What this quiz covers
This quiz focuses on Session Management, giving you a quick way to practice the rules, question types, and explanations that matter most for Cyber Security.
A session starts at 09:00. The service enforces a 20-minute idle timeout and an eight-hour absolute lifetime. The user remains active throughout the day and successfully sends a request at 16:55. The next request arrives at 17:05.
How should the service handle the request at 17:05 if both timeout policies are correctly enforced?
Cyber Security Quiz
Practice Session Management in Cyber Security with focused quiz questions that help you check what you know, review explanations, and build confidence with test-style prompts.
This quiz focuses on Session Management, giving you a quick way to practice the rules, question types, and explanations that matter most for Cyber Security.
Try each quiz question before looking at the correct answer. Use the explanations to review missed ideas, then come back to similar questions until the pattern feels familiar.
A session starts at 09:00. The service enforces a 20-minute idle timeout and an eight-hour absolute lifetime. The user remains active throughout the day and successfully sends a request at 16:55. The next request arrives at 17:05.
How should the service handle the request at 17:05 if both timeout policies are correctly enforced?
An application sets its session identifier in a cookie with no Expires or Max-Age attribute. The server-side session record remains valid for four hours. A user closes a browser that is configured to discard session cookies on exit. An attacker has already copied the identifier and submits it from another client before the four-hour server timeout.
Which statement best describes the session's status?
Expires are cryptographically bound to the browser process that created them.Expires or Max-Age attribute is set, the cookie is a session cookie, meaning the browser holds it only until the window closes. Once the user closes the browser, their local copy is gone. However, the server-side session record has its own four-hour lifespan, completely unaffected by what the browser does. An attacker who already copied the raw session identifier can replay it directly in an HTTP request — no browser cookie required. The server sees a valid token, checks its own records, finds an active session, and grants access. Answer C correctly captures this: the user's browser discards its copy, but the copied identifier remains valid until the server explicitly invalidates or expires it.
A is wrong because closing the browser never reaches out to the server to terminate the session — the server has no awareness of the browser closing. B is wrong because the server-side expiration does not retroactively make the client cookie persistent; cookie persistence is a purely client-side attribute controlled by Expires/Max-Age. D is wrong because cookies carry no cryptographic binding to a specific browser process — they are simply strings, freely copyable and replayable.
A useful rule of thumb: true session termination requires explicit server-side invalidation (like a logout endpoint). Relying on cookie expiry alone leaves the server-side session dangling and vulnerable to exactly this replay scenario.Two APIs trust tokens signed by the same identity provider. A token has a valid signature, has not expired, contains the audience api-a, and includes the scope required for a read operation. The token is presented to API B. API B currently validates only the signature, issuer, and expiration.
What should API B do to prevent this token from being used as a valid session credential for the wrong service?
Authorization header.aud (audience) claim that explicitly names which service(s) the token is intended for. In this scenario, the token carries aud: api-a, meaning the identity provider issued it specifically for API A. Even though API B trusts the same issuer and the signature is cryptographically valid, API B is not the intended recipient. If API B skips audience validation, any token issued to any service from the shared identity provider could be replayed against API B — a classic token confused deputy or cross-service token replay attack. The correct fix is B: API B must verify that its own identifier appears in the audience claim before accepting the token as a valid credential.
A is wrong because sharing a trusted issuer does not make tokens interchangeable. Audience scoping exists precisely to prevent this assumption — a token is a targeted credential, not a universal pass.
C is wrong because scope and audience serve different purposes. Scope controls what operations a token may perform; audience controls which services may honor it. Having the right scope on the wrong service doesn't override the audience mismatch.
D is wrong because the transmission mechanism (cookie vs. Authorization header) is irrelevant to audience validation. The flaw exists regardless of how the token was delivered.
Study tip: Remember the JWT validation checklist: signature → issuer → expiration → audience. Skipping any one of these creates a distinct vulnerability.A single-page application keeps its access token only in JavaScript memory and sends it in an Authorization header. The API does not accept the token from cookies or URL parameters. Cross-origin requests using that header are not permitted by the API's CORS policy, and the application has no script-injection vulnerability.
Compared with automatically sending an authentication cookie, what session-security effect does this design have?
Authorization headers to cross-site form submissions.Authorization header by application code. A cross-origin attacker page has no ability to read that token from memory (due to same-origin policy) or cause the browser to attach it automatically — browsers simply don't forward custom Authorization headers on cross-origin requests the way they forward cookies. This makes A correct: conventional CSRF exposure is reduced because the attacker cannot weaponize the browser's automatic credential-forwarding behavior.
B is wrong because "no client-side technique can access it" is an overstatement — if the application were vulnerable to XSS, injected scripts could read memory. The passage explicitly notes no XSS vulnerability exists, but that's a contextual assumption, not a universal truth about memory storage.
C is factually incorrect. Browsers do not automatically append Authorization headers to form submissions or cross-site requests — that header requires explicit JavaScript code.
D is wrong because CORS absolutely governs custom headers on cross-origin requests, not just cookies.
A useful mental model: ask yourself, "Can the attacker make the browser do this without JavaScript?" If yes, CSRF is a risk. If the attack requires JavaScript execution in the victim's origin, it's an XSS problem instead.Before a victim signs in, an attacker causes the victim's browser to use a session identifier known to the attacker. The application preserves that same identifier when the anonymous session becomes authenticated.
Which session-management change most directly prevents the attacker from reusing the known identifier as an authenticated session?
HttpOnly after authentication while preserving its value and associated server-side session.HttpOnly only prevents JavaScript from reading it — it does nothing to prevent the attacker from using the already-known identifier, since the attacker obtained it before this flag was set. The identifier's value and server mapping remain intact, so the session is still hijackable.
Option C extends the attack window rather than closing it. Keeping the same identifier longer simply gives the attacker more time to exploit the session they already know about. Expiration management addresses timeout policies, not fixation.
Option D is cosmetic and irrelevant to the attack vector. Hashing the identifier in logs doesn't change what the server accepts from the browser. The original value still authenticates successfully, so nothing is actually protected.
The study tip here: for session fixation, always ask "does this fix break the link between the old identifier and the new authenticated state?" If the answer is no, it's not a real defense. Regeneration on authentication is the canonical answer.An application authenticates users with a cookie configured as Secure, HttpOnly, and SameSite=Lax. An attacker hosts a page that automatically submits a cross-site POST request to the application's funds-transfer endpoint. The endpoint relies only on the authentication cookie and does not use a separate anti-CSRF token.
Which outcome is most likely in a modern browser using the stated cookie configuration?
Secure permits transmission on any HTTPS request, including cross-site POST requests.HttpOnly prevents script access but does not impose any cross-site transmission restrictions.SameSite — it's the attribute specifically designed to control cross-site transmission, and it's the heart of CSRF protection.
SameSite=Lax is a middle-ground policy. It withholds the cookie on cross-site subrequests (like auto-submitted forms, images, or fetch calls) but does allow it on top-level navigations using safe methods like GET. So when an attacker's page silently fires a cross-site POST, the browser recognizes this as a cross-site subrequest with an unsafe method and withholds the cookie — meaning the funds-transfer endpoint receives no authentication credential and the attack fails. However, if someone clicked a link that triggered a top-level GET navigation to the site, the cookie would be sent. That nuance is exactly what B captures, making it the correct answer.
A is wrong because Secure only enforces that the cookie travels over HTTPS — it says nothing about whether the cookie crosses site boundaries. Conflating "secure channel" with "permitted on any request" is a classic trap. C is wrong for a similar reason: HttpOnly prevents JavaScript from reading the cookie via document.cookie, but it imposes zero restrictions on which requests the browser attaches it to. D overstates the restriction. SameSite=Lax is not as strict as SameSite=Strict; it still permits the cookie on top-level GET navigations, so saying it's withheld from every cross-site request is inaccurate.
For your exam, memorize the three SameSite values as a spectrum: None sends always, Lax sends on top-level safe navigations only, and Strict never sends cross-site. Questions will frequently test whether you can distinguish Lax from Strict.A service issues signed, self-contained access tokens that expire after 30 minutes. It does not maintain a token denylist or consult a server-side session record for each request. A user logs out five minutes after a token is issued, and the logout process deletes the browser's copy of the token.
What happens if an attacker copied the token before logout and presents it 10 minutes later?
exp in JWT terminology). Expiration is a standard feature, not a contradiction.
As a study rule: whenever you see "stateless tokens" paired with "logout," immediately ask yourself whether a revocation mechanism exists. If it doesn't, logout is only cosmetic.A web application uses an opaque cookie as the identifier for a server-side authenticated session. Its logout endpoint responds by setting the cookie's expiration to a time in the past, but it leaves the corresponding server-side session record active.
Which modification provides the strongest logout behavior against an attacker who copied the cookie before logout?
Path attribute while preserving the existing identifier and server-side record.Secure and HttpOnly while leaving the copied identifier active.Path attribute while keeping the same session identifier and server-side record intact. This is purely cosmetic — the session is still alive, and the attacker's cookie still maps to a valid server-side record regardless of path scoping.
Answer D adding Secure and HttpOnly flags to an already-deleted cookie is meaningless. These flags govern how the browser handles the cookie during active use; they offer zero protection against a cookie that was already exfiltrated before logout.
Study tip: On session-security questions, always distinguish between the token (cookie) and the session record (server state). An attacker who steals the token bypasses any client-side cookie manipulation — only revoking the server-side record provides real protection.A load-balanced application stores opaque-session records only in each web server's memory. Requests are distributed across servers without session affinity. Users intermittently appear logged out when consecutive requests reach different servers. The organization also requires logout to invalidate a session immediately across all servers.
Which change best satisfies both reliable session continuity and immediate centralized invalidation?
A client and an attacker both possess refresh token R1. The legitimate client uses R1 first and receives access token A2 and refresh token R2. The authorization server marks R1 as used. The attacker later attempts to exchange R1.
Under refresh-token rotation with reuse detection, what is the most security-focused response to the attacker's later request?