CVE-2026-27953·Python vulnerability
ormar is a async mini ORM for Python. Versions 0.23.0 and below are vulnerable to Pydantic validation bypass through the model constructor, allowing any unauthenticated user to skip all field validation by injecting "__pk_only__": true into a JSON request body. By injecting "__pk_only__": true into a JSON request body, an unauthenticated attacker can skip all field validation and persist unvalidated data directly to the database. A secondary __excluded__ parameter injection uses the same pattern to selectively nullify arbitrary model fields (e.g., email or role) during construction. This affects ormar's canonical FastAPI integration pattern recommended in its official documentation, enabling privilege escalation, data integrity violations, and business logic bypass in any application using ormar.Model directly as a request body parameter. This issue has been fixed in version 0.23.1.
- Severity
- high
- Software
- Python
- Fixed in
- 0.23.1
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at 0.13% — higher than 33% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Read the two together. CVE-2026-27953 scores 7.1 on CVSS, so a successful attack would be serious — but at 0.13%, almost nobody is currently attempting it. That is a different situation from a flaw under mass exploitation, and it is usually the difference between patching on your next maintenance window and patching tonight.
Affected versions
Until: 0.23.1
Fixed in: 0.23.1
How to fix this CVE
Upgrade ormar to version 0.23.1 or later to patch the Pydantic validation bypass vulnerability. If you are using ormar as a request body parameter in FastAPI applications, ensure your deployment runs the patched version immediately. Review any FastAPI endpoints that accept ormar.Model instances directly and consider adding additional server-side validation layers as a defense-in-depth measure.
sudo dnf update python3-ormarDefensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
POST request containing JSON body with __pk_only__:true or __excluded__ parameters sent to FastAPI endpoints accepting ormar.Model objects. Example pattern: ("__pk_only__"\s*:\s*true|"__excluded__"\s*:\s*\{)WAF mitigation (if patching is not yet possible)
Add this rule to your WAF to block exploitation attempts while you schedule the patch.
Implement JSON schema validation at the WAF level to reject any incoming request bodies containing keys matching /__pk_only__|__excluded__/ before they reach the FastAPI application. Configure WAF rules to block JSON payloads with these parameter names targeting endpoints known to accept ormar.Model instances.How to check if you are affected
- Step 1: Check ormar version with: python3 -c "import ormar; print(ormar.__version__)"
- Step 2: Identify FastAPI applications using ormar by searching for ormar.Model imports: grep -r "from ormar import" /path/to/app/ && grep -r "ormar.Model" /path/to/app/
- Step 3: Search application logs for suspicious JSON payloads containing "__pk_only__" or "__excluded__" parameters: grep -i '__pk_only__\|__excluded__' /var/log/app/*.log
- Step 4: After upgrading, verify the patched version is running: python3 -c "import ormar; print(ormar.__version__)" and confirm it shows 0.23.1 or higher
Indicators of compromise
- __pk_only__:true in JSON request body
- __excluded__ parameter injection in request payload
- FastAPI POST requests to /path accepting ormar.Model with unusual field values
FAQ
What is CVE-2026-27953?
CVE-2026-27953 is a validation bypass flaw in ormar that allows attackers to inject special parameters (__pk_only__ and __excluded__) into JSON request bodies to skip field validation and persist unvalidated data directly to the database. This affects applications using ormar.Model as a FastAPI request parameter.
Is CVE-2026-27953 being actively exploited?
No, CVE-2026-27953 is not listed on the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are currently available. However, the attack pattern is straightforward and organizations should prioritize patching.
What versions of ormar are affected by CVE-2026-27953?
All ormar versions 0.23.0 and below are vulnerable. Version 0.23.1 and later include the fix.
How do I check if my server is vulnerable to CVE-2026-27953?
Run: python3 -c "import ormar; v = ormar.__version__.split('.'); print('Vulnerable' if int(v[1]) <= 23 and int(v[2]) < 1 else 'Patched')" to quickly determine if your installation is affected.
Does Defensia detect CVE-2026-27953?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If ormar is installed on a monitored server, CVE-2026-27953 will appear in your dashboard with remediation steps.
Related Python CVEs
References
- https://github.com/ormar-orm/ormar/blob/master/examples/fastapi_quick_start.py#L55
- https://github.com/ormar-orm/ormar/blob/master/ormar/fields/foreign_key.py#L41
- https://github.com/ormar-orm/ormar/blob/master/ormar/models/helpers/pydantic.py#L108
- https://github.com/ormar-orm/ormar/blob/master/ormar/models/model.py#L89
- https://github.com/ormar-orm/ormar/blob/master/ormar/models/newbasemodel.py#L128
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-27953. Free for 1 server.
Get started free