Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2025-46818 PoC — Redis: Authenticated users can execute LUA scripts as a different user

Source
Associated Vulnerability
Title:Redis: Authenticated users can execute LUA scripts as a different user (CVE-2025-46818)
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.
Description
CVE-2025-46818 – Redis Lua Sandbox Cross-User Escape
Readme
# CVE-2025-46818 – Redis Lua Sandbox Cross-User Escape

Sandbox escape via deprecated Lua APIs and mutable metatables on Redis 8.2.1.

## Overview

Redis 8.2.1 keeps deprecated Lua builtins (`getfenv`, `setfenv`, `newproxy`) exposed to scripts and fails to lock metatables for basic types. An attacker can inject methods into shared metatables, capture privileged environments, and run commands with another user's permissions.

## Environment

- Redis server 8.2.1 (or any vulnerable release before 8.2.2)
- `redis-cli`
- Local network access to the Redis instance

## Files

- [`CVE-2025-46818.lua`](/CVE-2025-46818.lua) – verifies deprecated builtins are present, patches the string metatable, and exposes a helper.

## Usage

```bash
# Setup
redis-cli -h localhost -p 6379 --eval CVE-2025-46818.lua
# Invoke the injected helper (assuming the victim user has higher privileges):
redis-cli -h localhost -p 6379 EVAL "return ('test').escalate()" 0
```

**Expected result:**

On 8.2.1 the initial script reports the deprecated APIs as `true` and confirms the metatable modification. The follow-up call returns the output of `ACL WHOAMI` (or whichever privileged command you swap in). Redis 8.2.2 removes the APIs by default, makes basic metatables read-only, and logs attempts.

## Mitigation

Upgrade to Redis 8.2.2 or later, or disable Lua for untrusted users or run with `lua-enable-deprecated-api no`.
File Snapshot

[4.0K] /data/pocs/7f2c9e1dddbc10e856ac55dbb588c700c7d9a38d ├── [1.5K] CVE-2025-46818.lua └── [1.4K] README.md 1 directory, 2 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →