Refactor the BeanFactory gadget code

This commit is contained in:
Spencer McIntyre
2022-01-12 16:14:18 -05:00
parent e873907d13
commit e093154865
6 changed files with 224 additions and 291 deletions
+13 -1
View File
@@ -23,7 +23,13 @@ module Exploit::JavaDeserialization
raise RuntimeError, 'Invalid shell for Java Deserialization payload generation'
end
Msf::Util::JavaDeserialization.ysoserial_payload(name, command, modified_type: shell)
if name == 'BeanFactory'
blob = Msf::Util::JavaDeserialization::BeanFactory.generate(command, shell: shell)
else
blob = Msf::Util::JavaDeserialization.ysoserial_payload(name, command, modified_type: shell)
end
blob
end
# Generate a binary blob that when deserialized by Java will execute the specified payload. This routine converts the
@@ -60,5 +66,11 @@ module Exploit::JavaDeserialization
generate_java_deserialization_for_command(name, shell, command)
end
def self.gadget_chains
chains = Msf::Util::JavaDeserialization.ysoserial_payload_names
chains << 'BeanFactory' # not a ysoserial payload, but still supported
chains.sort
end
end
end