老外的一份滲透測試報告

wyzsk發表於2020-08-19
作者: 瞌睡龍 · 2013/09/10 20:13

From:penetration-testing-sample-report-2013.pdf

offensive security出的一份滲透測試報告,翻譯了下重點內容 :)

過程還是很精彩的~

本次測試的域名為:megacorpone.com

先檢視一下其DNS伺服器:

enter image description here

然後發現 ns2.megacorpone.com 存在域傳送漏洞。

enter image description here

關於域傳送的漏洞,可以參考這裡/papers/?id=64

從圖片中可以看出域名都在50.7.67.x的IP段內,網路拓撲圖:

enter image description here

在admin.megacorpone.com伺服器的81埠發現了apache的webserver,然後掃一下檔案路徑:

enter image description here

可以看到/admin是一個需要身份驗證的路徑。

enter image description here

根據www.megacorpone.com網站內容做了一個字典,爆破密碼,使用者名稱就用admin了。

enter image description here

破解出密碼為:nanotechnology1

進入後介面:

enter image description here

可以看到是一套phpSQLiteCMS,管理SQLite資料的:

透過此頁面可以直接查詢使用者名稱和密碼的hash:

enter image description here

測試發現儲存的hash並非常規的方式,於是下載一份phpselitecms觀察其中的hash方式:

enter image description here

知道了hash的方式是使用使用了一個10位字元的salt一起做sha1,並且字串拼接原始salt一起放在資料庫中。

我們採用同樣的hash方式來暴力碰撞密碼,嘗試破解其他賬戶,又破解出兩個來,收集密碼的好處是可能其他系統也會使用相同的使用者名稱密碼,這樣就可以輕鬆的進入了。

SQLite Manager軟體存在一個已公開的程式碼注入漏洞,可以使用exp直接打:

http://www.exploit-db.com/exploits/24320/

enter image description here

反彈回shell:

enter image description here

伺服器拓撲:

enter image description here

同時發現伺服器可以提權,利用exp提權:

http://www.exploit-db.com/exploits/18411/

enter image description here

此時已經完全控制此臺伺服器。

然後好好的分析了一下此臺伺服器,檢視到web目錄下java應用只允許一個網段來訪問。

後來發現這個管理員網路之一:

enter image description here

我們在web客戶端增加了一個Java小程式,可以直接控制遠端客戶端。

(PS:出了這麼多Java 0day不知道直接掛到頁面上,老外的中馬率怎麼樣)

在管理員下載並允許後:

enter image description here

此時網路拓撲:

enter image description here

發現管理員的電腦在域中,開始提升到域管理員。

發現系統中有一個組管理檔案。

(ps:關於這個專門去查了一下是2008域管理存在的一個問題:http://www.carnal0wnage.com/papers/LARES-GPP.pdf

metasploit上有rb指令碼可以查詢xml檔案並解密:https://github.com/rapid7/metasploit-framework/blob/master/modules/post/windows/gather/credentials/gpp.rb

enter image description here

檢視groups.xml檔案:

enter image description here

解密:

enter image description here

解密的ruby指令碼貼出來:

使用方法是:

#ruby decrypt.rb 密文


#!ruby
require 'rubygems'
require 'openssl'
require 'base64'

#encrypted_data = "AzVJmXh/J9KrU5n0czX1uBPLSUjzFE8j7dOltPD8tLk"

encrypted_data = ARGV

def decrypt(encrypted_data)
  padding = "=" * (4 - (encrypted_data.length % 4))
  epassword = "#{encrypted_data}#{padding}"
  decoded = Base64.decode64(epassword)

   key = "\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b"
  aes = OpenSSL::Cipher::Cipher.new("AES-256-CBC")
  aes.decrypt
  aes.key = key
  plaintext = aes.update(decoded)
  plaintext << aes.final
  pass = plaintext.unpack('v*').pack('C*') # UNICODE conversion

   return pass
 end

blah = decrypt(encrypted_data)
puts blah 

嘗試用plink埠轉發,把內網的遠端桌面連線轉發出來,但是被阻斷了:

enter image description here

測試後發現可以透過HTTP-Tunnel轉發出來:

http://http-tunnel.sourceforge.net/

登陸的使用者名稱密碼採用的是SQLite Manager應用中的mike使用者。

enter image description here

此時網路拓撲圖:

enter image description here

開啟IE的預設主頁發現了Citrix伺服器,用跟遠端連線相同的使用者名稱和密碼進入:

enter image description here

Citrix環境當中,做了沙盒,只能使用IE,但是可以繞過。

使用IE的儲存,彈出的對話方塊,新建一個powershell的bat批處理:

enter image description here

enter image description here

enter image description here

利用powershell下載metasploit的反彈程式

enter image description here

下載完畢後,在儲存對話方塊中已管理員的許可權執行

enter image description here

這樣就獲得了Citrix系統的許可權

enter image description here

此時網路拓撲:

enter image description here

在Citrix上,嘗試從記憶體中獲取使用者名稱密碼:

enter image description here

這裡包含了很多的使用者名稱和密碼,其中還包括一個windows域管理員的。

給Citrix伺服器建立了一個遠端連線服務並使用域管理員登陸:

enter image description here

至此已經完全控制了windows域。

enter image description here

本文章來源於烏雲知識庫,此映象為了方便大家學習研究,文章版權歸烏雲知識庫!

相關文章