ロード・トゥ・ザ・ホワイトハッカー

ホワイトハッカーはじめました

KaliのToolたち

Kaliには多くのツールが用意されている。

 

こちらに一覧表示されて、一通りの説明がある。

tools.kali.org

 

12のカテゴリでリストアップされたツールの数は以下の通り。

カテゴリ カウント
Forensics Tools 23
Hardware Hacking 6
Information Gathering 67
Maintaining Access 17
Password Attacks 39
Reporting Tools 9
Reverse Engineering 11
Sniffing & Spoofing 33
Stress Testing 14
Vulnerability Analysis 27
Web Applications 43
Wireless Attacks 54

※2021年6月時点 

 

少し混乱するのが、実際のKaliのメニュー表示は、カテゴリも、ツールの表示数も異なること。

f:id:chikuwamaruX:20210626084408p:plain

上記は01-information gatheringを選択した画面。

サブカテゴリに分類され、表示されるのはわかりやすい。

 

メニューには、Dababase Assessment、PostExploitation、Social Engineering Toolsがあって、Maintaining Access、Stress Testingがない。

 

ツールの中には、複数のカテゴリにリストアップされているものがあり、集計すると以下の通り。

ツール名 カテゴリのカウント
THC-IPV6 5
Maltego Teeth 4
cisco-auditing-tool 3
Yersinia 3
Burp Suite 3
zaproxy 3
WebScarab 3
cisco-torch 3
sqlmap 3
DotDotPwn 2
FunkLoad 2
Ghost Phisher 2
HexorBase 2
diStorm3 2
inviteflood 2
iSMTP 2
iaxflood 2
dex2jar 2
CutyCapt 2
jboss-autopwn 2
copy-router-config 2
cisco-ocs 2
cisco-global-exploiter 2
chntpw 2
CaseFile 2
BBQSQL 2
crackle 2
Reaver 2
Xplico 2
Wireshark 2
Wifi Honey 2
sslstrip 2
SSLsplit 2
sqlsus 2
Sqlninja 2
smali 2
SIPArmyKnife 2
mdk3 2
Recon-ng 2
jSQL Injection 2
Powerfuzzer 2
polenum 2
Parsero 2
p0f 2
ohrwurm 2
Nmap 2
Nikto 2
Metagoofil 2
apktool 2
SET 2

 

THC-IPV6は、5つのカテゴリをカバーできると思うが、名前の通りIPv6のためのツール。

 

その他のツール、見覚えがある名前だと思ったら、CEHのテキストに登場していました。 

 

ツールの多さに途方に暮れてしまいますが、まずは、

 あたりで、使えるツールを調べよう。

 

つ・づ・く

 

 

 

ECE登録 ~その1~

初めてのECE(EC-Council Continuing Education)取得

どのカテゴリもハードルが高そうで、まずは「Education Seminar/Conference/Event」で1時間1ポイントが取得できるかに挑戦。

 

ポイントを得るためには、

「Submit any document/email confirmation/badge which confirms you attended the IT Security event.」

ということで、何かしらの証明が必要らしい。

 

対象イベント

enq.itmedia.co.jp

 

5日間のライブ配信セミナーで、特に受講票などもない。

参加登録しても、セミナー配信URLが送信されてくるだけ。

 

確かに、コロナ以前は受講票とかメールで送信してくれていたが、

オンラインで受講した証明ってどうすれば良いのか?

 

仕方がないので、オンラインセミナーの開始と終了の画面コピーをPCの日時と合わせて取得しておいた。

 

その後、以下のイベント登録画面から、登録して申請する。

 

f:id:chikuwamaruX:20210619092154p:plain

 

ハマりポイント
  • 登録日付が1日単位
  • 添付できるファイルのサイズが2MBまで
  • インジェクション防止のためか、記号が入力できない

パワポに画面コピーを貼っていたら、ファイルサイズが凄いことに。

パワポの各ページをJPGに変換して、さらにそのサイズを縮小して、Zipに圧縮してアップロード。

 

ホントにこれで、認めてもらえるのだろうか。

 

結果

2-3日経過後サイトをのぞくと、「Approved」、ということで8ポイントゲット!

f:id:chikuwamaruX:20210619092724p:plain

 

この種のイベントでポイントが取得できるなら、3年で120ポイントは大丈夫かも。

 

オンラインセミナーは後日、アーカイブが出るので、同じ方法で出来るかわかりませんが、ポイントを取得するのがECEの趣旨ではないと思うので、継続的に知識を蓄えます。

 

つ・づ・く

 

CEH継続の道のり

CEHを維持するために、1年間80ドルの費用とECE(EC-Council Continuing Education)ポイントを3年間で120貯めないといけない。

 

専用のWEBサイトが割り当てられ、そこで管理される。

 

1年間80ドルの費用

f:id:chikuwamaruX:20210619084952p:plain

試験に合格した月の、1年後の翌月までに、80ドルを支払う必要があるらしい。

 

ECE(EC-Council Continuing Education)ポイント

f:id:chikuwamaruX:20210619085526p:plain

2024年の5月31日までに、120ポイントを貯める必要がある。

 

 

上記の「Event Type」が以下の25種類の「Category Name」のいずれかになる。

その多くは、意味が不明、または意味が分かっても無理、と思えるもの。

Category Name Category Credits Proof Of Specification
Association/Organization Chapter Meeting (per Meeting) 1 Submit any document/email confirmation which confirms you attended the chapter-based IS-related organizations meeting.
Association/Organization Chapter Membership (per Association/Organization) 3 Submit any document/email confirmation which confirms you are the member of chapter-based IS-related organizations.
Association/Organization Membership (per Association/Organization) 2 Submit any document/email confirmation which confirms you are the member of IS-related organizations.
Author Article/Book Chapter/White Paper 20 Submit any email confirmation/ web link which confirms you are the author of an IS-related article/book chapter/white paper. Note - Publication of material on personal blogs is not eligible for credits.
Author Security Tool 40 Submit the web link which confirms you are the author of the Security tool.
Authoring Book 100 Submit any document/ web link which confirms you are the author of an IS-related book which published traditionally or on an electronic book site.
Authoring Course/Module 40 Submit the publicly available link/ web page of the course that displays the authors name is required to be submitted. In case of a physical book, an announcement publicly available will be accepted.
Certification Examination Related to IT Security 40 Submit the digital copy of the IT Security related exam certificate.
EC-Council Beta Exam Testing 80 Official document/email confirmation which confirms you have completed the EC-Council Beta Exam.
EC-Council ECE Examinations 120 Submit the digital copy of the EC-Council exam certificate.
EC-Council Exam Survey 20 Official document/email confirmation which confirms you have completed the EC-Council exam survey.
EC-Council Item Writing 100 Official document/email confirmation which confirms you have participated in the EC-Council Item Writing.
EC-Council Job Task Analysis Survey 40 Official document/email confirmation which confirms you have completed the EC-Council JTA survey.
EC-Council Review Board 80 Official document/email confirmation which confirms you are the review board member at EC-Council.
EC-Council Standard Setting 60 Official document/email confirmation which confirms you have participated in the EC-Council Standard Setting.
Education Course 1 Submit the course completion certificate. Note - Courses for which no course completion certificate is given are not eligible for credits.
Education Seminar/Conference/Event 1 Submit any document/email confirmation/badge which confirms you attended the IT Security event.
Higher Education Per Quarter 10 Submit a scanned copy of the Official Web based transcript from college/university which would have the grades is required.
Higher Education Per Semester 15 Submit a scanned copy of the Official Web based transcript from college/university which would have the grades is required.
Identify New Vulnerability 10 Submit any proof of the disclosed vulnerability and documented evidence claiming the ownership of the report published in a public forum. Vulnerabilities that are not disclosed publicly cannot be granted ECE credits.
Presentation 3 Submit any document/email confirmation which confirms you were the speaker or presenter of the IT Security event. Note - Members may not claim additional credits for presenting the same topic multiple times.
Reading an Information Security Book/Article Review/Book Review/Case Study 5 Provide book/article/case study review of minimum 250-500 words. The review should be presented with clarity of points and it is not plagiarized.
Teach New 21 Submit a scanned copy of a letter from the head of the department/company/organization on official letterhead indicating that you are or were the instructor for the IT Security course.
Teach Upgrade 11 Submit a scanned copy of a letter from the head of the department/company/organization on official letterhead indicating that you are or were the instructor for the IT Security course. Note - Instructors may not claim additional credits for teaching the same material multiple times. If course syllabus is updated every year then only you can claim credits.
Volunteering in public sector 1 Submit letter from the concerned public sector authority about the number of hours volunteered.

 

取得の履歴を以下に掲載します。

 

chikuwamarux.hatenablog.com

 

 

chikuwamarux.hatenablog.com

 

 

chikuwamarux.hatenablog.com

 

 

chikuwamarux.hatenablog.com

 

 

どのモジュールを使うんだMetasploit Framework

Metasploit Frameworkでいろいろ出来ることが分かった。

4000以上あるモジュールから、どれを使うのか、さっぱり分からない。

 

ここには、POSTとAUXILIARY モジュールについてのリファレンスのみがある。

www.offensive-security.com

 

 

Kaliでは、msfconsoleからsearchコマンドで検索して、info <モジュール名>とすることで、モジュールの使用方法などが分かる。

 

Searchコマンドで探す方法

Usage: search [<options>] [<keywords>:<value>]

Prepending a value with '-' will exclude any matching results.
If no options or keywords are provided, cached results are displayed.

OPTIONS:
-h Show this help information
-o <file> Send output to a file in csv format
-S <string> Regex pattern used to filter search results
-u Use module if there is one result

Keywords:
aka : Modules with a matching AKA (also-known-as) name
author : Modules written by this author
arch : Modules affecting this architecture
bid : Modules with a matching Bugtraq ID
cve : Modules with a matching CVE ID
edb : Modules with a matching Exploit-DB ID
check : Modules that support the 'check' method
date : Modules with a matching disclosure date
description : Modules with a matching description
fullname : Modules with a matching full name
mod_time : Modules with a matching modification date
name : Modules with a matching descriptive name
path : Modules with a matching path
platform : Modules affecting this platform
port : Modules with a matching port
rank : Modules with a matching rank (Can be descriptive (ex: 'good') or numeric with comparison operators (ex: 'gte400'))
ref : Modules with a matching ref
reference : Modules with a matching reference
target : Modules affecting this target
type : Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)

 

モジュールのドキュメントの確認

Kali の以下のディレクトにドキュメントらしきものが用意されている。すべてのモジュールのドキュメントがあるわけではない。

/usr/share/metasploit-framework/documentation/modules/

 

Githubにも上がっている。

github.com

 

OSやサービスごとにフォルダが分かれていて、全体像をつかみやすい。

 

こんなサイトもあったが、searchコマンドのWebUIのような感じ。

www.infosecmatter.com

 

 

Meterpreterについて

以下のドキュメントから

Meta-Interpreterの略で、dllインジェクションが、、、

というところから理解が進みました。

github.com

 

つ・づ・く

 

 

少しずつ理解するMetasploit

ExploitsとPayloadについて、なかなか理解が進まない。

 

よくある。「〇〇の脆弱性により、任意のコードが実行される」という不具合の情報。

 

Exploits=〇〇の脆弱性を突く

Payload=任意のコード実行

という風に理解しました。

 

Exploitの種類
  • Active
  • Passive
Payloadの種類
  • SINGLES
  • STAGERS
  • STAGES
上記以外のPayload
  • INLINE (NON STAGED)
  • METERPRETER
  • PASSIVEX
  • NONX
  • ORD
  • IPV6
  • REFLECTIVE DLL INJECTION

といろいろあるのですが、ここら辺から、混乱。

 

用語の解説に関しては、こちらを参考にさせていただきました。

cysec148.hatenablog.com

 

Payloadに関してはこちら。

www.atmarkit.co.jp

 

要するに、Exploitが成功すれば、任意のPayloadを流し込めて、

例えば、

  • リモートでバッチコマンドを実行
  • exeファイルを送りこんで実行させる
  • VNC接続を可能にする 

などを可能にして、PCを完全に乗っ取ることができる。

 

あらかじめMetasploitに豊富に用意されているし、

自分でカスタマイズすることもできる。

 

あー、おそろしや~。

 

 

 

 

 

 

CEHはつづくよ、どこまでも

CEH合格後、以下の件名のメールが届く。

You Rock! You Passed CEH, You’ve Earned a $450 Gift Card!

 

え?そんなご褒美あるの?と、スパムメールと疑いつつメールを見る。

CEH (Practical) の受験料$550が、今なら$100です、とのこと。

 

さすが商売熱心なEC-Council。。。

でも、CEH Practicalって、なんだ?

 

一応、以下のような資格体系になっているらしい。

f:id:chikuwamaruX:20210612090915p:plain

CEH (Practical)は6時間の実技試験で、20問のうち、7割正解で合格、とのこと。

それに合格すると「Master」として認められる。

 

そして全体像は、こんな感じ。

 

f:id:chikuwamaruX:20210612090908p:plain

Certified Ethical Hacker (Practical) | C|EH (Practical) | EC-Council

 

100ドルなら受験してみるか、という気もしてくるけれど、事前対策方法が分からないので、2-3回受験することになるのでしょう。

 

つ・づ・く、のか?

 

 

chikuwamarux.hatenablog.com

 

 

どこからはじめるMetasploit

さて、どうしたらMetasploit使いになれるのか。

 

この辺りの本を読んでみても、若干情報が古いのか、イマイチ理解が進まない。

 

本家サイトでは、有料版のGUIの解説がメインで、Metasploit Frameworkについて記述は少ない。

docs.rapid7.com

 

 

Kaliのツール紹介ページにある、動画風デモを見ていると、流れがつかめて、とても分かりやすかった。

tools.kali.org

  

上記にリンクがあり、ここにたどり着く。必要な情報が網羅されている感じです。

www.offensive-security.com

 

まずは、この辺りで一通りMetasploitに馴染んでみることにする。

 

 

 動画風デモのコマンド詳細

 Metasploit Framework | Penetration Testing Tools (kali.org)

の動画風デモで使用されている各コマンドを調査。

 

msfconsole

コンソールを開くときに、DB接続のために、msfdb initをその前に叩く。

msfdb init & msfconsole
 

Usage: msfconsole [options]

Common options:

-E, --environment : ENVIRONMENT Set Rails environment, defaults to RAIL_ENV environment variable or 'production'

Database options:

-M, --migration-path : DIRECTORY Specify a directory containing additional DB migrations
-n, --no-database : Disable database support
-y, --yaml : PATH Specify a YAML file containing database settings

Framework options:

-c : FILE Load the specified configuration file
-v, -V, --version : Show version

Module options:

--defer-module-loads : Defer module loading unless explicitly asked
-m, --module-path : DIRECTORY Load an additional module path

Console options:

-a, --ask : Ask before exiting Metasploit or accept 'exit -y'
-H, --history-file : FILE Save command history to the specified file
-l, --logger : STRING Specify a logger to use (Flatfile, StdoutWithoutTimestamps, TimestampColorlessFlatfile, Stderr, Stdout)
-L, --real-readline : Use the system Readline library instead of RbReadline
-o, --output : FILE Output to the specified file
-p, --plugin : PLUGIN Load a plugin on startup
-q, --quiet : Do not print the banner on startup
-r, --resource F: ILE Execute the specified resource file (- for stdin)
-x, --execute-command : COMMAND Execute the specified console commands (use ; for multiples)
-h, --help : Show this message

 

 workspace -a msftest  

ワークスペースの追加 

【その他オプション】

(ブランク) : List workspaces
-v : List workspaces verbosely
[name] : Switch workspace
-a [name] : Add workspace(s)
-d [name] : Delete workspace(s)
-D : Delete all workspaces
-r : Rename workspace
-h : Show this help information

 

clear 

コンソールのクリア

【その他オプション】

-T : TERM use this instead of $TERM
-V : print curses-version
-x : do not try to clear scrollback

 

db_nmap -F 192.168.0.1-10

nmapで取得した結果をdbに格納する。

Usage: db_nmap [--save | [--help | -h]] [nmap options]

  

hosts

dbに格納されたホストの情報の一覧表示。

Usage: hosts [ options ] [addr1 addr2 ...]

【その他オプション】

-a,--add : Add the hosts instead of searching
-d,--delete : Delete the hosts instead of searching
-c <col1,col2> : Only show the given columns (see list below)
-C <col1,col2> : Only show the given columns until the next restart (see list below)
-h,--help : Show this help information
-u,--up : Only show hosts which are up
-o <file> : Send output to a file in csv format
-O <column> : Order rows by specified column number
-R,--rhosts : Set RHOSTS from the results of the search
-S,--search : Search string to filter by
-i,--info : Change the info of a host
-n,--name : Change the name of a host
-m,--comment : Change the comment of a host
-t,--tag : Add or specify a tag to a range of hosts

 

services

dbに格納されたサービスの利用状況の一覧表示。

 

Usage: services [-h] [-u] [-a] [-r <proto>] [-p <port1,port2>] [-s <name1,name2>] [-o <filename>] [addr1 addr2 ...]

【その他オプション】

-a,--add : Add the services instead of searching
-d,--delete : Delete the services instead of searching
-c <col1,col2> : Only show the given columns
-h,--help : Show this help information
-s <name> : Name of the service to add
-p <port> : Search for a list of ports
-r <protocol> : Protocol type of the service being added [tcp|udp]
-u,--up : Only show services which are up
-o <file> : Send output to a file in csv format
-O <column> : Order rows by specified column number
-R,--rhosts : Set RHOSTS from the results of the search
-S,--search : Search string to filter by
-U,--update : Update data for existing service

 

use auxiliary/scanner/ssh/ssh_version

使用するモジュールを指定する。

 

Usage: use <name|term|index>

Interact with a module by name or search term/index.
If a module name is not found, it will be treated as a search term.
An index from the previous search results can be selected if desired.

 

【モジュールの種類】 
  • auxiliary - ポートスキャンやバージョン検出、ネットワークトラフィックの解析など、攻撃者の様々な作業を補助するモジュール。
  • exploit - 脆弱性を利用して、バッファオーバーフローを起こしたり認証を迂回して、ペイロードの実行をできるようにするコード。
  • payload - リモート接続の確立や meterpreter セッションの開始、シェルコマンドの実行など、exploit が成功した後にすぐ実行すること。
  • post - exploit とリモート接続が成功した後に、パスワードを盗取したりキーロガーを設定、あるいはファイルをダウンロードするために実行する様々なプログラム。
  • encoder - 暗号化を実行するためのプログラム。
  • nop - NOP ジェネレータ。NOP は何もしないアセンブリ言語の命令です。この命令の機械語はハードウェアのアーキテクチャによって異なります。NOP 命令は実行可能ファイルの空白を埋めるのに有用です。

Metasploit Framework - ArchWiki から引用

 

options

 各モジュールの設定オプションを表示する。

 

services -u -p 22 -R

 -RでRHOSTSに対して22番ポートを使用しているものを設定する。

 

setg threads 10

グローバル変数に値をセットする。

 

通常の変数にはsetを使用する。

 Usage: set [option] [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.

  

run

モジュールの実行

 

モジュール選択 ⇒ RHOST設定 ⇒実行

use auxiliary/scanner/http/http_version

services -u -p 80 -R

run

 

モジュール選択 ⇒ RHOST設定 ⇒実行

use auxiliary/scanner/smb/smb_version

services -u -p 445 -R

run

services 192.168.0.6

ホストのサービスを表示

 

search xampp

xamppに関するモジュールを検索する 


Usage: search [<options>] [<keywords>:<value>]

Prepending a value with '-' will exclude any matching results.
If no options or keywords are provided, cached results are displayed.

 

【その他オプション】

-h Show this help information
-o <file> Send output to a file in csv format
-S <string> Regex pattern used to filter search results
-u Use module if there is one result

 

Keywords:

aka : Modules with a matching AKA (also-known-as) name
author : Modules written by this author
arch : Modules affecting this architecture
bid : Modules with a matching Bugtraq ID
cve : Modules with a matching CVE ID
edb : Modules with a matching Exploit-DB ID
check : Modules that support the 'check' method
date : Modules with a matching disclosure date
description : Modules with a matching description
fullname : Modules with a matching full name
mod_time : Modules with a matching modification date
name : Modules with a matching descriptive name
path : Modules with a matching path
platform : Modules affecting this platform
port : Modules with a matching port
rank : Modules with a matching rank (Can be descriptive (ex: 'good') or numeric with comparison operators (ex: 'gte400'))
ref : Modules with a matching ref
reference : Modules with a matching reference
target : Modules affecting this target
type : Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)

 

Examples:
search cve:2009 type:exploit
search cve:2009 type:exploit platform:-linux

 

show payloads

 ペイロードの表示

 

valid parameters for the "show" command are:

all, encoders, nops, exploits, payloads, auxiliary, post, plugins, info, options