When Encryption Went Public: The Case of the Hardcoded Key
A website exposed an AES encryption key and initialisation vector in client-side JavaScript, allowing anyone to decrypt encrypted data. The author demonstrated this by writing a script that decrypted a sample encrypted text found on the site.
medium.com
Published on medium.com
This is very interesting story of how i found a website saying “Hey decrypt my secret using keys in the description below”.
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 developers hardcoded a symmetric encryption key and IV into client-side JavaScript, making them accessible to anyone.
Impact
An attacker could decrypt encrypted data protected by the exposed key, though the text does not specify what data or how sensitive it was.
What the attacker needed
Access to the website's client-side JavaScript
How it was found
- Open the login page and inspect its source code.
- Skim the JavaScript files and find a minified bundle.
- Locate the AES key and IV in the bundle.
- Find an encrypted text on the website.
- Write a script using the key and IV to decrypt the text.
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.
Encryption turns readable data into scrambled text, and a key is needed to unscramble it. Here the key was left in the website's code that anyone can download, so the encryption gave no real protection.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.