A broad cookie Domain attribute can cause a session cookie to be sent beyond the one host that created it. Narrow the scope unless a documented, authorized workflow truly needs subdomain sharing.
OWASP’s Session Management Cheat Sheet says that when the Domain attribute is not set, the cookie is restricted to the origin host. It warns that a permissive parent-domain value can extend the cookie to sibling hosts and increase cross-subdomain risk. This is a defensive configuration lesson for applications you own or are explicitly authorized to test.
Three findings first
- Host-only and parent-domain cookies have different reach.
- Path is not an authorization boundary. Server-side authorization remains essential.
- Repair requires a fresh-session retest. Reading configuration is not enough.
The scope map
| Configuration | Typical sending scope | Review question |
|---|---|---|
No Domain attribute |
Origin host | Does the application work without cross-subdomain sharing? |
Domain=example.com |
Parent domain and matching subdomains | Is this wider reach explicitly required and risk-reviewed? |
__Host- prefix pattern |
Requires Secure, Path=/, and no Domain on supporting browsers | Can the application use this stronger host-bound pattern? |
Safe repair-and-retest lab
- Use a local, isolated, or explicitly authorized app with synthetic accounts and synthetic cookie values.
- List the exact hosts in the intended workflow.
- Inspect only cookie attributes; never paste the session value into notes, screenshots, public AI, tickets, or source control.
- If sibling sharing is unnecessary, omit the
Domainattribute in the approved configuration. - Invalidate old test sessions and start a fresh browser context.
- Verify login and logout on the intended host.
- Verify the cookie is not sent to an unrelated sibling test host.
- Confirm server-side authorization still blocks disallowed actions.
- Preserve only redacted evidence and the responsible reviewer’s decision.
Evidence without secrets
| Field | Safe record |
|---|---|
| Authorized app | Internal system name or local lab identifier |
| Expected hosts | Hostnames without private routes or credentials |
| Observed Domain | Absent, exact approved parent, or unexpectedly broad |
| Repair | Config/code change; no secret value |
| Retest | Intended host works; unrelated sibling does not receive cookie |
| Stop point | Unknown ownership, production secret, undocumented dependency, or broken flow |
AI boundary
AI may help explain a redacted Set-Cookie pattern or compare a synthetic configuration. Do not provide production cookies, credentials, private logs, customer data, undisclosed vulnerabilities, or network details to a public AI service. A responsible human owns authority, repair, release, rollback, and evidence.
What this does not prove
A narrow Domain scope does not prove the application is free from XSS, CSRF, session fixation, subdomain takeover, authorization errors, or server compromise. Keep Secure, HttpOnly, SameSite, session rotation, expiration, CSRF defenses, DNS controls, and server-side authorization in their own tested records.
Primary sources
- OWASP — Session Management Cheat Sheet
- OWASP — Web Security Testing Guide: Testing for Cookies Attributes
Discover more from Louisville Institute of Technology (LIT) - Louisville, KY
Subscribe to get the latest posts sent to your email.