Pumpkin Garden 靶場實戰

靶場是實戰的演習,通過靶場能學習很多東西,這樣下次遇到類似的問題,就知道該怎麼做了。

此次的靶場,我獨立完成了60~70%,剩下的因爲自己的粗心和知識面問題,導致錯失100%完成度。好了,廢話不多說,我會在過程中詳細說明自己的思路。

一、信息收集

nmap掃描

我平時使用的最多的是這條nmap命令:

nmap -sV -sC -A -Pn -oN ip.txt ip

但是這次的靶場,我只掃出了一個21端口,只有使用了下面這條語句,才能完整把這次的靶場端口全掃出來。

nmap -sT -sV -A -p- -Pn -T5 -oN ip.txt ip

區別在哪裏

-p-、T5和-sT

1、-p是指定端口,-p-是指定1-65535,也就是全端口掃描。

2、sT Tcp connect() scan,不同於sS(半開式掃描,不需要完整的TCP三次握手也能獲取主機信息),sT需要建立三次握手

3、T5 這裏的T後跟0 ~ 5,默認的是T3,數字越大,代表掃描速度越快,之所以分爲不同的掃描速度等級,是爲了根據實際情況用於IDS躲避,比如0~1這兩種模式。這裏設置爲T5是因爲靶機在本地虛擬機,沒有IDS保護。

造成第一次掃描不全面的原因,是因爲少了指定全端口掃描-p-式掃描,已驗證。

貼上端口信息:

21/tcp   open  ftp     vsftpd 2.0.8 or later
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_-rw-r--r--    1 0        0              88 Jun 13 00:02 note.txt
| ftp-syst:
|   STAT:
| FTP server status:
|      Connected to 172.16.230.1
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 1
|      vsFTPd 3.0.2 - secure, fast, stable
|_End of status
1515/tcp open  http    Apache httpd 2.4.7 ((Ubuntu))
|_http-server-header: Apache/2.4.7 (Ubuntu)
|_http-title: Mission-Pumpkin
3535/tcp open  ssh     OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   1024 d8:8d:e7:48:3a:3c:91:0e:3f:43:ea:a3:05:d8:89:e2 (DSA)
|   2048 f0:41:8f:e0:40:e3:c0:3a:1f:4d:4f:93:e6:63:24:9e (RSA)
|   256 fa:87:57:1b:a2:ba:92:76:0c:e7:85:e7:f5:3d:54:b1 (ECDSA)
|_  256 fa:e8:42:5a:88:91:b4:4b:eb:e4:c3:74:2e:23:a5:45 (ED25519)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

同時打開目錄掃描工具,掃描http://172.16.230.154:1515/,網站端口不在默認的80端口。

二、FTP

看到ftp支持匿名訪問,於是
在這裏插入圖片描述

由於是匿名,所以password無論輸入什麼都會讓你成功登錄。打開下載的note.txt內容:

Hello Dear!
Looking for route map to PumpkinGarden? I think jack can help you find it.

ok.

三、Getshell

掃描目錄發現/img/目錄
在這裏插入圖片描述
打開clue.txt,內容:

c2NhcmVjcm93IDogNVFuQCR5

使用base64進行解碼:
scarecrow : 5Qn@$y

看起來像是賬號密碼?使用ssh進行嘗試

ssh -p 3535 [email protected]

OK,成功進入
在這裏插入圖片描述
ls,看到還有一個note.txt,打開:

Oops!!! I just forgot; keys to the garden are with LordPumpkin(ROOT user)!
Reach out to goblin and share this "Y0n$M4sy3D1t" to secretly get keys from LordPumpkin.

這裏我的工地英文使我陷入了尷尬,我一度卡在這裏,因爲我認爲這裏給的信息是使用:LordPumpkin:Y0nM4sy3D1tgoblin:Y0nM4sy3D1t去切換用戶,後來仔細閱讀發現並不是!而是goblin:Y0nM4sy3D1t,粗心啊!

ok,切換用戶執行,推薦使用ssh登錄goblin

在這裏插入圖片描述
發現goblin還是有個note,內容:

Hello Friend! I heard that you are looking for PumpkinGarden key.
But Key to the garden will be with LordPumpkin(ROOT user), don't worry, I know where LordPumpkin had placed the Key.
You can reach there through my backyard.

Here is the key to my backyard
https://www.securityfocus.com/data/vulnerabilities/exploits/38362.sh

四、提權

由於某些不可抗力因素,我無法下載到這個腳本,於是乎,查看別人的wirteup,手敲了一遍這個shell腳本,敲的時候我還有些鬱悶,這不是一些shell命令麼?貼上:
在這裏插入圖片描述

好的,使用python -m simpleHTTPServer 8086將本地的腳本下載到靶機。但是執行過程總是失敗,我以爲執行這個就可以,後來我終於瞭解它的用法了,兩種用法:

第一種:

從cd /tmp開始,依次執行到第19行,會發現已經提權成root權限。
在這裏插入圖片描述
第二種:

./38364.sh (你有權限編輯的文件)

這裏因爲靶機每隔15s就會刪除你的文件,嫌麻煩就沒去試了。

最終拿到PumpkinGarden_Key

也就是最終的flag
在這裏插入圖片描述
base64解密,Congratulations!

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