note 69323 added to function.extract

From: Date: Thu, 31 Aug 2006 17:05:10 +0000
Subject: note 69323 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-116546@lists.php.net to get a copy of this message
It's really easy to open gaping security holes using extract() on $_REQUEST, $_GET, etc. You have to be really sure of what you're doing, and use the proper flags on extract() to avoid clobbering important variables. For instance, the submission by kake26 at gmail dot com will not only perfectly emulate register globals (that's bad), but it'll store it in a database and recall the same variables every time the script runs (essentially allowing an attacker to attack your script every time it runs via one attack). Oops! To fix it, you'd have to get creative with flags. Maybe you could use EXTR_PREFIX_ALL instead of EXTR_OVERWRITE, for example. Of course, you should also sanitize the form elements to ensure there's no php code in them, and also to make sure any very important variables aren't in the form data. (like the classic $is_admin = true attack) ---- Server IP: 64.71.164.2 Probable Submitter: 192.188.162.7 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.extract.php Edit -- https://master.php.net/note/edit/69323 Del: integrated -- https://master.php.net/note/delete/69323/integrated Del: useless -- https://master.php.net/note/delete/69323/useless Del: bad code -- https://master.php.net/note/delete/69323/bad+code Del: spam -- https://master.php.net/note/delete/69323/spam Del: non-english -- https://master.php.net/note/delete/69323/non-english Del: in docs -- https://master.php.net/note/delete/69323/in+docs Del: other reasons-- https://master.php.net/note/delete/69323 Reject -- https://master.php.net/note/reject/69323 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116546) next »