Coder Social home page Coder Social logo

jspkiller-1's Introduction

JSPKiller

简介

一个JSP Webshell检测工具

主要是基于污点分析来做,依靠ASM解析字节码,然后模拟栈帧在JVM指令执行中的变化实现数据流分析

大致过程:

  1. 解析输入JSP文件到普通Java文件
  2. 动态编译这个Java文件得到对应的class文件
  3. 使用ASM等技术分析class文件的字节码

具体的原理参考先知社区文章:基于污点分析的JSP Webshell检测

为什么不基于AST做:可以避免一些编译过程产生的trick(例如注释换行逃逸// \u000d code;

Quick Start

目前支持以下两种检测,其他方式后续更新

  1. 反射构造Runtime.execWebshell
  2. 使用BCEL ClassLoader加载恶意字节码的Webshell(非反射方式)

命令:

java -jar JSPKiller.jar -f 1.jsp -m rb

  • 使用-f参数指定检测JSP文件
  • 使用-m参数指定检测模块:r表示反射型;b表示BCEL型(可多选)

提供了检测案例

  • jsp/test-1.jsp-jsp/test-4.jsp用于测试反射马
  • jsp/bcel-1.jsp-jsp/bcel-4.jsp用于测试BCEL马

如果发生空指针异常或编译报错,参考以下

注意:

  1. JSPKiller.jar目录下必须有lib.jar文件
  2. 测试的三种反射JSP马已经提供(在JSP目录下)
  3. 确保配置了正确的环境变量JAVA_HOME
  4. 确保java命令是JDK下的而不是JRE下的(例如环境变量Path中配置C:\Program Files\Java\jdk1.8.0_131\bin为第一个)这样做的原因是:在JRE环境中无法获得编译器对象(JavaCompiler)来进行动态编译,只有JDK有这样的功能

效果

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.