我今天大會開始,以創建殼code.The ASM是個好人,過了一段時間我創造了這個:我是否需要Shellcode的特定訂單?將此代碼轉換爲shellcode時,我做錯了什麼?
[SECTION .text]
global _start
_start:
call ender
starter:
mov al, 4
mov bl, 1
pop ecx
mov dl, 21
int 0x80
xor eax, eax
mov al, 1
xor ebx,ebx
int 0x80
ender:
call starter
db 10,'Shellcode forever!',10 ,10
哪些行之有效:
Shellcode forever!
[email protected]:~/Desktop# clear;nasm -f elf test.asm;ld -s -o test test.o;./test
所以然後我用「objdump的-d測試」,並得到這個:
test: file format elf32-i386
Disassembly of section .text:
08048060 <.text>:
8048060: e8 11 00 00 00 call 0x8048076
8048065: b0 04 mov $0x4,%al
8048067: b3 01 mov $0x1,%bl
8048069: 59 pop %ecx
804806a: b2 15 mov $0x15,%dl
804806c: cd 80 int $0x80
804806e: 31 c0 xor %eax,%eax
8048070: b0 01 mov $0x1,%al
8048072: 31 db xor %ebx,%ebx
8048074: cd 80 int $0x80
8048076: e8 ea ff ff ff call 0x8048065
804807b: 0a 53 68 or 0x68(%ebx),%dl
804807e: 65 gs
804807f: 6c insb (%dx),%es:(%edi)
8048080: 6c insb (%dx),%es:(%edi)
8048081: 63 6f 64 arpl %bp,0x64(%edi)
8048084: 65 20 66 6f and %ah,%gs:0x6f(%esi)
8048088: 72 65 jb 0x80480ef
804808a: 76 65 jbe 0x80480f1
804808c: 72 21 jb 0x80480af
804808e: 0a 0a or (%edx),%cl
但是當我把它變成的shellcode:
char code[] = "\xe8\x11\x00\x00\x00\xb0\x04\xb3\x01\x59\xb2\x15\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8\xea\xff\xff\xff\x0a\x53\x68\x65\x6c\x6c\x63\x6f\x64\x65\x20\x66\x6f\x72\x65\x76\x65\x72\x21\x0a\x0a";
它沒有工作。我做錯了什麼?
你是怎麼把它變成shellcode的?有沒有你沒有關心的任何endinanness問題? –
也許嘗試使用nasm2shell,將NASM,GNU as和二進制文件直接轉換爲shellcode的as2shell或bin2shell可能是值得的。 http://blog.markloiseau.com/wp-content/uploads/2012/06/bin2shell.tar。gz –
好吧,我試試看:p –