Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 什么是十六进制版本的程序,它的用途是什么_C_Linux_Gcc - Fatal编程技术网

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

C 什么是十六进制版本的程序,它的用途是什么,c,linux,gcc,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\

十六进制版本的程序, 例如,在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;”;

有人能给我解释一下上面的代码是做什么的吗?

您在上的链接通常被称为

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

回答您关于如何制作的问题:

请考虑汇编中的这段代码:

[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

看起来像是缓冲区溢出exploit@nlightnfotis:什么是cp-p/bin/sh/tmp/.beyond;chmod 4755/tmp/.beyond;means@Kajal它复制基本系统shell,可能是bash在/tmp/called.beyond下的一个新隐藏文件中,然后更改其所有权,以便能够在当前进程下执行它。@NlightNFotis,那么我们为什么不需要编译呢?我认为每个c程序都需要编译才能运行。@Kajal这些是shell命令,不是c源代码。它本质上与您在命令行界面中编写的内容相同。
char shellcode[] = "\xb0\x01\x31\xdb\xcd\x80";