A HashiCorp Vault batch token is a credential for a Vault server. Whoever holds it acts with the policies attached to it, so it can read the secrets those policies allow: database passwords, cloud credentials, encryption keys. The danger is the secrets behind it, not the token itself. Batch tokens also behave differently from the usual service tokens: they are not stored by Vault, and they cannot be renewed or revoked one by one. The reliable limits are their expiry and the policies they carry. Contain the access first, then investigate what was read.
Check your GitHub account for leaked secrets — free
- Provider
- Vault
- Severity
- Critical
- Impact
- Cloud infrastructure access
- Checked live by LeakWatch
- No
What a Vault Batch Token looks like
A batch token starts with hvb. followed by a long opaque string. HashiCorp documents the part after the prefix as 24 or more generated characters, and treats the structure as opaque, so the length varies:
hvb.XXXXXXXX… Vault batch token (masked; prefix + long URL-safe body)
Tokens seen in practice are often well over 100 characters. They appear in VAULT_TOKEN variables, in the X-Vault-Token request header, in CI variables and in Vault agent sink files. Tell them apart from their siblings: service tokens start with hvs. (see the Vault service token guide), and the old format without a clear prefix, starting with b., belongs to Vault versions before 1.10. A recovery or root token is a separate and more serious case.
How Vault Batch Tokens get leaked
- Shell history and scripts. A token exported in a terminal or typed into a deployment script, then committed.
- CI and pipeline configuration. Batch tokens are popular for short jobs, and a pipeline file or log that prints
VAULT_TOKENexposes one. - Environment files. A
.envor compose file withVAULT_TOKENcommitted by accident. - Debug output. A client or agent run with verbose logging that prints the request headers.
- Documentation and tickets. A working token pasted into a runbook, an issue or a chat to show a command that works.
What to do in the first hour
- Find out what the token can do. Identify the policies and the remaining lifetime. Batch tokens carry their TTL and expire on their own, so the exposure window may already be short. If you do not know how it was issued, find the auth method and role that created it in your Vault configuration.
- Stop new tokens like it. Because the token cannot be revoked individually, act on its source: tighten or remove the policies of the role or auth method that issues it, shorten the TTL, or disable the role until you have looked. Read the Vault documentation on revoking tokens by their parent or by their auth method before choosing.
- Check the audit log. If an audit device is enabled, search it for requests made with this token: reads of secrets, token creation, policy changes and unusual source addresses. This tells you which secrets were exposed.
- Rotate what it could read. Treat every secret the policies allowed as exposed: database credentials, cloud keys, API keys. Dynamic secrets leased through the token should be revoked by their lease.
- Check for persistence. Look for new tokens, roles, policies or auth methods created during the window.
- Clean up the code and replace the long-lived pattern with short TTLs and narrow policies. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same repository? Run a free scan.
Revoke it at HashiCorp Vault
Vault is usually self-hosted, or run as a managed cluster, so there is no single vendor page to revoke a token from: you work on your own cluster, through its CLI, API or interface, with an account allowed to manage tokens and policies. The Vault documentation on tokens explains that batch tokens are not persisted and are not revoked one at a time, so the practical levers are the expiry, the issuing role and its policies. A person has not confirmed the exact commands for your setup, so check the documentation for your Vault version.
How LeakWatch detects it
The rule is called Vault Batch Token. It looks for hvb. followed by 24 to 300 characters made of letters, digits, underscores and dashes, with a word boundary before the prefix, and it requires the value to end at a quote, a space, a semicolon or the end of the line. It does not need a variable name next to it. A body shorter than 24 characters, a different prefix such as hvs., or the older b. format is not reported. The case of the prefix matters. The severity is critical. This type is not checked live: LeakWatch does not send any request to a Vault server with the token it found.
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 I revoke a batch token with vault token revoke?
Not individually: batch tokens are not stored and have no accessor. Rely on their expiry, and act on the role and policies that issue them.
Is a short TTL enough protection?
It limits the window, but secrets read during that window stay compromised. Check the audit log and rotate what the token could read.
How is it different from a service token?
A service token is stored, can be renewed and can be revoked directly. A batch token is lighter, but gives up those controls.