MCPcopy Create free account
hub / github.com/quentinhardy/odat / testAll

Method testAll

Java.py:306–336  ·  view source on GitHub ↗

Test all functions

(self)

Source from the content-addressed store, hash-verified

304 return True
305
306 def testAll (self):
307 '''
308 Test all functions
309 '''
310 command = self.__generateRandomString__()
311 self.args['print'].subtitle('JAVA library ?')
312 logging.info("Try to use JAVA in order to execute the following random command: {0}".format(command))
313 status = self.createClassAndFunctionToExecOsCmd()
314 if status != True:
315 self.args['print'].badNews("KO")
316 else:
317 data = self.__runOSCmd__ (command,printResponse=False)
318 if data == '':
319 logging.info("The system command {0} return no error, it's impossible with this random command".format(command))
320 self.args['print'].badNews("KO")
321 else :
322 self.args['print'].goodNews("OK")
323 status = self.deleteClassAndFunctionToExecOsCmd()
324 if status != True:
325 self.args['print'].info("Impossible to delete functions created: {0}".format(self.cleanError(status)))
326 logging.info("The attacker can create a Java Stored Procedure. Perhaps he can exploit CVE-2018-3004 ('Oracle Privilege Escalation via Deserialization')...")
327 self.args['print'].subtitle("Bypass built in Oracle JVM security (CVE-2018-3004)?")
328 remoteFileName = generateRandomString()
329 if self.remoteSystemIsLinux() == True:
330 status = self.createOrAppendFileViaCVE_2018_3004(data=generateRandomString(),remoteFilename='/tmp/'+remoteFileName)
331 else:
332 status = self.createOrAppendFileViaCVE_2018_3004(data=generateRandomString(),remoteFilename='%temp%\\'+remoteFileName)
333 if status == True:
334 self.args['print'].goodNews("OK")
335 else:
336 self.args['print'].badNews("KO")
337
338def runjavaModule(args):
339 '''

Callers 2

runjavaModuleFunction · 0.95

Calls 11

__runOSCmd__Method · 0.95
generateRandomStringFunction · 0.90
subtitleMethod · 0.80
badNewsMethod · 0.80
goodNewsMethod · 0.80
cleanErrorMethod · 0.80
remoteSystemIsLinuxMethod · 0.80

Tested by

no test coverage detected