PHPackages                             erikwang2013/security-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. erikwang2013/security-php

ActiveLibrary[Security](/categories/security)

erikwang2013/security-php
=========================

A PHP security attack detection plugin featuring 27 threat detectors and compatibility with Laravel, Webman, ThinkPHP, and Hyperf.

v1.1.0(2w ago)1109↑175.2%MITPHPPHP &gt;=8.1

Since May 21Pushed 2w agoCompare

[ Source](https://github.com/erikwang2013/security-php)[ Packagist](https://packagist.org/packages/erikwang2013/security-php)[ RSS](/packages/erikwang2013-security-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Security PHP
============

[](#security-php)

> [English Documentation](README_EN.md)

基于 PHP 的安全攻击检测插件，支持 31 种攻击类型检测，兼容 Laravel、Webman、ThinkPHP、Hyperf 框架。

Copyright (c) 2026 erik  —

---

项目说明
----

[](#项目说明)

Security PHP 是一个轻量级 PHP 安全中间件，通过正则模式匹配和结构分析检测常见的 Web 攻击载荷。每个检测器独立可配置（启用/禁用 + 拦截/日志模式），支持 IP 白名单（含 IPv4/IPv6 CIDR）、IP 攻击升级黑名单（5次/60s → 封禁15分钟）、字段白名单、日志轮转和去重。检测器可返回自定义 HTTP 状态码（405/413/415 等）。持久化数据支持 File/Redis/Cache 三种存储后端，可按需切换。

### 支持的攻击类型

[](#支持的攻击类型)

#### 注入类攻击

[](#注入类攻击)

检测器说明`xss`XSS 跨站脚本 — ``、事件处理器 `on[a-z]+=`、SVG/CSS 注入、`javascript:` URI`sql_injection`SQL 注入 — UNION SELECT（含 `/**/`、`(` 绕过）、sleep/benchmark/pg\_sleep、布尔盲注、schema 枚举、存储过程执行`command_injection`命令注入 — 反引号、`$()`、管道符、`/dev/tcp`、PHP 代码执行函数、链式执行`nosql_injection`NoSQL 注入 — MongoDB `$ne`/`$gt`/`$regex`/`$where` 操作符、认证绕过`ldap_injection`LDAP 注入 — 过滤操作符 `(`xpath_injection`XPATH 注入 — 布尔绕过 `1=1`、``jndi_injection`JNDI/Log4Shell — `${jndi:ldap://`、`${lower:j}` 混淆、`${env:}` 环境变量查找`ssi_injection`SSI 服务端包含 — `
