CWE-201AI-written & agentic codeSeverity · High

Secrets sent to a model

Keys, tokens or customer data end up in prompts sent to a model provider. That data then leaves the product's control and may be stored, logged or exposed.

At a glance

Controls
CWE-201
Typical severityHigh
ReferenceCWE-201

What it is

Features that call a model often send whole records, logs or files as context. These can contain API keys, session tokens or personal data. Once sent, the data sits with the provider and in any logs along the way.

An attacker who reaches prompt logs, a shared conversation or the model's response can read those secrets. Prompt injection can also make the model repeat its context back to the user. AI-assisted attackers are skilled at writing inputs that draw hidden context out of a model.

Where it hides

What a reviewer can look for in the code and in the behaviour, before anyone proves it.

  • Support or chat features that attach full customer records to each prompt
  • Debugging and log-summary tools that send raw logs with tokens in them
  • Coding assistants given access to files that hold environment variables or keys
  • Prompt and response logs kept by the product or an observability tool

How MATT tests it

The proof runs against the deployed product, on every release, whoever wrote the code.

  1. 01Read the code that builds prompts and list every field and file it adds to the context.
  2. 02Sign in with the test login, place a unique fake secret in a test record, and use the feature on that record.
  3. 03Check the outgoing request, the stored logs and the model's reply for the fake secret.
The rule, in plain English

Secrets and customer data must be removed before anything is sent to a model.

Executable check

as test user: use the AI feature on a record holding a canary key expect: the canary key is absent from the outgoing prompt expect: the canary key is absent from stored prompt logs expect: customer identifiers are masked in the prompt

Every rule MATT holds →

What the fix looks like

  1. 01

    Build prompts from an explicit list of allowed fields.

  2. 02

    Run a redaction step that removes keys, tokens and personal data before any call to a model.

  3. 03

    Keep secrets out of files and folders that assistants and agents can read.

  4. 04

    Limit how long prompt logs are kept and who can read them.

A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →

ExploitOps discovery call

Understand where your security loop breaks.

A call with a MATT co-founder to understand your product and whether an ExploitOps Review is worth doing. If there is a real need, we scope one with the research team.

Let’s understand your priority

What brings you to MATT?

What would you like help with?
01 / 02