Cookie Slack Detector

ID

cookie_slack_detector

Severity

info

Kind

Session Management

CWE

205

Description

This detector performs systematic testing of cookie enforcement by sending repeated requests with individual cookies removed, then comparing responses against a baseline request with all cookies present. It identifies which cookies are actually required for authentication or authorization versus which cookies are set but not validated, revealing gaps in cookie-based security controls.

Rationale

Cookie slack occurs when applications set multiple cookies but fail to properly validate all of them on subsequent requests, creating authentication and authorization bypass opportunities. Attackers can identify which cookies are cosmetic or optional and strip authentication cookies while retaining session cookies, potentially accessing protected resources without proper credentials. This reveals weaknesses in session management where the application assumes cookie presence indicates validation, allowing unauthorized access or privilege escalation by selectively omitting security-critical cookies.

Remediation

Implement strict validation of all security-relevant cookies on every request to protected resources. Ensure that authentication and authorization decisions are based on server-side session state rather than cookie presence alone. Use framework-provided session management mechanisms that tie all session cookies together cryptographically. Regularly audit which cookies are set versus which are actually validated, and remove unused cookies to reduce the attack surface.