> For the complete documentation index, see [llms.txt](https://0xpthree.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xpthree.gitbook.io/notes/network-services/ports/80-443-http-s/web-vulnerabilities/upload-bypass.md).

# Upload bypass

## Magic byte + mime type + extension

Confirm that we’re able to upload PDF files:&#x20;

<figure><img src="/files/SRBrn3i76fsntH0zZBPw" alt=""><figcaption></figcaption></figure>

We are not able to bypass the restriction by changing MIME type and/or file extension:&#x20;

<figure><img src="/files/41mL7eVKGRxc7K7nZm3h" alt=""><figcaption></figcaption></figure>

Bypass by adding `%PDF-1.5` at the start of our payload, changing extension to `.pdf.php` and MIME type to `application/pdf`:&#x20;

<figure><img src="/files/1gg3oe5SK13CVxWjiy2M" alt=""><figcaption></figcaption></figure>
