Medium, CVSS 6.9PyPIAmendedPublished
OpaMiddleware does not filter HTTP OPTIONS requests
CVE-2024-40627 · GHSA-5f5c-8rvc-j8wf
- Affected
- PyPI fastapi-opa < 2.0.1
- Fixed in
- 2.0.1· Vendor fix available
- Issue
- HTTP OPTIONS requests are always allowed by OpaMiddleware, even when they lack authentication, and are passed through directly to the application. The maintainer uncertain whether this should be classed as a "bug" or "security issue" – but is erring on the side of "security issue" as an application could reasonably assume OPA controls apply to all HTTP methods, and it bypasses more sophisticated policies. Details OpaMiddleware allows all HTTP OPTIONS requests without evaluating it against any policy: https://github.com/busykoala/fastapi-opa/blob/6dd6f8c87e908fe080784a74707f016f1422b58a/fastapiopa/opa/opamiddleware.py#L79-L80 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 (CWE-204). PoC This toy application is based on the behaviour of an app[^1] which can use…
Recommended action: Upgrade to 2.0.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.