LocalAI Command Injection in audioToWav
The audio transcription endpoint passed user-supplied filenames to ffmpeg through a shell without sanitisation, so an attacker could inject shell commands. Successful exploitation could run arbitrary commands on the host with the privileges of the LocalAI process.
mudler/localai
Originally disclosed on huntr
A command injection vulnerability exists in the TranscriptEndpoint of mudler/localai, specifically within the audioToWav function used for converting audio files to WAV format for transcription. The vulnerability arises due to the lack of sanitization of user-supplied filenames before passing them to ffmpeg via a shell command, allowing an attacker to execute arbitrary commands on the host system. Successful exploitation could lead to unauthorized access, data breaches, or other detrimental impacts, depending on the privileges of the process executing the code.
From the GitHub Advisory Database (GHSA-wx43-g55g-2jf4, CC BY 4.0).
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
Impact
An attacker could execute arbitrary commands on the host, which could lead to unauthorised access or data breaches depending on the privileges of the process.
What the attacker needed
Access to the transcription endpoint; ability to supply a filename
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.
When a program builds a command line by gluing together text from a user, special characters in that text can be interpreted by the shell as extra commands. Here the filename was not cleaned before being handed to ffmpeg, so a crafted filename could make the server run the attacker's commands. This is called command injection.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.