PHP Session and Cookie Security Audit (php-session-cookie-audit)
- 攻击大类:C09 Web应用漏洞利用
Analyze the security settings and implementation logic of authentication sessions in PHP project source code, focusing on detecting:
- session fixation
- missing cookie flags (HttpOnly/Secure/SameSite)
- JWT verification flaws (algorithm confusion, unverified exp/iss/aud, weak keys)
- remember-me / persistent login weaknesses (if present)
Severity Rating and Numbering
- See
shared/SEVERITY_RATING.mdfor details - Vulnerability ID:
{C/H/M/L}-SESS-{sequence}
Mandatory Checks (Required)
- Session initialization:
- whether
session_regenerate_idis called after login - whether reasonable timeouts and cookie parameters are set
- whether
- Cookie flags:
- whether
HttpOnly,SecureandSameSiteare explicitly set
- whether
- JWT:
- whether the algorithm used for decode/verify is fixed
- whether
exp/nbf/iss/audare validated - whether the secret / public key is hardcoded or read insecurely
- Logout / invalidation:
- whether logout truly clears the session and the token
PoC Requirements (Mandatory)
- For session fixation: provide the request sequence (fix the session id before login -> verify the session changes after login)
- For cookie flags: explain the browser-observable difference and the impact (and provide sample HTTP response headers)
- For JWT: provide a request PoC skeleton for "missing signature algorithm / claim validation" (must explain how the payload is crafted)
Evidence Citation (Mandatory: from php-route-tracer)
Every suspected session or cookie security risk must cite the matching evidence points of the SESS row in the ## 9) Sink Evidence Type Checklist section of the trace output item by item (the status may be pending verification, but the evidence citations must exist):
EVID_SESS_SESSION_INIT_REGEN: evidence of session fixation defenses such assession_regenerate_idafter loginEVID_SESS_COOKIE_FLAGS: evidence that the cookie flags (HttpOnly/Secure/SameSite) are setEVID_SESS_JWT_VERIFY_CLAIMS: evidence of the JWT signature algorithm being fixed and of claim validation such as exp/nbf/iss/audEVID_SESS_LOGOUT_CLEAR: evidence that logout truly clears the session and the token
Handling Missing tracer Evidence (Mandatory)
- If the trace contract validation fails or any of the key evidence points 1~4 above is missing, the risk can only be marked as
⚠️pending verification; no "confirmed exploitable" assertion may be made.
Report Output
{output_path}/vuln_audit/sess_{timestamp}.md
Entry Template (Mandatory)
Must include: location evidence + data flow chain (token/session -> verification -> authorization) + exploitability preconditions + PoC + remediation recommendations + rg search statements.