How ridter/redis-rce works
Purpose and Entry Point
This repository is a single-purpose offensive security tool targeting Redis 4.x/5.x instances. It attempts remote code execution by presenting a rogue Redis replication server, causing the target to synchronize a supplied Redis module, then loading that module.
The only executable entry point is redis-rce.py; usage, target/version scope, and required module artifact are documented in README.md.
Operator Interface
redis-rce.py exposes a CLI for:
• Target Redis host, port, and optional authentication.
• Attacker-controlled rogue-server bind address and port.
• Path to the Redis module shared object, defaulting to exp.so.
• Verbose runtime output.
The module binary is not included in the repository; operators must compile or obtain it externally as specified in README.md.
Exploit Orchestration
The main control flow is concentrated in redis-rce.py:
1. Connect to the target Redis service.
2. Authenticate when an AUTH value is supplied.
3. Reconfigure or direct Redis replication toward the attacker’s rogue server.
4. Serve replication data containing the selected module payload.
5. Trigger Redis module loading and interact with the resulting command-execution capability.
This combines a client role toward the target Redis instance with a server role toward the target’s replication connection.
Rogue Replication Boundary
The attacker-hosted listener in redis-rce.py is the key protocol boundary. It must emulate enough Redis replication behavior for the target to accept the replication stream and persist the delivered module. Its address is supplied through -L/--lhost; its default listener port is 21000.
The target boundary is the Redis RESP/TCP service, normally port 6379, configured by -r/--rhost and -p/--rport.
Module Execution Boundary
The exploit payload is a Redis module shared library, expected as exp.so unless overridden with -f/--file. The tool depends on an externally compiled module from RedisModules-ExecuteCommand, rather than implementing arbitrary command execution wholly in Python.
redis-rce.py is therefore responsible for delivery and activation; the native module provides execution functionality after Redis loads it.
Runtime and Dependencies
The tool runs under Python and declares its runtime dependencies in requirements.txt. It requires:
• Network reachability from operator host to the target Redis service.
• Reachability from target Redis back to the operator’s rogue listener.
• A susceptible Redis 4.x/5.x deployment with replication/module-loading conditions that permit the attack.
Repository scope is intentionally narrow: README.md provides operational guidance, while redis-rce.py contains the exploit implementation.
Main entry points: redis-rce.py Exploit Controller · README.md Operational Guide · requirements.txt Python Dependencies
Components 12
Operator Inputs
- Operational Guide · Documents usage, scope, and external module requirement.
README.md - CLI Options · Accepts target, listener, module, auth, and verbosity settings.
redis-rce.py - Python Dependencies
requirements.txt - Operator Host · Runs the Python exploit and hosts the rogue listener.
Exploit Orchestration
- Exploit Controller · Coordinates target control, replication delivery, and module activation.
redis-rce.py - Redis Target Client · Connects and optionally authenticates to the target.
redis-rce.py - Replication Setup · Directs the target to synchronize from the rogue server.
redis-rce.py - Rogue Replication Server · Emulates Redis replication and serves the payload stream.
redis-rce.py - Module Load Trigger · Loads the delivered module on the target.
redis-rce.py
Target & Payload
- Target Redis 4.x/5.x · Susceptible RESP/TCP endpoint, normally on port 6379.
- Redis Module Payload · External exp.so artifact, or the file selected with --file.
- Command Execution · Provided by the external RedisModules-ExecuteCommand module.
Connections 15
- Operational Guide → CLI Options: documents
- Python Dependencies → Exploit Controller: supports runtime
- Operator Host → Exploit Controller: runs
- CLI Options → Exploit Controller: configures
- Exploit Controller → Redis Target Client: connects through
- Redis Target Client → Target Redis 4.x/5.x: RESP/TCP and optional AUTH
- Exploit Controller → Replication Setup: initiates
- Replication Setup → Target Redis 4.x/5.x: configures replication source
- Exploit Controller → Rogue Replication Server: hosts
- Target Redis 4.x/5.x → Rogue Replication Server: replication connection
- Redis Module Payload → Rogue Replication Server: served in replication stream
- Rogue Replication Server → Target Redis 4.x/5.x: delivers module data
- Exploit Controller → Module Load Trigger: triggers
- Module Load Trigger → Target Redis 4.x/5.x: loads module
- Target Redis 4.x/5.x → Command Execution: hosts loaded module