Berta CMS — 1 vulnerability check

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

← All products · Feeds on GitHub

Berta CMS < 0.8.10b engine/upload.php unauthenticated file upload

CVECVE-2015-2780
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/berta-cms/CVE-2015-2780.yaml

Berta CMS before 0.8.10b exposes its admin media uploader, engine/upload.php, without requiring a login session, so an anonymous visitor can upload files to the site.

Under the usual install paths (/engine, /berta/engine, /berta and the web root), this check first requests login.php to confirm the Berta admin engine, then requests upload.php without any file. The vulnerability is reported when the upload handler itself answers the anonymous request with its JSON error reply (status 0, "Wrong file type or size too big!"); an engine that requires a session answers 401. No file is sent and nothing is written to the site.

How noctis detects it

  1. HTTP(S) request GET {{edir}}/login.php
  2. HTTP(S) request GET {{edir}}/upload.php
  3. Parses / computes the next value with a Rhai script
  4. Checks res.found for ^UPLOAD$ → finding QoD 75: Berta CMS engine/upload.php reachable without authentication (CVE-2015-2780)

References:

Feed source — tests/vulnerabilities/berta-cms/CVE-2015-2780.yaml
# Berta CMS < 0.8.10b — unauthenticated engine/upload.php (CVE-2015-2780)
#
# Up to 0.8.9b, engine/upload.php (the media uploader of the admin engine) does not
# require a session: it defines no AUTH_AUTHREQUIRED, so any visitor reaches the
# handler that stores a posted file under the media folder (and, by extension and
# image-header checks only, accepts files that are not plain images). 0.8.10b adds
# define('AUTH_AUTHREQUIRED', true) + DO_UPLOAD, and the endpoint answers 401 with an
# empty body to an anonymous request. Both versions checked in the upstream repository
# (berta-cms/berta, tags 0.8.9b / 0.8.10b).
#
# Detection (QoD 75), per candidate engine dir (/engine, /berta/engine, /berta, web root):
#   1. login.php must be the Berta login page (xLoginForm + "berta v <version>").
#   2. GET upload.php with no file: an unauthenticated 200 JSON reply from the upload
#      handler itself ({"status":0,"error":"Wrong file type or size too big!"}) proves
#      the handler runs without a session. A fixed engine answers 401.
# Nothing is uploaded: the request carries no file, so nothing is written to the target.
# Writing a file is the only way to go further and is deliberately not done.
#
# Better than the source NASL: it matched the regex "O*error" (which matches any text
# containing "error") on /upload.php of a site, and requested /login.php instead of
# engine/login.php; this check requires the handler's own JSON error and the product's
# login page under the same directory.
# CVSS: NVD v3.x base score 9.8 (v2: 7.5).
#
# Source: OpenVAS/Greenbone NVT 2015/gb_berta_cms_file_upload_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805356, GPL-2.0-only).
uid: fbc643c8-27a3-40aa-bd06-fb1d6c77fe75
name: "Berta CMS < 0.8.10b engine/upload.php unauthenticated file upload (CVE-2015-2780)"
description: |
  Berta CMS before 0.8.10b exposes its admin media uploader, engine/upload.php, without
  requiring a login session, so an anonymous visitor can upload files to the site.

  Under the usual install paths (/engine, /berta/engine, /berta and the web root), this
  check first requests login.php to confirm the Berta admin engine, then requests
  upload.php without any file. The vulnerability is reported when the upload handler
  itself answers the anonymous request with its JSON error reply (status 0, "Wrong file
  type or size too big!"); an engine that requires a session answers 401. No file is
  sent and nothing is written to the site.
cves: [CVE-2015-2780]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [berta, berta-cms, php, file-upload, missing-authentication]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-2780"

steps:
  # A loop: step runs together with every following non-loop step once per directory;
  # pre-initialise the stored results a condition or script reads.
  - id: init-login
    action: set_var
    var_name: login_resp
    var_value: {status: 0, body: null}
    loop:
      over: ["/engine", "/berta/engine", "/berta", ""]
      var: edir

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

  - id: login
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{edir}}/login.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: login_resp

  - id: upload-anon
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{edir}}/upload.php"
    condition: 'login_resp.status == 200 && type_of(login_resp.body) == "string" && ereg("xLoginForm", login_resp.body) && ereg("berta v", login_resp.body)'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: up_resp

  - id: check
    action: script
    code: |
      let lb = if type_of(login_resp.body) == "string" { login_resp.body } else { "" };
      let ub = if type_of(up_resp.body) == "string" { up_resp.body } else { "" };
      let ok = up_resp.status == 200
        && ereg("\"status\"\\s*:\\s*0", ub)
        && stridx(ub, "Wrong file type or size too big!") >= 0;
      let m = eregmatch("berta v ?([0-9][0-9a-z.]*)", lb);
      #{ ok: ok, found: if ok { "UPLOAD" } else { "" }, version: if m.len() > 1 { m[1] } else { "unknown" } }
    store_as: res

  - id: report
    action: match
    source: res.found
    pattern: "^UPLOAD$"
    condition: "res.ok"
    on_match:
      finding:
        title: "Berta CMS engine/upload.php reachable without authentication (CVE-2015-2780)"
        description: "The media upload handler of the Berta CMS admin engine answers an anonymous request without a session: an unauthenticated attacker can upload files to the site's media folder, including files whose names keep a script extension when they carry an image header, which can lead to code execution."
        remediation: "Upgrade Berta CMS to 0.8.10b or later, where engine/upload.php requires an authenticated session."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET {{edir}}/upload.php without a session returned the upload handler's JSON error (Berta {{res.version}} login page at {{edir}}/login.php); a fixed engine answers 401"
      stop: true

View these feeds on GitHub