일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 탈중앙화
- 메타코드
- ELB
- 보안 그룹
- web security academy
- 정보처리기사
- File Upload
- systems manager
- AWS CLI
- 스마트 컨트랙트
- Session Manager
- metacode
- 스마트컨트랙트
- splunk db connect
- web3 보안
- 오블완
- aws 트리거
- 정처기 필기
- 블록체인
- web3
- metacodem
- AWS SSM
- 정처기필기
- 정처기
- 티스토리챌린지
- web shell
- aws lambda
- 메타코드M
- amazon s3 트리거
- Path Traversal
- Today
- Total
min8282
[File upload] Web shell upload via extension blacklist bypass 본문
[File upload] Web shell upload via extension blacklist bypass
min8282 2025. 4. 17. 17:02This lab contains a vulnerable image upload function. Certain file extensions are blacklisted, but this defense can be bypassed due to a fundamental flaw in the configuration of this blacklist.
To solve the lab, upload a basic PHP web shell, then use it to exfiltrate the contents of the file /home/carlos/secret. Submit this secret using the button provided in the lab banner.
You can log in to your own account using the following credentials: wiener:peter
You need to upload two different files to solve this lab.
Lab: Web shell upload via extension blacklist bypass | Web Security Academy
This lab contains a vulnerable image upload function. Certain file extensions are blacklisted, but this defense can be bypassed due to a fundamental flaw in ...
portswigger.net
이번 실습 페이지에는 취약한 이미지 업로드 기능이 포함되어 있다. 특정 파일 확장자는 블랙리스트에 등록되어 있지만, 이 블랙리스트 구성의 근본적인 결함 때문에 방어책을 우회할 수 있다.
문제를 해결하려면 기본 PHP 웹 셸을 업로드한 후, 이를 사용해서 /home/carlos/secret 파일 내용을 추출해야 한다. 랩 배너에 제공된 버튼을 사용하여 플래그?를 제출하면 된다.
로그인 계정: wiener/peter
랩으로 들어오면 기본적인 블로그 형태의 웹페이지를 볼 수 있다.
파일 업로드를 위해 주어진 계정으로 로그인을 한다.
로그인을 완료하면 My Account 페이지로 이동되고 파일 업로드 기능을 확인할 수 있다. 임의의 이미지 파일을 업로드한다.
정상적으로 업로드가 되었다는 메시지를 확인할 수 있다. 다시 My Account 페이지로 이동한다.
내가 올린 이미지 파일이 업로드된 것을 볼 수 있다.
이번에는 PHP 웹 셸을 업로드 시도를 했다.
.php 확장자가 필터링되어 업로드가 실패한 것을 알 수 있었다.
세상에 없는 확장자로 변경해서 업로드 시도를 했다.
업로드 성공 시 출력되는 메시지가 출력됐다.
My Account 페이지로 돌아와 보면 위와 같이 되어 있다.
응답 데이터를 확인해 본 결과 위와 같이 업로드된 파일 내용 그대로 나타나는 것을 확인할 수 있다.
현재까지 알 수 있는 것)
- php 확장자는 필터링되어 업로드가 불가능하다.
- 블랙리스트에 포함되지 않는 확장자는 업로드가 가능하다.
- 업로드된 내용을 그대로 볼 수 있다.
AddType application/x-httpd-php .jwajwa
.htaccess 는 다음과 같다.
htaccess 확장자의 파일이 업로드를 먼저 하고
.jwajwa 확장자의 웹 셸을 다시 업로드하면
이번에도 마찬가지로 업로드가 된다.
하지만 .htaccess를 업로드하기 전과 다르게 웹 셸 파일의 내용이 텍스트 그대로 출력되는 게 아니라 PHP 코드로 인식해 실행되어 /home/carlos/secret 파일의 내용 볼 수 있다.
이제 해당 파일의 내용을 상단 배너 Submit 버튼을 눌러 제출하면 해결할 수 있다.
'Web Security Academy' 카테고리의 다른 글
[Path traversal] File path traversal, traversal sequences stripped with superfluous URL-decode (0) | 2025.04.18 |
---|---|
[File upload] Remote code execution via web shell upload (1) | 2025.04.17 |