Josue Arango
All projects

2026 · Application Security & DevSecOps

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

PythonFlaskPyJWTOAuth 2.0OpenID ConnectPKCEJWKSSQLiteOWASP API Top 10

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

BOLA: the vulnerable API looks the vehicle up by id only; the secure one also checks the owner and answers 404
BOLA: the vulnerable API looks the vehicle up by id only; the secure one also checks the owner and answers 404
The same eight attacks: all succeed against port 8081, all are blocked by port 8082
The same eight attacks: all succeed against port 8081, all are blocked by port 8082
A token forged with role=admin and a wrong key lists every user on the vulnerable API and gets 401 on the secure one
A token forged with role=admin and a wrong key lists every user on the vulnerable API and gets 401 on the secure one