728x90
728x90
728x90
 

itsecgames.com

 

www.itsecgames.com

[사진 1]

현재 웹페이지를 어디서 접속했는지에 대한 정보가 웹페이지에 출력된다(referer).

 

low

[사진 2]

low 레벨이다. 웹페이지 소스코드를 보면 i 태그 값으로 박힌 것을 확인할 수 있다.

 

[사진 3]

burp로 프록시를 잡아서 referer 값을 위와 같이 변조한다.

 

[사진 4]

위와 같이 쿠키 값이 출력된 것을 확인할 수 있다.

 

medium

[사진 5]

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

 

high

[사진 6]

high 레벨에선 XSS 공격이 먹히지 않는다.

 

[사진 7]
[사진 8]

서버 코드를 보면 medium 레벨은 addslaehs() 함수, high 레벨의 경우 htmlspecialchars() 함수엥 의해 입력 값이 필터링된다. medium 레벨에서만 XSS 공격이 통하는 이유는 addslashes() 함수는 XSS 공격에 사용되는 특수문자 "<" 꺽쇄를 필터링하지 않기 때문이다. 따라서, high 레벨에서는 XSS 공격이 어렵겠다.

 

* PHP addslashes() Funfction

 

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