Skip to content

Incorrect limitation of a pathname to a restricted directory (Path Traversal) (CWE-22)

Moderate
sni published GHSA-4mrh-mx7x-rqjx Jan 28, 2024

Package

No package listed

Affected versions

<=3.08

Patched versions

>=3.12

Description

Summary

The Thruk web monitoring application presents a vulnerability in a file upload form that allows a threat actor to arbitrarily upload files to the server to any path they desire and have permissions for. This vulnerability is known as Path Traversal or Directory Traversal.

Details

PoC

Within the Thruk web monitoring application, when logging in with any user, there was an area where one could upload a file, so that it would be used as a background within the generated dashboards.
The following image shows the normal file upload flow, where it can be observed that the files were uploaded to the "backgrounds/" folder by default.

Screenshot 2024-01-25 at 13 27 16

Initially, it was verified that there were no write permissions in this folder, as the error returned confirmed that the file upload had not been successful.
However, by manipulating the folder path to "backgrounds/../../../../tmp/", it was observed that the server returned a successful message, confirming the file upload.

Screenshot 2024-01-25 at 13 28 22

This folder was chosen because it is present in every GNU Linux-based system and is normally modifiable by any user, thus demonstrating the vulnerability.

Impact

A threat actor, by exploiting this security flaw, could arbitrarily upload files to the server and manage to overwrite existing files on the server, thus affecting the integrity of the environment.
In the case of overwriting images or other resources of the application, they could deface the site.
Additionally, a threat actor could upload files in an automated manner until filling up the server's disk, which would cause unavailability in the system.
In many cases, this could extend to the point where a threat actor uploads a webshell and can execute arbitrary commands on the server.

###Countermeasure
Sanitize (validate) user inputs to prevent dangerous characters such as the dot (.) and slash (/).

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Adjacent
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L

CVE ID

CVE-2024-23822

Weaknesses

No CWEs

Credits