An attacker performs a cross-site scripting (XSS) attack against a web application, successfully stealing sensitive session cookies from victim browsers. The security team is tasked with updating the application's cookie configuration attributes. Which two cookie flags must be set to protect session cookies against theft via XSS and network sniffing?
Trap 1: Configure the 'SameSite=Strict' and 'Max-Age' attributes on session…
SameSite mitigates Cross-Site Request Forgery (CSRF), not XSS session theft.
Trap 2: Implement the 'Domain' and 'Path' restriction attributes on all…
Domain and Path govern cookie scope across URLs, not XSS vulnerability mitigation.
Trap 3: Enable the 'Partitioned' (CHIPS) attribute and 'HttpOnly' flag on…
CHIPS isolates cookies across third-party contexts, not standard XSS cookie theft.
- A
Set the 'HttpOnly' and 'Secure' attributes on all session cookies.
HttpOnly blocks script access, and Secure ensures transmission over encrypted channels only.
- B
Configure the 'SameSite=Strict' and 'Max-Age' attributes on session cookies.
Why wrong: SameSite mitigates Cross-Site Request Forgery (CSRF), not XSS session theft.
- C
Implement the 'Domain' and 'Path' restriction attributes on all authentication cookies.
Why wrong: Domain and Path govern cookie scope across URLs, not XSS vulnerability mitigation.
- D
Enable the 'Partitioned' (CHIPS) attribute and 'HttpOnly' flag on cookies.
Why wrong: CHIPS isolates cookies across third-party contexts, not standard XSS cookie theft.