From d725554a87881872a8682310ed3f645a95970bb4 Mon Sep 17 00:00:00 2001 From: OJ Date: Sun, 17 May 2015 17:29:47 +1000 Subject: [PATCH] Fix UUID code so that it always deals with 16 bytes Also re-add the payload ID to session validation now that the UUID stuff is reliable. --- lib/msf/base/sessions/meterpreter.rb | 4 +--- lib/rex/payloads/meterpreter/config.rb | 3 +-- lib/rex/post/meterpreter/packet.rb | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/msf/base/sessions/meterpreter.rb b/lib/msf/base/sessions/meterpreter.rb index 4e80919aec..35227de609 100644 --- a/lib/msf/base/sessions/meterpreter.rb +++ b/lib/msf/base/sessions/meterpreter.rb @@ -307,9 +307,7 @@ class Meterpreter < Rex::Post::Meterpreter::Client begin self.machine_id = self.core.machine_id(timeout) - # This is causing breakages thanks to Meterpeter not doing what it should - # be doing with the uuid. - #self.payload_uuid ||= self.core.uuid(timeout) + self.payload_uuid ||= self.core.uuid(timeout) return true rescue ::Rex::Post::Meterpreter::RequestError diff --git a/lib/rex/payloads/meterpreter/config.rb b/lib/rex/payloads/meterpreter/config.rb index ede3250504..a06a19ebca 100644 --- a/lib/rex/payloads/meterpreter/config.rb +++ b/lib/rex/payloads/meterpreter/config.rb @@ -8,7 +8,6 @@ class Rex::Payloads::Meterpreter::Config include Msf::ReflectiveDLLLoader - UUID_SIZE = 64 URL_SIZE = 512 UA_SIZE = 256 PROXY_HOST_SIZE = 128 @@ -48,7 +47,7 @@ private end def session_block(opts) - uuid = to_str(opts[:uuid].to_raw, UUID_SIZE) + uuid = opts[:uuid].to_raw exit_func = Msf::Payload::Windows.exit_types[opts[:exitfunk]] session_data = [ diff --git a/lib/rex/post/meterpreter/packet.rb b/lib/rex/post/meterpreter/packet.rb index f3d9b9b98a..459fb2d4bb 100644 --- a/lib/rex/post/meterpreter/packet.rb +++ b/lib/rex/post/meterpreter/packet.rb @@ -102,7 +102,7 @@ TLV_TYPE_TRANS_RETRY_WAIT = TLV_META_TYPE_UINT | 440 TLV_TYPE_TRANS_GROUP = TLV_META_TYPE_GROUP | 441 TLV_TYPE_MACHINE_ID = TLV_META_TYPE_STRING | 460 -TLV_TYPE_UUID = TLV_META_TYPE_STRING | 461 +TLV_TYPE_UUID = TLV_META_TYPE_RAW | 461 TLV_TYPE_CIPHER_NAME = TLV_META_TYPE_STRING | 500 TLV_TYPE_CIPHER_PARAMETERS = TLV_META_TYPE_GROUP | 501