postgresql/src/backend
Tom Lane ab4bbf941f 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:58:30 +00:00
..
access Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:30 +00:00
bootstrap On systems that have setsid(2) (which should be just about everything except 2006-11-21 20:59:53 +00:00
catalog Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:30 +00:00
commands Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:30 +00:00
executor Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:30 +00:00
lib
libpq Reject certificates with embedded NULLs in the commonName field. This stops 2009-12-09 06:37:21 +00:00
main Fix erroneous implementation of -s in postmaster.c (the switch doesn't take 2007-01-04 00:58:01 +00:00
nodes Fix an oversight in the code that makes transitive-equality deductions from 2008-12-01 21:06:31 +00:00
optimizer Partially revert my patch of 2008-11-12 that installed a limit on the number 2009-05-11 17:56:22 +00:00
parser Defend against null input in analyze_requires_snapshot(), per report 2009-01-30 16:59:16 +00:00
po Translation updates 2009-12-08 22:13:05 +00:00
port Call SetLastError(0) before calling the file mapping functions 2009-05-04 08:36:42 +00:00
postmaster Ignore attempts to set "application_name" in the connection startup packet. 2009-12-02 17:41:39 +00:00
regex Fix assorted security-grade bugs in the regex engine. All of these problems 2008-01-03 20:48:49 +00:00
rewrite Fix more problems with rewriter failing to set Query.hasSubLinks when inserting 2008-09-24 16:53:00 +00:00
storage Fix bug in temporary file management with subtransactions. A cursor opened 2009-12-03 11:03:55 +00:00
tcop Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:30 +00:00
utils Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:30 +00:00
Makefile On Windows, we know the backend stack size limit because we have to 2006-10-08 17:15:34 +00:00
nls.mk Install a more robust solution for the problem of infinite error-processing 2008-10-27 19:37:36 +00:00