Selena Sol Guestbook — 1 vulnerability check
noctis ships 1 vulnerability check for Selena Sol Guestbook, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Selena Sol's Guestbook guestbook.cgi SSI Injection
| CVE | CVE-1999-0237 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/selena-sol-guestbook/CVE-1999-0237.yaml |
Detects guestbook.cgi from Selena Sol's Guestbook (CVE-1999-0237). In its default setup the script writes visitor input into the guestbook page without removing HTML comments, so a server-side include (SSI) directive such as <!--#exec cmd="..."--> sent in an entry is stored as is and runs when the web server parses SSI in the guestbook page. Under the web root, /cgi-bin, /scripts, /cgi-local, /guestbook and /cgi-bin/guestbook, the feed sends guestbook.cgi one POST in which the required name and comments fields are empty (so the script adds no entry and answers with its "You forgot to fill out" form) and the address fields hold per-run random text around a complete, harmless <!--#echo var="..."--> directive. It reports the script when that error form returns the text with the directive intact, which shows the input reaches the guestbook unfiltered: a fixed copy, which removes comments or tags, or a page that merely echoes its input, does not match. Whether the server actually runs SSI in the guestbook page is not tested.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{url}}with a crafted body - Parses / computes the next value with a Rhai script
- Checks
verdictfor^POST→ finding QoD 75: Selena Sol's Guestbook guestbook.cgi SSI injection
References:
- https://nvd.nist.gov/vuln/detail/CVE-1999-0237
- https://exchange.xforce.ibmcloud.com/vulnerabilities/CVE-1999-0237
- https://auscert.org.au/bulletins/ESB-1997.052/
Feed source — tests/vulnerabilities/selena-sol-guestbook/CVE-1999-0237.yaml
# Selena Sol's Guestbook guestbook.cgi — server-side include injection through
# guestbook entries (CVE-1999-0237, CERT VB-97.02, AUSCERT ESB-1997.052)
#
# Credit: target script adapted from Greenbone's `pre2008/guestbook.nasl`
# (GPL-2.0-only), which only reports that guestbook.cgi exists
# (http_is_cgi_installed_ka) under / and the CGI dirs.
#
# CVE mapping: the NVD record ("Remote execution of arbitrary commands through
# Guestbook CGI program") is the 1997 Selena Sol guestbook hole of CERT
# VB-97.02: "All versions of this program" let a visitor store HTML — and so
# SSI directives — in the Comment field when the guestbook directory allows
# SSI. Matt Wright's guestbook.pl (BID 776) is CVE-1999-1053, covered by
# tests/vulnerabilities/matt-wright-guestbook/CVE-1999-1053.yaml.
#
# Source facts (guestbook.cgi 3.0, "Selena Sol's Guestbook", 08-01-96; a
# deployed copy is at github.com/matto2/stagnaro-fishing cgi-bin/report/):
# &ReadParse(*form_data);
# if ($form_data{'action'} eq "add" || $ENV{'REQUEST_METHOD'} eq "GET")
# { &add_form_header; &output_add_form; exit; }
# foreach $variable (@form_variables) {
# foreach $word (@bad_words) { … s/\b$word\b/censored/gi; }
# if ($allow_html != "yes") { $form_data{$variable} =~ s/<([^>]|\n)*>//g; }
# }
# foreach $field (@required_fields)
# { if ($form_data{$field} eq "") { &missing_required_field_data($field); } }
# … open (GUEST,">$guestbookreal") … print GUEST … $form_data{…} …
# missing_required_field_data() prints "Woopsy, You forgot to fill out $field
# …", then output_add_form — the form with every field's filtered value — and
# exits before guestbook.html is opened. guestbook.setup ships
# $allow_html = yes, so nothing is filtered: an <!--#exec cmd="…"--> in an
# entry is written into guestbook.html and runs when that page is SSI-parsed.
# The VB-97.02 fix strips <!--(.|\n)*--> from every field (its advice to set
# $allow_html = no does nothing on its own in 3.0: "!=" compares numerically,
# and "yes" and "no" are both 0, so the tag stripper never runs).
#
# Better than the reference check (presence of any guestbook.cgi): the feed
# POSTs the guestbook's fields with realname and comments (the required
# fields) empty, so no entry is ever written, and email, url, city, state and
# country carrying per-run random text around a complete, harmless
# <!--#echo var="…"--> directive (several fields, in case a customised add
# form echoes only some of them). It reports
# only when the script's own "forgot to fill out <field>" page comes back
# with the directive intact — the unfiltered input path. A fixed copy (comment
# or tag stripping) returns the text without it; a plain reflector has no such
# error page. Not proven: that the server SSI-parses guestbook.html
# (non-default configuration); exploiting it would mean writing a public
# entry, so the feed stops at QoD 75.
uid: e5cd4921-a31f-40e3-8ffc-50e3ef08078c
name: "Selena Sol's Guestbook guestbook.cgi SSI Injection (CVE-1999-0237)"
description: |
Detects guestbook.cgi from Selena Sol's Guestbook (CVE-1999-0237). In its
default setup the script writes visitor input into the guestbook page
without removing HTML comments, so a server-side include (SSI) directive
such as <!--#exec cmd="..."--> sent in an entry is stored as is and runs
when the web server parses SSI in the guestbook page. Under the web root,
/cgi-bin, /scripts, /cgi-local, /guestbook and /cgi-bin/guestbook, the feed
sends guestbook.cgi one POST in which the required name and comments fields
are empty (so the script adds no entry and answers with its "You forgot to
fill out" form) and the address fields hold per-run random text around a
complete, harmless <!--#echo var="..."--> directive. It reports the script
when that error form returns the text with the directive intact, which shows
the input reaches the guestbook unfiltered: a fixed copy, which removes
comments or tags, or a page that merely echoes its input, does not match.
Whether the server actually runs SSI in the guestbook page is not tested.
cves: [CVE-1999-0237]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [selena-sol-guestbook, guestbook, cgi, perl, ssi, ssi-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-1999-0237"
- "https://exchange.xforce.ibmcloud.com/vulnerabilities/CVE-1999-0237"
- "https://auscert.org.au/bulletins/ESB-1997.052/"
steps:
# a, c: 7 digits; b: 6 digits. The expected echo is built here so the
# judge compares one literal string.
- id: gen-tokens
action: script
code: |
let a = rand_int(1000000, 9999999);
let b = rand_int(100000, 999999);
let c = rand_int(1000000, 9999999);
#{ a: a, b: b, c: c,
p: "N" + a + "%3C%21--%23echo%20var%3D%22V" + b + "%22--%3EK" + c,
expect: "N" + a + "<!--#echo var=\"V" + b + "\"-->K" + c }
store_as: ov
# ── Per location: this step and every following one ──
# Pre-initialised so a failed request leaves no undefined variable behind.
- id: init
action: set_var
var_name: gb
var_value: {status: 0, body: ""}
loop:
over:
- "/guestbook.cgi"
- "/cgi-bin/guestbook.cgi"
- "/scripts/guestbook.cgi"
- "/cgi-local/guestbook.cgi"
- "/guestbook/guestbook.cgi"
- "/cgi-bin/guestbook/guestbook.cgi"
var: url
# realname and comments empty: guestbook.cgi exits in
# missing_required_field_data() before opening guestbook.html.
- id: post-city
action: http_request
method: POST
path: "{{url}}"
port: "{{port}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "realname=&email={{ov.p}}&url={{ov.p}}&city={{ov.p}}&state={{ov.p}}&country={{ov.p}}&comments="
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: gb
- id: judge
action: script
store_as: verdict
code: |
let b = if type_of(gb.body) == "string" { gb.body } else { "" };
let m = eregmatch("forgot to fill out ([A-Za-z_]+)", b);
if gb.status == 200 && type_of(m) == "array" && m.len() > 1
&& b.contains(ov.expect) {
"POST " + url + " realname= comments= city=" + ov.expect + " (also email, url, state, country)"
+ ": the \"forgot to fill out " + m[1]
+ "\" form echoed the field with the SSI directive intact (input not filtered)"
} else {
""
}
- id: report
action: match
source: verdict
pattern: "^POST "
on_match:
finding:
title: "Selena Sol's Guestbook guestbook.cgi SSI injection"
description: "guestbook.cgi does not remove HTML comments from visitor input, so a server-side include directive such as <!--#exec cmd=\"...\"--> sent in an entry is stored in the guestbook page and runs when the web server parses SSI in it."
remediation: "Remove Selena Sol's guestbook.cgi (the script is no longer maintained) or, at the very least, strip <!-- ... --> comments from every field before it is stored (setting $allow_html = no is not enough in version 3.0, whose check compares the value numerically); disable server-side includes, or at least exec, for the guestbook directory."
confidence_delta: 0.55
qod: 75
evidence: "{{verdict}}"
stop: true