728x90
728x90
728x90
 

itsecgames.com

 

www.itsecgames.com

[사진 1]

요청 패킷의 헤더 중 bWAPP 헤더를 이용하여 XSS 공격을 하라는 것 같다.

 

low

[사진 2]

burp로 프록시를 잡아보면 bWAPP 헤더가 존재하지 않는다.

 

[사진 3]

임의로 bWAPP 헤더를 생성하고 script 태그를 작성한다.

 

[사진 4]

그럼 위와 같이 쿠키 값이 웹페이지에 출력된다.

 

medium

[사진 5]

medium 레벨에서도 XSS 공격이 먹힌다.

 

high

[사진 6]

high 레벨에서는 script 태그가 일반 문자열로 출력된다.

 

[사진 7]

서버 코드를 보면 헤더 정보를 가져와서 bWAPP이라는 헤더가 있으면 데이터를 웹페이지로 반환해준다.

 

[사진 8]
[사진 9]

레벨에 따라 필터링이 나뉘는데, 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

728x90
728x90

+ Recent posts