views:

64

answers:

2
+1  Q: 

PHP tags in URL

So I made a landing page for all these forms that the marketing department at my work makes. One of the fields they pass is a URL that I redirect to after I'm done processing - a thank you page.

Recently, I discovered a URL that looked like this:

http://www.oursite.com/folder/thank-you.php?thankyou=free-guide&amp;amp;adgroup=&lt;?php echo nfpa-c ?>&amp;reference=<?php echo  ?>

Does this amount to anything but the form creator being dumb? My page is throwing huge errors about security and cross-site scripting, etc. What are the implications of this? Is there any legitimate reason to do this?

EDIT/UPDATE: My landing page is in ASP.NET. The error it mentions is possible cross-site scripting.

+3  A: 
<?php echo nfpa-c ?

I don't think it's the poster being dumb - this looks more like an outgoing form was not setup properly (e.g. PHP instructions used in a .html page that doesn't get parsed by the PHP interpreter.)

Check out the originating forms and look into their source code.

Pekka
Actually, this is hardcoded into an input field.<input type='hidden' name='success' value='*'> * the url from above
Brandi
@Brandi it's very likely meant to be parsed by PHP, isn't it?
Pekka
Quite possibly, but since it's not a variable, it's just outputting hardcoded text, it makes me think this is a really bad practice to put the tags in the url. They aren't going to want to change their forms, so I'm wondering what the implications are of just allowing this and turning the validation on my page to false?
Brandi
@Brandi there are no security implications as such on your end, but there could be sensitive data in the PHP source in the sending form. Also, it's well possible that statistical data (adgroups..?) is getting lost.
Pekka
So, someone could not post to my page a url that did something harmful if I just allow script to exist without any validation? So I could make a new page with <input type='hidden' name='success' value='http://mysite.com/<? php BADCODE ?>'>, and simply redirecting to that page will not be harmful to anyone involved?
Brandi
@Brandi nope, it would be totally harmless: If the code is not executed on your page straight away, it's just a meaningless series of characters.
Pekka
@Pekka: Thanks. :)
Brandi
+1  A: 

There is no legitimate reason to pass PHP code on the url like this. In fact it would be a Remote Code Execution Vulnerability, which is as bad as it gets its like like saying "Check Mate". I would make sure that that you don't have this code running, although its likely a bug because in php they would use eval("echo 'nfpa-c'");, you can't eval php tags like that, so its probably untested code.

Rook
This was exactly it. They made a syntax error and we convinced them to fix it.
Brandi
Assuming the PHP code came in there by accident, how is this a vulnerability?
Pekka
@Pekka passing php code in as a GET parameter is most defiantly a vulnerability, this bug however is not.
Rook