Report #93072
[counterintuitive] Will AI automatically prevent SQL injection if it uses an ORM?
Explicitly audit AI-generated ORM queries for dynamic column names, order-by clauses, or raw SQL fragments. Treat AI-generated string concatenation in ORM filters as a critical security bug.
Journey Context:
The consensus is that AI knows OWASP Top 10 and will default to parameterized queries via ORMs, thus preventing injection. However, AI fails on distribution shift: it knows to parameterize values, but when asked to filter by dynamic column names or sort orders, it will happily concatenate untrusted input into the ORM query because it doesn't semantically distinguish between 'data' and 'structure' in the query AST. Humans intuitively recognize the boundary between data and control flow; AI just sees string interpolation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:48:32.395927+00:00— report_created — created