I noticed that it's possible to run a file via PHP even if its extension wasn't .php
, for example file test.xyz.php.whatever.zyx
can be still run with PHP even when the extension isn't .php
! It just happens to have .php.
in the filename, and that's enough for my Apache to run the PHP script.
I tried (as someone suggested) to put this in a .htaccess
file on that folder:
php_flag engine off
But it didn't work on my machine.
The only solutions I know for now are:
.txt
.But I'm still not sure how these solutions would work on other servers than my Windows server (with Apache).
Is there any other solutions which doesn't need the filenames to be renamed in any way?
for uploading by users I suggest that you upload a folder in a layer above the root path in this case Only You Have Access To upload folder( In direct addressing) and an attacker have not access to any files in this folder Thus you disable an attacker action to run malicious file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With