473,770 Members | 5,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Salt in encrypted password in pg_shadow

I read that the password hash in pg_shadow is salted with username. Is
this still the case? If so, since probably 99% of all PostgreSQL has
"postgres" as the superuser name, wouldn't it be better to use standard
Unix/Apache MD5 hash instead?

--
dave
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05
26 5517
Bruno Wolff III wrote:
On Wed, Sep 08, 2004 at 00:33:39 -0400,
Tom Lane <tg*@sss.pgh.pa .us> wrote:
I've been hearing rumblings that MD5 and all other known crypto
protocols are known vulnerable since the latest crypto symposiums.
(Not that we didn't all suspect the NSA et al could break 'em, but
now they've told us exactly how they do it.)

Things aren't currently that bad. So far people have found a way to find
two strings that give the same hash using MD5. They haven't yet found a way
to find a string which hashes to a given hash. SHA-0 was also shown to
have some weakness. From comments I have read, I don't think SHA-1 was
shown to have any weaknesses. One comment specifically mentioned that
the change made between SHA-0 and SHA-1 seems to have been made to address
the weakness found in SHA-0. I haven't read the source papers, so take this
all with a grain of salt.


Well, when SHA-0 was ready NSA suggested to apply some changes in order to
correct some flaw discovered and SHA-1 comes out, interesting NSA never wrote
which flaw was corrected!
May be SHA-1 is trasparent water to NSA eyes :-)

I'm sure this entire thread will be stored somewhere else then archives...

Regards
Gaetano Mendola


Nov 23 '05 #21
Gaetano Mendola <me*****@bigfoo t.com> writes:
Well, when SHA-0 was ready NSA suggested to apply some changes in order to
correct some flaw discovered and SHA-1 comes out, interesting NSA never wrote
which flaw was corrected!
May be SHA-1 is trasparent water to NSA eyes :-)


This is awfully similar to the story that's told about DES:

When DES was under development the NSA told people to try a few specific
constants for the "sboxes" stage of the cipher. As far as anyone at the time
could tell they were completely random values and nearly any value would have
been just as good.

Then 30 years later when differential cryptanalysis was invented people found
the values the NSA told them to use are particularly resistant to differential
cryptanalysis attacks. Almost any other values and DES would have fallen right
then.

This means it's quite possible the NSA had differential cryptanalysis 30 years
before anyone else. Quite a remarkable achievement. However it's unlikely that
the same situation holds today. 30 years ago nobody outside the government was
doing serious cryptanalysis. If you were a mathematician interested in the
field you worked for the NSA or you changed fields. These days there's tons of
research in universities and in the private sector in serious cryptanalysis.
The NSA still employs plenty of good cryptanalysts but they no longer have the
monopoly they did back then.

--
greg
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #22
Greg Stark wrote:
Gaetano Mendola <me*****@bigfoo t.com> writes:

Well, when SHA-0 was ready NSA suggested to apply some changes in order to
correct some flaw discovered and SHA-1 comes out, interesting NSA never wrote
which flaw was corrected!
May be SHA-1 is trasparent water to NSA eyes :-)

This is awfully similar to the story that's told about DES:

When DES was under development the NSA told people to try a few specific
constants for the "sboxes" stage of the cipher. As far as anyone at the time
could tell they were completely random values and nearly any value would have
been just as good.

Then 30 years later when differential cryptanalysis was invented people found
the values the NSA told them to use are particularly resistant to differential
cryptanalysis attacks. Almost any other values and DES would have fallen right
then.

This means it's quite possible the NSA had differential cryptanalysis 30 years
before anyone else. Quite a remarkable achievement. However it's unlikely that
the same situation holds today. 30 years ago nobody outside the government was
doing serious cryptanalysis. If you were a mathematician interested in the
field you worked for the NSA or you changed fields. These days there's tons of
research in universities and in the private sector in serious cryptanalysis.
The NSA still employs plenty of good cryptanalysts but they no longer have the
monopoly they did back then.


I will invite you to repeat the same sentence in 2034 ... :-)

Regards
Gaetano Mendola

Nov 23 '05 #23

Chris Travers <ch***@metatron tech.com> writes:
This only works because you have a theoretical delay between incorrect
password attempts, so dictionary attacks directly are supposed to be
difficult to impliment. I say theoretically because a smart attacker will
use a program to open multiple telnet connections simultaneously to try a
large number of passwords at once.


No, this is irrelevant to salts. People actually trying to log in is not the
threat model that salts are there to protect. This is not what is meant by
"dictionary attack".

What is meant by dictionary attack in the context of hashed passwords is
someone generating a "dictionary " of hashes for every guessable password. Then
they can take any hash they find in a password database and look up in their
"dictionary " a valid password it.

Salts prevent this by forcing someone to generate 2^16 possible hashes for
every possible guessable password. Essentially making them hash every
guessable password again anew for each user attacked.

They're only relevant for attackers who have access to the password database.
Not for attackers who are just knocking on the door over and over.

The weakness described would apply to someone who had access to many
pg_shadows from many installations. They could check every "postgres" user
against their dictionary quickly. Or an unscrupulous dba could assign
usernames starting with the same two letters for everyone and then guess
people's passwords by looking up the hashes in a dictionary.

--
greg
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 23 '05 #24
Hi all;

With all due respect I generally side with Tom here.

Random salt values make sense in a few environments, for example, local
logins. They are designed to prevent someone from, say, copying the old
/etc/passwd or new /etc/shadow and then running an attack against the
passwords on it so that these passwords can be used to attack the
machine. This only works because you have a theoretical delay between
incorrect password attempts, so dictionary attacks directly are supposed
to be difficult to impliment. I say theoretically because a smart
attacker will use a program to open multiple telnet connections
simultaneously to try a large number of passwords at once.

Iirc, if PostgreSQL recieves a bad authentication attempt, it returns an
error and drops the connection. This is a double-edged sword
security-wise (allows for rapid dictionary attacks, but makes DoS a bit
less of a problem) and is a benefit performance-wise. So for the real
question: why would random salt values provide any security when it
would be less costly just to use a dictionary attack against account
itself? Given this model, it seems the only security benefit would be
that the attack Greg describes would be less likely to show up in the
logs. However, it could only work if the PostgreSQL instance is already
compromised, so this argument is somewhat moot. His argument seems to
be along the lines that the random salt in the /etc/shadow prevents root
from masquerading as any other user, which doesn't really work since
root can do this anyway. If an attacker can read pg_shadow, the fact
that the salt is not random is the least of your concerns.....

Best Wishes,
Chris Travers
Metatron Technology Consulting
Greg Stark wrote:
Tom Lane <tg*@sss.pgh.pa .us> writes:
Greg Stark <gs*****@mit.ed u> writes:

However with a known salt you only have to store the 1,000 hashes with the
known salt. You could instead store a dictionary of 64 million password
guesses in the same gigabyte.

This is still not responding to my original point though: if you know
the salt that was used, you can try brute-force scan of a few thousand
probable passwords in less CPU time than it will take to read a gigabyte
of precomputed hashes. The fact that common passwords are much shorter
than the fixed-size MD5 hashes works against you in a big way.


We must be talking past each other. The threat model salts are meant to defend
against is someone who has access to the data in pg_shadow for many users.
Without the salts or with salts you can predict beforehand you look up the
hash value in your precomputed dictionary using an index and instantaneously
get a working password.

Postgres's current method is in fact doing it wrong. Because the salt is
predictable for the "postgres" users it doesn't protect against the attack
above. If I knew I could get access to lots of pg_shadow's, say I work at an
off-site backup storage company, I could check each of them instantaneously
against a precomputed index of hundreds of thousands of guessable passwords.
The same attack against a well salted hash would require running the entire
battery of hashes against each client's password individually.

The reason I say the threat model doesn't apply is only because it's unlikely
that someone would have access to many postgres installs's pg_shadow. That's
the only situation where that attack would arise. (Or if a given install had
hundreds of users with the same initial letters I guess, but that also seems
rare)

But if you're not going to worry about that threat then salting is buying you
nothing anyways. If you're going to use a salt you may as well use one that
accomplishes what it's there for.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #25
Tom Lane <tg*@sss.pgh.pa .us> writes:
it's unlikely that the same situation holds today.
Why would you think that? The US government may not have too many
clues, but they certainly understand the importance of crypto. I cannot
think of any reason to suppose that NSA et al would have stopped
spending serious effort in this area.


Certainly the NSA hasn't stopped spending serious effort. What's changed is
that now there is serious effort outside the NSA as well. In academia and the
private sector, not to mention other national governments.

That wasn't the case 30 years ago partially because the money just wasn't
there outside the NSA, and partially because the NSA was extremely persuasive
in hiring away anyone doing research. It's hard to do get ahead in
publish-or-perish academia when everything you're working on suddenly becomes
classified...
(Where "serious effort" is measured by the standard of "a billion here, a
billion there, pretty soon you're talking about real money".)
Well there's a limit to how much you can spend on researcher salaries. There
are only so many researchers available to hire. Of course we don't know what
their full budget is but if it's in the billions (which it may well be) it's
probably mostly spent on operational costs, not research.
Quite honestly, as a US taxpayer I would not be happy if the NSA were
not far ahead of public research in this field ...


It's presumably ahead. But not like the situation 30 years ago when they were
the only group doing this kind of research.

--
greg
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #26
Greg Stark <gs*****@mit.ed u> writes:
This means it's quite possible the NSA had differential cryptanalysis
30 years before anyone else.
s/quite possible/known fact/
Quite a remarkable achievement. However
it's unlikely that the same situation holds today.


Why would you think that? The US government may not have too many
clues, but they certainly understand the importance of crypto. I cannot
think of any reason to suppose that NSA et al would have stopped
spending serious effort in this area. (Where "serious effort" is
measured by the standard of "a billion here, a billion there, pretty
soon you're talking about real money".)

Quite honestly, as a US taxpayer I would not be happy if the NSA were
not far ahead of public research in this field ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #27

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7523
by: Ian Davies | last post by:
Hello I would like to query the user table of the mysql database from my VB application to check that a user's password entered in a text field on a form corresponds to that users password in the mysql database. However, when I retreive the password using an sql statement into a recordset, it is encrypted. How can I decrypt it so I can make the comparison. Ian
0
2259
by: aji | last post by:
Hello, I have question about an encrypted password field in an MSAccess database file. My task is to migrate a shopping cart from ASP/Access to PHP/MySQL... which is quite new territory for me! Now, everything went smoothly so far: I exported the Access data into a textfile, remodeled it to fit the new shopping cart data base and imported it using phpMyAdmin...
2
2244
by: Roland Riess | last post by:
Hi NG, I don't know if I'm just missing the forest through the trees, or if it is really that complicated: I want to save a password that is entered/changed through a text control in a form. The control is bound to a dataset and the password shall be stored as an encrypted text in the database. I first tried to control the en- and decryption in the textbox's Format
0
1204
by: zelzel.zsu | last post by:
Is there any good methods to read a encrypted password file? hi, all: I've a zipped file with a password . currently i use it by this method: $ unzip -p secret.zip | python my-pexpect.py but i want to remove the unzip -p secret.zip process. that is : $ python my-pexpect.py
0
1016
by: Glenn | last post by:
Hi All: I was wondering if anyone has experienced any issues with users passwords after the have installed Microsoft's latest security update MS07-031. I am using the default AspNetSqlMembershipProvider passwordFormat = "Hashed". However, quite inexplicably, the hash generated by the provider changed even though it was using the same salt. The only thing that I can think of is that, some how, the security update changed the...
2
3059
by: prosad | last post by:
hi! Am having a problem inserting password after encrypting into a column of a table. am using MySQL. $loginid = $_POST; $password = $_POST; $encrypt_password = md5($password); if ($_POST) {
5
6098
by: Shmuel | last post by:
Hello, Is it possible to give to mysql_connect an encrypted (md5 or sha1) password? If not is there a workaround? I store passwords for users in database and don't want to use plain text passwords. Then I use that information to connect to the database. So every user have his own database.
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.