Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2022-31144

CVE-2022-31144: Redis Database RCE Vulnerability

CVE-2022-31144 is a remote code execution vulnerability in Redis database caused by a crafted XAUTOCLAIM command triggering heap overflow. This article covers the technical details, affected versions, and mitigation.

Published:

CVE-2022-31144 Overview

CVE-2022-31144 is a heap overflow vulnerability in Redis, an in-memory database that persists on disk. A specially crafted XAUTOCLAIM command on a stream key in a specific state may result in heap overflow, potentially leading to remote code execution. This vulnerability affects Redis versions on the 7.x branch prior to 7.0.4.

Critical Impact

Authenticated attackers with network access to vulnerable Redis instances can exploit this heap overflow vulnerability to potentially achieve remote code execution, compromising the confidentiality, integrity, and availability of the database system.

Affected Products

  • Redis versions 7.0.0 to 7.0.3
  • Redis 7.x branch prior to version 7.0.4
  • Systems running vulnerable Redis instances exposed to network access

Discovery Timeline

  • 2022-07-19 - CVE-2022-31144 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-31144

Vulnerability Analysis

This vulnerability is classified as a heap-based buffer overflow (CWE-122) and out-of-bounds write (CWE-787). The flaw resides in the handling of the XAUTOCLAIM command when processing stream keys in specific states. When a malicious user sends a specially crafted XAUTOCLAIM command, the Redis server fails to properly validate memory boundaries, resulting in a heap overflow condition.

The exploitation requires the attacker to have authenticated access to the Redis instance (low privileges required) and can be performed remotely over the network. No user interaction is required to trigger this vulnerability, making it particularly dangerous in environments where Redis is exposed to untrusted networks or users.

Root Cause

The root cause of CVE-2022-31144 stems from improper memory boundary validation in the XAUTOCLAIM command handler. When processing stream entries in certain edge-case states, the Redis server allocates insufficient heap memory or fails to properly check bounds before writing data. This leads to a heap-based buffer overflow where data is written beyond the allocated memory region.

The vulnerability specifically manifests when the stream key is in a particular state that triggers the flawed code path, allowing an attacker to corrupt adjacent heap memory structures.

Attack Vector

The attack vector for CVE-2022-31144 is network-based, requiring the attacker to have authenticated access to a vulnerable Redis instance. The exploitation flow involves:

  1. An attacker establishes an authenticated connection to the target Redis server
  2. The attacker identifies or creates a stream key in a vulnerable state
  3. A specially crafted XAUTOCLAIM command is sent to the server
  4. The malformed command triggers the heap overflow condition
  5. Depending on heap layout and exploitation technique, the attacker may achieve code execution

The vulnerability does not require user interaction and can be exploited with low-privilege authentication. Since Redis is often deployed in internal networks with minimal authentication, this vulnerability poses a significant risk to environments where network segmentation is inadequate.

Detection Methods for CVE-2022-31144

Indicators of Compromise

  • Unexpected Redis server crashes or restarts, particularly when processing stream commands
  • Anomalous XAUTOCLAIM commands in Redis slow logs or command history
  • Unusual memory access patterns or segmentation faults in Redis process logs
  • Suspicious authenticated connections from unexpected sources executing stream operations

Detection Strategies

  • Monitor Redis command logs for unusual XAUTOCLAIM command patterns or malformed arguments
  • Implement network intrusion detection rules to identify exploitation attempts targeting Redis streams
  • Deploy endpoint detection solutions like SentinelOne to monitor Redis process behavior for memory corruption indicators
  • Enable Redis ACLs to restrict access to stream commands for non-essential users

Monitoring Recommendations

  • Configure Redis logging to capture all XAUTOCLAIM commands with full argument details
  • Implement real-time alerting on Redis process crashes or abnormal terminations
  • Monitor network traffic to Redis ports (default 6379) for unusual patterns from authenticated sessions
  • Review Redis access logs regularly for authentication attempts from unauthorized sources

How to Mitigate CVE-2022-31144

Immediate Actions Required

  • Upgrade Redis to version 7.0.4 or later immediately
  • If immediate patching is not possible, restrict network access to Redis instances using firewall rules
  • Enable Redis AUTH and implement strong authentication credentials
  • Use Redis ACLs to limit which users can execute stream-related commands including XAUTOCLAIM
  • Ensure Redis is not exposed to untrusted networks or the public internet

Patch Information

The Redis development team has released version 7.0.4 which addresses this heap overflow vulnerability. Organizations running Redis 7.x versions prior to 7.0.4 should upgrade immediately. The patch information and release notes are available through the GitHub Redis Release 7.0.4. Additional security advisory details can be found in the GitHub Security Advisory GHSA-96f7-42fg-2jrh.

Linux distributions have also released patched packages, including Gentoo GLSA 202209-17. NetApp has issued guidance through their NetApp Security Advisory ntap-20220909-0002.

Workarounds

  • Implement network segmentation to isolate Redis instances from untrusted networks
  • Configure Redis ACLs to disable or restrict access to the XAUTOCLAIM command for non-essential users
  • Deploy a reverse proxy or firewall to filter potentially malicious Redis commands
  • Consider running Redis in protected mode if external access is not required
bash
# Configuration example - Restrict XAUTOCLAIM access using Redis ACLs
# Add to redis.conf or execute via redis-cli

# Create a restricted user without stream command access
ACL SETUSER limited_user on >strongpassword ~* &* +@all -@stream

# Alternatively, explicitly deny XAUTOCLAIM for specific users
ACL SETUSER app_user on >password ~* &* +@all -xautoclaim

# Enable protected mode to prevent external access
protected-mode yes

# Bind Redis to localhost only if external access is not required
bind 127.0.0.1 ::1

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.