SQLi is so Last
Where
Talks
ShmooCon 2025
Duration
21 min
Shows how Postgres roles, stored procedures and in-database JWT checks can limit what SQL injection is able to reach.
Summary
The talk asks why SQL injection keeps appearing despite prepared statements and ORMs. The speaker argues that prepared statements do not help if an attacker steals database credentials or finds a bug elsewhere, and that some ORMs have had injection flaws too. A core problem is that applications often connect as a powerful database role that can run arbitrary SQL.
The proposed remedy treats the database as an API. The application role receives execute rights only on security-definer functions that perform fixed operations, with row-level limits where needed. A stateless JWT, validated inside Postgres by an extension, lets the database itself decide who is calling rather than trusting the application server. A profile-update example shows the pattern end to end.
The speaker is candid about limits. Exposing the database directly is possible but largely untested, and a stored procedure that uses dynamic execute can itself be injectable, so static analysis and restricted roles remain important. Greenfield projects suit this best, though existing systems can migrate gradually. The takeaway is to shrink what a compromised query can reach rather than rely on one control.
Related talks
Talks·52 min
Nicholas Anastasi · Juan Pablo Gomez Postigo
Shows how a trusted proxy header bypassed authentication in popular self-hosted Servarr media applications.
Talks·45 min
Katie Paxton-Fear
Traces application security changes through the history of the Neopets virtual pet website, from plaintext passwords to bot defenses.
Talks·45 min
Covers modern attacks on OAuth, OIDC and JWT authentication flows and how they can be abused.


