BreachSpiderVerified, not vibes

CVE-2025-54070 in Openzeppelin products

No CVSS score published

OpenZeppelin Contracts is a library for secure smart contract development. Starting in version 5.2.0 and prior to version 5.4.0, the `lastIndexOf(bytes,byte,uint256)` function of the `Bytes.sol` library may access uninitialized memory when the following two conditions hold: 1) the provided buffer length is empty (i....

Affects 0 products from 4 vendors. Facts below cite their sources.

CVSS v46.9
EPSS0.7%
EPSS percentile47th
FixUnknown

Affected products and versions

VendorProductAffected versions
Openzeppelin — —
Processing — —
Search — —
Valid — —

A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.

Fix and vendor advisory

No official vendor advisory link on record. See the CVE record.

Exploitation

CISA known-exploitedNot in the CISA KEV catalog
Public exploitNot confirmed

Official description

OpenZeppelin Contracts is a library for secure smart contract development. Starting in version 5.2.0 and prior to version 5.4.0, the `lastIndexOf(bytes,byte,uint256)` function of the `Bytes.sol` library may access uninitialized memory when the following two conditions hold: 1) the provided buffer length is empty (i.e. `buffer.length == 0`) and position is not `2**256 - 1` (i.e. `pos != type(uint256).max`). The `pos` argument could be used to access arbitrary data outside of the buffer bounds. This could lead to the operation running out of gas, or returning an invalid index (outside of the empty buffer). Processing this invalid result for accessing the `buffer` would cause a revert under normal conditions. When triggered, the function reads memory at offset `buffer + 0x20 + pos`. If memory at that location (outside the `buffer`) matches the search pattern, the function would return an out of bound index instead of the expected `type(uint256).max`. This creates unexpected behavior where callers receive a valid-looking index pointing outside buffer bounds. Subsequent memory accesses that don't check bounds and use the returned index must carefully review the potential impact depending on their setup. Code relying on this function returning `type(uint256).max` for empty buffers or using the returned index without bounds checking could exhibit undefined behavior. Users should upgrade to version 5.4.0 to receive a patch.

Source: NIST NVD / MITRE CVE.

Record details

CVE IDCVE-2025-54070
BreachSpider IDBS-2025-GLOBAL-277776-I
Published2025-07-17
Last modified2026-06-17
Weakness (CWE)
SourceNVD

Weakness definitions

CWE-125: Out-of-Bounds Read

Software reads data past the boundary of an allocated buffer, leaking sensitive information or causing crashes.

Related attack patterns (CAPEC)

CAPEC-540 Overread Buffers via CWE-125

Mapping is CWE to CAPEC per MITRE CAPEC 3.9.

Analysis AI-written, not human-reviewed

A vulnerability in OpenZeppelin Contracts versions 5.2.0 to 5.3.9 allows for potential access to uninitialized memory in the `lastIndexOf(bytes,byte,uint256)` function of the `Bytes.sol` library under specific conditions.

The vulnerability occurs when the `lastIndexOf` function is called with an empty buffer and a position that is not `2**256 - 1`. This can lead to the function accessing uninitialized memory, which may contain sensitive data or lead to unexpected behavior.

Questions

What is CVE-2025-54070?

A vulnerability in OpenZeppelin Contracts versions 5.2.0 to 5.3.9 allows for potential access to uninitialized memory in the `lastIndexOf(bytes,byte,uint256)` function of the `Bytes.sol` library under specific conditions.

Is CVE-2025-54070 actively exploited?

No confirmed active exploitation of CVE-2025-54070 as of 2026-09-25.

How do I remediate CVE-2025-54070?

Priority: MEDIUM.

What systems are affected by CVE-2025-54070?

CVE-2025-54070 affects Openzeppelin; Processing; Search; Valid.

For developers and AI agents

Run this check from your own code or agent

REST API

curl -s https://breachspider.com/api/v1/assets/correlate-cves \
 -H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"assets":[{"asset_id":"dev-1","vendor":"Openzeppelin","product":"EDS-518A","version":"1.0"}]}'

API reference

Python SDK

pip install breachspider

PyPI · GitHub

MCP for AI agents

# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp

Setup for Claude, ChatGPT, Cursor

Free trial: 14 days, 750 device checks, no card.

Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-06-17.