473,804 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validating Request.Params[] values for cross site scripting

Hello

To prevent scross site scripting I am validating each value in the
Request.Params collection against the following regular expression :

^[a-zA-Z0-9\.\-_'=+/ :]*$

This only allows the following characters :

a-Z
0-9
Jan 10 '06 #1
3 2041
(1) yes
(2) just go through Request.Form and Request.QuerySt ring individually

(3) I don't know your situation, but it all seems like overkill and
unecessary protection to me
(4)ASP.NET supports a validateRequest attribute on the @Page level or in the
web.config which does this for you

Karl
--
http://www.openmymind.net/

<oo******@yahoo .co.uk> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hello

To prevent scross site scripting I am validating each value in the
Request.Params collection against the following regular expression :

^[a-zA-Z0-9\.\-_'=+/ :]*$

This only allows the following characters :

a-Z
0-9
.
-
_
'
=
+
[space]
:

Which prevents the <, %3C or \u0022 methods of getting a malicous html
tags into the request.

My problem is that the Request.Params structure contains lots of other
values which are nothing to do with the form such as "ALL_HTTP" which
comes in as :

"HTTP_CONNECTIO N:Keep-Alive\r\nHTTP_A CC...etc.."

This fails my regular expression because of the slash characters so
that NO page will ever pass my validation!

I have two questions.

1) Can a malicous user edit the values in parameters such as ALL_HTTP,
which I think are http headers?

2) Is there a way to access only the form/url parameter values and not
the http headers?

thanks

Jan 10 '06 #2
I should say that validateRequest is only available in 1.1 and 2.0, not 1.0

Karl
--
http://www.openmymind.net/

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Od******** ******@TK2MSFTN GP09.phx.gbl...
(1) yes
(2) just go through Request.Form and Request.QuerySt ring individually

(3) I don't know your situation, but it all seems like overkill and
unecessary protection to me
(4)ASP.NET supports a validateRequest attribute on the @Page level or in
the web.config which does this for you

Karl
--
http://www.openmymind.net/

<oo******@yahoo .co.uk> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hello

To prevent scross site scripting I am validating each value in the
Request.Params collection against the following regular expression :

^[a-zA-Z0-9\.\-_'=+/ :]*$

This only allows the following characters :

a-Z
0-9
.
-
_
'
=
+
[space]
:

Which prevents the <, %3C or \u0022 methods of getting a malicous html
tags into the request.

My problem is that the Request.Params structure contains lots of other
values which are nothing to do with the form such as "ALL_HTTP" which
comes in as :

"HTTP_CONNECTIO N:Keep-Alive\r\nHTTP_A CC...etc.."

This fails my regular expression because of the slash characters so
that NO page will ever pass my validation!

I have two questions.

1) Can a malicous user edit the values in parameters such as ALL_HTTP,
which I think are http headers?

2) Is there a way to access only the form/url parameter values and not
the http headers?

thanks


Jan 10 '06 #3
Thanks Karl I now go through Request.Form as well, I missed that.

It always seemed like unnecessary protection to me until one of our
customers hired an internet security company to test our pages.

Without complete validation of request parameters it is possible that
our site (which prompts for card details on one page) is succeptible to
phishing. Phishing is where hackers send emails posing as our customer
requesting card details from the user. If the email recipient clicks
the link in the email then malicious script can be inserted into our
card details page which can send the card details to a malicious web
page; eg; by a window.open call in response to onclick of the submit
button.

Jan 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1964
by: Venkat | last post by:
Hi All, I would like to about Cross Site Scripting. I googled XSS and got the point what it is but didn't get how it is achieved. Can someone describe me with an example how an hacker does it. My intension is not to hack anything but i am preparing a presentation on this and would like to caution my team mates about the consequences of XSS and how to protect our web based applications from a possible attack.
7
3915
by: Scott M. | last post by:
How can I disable the cross-site scripting check for one particular page of a site?
0
1160
by: Earl Teigrob | last post by:
I want to allow users to input html (via a rich text box) or directly, into a form field, save it in a data store and then output that html to the browser, but not allow cross-site scripting. What is the minimum that I need to filter to prevent cross-site scripting? Can it check for any occurance of the "<script" tag and alter it so that no usable javascript can be inserting with the HTML? Thanks
6
2041
by: John | last post by:
I've beed trying to add the following MD5 hash to my webform as a hidden field, but it comes up as a security error: < input type="hidden" name="tester" value="Omoo/W0Yr6nBOGq9oNfvpw==" / > Any ideas why? the '==' seems to be the issue. John
10
3480
by: Mr Newbie | last post by:
DropDown lists and Listboxes do not appear in the list of controls and values passed back to the server on PostBack in Request.Form object. Can someone confirm this to be correct and possibly answer why ? The impact of this is that values added via javascript will never make it back to the server side code unless one does some jiggery pokery with hidden fields etc. If this is true, then I would like to understand the reason behind the...
0
1202
by: Anbu | last post by:
All, I'm hosting a web site on Windows 2003 server as default web site. Same server is also hosting Windows SharePoint Server 2003 on another port. When I access WSS site, it works fine. But while accessing the default site from the same browser or without deleting the cookies, it throws the following message. Description: Request Validation has detected a potentially dangerous
4
2170
by: Jacob JKW | last post by:
Having read the CLJ FAQ and having done extensive Googling, I do understand that in in general cross-domain iframe scripting is not permitted. One issue I have not seen directly addressed, however, is scripting across different but still "friendly" domains. Essentially I'd like to send a signal from the child to the parent in any form at all. I would think that there might exist a way to set some variable or object property that could...
3
2327
by: Jennifer.Berube | last post by:
okay...so I got this login script and I edited it all and it seems to run fine...IE it listens to the script as far as permissions go when I place a restriction on a page and when you login it redirects. But first it doesn't tell you that you're logged in and doesn't provide a logout feature. And most importantly if I type in a random username and password not listed in the database it doesn't seem to matter it still "lets me login"
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.