martirspe/magsecure
GitHub: martirspe/magsecure
MagSecure 是一个面向 Magento 2 的开源安全框架,提供恶意软件检测、取证分析、事件响应分诊和安全硬化能力。
Stars: 0 | Forks: 0
# MagSecure
用于 Magento 2 恶意软件检测、取证分析、事件响应和强化的专业开源框架。
**状态:** v0.2.0 — **可用于生产环境的事件分诊**(扫描 + 日志 + 隔离 + 报告)。
其余模块详见 [docs/roadmap.md](docs/roadmap.md)。
## 环境要求
- Python 3.12+
- 生产环境的事件响应 (IR) 推荐使用 Linux(Ubuntu 22.04+ / Debian 12);开发环境也可在 Windows 上运行
- 可选的 Bash 启动器 (`magsecure.sh`)
- 可选:`pip install 'magsecure[db]'` / `pip install 'magsecure[yara]'`
## 快速开始(生产环境分诊)
```
cd magsecure
python3 -m venv .venv
source .venv/bin/activate # Windows: .\.venv\Scripts\Activate.ps1
pip install -e ".[dev]"
# 完整分拣扫描(写入 reports/report.json + reports/report.html)
magsecure scan --target /var/www/html
# 推荐 IR profile:检测 + 日志(仅在打算进行隔离时才执行隔离)
magsecure scan --target /var/www/html \
--plugins environment_audit \
--plugins magento_audit \
--plugins file_integrity \
--plugins webshell_detection \
--plugins php_ast_analyzer \
--plugins obfuscation_detection \
--plugins yara_engine \
--plugins database_scanner \
--plugins log_forensics
# 隔离:移动 HIGH/CRITICAL 文件发现(从不删除)
magsecure scan --target /var/www/html --quarantine --quarantine-min-severity HIGH
```
报告:
- `reports/report.json` — 支持 SIEM(Splunk / Elastic / Wazuh / Grafana)
- `reports/report.html` — 运维人员仪表板(风险、图表、时间线、IOC、发现)
- `quarantine/` — 转移的文件 + `manifest.jsonl` + `.meta.json` 附带文件
## 架构
请参阅 [docs/architecture.md](docs/architecture.md) 和 [docs/production.md](docs/production.md)。
## 已实现的插件
| # | 插件 | 用途 |
|---|--------|---------|
| 1 | `environment_audit` | 主机栈清单 |
| 2 | `magento_audit` | Magento 版本/模式/模块/CVE |
| 3 | `file_integrity` | SHA256 基准差异对比 |
| 4 | `webshell_detection` | 启发式 PHP 风险评分 |
| 5 | `php_ast_analyzer` | 结构化 PHP 分析 |
| 6 | `obfuscation_detection` | 熵 + 解码器链 |
| 7 | `yara_engine` | YARA / 指标后备 |
| 8 | `database_scanner` | Magento 数据库内容恶意软件 |
| 9 | `log_forensics` | 时间线 + 初始向量假设 |
| — | 隔离 + 报告 | 内置于 CLI(`--quarantine`,自动生成 HTML/JSON) |
## 下一阶段
请参阅 **[docs/roadmap.md](docs/roadmap.md)** 了解模块 10–20 和强化积压任务。
## 许可证
MIT
标签:AMSI绕过, DAST, DNS 反向解析, Magento, Python, 威胁检测, 子域名变形, 库, 应急响应, 应用安全, 恶意软件分析, 数字取证, 无后门, 自动化脚本, 自定义DNS解析器, 逆向工具