Access key leak meaning, in plain words

An access key leak is when a key that operates the cloud gets out. What OWASP and CWE-798 say about hard-coded keys, rotation and least privilege, and first.

Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated

An access key leak is when a key that operates the cloud gets out. An access key is a long string used as a key for a program to operate the cloud in place of a person. If it gets out, a third party can do what the key's owner can do.

How does an access key leak happen?

It resembles carelessly pinning on a public notice board a memo saying where the spare key to your home is kept. The key itself is not broken, but anyone who learns the place can open the door with it. A cloud key behaves the same way once the place it is kept can be seen from outside.

OWASP's secrets management sheet first lists the kinds of secret information: API keys, database credentials, IAM permissions, SSH keys, and certificates. It then points out that many organizations write such information in plain text in source code, configuration files, and configuration management tools.

MITRE's CWE-798 defines embedding credentials such as passwords and encryption keys directly in code as a weakness. As a countermeasure it lists keeping credentials used for outside connections in encrypted, protected configuration outside the code.

OWASP's key management sheet asks that keys and secret information not be put where the source code lives and not be embedded in build outputs. This is our own explanation, but if the public range of that place changes or copies spread, an embedded key may get out together.

How to find and respond to a leaked key is set out in access key leaks. What is visible from outside can be checked with the free URL check.

Why does an access key leak matter?

The range of permissions the key holds is the range of damage. If a key with wide permissions leaks, everything from reading data in a store to changing settings can be done in the key owner's name. It does not go through a login screen, so it also tends to be noticed late.

The ways of keeping damage small are gathered in OWASP's sheets: replace keys regularly so a stolen key lives a short time, give keys only the minimum permissions, and record who used a key when. For CI/CD mechanisms, it recommends short-lived authentication over long-lived fixed cloud keys.

The move when a suspicion arises is to disable the key and make a new one. The narrower you keep the permissions of IAM, the smaller the effect of a leak. The whole of where keys are kept is set out in secrets management. If you need help with a suspected leak, contact us.

Related terms

  • Secrets management: the operation of putting passwords and keys in a dedicated safe to protect them
  • Hard-coded secrets: writing passwords and keys directly into a program
  • IAM: the mechanism that decides who may do what in the cloud
  • Key management: the operation of making, keeping, and replacing encryption keys

Frequently asked questions

What should I do first when I suspect an access key has leaked?

Disable that key. OWASP's key management sheet asks that a key that has got out be revoked promptly, and that the recovery procedure for it be written down beforehand. After that, look at the record of the key's use and check whether any operations were suspicious.

Is it safe to write a key in the code and keep it in a private repository?

No. OWASP asks that keys not be put where the source code lives. CWE-798 also defines embedding credentials directly in code as a weakness. Hand keys over at run time from a dedicated storage mechanism.

Next step

First check that no keys are written in your source repositories and settings files. How to look at the problem of leaking keys is in access key leaks. The free URL check shows only what is visible from outside, and for what to do when a leak is suspected, contact us.

Frequently asked questions

What should I do first when I suspect an access key has leaked?

Disable that key. OWASP's key management sheet asks that a key that has got out be revoked promptly, and that the recovery procedure for it be written down beforehand. After that, look at the record of the key's use and check whether any operations were suspicious.

Is it safe to write a key in the code and keep it in a private repository?

No. OWASP asks that keys not be put where the source code lives. CWE-798 also defines embedding credentials directly in code as a weakness. Hand keys over at run time from a dedicated storage mechanism.

See what an attacker can see, today

The free URL check returns a grade in under a minute. For costs and next steps, book a free consultation.