Re: This code using _GET exploitable
| From: | Virgilio Quilario | Date: | Wed, 11 Mar 2009 12:55:56 +0000 |
| Subject: | Re: This code using _GET exploitable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289847@lists.php.net to get a copy of this message | ||
> filtered schreef:
>> Hi,
>>
>> we have script containing
>>
>> <? echo $_GET['studio'] ?>
>
> let say I do:
>
> example.com/yourscript.php?studio=<script type="text/javascript">alert('I
> am an evil haxor');</script>
>
> excusing the fact that the query is not urlencoded, what happens on your site
> (replace domain and script name to match your site/script)
>
>
>>
>> and
>>
>> <?
>> $cam = $_GET['cam'];
>>
>> if ($cam == '1') {
>> echo '<img
>> src="http://example.com"" />';
>> }
>
>
> if ($_GET['cam'] === '1')
> echo '<img
> src="http://example.com" />';
>
> no need to create the $cam var, and a little better to check for the exact value+type (===)
>
>> ?>
>>
>> Is this code prone to XSS attacks or for attacking the local webserver
>> and if so, how?
>>
>> $cam isn't used anywhere else.
use htmlentities() to display $_GET['studio']
like below.
<?php echo htmlentities($_GET['studio']); ?>
Virgil
http://www.jampmark.com
Free tips, tutorials, innovative tools and techniques for building and
improving web sites.