Lab: File path traversal, traversal sequences stripped with superfluous URL-decode

Lab: File path traversal, traversal sequences stripped with superfluous URL-decode

https://portswigger.net/web-security/file-path-traversal/lab-superfluous-url-decode

 

Lab: File path traversal, traversal sequences stripped with superfluous URL-decode | Web Security Academy

This lab contains a path traversal vulnerability in the display of product images. The application blocks input containing path traversal sequences. It then ...

portswigger.net

 


Directory Traversal 우회

 

/etc/passwd 확인하면 문제 해결

해당 문제는 경로순회 입력을 필터링하고 있으며, 이 입력을 사용하기 전에 URL decoding을 수행

[기본 설정] 프록시 설정, ACCESS THE LAB의 주소를 Burp Suite에 설정

 

(1) burp suite 설정 후 블로그를 새로고침하고, 수집된 패킷을 확인합니다.

 

(2) 하나의 패킷을 선택하여 Repeater로 보냅니다.

 

(3) filename을 변경하여 /etc/passwd 파일 내용을 확인합니다.

filename 변경 전

변경값 > ../../../../../etc/passwd

=> filename에 대해 필터링을 적용하고 있음을 알 수있음

 

(4) URL 경로 디코딩을 수행합니다.

문제에서 URL 경로에 대한 디코딩을 수행한다고 쓰여있습니다.

 

(4)-1 Decoder로 이동하여 " ../../../../../etc/passwd" 값을 URL 인코드를 합니다. (1회)

=> URL 인코드에서는 "  ../../../../../etc/passwd" 값을 "%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%65%74%63%2f%70%61%73%73%77%64" 이렇게 해석합니다.

 

(5) 인코드한 값을 공격구문으로 넣어봅니다.

=> 값이 나오지 않으므로 URL 인코드를 2회 실행합니다.

 

(6) Decoder로 이동하여 URL 인코드를 합니다. (2회)

=> 2회 인코딩 결과: %25%32%65%25%32%65%25%32%66%25%32%65%25%32%65%25%32%66%25%32%65%25%32%65%25%32%66%25%32%65%25%32%65%25%32%66%25%32%65%25%32%65%25%32%66%25%36%35%25%37%34%25%36%33%25%32%66%25%37%30%25%36%31%25%37%33%25%37%33%25%37%37%25%36%34

 

(7) 인코드한 값을 공격구문으로 넣어봅니다.

=> 경로 순환 문자열 필터링 없이 단순히 URL 인코드/디코드 형태는 Directory traversal 공격의 근본해결책이 되지 않습니다.