pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Make json{b}_populate_recordset() use the right tuple descriptor
Date: Mon, 06 Nov 2017 15:29:58 +0000
Message-ID: <E1eBjLa-0002l2-SE@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Make json{b}_populate_recordset() use the right tuple descriptor.

json{b}_populate_recordset() used the tuple descriptor created from the
query-level AS clause without worrying about whether it matched the actual
input record type.  If it didn't, that would usually result in a crash,
though disclosure of server memory contents seems possible as well, for a
skilled attacker capable of issuing crafted SQL commands.  Instead, use
the query-supplied descriptor only when there is no input tuple to look at,
and otherwise get a tuple descriptor based on the input tuple's own type
marking.  The core code will detect any type mismatch in the latter case.

Michael Paquier and Tom Lane, per a report from David Rowley.
Back-patch to 9.3 where this functionality was introduced.

Security: CVE-2017-15098

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c   | 36 +++++++++++++++++++++++++-----------
src/test/regress/expected/json.out  | 13 +++++++++++++
src/test/regress/expected/jsonb.out | 13 +++++++++++++
src/test/regress/sql/json.sql       |  6 ++++++
src/test/regress/sql/jsonb.sql      |  6 ++++++
5 files changed, 63 insertions(+), 11 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 (5+ messages)

Message-ID: <E1eBjLa-0002l2-SE@gemulon.postgresql.org>
Permalink:  ../E1eBjLa-0002l2-SE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eBjLa-0002l2-SE@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Make json{b}_populate_recordset() use the right tuple descriptor
  In-Reply-To: <E1eBjLa-0002l2-SE@gemulon.postgresql.org>
  References: <E1eBjLa-0002l2-SE@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