Add/Sub Encoder - Metasploit
This page contains detailed information about how to use the encoder/x86/add_sub metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Add/Sub Encoder
Module: encoder/x86/add_sub
Source code: modules/encoders/x86/add_sub.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): x86
Supported platform(s): All
Target service / protocol: -
Target network port(s): -
List of CVEs: -
Encodes payload with add or sub instructions. This idea came from (offensive-security) muts' hp nnm 7.5.1 exploit.
Module Ranking and Traits
Module Ranking:
- manual: The exploit is unstable or difficult to exploit and is basically a DoS. This ranking is also used when the module has no use unless specifically configured by the user (e.g.: exploit/windows/smb/psexec). More information about ranking can be found here.
Basic Usage
msf > use encoder/x86/add_sub
msf encoder(add_sub) > show targets
... a list of targets ...
msf encoder(add_sub) > set TARGET target-id
msf encoder(add_sub) > show options
... show and set options ...
msf encoder(add_sub) > exploit
Go back to menu.
Msfconsole Usage
Here is how the encoder/x86/add_sub module looks in the msfconsole:
msf6 > use encoder/x86/add_sub
msf6 encoder(x86/add_sub) > show info
Name: Add/Sub Encoder
Module: encoder/x86/add_sub
Platform: All
Arch: x86
Rank: Manual
Provided by:
Melih Sarica <[email protected]>
Description:
Encodes payload with add or sub instructions. This idea came from
(offensive-security) muts' hp nnm 7.5.1 exploit.
Module Options
This is a complete list of options available in the encoder/x86/add_sub module:
msf6 encoder(x86/add_sub) > show options
Module options (encoder/x86/add_sub):
Name Current Setting Required Description
---- --------------- -------- -----------
Advanced Options
Here is a complete list of advanced options supported by the encoder/x86/add_sub module:
msf6 encoder(x86/add_sub) > show advanced
Module advanced options (encoder/x86/add_sub):
Name Current Setting Required Description
---- --------------- -------- -----------
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Bad character list includes essential characters.
Here is a relevant code snippet related to the "Bad character list includes essential characters." error message:
94: end
95: offset = (datastore['BufferOffset'] || 0).to_i
96: @inst = {}
97: @set = add_or_sub(@avchars)
98: if @set == 0 then
99: raise EncodingError, "Bad character list includes essential characters."
100: exit
101: elsif @set == 1 then #add
102: @inst["opcode"] = 0x05
103: else #sub
104: @inst["opcode"] = 0x2d
Shellcode size must be divisible by 4, try nop padding.
Here is a relevant code snippet related to the "Shellcode size must be divisible by 4, try nop padding." error message:
107: @inst["pop"] = 0x58
108: @inst["and"] = 0x25
109: @inst["push_esp"] = 0x54
110: @inst["pop_esp"] = 0x5c
111: if state.buf.size%4 != 0 then
112: raise EncodingError, "Shellcode size must be divisible by 4, try nop padding."
113: exit
114: end
115: #init
116: write_inst(@inst["push_esp"], 0)
117: write_inst(@inst["pop"], 0)
Go back to menu.
Related Pull Requests
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5374 Merged Pull Request: Implements msfvenom --smallest
- #2597 Merged Pull Request: chmod -x .rb files without #! in modules and lib
- #2525 Merged Pull Request: Change module boilerplate
- #1713 Merged Pull Request: added add_sub encoder for x86 payloads
Go back to menu.
See Also
Check also the following modules related to this module:
- encoder/x86/alpha_mixed
- encoder/x86/alpha_upper
- encoder/x86/avoid_underscore_tolower
- encoder/x86/avoid_utf8_tolower
- encoder/x86/bloxor
- encoder/x86/bmp_polyglot
- encoder/x86/call4_dword_xor
- encoder/x86/context_cpuid
- encoder/x86/context_stat
- encoder/x86/context_time
- encoder/x86/countdown
- encoder/x86/fnstenv_mov
- encoder/x86/jmp_call_additive
- encoder/x86/nonalpha
- encoder/x86/nonupper
- encoder/x86/opt_sub
- encoder/x86/service
- encoder/x86/shikata_ga_nai
- encoder/x86/single_static_bit
- encoder/x86/unicode_mixed
- encoder/x86/unicode_upper
- encoder/x86/xor_dynamic
Authors
Melih Sarica <ms[at]sevure.com>
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.