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

Published Nov 24, 2026
·
Updated

Summary

Improper Validation of Specified Type of Input in ExAws.Dynamo.Encoder.encode/2 in exawsdynamo 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/exaws/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 expressionattributevalues 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 exawsdynamo: from 2.0.0 before 4.3.0.

Details

1. Structural idempotency guard. ExAws.Dynamo.Encoder.encode/2 in lib/exaws/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 encoderoot/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", keyconditionexpression: "attr = :val", expressionattributevalues: [val: uservalue]), 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 isprivate flag decode to nil, and {"M": {"role": {"S": "admin"}, "isadmin": {"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 exawsdynamo that passes user-influenced map data (a decoded JSON body, a nested attribute, a filter value) into a Dynamo item write or expressionattributevalues, 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.

Other sources

Improper Validation of Specified Type of Input in ExAws.Dynamo.Encoder.encode/2 in exawsdynamo 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/exaws/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 expressionattributevalues 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 exawsdynamo: from 2.0.0 before 4.3.0.

— MITRE

Affected Software

2 affected componentsFixes available
hex/ex_aws_dynamo>=2.0.0<4.3.0
erlang/ex_aws_dynamo>=2.0.0<4.3.0
4.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade erlang/ex_aws_dynamo to a version that resolves this vulnerability.

    Fixed in 4.3.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 4.3.0
  3. Compensating control

    Validate or reject untrusted maps with a top-level key matching a DynamoDB type descriptor ("S", "N", "B", "BOOL", "M", "L", "NS", "SS", "BS", or "NULL") before passing them to ExAws.Dynamo.Encoder.encode/2 or a Dynamo call.

Event History

Nov 24, 2026
CVE Published
via MITRE·12:59 PM
Data Sourced
via MITRE·12:59 PM
DescriptionWeakness
Data Sourced
via OSV·12:59 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via NVD·01:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which applications are exposed to this issue?

Applications are exposed when attacker-controlled map data is passed into a DynamoDB write or query through ex_aws_dynamo. This includes decoded JSON bodies, nested attributes, and expression_attribute_values entries that retain user influence.

2

What must an attacker provide to exploit it?

The attacker needs control over a map supplied to the DynamoDB call. A map containing a DynamoDB type-descriptor key such as "S", "N", "B", "BOOL", "M", "L", "NS", "SS", "BS", or "NULL" is treated as pre-encoded without validating the claimed value or rejecting extra content.

3

How can teams identify potentially affected code paths?

Review DynamoDB writes and queries for user-influenced maps reaching ex_aws_dynamo encoding, especially request-body data, nested map fields, and expression_attribute_values. These paths are relevant when the application expects its own values to be converted through the ExAws.Dynamo.Encodable protocol.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203