> For the complete documentation index, see [llms.txt](https://capcap-1.gitbook.io/capcap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capcap-1.gitbook.io/capcap/readme/ctf-modules/vulnerability-assessment/shells-and-payloads/web-shells/php-web-shells.md).

# PHP Web Shells

<https://github.com/WhiteWinterWolf/wwwolf-php-webshell>

####

#### 1. The Strategy: PHP Web Shells

* The Landscape: PHP powers nearly 80% of websites. If you see `.php` in the URL or headers (like Apache/PHP on CentOS), it is a prime target for a PHP-based web shell.
* The Goal: Upload a malicious `.php` script (like WhiteWinterWolf's web shell). Because the server processes PHP server-side, navigating to the uploaded file executes your OS commands.

#### 2. File Upload Bypass Workflow (Burp Suite)

When an application restricts uploads to images only (e.g., a "Vendor Logo" upload feature), you can often bypass the filter by manipulating the HTTP request in transit.

| **Step**              | **Action**            | **Detail / Execution**                                                                                       |
| --------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------ |
| 1. Proxy Setup        | Configure Browser     | Route browser traffic through Burp Suite (`127.0.0.1:8080`). Ensure intercept is ON.                         |
| 2. Upload Payload     | Select `.php` file    | Attempt to upload your PHP web shell via the web interface.                                                  |
| 3. Intercept & Modify | Change `Content-Type` | In Burp, locate the POST request. Change `Content-Type: application/x-php` to `Content-Type: image/gif`.     |
| 4. Forward            | Send Request          | Forward the modified packet. The server reads `image/gif`, assumes it is safe, and saves your `.php` file.   |
| 5. Execute            | Navigate to Path      | Browse to the upload directory (e.g., `/images/vendor/shell.php`). The browser acts as your command console. |


---

# 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://capcap-1.gitbook.io/capcap/readme/ctf-modules/vulnerability-assessment/shells-and-payloads/web-shells/php-web-shells.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.
