pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Add security checks to selectivity estimation functions
Date: Mon, 08 May 2017 13:32:06 +0000
Message-ID: <E1d7ili-0003sZ-9l@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Add security checks to selectivity estimation functions

Some selectivity estimation functions run user-supplied operators over
data obtained from pg_statistic without security checks, which allows
those operators to leak pg_statistic data without having privileges on
the underlying tables.  Fix by checking that one of the following is
satisfied: (1) the user has table or column privileges on the table
underlying the pg_statistic data, or (2) the function implementing the
user-supplied operator is leak-proof.  If neither is satisfied, planning
will proceed as if there are no statistics available.

At least one of these is satisfied in most cases in practice.  The only
situations that are negatively impacted are user-defined or
not-leak-proof operators on a security-barrier view.

Reported-by: Robert Haas <robertmhaas@gmail.com>
Author: Peter Eisentraut <peter_e@gmx.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>

Security: CVE-2017-7484

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c33c42362256382ed398df9dcda559cd547c68a7

Modified Files
--------------
doc/src/sgml/planstats.sgml                 |  60 +++++++++++
src/backend/utils/adt/array_selfuncs.c      |   6 +-
src/backend/utils/adt/rangetypes_selfuncs.c |  22 ++++
src/backend/utils/adt/selfuncs.c            | 160 ++++++++++++++++++++++------
src/include/utils/selfuncs.h                |   2 +
src/test/regress/expected/privileges.out    |  97 +++++++++++++++++
src/test/regress/sql/privileges.sql         |  61 +++++++++++
7 files changed, 376 insertions(+), 32 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (6+ messages)  latest in thread

Message-ID: <E1d7ili-0003sZ-9l@gemulon.postgresql.org>
Permalink:  ../E1d7ili-0003sZ-9l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1d7ili-0003sZ-9l@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: pgsql: Add security checks to selectivity estimation functions
  In-Reply-To: <E1d7ili-0003sZ-9l@gemulon.postgresql.org>
  References: <E1d7ili-0003sZ-9l@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox