Skip to content
Code & CI · Secret guide

Leaked Drone CI Access Token: what to do in the first hour

High severityDetected onlyLast verified · 4 min read

A Drone CI access token is the personal token of a user of a Drone server. It is what the drone command line tool and API clients use to authenticate as that user. With it, someone can list the repositories you can access, read and trigger builds, and, depending on your rights, manage repository settings and secrets. The danger is the pipeline: a build that runs attacker-chosen steps can reach the secrets and credentials injected into your CI. Reset the token first, then check what happened.

Check your GitHub account for leaked secrets — free

Provider
DroneCI
Severity
High
Impact
Source code and build access
Checked live by LeakWatch
No

What a Drone CI Access Token looks like

The personal token is a string of 32 lowercase letters and digits, shown on the account page of your Drone server, together with ready-to-copy commands:

DRONE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   (32 lowercase letters or digits, no prefix)

It usually appears with DRONE_SERVER (the URL of your Drone instance) and DRONE_TOKEN as environment variables, in a shell history, in a script that calls the drone CLI, or in an Authorization: Bearer header. Do not mix it up with the RPC secret that connects runners to the server, or with the secrets you store for a repository: those are other credentials, with their own storage. Since the token has no prefix, the context is what identifies it.

How Drone CI Access Tokens get leaked

  • Shell snippets. The commands offered on the account page, export DRONE_SERVER=… and export DRONE_TOKEN=…, pasted into a README, a script or a setup guide.
  • Automation scripts. A deployment or release script that calls the Drone API to trigger or promote builds, committed with its token.
  • Environment files. A .env or compose file for a tool that talks to Drone, pushed by accident.
  • Pipeline configuration. A .drone.yml that passes the token in plain text instead of from a secret.
  • Support requests. A debug session in a public issue or a forum with the token still in the pasted commands.

What to do in the first hour

  1. Reset the token. Sign in to your Drone server, open your account page where the personal token is shown and use the option to reset or regenerate it (see the link below). Drone servers are self-hosted, so the page is on your own instance.
  2. Update the clients that use it: scripts, CI jobs, local drone configuration. Put the new value in a secret store.
  3. Review builds. Look at the build history of the repositories you can access for builds you did not start, promotions or rollbacks, and builds that ran unexpected commands.
  4. Check repository settings and secrets. Look for changed settings, new cron jobs, added secrets or modified secrets. Rotate every secret the token could read or replace, since an attacker able to run a build can print them.
  5. Check the pipeline files in the repositories for steps you did not write, and the git history for commits by unknown accounts.
  6. Look at the server and runners. Check your server logs for API calls from unknown addresses. If an RPC secret was in the same file, rotate it.
  7. Clean up the code and history. See 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 Drone

The personal token is shown on the account page of your own Drone server, after you sign in with your source control account. Because Drone is usually self-hosted, there is no single address for every user: use the address of your instance. Look for the section where the personal token is displayed and for a way to reset it. A person has not confirmed the exact menu wording for this guide, and the interface can change by version, so follow the Drone documentation for your version. Make sure the old value stops working by testing it with the CLI after the reset.

How LeakWatch detects it

The rule is called DroneCI Access Token. It is contextual: the word droneci, as a single word, then a short label, then an assignment such as =, : or =>, optional quotes, and exactly 32 lowercase letters or digits, ending at a quote, a space, a semicolon or the end of the line. The word drone alone is not enough, and a value that is shorter than 32 characters is refused. Matching is case-insensitive. The prefilter keyword is droneci. The severity is high. This type is not checked live: LeakWatch does not send any request to a Drone server with the token it found. A token under a variable such as DRONE_TOKEN without the word droneci close by can be missed.

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 this token tied to one repository?

No. It is a personal token, so it carries your rights on the Drone server, across the repositories you can access.

Can an attacker read my pipeline secrets?

Secrets are usually hidden from the API, but someone who can run or edit a build can print them. That is why you rotate secrets after resetting the token.

Is the RPC secret the same thing?

No. It lets runners talk to the server. Rotate it too if it was in the same file.

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

LeakWatch is not affiliated with DroneCI.