Skip to content
Crypto Disclosed report Intermediate

Multiple cryptographic vulnerabilities in login page on ███████

The login page used client-side RSA encryption instead of HTTPS, allowing an attacker on the same network to perform ARP poisoning and replace the server's public key with their own. This let the attacker decrypt the victim's password and potentially compromise their account.

tcpiplab Follow

Originally disclosed on HackerOne

  • Triaged in 13 days
  • Fixed in 21 months
  • Disclosed after 2.6 years

Summary: I realize that this report's title may not make sense yet. In one sentence: users logging in to the ███████ Server REST API Login page can have their passwords stolen by an attacker on the same LAN or WiFi as the victim trying to log in.

Description: To save the reader any confusion, I'll point out that this is an unusual case where, instead of using HTTPS for password confidentiality in transit, the server sends RSA encryption scripts to the browser. The browser then encrypts the password before sending the login request to the server. Using ARP poisoning I was able to Man-in-the-Middle (MitM) traffic between a victim and the login server. This enabled me to inject my public key into the login page, capture the encrypted password and decrypt it (using my private key), revealing the victim's plaintext password.

Impact

User accounts on the ████████ Server REST API server could be compromised.

Step-by-step Reproduction Instructions

Because this report is so long, I'm only putting in this summarized list of steps. But if you want a full step-by-step with screenshots, the Ettercap filter, my Python decryption script and everything, I've already written it up. Just ask.

  1. The attacker must be on the same Layer 2 network segment (LAN, or WiFi) as the victim's computer.
  2. The attacker runs Ettercap, specifying the IP addresses of:
    • The gateway router
    • The victim's computer
  3. Using Ettercap, the attacker conducts an ARP Poisoning attack against the victim's computer and that of the gateway router, thereby acting as a proxy for traffic between those two devices.
  4. When the victim's browser sends a GET for http://███/server/rest/login, the attacker:
    1. intercepts the server's response,
    2. modifies the HTML form, replacing the server's public key modulus string with the attacker's public key modulus string.
  5. The victim enters username and password values in the modified HTML form and clicks the Login button. The RSA.js (and other scripts) run in the victim's browser as usual, but the resulting ciphertext is the user's password encrypted for the public key of the attacker. The victim's browser sends these values in a POST to /server/rest/login, but because of the ARP Poisoning attack, the POST is sent to the attacker's computer.
  6. The attacker, using OpenSSL and their own RSA private key, decrypts the encrypted password, thus recovering the plaintext password.
  7. Optional: The attacker re-encrypts the victim's plaintext password using the login page's original public key.
  8. Optional: The attacker places the now encrypted password value into a new POST to /server/rest/login and sends the request to the gateway router, thereby allowing the victim to authenticate to the server.
  9. At this point the attack is successful. Note: the attacker still needs to tell Ettercap to stop the ARP Poisoning attack, causing it to send the ARP Correction packet, thereby restoring normal connectivity between the victim and the gateway router.

Product, Version, and Configuration (If applicable)

Suggested Mitigation/Remediation Actions

  1. Require HTTPS for sending username/password to the server.
    • This would solve the whole problem
  2. At the risk of sounding pedantic, client-side encryption via Javascript is not an effective security control. But I do realize that there may be use-case requirements for your application that I don't know about.
  3. If you do have some reason why you must continue using client-side encryption, please know that the RSA.js script is using a vulnerable padding standard (PKCS#1v1.5). Unfortunately, the developer's new RSA.js script is still using PKCS#1v1.5 padding which is vulnerable to a chosen ciphertext attack. The Cryptosense blog explains in detail. FYI I did not attempt to exploit this padding vulnerability.

The original report as published on HackerOne, by tcpiplab. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The login page relied on client-side JavaScript RSA encryption instead of HTTPS, allowing a man-in-the-middle to replace the public key and decrypt the password.

Impact

User accounts on the server could be compromised because the attacker recovers the plaintext password.

What the attacker needed

Attacker on same LAN or WiFi; victim logs in via the page

The fix

The login page should require HTTPS for sending username and password to the server.

How it was found

  1. The attacker must be on the same Layer 2 network segment as the victim.
  2. The attacker runs Ettercap, specifying the IP addresses of the gateway router and the victim's computer.
  3. Using Ettercap, the attacker conducts an ARP Poisoning attack to act as a proxy between the victim and the gateway.
  4. When the victim's browser requests the login page, the attacker intercepts the response and replaces the server's public key modulus with the attacker's own.
  5. The victim enters credentials and submits the form; the password is encrypted with the attacker's public key and sent to the attacker.
  6. The attacker decrypts the password using their private key.

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 report has not been written yet. The Original tab links to the source.

When you log in, your password should be protected by HTTPS, which encrypts everything between your browser and the server. Here, the site instead used JavaScript to encrypt the password before sending it, but an attacker on the same Wi-Fi could intercept the page and swap the encryption key for their own. That way, the attacker could decrypt your password and log in as you.

What is Crypto?

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

More by tcpiplab

View all

2 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

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.