2. 入侵溯源策略
(1)日志分析三板斧
① 排查最近30天被修改的PHP文件:
find ./ -type f -name "*.php" -mtime -30 -exec ls -l {} \;
② 分析access_log异常请求:
grep -E '(php\?|base64_decode|eval\(|wget|curl)' /path/to/access_log
③ 数据库注入特征筛查:
mysqldump | grep -iE '(union\s+select|sleep\(|benchmark\()'
3. 权限管控规范
(1)动态权限策略
- 运行时权限(通过.htaccess实现):
<FilesMatch "\.(php|pl|py|jsp)$">
Order Deny,Allow
Deny from all
</FilesMatch>
<FilesMatch "^(index|portal|forum)\.php$">
Allow from all
</FilesMatch>