Exploiting Vulnerabilities In Llm Apis
The LLM API allowed calling a newsletter subscription function that passed the email parameter to an OS command without sanitisation. An attacker could inject shell commands via the email field, leading to remote code execution and deletion of a file.
Published on systemweakness.com
๐ Recon Insight: subscribetonewsletter is a juicy target โ newsletter functions are notorious for shelling out via CLI mail utils.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the newsletter subscription function passed the user-supplied email parameter directly to an OS command without sanitisation.
What the attacker needed
Access to the LLM chat interface
The fix
The newsletter function should sanitise the email parameter and avoid passing user input to OS commands.
How it was found
- Ask the LLM which APIs it can access.
- Ask the LLM what parameters the subscribe_to_newsletter API requires.
- Test a normal subscription with a controlled email address.
- Inject a command to check OS-level code execution.
- Inject a command to delete the target file.
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 write-up has not been written yet. The Original tab links to the source.
The chatbot could run a newsletter signup function that used the email address in a system command. Because the email wasn't cleaned, an attacker could sneak in extra commands that the computer would run, like deleting a file. 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.