CWE-347OWASP A02:2021OWASP API2:2023CWE-345

CWE-347: Improper Signature Verification

An application accepts a signed token, webhook, or message without properly verifying its signature, so an attacker can forge or tamper with it.

Also known as: Signature bypass, Unverified JWT, Missing webhook verification

Risk

Typically high to critical. A forged signature can mean authenticating as any user, accepting fake payment webhooks, or trusting tampered data, usually with no other exploit needed.

Definition

What it is

CWE-347 is the failure to correctly verify a cryptographic signature before trusting the signed content. It covers decoding a JWT without checking its signature, accepting the alg none header, comparing signatures with a non-constant-time check, or skipping webhook verification altogether. Because the signature is the only thing proving the message is authentic, a weak or absent check lets an attacker craft their own valid-looking token or payload. The consequence is direct: the system trusts data the attacker fully controls.

Use-cases

How it shows up in real code

JWT decoded but not verified

The server decodes a JWT to read the user id but never verifies the signature. An attacker edits the payload to any user id and the server trusts it.

alg none accepted

A library is configured to honor the token's alg header, and an attacker sets it to none. The token now needs no valid signature and is accepted as authentic.

Unverified payment webhook

A billing webhook marks orders as paid based on the request body alone. An attacker posts a fake paid event and receives goods without paying.

Non-constant-time compare

Signature bytes are compared with a normal equality check that returns early. The timing leak lets an attacker recover a valid signature byte by byte.

AI risk

Why AI-generated code has increased the exposure

  • Assistants optimize for code that reads the token's contents and returns the user, so they decode the payload and skip the verify step that adds no visible output.
  • Training data mixes decode and verify examples, so the model emits jwt.decode where jwt.verify with a key and allowed algorithms was required.
  • The signing secret or public key lives in config the model cannot see, so rather than wire it in, the assistant quietly drops the verification.
  • When scaffolding a webhook receiver, the model focuses on parsing the event body and omits the provider's signature-check step entirely.
  • Generated signature comparisons use ordinary equality rather than a constant-time function, since the model matches values the simplest way.

Vibe coding

How vibe coding amplifies the risk

  • Vibe coding ships a token handler that returns the right user in testing, hiding that it never checked the signature at all.
  • The skipped review is where someone would catch decode used in place of verify, or a webhook with no signature check.
  • A prototype that trusted unsigned tokens for speed is promoted to production, where that trust becomes an authentication bypass.
  • The flaw is invisible in local and demo testing because a developer only ever sends genuine tokens, never a forged one.
  • As the product adds integrations and webhooks, each new receiver is vibe-coded without verification, multiplying the forgeable entry points.

Detection

How to find it

  • Search for JWT handling that decodes without verifying, and for libraries configured to accept the alg none value or a caller-chosen algorithm.
  • Confirm every webhook receiver checks the provider's signature against the shared secret before acting on the payload.
  • Try a tampered token and a forged webhook against a test endpoint to see whether either is accepted.
  • Review signature comparisons for non-constant-time equality that leaks through timing.

Remediation

How to fix it

  • Always verify the signature with the expected key before trusting any signed token or message, and reject on any failure.
  • Pin the allowed algorithms explicitly and refuse none and unexpected algorithm values from the token header.
  • Verify every webhook with the provider's documented signature and secret before processing the event.
  • Compare signatures and MACs with a constant-time function to avoid timing side channels.
  • Keep verification keys and webhook secrets server-side in a secrets manager, and rotate any that may have leaked.

Frequently asked questions

What is CWE-347 (improper verification of cryptographic signature)?
CWE-347 is when an application trusts a signed token, webhook, or message without properly verifying its signature, for example decoding a JWT without checking it, accepting the alg none header, or skipping webhook verification. Because the signature is the only proof of authenticity, the attacker can forge content the system then trusts.
How have AI assistants and vibe coding increased the risk?
Assistants optimize for reading a token's contents and often emit decode where verify was needed, or build a webhook receiver that parses the body but never checks its signature, partly because the key lives in config they cannot see. Vibe coding ships that code because genuine tokens pass in testing, so the missing check never surfaces before production.
How do I fix improper signature verification?
Verify every signature with the expected key before trusting the content, pin allowed algorithms and reject none, check each webhook against its provider secret, use constant-time comparison, and keep keys and secrets server-side.

Related weaknesses

Catch CWE-347 before you ship

Tethlyn Audit scans your codebase and its git history for CWE-347 and the rest of the authentication & session security class, then ranks each finding by real exploitability and data sensitivity.

See Tethlyn Audit