News for hackers. Stuff that matters.
Re:Blog post id enumeration can lead to unwanted information... by mosburger on Monday February 29, 2016 @09:13AM (#11195518)
One reason I started using UUIDs for database IDs is in case I make an utterly incompetent mistake and leave a URL-hacking security hole somewhere, you still would need to guess a ridiculous ID to get at anything useful.

EDIT: I realize UUIDs are not "secure random" tokens and this isn't sufficient for real security, it's just a nice to have encumbrance if I screw up something I should've made secure in the first place. It's no substitute for doing your job right in the first place. :)

Re:Blog post id enumeration can lead to unwanted information... by JoeAltmaier on Monday February 29, 2016 @09:21AM (#11195562)
Some UUIDs are cryptographically secure. But maybe they are too expensive.

I support UUIDs instead of nearly any other id space. They solve collision problems completely. Its time to stop managing ids.

Re:Blog post id enumeration can lead to unwanted information... by zeveb on Monday February 29, 2016 @10:38AM (#11196031)
> Some UUIDs are cryptographically secure.

Not if they are RFC 4122 UUIDs (more accurately, they are insufficiently cryptographically secure): even the random ones are only 122 bits, which only provide 61 bits of security.

UUIDs are still really, really useful. I don't recommend not using them unless one understands why and when not to.

Re:Blog post id enumeration can lead to unwanted information... by marcosdumay on Monday February 29, 2016 @11:03AM (#11196199)
> But maybe they are too expensive.

Why would that be? You can fork your PRNG as many times as you have threads in initialization, so there's no need for IO. And secure ones do spend many times more CPU than the cheapest PRNG available, both would be a rounding error on the performance on nearly all real world work-loads.

I'd support removing non-secure random functions from every standard library out there.

Re:Blog post id enumeration can lead to unwanted information... by JoeAltmaier on Monday February 29, 2016 @11:12AM (#11196263)
We used UUIDs for every media stream in our media engine. Had to create about 15 per second during prime-time conference hours. It was 40% of our CPU load! So they aren't free.
Re:Blog post id enumeration can lead to unwanted information... by dchest on Monday February 29, 2016 @11:48AM (#11196487)
15 per second for 40% CPU? ಠ_ಠ This is very strange. On my laptop:

   ~ $ python -m timeit -s 'import uuid' 'uuid.uuid4()'
   100000 loops, best of 3: 14.2 usec per loop
Which gives more than 70000 random UUIDs per second.
Re:Blog post id enumeration can lead to unwanted information... by JoeAltmaier on Monday February 29, 2016 @11:52AM (#11196511)
Yeah we were using some cryptographically secure ones for some reason. Creating them in Java!
Re:Blog post id enumeration can lead to unwanted information... by dchest on Monday February 29, 2016 @11:54AM (#11196522)
Python's uuid4 is cryptographically secure, as far as I know. One UUID needs ~16 random bytes, my laptop's /dev/urandom gives about 14 MB/s (user-space PRNG can be much faster if needed).

Ah, Java...

Re:Blog post id enumeration can lead to unwanted information... by JoeAltmaier on Monday February 29, 2016 @12:24PM (#11196737)
To be cryptographically secure, it must be unguessable. That's a higher bar than random, because many random number generators are guessable (i.e. completely predictable).
Re:Blog post id enumeration can lead to unwanted information... by marcosdumay on Monday February 29, 2016 @06:10PM (#11199475)
Linux /dev/urandom is cryptographically secure.

The library you are using for creating those UUIDs must have some bug. My guess is they share the same generator for all threads on each machine.

Re:Blog post id enumeration can lead to unwanted information... by JoeAltmaier on Tuesday March 01, 2016 @01:30AM (#11201106)
From Wikipedia : "some people claim /dev/urandom as not recommended[who?] for the generation of long-term cryptographic keys"
Re:Blog post id enumeration can lead to unwanted information... by marcosdumay on Tuesday March 01, 2016 @07:38AM (#11202198)
It's manpage also says the same.

It is a cryptographically secure PRNG, but during a small time in system start up, it may not be correctly seeded.

If you need long term keys, it may be better to get some 256 bits from /dev/random before using /dev/urandom.

Re:Blog post id enumeration can lead to unwanted information... by dchest on Tuesday March 01, 2016 @08:14AM (#11202332)
Re:Blog post id enumeration can lead to unwanted information... by mosburger on Monday February 29, 2016 @11:04AM (#11196210)
Oh definitely, there are lots of reasons to use UUIDs. My case above is one of the sillier ones. :)