pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16449: Log file and the query field of the pg_stat_statements table display clear text password.
4+ messages / 4 participants
[nested] [flat]
* BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password.
@ 2020-05-18 09:16 PG Bug reporting form <noreply@postgresql.org>
2020-05-18 09:45 ` Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 4+ messages in thread
From: PG Bug reporting form @ 2020-05-18 09:16 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: abcxiaod@126.com
The following bug has been logged on the website:
Bug reference: 16449
Logged by: yi Ding
Email address: abcxiaod@126.com
PostgreSQL version: 10.12
Operating system: linux
Description:
1、The log_statement is set to ALL
2、Execute statement:alter user t password 'adsf123asg';
3、Log file shows clear text password.
2020-05-18 10:32:11.606
CST,"postgres","postgres",16959,"[local]",5ec1f354.423f,3,"",2020-05-18
10:30:44 CST,14/26972,0,LOG,00000,"statement: alter user t password
'adsf123asg';",,,,,,,,"exec_simple_query, postgres.c:963","psql"
4、The query field of the pg_stat_statements table displays the clear text
of the password.
postgres=# select * from pg_stat_statements where queryid = '2555618481';
-[ RECORD 1 ]-------+-----------------------------------
userid | 10
dbid | 12298
queryid | 2555618481
query | alter user t password 'adsf123asg'
calls | 2
total_time | 0.266986
min_time | 0.127103
max_time | 0.139883
mean_time | 0.133493
stddev_time | 0.00639000000000001
rows | 0
shared_blks_hit | 6
shared_blks_read | 0
shared_blks_dirtied | 2
shared_blks_written | 0
local_blks_hit | 0
local_blks_read | 0
local_blks_dirtied | 0
local_blks_written | 0
temp_blks_read | 0
temp_blks_written | 0
blk_read_time | 0
blk_write_time | 0
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password.
2020-05-18 09:16 BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. PG Bug reporting form <noreply@postgresql.org>
@ 2020-05-18 09:45 ` Magnus Hagander <magnus@hagander.net>
2020-05-19 06:22 ` Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
0 siblings, 1 reply; 4+ messages in thread
From: Magnus Hagander @ 2020-05-18 09:45 UTC (permalink / raw)
To: abcxiaod@126.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, May 18, 2020 at 11:41 AM PG Bug reporting form <
noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16449
> Logged by: yi Ding
> Email address: abcxiaod@126.com
> PostgreSQL version: 10.12
> Operating system: linux
> Description:
>
> 1、The log_statement is set to ALL
> 2、Execute statement:alter user t password 'adsf123asg';
> 3、Log file shows clear text password.
>
Yes, if you intentionally send the query in clear text, it will be logged
in clear text.
Just like with your report about creating user, it is clearly documented in
the ALTER ROLE documentation that if you don't want this, you should use
\password or a similar functionality, and not the cleartext ALTER USER.
--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password.
2020-05-18 09:16 BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. PG Bug reporting form <noreply@postgresql.org>
2020-05-18 09:45 ` Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. Magnus Hagander <magnus@hagander.net>
@ 2020-05-19 06:22 ` Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
2020-05-19 07:02 ` Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 4+ messages in thread
From: Oleksandr Shulgin @ 2020-05-19 06:22 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: abcxiaod@126.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, May 18, 2020 at 11:45 AM Magnus Hagander <magnus@hagander.net>
wrote:
>
>> 1、The log_statement is set to ALL
>> 2、Execute statement:alter user t password 'adsf123asg';
>> 3、Log file shows clear text password.
>>
>
> Yes, if you intentionally send the query in clear text, it will be logged
> in clear text.
>
> Just like with your report about creating user, it is clearly documented
> in the ALTER ROLE documentation that if you don't want this, you should
> use \password or a similar functionality, and not the cleartext ALTER USER.
>
I think it's worth noting that using psql's \password command still results
in an ALTER USER being sent to the server, and thus ending up in the logs.
The difference is that the logged password is already encrypted:
postgres=# \set ECHO_HIDDEN
postgres=# \password t
Enter new password:
Enter it again:
********* QUERY **********
ALTER USER t PASSWORD 'md5cf853b7f00ed64ef120b3f6af0d073c2'
**************************
Cheers,
--
Alex
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password.
2020-05-18 09:16 BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. PG Bug reporting form <noreply@postgresql.org>
2020-05-18 09:45 ` Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. Magnus Hagander <magnus@hagander.net>
2020-05-19 06:22 ` Re: BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
@ 2020-05-19 07:02 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 4+ messages in thread
From: Michael Paquier @ 2020-05-19 07:02 UTC (permalink / raw)
To: Oleksandr Shulgin <oleksandr.shulgin@zalando.de>; +Cc: Magnus Hagander <magnus@hagander.net>; abcxiaod@126.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Tue, May 19, 2020 at 08:22:09AM +0200, Oleksandr Shulgin wrote:
> I think it's worth noting that using psql's \password command still results
> in an ALTER USER being sent to the server, and thus ending up in the logs.
> The difference is that the logged password is already encrypted:
>
> postgres=# \set ECHO_HIDDEN
> postgres=# \password t
> Enter new password:
> Enter it again:
> ********* QUERY **********
> ALTER USER t PASSWORD 'md5cf853b7f00ed64ef120b3f6af0d073c2'
> **************************
Even with that, please also remember that for a md5-hashed password,
having the MD5 hash is enough to be able to log into the server.
That's not the case with SCRAM...
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-05-19 07:02 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 09:16 BUG #16449: Log file and the query field of the pg_stat_statements table display clear text password. PG Bug reporting form <noreply@postgresql.org>
2020-05-18 09:45 ` Magnus Hagander <magnus@hagander.net>
2020-05-19 06:22 ` Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
2020-05-19 07:02 ` Michael Paquier <michael@paquier.xyz>
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