2012-02-22 8 views
1

가능한 중복 :
What are the best practices for avoiding xss attacks in a PHP site
Examples of XSS that I can use to test my page input?예/PHP에서 XSS 공격의 유형은

예/PHP에서 클라이언트 측 XSS 공격의 유형이며 어떻게 무엇을 방지 할 수있다 ?

+6

참조 : [? 내 페이지의 입력을 테스트하는 데 사용할 수있는 XSS의 예 (http://stackoverflow.com/questions/7232405/examples-of-xss-that-i-can-use- test-my-page-input), [PHP 사이트에서 xss 공격을 피하는 가장 좋은 방법은 무엇입니까?] (http://stackoverflow.com/questions/71328/what-are-the-best-practices-for -avoiding-xss-a-php-site), [XSS 공격이 실제로 어떻게 작동합니까?] (http://stackoverflow.com/questions/3364427/how-xss-attack-really-works), http : //stackoverflow.com/search?q=xss+php ... –

+0

https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet – Cheekysoft

답변

0
  1. 일반 텍스트는 HTML입니다. htmlspecialchars로 일반 텍스트를 이스케이프하는 것을 잊었을 때. 예방이 필요하지 않습니다. PHP에서 템플릿을 사용할 때 변수를 그냥 이스케이프 처리하십시오. 또는 smarty/twig/etc를 사용하십시오.

  2. HTML은 HTML로 사용자가 HTML (fckeditor/tinymce/plain HTML/etc)을 만들도록 허용 한 경우. HTML 살균 소독제를 사용하십시오.

  3. HTML 코드를 HTML로 변환합니다. 정규식 기반 파서를 사용하지 마십시오. FSM- 파서 만 사용하십시오.