API Pentesting Part-2: Replay Attack- No Expiry on Authentication Headers (HMAC SHA-256)
The API uses HMAC-SHA256 authentication headers but does not check timestamps or nonces, so any captured valid request can be replayed indefinitely. An attacker who intercepts a request could repeat sensitive actions such as wallet deductions or filing submissions.
Published on medium.com
Continue to previous write up this is the one of the finding that I found in API pentesting. During API penetration testing of the taxation endpoints, we discovered that the API accepts previously captured, valid requests indefinitely.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The server verifies the HMAC signature but does not enforce freshness by requiring a timestamp or nonce, nor does it track or reject repeated signatures.
Impact
Attackers who capture a valid request can replay it to repeat state-changing actions such as payments or submissions, potentially causing financial loss or fraud; the report does not mention any defence that limited the attack.
What the attacker needed
Ability to intercept a valid request; test account with permission
The fix
The server should require and validate a timestamp and a unique nonce in each request, reject expired or reused values, and bind the HMAC to both.
How it was found
- Configure Postman to proxy through Burp and trust Burp's CA certificate.
- Turn Intercept ON in Burp and send a valid API request from Postman, ensuring the authentication headers are present.
- Save the exact request (headers, body, URL) from Burp and note the successful response.
- Replay the saved request in Burp Repeater without changes and observe it still returns 200 OK.
- Wait a long interval (e.g., hours or 24 hours) and replay the same request again to confirm it still succeeds.
- Use Burp Intruder or a script to replay the request many times and check for rate limiting or duplicate rejection.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you send a request to a server, it often includes a signature to prove it came from you. This report found that the server never checks whether the request is old, so someone who copies a request can send it again and again, and the server treats it as new. That means actions like moving money could be repeated without permission.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.