postgresql/src
Tom Lane 0d1ecd6300 Reset OpenSSL randomness state in each postmaster child process.
Previously, if the postmaster initialized OpenSSL's PRNG (which it will do
when ssl=on in postgresql.conf), the same pseudo-random state would be
inherited by each forked child process.  The problem is masked to a
considerable extent if the incoming connection uses SSL encryption, but
when it does not, identical pseudo-random state is made available to
functions like contrib/pgcrypto.  The process's PID does get mixed into any
requested random output, but on most systems that still only results in 32K
or so distinct random sequences available across all Postgres sessions.
This might allow an attacker who has database access to guess the results
of "secure" operations happening in another session.

To fix, forcibly reset the PRNG after fork().  Each child process that has
need for random numbers from OpenSSL's generator will thereby be forced to
go through OpenSSL's normal initialization sequence, which should provide
much greater variability of the sequences.  There are other ways we might
do this that would be slightly cheaper, but this approach seems the most
future-proof against SSL-related code changes.

This has been assigned CVE-2013-1900, but since the issue and the patch
have already been publicized on pgsql-hackers, there's no point in trying
to hide this commit.

Back-patch to all supported branches.

Marko Kreen
2013-03-27 18:50:21 -04:00
..
backend Reset OpenSSL randomness state in each postmaster child process. 2013-03-27 18:50:21 -04:00
bin Move some pg_dump function around. 2013-03-27 18:10:40 +02:00
common Move relpath() to libpgcommon 2013-02-21 22:46:17 -03:00
include Allow external recovery_config_directory 2013-03-27 11:45:42 +00:00
interfaces Re-include pqsignal() in libpq. 2013-03-17 15:45:31 -04:00
makefiles Blind attempt at fixing the non-MSVC Windows builds 2013-02-22 11:51:15 -03:00
pl Move pqsignal() to libpgport. 2013-03-17 12:06:42 -04:00
port initdb needs pqsignal() even on Windows. 2013-03-17 15:19:47 -04:00
template Remove _FORTIFY_SOURCE 2012-10-10 21:42:38 -04:00
test Fix "element <@ range" cost estimation. 2013-03-21 11:21:51 +02:00
timezone Add missing #include. 2013-03-25 09:55:43 +02:00
tools Add parallel pg_dump option. 2013-03-24 11:27:20 -04:00
tutorial Modernize string literal syntax in tutorial example. 2013-01-19 17:20:32 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.shlib Remove configure flag --disable-shared, as it is no longer used by any 2012-08-30 16:26:53 -04:00
nls-global.mk NLS: Use msgmerge --previous option 2012-12-13 23:12:12 -05:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00