bWAPP A3 Cross-Site-Scripting - Reflected (Custom Header)
itsecgames.com
www.itsecgames.com
요청 패킷의 헤더 중 bWAPP 헤더를 이용하여 XSS 공격을 하라는 것 같다.
low
burp로 프록시를 잡아보면 bWAPP 헤더가 존재하지 않는다.
임의로 bWAPP 헤더를 생성하고 script 태그를 작성한다.
그럼 위와 같이 쿠키 값이 웹페이지에 출력된다.
medium
medium 레벨에서도 XSS 공격이 먹힌다.
high
high 레벨에서는 script 태그가 일반 문자열로 출력된다.
서버 코드를 보면 헤더 정보를 가져와서 bWAPP이라는 헤더가 있으면 데이터를 웹페이지로 반환해준다.
레벨에 따라 필터링이 나뉘는데, medium 레벨의 경우 addslashes() 함수로 필터링을 하게 된다. 직전 문제와 마찬가지로 XSS 공격에 사용되는 특수문자들은 필터링되지 않기 때문에 XSS 공격이 먹히게 된다. high 레벨에서는 htmlspecialchars() 함수로 필터링을 하는데, XSS 공격에 사용되는 특수문자 "<"도 필터링이 된다. 따라서 XSS 공격이 어렵겠다.
* PHP addslashes() Function
PHP: addslashes - Manual
spamdunk at home dot com, your way is dangerous on PostgreSQL (and presumably MySQL). You're quite correct that ANSI SQL specifies using ' to escape, but those databases also support \ for escaping (in violation of the standard, I think). Which means that
www.php.net
* PHP htmlspecialchars() Function
PHP: htmlspecialchars - Manual
if your goal is just to protect your page from Cross Site Scripting (XSS) attack, or just to show HTML tags on a web page (showing on the page, for example), then using htmlspecialchars() is good enough and better than using htmlentities(). A minor point
www.php.net
'Wargame > bWAPP' 카테고리의 다른 글
bWAPP A3 Cross-Stie-Scripting - Reflected (HREF) (0) | 2020.11.23 |
---|---|
bWAPP A3 Cross-Site-Scripting - Reflected (Eval) (0) | 2020.11.18 |
bWAPP A3 Cross-Site-Scripting - Reflected (Back Button) (0) | 2020.11.18 |
bWAPP A3 Cross-Site-Scripting - Reflected (AJAX/XML) (0) | 2020.11.17 |
bWAPP A3 Cross-Site-Scripting - Reflected (AJAX/JSON) (0) | 2020.11.17 |