Saturday, August 13. 2005
Tobias Schlitt gave me a link to the article
10 Tips That Every PHP Developer Should Know, Part 2 by Jeffery Vaska that recently appeared on
phpbuilder.com. I was kinda shocked when I saw Tip #5, that describes howto deal with
$_GET and
$_POST. It mentions that a developer can use
extract($_POST) to eliminate the need of assigning every single entry manually. It also mentions:
This is a matter of
convenience and is not always a best practice.
It completely fails to mention, that using extract() without using prefixes or the parameter EXTR_SKIP is usually a very big security hole, because it allows an external attacker to overwrite every variable, including the superglobals (unless you use the Hardening-Patch) and this can lead in many cases to SQL injection or even Remote Code Execution Vulnerabilities.
Gulftech has recently released an advisory for Squirrelmail, that describes exactly such an extract($_POST) flaw.