shellcode学习

1、独立的存在,无需任何文件格式的包装
2、内存中运行,无需固定指定的宿主进程
生成shellcode的一种方法是找到编写的程序的文件偏移,用winhex打开程序,找到文件偏移,复制十六进制保存为文件。
用ida打开我们的文件,在函数名称栏我们可以看到有很多sub_开头的函数,这些全是vs给我们自动添加的代码,这些代码对我们编写shellcode有很大干扰,我们要尽量将其清除
1、修改程序入口点
在这里插入图片描述
在这里插入图片描述
2、关闭缓冲区安全检查
在这里插入图片描述
代码生成中的运行库debug版本要设置成为MTD,release版本要修改为MT

我们使用PEiD查看程序的节区,发现有代码段,数据段,资源段。
rsrc为默认添加的清单数据
在这里插入图片描述
将连接器中的清单文件的生成清单选择否,可以实现去除资源段的效果
在这里插入图片描述
将链接器中的调试里的生成调试信息选为否,可以关闭数据段(vs2008成功,2015失败),不影响生成shellcode
在这里插入图片描述
shellcode中不可以使用api函数,应为每个应用程序加载的dll位置不同,也应该避免全局变量的使用
确保已加载所使用API的动态链接库
windows每个程序在内部都会对ntdll,dll、kernel32.dll、kernelbase.dll
我们获得了kernel32.dll的地址就相当于得到了LoadLibrary(“kernel32.dll”)的返回值,有了这个返回值就相当于有了GetProcAddress函数的第一个参数
在这里插入图片描述
fs:[30]代表是PEB结构,PEB结构的0c位置是模块信息
在这里插入图片描述
在这里插入图片描述
每个系统的程序第三个模块加载的都是kernel32.dll
在这里插入图片描述
在这里插入图片描述
获得GetProcAddress地址
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Shellcode Helper v1.62 Coded by TeLeMan (c) 2008-2013 Usage: schelper.exe [options] Options: -i [input file] input file (Default: stdin) -o [output file] output file (Default: stdout) -s input file format (Default: Auto-Detection) -sb input file format is Binary -sp the input file format's parameters -d output file format (Default: C format) -db output file format is Binary -dp the output file format's parameters -search get the start offset by the pattern: e.g. PK\x03\x04 -soff fix the match offset after searching (Default: 0) -off convert the input file from the offset (Default: 0) -len convert the input file with the length (Default: 0 - MAX) -en [encoder] encode shellcode (Default: XorDword) -de [encoder] decode shellcode (Default: Auto-Detection) -ex exclude characters: e.g. 0x00,0x01-0x1F,0xFF (Default: 0x00) -in incude characters only -ep the encoder's parameters -t [pid] execute or inject shellcode into process for testing -td [pid] execute or inject shellcode into process for debugging -stack put shellcode into stack and execute it (ESP is the shellcode start) -noinfo display no normal messages except error messages Available formats: 0 - C 1 - C(HexArray) 2 - Perl 3 - Python 4 - Ruby 5 - JavaScript(Escape) 6 - VBScript(Escape) 7 - Pascal 8 - MASM(Data) 9 - HexDump 10 - BitString 11 - HexString 12 - HexArray(C like) 13 - Base64 14 - Binary 15 - HexString(C like) 16 - HexString(Escape) 17 - HexString(JavaScript,UNICODE) 18 - URI(ISO-8859-1) 19 - XML(PCDATA) 20 - BigNumber 21 - BigNumber(Hex) 22 - BigNumber(BaseX) 23 - FloatPoint 24 - UnixTimestamp 25 - GUID 26 - MASM(ASM) 27 - NASM 28 - YASM(ASM) 29 - FASM(ASM) 30 - JWASM(ASM) 31 - POASM(ASM) 32 - GOASM(ASM) 33 - GNU ASM Available encoders:

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值