Skip to content
Leaked secrets Write-up Beginner

Hardcoded Secrets Strike Again: How a Telegram Bot Token Exposed

A Telegram Bot API token was hardcoded in client-side JavaScript, giving full control of the official customer support bot. An attacker could read user conversations containing personal data and send messages impersonating support staff.

Cameron Bardin Follow

Published on medium.com

When a simple configuration mistake becomes a business-critical security incident.

Cameron Bardin (MDVKG), 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 developer included the full bot token, including the secret part, in client-side code when only the public bot ID was needed for the Telegram Login Widget.

Impact

An attacker could read user conversations containing personal data and send messages impersonating the official support bot, potentially leading to phishing and regulatory issues.

What the attacker needed

Access to the public website; No special privileges required

The fix

The token was rotated within 24 hours and the code was remediated.

How it was found

  1. Enumerate JavaScript files served to the client.
  2. Search for common token patterns using a regular expression.
  3. Validate the token by calling the Telegram Bot API getMe endpoint.
  4. Check the bot's webhook configuration.
  5. Retrieve pending messages using the getUpdates method.
  6. Send a test message to the researcher's own Telegram account to confirm control.

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 for a Telegram bot was left in the website's code that anyone can see. This let anyone take over the bot, read private chats, and send fake messages to users.

What is Leaked secrets?

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

More by Cameron Bardin

View all

1 more disclosed report, best first.

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.