Vulnerability · Published Jul 15, 2024 · Assigned by GitHub_M
CVE-2024-40627OpaMiddleware does not filter HTTP OPTIONS requests
Medium 5.8
In plain English
A medium-severity security flaw in fastapi-opa from busykoala. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.6% (higher than 47% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Fastapi OPA is an opensource fastapi middleware which includes auth flow. HTTP `OPTIONS` requests are always allowed by `OpaMiddleware`, even when they lack authentication, and are passed through directly to the application. `OpaMiddleware` allows all HTTP `OPTIONS` requests without evaluating it against any policy. If an application provides different responses to HTTP `OPTIONS` requests based on an entity existing (such as to indicate whether an entity is writable on a system level), an unauthenticated attacker could discover which entities exist within an application. This issue has been addressed in release version 2.0.1. All users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| PyPI | fastapi-opa | 2.0.1 | GHSA-5f5c-8rvc-j8wf |
| PyPI | fastapi-opa | 2.0.1 | PYSEC-2026-1361 |
| Ubuntu:22.04:LTS | fastapi | no fix listed | UBUNTU-CVE-2024-40627 |
| Ubuntu:24.04:LTS | fastapi | no fix listed | UBUNTU-CVE-2024-40627 |
| Ubuntu:25.10 | fastapi | no fix listed | UBUNTU-CVE-2024-40627 |
| Ubuntu:26.04:LTS | fastapi | no fix listed | UBUNTU-CVE-2024-40627 |
| Ubuntu:26.10 | fastapi | no fix listed | UBUNTU-CVE-2024-40627 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| busykoala | fastapi-opa | < 2.0.1 |
Weakness: CWE-204 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
References
- https://github.com/busykoala/fastapi-opa/security/advisories/GHSA-5f5c-8rvc-j8wf x_refsource_CONFIRM
- https://github.com/busykoala/fastapi-opa/commit/9588109ff651f7ffc92687129c4956126443fb8c x_refsource_MISC
- https://github.com/busykoala/fastapi-opa/blob/6dd6f8c87e908fe080784a74707f016f1422b58a/fastapi_opa/opa/opa_middleware.py#L79-L80 x_refsource_MISC