Topic awaiting preservation: PHP injection security? (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: Australia |
posted 06-09-2006 06:26
Hi all... code: $myVar = $_POST['myVar'];
code: print $myVar . 'contains invalid characters, please try again';
|
Bipolar (III) Inmate From: Australia |
posted 06-09-2006 06:29
Or is it only a security issue if you use eval() ? |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 06-09-2006 10:26
That would only be an issue if you were using eval(), but, you're always open to cross site scripting if you don't php->htmlentity() everything you output (preferably: When you output it). code: $obj = new $var ( ... );
code: $obj = eval('return new '. get_class($this). '();');
|
Bipolar (III) Inmate From: Australia |
posted 06-09-2006 11:00
Thanks TP, |
Bipolar (III) Inmate From: Australia |
posted 06-12-2006 15:29
So just to clarify... |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 06-12-2006 17:21
Globals overwrite - in case your code ever runs under a system with register globals on. |
Bipolar (III) Inmate From: Australia |
posted 06-13-2006 01:40
Cool thanks, yeh I turn register globals off in htaccess, but i have never actually used registered globals anyway. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 06-15-2006 19:51
TP |
Bipolar (III) Inmate From: Australia |
posted 06-16-2006 01:57
Actually i can't remember what I was reading but they said you shouldn't store htmlentitied data in your database. Its meant to be used for the html you are about to output, purely so that certain characters (say quotes ") show up. |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 06-16-2006 10:07
because one of these day, you might wish to do something else with the data in your database - and then the entitites are going to be a hazzle. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 06-17-2006 01:32
Makes sense. |