State Manipulation Fundamentals
What you'll learn: How attackers exploit hidden fields, cookies, and parameters to bypass intended application workflows and validation.
What is State Manipulation?
Web applications often track where users are in a multi-step process—like checkout flows, approval chains, or account registration. This "state" is stored somewhere: in hidden form fields, cookies, session variables, or URL parameters. State manipulation occurs when attackers modify these client-side values to skip steps, change prices, elevate privileges, or access unauthorized states.
Think of it like editing your ticket at a theme park from "general admission" to "VIP." If the park only checks the ticket you present—without verifying it against a secure backend record—you've successfully manipulated state.
Common Attack Vectors
Hidden Fields: An e-commerce site stores <input type="hidden" name="price" value="99.99"> in the checkout form. An attacker changes it to value="0.01" before submitting.
Cookies: A workflow stores step=2 in a cookie. The attacker sets step=5 to skip verification steps.
URL Parameters: A multi-step form uses ?stage=review. Changing it to ?stage=approved might bypass manager approval if the backend trusts this value blindly.
Why It Works
Applications fail when they:
- Trust client-supplied state without server-side validation
- Don't verify the user legitimately reached the current step
- Lack proper authorization checks at each state transition
This connects directly to what you learned about workflow authorization testing and server-side enforcement—the server must own and validate state, not just accept what the client claims.
Key Takeaway: State manipulation exploits trust in client-controlled data; always validate state transitions server-side against authoritative records, never relying solely on hidden fields, cookies, or parameters for workflow enforcement.