什么是程序的十六进制版本,它是什么

时间:2013-08-25 11:16:03

标签: c linux gcc

十六进制版程序,  例如在linux中,程序是以

的形式编写的
char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
 ...........
 ......
 .....
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;

有人可以向我解释上面的代码是做什么的吗?

1 个答案:

答案 0 :(得分:4)

您所链接的内容通常称为shellcode

这是表示计算机可以执行的指令的原始字节,通常用作各种攻击中的有效负载,例如buffer overflow attack

回答有关如何制作的问题:

在汇编中考虑这段代码:

[SECTION .text]
global _start
_start:
        xor eax, eax       ;exit is syscall 1
        mov al, 1       ;exit is syscall 1
        xor ebx,ebx     ;zero out ebx
        int 0x80

如果你组装它就可以得到:

Disassembly of section .text:

08048080 <_start>:
 8048080:       b0 01                   mov    $0x1,%al
 8048082:       31 db                   xor    %ebx,%ebx
 8048084:       cd 80                   int    $0x80

您需要的字节是 b0,01,31,db,cd 80 。现在你可以像这样轻松地使用它:

char shellcode[] = "\xb0\x01\x31\xdb\xcd\x80";

Source
Another Source

相关问题