> 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="https://2314265932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLZ9hPT4FtAP57VrTApYv%2Fuploads%2Fo0bhgrWFV6ImO8mnXP9i%2Fimage.png?alt=media&amp;token=6e23db7b-2913-4697-8b57-d779f8e810aa" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2314265932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLZ9hPT4FtAP57VrTApYv%2Fuploads%2FjQex7OlryW8kpfB7JyY6%2Fimage.png?alt=media&amp;token=2baa12b2-fecd-4c53-84c7-b5227979d033" 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="https://2314265932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLZ9hPT4FtAP57VrTApYv%2Fuploads%2Fpu4flJoDDEObk372hRkQ%2Fimage.png?alt=media&amp;token=36424136-13dd-4557-ba45-031a84d2368e" alt=""><figcaption></figcaption></figure>
