v0.12 — Sessies + TOTP volledig hardened (8 sub-fixes) #106

Closed
opened 2026-05-26 18:23:39 +00:00 by jesse-a · 1 comment
Owner

Severity: HIGH (v0.12 — pentest-rapport)

Cluster van 8 sessie/2FA-bevindingen uit het pentest-rapport v0.12, allen opgelost in commit aa68ac1:

  1. Sessie DB-revalidatiegetSession() doet per-request lookup op User.active/role/sessionVersion. Role-change/deactivatie/wachtwoord-wijziging werkt nu meteen door op alle bestaande cookies.
  2. TOTP-secret encrypted at-rest — AES-256-GCM, HKDF-SHA256-key uit AUTH_SECRET.
  3. Recovery-codes bcrypt-gehashed (cost 12) + atomic-consume via updateMany-guard.
  4. TOTP replay-prevention — nieuwe kolom User.lastTotpStep voorkomt hergebruik binnen 30s-step.
  5. Step-up authenticatiedisableTotp, startTotpEnrollment, e-mail-wijziging eisen huidig wachtwoord.
  6. bcrypt cost 10 → 12; wachtwoord-minimum 8 → 12 chars.
  7. AUTH_SECRET minimum 16 → 32 chars (vereiste voor HKDF-SHA256).
  8. JWT-verifier pint expliciet algorithms: ["HS256"] + typ: "JWT" (anti-algorithm-confusion).
**Severity: HIGH** (v0.12 — pentest-rapport) Cluster van 8 sessie/2FA-bevindingen uit het pentest-rapport v0.12, allen opgelost in commit aa68ac1: 1. **Sessie DB-revalidatie** — `getSession()` doet per-request lookup op `User.active`/`role`/`sessionVersion`. Role-change/deactivatie/wachtwoord-wijziging werkt nu meteen door op alle bestaande cookies. 2. **TOTP-secret encrypted at-rest** — AES-256-GCM, HKDF-SHA256-key uit `AUTH_SECRET`. 3. **Recovery-codes bcrypt-gehashed** (cost 12) + atomic-consume via `updateMany`-guard. 4. **TOTP replay-prevention** — nieuwe kolom `User.lastTotpStep` voorkomt hergebruik binnen 30s-step. 5. **Step-up authenticatie** — `disableTotp`, `startTotpEnrollment`, e-mail-wijziging eisen huidig wachtwoord. 6. **bcrypt cost** 10 → 12; **wachtwoord-minimum** 8 → 12 chars. 7. **AUTH_SECRET** minimum 16 → 32 chars (vereiste voor HKDF-SHA256). 8. **JWT-verifier** pint expliciet `algorithms: ["HS256"]` + `typ: "JWT"` (anti-algorithm-confusion).
Author
Owner

Opgelost in commit aa68ac1.

Opgelost in commit aa68ac1.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jesse-a/OpenCRM#106
No description provided.