Skip to content
RCE Write-up Intermediate

Episode 7: Server-Side Includes Injection — The Quiet Danger Lurking in Legacy Code

A guestbook page stored user comments in .shtml files that the server parsed for Server-Side Includes (SSI) directives. An attacker could inject SSI directives to execute shell commands on the server and view the output.

Yamini Yadav_369 Follow

Published on infosecwriteups.com

Hello everyone, I hope you’re doing well and staying curious. Welcome back to my Medium series, The Injection Chronicles.

Yamini Yadav_369, on infosecwriteups.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 application wrote raw user input into .shtml files that the server parsed for SSI directives, without escaping or disabling SSI.

Impact

An attacker could execute arbitrary shell commands on the server, potentially reading sensitive files, deleting or overwriting files, and pivoting to other systems.

What the attacker needed

Server parses .shtml files for SSI; user input is stored in a parsed file; no authentication needed

The fix

SSI should be disabled if not needed, and user input should never be written raw into files that are parsed for SSI directives; input should be escaped or stored as plain text.

How it was found

  1. Find a page that saves user input to a .shtml file, such as a guestbook.
  2. Submit a comment containing an SSI echo directive.
  3. Reload the guestbook page and see the server's local date and time displayed.
  4. Submit a comment containing an SSI exec directive to run a command.
  5. Reload the page and see the command output (e.g., the current user) in the response.

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.

Server-Side Includes (SSI) let a web server insert extra content into a page before sending it to you. If a site saves what you type into a file that the server treats as SSI, you can sneak in special instructions that the server runs as commands. This report shows a guestbook where comments were saved that way, so a comment could make the server run a command and show the result.

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 Yamini Yadav_369

View all

13 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.