October 2016
Intermediate to advanced
298 pages
5h 49m
English
If we have an XSS vulnerability in the web application, then by inserting appropriate JavaScript code we can steal the token and then use that to build a CSRF exploit (a self-submitting form and so on).
In the following image I've simulated an XSS vulnerability in Facebook through the Developer Console of Chrome, inserted the following code, which will grab the CSRF token from the hidden input with the name fb_dtsg and display it in the browser as shown in the screenshot following the code:
var csrf = document.getElementsByTagName("input")['fb_dtsg'].value;
alert('Your CSRF protection token fb_dtsg has value '+csrf);Let's take a look at the following screenshot:
It seems plain and simple, right? Similarly, we can ...
Read now
Unlock full access