CWE-345Identity & accessSeverity · High

Tokens meant for another service

An API accepts a token issued for a different app or audience. A token from a low-trust app, or another tenant's issuer, then opens a more sensitive API.

At a glance

Controls
CWE-345 · A08:2021 Software and Data Integrity Failures
Typical severityHigh
ReferenceCWE-345
OWASP Top 10A08:2021 Software and Data Integrity Failures

What it is

Tokens name who issued them and which service they are for. Many APIs check the signature and stop there. They never check the audience or issuer claims, so any token from a shared identity provider works.

An attacker gets a valid token from an easy place, such as a public app, a test client or a partner integration. They send it to a more sensitive API that shares the same identity provider. AI-assisted attackers read token claims and map which services trust which issuers, so they spot the gap quickly.

Where it hides

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

  • Several apps that share one identity provider or signing key
  • Multi-tenant setups where each tenant has its own issuer
  • Mobile, web and partner clients that all reach the same backend
  • Internal service-to-service APIs that accept user tokens

How MATT tests it

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

  1. 01Read the code and configuration to see which issuer and audience each API expects.
  2. 02Sign in to a second test app or client that uses the same identity provider and take its token.
  3. 03Send that token to the target API with a safe read call and record whether it is accepted.
The rule, in plain English

An API must accept only tokens issued for it, by the issuer it trusts.

Executable check

get a valid token issued for app X call GET /v1/me on API Y with that token expect: 401 send a token from an untrusted issuer to API Y expect: 401

Every rule MATT holds →

What the fix looks like

  1. 01

    Check the audience claim on every request and accept only this API's own audience.

  2. 02

    Check the issuer claim against a fixed list of trusted issuers.

  3. 03

    Give each tenant or app its own audience, and keep separate keys where trust levels differ.

  4. 04

    Use separate credentials for service‑to‑service calls.

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