0
我寫了一個簡單的Linux彙編shellcode,它打印出「Hello,world!」標準輸出。在Linux(Fedora)上執行彙編shellcode hello.S's-proc -e'返回SIGSEGV
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
jmp short string
code:
pop ecx
mov bl,1
mov al,13
mov al,4
int 0x80
dec bl
mov al,1
int 0x80
string:
call code
db 'hellow, world!'
程序名是hello.S
。現在,編譯代碼:
$ nasm -o hello hello.S
$ ./s-proc -p hello
/* The following shellcode is 47 bytes long: */
char shellcode[] =
"\x66\x31\xc0\x66\x31\xdb\x66\x31\xc9\x66\x31\xd2\xeb\x10\x66"
"\x59\xb3\x01\xb0\x0d\xb0\x04\xcd\x80\xfe\xcb\xb0\x01\xcd\x80"
"\xe8\xed\xff\x68\x65\x6c\x6c\x6f\x77\x2c\x20\x77\x6f\x72\x6c"
"\x64\x21";
$ ./s-proc -e hello
Calling code ...
Segmentation fault
$
該程序是正確的,但它會給出錯誤。
關於S-PROC:
S-PROC是用於執行的shellcode一個C程序。使用ld命令使得shellcode很大,因此我使用了s-proc。
*該程序是正確的,但會給出錯誤。*其中一個陳述是** false **。 – 2014-09-06 17:27:34