I've been assigned to one of my company's legacy webapps, and after a day or two of poking around the source, I've found an SQL injection vector similar to the following:
mysql_query("SELECT * FROM foo WHERE bar='" . $_GET['baz'] . "'");
I've tried to perform an SQL injection test against this, but it fails, due to PHP's magic_quotes_gpc
module being switched on.
I know magic_quotes_gpc
is dirty, but we have hundreds - if not thousands - of lines of code similar to the one above. We simply can't afford to switch magic_quotes_gpc
off, as this would leave code like this wide open to attack.
I'd like to know how 'exploitable' the code above is, and whether we should fix it immediately, or include the task of fixing it in with our other refactoring tasks.