In the previous recipe, we did a very basic proof of concept for an XSS exploitation. Also, in previous chapters, we saw how a session cookie can be used by an attacker to steal a valid user's session. XSS vulnerabilities and session cookies that are not protected by the HttpOnly flag can be a deadly combination for a web application's security.
In this recipe, we will see how an attacker can exploit an XSS vulnerability to grab a user's session cookie.