CVE-2025-46818
Redis: Authenticated users can execute LUA scripts as a different user
Record summary
CVE-2025-46818 has a selected CVSS score of 6.0 (medium); EIP currently links 1 repository PoC and 1 Nuclei template.
Description
Redis is an open source, in-memory database that persists on disk. Versions 8.2.1 and below allow an authenticated user to use a specially crafted Lua script to manipulate different LUA objects and potentially run their own code in the context of another user. The problem exists in all versions of Redis with LUA scripting. This issue is fixed in version 8.2.2. A workaround to mitigate the problem without patching the redis-server executable is to prevent users from executing LUA scripts. This can be done using ACL to block a script by restricting both the EVAL and FUNCTION command families.
Exploitation context
Affected products and versions
1| Product | Source | Version range | Status |
|---|---|---|---|
redisBrowse redis / redis | CVE List | < 8.2.2 | affected |
Proofs of concept
1Repository PoCs
GitHubdwisiswant0/CVE-2025-46818Repository PoCby dwisiswant0Stars: 0Scanner2 files
Analysis
Technical assessment
The artifact is a Lua script and README that checks for the presence of deprecated Lua APIs (getfenv, setfenv, newproxy) and attempts to modify the string metatable to inject a helper method. It reports on the availability of these APIs and the success of the metatable modification, functioning as a vulnerability scanner rather than a full exploit.
Backdoor review
No backdoor observed in reviewed code
The repository contains a proof-of-concept Lua script and README for CVE-2025-46818. The script demonstrates the claimed vulnerability by checking for deprecated Lua APIs and modifying the string metatable to inject an 'escalate' method that calls redis.pcall('ACL', 'WHOAMI'). This behavior is consistent with the described Redis sandbox escape and does not exhibit any concealed backdoor, credential theft, persistence, or unrelated payload. The script's actions are fully disclosed in the accompanying README.
Classification basis and observed behavior
Classification basis
The Lua script primarily checks for the presence of vulnerable conditions (deprecated APIs, mutable metatables) and reports on them. It does not autonomously exploit the vulnerability to achieve code execution in another user's context; it only injects a helper and requires a separate, manual step to invoke it. The README describes it as a 'repro' and verification script, consistent with a scanner.
CVE-2025-46818.lua:1CVE-2025-46818.lua:6-8README.md:17Requirements
- Authenticated access to a Redis instance with Lua scripting enabled.
README.md:2 - Redis version vulnerable to CVE-2025-46818 (e.g., 8.2.1).
README.md:11
Observed behavior
- Checks if deprecated Lua functions getfenv, setfenv, and newproxy are available.
CVE-2025-46818.lua:6-8 - Attempts to modify the string metatable to inject an 'escalate' method that calls redis.pcall('ACL', 'WHOAMI').
CVE-2025-46818.lua:19-31 - Returns a report indicating the availability of deprecated APIs and whether the metatable was patched.
CVE-2025-46818.lua:10-14CVE-2025-46818.lua:39
Behaviors behind the backdoor verdict
Observables
- Lua Script Behavior
- Payload withheldDemonstrates the claimed vulnerability by injecting a method that executes a privileged Redis command, matching the CVE description of running code in another user's context.
CVE-2025-46818.lua:24-31 - Deprecated Api Check
- Payload withheldVerifies the presence of deprecated Lua APIs that are part of the vulnerability, as described in the CVE and README.
CVE-2025-46818.lua:6-8
What the analysis did not establish
- The evidence does not include execution output or confirmation that the script successfully ran against a live Redis instance.
- The script's metatable injection is a partial step; full exploitation requires a separate privileged script execution, which is not automated in the provided code.
- Only the two text files (CVE-2025-46818.lua and README.md) were provided and reviewed; no other files exist in the repository snapshot.
- The review does not assess whether the PoC actually works as claimed or is safe to execute in any environment.
This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.
Nuclei templates
1ProjectDiscoveryHIGHRedis Lua Sandbox < 8.2.2 - Cross-User Escape
Redis is an open source, in-memory database that persists on disk. Versions 8.2.1 and below allow an authenticated user to use a specially crafted Lua script to manipulate different LUA objects and potentially run their own code in the context of another user. The problem exists in all versions of Redis with LUA scripting. This issue is fixed in version 8.2.2. A workaround to mitigate the problem without patching the redis-server executable is to prevent users from executing LUA scripts. This can be done using ACL to block a script by restricting both the EVAL and FUNCTION command families.
Impact
Authenticated users can execute arbitrary code in the context of other users, potentially leading to full system compromise.
Remediation
Upgrade to version 8.2.2 or later.
Source: ProjectDiscovery