Skip to content
Cloud · Secret guide

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

High severityDetected onlyLast verified · 5 min read

A Censys API key authenticates your requests to Censys, the internet-scanning and attack-surface platform. The key is tied to your account or to the personal access token that created it. Whoever holds it can run searches and API calls as you, and those calls use your plan’s quota and can reveal information about the hosts your team is researching. The risk is usually less dramatic than a payment key, but a leaked key still spends your quota, exposes your research and can be used to mislead your own monitoring. Delete the key first, then look at the usage.

Check your GitHub account for leaked secrets — free

Provider
Censys
Severity
High
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What a Censys API Key looks like

Censys credentials are long random strings of letters and digits, usually 32 characters with no visible prefix. Censys’ current platform uses personal access tokens that you create in your account settings, and older accounts may still hold a key of the same general shape. Because the value has no prefix, the clue is the surrounding text: the key is normally stored near the word censys in a variable, a header or a configuration file:

CENSYS_API_KEY=<32-character value, masked as XXXX…>

A value on its own does not tell you which account it belongs to, so you need to find the token in your Censys account before you can delete it. If several teams share one key, every copy must be removed, and each team should get its own token afterwards.

How Censys API keys get leaked

  • Configuration files. A .env file or a scanner configuration committed to a repository, often next to other tool credentials.
  • Automation scripts. Scripts that pull host data into a dashboard, with the key typed into the source code rather than read from the environment.
  • Shared notebooks. A research notebook that calls the API, saved and shared with the key still in a cell.
  • CI logs. A pipeline step that prints its environment or the full request, including the authentication header.
  • Shared snippets. A search example pasted into a blog post, a forum or a support thread, with the real key left in.

What to do in the first hour

  1. Delete the token in your Censys account. Open the account settings, find the personal access token that matches the leaked key, and delete it. Do this before you clean the repository. If you cannot tell which token it is, delete the token you suspect and create a new one for each job.
  2. Create a replacement for the job that needs it, and store it in a secret manager or an environment variable. Give each tool its own token, so one removal does not break everything.
  3. Check the usage. Review the activity and quota figures for your account for the period since the key may have been exposed. Look for spikes in requests, searches you do not recognize and calls at unusual hours.
  4. Review what the searches revealed. If the key was used for research, consider whether the people running those searches could have been exposed. Save a record of the activity for your security team.
  5. Check the other secrets in the same file. Monitoring and security tools are often configured together, so a leaked file may also hold keys for other platforms. Rotate those too.
  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 Censys

Sign in to the Censys platform and open the account settings. Under the personal access tokens tab, find the token and delete it with the trash icon on its card. Censys describes this as deleting the token, and deletion ends access straight away. Its getting-started documentation says that you can create several tokens as needed, so a clean replacement is easy to set up. We could not confirm from the Censys pages reviewed here whether a separate revoke action exists beyond deletion, so the delete action is the one to use.

How LeakWatch detects it

The rule is called Censys API Key. It looks for the word censys followed, within about 40 characters, by a standalone run of exactly 32 letters or digits. The word must appear in the text, and the value must sit close to it, so a long random string with no Censys context is not reported. Values with other lengths are not matched. The severity is high, with the impact class for SaaS services. This type is not checked live: LeakWatch does not send the key to Censys.

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

Can someone use my Censys key to see my private data?

They can use it to run the searches and API calls your plan allows, and those calls can reveal results tied to your account. Delete the key and check your usage history to see whether it was used.

Do I need to change my Censys password too?

Only if the same file or script held your login details. Personal access tokens are separate from your password, so deleting the token is the main step.

Why does the rule look for the word censys near the key?

Because a 32-character string on its own is common in many systems. The vendor name next to the value is what makes the match specific. A key with no name nearby may not be reported, so search your files for the value yourself as well.

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

LeakWatch is not affiliated with Censys.