1. Resources
  2. Identity Threats
  3. AWS

AWS Secrets Manager and Parameter Store Secret Harvesting

Also known as: Secrets Manager bulk retrieval, GetSecretValue abuse, SSM Parameter Store secret dumping, SecureString harvesting, Cloud secret store harvesting

A principal with read access to AWS Secrets Manager or Systems Manager Parameter Store lists and downloads every secret it can reach: database passwords, API keys and tokens for other systems.

Platform
AWS
Impact
High
Last updated
Attack difficulty
Low
Detection difficulty
Medium
Privileges required: Specific rights or roles
secretsmanager:GetSecretValue or ssm:GetParameter* on the targets, plus kms:Decrypt on the key when a customer managed KMS key protects them. List permissions help but are not required.
What the attacker gains
The cleartext of every secret and SecureString parameter the principal may read: credentials for databases, third-party services and other accounts.

How it works

AWS has two managed stores for secrets. Secrets Manager holds named secrets with versions and optional rotation. Systems Manager Parameter Store holds configuration parameters of three types: String, StringList and SecureString, the last encrypted with a KMS key. Both are meant to replace credentials in code and config files, which concentrates the credentials in one place behind IAM.

Harvesting is the ordinary read path used at scale. No vulnerability is involved:

  • Secrets Manager. GetSecretValue takes a secret name or ARN (and optionally a version ID or stage) and returns SecretString or SecretBinary in clear text. The caller needs permission on the secret and, when the secret is encrypted with a customer managed KMS key, permission to use that key. BatchGetSecretValue reads up to 20 secrets per call, named in a list or selected by filters.
  • Parameter Store. GetParameter, GetParameters and GetParametersByPath return parameter values. WithDecryption affects only SecureString parameters and is ignored for the other types. GetParametersByPath with the recursive option returns a whole hierarchy such as /prod/.

The attacker is a principal that already has those permissions: a role whose credentials were taken from instance metadata, a stolen access key, or a human account. Application roles are frequent sources, because a policy written as secretsmanager:GetSecretValue on *, or ssm:GetParameter* on a broad path, lets one compromised service read the secrets of all the others.

What makes this a distinct technique is the yield. A single role with wide read access turns into database administrator passwords, API keys for payment and messaging providers, tokens for source control and CI, and access keys for other AWS accounts. Each is a long-lived secret that keeps working outside AWS, where CloudTrail no longer sees its use.

Variants:

  • Targeted read. One or two secrets the attacker already knows by name, from application config or environment variables. Indistinguishable from the application by volume.
  • Bulk harvest. List, then read everything, or use the batch and path operations.
  • Previous versions. Reading the AWSPREVIOUS stage, or parameter history, recovers values that rotation replaced but that may still be valid elsewhere.

Prerequisites

  • Valid credentials for a principal in the account (or in another account that the secret's resource policy trusts).
  • secretsmanager:GetSecretValue (and secretsmanager:BatchGetSecretValue for batch reads) on the target secrets, or ssm:GetParameter, ssm:GetParameters or ssm:GetParametersByPath on the target parameters.
  • kms:Decrypt on the customer managed key, where one is used.
  • Optional: secretsmanager:ListSecrets and ssm:DescribeParameters to discover names. Without them the attacker needs names from elsewhere: application configuration, task definitions, environment variables, infrastructure code.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Discover what exists

# Secrets Manager: names, ARNs, KMS key, rotation and last-accessed dates
aws secretsmanager list-secrets --region eu-west-1

# Parameter Store: names, types and key IDs
aws ssm describe-parameters --region eu-west-1

Both services are regional, so repeat per Region. Names often reveal the value's purpose (prod/db/orders, /prod/payments/api-key).

2. Read secrets from Secrets Manager

# One secret, current version
aws secretsmanager get-secret-value --secret-id prod/db/orders

# The version that the last rotation replaced
aws secretsmanager get-secret-value --secret-id prod/db/orders --version-stage AWSPREVIOUS

# Several secrets in one request (up to 20)
aws secretsmanager batch-get-secret-value --secret-id-list prod/db/orders prod/db/billing prod/api/partner
{
    "ARN": "arn:aws:secretsmanager:eu-west-1:111122223333:secret:prod/db/orders-AbCdEf",
    "Name": "prod/db/orders",
    "VersionId": "00000000-0000-0000-0000-000000000000",
    "SecretString": "{\"username\":\"orders_app\",\"password\":\"<password>\",\"host\":\"db.corp.example.com\"}",
    "VersionStages": ["AWSCURRENT"]
}

3. Read parameters from Parameter Store

# One parameter, decrypted if it is a SecureString
aws ssm get-parameter --name /prod/payments/api-key --with-decryption

# A whole hierarchy
aws ssm get-parameters-by-path --path /prod/ --recursive --with-decryption

Without --with-decryption a SecureString comes back as ciphertext, while String parameters are returned in clear text either way.

4. Automate the harvest

# Pacu: enumerate and dump Secrets Manager and Parameter Store for the session's keys
pacu --session audit --module-name secrets__enum --exec

# CloudFox: list secrets from Secrets Manager and SSM across Regions
cloudfox aws --profile target secrets

5. Use what was found

The values are credentials for something else. Database passwords are used against the database endpoint, API keys against the third party, and stored AWS access keys start a new round of IAM enumeration in whatever account they belong to.

Impact

The attacker moves from one AWS principal to every system whose credentials that principal could read. Typical results are direct access to production databases with the application's or an administrator's account, access to third-party services billed to or trusted by the organization, and credentials for other AWS accounts, source control and CI systems.

Most of that later activity happens outside CloudTrail: a database login or a call to a payment provider's API is not an AWS event. The secrets also outlive the compromise. Removing the attacker's AWS access does not help until every harvested value has been rotated, and rotation has to cover previous versions that are still accepted by the target system.

OPSEC and artifacts

  • Read by name, skip the listing. ListSecrets and DescribeParameters by an application role are unusual. An operator who learned the names from task definitions or config reads them directly, like the application does. Each read is still a management event: GetSecretValue with the secret in requestParameters.secretId.
  • Batch to reduce requests. One BatchGetSecretValue call replaces many. It does not reduce the trail: Secrets Manager also writes a GetSecretValue event for each secret the batch returns.
  • Prefer Parameter Store paths. GetParametersByPath and GetParameters write one event per request however many parameters come back, so the event count understates the disclosure. The request parameters still show the path, the recursive flag and whether decryption was requested.
  • Use the role where it lives. Reads from the instance or function that owns the role come from the expected address. The same reads from another network change sourceIPAddress and userAgent.
  • Slow down. A handful of reads per hour stays under volume thresholds. It does not hide a role reading secrets it has never read before.
  • What is never logged: the values. CloudTrail excludes the sensitive response fields, so the log proves the request, not the content or what was done with it.
  • Gaps to know. AWS documents a ParameterNotFound exception for GetParameter, but CloudTrail does not record that exception for this operation, so guessing parameter names leaves less trace than guessing secret names. A denied Secrets Manager read is recorded with errorCode AccessDeniedException; some pipelines normalize it to AccessDenied, so match both.
  • KMS adds a second record. With a customer managed key, each decryption is a KMS Decrypt event made on the caller's behalf.

Detection

  • Many different secrets by one principal. The Secrets Manager bulk retrieval rules count distinct requestParameters.secretId values per caller, with a starting threshold of ten secrets in ten minutes, and include denied reads.
  • A first-time reader. A principal reading a secret it has not read in the baseline period, or a secret being read by anyone other than its application and its rotation function.
  • Discovery before reading. ListSecrets or DescribeParameters by a workload role, followed by reads. Broader discovery is covered by the IAM enumeration rules.
  • Wide path reads. GetParametersByPath on a short path such as / or /prod/ with recursive and withDecryption both true.
  • Old versions. Requests for the AWSPREVIOUS stage outside a rotation window.
  • Denied attempts. A burst of denied GetSecretValue calls shows a credential probing for what it can reach.
-- Distinct secrets requested per caller per hour, with denied reads (Athena, CloudTrail table)
SELECT useridentity.arn AS caller,
       sourceipaddress,
       date_trunc('hour', from_iso8601_timestamp(eventtime)) AS hour,
       count(DISTINCT json_extract_scalar(requestparameters, '$.secretId')) AS secrets,
       count_if(errorcode IN ('AccessDeniedException', 'AccessDenied')) AS denied
FROM cloudtrail_logs
WHERE eventsource = 'secretsmanager.amazonaws.com'
  AND eventname = 'GetSecretValue'
  AND eventtime >= '2026-11-22T00:00:00Z'
GROUP BY 1, 2, 3
HAVING count(DISTINCT json_extract_scalar(requestparameters, '$.secretId')) >= 10
ORDER BY secrets DESC

A secret requested once by name and once by ARN counts twice. Count the per-secret GetSecretValue rows and not the BatchGetSecretValue request, and classify each row's outcome before calling a secret disclosed. For Parameter Store, read the request parameters of GetParameter, GetParameters and GetParametersByPath events; a count of events is a count of requests, not of parameters. Application start-up, deployments and rotation functions read secrets legitimately and in bursts, so baseline by principal. Both event types are read-only management events and reach a trail only if it logs read events.

Mitigation

  • Scope read access to named secrets. Replace Resource: "*" with the ARNs or the path prefix one application needs, and use tags or resource policies to separate environments. This is least privilege where it pays most.
  • Separate listing from reading. Inventory rights (ListSecrets, DescribeParameters) and value reads should be different grants, and few identities need the first.
  • Use customer managed KMS keys with tight key policies for the most sensitive secrets, so that reading needs a second, independently controlled permission. Review who holds kms:Decrypt.
  • Restrict Parameter Store paths and decryption. Grant ssm:GetParametersByPath only on the application's own subtree, and mind that recursive reads include child paths. Store credentials as SecureString, never as String.
  • Rotate automatically. Turn on secret rotation for database and service credentials so a harvested value has a short life, and prefer mechanisms without a stored secret at all, such as IAM database authentication and role-based access between AWS services.
  • Constrain where roles can be used. Conditions on source VPC or VPC endpoint in the secret's resource policy keep a copied credential from reading secrets from outside the network.
  • After a harvest, rotate everything the principal could read, not only what the log shows it read, and check the target systems' own logs for use of the old values. The same reasoning applies in Azure: see Key Vault secret access abuse.

Detection rules for this attack

Log events to collect

FAQ

Does CloudTrail show which secret values were read?

It shows which secrets were requested, by whom and from where, never the values. A GetSecretValue event carries the secret's name or ARN in requestParameters.secretId. The sensitive response fields are left out. For Parameter Store, the event shows the parameter name or path and whether decryption was requested, and a single GetParametersByPath event can stand for many parameters returned.

Does a customer managed KMS key protect secrets from a compromised role?

Only if the role cannot use the key. Reading a secret that is encrypted with a customer managed key needs both the read permission on the secret and kms:Decrypt on the key. A key policy that grants decrypt to a small set of principals is a real second barrier. A key that every role in the account may use adds an audit trail and nothing else.

What is the difference between String and SecureString parameters for an attacker?

A String or StringList parameter is returned in clear text by any read, and the WithDecryption flag is ignored. A SecureString is returned encrypted unless the request asks for decryption and the caller may use the KMS key. Passwords stored as plain String parameters are therefore readable with the read permission alone, and they are common.

How many API calls does it take to dump a secret store?

Few. BatchGetSecretValue returns up to 20 secrets per call and can select them with filters, and GetParametersByPath with the recursive option walks a whole parameter hierarchy page by page. Secrets Manager still writes one GetSecretValue event for each secret a batch call returns, so per-secret counting works there. Parameter Store batch reads do not expand that way.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.