The short version
- A honeytoken is silent when nobody steals it and silent when its alert path is broken, so silence proves nothing.
- A positive control is a trip you cause on purpose: one
aws sts get-caller-identitycall with the decoy key, then a check that the alert arrived. - Eight changes can break the path without any error, among them a disabled EventBridge rule, a stopped CloudTrail trail, a deactivated key and a deploy that drops the decoy.
- Label a test trip by matching it to a record the tester wrote before the call. Never drop alerts by source IP or user agent.
- The dead man's switch is a CloudWatch alarm on a "test trip seen" metric with
TreatMissingDataset tobreaching. Compass does not run scheduled self-tests today.
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 deleted | A rule that matches nothing looks the same as a rule that is off | aws events describe-rule --name backup-reporting-activity --region us-east-1 --query State |
The rule state is plain ENABLED | A 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 rule | EventBridge rules are regional and the attacker picks the region | Repeat describe-rule with --region for every enabled region |
| The CloudTrail trail stopped logging | EventBridge only gets CloudTrail events while a trail is logging | aws cloudtrail get-trail-status --name management-events --query IsLogging |
| The trail is not multi-region, or logs write events only | The backstop metric filter then sees one region, or no read-only calls | aws 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 gone | The rule still matches. The message goes nowhere | aws 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 key | Unused keys are exactly what key hygiene tools remove | aws iam list-access-keys --user-name svc-backup-reporting --query "AccessKeyMetadata[].[AccessKeyId,Status]" |
| A deploy dropped the decoy from the task definition | The alert path is fine. There is nothing left to steal | See "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:
- 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.
- 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.
- 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:
- A user-agent marker. The caller chooses the user agent, so a fixed marker such as
selftestis a password printed in your repository. A random marker that lives for minutes cannot be guessed in advance. - A known source address. AWS records
sourceIPAddress, the caller does not type it in. A scheduled tester needs a stable one, for example a Lambda function in private subnets behind a NAT gateway with an Elastic IP address (AWS). Do not share that NAT gateway with the workloads that hold the decoys: an attacker inside one would leave from the same address. - A maintenance window. A fixed weekly window is a schedule an attacker can learn. The one-time record gives a narrower one.
- A tag on the test event. The CloudTrail record has no field for a caller's own tag (record contents). The marker in
userAgentis the tag.
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:
- Run the test at least twice per alarm period, so one slow run does not raise a false alarm.
- Send the alarm somewhere else. If it uses the same SNS topic and Slack webhook as the honeytoken, one broken webhook silences both.
- Time the alarm once. CloudWatch looks further back than one period when data is missing (same guide), so disable the schedule on purpose and measure how long the alarm takes.
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:
honeypot armchecks that the decoy's resources are in place and refuses to arm an AWS key without a CloudTrail trail that logs management events.honeypot firemakes one STS call with the decoy's key and waits for the alert to come back through Compass's queue.
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:
- A positive control proves one path at one moment: from the tester, in the regions tested, at the time of the test.
- The test says nothing about placement. A decoy that alerts perfectly but sits where no attacker looks is still useless.
- Some calls may never be logged. Researchers have found AWS API calls that CloudTrail did not record.
- The tester is a new thing to protect, and nothing here was measured for cost.
Honeytokens do not replace GuardDuty or your other alerts. Keep both.
8. Sources
- AWS canary credentials: how to set up an IAM honeytoken (the build guide this article tests)
- terraform-aws-honeytoken and Compass honeytoken documentation
- Configuring how CloudWatch alarms treat missing data and PutMetricAlarm
- AWS service events delivered via CloudTrail and Receiving read-only management events
- CloudTrail record contents and Sending CloudTrail events to CloudWatch Logs
- Application ID setting (
AWS_SDK_UA_APP_ID) and botocore Config - Schedule types in EventBridge Scheduler
- Terraform AWS provider documentation: aws_cloudwatch_metric_alarm, aws_scheduler_schedule, aws_cloudwatch_event_rule
- PHP2Shell hit our PHP sites. A fake AWS key contained it in under two minutes
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
Beamreach