News for hackers. Stuff that matters.
Re:Bear Does Analytics with CSS by tptacek on Wednesday November 01, 2023 @09:51AM (#38098159)
Salting a standard cryptographic hash (like SHA2) doesn't do anything meaningful to slow a brute force attack. This problem is the reason we have password KDFs like scrypt.

(I don't care about this Bear analytics thing at all, and just clicked the comment thread to see if it was the Bear I thought it was; I do care about people's misconceptions about hashing.)

Re:Bear Does Analytics with CSS by alkonaut on Wednesday November 01, 2023 @10:41AM (#38098821)
What do you mean by "brute force" in the context of reversing PII that has been obscured by a one way hash? My IP number passed through SHA1 with a hash (which I generated and stored safely on my machine) is 6FF6BA399B75F5698CEEDB2B1716C46D12C28DF5

The only thing you can brute force from that is some IP and some salt such that SHA1(IP+Salt) = 6FF6BA399B75F5698CEEDB2B1716C46D12C28DF5 But you'll find millions of such IPs. It's not revealing my IP even if you manage to find a match?

Re:Bear Does Analytics with CSS by infinityio on Wednesday November 01, 2023 @11:02AM (#38099134)
If you also explicitly mentioned the salt used (as bear appear to have done?), this just becomes a matter of testing 4 billion options and seeing which matches
Re:Bear Does Analytics with CSS by alkonaut on Wednesday November 01, 2023 @11:07AM (#38099234)
I think it's just unsalted in the example code. Or you could argue that the date is kind of used as a salt. But the point was that salting + hashing is fine for PII in telemetry if and only if the salt stays on the client. It might be difficult to do without JS though.
Re:Bear Does Analytics with CSS by remram on Wednesday November 01, 2023 @09:04PM (#38107615)
What does "stay on the client" mean? It has to be consistent across visits and you don't want to use cookies (otherwise you don't need to mess with addresses at all). You have no option except sending every client the same salt.
Re:Bear Does Analytics with CSS by alkonaut on Thursday November 02, 2023 @04:03AM (#38110301)
In this context it means exactly that: staying on the client. And yes that means using cookies (or rather, local storage probably). So this is requiring consent no matter how you do it. But note that the system in the article also requires consent since it sends PII (the IP) over the wire and saves it on the server. It's reversible and not anonymous - so it's even worse than using a cookie without consent I'd say.

Yes if all you ever want to send is a unique visitor ID then there is no point in having a local hash, because you can just generate a random ID and use that to identify the user.

What I mean is that if you want to send multiple pieces of PII (such as an IP, a filename, a username,...) then the only way to do that safely is to send hash(salt+filename) for example, where the salt is not known to the server receiving the hash. The IP in the suggestion to use a locally stored hash here just represented "PII that should be sent anonymously" and not "A good way of identifying a unique system".

Re:Bear Does Analytics with CSS by michaelmior on Wednesday November 01, 2023 @11:06AM (#38099202)
> Salting a standard cryptographic hash (like SHA2) doesn't do anything meaningful to slow a brute force attack.

Sure, but it does at least prevent the use of rainbow tables. Arguably not relevant in this scenario, but it doesn't mean that salting does nothing. Rainbow tables can speed up attacks by many orders of magnitude. Salting may not prevent each individual password from being brute forced, but for most attackers, it probably will prevent your entire database from being compromised due to the amount of computation required.

Re:Bear Does Analytics with CSS by tptacek on Wednesday November 01, 2023 @01:43PM (#38101926)
Rainbow tables don't matter. If you're discussing the strength of your scheme with or without rainbow tables, you have already lost.

https://news.ycombinator.com/item?id=38098188

Re:Bear Does Analytics with CSS by robertlagrant on Wednesday November 01, 2023 @06:32PM (#38106292)
That's just a link where you claim the same thing. What's your actual rationale? Do you think salting is pointless?
Re:Bear Does Analytics with CSS by tptacek on Thursday November 02, 2023 @09:30PM (#38123185)
I think it's meaningless. Every password KDF is randomized. But randomization isn't what makes them difficult to brute-force; non-password-KDF "salted" hashes are extremely easy to brute force, which is the whole reason we have password KDFs.

"Salted hashes" are one of the more treacherous security cargo cults, because they create the impression that the big problem you have to solve hashing a password is somehow mixing in a salt. No: just doing that by itself doesn't accomplish anything meaningful at all.

Re:Bear Does Analytics with CSS by robertlagrant on Friday November 03, 2023 @05:39AM (#38126397)
Understood, but I think this is just people using "hash" and "KDF" interchangeably. Agree that a KDF is the way to go, but salting it is also a good idea to explode the search space.
Re:Bear Does Analytics with CSS by michaelmior on Thursday November 02, 2023 @01:04PM (#38116644)
I don't follow your point. Yes, you can brute force. But if I have 50,000 unsalted password hashes, I can crack those using rainbow tables much faster than brute forcing all 50,000. For a single password hash, I agree it probably doesn't really matter.
Re:Bear Does Analytics with CSS by juliusdavies on Thursday November 02, 2023 @05:05PM (#38120127)
I don't understand why anyone would ever have 50,000 or even 1 unsalted password hash.