Re: XSS Vulnerabilities and strip_tags

From: Date: Fri, 12 Mar 2004 18:28:11 +0000
Subject: Re: XSS Vulnerabilities and strip_tags
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180274@lists.php.net to get a copy of this message
i didnt know what XSS was, just read it on webopedia.com now, maybe i got the wrong idea... strip_tags should prevent a kind of explotation, but maybe its behavior is not exactly what you want... see also htmlentities (http://www.php.net/htmlentities) you need to ask yourself how the environment that you are using will interpret things if you are sending "SELECT ... FROM ... WHERE field1='". $_POST['field1'] ."'", if $_POST['field1'] is: 0' OR field2=0 AND ''=' the resulting string would be: SELECT ... FROM ... WHERE field1='0' OR field2=0 AND ''='' and you probably dont want people making queries as they like hehe dont let ppl upload files and save them as .php or any other extension that would trigger a special behavior on the server that they shouldnt be able to remember you can never trust input data... trlists@clayst.com wrote:
Is the general wisdom that using strip_tags on input is sufficient to protect against XSS vulnerabilities from that input? I have been doing some reading on it but haven't found anything that suggests a vulnerability that removing the tags in this way would not cure. Are there multi-level encodings that can get past strip_tags? I probably should also be doing a urldecode before strip_tags to get around any hex encodings, or does strip_tags handle that? Thanks for any info, -- Tom


« previous php.general (#180274) next »