Aether AI
3967ece625
fix(security): OC-25 — Validate OAuth state parameter to prevent CSRF attacks ( #16058 )
...
* fix(security): validate OAuth state parameter to prevent CSRF attacks (OC-25)
The parseOAuthCallbackInput() function in the Chutes OAuth flow had two
critical bugs that completely defeated CSRF state validation:
1. State extracted from callback URL was never compared against the
expected cryptographic nonce, allowing attacker-controlled state values
2. When URL parsing failed (bare authorization code input), the catch block
fabricated a matching state using expectedState, making the caller's
CSRF check always pass
## Attack Flow
1. Victim runs `openclaw login chutes --manual`
2. System generates cryptographic state: randomBytes(16).toString("hex")
3. Browser opens: https://api.chutes.ai/idp/authorize?state=abc123 ...
4. Attacker obtains their OWN OAuth authorization code (out of band)
5. Attacker tricks victim into pasting just "EVIL_CODE" (not full URL)
6. parseOAuthCallbackInput("EVIL_CODE", "abc123...") is called
7. new URL("EVIL_CODE") throws → catch block executes
8. catch returns { code: "EVIL_CODE", state: "abc123..." } ← FABRICATED
9. Caller checks: parsed.state !== state → "abc123..." !== "abc123..." → FALSE
10. CSRF check passes! System calls exchangeChutesCodeForTokens()
11. Attacker's code exchanged for access + refresh tokens
12. Victim's account linked to attacker's OAuth session
Fix:
- Add explicit state validation against expectedState before returning
- Remove state fabrication from catch block; always return error for
non-URL input
- Add comprehensive unit tests for state validation
Remediated by Aether AI Agent security analysis.
* fix(security): harden chutes manual oauth state check (#16058 ) (thanks @aether-ai-agent)
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-02-14 15:28:52 +01:00
..
2026-02-13 20:26:39 +00:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-14 01:46:12 +01:00
2026-02-14 13:37:47 +01:00
2026-02-13 14:28:22 +00:00
2026-02-08 04:53:31 -08:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-13 02:02:01 +01:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-13 04:25:05 +01:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-01-19 10:44:18 +00:00
2026-02-14 05:58:26 +01:00
2026-02-14 13:25:54 +01:00
2026-02-14 13:25:54 +01:00
2026-02-10 07:31:02 -05:00
2026-01-31 16:19:20 +09:00
2026-02-13 04:25:05 +01:00
2026-02-13 16:18:16 +01:00
2026-01-18 16:35:52 +00:00
2026-02-01 10:03:47 +09:00
2026-01-18 16:35:52 +00:00
2026-01-18 16:35:52 +00:00
2026-02-13 16:18:16 +01:00
2026-02-13 16:18:16 +01:00
2026-02-14 13:37:47 +01:00
2026-02-01 10:03:47 +09:00
2026-02-13 17:18:49 +00:00
2026-02-13 16:18:16 +01:00
2026-02-14 01:07:35 +01:00
2026-01-18 16:35:52 +00:00
2026-02-13 15:48:37 +01:00
2026-02-13 15:48:37 +01:00
2026-02-05 15:14:50 -08:00
2026-02-05 16:54:44 -05:00
2026-02-14 13:37:47 +01:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-14 13:37:47 +01:00
2026-01-14 05:39:47 +00:00
2026-01-31 16:19:20 +09:00
2026-02-13 14:28:22 +00:00
2026-02-14 12:13:27 +00:00
2026-01-18 01:00:24 +00:00
2026-02-13 14:28:22 +00:00
2026-02-14 15:28:52 +01:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-14 12:32:17 +01:00
2026-02-14 12:32:17 +01:00
2026-02-14 12:32:17 +01:00
2026-02-14 12:32:17 +01:00
2026-02-01 10:03:47 +09:00
2026-01-14 15:02:19 +00:00
2026-02-13 14:28:22 +00:00
2026-02-11 13:07:30 -05:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-01-14 15:02:19 +00:00
2026-02-13 14:28:22 +00:00
2026-02-06 22:17:09 -08:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-04 19:51:06 +00:00
2026-02-13 14:28:22 +00:00
2026-02-14 12:40:47 +01:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-01-30 03:16:21 +01:00
2026-02-14 12:40:47 +01:00
2026-02-14 12:40:47 +01:00
2026-02-01 10:03:47 +09:00
2026-02-02 16:18:09 +09:00
2026-02-13 16:43:39 +01:00
2026-02-13 16:43:39 +01:00
2026-02-08 16:20:13 -05:00
2026-02-14 12:40:47 +01:00
2026-01-28 00:16:00 +00:00
2026-02-06 01:14:00 -05:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-04 19:51:06 +00:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-01-31 16:19:20 +09:00
2026-02-13 14:28:22 +00:00
2026-01-31 16:19:20 +09:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-13 14:28:22 +00:00
2026-02-13 19:22:25 +00:00
2026-02-01 10:03:47 +09:00
2026-02-13 16:08:38 +00:00
2026-02-01 10:03:47 +09:00
2026-02-05 16:54:44 -05:00
2026-02-13 15:48:37 +01:00
2026-02-13 15:48:37 +01:00
2026-02-14 00:54:46 +01:00
2026-02-14 00:38:55 +00:00
2026-02-13 14:28:22 +00:00
2026-01-16 00:42:28 +00:00
2026-02-01 10:03:47 +09:00
2026-01-18 07:46:00 +00:00
2026-01-17 18:19:55 +00:00
2026-01-31 16:19:20 +09:00
2026-02-13 16:18:16 +01:00
2026-02-13 16:18:16 +01:00
2026-02-13 16:18:16 +01:00
2026-02-14 13:37:47 +01:00
2026-02-01 10:03:47 +09:00
2026-02-14 13:37:47 +01:00
2026-02-13 14:28:22 +00:00
2026-02-14 13:25:54 +01:00
2026-02-14 13:25:54 +01:00
2026-02-13 16:43:39 +01:00
2026-02-13 16:43:39 +01:00
2026-02-13 14:28:22 +00:00
2026-02-11 14:48:45 -05:00
2026-02-13 17:04:41 +01:00
2026-02-13 17:04:41 +01:00
2026-02-13 14:28:22 +00:00
2026-02-14 13:05:37 +01:00
2026-02-13 14:28:22 +00:00
2026-02-11 13:07:30 -05:00
2026-02-13 16:20:37 +00:00
2026-02-14 13:37:47 +01:00
2026-02-01 10:03:47 +09:00
2026-02-14 05:58:26 +01:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-09 13:27:21 -06:00
2026-02-14 13:25:54 +01:00
2026-02-14 05:58:26 +01:00
2026-02-05 16:54:44 -05:00
2026-02-13 17:18:49 +00:00
2026-02-13 17:18:49 +00:00
2026-02-13 14:48:45 +00:00
2026-02-05 16:54:44 -05:00
2026-02-05 16:54:44 -05:00
2026-02-14 01:07:35 +01:00
2026-02-01 10:03:47 +09:00
2026-02-08 04:53:31 -08:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-08 04:53:31 -08:00
2026-02-13 14:28:22 +00:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-12 23:52:19 -05:00
2026-02-01 10:03:47 +09:00
2026-02-14 14:42:08 +01:00
2026-02-14 14:42:08 +01:00
2026-02-08 04:53:31 -08:00
2026-02-01 10:03:47 +09:00
2026-02-14 00:45:45 +01:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-12 23:52:19 -05:00
2026-01-31 16:19:20 +09:00
2026-02-01 10:03:47 +09:00
2026-02-02 23:45:05 -08:00
2026-02-12 23:52:19 -05:00
2026-01-14 05:39:47 +00:00
2026-02-12 23:52:19 -05:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-01 10:03:47 +09:00
2026-02-13 14:28:22 +00:00
2026-02-12 19:16:04 +01:00