Skip to content
Leaked secrets Write-up Beginner

From Key to Chaos: How a JS Key Breaks Notification Security

The VAPID private key used to sign web push notifications was hardcoded in a JavaScript file. An attacker who obtains this key could sign and send push notifications that appear to come from the legitimate application, potentially delivering phishing links or malware to users.

medium.com

Published on medium.com

Push notifications are now a standard feature in our online lives. Whether it is your favourite online shopping app alerting you to a discount, a news app pushing breaking news, or a banking app reminding you about a transaction, push notifications are a standard feature.​

Rushikesh Kaware, on medium.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

The VAPID private key, which should remain server-side and secret, was embedded directly in client-accessible JavaScript code.

Impact

An attacker with the key could send push notifications that appear to come from the legitimate app, potentially tricking users into clicking phishing links or downloading malware.

What the attacker needed

Access to the JavaScript file containing the key

The fix

The key should be removed from the code, stored in a secrets manager or environment variable, and rotated immediately.

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.

Web push notifications let websites send messages to your device even when the site is not open. A special private key acts like a signature that proves the message really came from that website. If the key is left in the website's code where anyone can find it, an attacker can copy it and send fake notifications that look real.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.