How an Unsanitized EXIF Metadata Parser Led to Command Injection
A media storage platform passed the EXIF Comment tag from uploaded avatars into a shell command without escaping, so shell substitution syntax in the tag ran as the background worker. An attacker could run arbitrary commands on the worker host and send the output to an external server.
When building media-heavy web applications, developers frequently rely on background image processing utilities (such as ImageMagick, FFmpeg, or ExifTool) to strip metadata, resize thumbnails, or optimize file sizes upon upload. Because image processing is computationally heavy, it is typically passed off to…
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
The worker built a shell command by concatenating the user-controlled EXIF Comment value into a string passed to a shell, so shell substitution syntax was evaluated.
Impact
An attacker could execute arbitrary system commands as the worker, inspect internal services, extract environment credentials and pivot across the host; the worker also belonged to the sudo group.
What the attacker needed
A user account able to upload an avatar; ability to craft an image with a chosen EXIF tag; an external server to receive callbacks
The fix
The team replaced shell string concatenation with safe process APIs using array arguments, isolated workers in unprivileged read-only containers without outbound access, and sanitised uploads with native image libraries instead of shell utilities.
How it was found
- Upload an avatar and note the 202 response showing background processing
- Embed a command substitution payload into the EXIF Comment tag of a test image
- Upload the modified image and watch an external listener for a callback
- Use a payload that writes command output to a file, then a second payload that sends that file out
- Observe the returned output showing the worker's user and groups
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.
When you upload a photo, hidden data called EXIF is stored inside the file, such as camera model or a comment. This site read that comment and pasted it into a command it ran on its server, so text in the photo could make the server run extra commands. The tester proved this by making the server fetch a URL they controlled.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.