Files
ServerStack/docs/security_audit_backdoor_2026-07-17.md
T
condor 679e0b4184 init
2026-07-24 18:54:53 +08:00

71 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ServerStack 脚本后门专项审计报告
- 审计日期:2026-07-17
- 审计对象:`E:\Desktop\ServerStack`83 个 .sh 脚本 + .py / .exp / .conf / .service 等配套文件)
- 审计方式:针对后门典型特征做定向扫描(grep + 人工阅读命中上下文),区分"正常拉取官方源码"与"可疑外连/执行"
- **结论:未发现任何后门(无隐藏外连、反弹 shell、混淆执行、持久化、提权或 SSH 后门)。**
---
## 一、已核查的后门特征类别与结果
| # | 检查项 | 命中情况 | 判定 |
|---|--------|----------|------|
| 1 | 网络外连 / 远程下载执行(curl/wget/nc/socat/telnet | 全部为下载官方软件包 | 正常 |
| 2 | 反弹 shell/dev/tcp、bash -i、nc -e、mkfifo | 0 命中 | 干净 |
| 3 | 混淆 / 解码执行(base64 -d、xxd -r、openssl enc、滥用 eval | 仅 `eval set --`(getopt 解析) 与生成随机密钥的 base64 | 正常 |
| 4 | pipe-to-shell(下载输出直接 `\| bash`/`\| sh`) | 2 处:mongo 建用户命令、PHP 升级重建 configure | 正常 |
| 5 | 持久化(cron、systemctl enable、rc.local、/etc/profile.d、@reboot | ntpdate 校时 cron、fail2ban 自启、profile.d 环境变量 | 正常 |
| 6 | 提权(useradd、chmod 777、SUID、NOPASSWD sudo、LD_PRELOAD | 0 命中(SUID/sudo 全空) | 干净 |
| 7 | SSH 后门(注入 authorized_keys、改 sshd_config | 仅改 SSH 端口(用户选项)、清理 known_hosts | 正常 |
| 8 | 自启隐藏(nohup、setsid、disown、/tmp 落盘执行) | 0 命中(/dev/shm 均为 PHP-FPM socket 路径) | 干净 |
| 9 | 下载源域名白名单 | 全部为官方/主流镜像(见下) | 正常 |
| 10 | IP 探测脚本是否回传数据 | 仅 GET 本机公网 IP,无数据外发 | 正常 |
| 11 | 主流程隐藏钩子(loader/workflow/menu/installer/init | 仅安装 wget/curl 软件包 | 正常 |
| 12 | 备份脚本硬编码凭据 | 全部交互式 `read -p` 输入 | 正常 |
---
## 二、下载源域名白名单(全部可信)
- 项目站:`oneinstack.com``github.com/oneinstack``linuxeye.com``mirrors.linuxeye.com`
- 数据库官方源:`cdn.mysql.com``repo.huaweicloud.com``mirrors.tuna.tsinghua.edu.cn``mirrors.dotsrc.org``archive.mariadb.org``ftp.postgresql.org``ftp.heanet.ie``fastdl.mongodb.org`
- Web/PHP`nginx.org``php.net`/`secure.php.net``pecl.php.net``pear.php.net``getcomposer.org`/`mirrors.aliyun.com``downloads.sourceforge.net``nodejs.org``www.openssl.org``downloads.ioncube.com``download.pureftpd.org`
- 备份工具(用户主动启用):`gosspublic.alicdn.com`(阿里云OSS)、`devtools.qiniu.com`(七牛)、`collection.b0.upaiyun.com`(又拍)、`mirrors.linuxeye.com`(Dropbox 客户端 dbxcli)
- IP 归属探测(仅用于国内/国外镜像分流):`ip-api.com``ipv4.icanhazip.com``pv.sohu.com`
- README 链接:`img.shields.io``t.me``paypal.me`(非脚本执行)
---
## 三、双用工具(非后门,但建议知晓)
`scripts/` 下的批量运维套件**需用户显式提供 `iplist.txt`/`config.txt` 并手动运行**,不会被安装流程静默触发:
- `ckssh.py`:仅做 TCP 端口连通性检测(connect 后打印 ok/no)。
- `mabs.sh` + `thread.sh` + `mssh.exp` + `mscp.exp`:读取 IP/端口/用户/口令列表,向多台主机推送文件或执行命令。口令经 `xxd` 十六进制编码后由 `bc`/`dc` 解码传入 expect(本地编码,非外泄)。
- 调用点:仅 `bin/backup.sh:269`(备份到远程)、`bin/backup_setup.sh:167`(备份配置),且均依赖用户填写的配置文件。
- **风险点(运维自有风险,非恶意)**:配置文件中以明文存储远程主机口令;该工具可对多主机批量执行命令。请妥善保管 `iplist.txt`/`config_backup.txt`
---
## 四、附带发现(非安全后门,建议修复)
- `modules/security/fail2ban.sh` 第 23–33 行:仍把 init 脚本拷贝到 `/etc/services/fail2ban`(应为 `/etc/init.d/fail2ban`),属上一轮"仅支持 Debian/Ubuntu"裁剪时遗留的 RHEL 路径笔误(与之前 mysql 的 `/etc/services/mysqld` 同类)。不影响 Debian/Ubuntu 分支,但属功能 bug,建议一并修正。
- `src/` 目录残留 `nginx-rtmp-module.tar.gz``ngx-fancyindex-0.5.2.tar.xz`(前轮已从 nginx.sh 移除引用),可清理以减少体积。
- 项目当前非 git 仓库,无法做提交历史比对;如需验证完整性,建议初始化 git 并定期提交基线。
---
## 五、审计命令摘要(可复现)
```
# 外连/反弹 shell
grep -rniE "curl |wget |nc |/dev/tcp/|bash -i|socat|mkfifo" --include="*.sh" .
# 混淆/动态执行
grep -rniE "base64 -d|/dev/tcp/|xxd -r|openssl enc" --include="*.sh" .
# 持久化/提权
grep -rniE "crontab|@reboot|systemctl enable|ld_preload|useradd|chmod 777|chmod \+s|NOPASSWD" --include="*.sh" .
# 全部域名
grep -rnoE "https?://[^/]+" --include="*.sh" --include="*.py" . | sort -u
```