Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Major HTMLawed Security Issues
HTMLawed is used by Vanilla to sanitize HTML, however, that is NOT what it is intended for. HTMLawed is only designed to be used to ensure valid HTML. HTMLawed fails to sanitize against a number of major attack vectors, especially in the style attribute, which can be used for click-jacking, phishing, web-page overlays, defacement, and more.
This is mentioned at http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm#s2.5
For example, the following snippet can be used to display a div outside the post area:
I strongly recommend returning to something intended for security, such as HTML Purifier. Alternately, it is supposedly possible to write your own filter to sanitize the style attribute yourself. If abandoning HTMLawed is not an option, it might be ideal to lock down all styles except those used for basic text formatting.
This is mentioned at http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm#s2.5
For example, the following snippet can be used to display a div outside the post area:
<div style="width: 100px; height: 100px; position: absolute; bottom: 0; right: 0; background: red; opacity: 0.5; z-index: 10000;">this is a security test</div>A slight alteration could be used to exploit users via a clickjacking type attack:
<a href="http://attack.example.com" style="display: block; width: 100000px; height: 10000px; position: absolute; top: 0; left: 0; opacity: 0.0; z-index: 10000;">this is a security test</a>You can test either of the above non-persistently by copying into a reply and clicking preview.
I strongly recommend returning to something intended for security, such as HTML Purifier. Alternately, it is supposedly possible to write your own filter to sanitize the style attribute yourself. If abandoning HTMLawed is not an option, it might be ideal to lock down all styles except those used for basic text formatting.
Tagged:
-1
Comments
it appears that htmlawed does work to purify html. the site says
"use to filter, secure & sanitize HTML in blog comments or forum posts, generate XML-compatible feed items from web-page excerpts, convert HTML to XHTML, pretty-print HTML, scrape web-pages, reduce spam, remove XSS code, etc."
http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/index.php
the plugin shows its using htmlawed 1.1.9.3 and the most recent version is 1.1.9.4.
Maybe the plugin is not configured correctly, or the older version doesn't catch clickjacking?
you can test it for yourself here
http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawedTest.php
tested clickjacking script on html purifier and it stopped the attack
http://htmlpurifier.org/demo.php
There is a plugin to use HTML Purifier instead, and I plan to use that as a workaround. I'm raising the issue here because a security issue like this could cripple Vanilla's reputation, which would be a rotten shame.
@patnaik, Blanket denial of style would be a big problem for Vanilla, especially for forums where WYSIWYG editors are in use. Actually processing the contents of style would be a real chore, especially since the processing would have to be cross browser secure against any type of malformed styles that people could come up with. The only safe solution I can think of would be to parse the styles and rebuild them based on a whitelist and value validation. This isn't easy.
I'm sure this seems to you like an attack on HTMLawed. I'm sorry for that. I really desperately want to be able to use it (it would be VERY convenient.) My problem is that, as currently implemented, it isn't a safe/suitable way to sanitize of this type of content. It could be patched with a custom filter, but honestly, I couldn't find any "easy" way to do this. The recommended snippet glazed over the issue of how to *actually* use CSS Tidy to do this. After digging through the CSS Tidy documentation, I don't think it can actually be done that way, because CSS Tidy doesn't appear to support any type of custom property filtering.
@Mark @Todd
Have you had a chance to read over this discussion? care to comment?
if htmlawed is still active, are our setting just not configured correctly, and this is allowing this clickjacking script? Or is this a known issue that maybe the htmlawed team is working on? Maybe we could report this and submit a fix, then update the plugin on our side.
@patnaik - any chance you could help us to tighten up our htmLawed implementation so we don't have to go back to HtmlPurifier?
I looked at your code and the change helps, but there are still lots of ways around it. I'll send you a PM with more details, since this will be outside the realm of obvious attack vectors.
Sorry to be such a pain!
This will cause problems for people with wysiwyg and BBCode, but I think those issues can be dealt with separately.