id: CVE-2025-46817

info:
  name: Redis < 8.2.1 lua script - Integer Overflow
  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 cause an integer overflow 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.
  impact: |
    Authenticated users can execute arbitrary code remotely, potentially compromising the entire system.
  remediation: |
    Update to version 8.2.2 or later.
  reference:
    - https://github.com/dwisiswant0/CVE-2025-46817/blob/master/README.md
  metadata:
    verified: true
    max-request: 1
    shodan-query: product:"redis"
  tags: cve,cve2025,js,redis,network,passive,authenticated,vuln

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.1')
        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: 490a004630440220080a6659d3227d58a0fa8dc7bd43125de8a2e35e2495dc3333d2a4bbfd52eaca02203e7ef01f288abeef90e8fbef910a07079b3e259c88d44adb9e89e2a27f4783a2:922c64590222798bb761d5b6d8e72950