New PHP Interpreter Finds XSS, Injection Holes
rkrishardy writes "A group of researchers from MIT, Stanford, and Syracuse has developed a new program, named 'Ardilla,' which can analyze PHP code for cross-site scripting (XSS) and SQL injection attack vulnerabilities. (Here is the paper, in PDF, and a table of results from scanning six PHP applications.) Ardilla uses a modified Zend interpreter to analyze the code, trace the data, and determine whether the threat is real or not, significantly decreasing false positives." Unfortunately, license issues prevent the tool in its current form from being released as open source.
New PHP Interpreter Finds XSS, Injection Holes
Fixed it for you.
I don't use SQL you insensitive clods!
New PHP Interpreter Findx XSS, Injection Holes
New PHP Interpreter Finds XSS, Injection Holes
Fixed it for you.
Clearly the title was trying to illustrate the PHP interpreter's ability to solve the pythagorean theorem.
My work here is dung.
it probably hasn't been open sourced because it's full of security holes
From the results paper: "Part of Ardilla's implementation depends on modifications to the open-source Zend interpreter...made (for a different purpose) by a student while he was an intern at IBM. We have since made many more modifications, but since the original small diffs are owned by IBM, we cannot release either those original modifications or our later work that builds on them...It would be valuable for someone to re-implement the original changes, so that we could release our entire system as we would prefer. "
How would these changes be "re-implemented" - would the code have to be re-engineered, or would a trawl through the original code (patching in changes verbatim) be acceptable? Otherwise, would somebody have to find alternative syntax for implementing the same functionality? Barrel of worms methinks.
Although it would be nice to be able to use this, I'd imagine there'd be lots of damage following from widespread release of this program without a quick turnaround on fixing vulnerable sites.
... reminds me on Perl's taint mode where all external input data is traced until it was explicitly checked through a regular expression or similar.
Same program, just in one line, hence easier to understand: perl -nE'say q(Exploit found) if /php/i' *
i cant even find where to download a closed source version of it. is it available at all?
The basic issue here is that most PHP code does not currently use Frameworks, and many PHP developers aren't exactly experienced enough to know what XSS or SQL Injection are.
The problem will never really be fixed in PHP until some framework or at least methodology wins out as the PHP framework of choice.
It'd be nice if the PHP guys picked one and put their backing behind it, maybe even included it by default like they did APC for caching.
Just teach people how to code. When a function or subsystem expects a certain format as a precondition on its input, you actually have to make sure you enforce that precondition (in the case of PHP applications, you simply need to apply trivial conversions such as htmlspecialchars() or mysql_escape_char() depending on whether you want to use that input to generate HTML or XML or to include it into a MySQL request -- this is enough to get rid of XSS and SQL injections completely).
There would be no need for such tools if PHP developers actually were software engineers rather than kiddies surfing on the web hype that barely understand the tools they're manipulating.
And I wonder, are the maintainers of schoolmate and webchess now frantically patching their code? None of the articles gives dates - although the PDF is more than 18 months old.
"A group of researchers from MIT, Stanford, and Syracuse has developed a new program, named 'Ardilla,' which can analyze PHP code for cross-site scripting (XSS) and SQL injection attack vulnerabilities. (Here is the paper, in PDF, and a table of results from scanning six PHP applications.) Ardilla uses a modified Zend interpreter to analyze the code, trace the data, and determine whether the threat is real or not, significantly decreasing false positives."
They've written a program named: 'Ardilla,', complete with a comma in the name. Complete sentences in parenthesis. misspelled word in headline. Seriously kdawson, it's not like you're going for "frist post". Take a minute or two to fucking edit.
Megan Fox's Tits
Or the lack thereof..
There is a similar tool available under a BSD license called PHPAudit, but it does seem to generate a few more false positives than the one linked in this article... It's site is http://phpaudit.precor-incorporated.com/
How many XSS and SQL vulnerabilities would be a non-issue if the PHP language made it impossible for these to occur by default without
explicit indication that it should be allowed?
Don't tell me its impossible or even hard because I've been there done that.
I agree that it is possible (but difficult) to identify sql injection vulnerabilities with automated code inspection. I do not think XSS can be identified so easily. In a web app, user-submitted text is added to a database. Then who-knows-what happens to it. Eventually, something based on that text is submitted as output, at which time special characters must be escaped.
The only way to accurately identify XSS in such a scenario is to track the input from the user, into the database, and back out, so that you know the special characters are escaped. That's not something software could accurately do for a general case, without tons of false positives.
A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
Unfortunately, license issues prevent the tool in its current form from being released as open source.
The existence of a tool (even if it's pricey) is invaluable; especially when compared to inferior tools. If we want a FOSS solution, all that's stopping us is ourselves.
There are no perfect answers, only the right questions. More questions at http://foresightandhindsight.blogspot.com/
If people aren't using escaping functions like that at all then this tool isn't really needed, a simple parser could see the functions aren't being called. This tool seems like it may be useful for catching occasional cases where something has mistakenly being omitted. Ie because people are imperfect, not because they are clueless.
That said I don't think it's really something that developers should have to care about. PHP is primarily a language for interacting with databases and web browsers and as such should make this easier (to the extent of not requiring any code at all). I work on PHP applications and we have a heap of code using all the escaping functions and it makes an ugly, overly verbose mess. I'm currently near the end of a DB layer which takes care of escaping automatically (the layer 'knows' the DB schema and uses that knowledge to validate and escape input automatically).
The coder shouldn't need to state that data going to the DB needs escaping, it should happen automatically.
Similarly I'm disappointed that things like Smarty need special instruction in order to escape variables heading to the browser. Almost everything in a web app should be escaped, Smarty should do that be default and require a special modifier to be set in the rare instances it isn't desired.
Boffoonery - downloadable Comedy Benefit for Bletchley Park