HighDots Forums  

Form Reload with Tainted Values

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss Form Reload with Tainted Values in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Ruebner
 
Posts: n/a

Default Form Reload with Tainted Values - 04-28-2008 , 04:13 PM






Greetings,

Not one to second-guess users' intentions, I like to throw back at
them any text input that didn't make it through a couple of
basic preg_match()'d sanity checks. This means reloading the
form with the _unaltered_ input as respective 'value' attributes, combined
with a friendly error message for the merely befuddled. The downright
vicious may choke on their own pathetic attempts at XSS.

But, how sane is such an approach from a security perspective? Is there
anything that might come around and bite me in the ass?

Any input greatly appreciated.

Mike

Reply With Quote
  #2  
Old   
Joost Diepenmaat
 
Posts: n/a

Default Re: Form Reload with Tainted Values - 04-29-2008 , 02:24 AM






Michael Ruebner <njus (AT) lunchinglads (DOT) net> writes:

Quote:
Greetings,

Not one to second-guess users' intentions, I like to throw back at
them any text input that didn't make it through a couple of
basic preg_match()'d sanity checks. This means reloading the
form with the _unaltered_ input as respective 'value' attributes, combined
with a friendly error message for the merely befuddled.
Sound good in theory.

Quote:
The downright
vicious may choke on their own pathetic attempts at XSS.
*If* that's true, then the input can be used as an XSS attack -
they'll just have to lure some unsuspecting victim to the
error/feedback page you created.

Quote:
But, how sane is such an approach from a security perspective? Is there
anything that might come around and bite me in the ass?
Either you stop things like Javascript injection with proper escaping
etc, in which case it won't be a problem, or this will definitely bite
you.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


Reply With Quote
  #3  
Old   
Michael Ruebner
 
Posts: n/a

Default Re: Form Reload with Tainted Values - 05-01-2008 , 06:11 AM



Joost Diepenmaat:

Quote:
*If* that's true, then the input can be used as an XSS attack -
they'll just have to lure some unsuspecting victim to the
error/feedback page you created.
None of the returned values will ever be stored in a session (or make it
into the database), so I assume that hijacking and/or redirection will not
be an issue. Put another way around, if the attacker's browser will be the
only client to display rouge input, what's the harm to the rest of us?

Mike


Reply With Quote
  #4  
Old   
Chris Morris
 
Posts: n/a

Default Re: Form Reload with Tainted Values - 05-01-2008 , 06:23 AM



Michael Ruebner <njus (AT) lunchinglads (DOT) net> writes:
Quote:
Joost Diepenmaat:
*If* that's true, then the input can be used as an XSS attack -
they'll just have to lure some unsuspecting victim to the
error/feedback page you created.

None of the returned values will ever be stored in a session (or make it
into the database), so I assume that hijacking and/or redirection will not
be an issue. Put another way around, if the attacker's browser will be the
only client to display rouge input, what's the harm to the rest of us?
vulnerable.php => <?php print ($_GET['print']); ?>

<a href="vulnerable.php?print=<script>alert(document. cookie)</script>">
Please follow this link</a>

The attacker is the person who creates the link (or form, if it's a
POST-based attack instead).
The victim is the person who gets tricked into clicking on it.
They don't need to be the same person.

Persistent XSS, where the value gets stored in the database and then
redisplayed, is *worse* than this because the victims just have to
look at the legitimate site, and the more that look, the worse it
gets. However, tricking someone into clicking on a link on a
relatively unrelated web page is not exactly difficult.

With most common web programming languages making it incredibly
difficult to avoid filling code with XSS bugs, it's not an easy thing
to ensure doesn't happen, but it's absolutely necessary.

http://www.cgisecurity.com/articles/xss-faq.shtml has a few more examples.

--
Chris


Reply With Quote
  #5  
Old   
Michael Ruebner
 
Posts: n/a

Default Re: Form Reload with Tainted Values - 05-02-2008 , 07:20 AM



Chris Morris:

Quote:
The attacker is the person who creates the link (or form, if it's a
POST-based attack instead).
The victim is the person who gets tricked into clicking on it.
They don't need to be the same person.
OK. Got it. I was stuck on persistent XSS and lost sight of the simpler
things in life ;-)

Thanks for your, and Joost's, input.

Mike


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.