xDro1d / zkar

ZKar is a Java serialization protocol analysis tool implement in Go.

Home Page:https://github.com/phith0n/zkar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZKar

ZKar is a Java serialization protocol analysis tool implement in Go. This tool is still work in progress, so no complete API document and contribution guide.

ZKar provides:

  • A Java serialization payloads parser and viewer in pure Go, no CGO or JDK is required
  • From the Java serialization protocol to a Go struct
  • A Go library that can manipulate the Java serialization data
  • WIP: Ysoserial implement in Go
  • WIP: Java class bytecodes parser, viewer and manipulation
  • WIP: An implementation of RMI/LDAP in Go

πŸ“¦ Installing

Using ZKar is easy. use go get to install the ZKar along with the library and its dependencies:

go get -u github.com/phith0n/zkar

Next, use github.com/phith0n/zkar/* in your application:

package main

import (
  "fmt"
  "github.com/phith0n/zkar/serz"
  "io/ioutil"
  "log"
)

func main() {
  data, _ := ioutil.ReadFile("./testcases/ysoserial/CommonsCollections6.ser")
  serialization, err := serz.FromBytes(data)
  if err != nil {
    log.Fatal("parse error")
  }

  fmt.Println(serialization.ToString())
}

πŸ’» Command line utility tool

ZKar also provides a command line utility tool that you can use it directly:

$ go run main.go
NAME:
   zkar - A Java serz tool

USAGE:
   main [global options] command [command options] [arguments...]

COMMANDS:
   generate  generate Java serz attack payloads
   dump      parse the Java serz streams and dump the struct
   help, h   Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help (default: false)

For example, you are able to dump the payload CommonsBeanutils3 from Ysoserial like:

$ go run main.go dump -f "$(pwd)/testcases/ysoserial/CommonsBeanutils3.ser"

asciicast

πŸ›  Tests

ZKar is a well-tested tool that passed all Ysoserial generated gadgets parsing and rebuilding tests. It means that gadget generating by Ysoserial can be parsed by ZKar, and parsed struts can be converted back into bytes string which is equal to the original one.

Gadget Package Parse Rebuild Parse Time
AspectJWeaver Ysoserial βœ… βœ… 80.334Β΅s
BeanShell1 Ysoserial βœ… βœ… 782.613Β΅s
C3P0 Ysoserial βœ… βœ… 98.321Β΅s
Click1 Ysoserial βœ… βœ… 573.298Β΅s
Clojure Ysoserial βœ… βœ… 72.415Β΅s
CommonsBeanutils1 Ysoserial βœ… βœ… 461.15Β΅s
CommonsCollections1 Ysoserial βœ… βœ… 64.484Β΅s
CommonsCollections2 Ysoserial βœ… βœ… 508.918Β΅s
CommonsCollections3 Ysoserial βœ… βœ… 564.071Β΅s
CommonsCollections4 Ysoserial βœ… βœ… 535.449Β΅s
CommonsCollections5 Ysoserial βœ… βœ… 137.609Β΅s
CommonsCollections6 Ysoserial βœ… βœ… 68.753Β΅s
CommonsCollections7 Ysoserial βœ… βœ… 178.549Β΅s
FileUpload1 Ysoserial βœ… βœ… 35.39Β΅s
Groovy1 Ysoserial βœ… βœ… 150.991Β΅s
Hibernate1 Ysoserial βœ… βœ… 789.674Β΅s
Hibernate2 Ysoserial βœ… βœ… 168.624Β΅s
JBossInterceptors1 Ysoserial βœ… βœ… 632.581Β΅s
JRMPClient Ysoserial βœ… βœ… 32.967Β΅s
JRMPListener Ysoserial βœ… βœ… 38.263Β΅s
JSON1 Ysoserial βœ… βœ… 2.157225ms
JavassistWeld1 Ysoserial βœ… βœ… 468.596Β΅s
Jdk7u21 Ysoserial βœ… βœ… 355.01Β΅s
Jython1 Ysoserial βœ… βœ… 216.862Β΅s
MozillaRhino1 Ysoserial βœ… βœ… 1.775193ms
MozillaRhino2 Ysoserial βœ… βœ… 409.124Β΅s
Myfaces1 Ysoserial βœ… βœ… 22.997Β΅s
Myfaces2 Ysoserial βœ… βœ… 38.131Β΅s
ROME Ysoserial βœ… βœ… 485.804Β΅s
Spring1 Ysoserial βœ… βœ… 797.469Β΅s
Spring2 Ysoserial βœ… βœ… 358.041Β΅s
URLDNS Ysoserial βœ… βœ… 21.502Β΅s
Vaadin1 Ysoserial βœ… βœ… 438.729Β΅s
Wicket1 Ysoserial βœ… βœ… 23.509Β΅s

πŸ“ TODO

  • Java bytecodes parser and generator
  • Serialization payloads generator
  • An implementation of RMI/LDAP in Go

βš–οΈ License

ZKar is released under the MIT license. See LICENSE

πŸ‘€ See Also

  • SerializationDumper: A tool to dump and rebuild Java serialization streams and Java RMI packet contents in a more human readable form.
  • ysoserial: A proof-of-concept tool for generating payloads that exploit unsafe Java object deserialization.
  • Java-Deserialization-Cheat-Sheet: The cheat sheet about Java Deserialization vulnerabilities

About

ZKar is a Java serialization protocol analysis tool implement in Go.

https://github.com/phith0n/zkar

License:MIT License


Languages

Language:Go 98.1%Language:Python 1.9%