Guide · Ilia Dubovskii · 1 December 2026

How to Test That Your AWS Honeytokens Still Work (Positive Controls)

To test that an AWS honeytoken still works, use the decoy access key yourself, on a schedule, from a place you know, and raise an alarm when the expected alert does not arrive. That is a positive control. A honeytoken that never fires is either a quiet month or a broken alert path, and the two look the same. The test is one sts:GetCallerIdentity call with the decoy key, and the alarm is a CloudWatch alarm with TreatMissingData set to breaching.

The short version

1. Why a quiet honeytoken tells you nothing

A honeytoken is a decoy credential that nothing legitimate uses. On AWS it is usually an access key for an IAM user that is denied every action. CloudTrail records any call made with the key, an EventBridge rule matches the record, and an alert goes to Slack or a pager. The build is in our guide, AWS canary credentials: how to set up an IAM honeytoken.

Most monitoring fails loudly. A honeytoken fails silently, because its normal reading is also silence. "Nobody touched the decoy" and "the alert path has been broken since March" produce the same empty channel. Laboratories solve this with a positive control: a sample known to contain the thing the test looks for. For a honeytoken, the positive control is a trip you cause yourself.

In our October 2026 incident an attacker used PHP2Shell to read a container's environment, tried the decoy AWS key, and the alert reached Slack in under a minute (the write-up). With a disabled rule, that would have been a silent month.

2. What can break without anyone noticing

Every row is a change that produces no error and no alert. The names (backup-reporting-activity, svc-backup-reporting, management-events) are the ones used in the build guide.

What breaks Why nothing tells you How to check by hand
The EventBridge rule is disabled or deletedA rule that matches nothing looks the same as a rule that is offaws events describe-rule --name backup-reporting-activity --region us-east-1 --query State
The rule state is plain ENABLEDA rule in the ENABLED state does not match read-only management events, so sts:GetCallerIdentity is missed (AWS)The same command must print ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS
A region has no ruleEventBridge rules are regional and the attacker picks the regionRepeat describe-rule with --region for every enabled region
The CloudTrail trail stopped loggingEventBridge only gets CloudTrail events while a trail is loggingaws cloudtrail get-trail-status --name management-events --query IsLogging
The trail is not multi-region, or logs write events onlyThe backstop metric filter then sees one region, or no read-only callsaws cloudtrail describe-trails --query "trailList[].[Name,IsMultiRegionTrail,HomeRegion]" and aws cloudtrail get-event-selectors --trail-name management-events
The rule has no target, or the SNS subscription is goneThe rule still matches. The message goes nowhereaws events list-targets-by-rule --rule backup-reporting-activity and aws sns list-subscriptions-by-topic --topic-arn <topic-arn>
A clean-up job deactivated or deleted the keyUnused keys are exactly what key hygiene tools removeaws iam list-access-keys --user-name svc-backup-reporting --query "AccessKeyMetadata[].[AccessKeyId,Status]"
A deploy dropped the decoy from the task definitionThe alert path is fine. There is nothing left to stealSee "after every deploy" below

AWS CLI reference: describe-rule, get-trail-status, describe-trails, get-event-selectors, list-targets-by-rule, list-subscriptions-by-topic, list-access-keys. A healthy key shows Active. A healthy trail shows IsLogging and IsMultiRegionTrail as true, and an event selector with ReadWriteType set to All. get-trail-status answers for one region, so run it in the trail's home region.

We have not verified whether CloudTrail records a call made with a deactivated or deleted key, so treat that decoy as blind. And a configuration check only reads the settings someone thought of. A positive control sends a real event through the real path, so it also catches what is not in the table: a changed topic policy, a revoked Slack webhook.

3. Run the test by hand

Tell whoever is on call first. Use a machine whose public IP address you know, in the directory where you applied terraform-aws-honeytoken. The subshell keeps the decoy credentials out of your session.

(
  export AWS_ACCESS_KEY_ID="$(terraform output -raw access_key_id)"
  export AWS_SECRET_ACCESS_KEY="$(terraform output -raw secret_access_key)"
  unset AWS_SESSION_TOKEN AWS_PROFILE

  # A random marker for this one run. Write it down with the time.
  export AWS_SDK_UA_APP_ID="t-$(openssl rand -hex 8)"
  echo "$AWS_SDK_UA_APP_ID"
  date -u +%H:%M:%S

  # 1. Read-only, needs no permissions: succeeds.
  aws sts get-caller-identity --region us-east-1

  # 2. Denied: fails with AccessDenied, and is still logged.
  aws s3api list-buckets --region us-east-1

  # 3. A regional endpoint in another region.
  aws sts get-caller-identity --region eu-west-1 \
    --endpoint-url https://sts.eu-west-1.amazonaws.com
)

AWS_SDK_UA_APP_ID is a standard setting of the AWS CLI v2 and the SDKs, at most 50 characters (AWS SDKs and Tools reference). The SDK puts the value into the User-Agent header as app/<value> (botocore), and CloudTrail records that header in the event's userAgent field.

Each call proves a different thing. Call 1 needs no permissions, so it succeeds even under a deny-all policy (AWS), and its alert proves the rule has the ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS state. The alert for call 2 proves denied calls reach you. The alert for call 3 proves that region is covered.

You should receive three alerts on the EventBridge path, or one alarm on the CloudWatch Logs backstop. Each event should show the decoy user's ARN, your address in sourceIPAddress and your marker inside userAgent (CloudTrail record contents).

AWS says CloudTrail typically delivers events to CloudWatch Logs within an average of about 5 minutes, without a guarantee (AWS). Our build guide found no published figure for the EventBridge path. In our October incident it took under a minute. Measure your own: subtract the event's eventTime from the time the alert arrived.

If an alert is missing, check with your normal credentials whether CloudTrail saw the call:

aws cloudtrail lookup-events --region us-east-1 \
  --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=<decoy-key-id>

lookup-events covers one region, so repeat it with --region eu-west-1 for call 3. An event without an alert points at the rule or the target. No event at all points at the key.

4. Tell a test trip from a real one without an allowlist

The obvious shortcut is a filter: "ignore trips from the office IP" or "ignore trips with our test user agent". That filter is an allowlist, and an allowlist on a honeytoken is a way to use the decoy without being seen.

Three properties keep the test safe:

  1. The test alert is never dropped. The alert travels the whole path and lands in the same channel as a real one. The test is only labelled, at the last step. If the label logic breaks, the worst case is a test that looks real.
  2. The label comes from a one-time record, not from a pattern. Before the call, the tester writes down the decoy, the time and the random marker. A trip is labelled as a test only if it carries that marker, arrives within minutes of that time, and comes from the tester's address. The record is used once.
  3. Everything else is real. No marker, an old marker, the wrong address, or two trips where one was expected: page a person.

Each part is weak alone:

What is left over is the tester. Someone who controls it can read the next marker and send from the right address, so review changes to the tester like changes to the alert path.

5. Schedule the test and alarm when the trip goes missing

A test that a person has to remember stops in the third month. The scheduled version is a tester, a metric, and an alarm that fires on silence.

The tester is a Lambda function started by EventBridge Scheduler, or a scheduled CI job with a fixed source address. Each run writes the one-time record, calls sts:GetCallerIdentity with the decoy key in every watched region with the marker in the user agent (in boto3, Config(user_agent_appid=marker)), then looks for the alert at the far end. The further along the path it looks, the more the test proves. Only if the alert was seen, the tester publishes a metric (put-metric-data):

aws cloudwatch put-metric-data --namespace Ops --metric-name DecoyTestSeen \
  --dimensions Decoy=svc-backup-reporting --value 1 --unit Count

The schedule is an aws_scheduler_schedule with a rate expression:

resource "aws_scheduler_schedule" "decoy_test" {
  name                = "decoy-test"
  schedule_expression = "rate(12 hours)"

  flexible_time_window {
    mode = "OFF"
  }

  target {
    arn      = aws_lambda_function.decoy_test.arn
    role_arn = aws_iam_role.decoy_test_scheduler.arn
  }
}

The tester's secret store becomes a second place where every decoy lives. Write that down next to the decoy.

The dead man's switch

This alarm fires when a number is absent. CloudWatch calls the setting TreatMissingData. The default value is missing. With breaching, missing data points are treated as "bad" and breaching the threshold (CloudWatch user guide, PutMetricAlarm). In Terraform it is the treat_missing_data argument of aws_cloudwatch_metric_alarm:

resource "aws_cloudwatch_metric_alarm" "decoy_test_missing" {
  alarm_name          = "decoy-test-missing"
  namespace           = "Ops"
  metric_name         = "DecoyTestSeen"
  dimensions          = { Decoy = "svc-backup-reporting" }
  statistic           = "Sum"
  period              = 86400
  evaluation_periods  = 1
  comparison_operator = "LessThanThreshold"
  threshold           = 1
  treat_missing_data  = "breaching"

  # Not the honeytoken's own topic.
  alarm_actions = [aws_sns_topic.ops_fallback.arn]
}

This alarm reads: "fewer than one successful test trip in a day". It fires when the alert path is broken, and also when the tester crashed or the schedule was disabled. All of those leave the metric empty, and empty counts as breaching.

Three details matter:

With these settings you can be blind for about a day without knowing. Also test after every change to regions, the trail, the rule or the alert routing. Record each run: the decoy, the region, the time of the call, the event's eventTime and the time the alert was seen. The difference is your latency, and a slow drift in it shows up before a failure does.

6. Test the response in staging and the decoy after every deploy

The response. If a trip restarts a task or deactivates a key, test that in a staging copy only, never in production: the same decoy module, the same response wiring, a staging service. In staging, skip the test label and let the trip run the response for real. For a restart, the service's deployments should show a new task (describe-services). For a key deactivation, aws iam list-access-keys should show the decoy key as Inactive. Then undo the response, or the staging decoy stays broken.

The decoy after every deploy. A deploy that registers a task definition from its own template, not from the Terraform that planted the decoy, produces a revision without the decoy. Add a step at the end of the pipeline:

TASK_DEF="$(aws ecs describe-services --cluster <cluster> --services <service> \
  --query "services[0].taskDefinition" --output text)"

aws ecs describe-task-definition --task-definition "$TASK_DEF" \
  --query "taskDefinition.containerDefinitions[].environment[?name=='BACKUP_AWS_ACCESS_KEY_ID'].value" \
  --output text

Fail the pipeline if the output is empty or differs from terraform output -raw access_key_id (describe-task-definition). This check proves the decoy is in the task definition the service runs. It does not prove the alert path.

7. What Compass does and does not do, and the limits

Compass is our open-source (Apache 2.0) agent that plants decoys as Terraform pull requests. Its honeytoken documentation describes two positive controls run by hand:

Compass does not run scheduled self-tests today, and Compass has no alarm for a missing test trip. honeypot fire proves the path only as far as Compass's own queue, not as far as your Slack channel. honeypot fire also marks its own alerts with a fixed user-agent string, which is the static-marker pattern this article warns about, so do not treat that marker as proof that a trip was a test. If you use Compass, build the schedule and the dead man's switch yourself.

The limits of the whole approach:

Honeytokens do not replace GuardDuty or your other alerts. Keep both.

8. Sources

9. FAQ

What is a positive control for a honeytoken?

A positive control is a trip you cause on purpose to prove the alert path works. You use the decoy AWS key yourself, for example with aws sts get-caller-identity, from a known address at a known time, and check that the alert arrives.

Which CloudWatch setting makes an alarm fire when no data arrives?

The setting is TreatMissingData with the value breaching. In Terraform it is treat_missing_data = "breaching" on aws_cloudwatch_metric_alarm. With the default, missing, an alarm whose data points are all missing goes to INSUFFICIENT_DATA, not to ALARM.

Can I ignore honeytoken alerts from my own IP address or user agent?

No. A rule that drops alerts by source IP or user agent is an allowlist, and an attacker who learns the rule can use the decoy unseen. Let every alert through, and label a test only when it matches a one-time record the tester wrote before the call.

Does Compass test its honeytokens automatically?

No. Compass has a manual test, honeypot fire, which makes one STS call with the decoy key and waits for the alert on Compass's queue. Compass does not run scheduled self-tests today.

Last checked: 25 November 2026. Written by Ilia Dubovskii, founder of Beamreach. Commands and setting names were checked against AWS and Terraform documentation on that date. The scheduled test is a design: run it in a test account first.

Related: *2Shell vulnerabilities · How to protect against *2Shell · PHP2Shell contained in two minutes · AWS canary credentials · One Fake Password (talk) · CVE Watch