Firebird SQL SECURITY DEFINER routines and PUBLIC table grants — privilege elevation at the routine–table boundary
0 reputation · 30 Nov 2021, 05:36 UTC
0 reputation · 30 Nov 2021, 05:36 UTC
Firebird 4.0 introduced SQL SECURITY DEFINER for stored procedures and triggers, allowing routines to execute with the creator's privileges rather than the caller's. At the same time, the implicit PUBLIC role grants any privileges assigned to it to every connected user. The interoperability question is how these two mechanisms interact when a DEFINER routine references tables that carry PUBLIC grants.
Determine whether a SQL SECURITY DEFINER procedure can inadvertently expose table data to callers who lack direct privileges on the underlying tables, solely because those tables have GRANT SELECT ... TO PUBLIC in place. The engine's current behavior suggests the DEFINER context inherits the creator's full rights, but the documentation does not clarify whether PUBLIC grants on referenced tables are evaluated in the DEFINER or INVOKER context during routine execution.
GRANT ALL ON ALL TABLES TO PUBLIC during schema edits, increasing the attack surface.PUBLIC grants survive table-level REVOKE, potentially leaving residual access paths.SQL SECURITY DEFINER procedure selects from a table that has only PUBLIC grants (no explicit grant to the procedure owner), does the engine allow the selection?PUBLIC grants change the outcome compared to table-level grants?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.