Path Traversal Vulnerabilities in Icinga Web
Two path traversal vulnerabilities in Icinga Web allowed unauthenticated attackers to read arbitrary files and authenticated users to write files outside intended directories, potentially leading to remote code execution. Attackers could chain these to compromise the server by disclosing configuration files and then executing PHP code.
blog.sonarsource.com
Published on blog.sonarsource.com
Icinga is a modern, open-source IT monitoring system with a web interface. Thanks to its specialized scripting language, it is highly configurable and can run checks on virtually any IT equipment.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application constructed file paths from user input without properly sanitising directory traversal sequences, and later failed to validate that the resolved path stayed within the intended directory.
Impact
Attackers could read any file on the server, including sensitive configuration files and SSH keys, and could chain this with a file write vulnerability to execute arbitrary PHP code, leading to full server compromise.
What the attacker needed
Network access to the Icinga Web instance; For RCE: database reachable and credentials valid; For RCE: authenticated access (obtained via database)
The fix
The vulnerabilities were fixed by resolving the constructed path with realpath() and ensuring it remains under the expected directory, and by adding format validation to prevent file:// usage.
How it was found
- Send a request to a path under lib/ with directory traversal sequences to read arbitrary files.
- Use the disclosed configuration files to obtain database credentials.
- Access the database to change an administrator's password and gain authenticated access.
- As an authenticated user, edit an SSH key resource and set the user parameter to include directory traversal sequences.
- Craft a payload that starts with file://, includes a path to a valid PEM certificate, a NULL byte, and PHP code to write.
- Change the global_module_path setting to a writable directory and enable a module to execute the PHP code.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Path traversal is a flaw where an attacker can use special sequences like '../' to escape a restricted folder and access other files on the server. In Icinga Web, this let attackers read sensitive files such as configuration files containing database passwords, and later write malicious files that could be executed as code. This means an attacker could take full control of the monitoring server.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.