QuestionQ32

VerifiedSecure Coding Practices for Session Management

Thomas is not skilled at secure coding. He has neither received secure-coding training nor understands the consequences of insecure coding. One day, he wrote the code shown in the following screenshot. He passed the false parameter to the setHttpOnly() method, which may result in a certain type of vulnerability. Identify the attack that could exploit this vulnerability.

Question Image

Explanation

An HttpOnly cookie is hidden from client-side scripts; setting setHttpOnly(false) does not apply that protection. Consequently, malicious browser-side script—commonly injected through cross-site scripting (XSS)—can access a session or login cookie and exfiltrate it for session hijacking. This is a client-side scripts attack.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!