postgresql/src/include/utils
Tom Lane 42ba393b59 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:04 +00:00
..
acl.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
array.h Remove SQL-compatibility function cardinality(). It is not exactly clear 2009-04-09 17:39:50 +00:00
ascii.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
builtins.h Accept 'on' and 'off' as input for boolean data type, unifying the syntax 2009-03-09 14:34:35 +00:00
cash.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
catcache.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
combocid.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
date.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
datetime.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
datum.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
dynahash.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
dynamic_loader.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
elog.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
errcodes.h Add new SQL:2008 error codes for invalid LIMIT and OFFSET values. Remove 2009-03-04 10:55:00 +00:00
flatfiles.h Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
fmgrtab.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
formatting.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
geo_decls.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
guc.h Prevent indirect security attacks via changing session-local state within 2009-12-09 21:58:04 +00:00
guc_tables.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
help_config.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
hsearch.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
inet.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
int8.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
inval.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
logtape.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
lsyscache.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
memutils.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
nabstime.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
numeric.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
palloc.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
pg_crc.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
pg_locale.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
pg_lzcompress.h This patch addresses some issues in TOAST compression strategy that 2008-03-07 23:20:21 +00:00
pg_rusage.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
plancache.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
portal.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
ps_status.h Add GUC update_process_title to control whether 'ps' display is updated 2006-06-27 22:16:44 +00:00
rel.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
relcache.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
resowner.h Fix bug in temporary file management with subtransactions. A cursor opened 2009-12-03 11:03:35 +00:00
selfuncs.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
snapmgr.h Fix snapshot management, take two. 2009-10-07 16:27:29 +00:00
snapshot.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
syscache.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
timestamp.h Fix overflow for INTERVAL 'x ms' where x is more than a couple million, 2009-08-18 21:23:21 +00:00
tqual.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
tuplesort.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
tuplestore.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
typcache.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
tzparser.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
uuid.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
varbit.h Update copyright for 2009. 2009-01-01 17:24:05 +00:00
xml.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00