|
Jun
30
1
|
Auditing for HTML Tainting |
|||||
Note: the code for the auditing script is located here. Even the terminology reflects the apathy. You "escape" SQL with mysql_real_escape_string(), but you "convert special characters" using "htmlspecialchars()" or "htmlentities()." In addition, there are huge glaring comments about why one should escape SQL. From mysql_real_escape_string(): But neither pages for the HTML escaping functions say anything along the lines of "You must escape your HTML, otherwise people can use carefully crafted parameters to tell the world you advocate pre-teen sex and link to NAMBLA (note: I nofollowed that link). Phew! Obviously, your site could also show support for other sites engaging in legal sex, or even boring spam links for casinos; but either way, you probably want to make sure you don't advocate any of the above without actually knowing it. Or maybe you're a black hatter who wants to snoop around to find some more benevolent free links. I don't care. Just don't advocate NAMBLA. I cannot stress enough that this is a major problem that is largely ignored. Fix affected sites or someone else will eventually make you fix it. I've posted an auditing script here. Basically, this code takes a list of pages, parses them, and picks out the forms on the pages. It sends the forms as is (values, checks in checkboxes in tact, etc.), but sets the first text box, assumed to be a sort of query-field, to "<h1>testing 123</h1>" using cURL. Then it searches for that string in the reponse to the form. If it's there verbatim, and unescaped, it's a potentially valid attack. I used a slightly-modified HTML parser written by Jose Solorzano, and a few regular expressions. Currently, you must provide a list of URLs you want to test. These can be derived from your web site logs somehow, or a call to the Yahoo REST API using the "site:" command. I will not provide the code for that to prevent script kiddies from running this script on "site:www.whitehouse.gov." Do what you wish; like anything, this tool can be used for good or evil, and can probably even get you arrested. </moral rant>. Have fun! Here's some sample output: Related posts: Code for HTML Auditing <? // +———————————————————————-+ // | HTMLParser | // | Simple HTML Parsing Library | // | Based on Jose Solorzano's Library; his notice is below. | // +———————————————————————-+ // | Portions Copyright (c) 2004-2005 Jaimie Sirovich | // +———————————————————————-+ // | This program is free software; you can redistribute it and/or |... XSS & HTML Injection are Frighteningly Trivial to Find at Harvard.edu This recent article mentions that XSS and HTML injection are... Find HTML Injection Vulnerabilities with Google Code Search I guess I think like a hacker, because I thought... WP HTML Taint Check <? /*Plugin Name: HTMLTaintCheckPlugin URI: http://www.seoegghead.com/Description: Checks for suspicious links in posts. MAKE SURE TO REPLACE YOUR EMAIL ADDRESS IN... Were You a Good Christian SEO This Year? Have you been a good Christian this year? No? So...
| ||||||
"Only One Wise Comment Banged Out Somewhere On The Internet ..."ha.ckers.org security lab - Archive » Free XSS reflection auditing tool[...] Jaimie Sirovich just released a tool for doing XSS relfection auditing this morning. The way he describes it's function is that it looks for parameters and injects a small snippet of HTML. If that HTML is seen once the server returns data you know it's vulnerable to XSS. Of course that's not always the truth, and there are many other forms of XSS that are missed by this approach but it's free, and you can't beat free. Of course, he is talking about it in context of Blackhat SEO, where you can raise your own page rank by injecting XSS into pages that have a high page rank. [...]
|


















