> For the complete documentation index, see [llms.txt](https://www.webhackingtips.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.webhackingtips.com/week-49-file-upload-bypass.md).

# Week 49 - File Upload Bypass

Looking for another way of exploiting PHP file uploads?\
&#x20;\
Say the application properly blocks all attempts at uploading PHP files (.php, .php4, .php5, etc). If you are lucky enough to find an application that stores file uploads in the web root (e.g. /var/www/html/file.txt) try uploading a file named .htaccess containing the following:\
&#x20;\
`AddType application/x-httpd-php .cth`\
&#x20;\
Now .cth files will execute as .php and you can successfully bypass PHP upload restrictions!\
\
This works because .htaccess is a file stored in the web root that controls high-level server configurations, like URL redirection and file rendering.\
&#x20;\
Shoutout to [John H.](https://www.linkedin.com/in/ACoAABLPqDIBHtjgo8d_MxPO3MdoBXc2VW_WfEk) and alh4zr3d for this one

![](/files/sQRABrCkDb2jY5pvlndX)


---

# 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:

```
GET https://www.webhackingtips.com/week-49-file-upload-bypass.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
