SEVERITY NOT PROVIDED · CVSS 4.0 EPSS 0.3% · 11th percentile CWE-1287

CVE-2026-62270: Type confusion via structural idempotency guard in ExAws.Dynamo.Encoder.encode/2

Published 2026-11-24 · Updated 2026-11-26 · Also known as EEF-CVE-2026-62270, GHSA-9776-rh77-6wp6

Summary

A type confusion vulnerability in ExAws.Dynamo.Encoder.encode/2 allows untrusted map data to bypass the encoding protocol by merely containing DynamoDB type descriptor keys. Engineering teams maintaining applications using vulnerable versions of ex_aws_dynamo should upgrade immediately.

Who is affected

Deployments that pass user-influenced map data into DynamoDB operations or expression attribute values are vulnerable. Attackers can exploit this without authentication to cause persistent data corruption, bypass authorization checks, inject arbitrary attributes, and trigger reader crashes resulting in denial of service.

Exploitability

The vulnerability requires local access with low privileges or low attack complexity depending on user interaction patterns, though the vector states low privileges and no UI are required. The EPSS score is 0.003 and it is not present in the CISA KEV list, indicating low observed exploitation frequency in the wild.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-26. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Hex ex_aws_dynamo >= 2.0.0, < 4.3.0 4.3.0 mix deps.update ex_aws_dynamo

CVSS 4.0 vector

CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N

Attack vectorLocal
Attack complexityLow
Attack requirementsPresent
Privileges requiredNone
User interactionNone
Confidentiality (vulnerable system)Low
Integrity (vulnerable system)High
Availability (vulnerable system)Low
Confidentiality (subsequent systems)None
Integrity (subsequent systems)None
Availability (subsequent systems)None

Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.

FAQ

What causes the type confusion vulnerability in ExAws.Dynamo.Encoder?

The encode/2 function checks only for the presence of DynamoDB type descriptor keys (such as 'S', 'N', 'M') in maps, treating them as already encoded and returning them verbatim without validating their internal structure or type.

Which versions of ex_aws_dynamo are affected?

Versions from 2.0.0 up to, but not including, 4.3.0 are affected.

What is the recommended fix for CVE-2026-62270?

The primary remediation is to upgrade ex_aws_dynamo to version 4.3.0 or later.

Original advisory description
## Summary Improper Validation of Specified Type of Input in `ExAws.Dynamo.Encoder.encode/2` in ex_aws_dynamo allows an attacker who controls map data passed into a DynamoDB call to choose the raw stored DynamoDB `AttributeValue`. The `encode/2` function in `lib/ex_aws/dynamo/encoder.ex` has one clause per DynamoDB type descriptor (`"S"`, `"N"`, `"B"`, `"BOOL"`, `"M"`, `"L"`, `"NS"`, `"SS"`, `"BS"`, `"NULL"`) that treats any map merely containing such a key as already encoded and returns it verbatim, bypassing the `ExAws.Dynamo.Encodable` protocol. The match is on the presence of the key alone, so no check is made that the value is well formed for the claimed type, and extra keys and arbitrary nested content survive untouched. An application that threads user-influenced map data (a decoded JSON body, a nested attribute, or an `expression_attribute_values` entry) into a Dynamo write or query therefore lets the user, rather than the application, decide the stored attribute's declared type, its bytes, and its structure. This type confusion breaks round-trip integrity and enables silent persistent data corruption, injection of attributes and raw binaries the schema never sanctioned, subversion of application authorization checks that trust the decoded type of a value, and a decoder crash on read-back that denies reads of the affected item to other users of the same table. This issue affects ex_aws_dynamo: from 2.0.0 before 4.3.0. ## Details **1. Structural idempotency guard.** `ExAws.Dynamo.Encoder.encode/2` in `lib/ex_aws/dynamo/encoder.ex` has one clause per type descriptor (`"S"`, `"N"`, `"B"`, `"BOOL"`, `"BS"`, `"L"`, `"M"`, `"NS"`, `"NULL"`, `"SS"`), each of the form `def encode(%{"S" => _} = val, _), do: val`. A map that merely contains one of these keys is returned verbatim and skips the `ExAws.Dynamo.Encodable` protocol. **2. No validation.** The match is on the presence of the key alone: extra keys and arbitrary nested content survive, and nothing checks that the value is well formed for the claimed type. Nothing distinguishes a value this encoder produced from user data of the same shape, so a decoded JSON body `%{"S" => "evil"}`, meant as a Map with a key named `"S"`, is sent as the string `"evil"`. **3. Consequences.** The user, not the application, decides the stored attribute's type, bytes and structure, and `decode(encode(x))` differs from `x` for any `x` shaped like the wire format. `encode!/2` and `encode_root/2` call `Encodable.encode` directly and skip the shortcut, so the same value encodes differently depending on the entry point. ## Proof of concept 1. An endpoint takes a JSON body `{"filter": <any JSON value>}` and passes the value to `ExAws.Dynamo.query("Products", key_condition_expression: "attr = :val", expression_attribute_values: [val: user_value])`, which runs it through `Encoder.encode/2`. 2. A benign value `{"city": "Berlin"}` is encoded as type `M`. 3. The attacker sends `{"N": "1000000"}`. The `"N"` clause matches, the map is sent unchanged, and it reads back as the integer `1000000` instead of a map. 4. `{"B": "<base64>"}` stores attacker-chosen raw bytes, `{"NULL": "true"}` makes an `is_private` flag decode to `nil`, and `{"M": {"role": {"S": "admin"}, "is_admin": {"BOOL": true}}}` injects attributes the schema never sanctioned. 5. `{"N": "evil"}` is stored as a malformed number, and a later scan by another user raises while decoding the item. ## Impact Type confusion / improper input validation in `ExAws.Dynamo.Encoder.encode/2`. Affects any application on `ex_aws_dynamo` that passes user-influenced map data (a decoded JSON body, a nested attribute, a filter value) into a Dynamo item write or `expression_attribute_values`, which is the ordinary usage pattern behind an HTTP boundary. No authentication or special privilege is needed, only the ability to submit a JSON object whose key is one of the ten type descriptors. Consequences range from silent persistent data corruption and denial of service for other readers of the same table, to authorization bypass and injection of attacker-controlled binaries and privileged attributes into the datastore. ## Workarounds Validate or reject untrusted map data whose top-level key is one of the DynamoDB type descriptors (`"S"`, `"N"`, `"B"`, `"BOOL"`, `"M"`, `"L"`, `"NS"`, `"SS"`, `"BS"`, `"NULL"`) before passing it to `ExAws.Dynamo.Encoder.encode/2` or into a Dynamo call, so that user-supplied maps cannot be mistaken for already-encoded values.

References

Source records: EEF-CVE-2026-62270 (OSV.dev) · EPSS by FIRST, 2026-11-26.