How can I allow my user to insert HTML code, without risks? (not only technical risks)

后端 未结 10 825
一生所求
一生所求 2020-12-09 05:41

I developed a web application, that permits my users to manage some aspects of a web site dynamically (yes, some kind of cms) in LAMP environment (debian, apache, php, mysql

10条回答
  •  春和景丽
    2020-12-09 06:11

    It doesn't really matter what you're looking to remove, someone will always find a way to get around it. As a reference take a look at this XSS Cheat Sheet.

    As an example, how are you ever going to remove this valid XSS attack:

    
    

    Your best option is only allow a subset of acceptable tags and remove anything else. This practice is know as White Listing and is the best method for preventing XSS (besides disallowing HTML.)

    Also use the cheat sheet in your testing; fire as much as you can at your website and try to find some ways to perform XSS.

提交回复
热议问题