Directory traversal

Introduction


Path Traversal, 또는 Directory Traversal 이라고도 불리는 해당 취약점은, 공격자가 웹 애플리케이션의 URL을 교묘히 조작해 애플리케이션의 루트 폴더 밖에 존재하는 파일이나 디렉터리에 접근하도록 만드는 웹취약점입니다.

이미지·정적 텍스트·코드 등 다양한 파일을 포함시키면서 입력값 검증을 제대로 구현하지 못할 때 발생하며,공격자는 주로 ../(점-점-슬래시)와 같은 시퀀스, 혹은 유사한 구문을 입력 필드에 주입해 웹 애플리케이션의 경로 제한을 우회하고 원하는 시스템 파일에 접근할 수 있습니다..

이 취약점은 다음과 같이 CVSS 7.3(High) 위험도로 분류됩니다.

  • CWE-22 : “제한된 디렉터리에 대한 경로명을 부적절하게 제한(‘Path Traversal’)”

  • CWE-35 : “Path Traversal: ‘…/…//’”

  • CWE-73 : “Directory Traversal”

  • CWE-200 : “권한 없는 주체에게 민감 정보 노출”

또한 OWASP Top 10 에서는 아래 항목과 관련이 있습니다.

  • A05:2021 - Security Misconfiguration

  • A01:2021 - Broken Access Control

Linux Server Path Traversal Exploitation


Important Linux Files
  • 운영 체제‧시스템 정보

    /etc/issue
    /etc/group
    /etc/hosts
    /etc/motd

  • 프로세스 관련

    /proc/[0-9]*/fd/[0-9]*       # 첫 번째는 PID, 두 번째는 파일 디스크립터
    /proc/self/environ
    /proc/version
    /proc/cmdline
    /proc/sched_debug
    /proc/mounts
    

  • 네트워크 상태

    /proc/net/arp
    /proc/net/route
    /proc/net/tcp
    /proc/net/udp

  • 현재 작업 디렉터리

    /proc/self/cwd/index.php
    /proc/self/cwd/main.py

  • 인덱스(DB) 파일

    /var/lib/mlocate/mlocate.db
    /var/lib/plocate/plocate.db
    /var/lib/mlocate.db

  • 자격 증명‧히스토리

    /etc/passwd
    /etc/shadow
    /home/$USER/.bash_history
    /home/$USER/.ssh/id_rsa
    /etc/mysql/my.cnf

  • Kubernetes 서비스어카운트

    /run/secrets/kubernetes.io/serviceaccount/token
    /run/secrets/kubernetes.io/serviceaccount/namespace
    /run/secrets/kubernetes.io/serviceaccount/certificate
    /var/run/secrets/kubernetes.io/serviceaccount

Windows Server Path Traversal Exploitation


Important Windows Files
  • 운영 체제 및 시스템 정보

    C:\Windows\win.ini                          
    C:\Windows\System32\license.rtf             
    C:\Windows\System32\drivers\etc\hosts       
    C:\Windows\System32\config\systemprofile    

  • 사용자 및 자격 증명 관련

    C:\Users\Administrator\NTUSER.DAT
    C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
    C:\Users\<USERNAME>\.ssh\id_rsa
    C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

  • 시스템 설정 및 인증 관련

    C:\Windows\System32\config\SAM
    C:\Windows\System32\config\SYSTEM
    C:\Windows\System32\config\SECURITY

  • 프로세스 및 환경 관련

    C:\Windows\System32\Tasks
    C:\Windows\System32\drivers
    %TEMP%\
    %APPDATA%\

  • 네트워크 관련

    C:\Windows\System32\LogFiles\Firewall\pfirewall.log
    C:\Windows\System32\winevt\Logs\Security.evtx

  • 데이터베이스 및 애플리케이션 설정

    C:\Program Files\MySQL\MySQL Server X.X\my.ini
    C:\inetpub\wwwroot\web.config
    C:\Program Files (x86)\Steam\config\loginusers.vdf

  • Kubernetes / Docker 환경

    C:\Users\<USERNAME>\.kube\config
    C:\ProgramData\Docker\config\daemon.json
    C:\ProgramData\Docker\containers\<CONTAINER_ID>\config.v2.json

Mitigation


Last updated