From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Ignore attempts to \gset into specially treated variables.
Date: Mon, 09 Nov 2020 15:35:42 +0000
Message-ID: <E1kc9Co-0003Ng-St@gemulon.postgresql.org> (raw)
Ignore attempts to \gset into specially treated variables.
If an interactive psql session used \gset when querying a compromised
server, the attacker could execute arbitrary code as the operating
system account running psql. Using a prefix not found among specially
treated variables, e.g. every lowercase string, precluded the attack.
Fix by issuing a warning and setting no variable for the column in
question. Users wanting the old behavior can use a prefix and then a
meta-command like "\set HISTSIZE :prefix_HISTSIZE". Back-patch to 9.5
(all supported versions).
Reviewed by Robert Haas. Reported by Nick Cleaton.
Security: CVE-2020-25696
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/12fd81cb7fab49ba0a5f004596e52271275deec0
Modified Files
--------------
src/bin/psql/common.c | 7 +++++++
src/bin/psql/variables.c | 18 ++++++++++++++++++
src/bin/psql/variables.h | 1 +
src/test/regress/expected/psql.out | 4 ++++
src/test/regress/sql/psql.sql | 3 +++
5 files changed, 33 insertions(+)
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: noah@leadboat.com
Subject: Re: pgsql: Ignore attempts to \gset into specially treated variables.
In-Reply-To: <E1kc9Co-0003Ng-St@gemulon.postgresql.org>
References: <E1kc9Co-0003Ng-St@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