CVE-2024-5181

9.8 CRITICAL

📋 TL;DR

A command injection vulnerability in mudler/localai version 2.14.0 allows attackers to execute arbitrary system commands by manipulating the backend parameter in configuration files. This can lead to complete system compromise. Organizations using the vulnerable version of LocalAI are affected.

💻 Affected Systems

Products:
  • mudler/localai
Versions: 2.14.0
Operating Systems: All platforms running LocalAI
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists when using configuration files with backend parameter manipulation.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with root/admin privileges, data exfiltration, ransomware deployment, and persistent backdoor installation.

🟠

Likely Case

Unauthorized command execution leading to data theft, service disruption, and lateral movement within the network.

🟢

If Mitigated

Limited impact with proper network segmentation, minimal privileges, and monitoring in place.

🌐 Internet-Facing: HIGH - Internet-facing instances can be directly exploited without authentication.
🏢 Internal Only: HIGH - Internal instances remain vulnerable to insider threats or compromised internal systems.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires access to modify configuration files or supply malicious backend parameter values.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after commit 1a3dedece06cab1acc3332055d285ac540a47f0e

Vendor Advisory: https://github.com/mudler/localai/commit/1a3dedece06cab1acc3332055d285ac540a47f0e

Restart Required: Yes

Instructions:

1. Update LocalAI to latest version. 2. Replace vulnerable 2.14.0 installation. 3. Restart all LocalAI services. 4. Validate configuration files don't contain malicious backend parameters.

🔧 Temporary Workarounds

Restrict Configuration File Access

linux

Limit write access to LocalAI configuration files to prevent backend parameter manipulation.

chmod 644 /path/to/localai/config/*
chown root:root /path/to/localai/config/*

Network Segmentation

all

Isolate LocalAI instances in restricted network segments to limit attack surface.

🧯 If You Can't Patch

  • Implement strict input validation for backend parameter values
  • Run LocalAI with minimal privileges using non-root user accounts

🔍 How to Verify

Check if Vulnerable:

Check if running LocalAI version 2.14.0 by examining version in configuration or running binary.

Check Version:

localai --version or check package manager for installed version

Verify Fix Applied:

Confirm version is updated beyond commit 1a3dedece06cab1acc3332055d285ac540a47f0e and test backend parameter validation.

📡 Detection & Monitoring

Log Indicators:

  • Unusual process names in system logs
  • Unexpected command execution from LocalAI process
  • Configuration file modification alerts

Network Indicators:

  • Unexpected outbound connections from LocalAI host
  • Command and control traffic patterns

SIEM Query:

process_name:localai AND (command_line:*;* OR command_line:*&* OR command_line:*|*)

🔗 References

📤 Share & Export