id: CVE-2025-49844

info:
  name: Redis Lua Parser < 8.2.2 - Use After Free
  author: pussycat0x
  severity: critical
  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 the garbage collector, trigger a use-after-free and potentially lead to remote code execution. The problem exists in all versions of Redis with Lua scripting. This issue is fixed in version 8.2.2. To workaround this issue without patching the redis-server executable is to prevent users from executing Lua scripts. This can be done using ACL to restrict EVAL and EVALSHA commands.
  impact: |
    Authenticated attackers can manipulate the garbage collector through crafted Lua scripts to trigger use-after-free conditions, potentially achieving remote code execution on Redis servers.
  remediation: |
    Upgrade to version 8.2.2 or later.
  reference:
    - https://www.wiz.io/blog/wiz-research-redis-rce-cve-2025-49844
    - https://github.com/dwisiswant0/CVE-2025-49844
  metadata:
    verified: true
    max-request: 1
    shodan-query: product:"redis"
  tags: cve,cve2025,js,redis,network,passive,authenticated,vuln,vkev

flow: javascript(1) && javascript(2)

javascript:
  - pre-condition: |
      isPortOpen(Host,Port);

    code: |
      const redis = require('nuclei/redis');
      const info = redis.GetServerInfo(Host,Port);
      Export(info);

    args:
      Host: "{{Host}}"
      Port: "6379"

    matchers:
      - type: dsl
        dsl:
          - success == true
          - compare_versions(version, ' < 8.2.2')
        condition: and


    extractors:
      - type: regex
        name: version
        part: response
        group: 1
        regex:
          - redis_version:(\d+\.\d+\.\d+)

  - code: |
      const redis = require('nuclei/redis');
      const info = redis.RunLuaScript(Host,Port,Password,Payload);
      Export(info);

    args:
      Host: "{{Host}}"
      Port: "6379"
      Password: "{{passwords}}"
      Payload: 'return "lua enabled"'

    payloads:
      passwords:
        - ""

    matchers:
      - type: dsl
        dsl:
          - success == true
          - contains(response, 'lua enabled')
        condition: and
        internal: true
# digest: 490a00463044022008ea7302c983f927b3414adbb7be9b9a84a18be037398ed0707e72325bedc756022063ad083f9a939166ebe829b36a1a924c1ff76301219de4bbb15daf933ac61210:922c64590222798bb761d5b6d8e72950