0
0
Cybersecurityknowledge~20 mins

HTTP security headers in Cybersecurity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
HTTP Security Headers Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📋 Factual
intermediate
2:00remaining
What is the primary purpose of the Content-Security-Policy header?

The Content-Security-Policy (CSP) header is used in web security. What does it mainly help prevent?

AIt restricts the sources from which a browser can load resources to prevent cross-site scripting attacks.
BIt encrypts the data sent between the browser and server to prevent eavesdropping.
CIt forces the browser to only use HTTPS connections for all requests.
DIt hides the server software version to prevent targeted attacks.
Attempts:
2 left
💡 Hint

Think about how websites control what scripts or content can run on their pages.

🧠 Conceptual
intermediate
2:00remaining
How does the Strict-Transport-Security header improve security?

What effect does the Strict-Transport-Security (HSTS) header have on a user's browser?

AIt tells the browser to always use HTTPS for future requests to the site, preventing downgrade attacks.
BIt blocks all cookies from being sent to the server to protect privacy.
CIt disables JavaScript execution on the website to prevent malicious scripts.
DIt forces the browser to clear its cache when visiting the site.
Attempts:
2 left
💡 Hint

Consider how browsers handle secure connections and what can happen if they switch to insecure ones.

🔍 Analysis
advanced
2:00remaining
Identify the effect of the following header on browser behavior

Given the HTTP header:

Referrer-Policy: no-referrer-when-downgrade

What does this header instruct the browser to do?

AAlways send the full URL as referrer, even when moving to less secure sites.
BNever send any referrer information regardless of the destination.
CSend only the origin part of the URL as referrer for all requests.
DSend the full URL as referrer only when navigating to the same or more secure protocol, but not when going to less secure sites.
Attempts:
2 left
💡 Hint

Think about what 'downgrade' means in terms of security protocols.

Comparison
advanced
2:00remaining
Compare X-Frame-Options and Content-Security-Policy frame-ancestors directives

Both X-Frame-Options and the frame-ancestors directive in Content-Security-Policy control framing of a webpage. Which statement correctly compares their capabilities?

AX-Frame-Options can specify multiple domains, but frame-ancestors only allows a single domain.
BBoth headers are deprecated and have no effect on modern browsers.
CX-Frame-Options supports only a few fixed options, while frame-ancestors allows specifying multiple allowed domains and is more flexible.
Dframe-ancestors only works in Internet Explorer, while X-Frame-Options works in all browsers.
Attempts:
2 left
💡 Hint

Consider which header offers more detailed control over allowed framing sources.

Reasoning
expert
2:00remaining
Why might setting the X-Content-Type-Options header to 'nosniff' be critical?

What security risk does setting X-Content-Type-Options: nosniff help prevent?

AIt encrypts the content to prevent interception during transmission.
BIt stops browsers from guessing the MIME type, preventing execution of malicious files disguised with wrong extensions.
CIt disables all inline scripts on the webpage to block cross-site scripting.
DIt forces the browser to cache all content for faster loading.
Attempts:
2 left
💡 Hint

Think about how browsers handle files when the declared content type might be incorrect or missing.