Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cyber Security Cards › Revision Cards

XSS Path to Session Cookies – Defence First

XSS Path to Session Cookies – Defence First XSS (Cross-Site Scripting) runs an attacker’s script in your browser on a trusted site. One use is stealing the session cookie. If the cookie is not HttpOnly , the script can read it and send it out. Even with HttpOnly, the script can still act as you on t

XSS Path to Session Cookies – Defence First XSS (Cross-Site Scripting) runs an attacker’s script in your browser on a trusted site. One use is stealing the session cookie. If the cookie is not HttpOnly , the script can read it and send it out. Even with HttpOnly, the script can still act as you on t
XSS Path to Session Cookies – Defence First · Download PNG
Read card text

What this card says

What it is

XSS (Cross-Site Scripting) runs an attacker’s script in your browser on a trusted site.

One use is stealing the session cookie.

How it works

If the cookie is not HttpOnly, the script can read it and send it out.

Even with HttpOnly, the script can still act as you on the page.

Defence

Set cookies HttpOnly. Encode all output.

Add a Content-Security-Policy so injected scripts won’t run.

Red team (attacker) doesBlue team (defender)…
Injects script into reflected/stored field on OWN lab appEncode output; CSP; input validation
Reads document.cookie when HttpOnly missingHttpOnly session cookie; short TTL
Uses XSS to call APIs as victim without stealing cookieCSP + SameSite + CSRF tokens + least privilege

Learn more in the lesson: 41.4 XSS Path to Session Cookies – Defence First

See all Ravi Sir's Cyber Security Cards