API Security: BOLA, BFLA, JWT and Rate Limiting
Python · Flask · PyJWT · OAuth 2.0 / OpenID Connect

Two versions of the same REST API, one deliberately vulnerable and one remediated, attacked by the same script. All eight attacks, mapped to the OWASP API Security Top 10 (2023), succeed against the first and are blocked by the second. A companion lab builds a minimal OpenID Connect provider and an API that validates every token before granting access. Fictitious users, run on localhost.
Technologies
My role
Sole author. Wrote both APIs, the attack script, the identity provider and its test bank.
Highlights
- Per-object ownership checks that answer 404, so the existence of another user's object is not leaked (BOLA)
- Deny-by-default role decorator on admin functions (BFLA)
- Strict JWT validation (algorithm allow-list, signature, expiry, issuer and audience) rejects alg:none, forged admin and expired tokens
- Rate limiting: 50 login attempts get 49 HTTP 429 responses, and the one-time code that fell after 743 guesses is no longer reachable
- OIDC provider with client credentials and authorization code + PKCE (S256), RS256 tokens published through JWKS
- 17-case test bank of real JWT attacks and misconfigurations, compared against two deliberately unsafe validators
Screenshots and diagrams


