RFC 6265 Quiz

HTTP State Management Mechanism

0 / 0

References (URLs)

Scope: RFC 6265 defines the Cookie and Set-Cookie fields and user-agent processing. It does not define a cookie value's application semantics or make Path, Domain, Secure, or HttpOnly a complete authorization boundary. CSRF defenses and server-side session policy remain application responsibilities.

Q1: How should a gateway forward multiple Set-Cookie fields?

Multiple Choice

An origin returns two Set-Cookie fields. One contains an Expires date with a comma. A gateway normally combines repeated fields into one comma-separated value.

**Explanation:** A: RFC 6265 Section 3 identifies Set-Cookie as an exception: comma also appears in its syntax, so ordinary folding can alter meaning. B: Section 3 says origin servers SHOULD NOT fold multiple Set-Cookie fields. Preserving the separate fields avoids that ambiguity. C: An origin can include multiple Set-Cookie fields; the recommendation concerns duplicate names and races, not a one-cookie response limit. D: Cookie is the request field by which a user agent returns applicable stored cookies; it cannot replace response-side Set-Cookie.

Q2: Is Path a security boundary between two services?

Multiple Choice

Two mutually distrusting applications share example.com. The administrator assigns /finance and /games and relies on Path attributes to keep each application's security-sensitive cookies isolated.

**Explanation:** A: RFC 6265 Section 8.6 notes that a response can set an arbitrary Path; the request path does not confine what Path it may set. B: HttpOnly limits exposure through non-HTTP APIs. It does not turn Path into an integrity boundary. C: Sections 4.1.2.4 and 8.6 distinguish path matching from security isolation and advise against security-sensitive cookies for mutually distrusting services on different paths of one host. D: The RFC permits non-root Path values. The defect is relying on them for isolation, not using them at all.

Q3: What guarantee does Secure fail to provide?

Multiple Choice

An HTTPS service marks its session cookie Secure. Its review concludes that an active network attacker cannot inject a replacement cookie because the real cookie is never sent over HTTP.

**Explanation:** A: Secure sets a transmission flag; RFC 6265 defines no browser signature operation for it. B: HttpOnly constrains non-HTTP API access and is independent of Secure; it does not authenticate response headers. C: Section 8.6 explains that an attacker can impersonate an insecure response and inject Set-Cookie even when the genuine service uses HTTPS exclusively. D: Sections 4.1.2.5 and 8.6 limit Secure's guarantee and explicitly describe overwrite attacks. Additional integrity and session controls belong to the application and deployment.

Q4: What does the cookie check fail to establish?

Multiple Choice

An agent opens an attacker-selected page. That page causes the browser to submit a transfer request to bank.example. The browser automatically attaches a valid Secure, HttpOnly session cookie, and the bank authorizes the transfer solely from that cookie.

**Explanation:** A: Automatic attachment lets an attacker designate a request while the user agent supplies ambient authority. B: RFC 6265 Section 8.2 identifies this separation of designation and authorization as the basis of CSRF/confused-deputy risk. The concrete request-authorization defense is an application design choice, not a cookie-processing rule defined by RFC 6265. C: Encryption can protect cookie contents but does not prove who selected the operation carried by the request. D: Lifetime affects retention, not the relationship between session authority and the requested action.

Q5: May a server treat the first same-name cookie as authoritative?

Multiple Choice

A request contains `SID=finance; SID=other`, created from same-name cookies with different Path values. The backend always trusts the first value because Section 5.4 recommends longer paths first.

**Explanation:** A: Section 5.4 says the user agent SHOULD sort, and notes that not all user agents do so. That is not a universal MUST. B: Section 4.2.2 states that Cookie does not return attributes such as Path or Domain. C: Section 4.2.2 says servers SHOULD NOT rely on serialization order, especially for same-name cookies. Unique names or unambiguous server-side handling avoid making authority depend on unavailable metadata. D: Same-name cookies with different Domain or Path values can legitimately appear together.

Q6: Can a server rely on a cookie remaining stored until Max-Age?

Multiple Choice

A workflow cookie has Max-Age=86400. The server treats its absence during that day as proof of tampering and permanently rejects the user's account.

**Explanation:** A: Section 4.1.2.2 calls Max-Age a maximum lifetime and says the user agent need not retain the cookie for that duration. Sections 5.3 and 8.6 also permit capacity-driven removal and warn servers not to rely on retention. Recovery and reauthentication policy are application choices. B: Max-Age determines an expiry time when processed; it does not impose a minimum retention period. C: Replacement with a past expiry is one deletion mechanism, but users, privacy controls, and storage limits can also remove cookies. D: Max-Age has defined processing semantics and takes precedence over Expires when both occur.