Remote Code Execution via path traversal bypass in lollms
The `/mount_extension` endpoint in lollms allowed path traversal because the `data.category` and `data.folder` parameters accepted empty strings, letting an attacker construct a `package_path` pointing to the root directory. If an attacker could place a `config.yaml` file in a controllable path, that path could be added to the extensions list and trigger execution of `__init__.py`, leading to remote code execution.
parisneo/lollms
Originally disclosed on huntr
CVE-2024-4320 describes a vulnerability in the parisneo/lollms software, specifically within the ExtensionBuilder().build_extension() function. The vulnerability arises from the /mount_extension endpoint, where a path traversal issue allows attackers to navigate beyond the intended directory structure. This is facilitated by the data.category and data.folder parameters accepting empty strings (""), which, due to inadequate input sanitization, can lead to the construction of a package_path that points to the root directory. Consequently, if an attacker can create a config.yaml file in a controllable path, this path can be appended to the extensions list and trigger the execution of __init__.py in the current directory, leading to remote code execution. The vulnerability affects versions from 5.9.0, and has been addressed in version 9.5.1.
From the GitHub Advisory Database (GHSA-mvrm-fh8q-6wr2, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely inadequate input sanitisation allowed empty `category` and `folder` values to produce a `package_path` that resolved to the root directory, enabling path traversal.
Impact
An attacker could achieve remote code execution if they can create a `config.yaml` file in a controllable path.
What the attacker needed
Ability to create a config.yaml in a controllable path
The fix
The vulnerability was fixed in version 9.5.1.
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 report has not been written yet. The Original tab links to the source.
Path traversal is when a program lets someone use special characters like `..` to escape the folder it is supposed to stay in. Here, empty values for two settings caused the software to build a file path that pointed to the root of the filesystem. If an attacker could also plant a small configuration file, the software would run code from that location, giving the attacker control of the server.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.