Encryption Isn't Enough: Compromising a Payment Processor using Math
The BFF encrypted file download URLs using AES-128-CBC without authentication, allowing an attacker to manipulate the IV and change the first 16 bytes of the decrypted URL. This enabled SSRF, leaking the BFF's access token, which was overprivileged and could be used to access the API gateway from the internet, leading to full compromise of the customer service frontend.
During a security engagement with my employer, iteratec, I found and reported a security issue that allowed me to completely compromise the internal customer service frontend of a payment processor, which would have let us steal customer information or trigger payments.
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 use of unauthenticated AES-128-CBC encryption for URLs, combined with missing URL validation, network segmentation, and overprivileged tokens.
Impact
The attacker could steal the BFF's access token and use it to access the API gateway from the internet, allowing them to query customer data, trigger payments, and impersonate employees in audit logs.
What the attacker needed
Knowledge of the plaintext URL (whitebox or leak); ability to send requests to the BFF; attacker-controlled domain
The fix
The system should authenticate ciphertexts (e.g., using an AEAD mode or a MAC), validate URLs against an allowlist, restrict outbound traffic, segment the network, and use least-privilege tokens.
How it was found
- Obtain the encrypted download link (ciphertext and IV) from the BFF.
- Compute the XOR difference between the known first 16 bytes of the plaintext URL and the attacker's target URL.
- XOR this difference with the original IV to create a modified IV.
- Send the modified IV and original ciphertext to the BFF's download endpoint.
- The BFF decrypts the ciphertext to the attacker's URL and makes a request to it, including its access token.
- Capture the access token from the request to the attacker's server.
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 system encrypted download links to stop attackers from changing them, but the encryption method used (AES-CBC) does not check if the encrypted data was modified. By changing part of the encrypted data (the IV), an attacker can make the server decrypt it to a different web address they control. The server then sends its secret access token to that address, which the attacker can use to access internal systems.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.