0
$\begingroup$

The spec ( https://github.com/ulid/spec which is not a real standard ) explains that there are 80 random bits in an ULID. UUIDv4 is better from a security aspect, as it has 122 bits for randomness. But UUIDv4 has no monotonic sort order, and that would be very benefical in my actual application.

So how bad would it be to use ULIDs for session ids?

$\endgroup$

1 Answer 1

1
$\begingroup$

Almost certainly unsafe. If two or more ULIDs would be generated in the same millisecond, the "random" component is replaced by a counter. An attacker could issue requests, then try adding or subtracting 1 to see if they collided with an existing session. If the system is processing more than 1000 requests per second the attack becomes certain to succeed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.