<dd id="sga4y"><optgroup id="sga4y"></optgroup></dd>
<nav id="sga4y"><code id="sga4y"></code></nav>
  • <optgroup id="sga4y"></optgroup>

    原文地址:http://drops.wooyun.org/papers/576

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

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

    過程還是很精彩的~

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

    先查看一下其DNS服務器:

    enter image description here

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

    enter image description here

    關于域傳送的漏洞,可以參考這里http://drops.wooyun.org/papers/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

    97av