考点:strcmp漏洞、命令注入、切换目录
靶机链接:https://www.vulnhub.com/entry/potato-1,529/
环境配置
名称 | IP |
---|
Kali Linux | 10.0.2.15 |
POTATO 1 | 10.0.2.16 |
初步打点
端口扫描
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| $ export rip=10.0.2.16
$ $ sudo nmap -v -A -p- $rip
Scanning localhost (10.0.2.16) [65535 ports]
Discovered open port 80/tcp on 10.0.2.16
Discovered open port 22/tcp on 10.0.2.16
Discovered open port 2112/tcp on 10.0.2.16
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 ef:24:0e:ab:d2:b3:16:b4:4b:2e:27:c0:5f:48:79:8b (RSA)
| 256 f2:d8:35:3f:49:59:85:85:07:e6:a2:0e:65:7a:8c:4b (ECDSA)
|_ 256 0b:23:89:c3:c0:26:d5:64:5e:93:b7:ba:f5:14:7f:3e (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Potato company
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.41 (Ubuntu)
2112/tcp open ftp ProFTPD
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rw-r--r-- 1 ftp ftp 901 Aug 2 2020 index.php.bak
|_-rw-r--r-- 1 ftp ftp 54 Aug 2 2020 welcome.msg
|
WEB测试
查看2112端口,使用Filezilla匿名登录

下载index.php.bak内容如下

这里php strcmp()存在漏洞,可使用数组绕过,但是这个登录页需要找一下
dirb
1
2
| $ dirb http://10.0.2.16
==> DIRECTORY: http://10.0.2.16/admin/
|
漏洞发现
利用strcmp()漏洞登录

查看几个菜单寻找可能存在的漏洞

拦截报文

修改报文

读取dashboard.php代码,发现不光存在任意文件读取,还存在命令注入。
获得权限
靶机测试
继续修改报告,插入反弹shell脚本

收到反弹shell

提权
passwd


获得webadmin
的密码是dragon
登录后
1
2
3
4
5
6
7
| $ sudo -l
Matching Defaults entries for webadmin on serv:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User webadmin may run the following commands on serv:
(ALL : ALL) /bin/nice /notes/*
|
虽然/notes目录不可写入
可以通过..跳出notes目录


最后修改于 2020-08-02