【注意】このサイトに記載されていることを他人に試すことは「不正アクセス禁止法」に該当する場合があります。詳しくはこちらから

ハッカーはNcrackでネットワーク認証のクラッキングを確認する(Kali Linux)

ホワイトハッカーの知識座学,Kali Linuxツール,Ncrack

ネットワーク認証のクラッキングを理解するためにまとめてみました。
このの動作確認は自分のドメインでテストを行っています。

Ncrackとは

Ncrackは、高速ネットワーク認証クラッキングツールです。
Ncrackは、企業が自社のネットワークを保護するために、すべてのホストやネットワーク機器に不適切なパスワードがないかどうかを積極的にテストするために開発されました。また、セキュリティの専門家は、クライアントを監査する際にNcrackを利用しています。

Ncrackは、モジュラーアプローチ、Nmapに似たコマンドライン構文、ネットワークからのフィードバックに基づいて動作を適応させることができるダイナミックエンジンを使用して設計されています。これにより、複数のホストの大規模な監査を迅速かつ確実に行うことができます。

機能

・ネットワーク操作を完全にコントロールできる柔軟なインターフェース
・非常に高度なブルートフォース攻撃の可能性、使いやすいタイミングテンプレート
・Nmapと同様のランタイムインタラクション
・サポートするプロトコルは、SSH、RDP、FTP、Telnet、HTTP(S)、POP3(S)、IMAP、SMB、VNC、SIP、Redis、PostgreSQL、MySQL、MSSQL、MongoDB、Cassandra、WinRM、OWA

ツールの場所

[Applications]→[05-Password Attacks]→[Ncrack]

ツールと使用方法

ncrack [Options] {target and service specification}

例 ncrack -user wp01 -P pass.txt http://192.168.56.2

【実行イメージ】少し端折って整形しています。

┌──(root__kali)-[/home/kali]
└─# ncrack -user wp01 -P pass.txt http://192.168.56.2
Starting Ncrack 0.7 ( http://ncrack.org ) at 2021-05-20 04:28 EDT
Ncrack done: 1 service scanned in 3.03 seconds.
Ncrack finished.

ターゲット仕様(TARGET SPECIFICATION)

Can pass hostnames, IP addresses, networks, etc.
ホスト名、IPアドレス、ネットワークなどを渡すことができます。
Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254

-iX <inputfilename>

Input from Nmap’s -oX XML output format.
Nmapの-oX XML出力フォーマットからの入力。

-iN <inputfilename>

Input from Nmap’s -oN Normal output format.
Nmapの-oNからの入力 通常の出力フォーマット。

-iL <inputfilename>

Input from list of hosts/networks.
ホスト/ネットワークのリストから入力

–exclude <host1[,host2][,host3],…>

Exclude hosts/networks.
ホスト/ネットワークを除外します。

–excludefile <exclude_file>

Exclude list from file.
ファイルからリストを除外する。

サービス仕様(SERVICE SPECIFICATION)

Can pass target specific services in <service>://target (standard) notation or using -p which will be applied to all hosts in non-standard notation.
Service arguments can be specified to be host-specific, type of service-specific (-m) or global (-g).
<service>://target(標準)表記ではターゲットを特定したサービスを、非標準表記ではすべてのホストに適用される-pを使用して渡すことができます。
サービスの引数は、ホスト固有、サービスの種類固有(-m)、グローバル(-g)のいずれかを指定できます。
Ex: ssh://10.0.0.10,at=10,cl=30 -m ssh:at=50 -g cd=3000
Ex2: ncrack -p ssh,ftp:3500,25 10.0.0.10 scanme.nmap.org google.com:80,ssl

-p <service-list>

services will be applied to all non-standard notation hosts.
サービスは、すべての非標準記法のホストに適用されます。

-m <service>:<options>

options will be applied to all services of this type.
オプションは、このタイプのサービスすべてに適用されます。

-g <options>

options will be applied to every service globally.
オプションは、すべてのサービスにグローバルに適用されます。

その他のオプション(Misc options)

ssl

enable SSL over this service.
このサービスのSSLを有効にします。

path <name>

used in modules like HTTP. ('=’ needs escaping if used)
HTTPなどのモジュールで使用されます。('=’が使われている場合はエスケープが必要)

db <name>

used in modules like MongoDB to specify the database.
は、MongoDB などのモジュールでデータベースを指定するために使用されます。

domain <name>

used in modules like WinRM to specify the domain.
WinRMなどのモジュールでドメインを指定するために使われます。

タイミングとパフォーマンス(TIMING AND PERFORMANCE)

Options which take <time> are in seconds, unless you append 'ms’ (milliseconds), 'm’ (minutes), or 'h’ (hours) to the value (e.g. 30m).
<time>を取るオプションは、「ms」(ミリ秒)、「m」(分)、「h」(時間)を値に追加しない限り、秒単位となります(例:30m)。

サービス別のオプション(Service-specific options)

cl (min connection limit)

minimum number of concurrent parallel connections.
同時並列接続の最小数

CL (max connection limit)

maximum number of concurrent parallel connections.
同時並列接続の最大数。

at (authentication tries)

authentication attempts per connection.
接続ごとに認証を試みる。

cd (connection delay)

delay <time> between each connection initiation.
各接続開始の間のdelay <時間>を設定します。

cr (connection retries)

caps number of service connection attempts to (time-out): maximum cracking <time> for service, regardless of success so far.
サービスへの接続試行回数の上限(タイムアウト):これまでの成功に関わらず、サービスへの最大クラッキング<タイム>。

-T<0-5>

Set timing template. (higher is faster)
タイミングテンプレートを設定します。高い方が速い

–connection-limit <number>

threshold for total concurrent connections.
総同時接続数の閾値を設定します。

–stealthy-linear

try credentials using only one connection against each specified host until you hit the same host again. Overrides all other timing options.
同じホストに再度アクセスするまで、指定された各ホストに対して1つの接続のみを使用して資格情報を試してください。 他のすべてのタイミングオプションを上書きします。

認証(AUTHENTICATION)

-U <filename>

username file.
ユーザー名のファイルです。

-P <filename>

password file.
パスワードファイル。

–user <username_list>

comma-separated username list.
コンマで区切られたユーザー名のリスト。

–pass <password_list>

comma-separated password list.
コンマで区切られたパスワードリスト。

–passwords-first

Iterate password list for each username. Default is opposite.
ユーザー名ごとにパスワードリストを繰り返します。デフォルトは反対です。

–pairwise

Choose usernames and passwords in pairs.
ユーザー名とパスワードは二人一組で決めましょう。

出力(OUTPUT)

-oN/-oX <file>

Output scan in normal and XML format, respectively, to the given filename.
スキャンデータを通常のフォーマットとXMLフォーマットでそれぞれ与えられたファイル名に出力します。

-oA <basename>

Output in the two major formats at once.
2つの主要なフォーマットで一度に出力できます。

-v

Increase verbosity level. (use twice or more for greater effect)
冗長性のレベルを上げる。2回以上使用するとより効果的です

-d[level]

Set or increase debugging level. (Up to 10 is meaningful)
デバッグレベルを設定または増加します。10までは意味があります

–nsock-trace <level>

Set nsock trace level. (Valid range: 0 – 10)
nsock のトレースレベルを設定します。有効範囲:0~10

–log-errors

Log errors/warnings to the normal-format output file.
エラー/ワーニングを通常のフォーマットの出力ファイルにログする。

–append-output

Append to rather than clobber specified output files.
指定された出力ファイルを破壊するのではなく、追加する。

その他(MISC)

–resume <file>

Continue previously saved session.
前回保存したセッションを継続する。

–save <file>

Save restoration file with specific filename.
復元ファイルを特定のファイル名で保存します。

-f

quit cracking service after one found credential.
は、クレデンシャルが1つ見つかっただけで、クラッキングサービスを終了します。

-6

Enable IPv6 cracking.
IPv6クラッキングを有効にする。

-sL or –list

only list hosts and services.
ホストとサービスのみを一覧表示します。

–datadir <dirname>

Specify custom Ncrack data file location.
カスタムNcrackデータファイルの場所を指定します。

–proxy <type://proxy:port>

Make connections via socks4, 4a, http.
socks4、4a、httpで接続します。

-V

Print version number.
プリントのバージョン番号。

-h

Print this help summary page.
このヘルプの概要ページを印刷する。

モジュール(MODULES)

SSH, RDP, FTP, Telnet, HTTP(S), WordPress, POP3(S), IMAP, CVS, SMB, VNC, SIP, Redis, PostgreSQL, MQTT, MySQL, MSSQL, MongoDB, Cassandra, WinRM, OWA, DICOM

例(EXAMPLES)

ncrack -v –user root localhost:22
ncrack -v -T5 https://192.168.0.1
ncrack -v -iX ~/nmap.xml -g CL=5,to=1h

Ncrackツールのまとめ

このNcrackツールはブラックハットハッカーではなく、セキュリティの専門家がペネトレーション・テストでホストとネットワーク・デバイスの脆弱なパスワードを分析するのに使われているそうです。

企業のネットワーク保護を支援するために設計されています。

実際にパラメーターを確認しながらテスト環境で動かしましたが、正常には終了するもののハッキング結果が表示されていません。

もうすこし調べたいと思います。