Allow exploits to provide encoder Compat options #3024

merged 3 commits into from Mar 13, 2014


None yet

5 participants


Requirement (re)discovered while processing #2964, where a ARCH_CMD encoder would require the powershell command in order to work. Would be neat if exploits can provide a list of "Compat" options to have into account when selecting the encoder.


At this moment nothing should change, because any module provides Compat options for the encoder... so just ensure all works as before. Tests:

  • Use msfpayload to generate any payload you can imagine, should work as before
  • Use msfvenom to generate any encoded payload you can imagine, should work as before.
  • Use any exploit you can imagine, should work as before.
@jlee-r7 jlee-r7 and 3 others commented on an outdated diff Feb 21, 2014
@@ -125,6 +125,17 @@ def encode
self.encoder =
self.encoded = nil
+ # If the encoding is requested by an exploit check compatibility
+ # options first of all. For the 'generic/none' encoder compatibility
+ # options don't apply.
+ if (reqs['Exploit'] &&
+ reqs['Exploit'].compatible?(self.encoder) == false &&
+ encname !~ /generic\/none/)
jlee-r7 Feb 21, 2014 Contributor

why do we need a special case for generic/none?

todb-r7 Feb 21, 2014 Contributor

if plus && plus == false makes my brain hurt.

Any way to make this clearer? probably not...

jvazquez-r7 Feb 21, 2014 Contributor

@jee-r7 because if any encoder is able to encode it, maybe it still can pass the requirements without encoding, prolly not, but doesn't hurt to give the chance, thoughts?

Meatballs1 Feb 22, 2014 Contributor

if reqs['Exploit'] && !reqs['Exploit'].compatible?(self.encoder) && encname !~ /generic\/none/)



I guess I can work on this since we have a week until the next release. Grabbing.

@wchen-r7 wchen-r7 self-assigned this Mar 12, 2014
@wchen-r7 wchen-r7 added a commit that referenced this pull request Mar 13, 2014
@wchen-r7 wchen-r7 Land #3024 - Allow encoder Compat options 7ead044
@wchen-r7 wchen-r7 merged commit 9fd635d into rapid7:master Mar 13, 2014

1 check passed

default The Travis CI build passed
@jvazquez-r7 jvazquez-r7 deleted the jvazquez-r7:compat_encoders branch Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment