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.5For 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.
-1 · ·
Comments
- Spam
- Abuse
0 · Insightful Awesome LOL ·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?
- Spam
- Abuse
0 · Insightful Awesome LOL ·you can test it for yourself here
http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawedTest.php
- Spam
- Abuse
0 · Insightful Awesome LOL ·tested clickjacking script on html purifier and it stopped the attack
http://htmlpurifier.org/demo.php
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·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.
- Spam
- Abuse
0 · Insightful Awesome LOL ·@Mark @Todd
Have you had a chance to read over this discussion? care to comment?
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·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.
- Spam
- Abuse
0 · Insightful Awesome LOL ·@patnaik - any chance you could help us to tighten up our htmLawed implementation so we don't have to go back to HtmlPurifier? :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·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!
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·This will cause problems for people with wysiwyg and BBCode, but I think those issues can be dealt with separately.
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·Is there a possible threat even after disabling position, z-index and opacity?
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·I see the "style" has been disabled, and it seems I can enable it by commenting line 53 in plugins/HtmlLawd/class.htmlawed.plugin.php
$Config['deny_attribute'] .= ',style';My question is: if I comment this line "style" will be working again, does that pose a threat?
There seems to be a work around against position, z-index and opacity in line 73
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·What are html alternatives to change font color?
- Spam
- Abuse
0 · Insightful Awesome LOL ·If you want to allow very much formatting you should probably switch your forum to use HTML Purifier. There's a plugin you can download for this.
- Spam
- Abuse
0 · Insightful Awesome LOL ·I'm the author of DaDaBIK, a PHP Web application generator, and I would like to use HTMLawed for my project too, because HTMLpurifier seems to me too complex and doesn't support PHP4.
However, it seems that there are other vulnerabilities than the style and class ones, that you solve disabling them.
I refer for example to the character encode checking problems or the attribute-based security vulnerabilities...anyway you can read all the limitations and problems here:
http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm#s2.8
So what do you think about and why didn't you consider these issues?
Thanks in advance.
Cheers,
Eugenio
- Spam
- Abuse
0 · Insightful Awesome LOL ·- Spam
- Abuse
0 · Insightful Awesome LOL ·Notice this topic thank to SPAM messages above. Apart this, the HTML security problems this thread is about has been solved? The argument is very interesting: maybe using the old good BBcode as only markup editor can be a solution?
- Spam
- Abuse
0 · Insightful Awesome LOL ·candyman @patnaik answers the question well, and he would know. It is all about using it appropriately.
btw I mentioned the class white-list approach aswell. You can also have limited styling, not really a problem.
Vanilla forums uses a style, they are happy to firefight tomfoolery. It really is not a problem to limit style to bbcode level. But you also get the benefit, of using broader html.
This really isn't as big an issue as has been made out. Out of the box the plugin is safe.
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
0 · Insightful Awesome LOL ·