Module: Msf::Util::EXE::Windows::Aarch64::ClassMethods
- Included in:
- Msf::Util::EXE::Windows::Aarch64
- Defined in:
- lib/msf/util/exe/windows/aarch64.rb
Constant Summary collapse
- WINAARCH64_PAYLOAD_SPACE =
The size, in bytes, of the fixed
payload[]buffer declared in data/templates/src/pe/exe/template_aarch64_windows.c (SCSIZE). Shellcode longer than this would overwrite adjacent bytes in the compiled template. The AArch64 DLL uses the shared pe/dll/template.c buffers (4KiB / 256KiB) via Common::ClassMethods#set_template_default_winpe_dll, not this constant. 8192
Instance Method Summary collapse
-
#inject_winaarch64_payload(code, opts, default_template) ⇒ String
Overwrite the "PAYLOAD:" tag in a Windows AArch64 PE template.
-
#to_winaarch64pe(framework, code, opts = {}) ⇒ String
Construct a Windows AArch64 PE executable with the given shellcode.
-
#to_winaarch64pe_dll(framework, code, opts = {}) ⇒ String
Construct a Windows AArch64 PE DLL with the given shellcode.
Instance Method Details
#inject_winaarch64_payload(code, opts, default_template) ⇒ String
Overwrite the "PAYLOAD:" tag in a Windows AArch64 PE template.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/msf/util/exe/windows/aarch64.rb', line 61 def inject_winaarch64_payload(code, opts, default_template) set_template_default(opts, default_template) pe = File.read(opts[:template], mode: 'rb') bo = find_payload_tag(pe, 'Invalid Windows AArch64 template: missing "PAYLOAD:" tag') if code.length > WINAARCH64_PAYLOAD_SPACE raise Rex::RuntimeError, "The Windows AArch64 PE generator has a max size of #{WINAARCH64_PAYLOAD_SPACE} bytes, please fix the calling module" end pe[bo, code.length] = code.dup pe end |
#to_winaarch64pe(framework, code, opts = {}) ⇒ String
Construct a Windows AArch64 PE executable with the given shellcode.
There is still no dedicated AArch64 service template, so this loader-style EXE is reused when a caller asked for exe-service. That is safe for psexec-style delivery: Windows still spawns the process when the SCM start request times out because the binary doesn't speak the service control protocol. DLL generation uses #to_winaarch64pe_dll instead.
30 31 32 |
# File 'lib/msf/util/exe/windows/aarch64.rb', line 30 def to_winaarch64pe(framework, code, opts = {}) inject_winaarch64_payload(code, opts, 'template_aarch64_windows.exe') end |
#to_winaarch64pe_dll(framework, code, opts = {}) ⇒ String
Construct a Windows AArch64 PE DLL with the given shellcode.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/msf/util/exe/windows/aarch64.rb', line 41 def to_winaarch64pe_dll(framework, code, opts = {}) set_template_default_winpe_dll(opts, ARCH_AARCH64, code.size) opts[:exe_type] = :dll if opts[:inject] raise Rex::RuntimeError, 'Template injection unsupported for AArch64 DLLs' else exe_sub_method(code, opts) end end |