发信人: HPVC() 
整理人: williamlong(1999-12-13 19:02:14), 站内信件
 | 
 
 
                         系统防卫(三) 5.找出隐藏文件   上节提到当hacker在取得root权限后,在系统中留下些后门文件。最常用的方法就是放 在/bin、/usr/bin、/usr/sbin等命令目录下,但也有其他的方法隐藏起来。    For example: $pwd /export/home/tommy  $ls -al  total 48 drwxr-xr-x  11 tommy    other       1024 Oct 13 11:20 . drwxr-xr-x  10 root     other        512 Sep 18 11:11 .. drwxr-xr-x   2 tommy    other        512 Oct 13 11:18 .. drwxr-xr-x   2 tommy    other        512 Oct 13 11:18 ... -rw-r--r--   1 tommy    other        255 Oct 10 23:37 .profile -rw-------   1 tommy    other        272 Oct 11 00:19 .sh_history -rw-r--r--   1 tommy    other       1429 Oct  8 17:35 33acounts drwx------   6 tommy    other        512 Sep 24 18:24 IBM -rwx------   1 tommy    other        455 Sep 24 16:08 catcher.c drwxr-xr-x   2 tommy    other        512 Oct 13 11:17 crack drwxr-xr-x   2 tommy    other        512 Oct 12 10:15 exploit drwxr-xr-x   2 tommy    other        512 Oct 13 11:20 host drwx------   2 tommy    other        512 Sep 24 15:38 klaxon -rwx------   1 tommy    other        124 Sep 18 11:07 local.cshrc -rwx------   1 tommy    other        575 Sep 18 11:07 local.login -rwx------   1 tommy    other        560 Sep 18 11:07 local.profile -rwx------   1 tommy    other       4275 Sep 21 20:40 scanproxy.c drwx------   2 tommy    other       1024 Oct  7 14:22 sniff drwxr-xr-x   2 tommy    other        512 Oct 12 09:55 source             
    相信大家也会留意到有个三个点"..."的目录了,这是最简单的建立隐藏目录的方法,管理员只要留神一下就会找到它,并且可以直接 敲 cd ... 指令就可进入此目录。   但是否也注意到有两个 ".."的目录, 一点"." 是代表当前目录,二个点".."是代表父 目录,但为什么有两个父目录呢? 有问题!其实是hacker利用了特殊字符建立的目录, 只要用带参数b的ls 指令就可看清楚了。 $ls -lab drwxr-xr-x  11 tommy    other       1024 Oct 13 11:32 . drwxr-xr-x  10 root     other        512 Sep 18 11:11 .. drwxr-xr-x   2 tommy    other        512 Oct 13 11:18 ..\007 drwxr-xr-x   2 tommy    other        512 Oct 13 11:18 ... -rw-r--r--   1 tommy    other        255 Oct 10 23:37 .profile -rw-------   1 tommy    other        272 Oct 11 00:19 .sh_history -rw-r--r--   1 tommy    other       1429 Oct  8 17:35 33acounts drwx------   6 tommy    other        512 Sep 24 18:24 IBM -rwx------   1 tommy    other        455 Sep 24 16:08 catcher.c -rw-r--r--   1 tommy    other     149788 Oct 13 11:32 core drwxr-xr-x   2 tommy    other        512 Oct 13 11:17 crack drwxr-xr-x   2 tommy    other        512 Oct 12 10:15 exploit drwxr-xr-x   2 tommy    other        512 Oct 13 11:20 h\007ost drwx------   2 tommy    other        512 Sep 24 15:38 klaxon -rwx------   1 tommy    other        124 Sep 18 11:07 local.cshrc -rwx------   1 tommy    other        575 Sep 18 11:07 local.login -rwx------   1 tommy    other        560 Sep 18 11:07 local.profile -rwx------   1 tommy    other       4275 Sep 21 20:40 scanproxy.c drwx------   2 tommy    other       1024 Oct  7 14:22 sniff drwxr-xr-x   2 tommy    other        512 Oct 12 09:55 source  
    原来两点".."后还跟了个ascii字符,对应为ctrl+g ,hacker是用了mkdir ..^G 的指令来建立的,同时我们也注意到有一个看似是叫做host目录,其实也是用mkdir h^Gost指令来建立的隐藏目录;   hacker也可利用以上的方法(还有空格键)组合出隐藏的目录,对于这些情况,管理员应查清楚该目录下的文件内容(有时未必是hacker所干,只是用户想隐藏自己的私人文件而已),再做行动。  如发现其目录下有攻击性程序,可以用问号"?"代替"\007"等不可见字符,来删除该目录,如 $rm -r ..? (删除掉 ..\007 目录)  $rm -r h?ost (删除掉 h\007ost目录)   就可删除 "..^G"等隐藏的目录了。   对于带有空格键的目录或文件,删除它时,用引号引起来防止shell把它滤掉. $ls -al  total 6 drwxr-xr-x   3 tommy    other        512 Oct 13 13:13 . drwxr-xr-x  10 tommy    other       1024 Oct 13 13:11 .. drwxr-xr-x   2 tommy    other        512 Oct 13 13:11 h ost  $rm -r h" "ost  that's ok。  
  6.关闭不必要的服务   79端口所运行的服务是fingerd,它是为网络用户提供服务的。一个远程用户可通过finger 来知道某一主机中是否存在某一个用户。此命令根据/etc/passwd文件中相应帐号的注释字段 来产生一个报告。这些信息可能被hacker利用来猜口令。前段时间站点203.123.254.97 (tokobudi.co.id,其中一个被hack的印尼站点),就是利用这服务找出系统中的所有帐号, 其中有多个username和password是一样的,加上本身系统的bug还没fix,所以留下了后患。   而1988年著名的Internet Worm 是利用1988年11月以前的fingerd存在严重的缺陷,从而 使fingerd转去启动shell程序,而不是执行finger指令。   本身开通fingerd服务没错,错在用户采用了非常脆弱的password,有时使的有经验hacker 不运行猜口令的程序也可猜中password,所以对于ISP来说没必要开着79端口,应将其关闭。
  #vi /etc/inetd.conf  在finger前加"#"号,将其注释掉  #finger stream  tcp     nowait  nobody  /usr/sbin/in.fingerd    in.fingerd 再找出inetd的进程号,kill掉此id,再重起inetd进程。 #ps -ef|grep inetd     root   120     1  0   Oct 12 ?        0:00 /usr/sbin/inetd -s     root  4806  4764  0 17:31:24 pts/5    0:00 grep inetd                     #kill -HUP 120
    that's ok.
 
  -- ※ 来源:.广州网易 BBS bbs.nease.net.[FROM: news.foshan.gd.]
  | 
 
 
 |