0
"Hello, world!"라는 간단한 Linux 어셈블리 셸 코드를 작성했습니다. stdout.Linux (Fedora) 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는 쉘 코드를 실행하는데 사용되는 프로그램 C의 경우 : S-PROC 정보
. ld 명령을 사용하면 쉘 코드가 커지기 때문에 s-proc을 사용했습니다.
S-pros.c의 소스 코드
는 래퍼 코드는 단순히 메모리 덩어리를 가져옵니다malloc
를 사용하고 그것으로 파일을 읽고
here 및
here
* 프로그램이 정확하지만 오류가 발생합니다. *이 중 하나는 ** 거짓 **입니다. –