Re: JavaScript Injection ???
| From: | Daniel Brown | Date: | Mon, 18 Apr 2011 18:46:09 +0000 |
| Subject: | Re: JavaScript Injection ??? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312442@lists.php.net to get a copy of this message | ||
On Mon, Apr 18, 2011 at 14:42, tedd <tedd@sperling.com> wrote:
>
> No, I had a simple form where IF the user entered:
>
> <script> alert("Evil Code");</script>
>
> -- into the form's text field (i.e., $_POST['text'] ) AND clicked Submit,
> the form would
>
> echo( $_POST['text'] );
>
> -- and that would produce a JavaScript Alert.
>
> Here's the form:
>
> http://php1.net/a/insecure-form/index.php
>
> It was a simple working example of JavaScript Injection. But it no longer
> works and I want to find out why. The most popular reason thus far is
> "Browsers have changed", but I'm not sure as to what did change.
Look at the post-processing source --- note the slashes. Apply
stripslashes() to the output on the PHP side and all should be right
again with the world.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/