EEF-CVE-2026-62270

Source
https://cna.erlef.org/osv/EEF-CVE-2026-62270.html
Import Source
https://cna.erlef.org/osv/EEF-CVE-2026-62270.json
JSON Data
https://api.osv.dev/v1/vulns/EEF-CVE-2026-62270
Aliases
  • GHSA-9776-rh77-6wp6
  • CVE-2026-62270
Published
2026-11-24T12:59:00Z
Modified
2026-11-24T13:00:03Z
Severity
  • 5.9 (Medium) CVSS_V4 - 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 (Source: CNA) CVSS Calculator
Summary
Type confusion via structural idempotency guard in ExAws.Dynamo.Encoder.encode/2
Details

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.

Database specific
{
    "capec_ids":  [
        "CAPEC-153"
    ],
    "cpe_ids":  [
        "cpe:2.3:a:ex-aws:ex_aws_dynamo:*:*:*:*:*:*:*:*"
    ],
    "cwe_ids":  [
        "CWE-1287"
    ]
}
References
Credits
    • Peter Ullrich - FINDER
    • Peter Ullrich - REPORTER
    • Jonatan Männchen / EEF - ANALYST
    • Peter Ullrich - COORDINATOR
    • Bernard Duggan - REMEDIATION_DEVELOPER

Affected packages

Hex / ex_aws_dynamo

Package

Name
ex_aws_dynamo
Purl
pkg:hex/ex_aws_dynamo

Affected ranges

Type
SEMVER
Events
Introduced
2.0.0
Fixed
4.3.0

Affected versions

2.*
2.0.0
2.0.1
2.1.0
2.2.0
2.2.1
2.2.2
2.3.0
2.3.1
2.3.2
2.3.3
2.3.4
3.*
3.0.0
3.0.1
3.0.2
3.0.3
4.*
4.0.0
4.0.1
4.0.2
4.1.0
4.2.0
4.2.1
4.2.2

Database specific

source
"https://cna.erlef.org/osv/EEF-CVE-2026-62270.json"

Git / github.com/ex-aws/ex_aws_dynamo

Affected ranges

Type
GIT
Repo
https://github.com/ex-aws/ex_aws_dynamo
Events

Affected versions

3.*
3.0.3
v2.*
v2.1.0
v2.2.0
v2.2.1
v2.2.2
v2.3.0
v2.3.1
v2.3.2
v2.3.3
v2.3.4
v3.*
v3.0.0
v3.0.1
v3.0.2
v4.*
v4.0.0
v4.0.1
v4.0.2
v4.1.0
v4.2.0
v4.2.1
v4.2.2

Database specific

source
"https://cna.erlef.org/osv/EEF-CVE-2026-62270.json"