2025. 2. 23. 14:19ㆍWeb Security/웹 해킹
많은 프레임 워크는 개발의 필요성 때문에 디버그 모드를 지원한다. 이에 디버그 모드 활성화 후 배포에 따른 RCE 가능성에 대하여 글을 쓰고자한다. RCE 왜에도 jwt key 등 중요정보들이 leak 될 수 도 있다.
FLASK 프레임 워크
아래의 사진을 보면 FLASK debug모드가 켜진 상태이다. 아래는 디버그 모드에서 파이썬 쉘을 사용하기 위해서 필요한 pin 번호가 만들어지는 코드이다. 버전 및 환경 마다 다르지만, 아래와 같은 파일을 유출할 수 있는 LFI 취약점이 존재한다면 RCE가 발생할 수 있다.
/etc/machine-id
/proc/sys/kernel/random/boot_id
/proc/self/cgroup
/sys/class/net/<network interface>/address
/etc/passwd
https://github.com/pallets/werkzeug/blob/main/src/werkzeug/debug/__init__.py
werkzeug/src/werkzeug/debug/__init__.py at main · pallets/werkzeug
The comprehensive WSGI web application library. Contribute to pallets/werkzeug development by creating an account on GitHub.
github.com
참고 :
https://b33pl0g1c.medium.com/hacking-the-debugging-pin-of-a-flask-application-7364794c4948
Hacking the Debugging Pin of a Flask Application
Hola, Hackers and Developers! In this article, I am going to show you why leaving keeping Debug Mode on for a Flask Production Server is a…
b33pl0g1c.medium.com
DJANGO
과거 SSRF 공격을 할 때, 어떻게 숨겨진 endpoint에 공격을 가할 수 있을까 고민한적이 있다. 아래 사진으로 보면 DEBUG 모드가 켜져있다면 andpoint을 제공해준다. 이외에도, DB 스키마 정보, 다양한 스택 트레이스 정보를 제공함 으로써 해킹에 유용하게 사용될 수 있다.
https://medium.verylazytech.com/why-djangos-debug-true-is-a-goldmine-for-hackers-01486289607d
Why Django’s [DEBUG=True] is a Goldmine for Hackers
Misconfigurations are often the weakest link in an otherwise secure environment. One of the most dangerous yet easily overlooked…
medium.verylazytech.com
https://blog.vidocsecurity.com/blog/escalation-of-debug-mode-in-django/
Escalating debug mode in Django to RCE, SSRF, SQLi
Security implications of DEBUG=true in Django. Learnings from an ethical hacker's perspective
blog.vidocsecurity.com
'Web Security > 웹 해킹' 카테고리의 다른 글
ByPass WAF using HTTP header (0) | 2025.01.11 |
---|---|
PHP Session Poisoning using LFI (0) | 2025.01.09 |
file upload & download & reverse shell (11) | 2024.11.15 |
blind sql injection (1) | 2024.10.29 |
sql injection CTF vs real world. finger print (0) | 2024.10.27 |