Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Canary tokens in agent sandboxes: tripwires that tell you when a run goes rogue

Most controls around agent code are preventive: isolation, network allowlists, scoped credentials. They limit what a compromised run can do. They do not tell you that a run was compromised. A prompt injection that tries to steal credentials and fails leaves you safe, and also unaware that someone tried. Canary tokens fill that gap. A canary is a fake secret or address that nothing legitimate…

Canary tokens are a security measure used to detect when an agent run has been compromised or is behaving maliciously. These tokens are essentially fake secrets or addresses that legitimate systems should never use. When an agent uses one of these canary tokens, it triggers an alert, indicating that something is amiss. In an agent sandbox, canary tokens can be particularly effective at identifying unauthorized activities.

The concept of canary tokens is demonstrated using the free Canarytokens service from Thinkst, which provides AWS API keys that look real to an attacker but are wired to an alert. If these AWS keys are used via the AWS API, an alert is generated. However, there is a delay of 2 to 30 minutes due to Amazon's logging system. Other types of canary tokens include unique DNS names and HTTP URLs that trigger alerts when accessed.

When placing canary tokens in an agent run, it is essential to consider what an injected instruction would tell the agent to do. For instance, attackers often target AWS credentials, so canary tokens can be placed in standard locations where these credentials are typically stored, such as an ~/.aws/credentials file or environment variables like AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. This approach allows canaries to fire whenever these keys are used, even if they are smuggled out of the sandbox.

Similarly, canary tokens can be placed in configuration files, such as a config.yaml file with an internal_api entry or a README file with a commented-out backup endpoint. If anything resolves the DNS canary, it indicates that the run attempted to establish a connection to it. This testing method helps evaluate network controls and detect potential exfiltration attempts.

Each canary token can be associated with a specific run, allowing for more targeted alerts. For example, using a unique canary token per run or per day of runs can provide detailed information about the source of the alert. Recording the token used for each run in structured logs is also crucial for tracking and analysis.

To minimize false alarms, canaries should not be placed in environments where they could be used legitimately. For example, AWS key canaries should not be included in runs involving AWS tasks. Additionally, canaries should be kept out of the prompt or system description to avoid unintended usage by the model.

When an alert is triggered, it is essential to investigate the run's transcript and commands to determine the cause of the alert. This investigation helps identify whether the issue is a prompt-injection problem, a task design problem, or both. Canary tokens do not prevent any malicious activity; instead, they provide post-incident evidence of suspicious behavior. They should be used in conjunction with existing security measures such as isolation, network limits, and credential scoping.

In a Sandscale sandbox, canaries can be implemented similarly to other environments. Fake credentials can be written to a file or passed as environment values when creating the sandbox. Labels can be used to tie the sandbox to the specific canary token. Sandboxes should also have Data Loss Prevention (DLP) checks in place to scan prompts and MCP tool calls for credentials before they leave the sandbox. This proactive approach can stop real secrets from reaching a model and alert you to any attempts to use canary keys.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

A Year-End Device Fleet Review for Small Teams Before the Next Budget

A mid-year inventory, started after a unit has already failed, answers a narrow question: what do we do about this one. A year-end review answers a broader one: what did this year actually ask of the…

  • Year-end review assesses device fleet performance over a year.
  • Data compiled on device type, model, usage frequency, and age.
  • Determines device effectiveness, failures, and data backup verification.

Bonsai 2.5 27B coding test

Ternary Bonsai 2.5 27B wrote Python rocket-game rules code in ~10 minutes. It passed all 14 of our checks. But then it spent ~110 tool calls on a font problem and never built the game!

Laravel 13.37 DoS: What Was Fixed, and How to Check

Last updated: 25 November 2026. This article is based on Laravel's published GitHub advisory and its framework changelog, plus secondary coverage.

  • Laravel 13.37.x versions vulnerable to DoS flaw, CVSS 7.5
  • Unauthenticated attackers could exhaust CPU, memory resources
  • Fixed in Laravel 13.38.0 (13.x) and 12.74.0 (12.x)

More from Thursday 26 November →