Saltar al contenido
Underc0de /foro

XSS via POST

🌐 This is an automatic translation of a topic from Underc0de, the largest Spanish-speaking hacking and IT community. Read the original (Spanish) and reply →
ANTRAX ·
Hi everyone!<br /><br />Throughout the forum I've seen many papers or tutorials about XSS, but none talks about the POST method.<br />A few days ago an XSS via POST was reported in Underc0de's contact form. Luckily it wasn't anything risky, but it was a vulnerability we had to fix.<br />This time we'll use the code of that contact form to reproduce the flaw and to see how to test whether our applications are vulnerable to XSS via POST.<br /><br />The contact form code is here: Los enlaces son solo para miembros. Registrate o iniciá sesión in case anyone wants to run the test.<br /><br />In addition, we'll need some tool that modifies the parameters we send via POST. I'll use Tamper Data which is a Firefox add-on: <br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />Once the contact form is set up it will look something like this:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />The first step will be to fill in all its fields and open Tamper Data. Once this is done, we click "Start Tamper" (in Tamper Data) and submit the contact form.<br />After this, an alert will appear in Tamper Data to modify the data we are sending. <br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />We click modify, and we review the values it is sending on the right side, which are the ones we have loaded from the form.<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Now it's time to play with these fields. This contact form doesn't filter its variables, so we'll place some XSS vector in its parameters.<br />In this case, I placed a simple alert in the email field. <br /><br /><script>alert('XSS')</script><br /><br />On clicking OK, the site will keep loading with the new supplied information...<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />And as you can see, the Alert appeared with our message.<br /><br />I hope it's useful to you!<br /><br />Regards!<br />ANTRAX
EPSILON ·
Very good @ANTRAX !, this comes in very handy because many people believe or limit themselves to thinking that this bug is only exploited via GET like SQL Injections, and this isn't so, and it's worth saying that you can also use Live HTTP Headers or BurpSuite to edit headers since I consider them easy to use. Regards!
GENIOL ·
excellent post!!! thank you very much for the contribution!! HailUnderc0de
elshotta ·
very good,<br />but then what you mean is that through the normal form the xss can't be inserted?<br />it's only by capturing the value with tamperdata?
WHK ·
Cita de: elshotta en Agosto 19, 2021, 01:34:44 PM<br />very good,<br />but then what you mean is that through the normal form the xss can't be inserted?<br />it's only by capturing the value with tamperdata?<br />
<br /><br />An XSS is independent of whether it goes via get, post, put, delete, etc, nor does it depend on a particular software; in fact an attacker doesn't need all their victims to have tamper data or burpsuite installed. What matters is what the server receives and what it returns, in other words the only thing to do is that someone can involuntarily send an http request (regardless of the method) and that in some input it may contain malicious code that can be returned by the server with a content type header of html type, then, for example, you can send a <script> tag so the server itself returns it to you and it executes. This allows that if a user accesses some html of yours and it has instructions to redirect the user to a url (regardless of whether it's get or post) their browser can execute the instruction you want, such as, for example, obtaining the session cookie and sending it to another server as long as the cookie allows it (due to the httponly flag).<br /><br />Take a look at these links:<br /><br />- Los enlaces son solo para miembros. Registrate o iniciá sesión<br />- Los enlaces son solo para miembros. Registrate o iniciá sesión
developerheh ·
I loved the dessert. Thanks
Grupo de WhatsApp