Skip to content
Crypto Write-up Advanced

Encryption without signatures

The server encrypted per-user tokens with AES-CBC but did not sign them, and it leaked padding errors, so an attacker could use a padding oracle to forge a token that decrypts to an admin JSON object. By reusing blocks from a free anonymous token and placing the uncontrollable junk inside a duplicate JSON property, the attacker could obtain the flag.

Teddy Katz Follow

Published on blog.teddykatz.com

A few weeks ago, I found an interesting account takeover bug in a webserver. This is the type of issue where it’s not too difficult to spot that something is wrong, but it’s surprisingly complicated to create a working exploit, requiring several different attacks to be chained together.

Teddy Katz (@not_aardvark), on blog.teddykatz.com

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

Likely the tokens were encrypted with AES-CBC using a fixed IV and no integrity protection, and decryption errors were distinguishable, enabling a padding oracle attack.

Impact

An attacker could forge a token for the admin account and retrieve the flag, though the exploit required repeated attempts because random junk had to produce valid JSON.

What the attacker needed

Access to the server; ability to request anonymous tokens; padding oracle error visible

The fix

Tokens should be signed (for example with an HMAC) and decryption errors should not be distinguishable, so tampering is detected before parsing.

How it was found

  1. Obtain an anonymous token from the server by visiting the root path.
  2. Use the padding oracle to generate ciphertext blocks for a chosen plaintext.
  3. Reuse the first 32 bytes of the anonymous token to control the start of the decrypted plaintext.
  4. Place the random junk inside a JSON string and add a second user property set to admin.
  5. Retry with different random blocks until the decrypted plaintext is valid JSON.
  6. Send the forged token to the flag endpoint to retrieve the flag.

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.

The server gives each user a scrambled (encrypted) token that says who they are. Because the scrambling can be manipulated and the server reveals when unscrambling fails, an attacker can craft a token that the server believes belongs to the admin. This lets them read the protected flag.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by Teddy Katz

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.