Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript used in URL

Tags:

javascript

xss

Looking through analytics, I saw that someone visited my cart page and added the following to the URL:

cart?wvstest=javascript:domxssExecutionSink(1,%2522%253Cbr%253E()locxss%2522)

What would this do, and should I be considered of any security issues?

like image 610
Jordan Bundy Avatar asked May 01 '14 21:05

Jordan Bundy


People also ask

What is JavaScript in URL?

The JavaScript built-in URL class provides a flexible interface that allows both to create and parse URLs . No networking methods requiring a URL object exist now. Strings are rather convenient for that. So, technically, you needn't always use URLs, but in some instances, they are handy. Let's dive into some details.

Can you execute JavaScript in URL?

javascript: URLs can also be used in other contexts. You might use one as the target of a hypertext link, for example. Then when the user clicks on the link, the specified JavaScript code will be executed.


2 Answers

It's an attempt at injecting JavaScript by penetration tool Acunetix. The specfic attack is DOM based XSS (as shown by the function named domxssExecutionSink). If you were to echo the query parameter wvstest directly to the page, their JavaScript would have been executed.

Read more about XSS atacks (and how to mitigate them) at OWASP

like image 79
SomeKittens Avatar answered Oct 11 '22 09:10

SomeKittens


It will pass the data to your server.

What happens next depends on your server side code.

If you were to read wvstest as a query string and then inject it (without proper sanitisation) into an HTML document, you would have an XSS security hole.

like image 34
Quentin Avatar answered Oct 11 '22 09:10

Quentin