BaseIncomplete

CWE-838Inappropriate Encoding for Output Context

Category: other

Description

The product uses or specifies an encoding when generating output to a downstream component, but the specified encoding is not the same as the encoding that is expected by the downstream component.

Common consequences· 1

  • Integrity / Confidentiality / Availability — Modify Application Data, Execute Unauthorized Code or Commands
    An attacker could modify the structure of the message or data being sent to the downstream component, possibly injecting commands.

Potential mitigations· 3

  • [Implementation]Use context-aware encoding. That is, understand which encoding is being used by the downstream component, and ensure that this encoding is used. If an encoding can be specified, do so, instead of assuming that the default encoding is the same as the default being assumed by the downstream component.
  • [Architecture and Design]Where possible, use communications protocols or data formats that provide strict boundaries between control and data. If this is not feasible, ensure that the protocols or formats allow the communicating components to explicitly state which encoding/decoding method is being used. Some template frameworks provide built-in support.
  • [Architecture and Design]

Related CAPEC attack patterns· 1

CAPEC-468

References

  1. https://cwe.mitre.org/data/definitions/838.html

Exploits (incoming)1

TypeTargetConfidenceTier
AttackPatternGeneric Cross-Browser Cross-Domain Theftcapec-468100%live

(incoming)1

TypeTargetConfidenceTier
VulnerabilityCVE-2025-4052cve-2025-40520%live

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Improper Encoding or Escaping of Output
CWE
Improper Handling of Alternate Encoding
CWE
Encoding Error
CWE
Improper Handling of Unicode Encoding
CWE
Improper Handling of Mixed Encoding
CWE
Improper Neutralization of Escape, Meta, or Control Sequences
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.