postgresql/src/backend/utils
Tom Lane 62aba76568 Prevent indirect security attacks via changing session-local state within
an allegedly immutable index function.  It was previously recognized that
we had to prevent such a function from executing SET/RESET ROLE/SESSION
AUTHORIZATION, or it could trivially obtain the privileges of the session
user.  However, since there is in general no privilege checking for changes
of session-local state, it is also possible for such a function to change
settings in a way that might subvert later operations in the same session.
Examples include changing search_path to cause an unexpected function to
be called, or replacing an existing prepared statement with another one
that will execute a function of the attacker's choosing.

The present patch secures VACUUM, ANALYZE, and CREATE INDEX/REINDEX against
these threats, which are the same places previously deemed to need protection
against the SET ROLE issue.  GUC changes are still allowed, since there are
many useful cases for that, but we prevent security problems by forcing a
rollback of any GUC change after completing the operation.  Other cases are
handled by throwing an error if any change is attempted; these include temp
table creation, closing a cursor, and creating or deleting a prepared
statement.  (In 7.4, the infrastructure to roll back GUC changes doesn't
exist, so we settle for rejecting changes of "search_path" in these contexts.)

Original report and patch by Gurjeet Singh, additional analysis by
Tom Lane.

Security: CVE-2009-4136
2009-12-09 21:57:51 +00:00
..
adt Prevent indirect security attacks via changing session-local state within 2009-12-09 21:57:51 +00:00
cache Add exclusion constraints, which generalize the concept of uniqueness to 2009-12-07 05:22:23 +00:00
error Add support for an application_name parameter, which is displayed in 2009-11-28 23:38:08 +00:00
fmgr Prevent indirect security attacks via changing session-local state within 2009-12-09 21:57:51 +00:00
hash Update copyright for 2009. 2009-01-01 17:24:05 +00:00
init Prevent indirect security attacks via changing session-local state within 2009-12-09 21:57:51 +00:00
mb Make initdb behave sanely when the selected locale has codeset "US-ASCII". 2009-11-12 02:46:16 +00:00
misc Prevent indirect security attacks via changing session-local state within 2009-12-09 21:57:51 +00:00
mmgr Speed up AllocSetFreeIndex, which is a significant cost in palloc and pfree, 2009-07-21 19:53:12 +00:00
resowner Fix bug in temporary file management with subtransactions. A cursor opened 2009-12-03 11:03:29 +00:00
sort Extend EXPLAIN to support output in XML or JSON format. 2009-08-10 05:46:50 +00:00
time Fix snapshot management, take two. 2009-10-07 16:27:18 +00:00
.cvsignore Cleanup to ensure good state of derived files in tarballs. 2000-06-09 02:38:36 +00:00
Gen_dummy_probes.sed Update copyright for 2009. 2009-01-01 17:24:05 +00:00
Gen_fmgrtab.pl Update copyright for 2009. 2009-01-01 17:24:05 +00:00
Gen_fmgrtab.sh Update copyright for 2009. 2009-01-01 17:24:05 +00:00
Makefile Add a few more DTrace probes to the backend. 2008-08-01 13:16:09 +00:00
probes.d Revert DTrace patch from Robert Lor 2009-04-02 20:59:10 +00:00