Exposing Administrative Secrets: How an Exposed Nylas Client Secr
A privileged Nylas application credential was hardcoded in a publicly accessible JavaScript bundle. An attacker could use it to list the company's Nylas applications, enumerate OAuth redirect URIs, list grants, and read live email messages from the company's testing mailboxes.
During a routine inspection of a test environment (.[REDACTED].com), I decided to analyze the compiled frontend assets. By digging into the production JavaScript bundle (main.[HASH].js), I discovered the affected company's Nylas application credentials hardcoded in the frontend bundle:
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 company embedded a privileged Nylas application credential in client-side JavaScript instead of keeping it server-side.
Impact
The exposed credential allowed reading live email threads and messages from the company's testing mailboxes and could add, modify or delete OAuth callback URIs, but only for that company's Nylas application, not other customers' grants or mailboxes.
What the attacker needed
Access to the public JavaScript bundle; no account needed
The fix
The credential should be kept server-side and removed from client-side code, following Nylas's security guidance.
How it was found
- Inspect the compiled frontend JavaScript bundle of a test environment.
- Find the Nylas application credential hardcoded in the bundle.
- Authenticate to the Nylas API with the exposed credential and list applications.
- List the application's redirect URIs.
- List grants to obtain user emails, OAuth scopes, IP addresses and user agents.
- Use an active grant ID to fetch live messages from the mailbox.
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.
A secret key that lets a program talk to an email service was left inside code that every visitor's browser downloads. Anyone who opened the website could read that key and use it to ask the email service for the company's data, including emails. The company should have kept the key on its own servers, not in the browser.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.