# Leaked age Secret Key? Replace the Key Pair, Re-encrypt

> age secret key (AGE-SECRET-KEY-1) exposed on GitHub? Generate a new key pair, re-encrypt your files and rotate their contents. Step-by-step guide.

Source: https://leakwatch.net/secrets/age-secret-key

---

[LeakWatch](/)

[Product](/product)[Live feed](/leaks)[Guides](/secrets)[Blog](/blog)[Free scan](/)

1.  [Home](/)
2.  [Secrets](/secrets)
3.  age Secret Key

Databases & keys · Secret guide

# Leaked age Secret Key: what to do in the first hour

High severityDetected onlyLast verified October 30, 2026 · 5 min read

An age secret key is the private half of a key pair used by age, the small file encryption tool. Whoever holds it can decrypt every file that was encrypted to the matching public key (the recipient), including files you stored months ago and files that were already copied elsewhere. Many projects use age through SOPS to keep encrypted secrets in a repository, which means the leak of one key can open all the configuration files of a project. There is no provider and no revoke button, because age has no server: the fix is to replace the key pair and re-encrypt. Replace first, then rotate what the old key could read.

[Check your GitHub account for leaked secrets — free](/)

Provider

Other

Severity

High

Impact

Source code and build access

Checked live by LeakWatch

No

## What an age secret key looks like

An age secret key begins with the fixed text `AGE-SECRET-KEY-1`, followed by 58 characters from the Bech32 alphabet, written in uppercase:

```text
AGE-SECRET-KEY-1XXXX…XXXX   age secret key (masked, 58 Bech32 characters after the prefix)
```

The Bech32 alphabet has no `1`, `b`, `i` or `o`, which is one way to recognise a real key from a made-up one. The key is usually kept in a text file, often called `keys.txt`, next to a comment line that shows the public key, and the `age-keygen` tool writes it that way. Do not confuse it with the public key, which starts with `age1` in lowercase and is meant to be shared. A public key in a repository is normal; the line starting with `AGE-SECRET-KEY-` is not. The key can also be read from the `SOPS_AGE_KEY` or `SOPS_AGE_KEY_FILE` variables.

## How age secret keys get leaked

-   **Key file committed.** `keys.txt` or `age.key` added to a repository with `git add .`, often in a deployment or dotfiles repository.
-   **SOPS projects.** The key is placed next to the encrypted files so that the pipeline can decrypt them, then the whole directory is published.
-   **CI configuration.** `SOPS_AGE_KEY` pasted into a workflow file rather than stored in the CI platform’s secret settings.
-   **Backups and dotfiles.** A home directory or `~/.config/sops/age` folder pushed as a personal dotfiles repository.
-   **Container images.** A key copied into an image layer so that the application can decrypt its configuration at start, then the image is pushed to a public registry.
-   **Chat and tickets.** A key pasted to share it with a colleague, which stays in history.

## What to do in the first hour

1.  **Generate a new key pair** with `age-keygen` on a trusted machine, and keep the new secret key in a proper secret store, not in the repository.
2.  **Re-encrypt your files to the new recipient.** For plain age files, decrypt with the old key and encrypt again to the new public key. For SOPS, update the age recipient in your SOPS configuration and run its key rotation command on each encrypted file. Remove the old recipient from the configuration.
3.  **Treat the contents as exposed.** Every secret that was stored in a file the old key could decrypt must be rotated at its source: database passwords, API keys, tokens and certificates. Changing the age key does not protect values the attacker may already have read. Start with the ones that grant the most access.
4.  **Look at the history.** Encrypted files from older commits are still readable with the old key, even after you re-encrypt the current version. Rotating the underlying secrets is what matters.
5.  **Deploy the new key** to the pipeline or servers that decrypt the files, and delete the old one from them.
6.  **Check for use of the old key.** age leaves no log, so look instead at the services behind the secrets: access logs, sign-ins and API usage since the exposure.
7.  **Clean up the code**, add key files to `.gitignore`, and look for other secrets in the same commit. See [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github).

Not sure what else leaked from the same repository? [Run a free scan](/).

[Not sure what else leaked? Run a free scan.](/)

## Revoke it at age

There is nothing to revoke at a vendor. age is a local tool with no account, no server and no central list of keys, so a compromised key can only be abandoned: generate a new pair and re-encrypt, as in the steps above. The age documentation describes key generation and recipients, and the SOPS documentation describes rotating the keys of encrypted files. A person has not confirmed any menu wording for this guide, because there is no console. Do not publish an announcement that the old key is revoked: nothing enforces that, and the only real protection is that the files no longer depend on it.

## How LeakWatch detects it

The rule is called Age Secret Key. It looks for the exact text `AGE-SECRET-KEY-1` followed by exactly 58 characters from the Bech32 alphabet `QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L`, in uppercase. It does not need a variable name next to it. A key with a body that is too short, a key written in lowercase, or a public key starting with `age1` is not reported. The severity is **high**. This type is not checked live: age has no server, so there is nothing to ask, and LeakWatch cannot tell whether any file still uses the key.

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 the public key (age1…) also a secret?

No. The recipient is meant to be shared so that others can encrypt files for you. Only the line starting with `AGE-SECRET-KEY-` must stay private.

I removed the key file in a new commit. Is that enough?

No. The key stays in the git history and in any clone or fork. Generate a new pair and re-encrypt, and rotate the secrets the old key could open.

Can I find out whether someone used the key to decrypt files?

Not from age itself, which keeps no record. Look at the systems protected by the decrypted secrets instead, for unusual sign-ins or API calls since the key was exposed.

## Related

-   [SSH / RSA Private Key](/secrets/ssh-private-key)
-   [RSA Private Key](/secrets/rsa-private-key)
-   [Vault Service Token](/secrets/vault-service-token)
-   [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github)
-   [Which vendors leak most this week](/leaks/trends)
-   [All secret guides](/secrets)

[Get alerted next time a secret leaks — create a free account](/)

LeakWatch is not affiliated with Other.

![Gabriel Diyan, founder of LeakWatch](/brand/Photo-Gabriel-Diyan.webp)

Gabriel Diyan (0xCr0c0)

Cybersecurity student, founder of LeakWatch. I built and run the scanner described here — the detection patterns, the false-positive classifier and the provider validators are mine. [More about who I am](/about).

[GitHub](https://github.com/Leakwatch-Scan) · [X](https://x.com/LeakwatchScan) · [LinkedIn](https://www.linkedin.com/in/gabriel-diyan-80a378375) · [GitHub (personal)](https://github.com/crocogab)

LeakWatch

Secrets leak into public commits every minute. This watches the forges for yours. Built and run by [Gabriel Diyan](/about), a cybersecurity student — [why LeakWatch exists](/about).

Scan

-   [Product](/product)
-   [Live feed](/leaks)
-   [Trends](/leaks/trends)
-   [API docs](/docs)
-   [CI/CD](/docs?tab=ci)

Read

-   [Blog](/blog)
-   [Secret guides](/secrets)
-   [Changelog](/changelog)
-   [About](/about)

Verify

-   [Security](/security)
-   [Privacy](/privacy)
-   [Terms](/terms)
-   [Legal](/legal)
-   [Contact](/contact)
-   [Status](https://status.leakwatch.net)

© 2026 LeakWatch

[GitHub](https://github.com/Leakwatch-Scan)[X](https://x.com/LeakwatchScan)
