Skip to content
RCE Disclosed report Advanced CVE-2024-6982

LoLLMS Code Injection vulnerability

The Calculate function in LoLLMS used Python's eval() inside a sandbox that disabled builtins and only allowed math functions. An attacker could bypass the sandbox by loading the os module through _frozen_importlib.BuiltinImporter and run arbitrary commands on the server.

parisneo/lollms

Originally disclosed on huntr

A remote code execution vulnerability exists in the Calculate function of parisneo/lollms version 9.8. The vulnerability arises from the use of Python's eval() function to evaluate mathematical expressions within a Python sandbox that disables __builtins__ and only allows functions from the math module. This sandbox can be bypassed by loading the os module using the _frozen_importlib.BuiltinImporter class, allowing an attacker to execute arbitrary commands on the server. The issue is fixed in version 9.10.

From the GitHub Advisory Database (GHSA-jccx-m9v4-9hwh, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

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 the sandbox relied on removing builtins and restricting imports, but the import machinery itself remained reachable, so a module could still be loaded.

Impact

An attacker could execute arbitrary commands on the server, leading to full remote code execution.

What the attacker needed

Access to the Calculate function

The fix

The issue was fixed in version 9.10.

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.

The program tried to run small maths calculations safely by using a Python feature that evaluates code, but it left a way to import a system module. That let an attacker run their own commands on the server, not just do maths.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from parisneo/lollms

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.