I am currently in a project with a PHP frontend. We’re pretty concerned about security, because we’ll have quite a lot of users and are an attractive target for hackers. Our users are able to submit HTML formatted content that is visible to other users later. This is a big problem because we’re vulnerable for the whole set of XSS attacks. We’re filtering as good as we can, but the variety of attack vectors is pretty big.
So, I’m searching for PHP based HTML sanitizing/filtering solutions. Commercial solutions are fine (even preferred). Currently we’re using a modified HTML purifier, but we’re not satisfied with the results.
What are some good libraries/tools that are capable of filtering malicious parts of HTML?
It is nice to have for example HTML5 awareness, which will become a security nightmare once it’s available “in the wild”.
Update:
We’re doing an in-depth configuration of HTML Purifier. It looks like the older framework we used before was just not configuring it at all. Now the results look much better.
HTML Purifier project
Personally I have had very good results with the HTML Purifier project
It is highly customizable and has a huge code base. The only issue is uploading the files to your server.
Are you sure you have not got a configuration issue with your installation? As the purifier should not let through any HTML tags at all if configured correctly.
From the web site:
I wrote an article about how to use the HTML purifier library with CodeIgniter here.
Maybe it will help with giving it another try: