Skip to content
Cloud · Secret guide

Leaked Yandex Cloud API Key: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

Yandex Cloud credentials come in three shapes, and all three act as a service account or user inside your cloud: an API key, a static access key for the S3-compatible Object Storage, and an IAM token. What an attacker can do is bounded by the roles of that service account, but service accounts are often given broad roles on a whole folder or cloud. That can mean reading or deleting Object Storage buckets, starting compute instances (a common route to cryptomining bills), or reading databases and secrets. Revoke the credential first, then investigate what it did.

Check your GitHub account for leaked secrets — free

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

What a Yandex Cloud API key looks like

Three different values can leak, and the rules treat them separately:

AQVNXXXXXXXX…   API key (AQVN + 35 to 38 characters)
YCXXXXXXXX…   static access key secret (YC + 38 characters)
t1.XXXXXXXX.XXXXXXXX…                        IAM token (t1. + segment + . + 86 characters)
  • The API key is the secret returned once when you create a key for a service account. Its identifier is a separate, non-secret value.
  • The static access key is an AWS-style pair used with the S3-compatible API. The key identifier is public-ish; the secret half is the part that starts with YC.
  • The IAM token is short-lived and obtained by exchanging another credential. It is less durable, but still valid until it expires.

They usually appear in variables or files with yandex in the name (YANDEX_API_KEY, yandex_cloud_token), in Terraform provider settings, in ~/.config/yandex-cloud/config.yaml, and in S3 client configuration pointing at the Yandex storage endpoint.

How Yandex Cloud API keys get leaked

  • Terraform and infrastructure code. Provider blocks with a token or key inline, or a terraform.tfvars file committed by mistake.
  • Committed environment files. .env files and Docker compose files used for a bot, a function or a backend that calls a Yandex API.
  • Object Storage clients. An S3 configuration for backups or static sites, with the static access key secret in plain text.
  • CI/CD pipelines. Keys in a public pipeline definition, or printed by a debug step.
  • Serverless and cloud function code. Credentials hard-coded in a function that is then published as an open repository.
  • Shared service account JSON. A key file pasted into an issue, a chat or a gist to ask for help.

What to do in the first hour

  1. Delete or replace the leaked credential. Find the service account that owns it and remove the API key, the static access key or both (see the link below). Deleting an API key is an immediate, irreversible action. An IAM token cannot be revoked on its own; it expires, so also remove the credential that produced it.
  2. Issue a new credential if the application needs one, with the narrowest role possible, and deploy it through your secret store rather than a file.
  3. Review the service account’s roles. Check which roles it holds on which folders and clouds. This tells you the worst case of what the attacker could reach.
  4. Audit the activity. Use Audit Trails, if it was enabled, and the cloud’s operation logs to look for actions by the service account since the exposure: new service accounts, new keys, changed access bindings, created instances, buckets listed or emptied.
  5. Check billing. Look at the cost breakdown by service for unexpected compute or traffic.
  6. Check what the attacker could have created. Persistence is often a new service account or a new key attached to an existing one. Remove what you did not create.
  7. Clean up the code and rewrite history if needed. 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 Yandex Cloud

Keys are managed per service account in the Yandex Cloud console, under Identity and Access Management and then Service accounts; the Yandex Cloud console is where you sign in. The official Yandex Cloud documentation page “Deleting API keys” describes the console steps and the yc iam api-key delete command. A person has not confirmed the exact menu wording for this guide, and the interface can change, so if the page differs from this description, look for the section where the keys of the service account are listed.

How LeakWatch detects it

Three rules cover this vendor, and each needs the word yandex (any case) near the value, followed by an assignment such as =, : or =>, so a bare string is never reported.

  • Yandex API Key accepts a value starting with AQVN followed by 35 to 38 letters, digits, _ or -.
  • Yandex AWS Access Token accepts a value starting with YC followed by exactly 38 letters, digits, _ or -.
  • Yandex Access Token accepts t1., a first segment, a dot, then exactly 86 letters, digits, _ or -, with optional trailing = padding.

Values of another length, or with no yandex context in the line, are not reported. All three have a severity of high. This type is not checked live: LeakWatch does not send any request to Yandex with what 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

Which of the three credentials is the most dangerous?

The API key and the static access key have no short expiry, so they stay valid until you delete them. An IAM token expires by itself, but it works until then.

Can I see what the key was used for?

Only if Audit Trails or operation logs were enabled before the exposure. Check them for the service account, and treat missing logs as a reason to assume the worst.

Do I need to delete the service account too?

Not necessarily. Deleting the leaked key is enough to stop it, provided you checked that the attacker did not create other keys. Delete the account only if it is no longer needed.

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

LeakWatch is not affiliated with Yandex.