X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AA2CD53824 for ; Mon, 2 May 2005 19:09:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16454-01 for ; Mon, 2 May 2005 22:09:14 +0000 (GMT) Received: from window.monsterlabs.com (window.monsterlabs.com [216.183.105.176]) by svr1.postgresql.org (Postfix) with SMTP id 8A86C5338F for ; Mon, 2 May 2005 19:09:13 -0300 (ADT) Received: (qmail 20654 invoked from network); 2 May 2005 22:09:14 -0000 Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) (209.149.56.238) by 0 with SMTP; 2 May 2005 22:09:14 -0000 In-Reply-To: <2369.1115064398@sss.pgh.pa.us> References: <2369.1115064398@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Message-Id: <83afb16522c2793852c5627842f604dd@sitening.com> Content-Transfer-Encoding: quoted-printable Cc: pgsql-announce@postgresql.org From: Thomas F.O'Connell Subject: Re: [ANNOUNCE] IMPORTANT: two new PostgreSQL security problems found Date: Mon, 2 May 2005 17:09:13 -0500 To: pgsql-admin@postgresql.org X-Mailer: Apple Mail (2.622) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/10 X-Sequence-Number: 17439 Considering that this is a security-related system catalog update, is=20 there any way of providing some sort of signature for a message like=20 this such that the community can feel that issuing some arcane commands=20= as a superuser won't open a hole rather than close one? This is the first time I've seen an announcement of this sort regarding=20= PostgreSQL, and I'm just curious about the release mechanism for it. I doubt if anyone is spoofing Tom, but in an era of phishing and=20 spoofing, one can't be too sure, especially if one is concerned about=20 security... -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC Strategic Open Source: Open Your i=99 http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-260-0005 On May 2, 2005, at 3:06 PM, Tom Lane wrote: > Two serious security errors have been found in PostgreSQL 7.3 and = newer > releases. These errors at least allow an unprivileged database user = to > crash the backend process, and may make it possible for an = unprivileged > user to gain the privileges of a database superuser. > > We are currently preparing new releases that will correct these=20 > problems > in freshly initdb'd installations. However, because these problems = are > really incorrect system catalog entries, updating to a new release = will > NOT by itself solve the problems in an existing installation. = Instead, > it is necessary for the database administrator to fix the catalog=20 > entries > manually, as described below. We are releasing this advisory to=20 > encourage > administrators of PostgreSQL installations to perform these fixes as=20= > soon > as possible. > > > Character conversion vulnerability > ---------------------------------- > > The more severe of the two errors is that the functions that support > client-to-server character set conversion can be called from SQL=20 > commands > by unprivileged users, but these functions are not designed to be safe > against malicious choices of argument values. This problem exists in > PostgreSQL 7.3.* through 8.0.*. The recommended fix is to disable=20 > public > EXECUTE access for these functions. This does not affect normal usage=20= > of > the functions for character set conversion, but it will prevent = misuse. > > To accomplish this change, execute the following SQL command as a > superuser: > > UPDATE pg_proc SET proacl =3D '{=3D}' > WHERE pronamespace =3D 11 AND pronargs =3D 5 > AND proargtypes[2] =3D 'cstring'::regtype; > > In 7.3.* through 8.0.*, this should report having updated 90 rows. > 7.4 and later will report a "WARNING: defaulting grantor to user ID 1" > which can be ignored. > > The above command must be carried out in *each* database of an > installation, including template1, and ideally including template0 as > well. If you do not fix the template databases then any subsequently > created databases will contain the same vulnerability. template1 can > be fixed in the same way as any other database, but fixing template0 > requires additional steps. First, from any database issue > > UPDATE pg_database SET datallowconn =3D true WHERE datname =3D = 'template0'; > > Next connect to template0 and perform the pg_proc update. Finally, do > > -- re-freeze template0: > VACUUM FREEZE; > -- and protect it against future alterations: > UPDATE pg_database SET datallowconn =3D false WHERE datname =3D=20 > 'template0'; > > > tsearch2 vulnerability > ---------------------- > > The other error is that the contrib/tsearch2 module misdeclares = several > functions as returning type "internal" when they do not have any > "internal" argument. This breaks the type safety of "internal" by > allowing users to construct SQL commands that invoke other functions > accepting "internal" arguments. The consequences of this have not = been > investigated in detail, but it is certainly at least possible to crash > the backend. > > This error affects PostgreSQL 7.4 and later, but only if you have > installed the contrib/tsearch2 module. The recommended fix is to > change the misdeclared functions so that they accept an "internal" > argument and therefore cannot be called directly from SQL commands. > To do this, execute the following command as a superuser: > > UPDATE pg_proc SET proargtypes[0] =3D 'internal'::regtype > WHERE oid IN ( > 'dex_init(text)'::regprocedure, > 'snb_en_init(text)'::regprocedure, > 'snb_ru_init(text)'::regprocedure, > 'spell_init(text)'::regprocedure, > 'syn_init(text)'::regprocedure > ); > > This should report 5 rows updated. (If it fails with a message > like "function "dex_init(text)" does not exist", then either tsearch2 > is not installed in this database, or you already did the update.) > > You will need to do this in *each* database in which you have = installed > tsearch2, including template1. You need not worry about template0, > however, since it will certainly not contain tsearch2. > > If you frequently install tsearch2 in new databases, you will also > want to modify the tsearch.sql script to declare these functions as > taking type internal in the first place. (The script fix will be part > of the upcoming releases, so you may be able to wait for those.) > > > On behalf of the PostgreSQL core committee, I'd like to apologize for > any problems that may arise from these errors. > > regards, tom lane > > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings