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
4.6
/ 10

CVSS base metrics

Attack vector
Adjacent
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low
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