728x90
728x90
728x90
 

itsecgames.com

 

www.itsecgames.com

[사진 1]

First name, Last name을 입력하면 웹페이지에 출력해준다.

 

[사진 2]

위와 같이 웹페이지에 그대로 출력된다.

 

low

[사진 3]

low 레벨이다. low 레벨의 경우 script 태그를 삽입하면 웹페이지에 그대로 박혀서 동작하는 것을 확인할 수 있다.

 

medium

[사진 4]

medium 레벨도 low 레벨과 마찬가지로 XSS 공격이 먹힌다.

 

high

[사진 5]

high 레벨의 경우 XSS 공격이 먹히지 않는다.

 

[사진 6]
[사진 7]

서버 코드를 보자. 먼저, medium 레벨의 경우 addslahes() 입력 값이 필터링된다. addslashes() 함수의 경우 single quote, double quote, backslash, NULL 값만 필터링하는데, XSS 공격에 사용되는 특수문자는 해당되지 않으므로 medium 레벨에서 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

www.php.net/manual/en/function.htmlspecialchars.php

 

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