Skip to content
Cloud · Secret guide

Leaked ngrok API Key: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

An ngrok key or authtoken lets a program open tunnels that expose local services to the internet, under your account. A platform API key can also manage that account: create and delete keys, edit endpoints and reserved domains. Anyone who holds one can publish a service that looks like yours, redirect a domain you reserved or open a tunnel into a machine on your network. Because a tunnel is a public door, the damage can be quick and hard to notice, so treat a leaked value as an active threat.

Check your GitHub account for leaked secrets — free

Provider
ngrok
Severity
High
Impact
Cloud infrastructure access
Checked live by LeakWatch
No

What an ngrok API key looks like

ngrok authtokens and API keys have a recognizable shape: they begin with a digit 2, followed by a long run of letters and digits, an underscore and a further group of digits and letters. The value is typically stored in an environment variable named after ngrok, such as an authtoken variable or an API key variable:

NGROK_AUTHTOKEN=2XXXX…_0…   (masked)

The rule does not distinguish an authtoken from a platform API key, because both use a similar format in configuration files. Check the dashboard to see which one you have, since an authtoken only opens tunnels, while a platform API key can manage the account. Some newer ngrok products, such as AI gateway access keys, use a different format and appear in a separate area of the dashboard, so a value that does not match this shape is not necessarily an ngrok tunnel token.

How ngrok keys get leaked

  • Launch configuration. The ngrok.yml file or a shell script that sets the authtoken, committed to a repository.
  • Development containers. A Docker image or compose file that bakes the authtoken into a layer or a build argument.
  • Tutorials and demos. A command pasted into a blog post, a video description or a chat with the real token in it.
  • Shared dotfiles. A dotfiles repository or a backup of a home folder that still contains the ngrok configuration.
  • CI logs. A pipeline that starts a tunnel for testing and prints the command, including the token argument.

What to do in the first hour

  1. Delete the key or authtoken in the ngrok dashboard. Open the API keys or authtokens page, find the value that leaked, and delete it. Deleting stops it from being used for new sessions. Do this before you clean the repository.
  2. Close the open tunnels. Stop any tunnels that were started with the leaked value, and check the list of active endpoints for ones you did not start. Tunnels using the old token may need to be restarted with the new one.
  3. Check reserved domains and endpoints. Review the reserved domains and any endpoints on the account, and look for changes you did not make, such as a new domain or a changed forwarding target.
  4. Create a replacement and store it in a secret manager or an environment variable. Give each machine or pipeline its own authtoken, so the next removal affects one job only.
  5. Check the local machine and the network. If a tunnel was opened by someone else, a service on your machine may have been reached. Review the logs of the services you exposed during the period.
  6. Clean the repository after the rotation: remove the value from the files, add the file to .gitignore and decide whether to rewrite history. The order of steps is in I accidentally pushed an API key to GitHub.

Not sure what else leaked? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at ngrok

Sign in to the ngrok dashboard and open the account settings for API keys and authtokens. Delete the leaked value there and create a new one. ngrok’s API also lets you create, list and delete API keys by identifier, which is useful for rotation from a script. We could not confirm from ngrok’s pages reviewed here the exact labels of the dashboard or whether authtokens can be deleted from the same screen as API keys, so check the list you see. If you cannot find the value, treat it as active and remove every token on the account that you do not recognize.

How LeakWatch detects it

The rule is called Ngrok API Key. It looks for the word ngrok followed, within a short distance, by a label such as an authtoken, API key or secret, then a separator, and then a value that starts with the digit 2, has a fixed run of letters and digits, an underscore, a digit and a further run of letters and digits. Values that do not follow this shape are not reported, so a region name or an unrelated setting is not matched. The severity is high, with the impact class for infrastructure and cloud services. This type is not checked live: LeakWatch does not try the value against ngrok.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is an authtoken as dangerous as a platform API key?

Less so. An authtoken lets a machine open tunnels, while a platform API key can manage the account, including keys and domains. Treat both as urgent, but check the dashboard to see what the leaked value could do.

Will my development tunnel stop working?

Yes, when the old value is deleted, any tunnel started with it stops. Start the tunnel again with the new authtoken, and update the configuration file on each machine.

Could someone have used my tunnel to reach my computer?

They could have, if a tunnel with the leaked value was open. Check which services were exposed, review their logs and make sure they are not left running on the machine.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with ngrok.