检测php网站是否已经被攻破
from :http://www.gregfreeman.org/2013/how-to-tell-if-your-php-site-has-been-compromised/
http://drops.wooyun.org/web/2718
0x01 查看访问日志
PREMOVED - - [01/Mar/2013:06:16:48 -0600] "POST/uploads/monthly_10_2012/view.php HTTP/1.1" 200 36 "-" "Mozilla/5.0"
IPREMOVED - - [01/Mar/2013:06:12:58 -0600] "POST/public/style_images/master/profile/blog.php HTTP/1.1" 200 36 "-" "Mozilla/5.0"
nginx默认记录的日志格式为:
access_log logs/access.log
access_log logs/access.log combined;
nginx默认记录日志的位置为:
nginx安装目录/log/
0x02 查找含有恶意php代码的文件
2.1 查找最近发生变化的php文件
find . -type f -name '*.php' -mtime -7
-type f 表示搜索正常的一般文件 -mtime -7 表示7*24小时内修改的文件
2.2 查找文件中是否存在疑似代码
find . -type f -name '*.php' | xargs grep -l "eval *(" --color
(*代表任意个空格)
find . -type f -name '*.php' | xargs grep -l "base64_decode *(" --color
find . -type f -name '*.php' | xargs grep -l "gzinflate *(" --color
find . -type f -name '*.php' | xargs grep -l "eval *(str_rot13 *(base64_decode *(" --color
0x03 比较代码文件
diff -r wordpress-clean/ wordpress-compromised/ -x wp-content
上面的例子是比较wordpress-clean/ 和wordpress-comprised/两个目录,并且目录里面的wp-content/子目录不比较
0x04 搜寻可写的目录
看这个目录里面是否有可疑文件,如下脚本查找权限为777的目录是否存在php文件
search_dir=$(pwd)
writable_dirs=$(find $search_dir -type d -perm 0777)
for dir in $writable_dirs
do
#echo $dir
find $dir -type f -name '*.php'
done
黑客经常在jpg文件中插入php代码,因此在查询这些目录的时候也要查询jpg文件:
find wp-content/uploads -type f -iname '*.jpg' | xargs grep -i php
注意:-iname 表示文件名不区分大小写 grep -i 也表示不区分大小写
0x05 检测iframe标签
grep -i '
0x06 查找数据库中是否存在敏感字符串
包括%base64_%、%eval(%<等上面提到的一些关键词
0x07 检查.htaccess文件
是否包含了auto_prepend_file和auto_append_file,使用如下命令
find . -type f -name '\.htaccess' | xargs grep -i auto_prepend_file
find . -type f -name '\.htaccess' | xargs grep -i auto_append_file
检测php网站是否已经被攻破的更多相关文章
- 检测php网站是否已经被攻破的方法
0x01 查看访问日志 看是否有文件上传操作(POST方法), IPREMOVED - - [01/Mar/2013:06:16:48 -0600] "POST/uploads/monthl ...
- regular expression 在线检测的网站
http://regexone.com/ 学习网站 http://regexone.com/lesson/optional_characters? http://regexone.com/less ...
- 使用Charles检测HTTPS网站的数据包
1.下载Charles 下载地址:https://www.charlesproxy.com/download/ 2.安装Charles的证书 选择Help->SSL Proxying->I ...
- 【工作】Proxy Server的优化 - 检测目标网站URL变化
在工作中,我在组里负责一个Proxy(代理)的Module,这个Module是针对微软的Office 365的邮件门户OWA实现,工作起来后,用户访问Office 365 OWA,无需再输入Offic ...
- 一、IIS性能检测与网站管理
一.性能监视器 1.Windows Server自带的性能监视器.(开始 运行 perfmon ) 另一种方式打开 Performance Monitor 点击Windows+R,在Run中输入per ...
- 360在线网站安全检测,web安全测试AppScan扫描工具,XSS常用的攻击手法
360在线网站安全检测,web安全测试AppScan扫描工具,XSS常用的攻击手法 如何做好网站的安全性测试 360网站安全检测 - 在线安全检测,网站漏洞修复,网站后门检测http://websca ...
- Chrome好用的插件:Wappalyzer 检测网站使用的技术
Chrome好用的插件:Wappalyzer 检测网站使用的技术 Wappalyzer是一款能够分析目标网站所采用的平台架构.网站环境.服务器配置环境.javascript框架.编程语言等参数的chr ...
- C#重启IIS指定网站和指定应用程序池
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 从TP、FP、TN、FN到ROC曲线、miss rate、行人检测评估
从TP.FP.TN.FN到ROC曲线.miss rate.行人检测评估 想要在行人检测的evaluation阶段要计算miss rate,就要从True Positive Rate讲起:miss ra ...
随机推荐
- HD OJ2023
#include "stdio.h"double stu[60],cla[10];int a[60][60];int main(){ int n,m,i,number,j; whi ...
- (spring-第16回【AOP基础篇】)基本概念
AOP(Aspect Oriented Programing),面向切面方程.介绍具体定义前,先看一个例子: package com.baobaotao.concept; public class F ...
- 关于offer选择
6月1日收到移动调剂到昭通移动的电话,当时第一反应就是拒绝,后来参考了很久,犹豫了很久,答应了hr:答应了就有点后悔了:各种挑刺为难Hr;6月2日上午回绝hr: 问:陈姐,我有件重要的事忘记问了,在昭 ...
- "This connection is untrusted" - Firefox error message
Error Messages I am receiving the following error message in Firefox: After selecting Cancel to clos ...
- Redis - 密码配置和主从复制
使用config set命令修改requirepass参数配置Redis密码config set requirepass password 也可以通过配置文件修改密码,重启后生效. 克隆虚拟机,分别运 ...
- Extjs学习笔记(-):ComboBox联动
http://www.cnblogs.com/wumin97136/archive/2007/12/24/1012720.html http://examples.ext.net/ http://ex ...
- Magento的价格去掉小数点
Magento的默认情况,价格后面是有小数点的,我们来看下如何正确的来去掉小数点. 1.复制如下路径的文件 app/code/core/Mage/Directory/Model/Currency.ph ...
- 第一个Sprint冲刺第四天
讨论成员:邵家文.李新.朱浩龙.陈俊金 讨论问题:掌握计时技术的知识 讨论地点:qq网络 进展:即将开始对计时技术代码的编写
- cmd命令进行RSA 密钥加密操作
--参考 http://msdn.microsoft.com/zh-cn/library/2w117ede http://msdn.microsoft.com/zh-cn/library/yxw286 ...
- hdu 4252 A Famous City
题意:一张相片上的很多建筑相互遮住了,根据高低不同就在相片上把一座高楼的可见部分作为一个矩形,并用数字描述其高度,若一张相片上的两个建筑群中间有空地,高度则为0;求最少有多少个建筑; 分析: 输入的0 ...