close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Cross Site Scripting (XSS) issues when using URL Queries that are shown in the address field

Thread began 9/16/2020 11:10 am by Steve | Last modified 9/16/2020 12:52 pm by Ray Borduin | 14 views | 4 replies |

Steve

Cross Site Scripting (XSS) issues when using URL Queries that are shown in the address field

I have a client that is getting flagged as having XSS vulnerabilities on their site.
For instance we have a generic page that uses the URL string as a value in the page. These are Cities and allow a number of pages to have some SEO benefit without having to write Content for each city.

Example:
https://www.savonhomes.com/cities.php?id=Riverside

But this string will also allow html tags such as :
https://www.savonhomes.com/cities.php?id=<h1>Riverside</h1>

This show that "tags" can be used in the page and is being flagged as an XSS vulnerability.

Personally I don't see how this could be a problem other than our client getting notices from companies that want to solve this condition.

Should I sanitize the URL parameter input prior to using in the page or is it best practice to disallow the page to render IF a certain characters are present (<> etc)?

Views?

Sign in to reply to this post

Ray BorduinWebAssist

Cross site scripting can be used in conjunction with iframes to steal cookies. The stolen cookies could be used to hijack sessions. Now, that may or may not be a big issue depending on what sensitive information your site may or may not contain about users.

In general, I would close XSS vulnerabilities... You can do that by using htmlspecialchars() to encode any potentially offending code before writing it to the page like:

php:
<?php echo(htmlspecialchars($_GET["id"])); ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Steve

Thank you Ray. As always you are an invaluable resource to the community.

Sign in to reply to this post

Steve

Actually I did not see merit in htmlspecialchars but found the strip_tags() function to remove all tags which seems effective in leaving only text in the URL parameter.

Sign in to reply to this post

Ray BorduinWebAssist

strip_tags() removes tags but won't encode quotes or even > characters outside of tags, which can be used to break out of tag or script blocks where the GET variable is referenced.

strip_tags may be enough in your application, but htmlspecialchars() is the more complete blocker for XSS attacks in all situations where they may occur.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...