pgsql: Prevent PL/Tcl from loading the "unknown" module from - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Prevent PL/Tcl from loading the "unknown" module from
Date
Msg-id 20100513182912.828927541D2@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
Prevent PL/Tcl from loading the "unknown" module from pltcl_modules unless
that is a regular table or view owned by a superuser.  This prevents a
trojan horse attack whereby any unprivileged SQL user could create such a
table and insert code into it that would then get executed in other users'
sessions whenever they call pltcl functions.

Worse yet, because the code was automatically loaded into both the "normal"
and "safe" interpreters at first use, the attacker could execute unrestricted
Tcl code in the "normal" interpreter without there being any pltclu functions
anywhere, or indeed anyone else using pltcl at all: installing pltcl is
sufficient to open the hole.  Change the initialization logic so that the
"unknown" code is only loaded into an interpreter when the interpreter is
first really used.  (That doesn't add any additional security in this
particular context, but it seems a prudent change, and anyway the former
behavior violated the principle of least astonishment.)

Security: CVE-2010-1170

Modified Files:
--------------
    pgsql/doc/src/sgml:
        pltcl.sgml (r2.49 -> r2.50)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/pltcl.sgml?r1=2.49&r2=2.50)
    pgsql/src/pl/tcl:
        pltcl.c (r1.132 -> r1.133)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/tcl/pltcl.c?r1=1.132&r2=1.133)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Prevent PL/Tcl from loading the "unknown" module from
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Prevent PL/Tcl from loading the "unknown" module from