Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ne5Qk-0007yA-El for pgsql-general@arkaria.postgresql.org; Tue, 12 Apr 2022 01:34:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ne5Qj-0007to-4m for pgsql-general@arkaria.postgresql.org; Tue, 12 Apr 2022 01:34:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ne5Qi-0007tf-JO for pgsql-general@lists.postgresql.org; Tue, 12 Apr 2022 01:34:52 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ne5Qg-0007ms-3N for pgsql-general@lists.postgresql.org; Tue, 12 Apr 2022 01:34:51 +0000 Received: by mail-pg1-x535.google.com with SMTP id 66so15723656pga.12 for ; Mon, 11 Apr 2022 18:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=nKwyf+/ao4RgHAyG5El27/bOgA94ox+4L8/3B/nvM0I=; b=eHJw0UwKvWupJuVrvmwfwPu9iQqJqhGwJkCYu2BD47U/4UnckvFtXbx58uSFGFpToX vcF3I1sAAOrIhzMLchvAiNRF+IKuHKpta82cYCRIrsbXrejcVcdKvkNmQ+XEB3draWFa oFIH3enxB1S9YBV6wLL4YAEEcw30C2F5GMsWg4g9uSYx1kx9OUkvskKgA/Mi7TGi+3/1 TH4FbFF/HfpBXoHWWlrZaqozupdOKitzwrcyGwM2HN+VSYBParx1yoMhr9iOo0XYQR5g qF9/TEze2+UQ0tqiHflZsub5L9BIOvdSCL9eNZ3Jqjc7Li49DMCKS1I4dU80p/Fr482i CV3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=nKwyf+/ao4RgHAyG5El27/bOgA94ox+4L8/3B/nvM0I=; b=T7IP4fl6OYtMRgV8tFDjrESjgOR6LuspgtlgagZQkO6APaHOl80niLf283wqJ9JSzr vY89sW3S+gbEjTYDkvwmtQoPH5ag2uhs2dJGnyO6dzSdBcQcsx2TyPzB2qbjrTEifsdj hg3lC/XLFqmzZH/kJnHqHVMqncJFEyxe23+TBI5TEK9kYmzungv2YtUn651EBrT5vY7m JKtmGKRAOj3ygrtm8+x/aJovSvUERRXNqW2Di25kSJCTMdFGDbwu/HWLIocUW4H3hlfM O77F0qAydZ60I7DjhX3vBXF9euBuoi7nYJGJkAFBayHGD3AYSkbJIEDLQBWfZuiKw8Ly N9jA== X-Gm-Message-State: AOAM531z4dHMiWtf9PVAugDycYlsaRREA/MREF2nrxed8i2RUagsp9gf OVSexgIRc4S2V9kiNb0bPlo= X-Google-Smtp-Source: ABdhPJy0cd33BS4UXISuPJTdfMQ08+OCOTdJR665zzlIc9B5rPOOOEsWu8zH1CgV79m2Zvc7LZa6DA== X-Received: by 2002:a05:6a00:16c5:b0:505:c572:7c2a with SMTP id l5-20020a056a0016c500b00505c5727c2amr2134902pfc.46.1649727288931; Mon, 11 Apr 2022 18:34:48 -0700 (PDT) Received: from smtpclient.apple ([136.36.238.254]) by smtp.gmail.com with ESMTPSA id t186-20020a625fc3000000b0050595843879sm10002879pfb.213.2022.04.11.18.34.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Apr 2022 18:34:48 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-38C34B2C-4843-4C02-BB93-6A43D27896B0 Content-Transfer-Encoding: 7bit From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: How easy is it to lose permissions in 'public' schema? Date: Mon, 11 Apr 2022 19:34:46 -0600 Message-Id: <690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com> References: Cc: Tom Lane , "pgsql-generallists.postgresql.org" In-Reply-To: To: Adrian Klaver X-Mailer: iPhone Mail (19D52) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail-38C34B2C-4843-4C02-BB93-6A43D27896B0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Apr 11, 2022, at 6:51 PM, Adrian Klaver wro= te: >=20 > =EF=BB=BFOn 4/11/22 17:34, Tom Lane wrote: >> Adrian Klaver writes: >>>> On 4/11/22 16:10, Rob Sargent wrote: >>>>> I've just bumped into this. >>>>>=20 >>>>> barnard=3D> select public.genome_threshold_mono('a'::text,'b'::text); >>>>> ERROR: permission denied for schema public >>>>> LINE 1: select public.genome_threshold_mono('a'::text,'b'::text); >>>>>=20 >>>>> I know I haven't intentionally removed 'public' from grantee's purview= >>>>> and short of the code block above not actually getting run, any guesse= s >>>>> as to how access to 'public' got removed from grantee? >>> I'm going to say someone read this: >>> https://wiki.postgresql.org/wiki/A_Guide_to_CVE-2018-1058:_Protect_Your_= Search_Path >>> And did something along the line of this: >>> REVOKE CREATE ON SCHEMA public FROM PUBLIC; >> Note that that only recommends removing CREATE, though, not USAGE >> which is what Rob seems to be lacking. >=20 > Yeah that is why I threw in the 'And did something along the line of this'= and the 'Probably should take a look at what permissions the functions in p= ublic have?'. I'm guessing someone saw the release notes for 10.3(https://ww= w.postgresql.org/docs/10/release-10-3.html) and the comments on the mailing l= ist and got proactive. >=20 >> regards, tom lane >=20 Gentlemen,thank you.=20 Something similar to as described is a definite possibility during the =E2=80= =98bringing over=E2=80=99. Same time one of the brought over dbs was importe= d twice without constraints etc. I love being looked after. Cheers, rjs >=20 > --=20 > Adrian Klaver > adrian.klaver@aklaver.com --Apple-Mail-38C34B2C-4843-4C02-BB93-6A43D27896B0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Apr 11, 2022, at 6:= 51 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:

=EF=BB=BFOn 4/1= 1/22 17:34, Tom Lane wrote:
Adrian= Klaver <adrian.klaver@aklaver.com> writes:
On 4/11/22 16:10, Rob= Sargent wrote:
I've just bumped= into this.
=
barnard=3D> select pub= lic.genome_threshold_mono('a'::text,'b'::text);
ERROR:  permission denied for schema publi= c
LINE 1: select pu= blic.genome_threshold_mono('a'::text,'b'::text);

I know I haven't intentionally removed 'public' from grantee's p= urview
and short of= the code block above not actually getting run, any guesses
as to how access to 'public' got remo= ved from grantee?
I'm going to say someone re= ad this:
https://wiki.postgresql.org/wiki/A_Guide_to_CVE-2= 018-1058:_Protect_Your_Search_Path
And did something along= the line of this:
REVOKE CREATE ON SCHEMA public FROM PUB= LIC;
Not= e that that only recommends removing CREATE, though, not USAGE
which is what Rob seems to be lack= ing.

Yeah that is why I threw i= n the 'And did something along the line of this' and the 'Probably should ta= ke a look at what permissions the functions in public have?'. I'm guessing s= omeone saw the release notes for 10.3(https://www.postgresql.org/docs/10/rel= ease-10-3.html) and the comments on the mailing list and got proactive.

     =      regards, tom lane
<= br>
Gentlemen,thank you. 

Somethin= g similar to as described is a definite possibility during the =E2=80=98brin= ging over=E2=80=99. Same time one of the brought over dbs was imported twice= without constraints etc. I love being looked after.
Cheers= ,
rjs


--
Adrian Klaver
adrian= .klaver@aklaver.com
= --Apple-Mail-38C34B2C-4843-4C02-BB93-6A43D27896B0--