Skip to main content

Public Frontend JavaScript Bundle Exposes Complete Incoming Chat Webhook Credential

Updated 6 min readMarkdown

Summary

During passive review of a publicly accessible web application, I found that one of the frontend JavaScript bundles exposed a complete incoming chat webhook URL.

The exposed webhook contained sensitive credential parameters, including:

  • webhook space/channel identifier

  • API key-style parameter

  • token-style parameter

  • full message-posting URL

I did not invoke the webhook, send any message, access any chat content, interact with any user account, or perform any active exploitation. The finding was verified only by passively downloading and inspecting public frontend JavaScript served by the application.

Description

While reviewing the unauthenticated attack surface of the target web application, I observed that the public root page loaded frontend JavaScript bundles.

After downloading and inspecting one of the public bundles, I found a complete incoming chat webhook URL embedded in the JavaScript. The URL included both a key-like value and a token-like value.

The exposed value had the following redacted structure:

https://<CHAT_WEBHOOK_HOST>/<WEBHOOK_PATH>/<SPACE_OR_CHANNEL_ID>/<MESSAGE_ACTION>?key=<REDACTED_KEY>&token=<REDACTED_TOKEN>

The surrounding JavaScript suggested that the application only needed the webhook origin for configuration purposes, but the full webhook URL was embedded in the public bundle.

Example redacted code pattern:

var webhookUrl = "https://<CHAT_WEBHOOK_HOST>/<WEBHOOK_PATH>/<SPACE_OR_CHANNEL_ID>/<MESSAGE_ACTION>?key=<REDACTED_KEY>&token=<REDACTED_TOKEN>";

var webhookOrigin = webhookUrl !== "" ? new URL(webhookUrl).origin : "";

Only the origin was required:

https://<CHAT_WEBHOOK_HOST>

However, the frontend bundle exposed the complete webhook URL, including the sensitive key and token values.

This is security-sensitive because frontend JavaScript is publicly accessible by design. Any unauthenticated visitor can download the bundle and extract the webhook credential.

Steps to Reproduce

1. Create a local working directory

mkdir -p public-webhook-secret-review
cd public-webhook-secret-review

2. Download the public root page

Use a placeholder target only.

curl -sk "https://<TARGET_HOST>/" -o root.html

3. Extract public JavaScript bundle references

grep -oE '/[^"]+\.js' root.html | sort -u > js-bundles.txt
cat js-bundles.txt

Expected output format:

/<PUBLIC_JS_BUNDLE_PATH_1>.js
/<PUBLIC_JS_BUNDLE_PATH_2>.js
/<PUBLIC_JS_BUNDLE_PATH_3>.js

4. Download the public JavaScript bundles

mkdir -p js

while read -r path; do
  name="\((basename "\)path")"
  curl -sk "https://<TARGET_HOST>\({path}" -o "js/\){name}"
done < js-bundles.txt

5. Calculate hashes for evidence integrity

sha256sum js/*.js | tee js-sha256.txt

Example redacted output:

<SHA256_HASH>  js/<AFFECTED_BUNDLE>.js

6. Search for webhook-like URLs and credential parameters

grep -RniE "webhook|incoming|spaces|messages|key=|token=|chat|hooks" js/ | tee webhook-indicators.txt

7. Search for full URL patterns containing key and token parameters

grep -RaoE 'https://[^"'\''\\ )]+[?&]key=[^"'\''\\ )]+[&]token=[^"'\''\\ )]+' js/ | tee possible-webhook-urls.txt

8. Review the matching JavaScript bundle safely

less js/<AFFECTED_BUNDLE>.js

9. Save only redacted evidence

Do not save or publish the real webhook URL.

Use this redacted format:

Exposed webhook structure:

Scheme: https
Host: <CHAT_WEBHOOK_HOST>
Path pattern: <WEBHOOK_MESSAGE_PATH>
Space/channel identifier present: yes
Has key parameter: yes
Has token parameter: yes

Redacted URL:
https://<CHAT_WEBHOOK_HOST>/<WEBHOOK_PATH>/<SPACE_OR_CHANNEL_ID>/<MESSAGE_ACTION>?key=<REDACTED_KEY>&token=<REDACTED_TOKEN>

10. Verify URL structure locally without invoking the webhook

Use a local parser only. Do not send any request to the webhook.

python3 - <<'PY'
from urllib.parse import urlparse, parse_qs

url = "https://<CHAT_WEBHOOK_HOST>/<WEBHOOK_PATH>/<SPACE_OR_CHANNEL_ID>/<MESSAGE_ACTION>?key=<REDACTED_KEY>&token=<REDACTED_TOKEN>"

parsed = urlparse(url)
params = parse_qs(parsed.query)

print("scheme:", parsed.scheme)
print("host:", parsed.netloc)
print("path:", parsed.path)
print("has_key:", "key" in params)
print("has_token:", "token" in params)
PY

Expected output:

scheme: https
host: <CHAT_WEBHOOK_HOST>
path: <WEBHOOK_PATH>
has_key: True
has_token: True

11. Stop at passive verification

No active exploitation is needed to prove the exposure.

I did not:

  • invoke the webhook

  • send a message

  • access chat content

  • interact with any user account

  • guess credentials

  • brute force anything

  • perform out-of-scope testing

Observed Result

A publicly accessible frontend JavaScript bundle contained a complete incoming chat webhook URL.

The exposed URL included:

  • webhook API host

  • webhook message path

  • space/channel identifier

  • key parameter

  • token parameter

The code appeared to only need the webhook origin, but the full credential-bearing URL was exposed in the public bundle.

Expected Result

Frontend JavaScript should not expose full incoming webhook URLs or credential-bearing URLs.

The application should expose only non-sensitive configuration values in frontend assets.

If only the origin is required, the frontend should contain only:

https://<CHAT_WEBHOOK_HOST>

The complete webhook URL should be stored securely server-side or in a secret-management system.

Security Impact

If the exposed webhook is valid, an unauthenticated attacker who downloads the public JavaScript bundle may be able to post arbitrary messages into the configured chat space or channel.

Potential impact includes:

  • unauthorized messages in an internal or company chat space

  • spoofed operational or system notifications

  • phishing-style messages inside a trusted communication channel

  • disruption of alerting or monitoring workflows

  • abuse of a pay-per-use or quota-based webhook integration

  • reputational damage if trusted internal channels are abused

  • alert fatigue if the webhook is used for operational notifications

This issue does not require authentication to discover. The secret is exposed in a public frontend asset.

Attack Scenario

A realistic attack scenario would look like this:

  1. An attacker visits the public web application.

  2. The attacker downloads the public JavaScript bundles.

  3. The attacker searches the bundles for webhook indicators.

  4. The attacker extracts the complete incoming webhook URL.

  5. The attacker sends unauthorized messages to the configured chat space.

  6. Internal users receive messages that appear to come from a trusted integration.

  7. The attacker uses the trusted channel for spam, phishing, disruption, or operational confusion.

No active message sending was performed during my test.

Severity Rationale

I rate this as Medium severity because the issue exposes a complete credential-bearing webhook URL in a public JavaScript bundle.

The direct impact depends on the destination chat space and the privileges of the webhook. If the webhook posts into a sensitive internal, security, operations, or monitoring channel, the impact may be higher.

The issue is still security-relevant even without invoking the webhook because the exposed key and token are sufficient credential material for potential abuse if valid.

The application owner should:

  1. Immediately revoke or rotate the exposed webhook.

  2. Remove the full webhook URL from frontend JavaScript.

  3. Store webhook URLs only in backend configuration or a secret-management system.

  4. Expose only non-sensitive origins or feature flags to the frontend.

  5. Review historical public build artifacts for the same exposed webhook.

  6. Invalidate cached public JavaScript assets after remediation.

  7. Review webhook logs for unauthorized use.

  8. Restrict webhook destinations to the minimum required channel or space.

  9. Add secret scanning to CI/CD for patterns such as:

webhook
hooks
key=
token=
incoming
messages
spaces
chat
  1. Add deployment checks to prevent credential-bearing URLs from being included in frontend bundles.

Researcher Safety Note

This finding was verified passively only.

I did not:

  • invoke the exposed webhook

  • send any message

  • access any chat content

  • interact with any user account

  • guess credentials

  • perform brute force testing

  • perform out-of-scope testing

  • modify any data

The issue was confirmed only by inspecting publicly accessible frontend JavaScript served by the application.

3 views

No comments yet. Be the first to comment.