「Recon For Web Pen-Testing!!」から偵察フェーズを学ぶ

ソース:

medium.com

訳:

偵察は、脆弱性潜在的な攻撃ベクトルを特定するためにターゲットに関する情報を収集するプロセスで。 
Web 侵入テストの偵察への段階的なアプローチについて、スケッチから始めてより高度なテクニックまで説明を。

 

Increase Your Attack Area

サブドメインを開始するときは常に、最初にパッシブ偵察を開始し。 以下では、私が使用しているすべてのツール/ウェブサイトについて説明を。 

 

DigDomain Information Groper の略で、ネームサーバーにクエリを実行して結果を表示することで DNS を検索

 

~#root㉿kali: dig target.com any

Go-Back in Time

robots.txt や URL などの古いファイルを表示するためのウェイバック マシン。

 

これを自動化するツール

 

waybuckurls.py

ダウンロード:https://gist.github.com/mhmdia/adf6bff70142e5091792841d4b372050

 

サブドメインの検出

Knockpy:

https://github.com/guelfoweb/knock

 

使い方:./knockpy target.com

 

Sublist3r:

https://github.com/aboul3la/Sublist3r

 

使い方:python sublis3r.py -d target.com -p 80 443

 

 

SubBrute:

https://github.com/TheRook/subbrute

 

使い方:./subbrute.py google.com

 

 

Google Dork:

site:target.com -site www.target.com

 

Onlineリソース:

https://dnsdumpster.com/
https://searchdns.netcraft.com/
https://www.virustotal.com (Go to search and
type target.com)
https://crt.sh/?q=%25paypal.com (Use “%target.com”. )

 

サブドメインサブドメインを検索する

一部の Web サイトには 5 レベルと 6 レベルのサブドメインがあり。

Tool: altdns (https://github.com/infosec-au/altdns)
Input : sub-domain list
Usage: ./altdns.py -i subdomains.txt -o
data_output -w words.txt -r -s output.txt

 

Tool: SubBrute

./subbrute.py target.com > sudomains.txt
Then
./subbrute.py –t subdomains.txt

 

dnsx: これは、retryabledns ライブラリを通じてさまざまなプローブを実行するために設計された高速で多目的の DNS ツールキットです。

使い方:https://github.com/projectdiscovery/dnsx

 

Ffuf: これは高速ディレクトリ ファジング ツールです。これを使用すると、より短い時間でより多くのディレクトリを列挙でき。

~#root㉿kali: ffuf -u https://targett.com/FUZZ -w /usr/share/wordlists/dirb/common.txt/

 

 

WaybackURls
+
Subdomains
+
Subdomains of Subdomains

 

サブドメインを検証する

ツール: EyeWitnes 

https://github.com/ChrisTruncer/EyeWitness

すべてのサブドメインのリストを提供すると、すべてのサブドメインスクリーンショットを含むレポートが表示されます。

使い方: ./EyeWitness.py -f subdomain.txt 

 

ターゲットのIPレンジの検証

url: https://whois.arin.net

url: https://bgp.he.net/

Search by Target IP

 

IPレンジの検証のケーススタディ

Patrik Fehrenbach (@ITSecurityguard)
Wrote a Bash script to download phpinfo.php
file (if found) from Yahoo! IP range
(98.136.0.0–98.139.255.255)

Bash Script

#!/bin/bash
for ipa in 98.13{6..9}.{0..255}.{0..255}; do
wget -t 1 -T 5 http://${ipa}/phpinfo.php; done&

 

Censys: ターゲットに関する有益な情報を提供してくれるもう 1 つの優れたオンラインツール

censys.io: https://censys.io/

 

Photon: 基本的に、Web サイトから多くの有用な情報を見つけるのに役立つデータ抽出ツールで

ダウンロード: https://github.com/s0md3v/Photon

使用法: python3 photon.py -u target.com — キー — DNS

 

 

DnsDumpster: dig に非常に似ていますがGUI を提供し

使用方法: https://dnsdumpster.com/

 

Github Recon

Github で何が見つかるでしょうか?

FTP認証情報
• 秘密キー [API_key、Aws_secret key など]
• 内部認証情報 [従業員認証情報]
APIエンドポイント
ドメインパターン

  • githubにアクセスして検索してください(例:
    - 「target.com」「dev」
    - 「dev.target.com」
    - 「target.com」API_key
    - 「target.com」のパスワード
    - 「api.target.com」

Googleもまた有用で

Dork:

site: “github.com” + “Target” + password

shodan: インターネットに接続されたデバイス用の世界初の検索エンジンで。Platfrom を探索して。

  • p Addresses.
  • SSL Certificates.
  • Services.
  • Favicon Hashes.
  • etc

 

Zoomeye: 別の検索エンジンであり、検索に使用でき

  • Web Servers.
  • IP & Ports.
  • Headers & Status Codes.
  • Vulnerabilities.
  • etc.

usage:https://www.zoomeye.org/

 

コンテンツディスカバリー

Google is your friend
• Use Google Dork to find:-
- File Extensions
- Parameters
- Login Page
- Sometimes Directory Structure
- Important Stuff

 

私はよく Google Dork を使ってファイルを検索し。
特定の拡張子も明らかになり、ターゲットが使用するテクノロジー

 

Google Dork:
-site:target.com filetype:php
- site:target.com filetype:aspx
- site:target.com filetype:swf (Shockwave Flash)
- site:target.com filetype:wsdl

Find Parameter

Google Dork:
- site: target.com inurl:.php?id=
- site: target.com inurl:.php?user=
- site: target.com inurl:.php?book=

Find Login Page

Google Dork
- site: target.com inurl:login.php
- site: target.com intext: “login”
- site: target.com inurl:portal.php
- site: target.com inurl:register.php

(Note: if site has register page, there are chances
that site also have login page)

 

Find Directory Structure

Google Dork:
-site: target.com intext: “index of /”

 

 

Tools:

Gobuster- 

https://github.com/OJ/gobuster

Dirsearch- https://github.com/maurosoria/dirsearch

Feroxbuster- https://github.com/epi052/feroxbuster

paramSpider- https://github.com/devanshbatham/ParamSpider

Usage: python3 paramspider.py — domain target.com

assetfinder: https://github.com/tomnomnom/assetfinder

subzy: https://github.com/LukaSikic/subzy

 

隠されたGETパラメータとPOSTパラメータを見つける

Bug Bounty 中に、いくつかの興味深いパラメータを発見し。
開発者は GET または POST クエリのパラメータを「 非表示 」にすることがありますが、これらのパラメータを見つけてペイロードを挿入することが興味深い場合もあり。
私は、Arjunという優れたツールを利用しており。
この Python スクリプトは、GET パラメータと POST パラメータにブルートフォース攻撃を実行し。

ダウンロード:

https://github.com/UltimateHackers/Arjun

 

LinkFinder: JavaScript ファイル内のエンドポイントとそのパラメータを検出するために作成された Python スクリプト

ダウンロード: https://github.com/GerbenJavado/LinkFinder

使用法: ./linkfinder.py -i https://target.com-o cli

 

 

脆弱性スキャン

Nuclei: これは非常に優れており、YAML で独自のテンプレートを作成したり、他のハッカーが作成した何千もの他のテンプレートを使用したりでき。

 

cat subs.txt | nuclei 
cat subs.txt | nuclei -t /nuclei-templates/<your template>



Nikto: https://github.com/sullo/nikto

TiDos: 多くのモジュールを備えた攻撃的な Web アプリケーション フレームワークです。偵察の実行から Web アプリケーションの攻撃まで、多くのペネトレーション テスト タスクに役立ち。

ダウンロード: https://github.com/0xInfection/TIDoS-Framework

使用法: ./tidos.py

注: TiDos のインストール ( https://www.youtube.com/watch?v=5a_GFWeovYI )

 

BurpSuite

Burp Suite のターゲットで Spider ツールを実行します
• スパイダーが終了したら、ホストを右クリックします。
「このホストの URL をコピー」をクリックします。 

Zscanner

コピーしたら、urls.txt に貼り付けます。
 • urls.txt ファイルを Zscanner のルートに置きます
  例えば。 c/xampp/htdocs/zscanner/urls.txt
 • ブラウザで zscanner を開きます

 

「スキャナーを開始」をクリックします
• /outputs/ フォルダーに 4 つのファイルが出力され。
 JS-output.txt、GET-output.txt、POSTHost-
 出力.txt、POSTデータ出力.txt
• JS-output.txt ファイルをコピーし、それをルートに置きます。
 JS-Scan ルート フォルダー
 例えば、 c/xampp/js-scan/JS-output.txt 

JS-Scan

Open JS-Scan in browser

 

• JS ファイルから抽出されたエンドポイントは、
ウェブページで定義されたエンドポイントに脆弱性がある
• 自動スキャナは通常スキャンを行いません、JS ファイルで定義されたエンドポイントに。
• 開発者とテスターはそれらを気にしません。

 

アマゾン ウェブ サービス (AWS または S3 バケット)

  • AWS Simple Storage Service (S3と短縮されることが多い) は、独自のストレージデポジトリを構築し維持することをを望まない企業によって使用され。
    Amazon Simple Storage Service を使用すると、
    オブジェクトやファイルを仮想サーバーに保存でき、物理的なラックの代わりに
  • ユーザーがバケットを作成した後、 ソースコードの保存を開始でき。証明書、パスワード、コンテンツ、データベース およびその他のデータ。

ターゲットが脆弱な場合はどうなりますか?

S3バケットへのフルアクセスを取得でき
ファイルをダウンロード、アップロード、上書きすることができ

S3 バケットを見つける方法は?

Burp Suiteも役に立ち。

AWS Hacking

ターミナルを開く

awscli を kali にインストールします: sudo apt-get install awscli

バケットと対話する: aws ls s3://hackerone-attachments

World Writable ディレクトリの検索: aws s3 mv test.txt s3://hackerone-attachments

 

ほなほな。