Jump to content
Nytro

Stored XSS And SET

Recommended Posts

Posted

Stored XSS And SET

Stored XSS is the most dangerous type of cross site scripting due to the fact that the user can be exploited just by visiting the web page where the vulnerability occurs.Also if that user happens to be the administrator of the website then this can lead to compromise the web application which is one of the reasons that the risk is higher than a reflected XSS.

In real world scenarios once a stored XSS vulnerability have discovered,the penetration tester reports the issue and provides a brief explanation in the final report about the potential risks but he doesn’t continue the attack as it is not necessary except if the client asks it.However a malicious attacker will not stop there and he will try to attack the users by combining tools and methods.So in this article we will examine how an attacker can use SET with a stored XSS in order to obtain shells from users.

First of all stored XSS can be discovered in web applications that are allowing the users to store information like comments,message boards,page profiles,shopping carts etc.Let’s say that we have a web application with the following form:

stored-xss.jpeg?w=645&h=322

Comment Form Vulnerable to XSS

In order to test it for XSS we will try to pass into the comment field the following script:

xss-stored2.jpeg?w=645

Alert Box – JavaScript Code

The result will be the following:

stored-xss1.jpeg?w=645

Comment Field Vulnerable to XSS

Now that we know where the vulnerability exists we can launch the social engineering toolkit.

stored-xss2.jpeg?w=645

SET – Menu

The attack that we are going to choose is the Java Applet Attack Method.

stored-xss3.jpeg?w=645

Java Applet Attack Method

We will enter our IP address in order the reverse shell to connect back to us and we will choose the first option which is Java Required.

stored-xss4.jpeg?w=645

SET Configurations

Next we will have to choose our payload and our encoder.In this case we will select to use as a payload a simple Meterpreter Reverse TCP and as a encoder the famous shikata_ga_nai.

stored-xss5.jpeg?w=645

SET – Encoders

Now we can go back to the web application and we can try to insert the malicious JavaScript code in the comment field that we already know from before that is vulnerable to XSS.

stored-xss6.jpeg?w=645

Malicious JavaScript Code

When a user will try to access the page that contains the malicious JavaScript the code will executed in his browser and a new window will come up that will contain the following message:

xss-stored.jpeg?w=645&h=273

Fake message trying to convince the user to run the java applet

After a while the user will notice a pop-up box that it will ask him if he wants to run the Java applet.

xss-stored1.jpeg?w=645

Malicious Java Applet

If the user press on the Run button the malicious code will executed and it will return us a shell.

71.png?w=476&h=127

Remote Shell

Conclusion

As we saw stored XSS can be very dangerous as the JavaScript code executed once the unsuspected user has visited the vulnerable page.In this article the malicious attacker wanted to redirect the user to another page in order to run the malicious Java applet that lead to a shell.A potential attacker can use many tools with different arbitrary codes combined together in order to achieve his goal so regular penetration tests is a necessity for every company that wants to defend herself from non-ethical hackers.

Sursa: Stored XSS And SET

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...