Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkdM1-005XeY-Kc for pgsql-bugs@arkaria.postgresql.org; Wed, 19 Feb 2025 06:14:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tkdM0-004T5F-2d for pgsql-bugs@arkaria.postgresql.org; Wed, 19 Feb 2025 06:14:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkd5t-004NTw-Lr for pgsql-bugs@lists.postgresql.org; Wed, 19 Feb 2025 05:58:01 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tkd5r-001ef5-24 for pgsql-bugs@lists.postgresql.org; Wed, 19 Feb 2025 05:58:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=unixarea.de ; s=blu3434000; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=g5kpd/YQ1p48FCgV9SPsq4AHAIv6u6lB/nd9EoBvwAg=; b=T6shWG4RcSUXMLvSh77KaC3Yxe qldn5yUrZGxU7Z+LSVMczaz32MIxk0YhHVhwQzq5zCSjTzbIhHbhpt0buQB6z6q4SI/0nE44S2FJg 2XbSxpYLCNbPD4fyBlB4ojHyDxvHj/gsnjpbLqvnaNAsIMqqxAO+2IELeFfjnppM/8Sql5gObz84n vNxM1Q5Em5b52NI1wM8yEDOnTNg7Cgd6mEh2W2QFXvv3ePoc0jl0ZyqoLpGimwQVvQa/YUP+r8Q2A 5rr2x0JsazjHyCrOexEiS3uvLgF4VaU56c1BxE93i+5WRhnFg5l+7Vue53DvI2Dmn6GmWJT6aZtGz sglQH2hA==; Received: from [62.216.207.183] (helo=pureos) by ms-10.1blu.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tkd5n-007TLO-JC; Wed, 19 Feb 2025 06:57:55 +0100 Date: Wed, 19 Feb 2025 06:57:52 +0100 From: Matthias Apitz To: Tom Lane Cc: Indrajeeth Deshmukh , David Rowley , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18817: Security Bug Report: Plaintext Password Exposure in Logs Message-ID: Reply-To: Matthias Apitz References: <18817-771682052a364bfe@postgresql.org> <1241094.1739893072@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1241094.1739893072@sss.pgh.pa.us> X-Operating-System: FreeBSD 14.0-CURRENT 1400094 (amd64) X-message-flag: Mails in HTML will not be read! Send only plain text. X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 62.216.207.183 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk El día martes, febrero 18, 2025 a las 10:37:52 -0500, Tom Lane escribió: > Indrajeeth Deshmukh writes: > > Thanks for sharing the details. It looks like a valid issue and has not > > been resolved yet. Currently, the solution is keeping the file remains > > secure, but when it comes to SIEM monitoring, it will be a major concern. > > Any thoughts on this? > > The real bottom-line answer to that is that passwords are just the > tip of the iceberg. The server log is likely to contain other > critical information depending on your application; consider credit > card numbers, HIPAA-protected medical details, etc. The server > has no way at all to know which fields might be sensitive in that > way. Even if we had some notion of which fields to hide, in cases > like statements with syntax errors, we couldn't reliably identify > which parts of a query string are sensitive. > > The only solution is to treat the server log files with the same > amount of care as you give to the database files themselves. > Or send them to /dev/null, but that's unlikely to be very workable > in practice. > > Independently of that, best practice is to never send cleartext > passwords to the server in the first place. psql has support > for setting a password without that, and I think libpq does too. What do I have to configure in the PostgreSQL server to get this reproduced? I tried: $ psql -Usisis testdb psql (15.1, server 16.5) WARNING: psql major version 15, server major version 16. Some psql features might not work. Type "help" for help. testdb=# CREATE USER bla WITH PASSWORD 'bla'; CREATE ROLE testdb=# and have nothing in the log: $ tail /data/postgresql165/log/postgresql-2025-02-19_000000.log ... 2025-02-19 06:15:23.582 CET [1947] LOG: checkpoint complete: wrote 1421 buffers (8.7%); 0 WAL file(s) added, 1 removed, 0 recycled; write=142.168 s, sync=0.003 s, total=142.186 s; sync files=57, longest=0.002 s, average=0.001 s; distance=18403 kB, estimate=18403 kB; lsn=5/72470898, redo lsn=5/7246F048 I even set log_statement = 'all' and restarted the server - nothing. The purpose of my question is to inform our 50++ PostgreSQL customers what they must avoid... Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub