CND Application And Data Protection Practice Question
A software developer is writing a secure web application and needs to protect sensitive user session cookies against theft and cross-site scripting (XSS) attacks. Which TWO cookie attributes must be set when creating session cookies?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Secure
HttpOnly prevents client-side scripts (JavaScript) from accessing the cookie (mitigating XSS theft), and Secure ensures the cookie is only transmitted over encrypted HTTPS connections.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Max-Age=31536000
Why it's wrong here
Max-Age sets cookie persistence lifespan, which does not protect against XSS.
- ✗
Domain=example.com
Why it's wrong here
Domain defines the hosts allowed to receive the cookie, unrelated to XSS protection.
- ✗
SameSite=Strict or Lax
Why it's wrong here
SameSite mitigates Cross-Site Request Forgery (CSRF), not XSS cookie theft.
- ✓
Secure
Why this is correct
The Secure attribute ensures the cookie is transmitted exclusively over encrypted HTTPS connections.
- ✓
HttpOnly
Why this is correct
The HttpOnly attribute blocks client-side JavaScript from reading document.cookie.
About these practice questions
Courseiva writes every CND question from scratch — 323 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official EC-Council exam blueprint
This CND practice question is part of Courseiva's free EC-Council certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CND exam.