Disclaimer:
Educational Use Only:
The website links provided are to be used strictly for educational and knowledge-gaining purposes only.
No Misuse:
Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.
Respect for Websites and Businesses:
Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.
Acknowledge Value of Knowledge:
Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.
No Endorsement:
The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.
User Responsibility:
By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.
- Which attribute ensures cookies are sent only over HTTPS connections?
a. Domain
b. Secure
c. Path
d. Expires
Answer: b. Secureinfosecinstitute - What attribute in cookies prevents access by JavaScript?
a. Secure
b. HttpOnly
c. Path
d. SameSite
Answer: b. HttpOnlyacunetix - What is the main function of the SameSite cookie attribute?
a. Control cookie expiry
b. Block third-party cookies
c. Restrict cookie transmission during cross-site requests
d. Allow persistent sessions
Answer: c. Restrict cookie transmission during cross-site requestsowasp - Which flag mitigates XSS cookie theft?
a. Path
b. Secure
c. Domain
d. HttpOnly
Answer: d. HttpOnlyacunetix - Under which attribute will cookies never be sent with third-party requests?
a. SameSite=Lax
b. SameSite=None
c. SameSite=Strict
d. Secure
Answer: c. SameSite=Strictowasp - Cookies without the Secure flag can be transmitted via what protocol?
a. HTTPS only
b. SMTP
c. HTTP
d. SSH
Answer: c. HTTPinfosecinstitute - The Secure flag is useful to prevent what attack type?
a. XSS
b. CSRF
c. Man-in-the-middle (MITM) cookie sniffing
d. DNS poisoning
Answer: c. Man-in-the-middle (MITM) cookie sniffinginfosecinstitute - When SameSite=Lax is used, cookies will be sent under what condition?
a. Always
b. Only for first-party top-level navigations
c. During background image loads
d. Never
Answer: b. Only for first-party top-level navigationsowasp - The SameSite=None attribute requires which other flag?
a. Domain
b. Secure
c. Path
d. Expires
Answer: b. Secureowasp - Which of the following is a secure cookie configuration?
a. Set-Cookie: SID; Secure; HttpOnly; SameSite=Strict
b. Set-Cookie: SID
c. Set-Cookie: SID; Domain=example.com
d. Set-Cookie: SID; Path=/public
Answer: a. Set-Cookie: SID; Secure; HttpOnly; SameSite=Strictowasp - Which cookie flag reduces exposure to network sniffing?
a. Secure
b. Domain
c. Max-Age
d. Expires
Answer: a. Secureinfosecinstitute - Which flag prevents cookies from being modified via client-side scripts?
a. HttpOnly
b. Secure
c. Path
d. Lax
Answer: a. HttpOnlyacunetix - What risk is associated with missing HttpOnly flag?
a. Unencrypted transmission
b. Cookie theft via JavaScript (XSS)
c. Session timeout
d. Secure deletion failure
Answer: b. Cookie theft via JavaScript (XSS)acunetix - Which cookie attribute limits its scope to a specific domain?
a. Domain
b. Secure
c. SameSite
d. HttpOnly
Answer: a. Domaindeveloper.mozilla - The cookie “SameSite=None; Secure” is typically used for what?
a. Blocking advertisements
b. Full cross-site operation under HTTPS
c. Limiting session duration
d. Encrypting cookie data
Answer: b. Full cross-site operation under HTTPSowasp - HttpOnly cookies protect against what type of script?
a. Server-side Python
b. JavaScript in web pages
c. SQL injection logic
d. NodeJS modules
Answer: b. JavaScript in web pagesacunetix - Secure cookies should not be set for sites using what protocol?
a. HTTPS
b. FTP
c. HTTP
d. IMAP
Answer: c. HTTPinfosecinstitute - A cookie is accessible to client scripts if which attribute is missing?
a. Secure
b. HttpOnly
c. Path
d. SameSite
Answer: b. HttpOnlyacunetix - The flag that helps prevent session hijacking via sniffing is:
a. Secure
b. Domain
c. Max-Age
d. HttpOnly
Answer: a. Secureinfosecinstitute - Which attribute is used to mitigate CSRF attacks?
a. Expires
b. SameSite
c. Domain
d. Max-Age
Answer: b. SameSiteexamradar - Cookies transmitted over unsecured HTTP channels are vulnerable to:
a. Cache poisoning
b. Eavesdropping
c. Log tampering
d. CSRF
Answer: b. Eavesdroppinginfosecinstitute - Which of the following helps prevent cookies from being sent during cross-origin requests?
a. HttpOnly
b. Secure
c. SameSite
d. Domain
Answer: c. SameSiteowasp - The __Host- prefix in a cookie enforces what condition?
a. Cookie has path=/, no domain attribute, Secure flag
b. Cookie can have any domain
c. Cookie uses default expiry
d. Cookie can be sent via HTTP
Answer: a. Cookie has path=/, no domain attribute, Secure flagowasp - Which cookie attribute must be applied to secure sensitive tokens like session IDs?
a. HttpOnly
b. Secure
c. SameSite
d. All of the above
Answer: d. All of the aboveacunetix+2 - What happens if Secure flag is set but site uses HTTP?
a. Cookie visible to scripts
b. Cookie ignored by browsers
c. Cookie sent normally
d. Cookie encrypted automatically
Answer: b. Cookie ignored by browsersinfosecinstitute - SameSite=Strict provides:
a. Maximum CSRF protection
b. Automatic cookie deletion
c. Enhanced caching speed
d. Public cookie access
Answer: a. Maximum CSRF protectionowasp - Which cookie attribute reduces risk of token leakage between sites?
a. Max-Age
b. SameSite
c. Expires
d. Domain
Answer: b. SameSiteowasp - HttpOnly is primarily used to defend against:
a. CSRF
b. SQL injection
c. XSS
d. Session fixation
Answer: c. XSSacunetix - Which flag combination gives best cookie protection?
a. Secure; HttpOnly; SameSite=Strict
b. Max-Age; Domain
c. Secure only
d. HttpOnly only
Answer: a. Secure; HttpOnly; SameSite=Strictinfosecinstitute+2 - Cookies used for authentication should always use:
a. Secure and HttpOnly flags
b. Domain flag only
c. Expires only
d. SameSite=None
Answer: a. Secure and HttpOnly flagsacunetix+1 - Why is the Secure flag essential for session cookies?
a. It prevents cookie theft over HTTP
b. It increases website loading
c. It hides cookies from server logs
d. It sets cookie expiry
Answer: a. It prevents cookie theft over HTTPinfosecinstitute - SameSite=Lax is preferred for what reason?
a. Balanced protection and usability
b. Enables public access
c. Blocks all cookies
d. Encrypts cookies end-to-end
Answer: a. Balanced protection and usabilityowasp - What common vulnerability arises if cookies lack Secure attribute?
a. Cookie reuse
b. Man-in-the-middle exposure
c. Session timeout
d. Flooding attack
Answer: b. Man-in-the-middle exposureinfosecinstitute - What attribute prevents cookies from being shared during iframe loads?
a. HttpOnly
b. SameSite=Strict
c. Path
d. Secure
Answer: b. SameSite=Strictowasp - Secure cookies can only be transmitted via what?
a. HTTPS connections
b. Any connection
c. SSH
d. Localhost connections
Answer: a. HTTPS connectionsinfosecinstitute - HttpOnly cookies help protect from which JavaScript property?
a. document.cookie
b. console.log
c. alert()
d. window.location
Answer: a. document.cookieacunetix - SameSite helps reduce the risk of what attack?
a. Cross-site request forgery
b. Brute-force
c. SQL injection
d. Password spraying
Answer: a. Cross-site request forgeryexamradar - A common misconfiguration in cookies is:
a. Missing Secure flag
b. Short expiry time
c. Too many cookies
d. Large cookie size
Answer: a. Missing Secure flaginfosecinstitute - HttpOnly cookies cannot be accessed using:
a. HTTP header response
b. JavaScript code
c. PHP session
d. Server-side APIs
Answer: b. JavaScript codeacunetix - The Secure flag ensures cookies are sent:
a. Only with HTTPS
b. With HTTP and HTTPS
c. Over local network only
d. To localhost only
Answer: a. Only with HTTPSinfosecinstitute - Which cookie attribute improves defense in depth?
a. SameSite
b. Secure
c. HttpOnly
d. All of the above
Answer: d. All of the aboveacunetix+2 - Which flag combination prevents cookies from being stolen through scripts or intercepts?
a. Secure; HttpOnly
b. Domain; Path
c. Expires; Max-Age
d. None
Answer: a. Secure; HttpOnlyacunetix+1 - Cookies lacking HttpOnly are exploitable under:
a. XSS attacks
b. DoS attacks
c. SQL injection
d. Command injection
Answer: a. XSS attacksacunetix - What type of cookies ensure better protection for sessions?
a. Secure cookies
b. Persistent cookies
c. Tracking cookies
d. Third-party cookies
Answer: a. Secure cookiesinfosecinstitute - Setting SameSite=None without Secure causes cookies to be:
a. Ignored by browsers
b. Sent across requests
c. Prefetched in cache
d. Expired early
Answer: a. Ignored by browsersowasp - The Secure attribute should always be paired with:
a. HTTPS
b. HTTP
c. FTP
d. None
Answer: a. HTTPSinfosecinstitute - Which cookie attribute helps limit session scope to domain?
a. Domain
b. Secure
c. HttpOnly
d. SameSite
Answer: a. Domaindeveloper.mozilla - Secure cookie configuration example follows which format?
a. Set-Cookie: __Host-SID=<token>; path=/; Secure; HttpOnly; SameSite=Strict
b. Set-Cookie: SID
c. Set-Cookie: Secure
d. Cookie: Domain
Answer: a. Set-Cookie: __Host-SID=<token>; path=/; Secure; HttpOnly; SameSite=Strictowasp - The main defense of Secure cookies is against:
a. Network eavesdropping
b. XSS
c. SQL injection
d. Phishing
Answer: a. Network eavesdroppinginfosecinstitute - Which flag in cookies was introduced to stop browsers from sending cookies during cross-origin POST requests?
a. SameSite
b. HttpOnly
c. Secure
d. Domain
Answer: a. SameSiteowasp
- https://www.infosecinstitute.com/resources/general-security/securing-cookies-httponly-secure-flags/
- https://www.acunetix.com/blog/web-security-zone/httponly-flag-protecting-cookies/
- https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/06-Session_Management_Testing/02-Testing_for_Cookies_Attributes
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies
- https://examradar.com/secure-cookies-attack-in-session-management-mcqs/
- https://www.sanfoundry.com/cyber-security-questions-answers-caches-cookies/
- https://examradar.com/question/5247/Secure-cookies-have-which-feature/
- https://testbook.com/objective-questions/mcq-on-cookies–5eea6a1439140f30f369f2c5
- https://www.sanfoundry.com/1000-cyber-security-questions-answers/
- https://www.programmingempire.com/40-mcqs-on-cookies-and-session-management-with-servlets/
- https://www.invicti.com/learn/cookie-security-flags
- https://www.theknowledgeacademy.com/blog/cyber-security-mcq-and-answers/
- https://owasp.org/www-project-secure-coding-practices-quick-reference-guide/stable-en/02-checklist/05-checklist
- https://owasp.org/www-community/controls/SecureCookieAttribute
- https://owasp.org/www-project-top-ten/
- https://www.yeahhub.com/20-multiple-choice-questions-on-website-security/
- https://www.reflectiz.com/blog/owasp-top-ten-2025/
- https://www.youtube.com/watch?v=utwfZ9hZrrE
- https://blog.codacy.com/owasp-top-10
- https://www.interviewbit.com/cyber-security-mcq/