@@ -15,7 +15,8 @@ def initialize(info = {})
15
15
super
16
16
register_advanced_options (
17
17
[
18
- Msf ::OptString . new ( 'PayloadUUIDSeed' , [ false , 'A string to use when generating the payload UUID (deterministic)' ] )
18
+ Msf ::OptString . new ( 'PayloadUUIDSeed' , [ false , 'A string to use when generating the payload UUID (deterministic)' ] ) ,
19
+ Msf ::OptString . new ( 'PayloadUUIDRaw' , [ false , 'A hex string representing the raw 8-byte PUID value for the UUID' ] ) ,
19
20
] , self . class )
20
21
end
21
22
@@ -33,8 +34,8 @@ def generate_uri_uuid_mode(mode,len=nil)
33
34
# The URI length may not have room for an embedded checksum
34
35
if len && len < URI_CHECKSUM_UUID_MIN_LEN
35
36
# Throw an error if the user set a seed, but there is no room for it
36
- if datastore [ 'PayloadUUIDSeed' ] . to_s . length > 0
37
- raise ArgumentError , "A PayloadUUIDSeed was specified, but this payload doesn't have enough room for a UUID"
37
+ if datastore [ 'PayloadUUIDSeed' ] . to_s . length > 0 || datastore [ 'PayloadUUIDRaw' ] . to_s . length > 0
38
+ raise ArgumentError , "A PayloadUUIDSeed or PayloadUUIDRaw value was specified, but this payload doesn't have enough room for a UUID"
38
39
end
39
40
return "/" + generate_uri_checksum ( sum , len , prefix = "" )
40
41
end
@@ -50,10 +51,21 @@ def generate_payload_uuid
50
51
platform : self . platform
51
52
}
52
53
54
+ # Handle user-specified seed values
53
55
if datastore [ 'PayloadUUIDSeed' ] . to_s . length > 0
54
56
conf [ :seed ] = datastore [ 'PayloadUUIDSeed' ] . to_s
55
57
end
56
58
59
+ # Handle user-specified raw payload UID values
60
+ if datastore [ 'PayloadUUIDRaw' ] . to_s . length > 0
61
+ puid_raw = [ datastore [ 'PayloadUUIDRaw' ] . to_s ] . pack ( "H*" )
62
+ if puid_raw . length != 8
63
+ raise ArgumentError , "The PayloadUUIDRaw value must be exactly 16 bytes of hex"
64
+ end
65
+ conf . delete ( :seed )
66
+ conf [ :puid ] = puid_raw
67
+ end
68
+
57
69
Msf ::Payload ::UUID . new ( conf )
58
70
end
59
71
0 commit comments