Skip to content
RCE Write-up Intermediate

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.

Aditya Bhatt Follow

Published on systemweakness.com

๐Ÿ‘€ Recon Insight: subscribetonewsletter is a juicy target โ€” newsletter functions are notorious for shelling out via CLI mail utils.

Aditya Bhatt, on systemweakness.com

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

  1. Ask the LLM which APIs it can access.
  2. Ask the LLM what parameters the subscribe_to_newsletter API requires.
  3. Test a normal subscription with a controlled email address.
  4. Inject a command to check OS-level code execution.
  5. 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.

More by Aditya Bhatt

View all

25 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.