ProjectSend — 1 vulnerability check

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

← All products · Feeds on GitHub

ProjectSend < r1720 unauthenticated options.php settings handler

CVECVE-2024-11680
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, tcp_connect, script, http_request, match · highest QoD 97
Feedtests/vulnerabilities/projectsend/CVE-2024-11680.yaml

Tests ProjectSend (before r1720) for the improper authentication in options.php (CVE-2024-11680): the settings form handler runs for an anonymous visitor, who can then change any application option. The test opens the login page to obtain a session and its CSRF token, then posts to options.php with that token and a single random field left empty, so the handler rejects the form as incomplete and saves nothing. The handler's own answer confirms it ran without a login: its redirect back to the options page, or its "Options could not be saved" error message shown on the next login page of the same session. A server error to that post, without either sign, is reported with lower confidence: the handler ran and failed while logging the change, which happens on older releases with a strict database or a recent PHP. A fixed release redirects to the login page instead. No option is changed; the application may record an "options updated" entry in its activity log.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /index.php HTTP/1.0
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request POST /options.php?section=branding with a crafted body
  4. HTTP(S) request GET /index.php
  5. Parses / computes the next value with a Rhai script
  6. Checks v.proof for . → finding QoD 97: Anonymous POST /options.php (valid session CSRF token, one random empty field — nothing saved) was processed by the settings handler: …
  7. Checks v.weak_proof for . → finding QoD 70: Anonymous POST /options.php with a valid session CSRF token and one random empty field was not redirected to the login page: …

References:

Feed source — tests/vulnerabilities/projectsend/CVE-2024-11680.yaml
# ProjectSend < r1720 — unauthenticated options.php POST handler (CVE-2024-11680)
#
# Before r1720, options.php never called log_in_required(): its POST branch runs for an
# anonymous visitor who only holds a valid session CSRF token (any visitor gets one from
# the login page). Checked against the upstream tags r1295, r1415, r1584, r1605 (vulnerable)
# and r1720 (fixed: log_in_required() redirects to index.php before the POST branch) of
# github.com/ignacionelson/ProjectSend.
#
# Non-destructive proof — nothing is written to the options table:
#   1. GET /index.php over a raw socket: every Set-Cookie (session) + the csrf_token of the
#      login form. Fingerprint gate: the login_form with its csrf_token input.
#   2. POST /options.php?section=branding with that session, the token and ONE random,
#      empty field. The section comes from the query string ("branding" has no checkbox
#      list, so nothing is forced to 0), so the only saved key would be the random one —
#      but it is empty, so the handler's "all fields filled" check fails and save_option()
#      is never called. The handler then logs an action-log entry and redirects.
#   3. GET /index.php with the same session.
#   Proof (either):
#     a. r1584+ store the error flash "Some fields were not completed. Options could not be
#        saved." in the session; the login page of step 3 renders it (absent in step 1).
#        Holds on PHP 8 too, where the action-log call fatals on the undefined
#        CURRENT_USER_ID constant after the flash is set (500 instead of a redirect).
#     b. The handler's own redirect: Location "options.php?section=" (empty: the section
#        was not posted) — r1295..r1415 append "&status=3" (fields missing). No other
#        code path of options.php redirects there; the fixed release redirects to
#        index.php. Language-independent, but only on PHP 7 with a non-strict sql_mode:
#        the action-log insert puts the string 'CURRENT_USER_ID' into an int column, so
#        strict MySQL >= 5.7 / MariaDB >= 10.2.4 (default) throws → 500 before the redirect.
#     c. (QoD 70) The POST, with the valid session token, answers 500 and no flash shows:
#        the handler reached its action-log call and died (old releases on PHP 8 or on a
#        strict database, or a translated install on PHP 8). The fixed release redirects
#        before any database access, so it never answers 500 here.
#
# Fixes issue #2413: the previous probe posted site_name=NOCTIS_PROBE_TEST_TITLE with an
# invalid token — a real install answers 403 to an invalid token, and with a valid one
# that request stores a new option on the target.
#
# CVSS: NVD v3.1 9.8 for CVE-2024-11680.
uid: f745f696-15d9-4d5e-94a6-b5692bc7ba4c
name: "ProjectSend < r1720 unauthenticated options.php settings handler (CVE-2024-11680)"
description: |
  Tests ProjectSend (before r1720) for the improper authentication in options.php
  (CVE-2024-11680): the settings form handler runs for an anonymous visitor, who can then
  change any application option. The test opens the login page to obtain a session and its
  CSRF token, then posts to options.php with that token and a single random field left
  empty, so the handler rejects the form as incomplete and saves nothing. The handler's own
  answer confirms it ran without a login: its redirect back to the options page, or its
  "Options could not be saved" error message shown on the next login page of the same
  session. A server error to that post, without either sign, is reported with lower
  confidence: the handler ran and failed while logging the change, which happens on older
  releases with a strict database or a recent PHP. A fixed release redirects to the login
  page instead. No option is changed; the
  application may record an "options updated" entry in its activity log.
cves: [CVE-2024-11680]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [projectsend, auth-bypass, settings-manipulation, kev]
services: [http, https]
author: noctis
version: "1.1.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2024-11680"
  - "https://www.projectsend.org/security-advisory-2024-11/"
  - "https://github.com/ignacionelson/ProjectSend/compare/r1605...r1720"

steps:
  # Pre-initialise every stored result a script reads.
  - id: init-lp
    action: set_var
    var_name: lp
    var_value: {connected: false, banner: null}

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

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

  # 1. Login page: session cookies (raw reply — http_request keeps only the last
  #    Set-Cookie) and the form's csrf_token.
  - id: login
    action: tcp_connect
    port: "{{port}}"
    send: "GET /index.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\n\r\n"
    store_as: lp

  - id: session
    action: script
    code: |
      let out = #{ ok: false, cookie: "", token: "", field: "noctis" + tolower(rand_str(10)), base_msg: false };
      if type_of(lp.banner) == "string" {
        let raw = lp.banner;
        let cut = stridx(raw, "\r\n\r\n");
        let head = if cut >= 0 { substr(raw, 0, cut) } else { raw };
        let jar = #{};
        for l in split(head, "\n") {
          let c = eregmatch("^set-cookie:[ \\t]*([A-Za-z0-9_.-]+)=([^;\\r]*)", l, true);
          if c.len() < 3 || c[2] == "" || c[2] == "deleted" { continue; }
          jar[c[1]] = c[2];
        }
        for k in jar.keys() {
          if out.cookie != "" { out.cookie += "; "; }
          out.cookie += k + "=" + jar[k];
        }
        let t = eregmatch("<input type=\"hidden\" name=\"csrf_token\" value=\"([0-9a-f]{32,128})\"", raw);
        if t.len() > 1 { out.token = t[1]; }
        out.base_msg = ereg("Options could not be saved", raw);
        out.ok = ereg("^HTTP/1\\.[01] 200 ", raw) && ereg("id=\"login_form\"", raw)
          && out.token != "" && out.cookie != "";
      }
      out
    store_as: s

  # 2. The options handler, anonymously, with one random empty field: rejected as
  #    incomplete, nothing saved.
  - id: options-post
    action: http_request
    method: POST
    path: "/options.php?section=branding"
    port: "{{port}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: "s.ok == true"
    headers:
      Content-Type: application/x-www-form-urlencoded
      Cookie: "{{s.cookie}}"
    body: "csrf_token={{s.token}}&{{s.field}}="
    store_as: post

  # 3. Same session: the handler's error flash, if it ran.
  - id: login-again
    action: http_request
    method: GET
    path: /index.php
    port: "{{port}}"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    condition: "s.ok == true && post.status != 0"
    headers:
      Cookie: "{{s.cookie}}"
    store_as: after

  - id: verdict
    action: script
    code: |
      let loc = "";
      if post.status >= 301 && post.status <= 303 && type_of(post.headers["location"]) == "string" {
        loc = post.headers["location"];
      }
      let by_loc = ereg("(^|/)options\\.php\\?section=(&status=3)?$", loc);
      let by_flash = s.ok == true && s.base_msg == false && after.status == 200
        && type_of(after.body) == "string"
        && ereg("Some fields were not completed\\. Options could not be saved\\.", after.body);
      let proof = if by_flash && by_loc {
        "error flash on the next page and redirect to " + loc
      } else if by_flash {
        "error flash \"Options could not be saved\" on the next page (POST answered " + post.status + ")"
      } else if by_loc {
        "redirect to " + loc
      } else { "" };
      let weak = s.ok == true && !by_flash && !by_loc && post.status == 500;
      #{ hit: s.ok == true && (by_flash || by_loc), proof: proof,
         weak: weak, weak_proof: if weak { "POST answered 500 (handler died in its action-log call)" } else { "" } }
    store_as: v

  - id: handler-ran
    action: match
    source: v.proof
    pattern: "."
    condition: "v.hit == true"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "Anonymous POST /options.php (valid session CSRF token, one random empty field — nothing saved) was processed by the settings handler: {{v.proof}}"

  - id: handler-crashed
    action: match
    source: v.weak_proof
    pattern: "."
    condition: "v.weak == true"
    on_match:
      finding:
        confidence_delta: 0.40
        qod: 70
        evidence: "Anonymous POST /options.php with a valid session CSRF token and one random empty field was not redirected to the login page: {{v.weak_proof}}"

View these feeds on GitHub