728x90
728x90
728x90
 

itsecgames.com

 

www.itsecgames.com

[사진 1]

XSS 공격을 해보자. 이 문제는 이전 문제들 중 HTML Injection과 유사하다.

 

* bWAPP A1 HTML Injection - Reflected (GET) Write-up

 

bWAPP A1 HTML Injection - Reflected (GET)

itsecgames.com www.itsecgames.com HTTP Method 중 GET 방식을 이용한 HTML Injection 문제이다. 위와 같이 텍스트를 입력하면 입력한 텍스트가 웹페이지에 출력된다. 이 때 페이지 소스를 보면 태그와 태그..

0xe82de.com

 

low

[사진 2]

low 레벨이다. 위와 같이 소스코드에 추가할 script 태그를 First name에 기입하고 last name엔 h1 태그를 기입한다. 그리고 Go 버튼을 클릭하면 위와 같이 소스코드에 script, h1 태그가 그대로 박히고 웹페이지에 출력되는 것을 확인할 수 있다.

 

medium

[사진 3]

medium 레벨도 low 레벨과 마찬가지로 script, h1 태그가 소스코드에 그대로 박힌다.

 

high

[사진 4]

high 레벨의 경우 script, h1 태그가 정상적인 태그로 인식되지 않는다.

 

[사진 5]

소스코드를 봐도 태그가 작동되지 않고 일반 문자열로 인식된 것을 확인할 수 있다.

 

[사진 6]

서버코드를 보면 medium, high 레벨일 때 각각 xss_check_4(), xss_check_2() 함수에 의해 파라미터 값이 필터링된다.

 

[사진 7]

먼저 medium 레벨에서 사용되는 xss_check_4() 함수를 보면 PHP의 addslashes() 함수로 파라미터 값을 필터링한다. addslashes() 함수는 single quote, double quote, backslash, NULL 값을 제거하는데, 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

 

[사진 8]

다음으로 high 레벨에서 사용되는 xss_check_2(0 함수를 보면 PHP의 htmlentities() 함수가 사용된다. htmlentities() 함수는 전달받은 인자(파라미터 값)를 HTML 엔티티로 반환한다. 즉, javascript 태그나 html 태그를 일반적인 문자열로 바꿔주는 것이다. 그렇기 때문에 high 레벨에서 XSS 공격이 통하지 않았던 것이다.

 

* PHP htmlentitis() Function

 

PHP: htmlentities - Manual

I'm glad 5.4 has xml support, but many of us are working with older installations, some of us still have to use PHP4. If you're like me you've been frustrated with trying to use htmlentites/htmlspecial chars with xml output. I was hoping to find an option

www.php.net

728x90
728x90

+ Recent posts