CVE-2025-54070
Last modified
CVE-2025-54070 is a medium-severity vulnerability rated 6.9/10 on the CVSS scale. 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. EPSS estimates a 0.33% chance of exploitation in the next 30 days.
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.
Metrics
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Weakness Enumeration
References
Timeline
- Published
- Last Modified
- Status
- Deferred
Frequently Asked Questions
What is CVE-2025-54070?
How severe is CVE-2025-54070?
How do I fix CVE-2025-54070?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2025
- CVE-2025-54063Cherry Studio is a desktop client that supports for multiple…9.6
- CVE-2025-54064Rucio is a software framework that provides functionality to…6.9
- CVE-2025-54065GZDoom is a feature centric port for all Doom engine games. …7.9
- CVE-2025-54066DiracX-Web is a web application that provides an interface t…4.7
- CVE-2025-54068Livewire is a full-stack framework for Laravel. In Livewire …9.8
- CVE-2025-5407A vulnerability has been found in chaitak-gorai Blogbook up …5.4
- CVE-2025-54071RomM (ROM Manager) allows users to scan, enrich, browse and …9.4
- CVE-2025-54072yt-dlp is a feature-rich command-line audio/video downloader…8.1
- CVE-2025-54073mcp-package-docs is an MCP (Model Context Protocol) server t…7.5
- CVE-2025-54074Cherry Studio is a desktop client that supports for multiple…9.8
- CVE-2025-54075MDC is a tool to take regular Markdown and write documents i…8.3
- CVE-2025-54076WeGIA is an open source web manager with a focus on the Port…6.1
Are you affected by CVE-2025-54070?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
