Snipe Gallery — 1 vulnerability check

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

← All products · Feeds on GitHub

Snipe Gallery cfg_admin_path remote file inclusion

CVECVE-2010-2126
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 70
Feedtests/vulnerabilities/snipe-gallery/CVE-2010-2126.yaml

Snipe Gallery 3.1.4 and 3.1.5 (a PHP/MySQL image gallery) are reported to include PHP files from a path given by the cfg_admin_path request parameter in index.php, view.php, image.php, search.php and several admin/ gallery pages, which would let an unauthenticated attacker run arbitrary PHP code from a remote URL. No fixed release exists.

This check requests index.php (the gallery list) in the web root and the usual install directories (/snipegallery, /gallery, /demo). It reads the Snipe Gallery version from the page heading ("Snipe Gallery v.3.1.5 - Galleries") or from the snipegallery.com link in the page footer, and reports versions 3.1.4 and 3.1.5. The finding rests on the version alone, as no exploit request is sent; only ordinary page requests are made.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/index.php
  2. Parses / computes the next value with a Rhai script
  3. Checks hit.ver for ^3\.1\.[45]$ → finding QoD 70: Snipe Gallery 3.1.4 / 3.1.5 cfg_admin_path remote file inclusion (version)

References:

Feed source — tests/vulnerabilities/snipe-gallery/CVE-2010-2126.yaml
# Snipe Gallery 3.1.4 / 3.1.5 cfg_admin_path remote file inclusion — CVE-2010-2126
#
# The advisory (EDB-34016/34017, BID 40279) reports that index.php, view.php, image.php,
# search.php and the admin/ gallery pages include "$cfg_admin_path/lib/..." with
# cfg_admin_path taken from the request (register_globals). No benign behavioural proof
# exists: in the shipped 3.1.4 and 3.1.5 code (SourceForge snipegallery zips, the last
# releases) every one of those scripts first includes inc/config.php, which assigns
# $cfg_admin_path = $cfg_app_path . '/admin' unconditionally, so a request value is
# overwritten before the include runs. A cfg_admin_path probe therefore never fires on a
# stock install, and this feed reports the affected versions from the version banner, as
# the reference check does (QoD 70).
#
# Version source: inc/config.php sets $cfg_program_version = "v.3.1.5" ("v.3.1.4" in
# 3.1.4, "v.3.1.3" in 3.1.3), and layout/header.php prints it on the gallery list
# (index.php) as
#   <span class="heading">Snipe Gallery v.3.1.5  - Galleries</span>
# with layout/footer.php adding "<a href="http://www.snipegallery.com" ...>Snipe Gallery
# \n\t\tv.3.1.5</a>". No later release exists (3.1.5 is the last one), so both versions
# are reported.
#
# Better than the reference check:
#   - the version is also read from the footer link when the heading is customised;
#   - the product markup (heading span or snipegallery.com footer link) is required, so a
#     page merely mentioning "Snipe Gallery v.3.1.5" in its text is not reported;
#   - /gallery and /demo (the install directory assumed by the shipped config.php) are
#     probed besides the web root and /snipegallery.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_snipegallery_remote_file_include_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801218, GPL-2.0-only) and gb_snipegallery_detect.nasl.
uid: fb230ba7-03b3-4e2b-ada4-9edefc2edeab
name: "Snipe Gallery cfg_admin_path remote file inclusion (CVE-2010-2126)"
description: |
  Snipe Gallery 3.1.4 and 3.1.5 (a PHP/MySQL image gallery) are reported to include
  PHP files from a path given by the cfg_admin_path request parameter in index.php,
  view.php, image.php, search.php and several admin/ gallery pages, which would let an
  unauthenticated attacker run arbitrary PHP code from a remote URL. No fixed release
  exists.

  This check requests index.php (the gallery list) in the web root and the usual
  install directories (/snipegallery, /gallery, /demo). It reads the Snipe Gallery
  version from the page heading ("Snipe Gallery v.3.1.5 - Galleries") or from the
  snipegallery.com link in the page footer, and reports versions 3.1.4 and 3.1.5. The
  finding rests on the version alone, as no exploit request is sent; only ordinary page
  requests are made.
cves: [CVE-2010-2126]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [snipe-gallery, php, rfi, version-check, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-2126"
  - "https://www.exploit-db.com/exploits/34016"
  - "https://www.exploit-db.com/exploits/34017"
  - "http://www.securityfocus.com/bid/40279"
  - "https://sourceforge.net/projects/snipegallery/"
  # OpenVAS/Greenbone NASL 2010/gb_snipegallery_remote_file_include_vuln.nasl (GPL-2.0-only)

steps:
  - id: init-hit
    action: set_var
    var_name: hit
    var_value: {dir: "", ver: "", src: ""}

  # Loop group: every following step runs once per candidate directory. Pre-initialise
  # the stored reply so a failed request never leaves the previous directory's page.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/snipegallery", "/gallery", "/demo"]

  - id: fetch-index
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: 'hit.ver == ""'
    store_as: page

  - id: parse-version
    action: script
    condition: 'hit.ver == ""'
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      let ver = "";
      let src = "";
      if page.status == 200 {
        let h = eregmatch("class=\"heading\">Snipe Gallery v\\.([0-9]+\\.[0-9][0-9.]*) +- ", b);
        if type_of(h) == "array" && h.len() > 1 {
          ver = h[1];
          src = "page heading";
        } else {
          let f = eregmatch("href=\"https?://(www\\.)?snipegallery\\.com/?\"[^>]*>Snipe Gallery\\s+v\\.([0-9]+\\.[0-9][0-9.]*)</a>", b);
          if type_of(f) == "array" && f.len() > 2 {
            ver = f[2];
            src = "footer link";
          }
        }
      }
      if ver != "" {
        #{ dir: dir + "/", ver: ver, src: src }
      } else {
        hit
      }
    store_as: hit

  - id: version-affected
    action: match
    source: hit.ver
    pattern: "^3\\.1\\.[45]$"
    condition: 'hit.ver != ""'
    on_match:
      finding:
        cves: [CVE-2010-2126]
        title: "Snipe Gallery 3.1.4 / 3.1.5 cfg_admin_path remote file inclusion (version)"
        description: "The site runs Snipe Gallery 3.1.4 or 3.1.5, versions reported to include PHP files from a path given by the cfg_admin_path request parameter (index.php, view.php, image.php, search.php, admin/ gallery pages), allowing remote code execution through a remote file inclusion. This finding rests on the version shown by the application."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{hit.dir}}index.php (gallery list) shows Snipe Gallery version {{hit.ver}} in its {{hit.src}}."
        remediation: "Snipe Gallery is no longer maintained and no fixed release exists: replace it with a maintained gallery application, or at least run PHP with register_globals and allow_url_include disabled and restrict access to the gallery's admin/ directory."
      stop: true

View these feeds on GitHub