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

ハッカーはdnschefで高度な設定が可能なDNSプロキシを使って偽装する(Kali Linux)

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

高度な設定が可能なDNSプロキシを使っての偽装方法を理解するためにまとめてみました。
この動作確認は自分のドメインでテストを行っています。

dnschefとは

DNSChefは、Penetration TesterやMalware Analysts向けの、高度な設定が可能なDNSプロキシです。DNSプロキシ(別名「Fake DNS」)は、アプリケーション・ネットワーク・トラフィックの分析などに使用されるツールです。例えば、DNS プロキシは、「badguy.com」へのリクエストを偽装して、インターネット上のどこかにある実際のホストではなく、ローカルマシンを指すように仕向けたり、傍受したりするのに使用できます。

機能

・DNSへの問い合わせをインターセプトして差し替える

ツールの場所

[Applications]→[09-Sniffing & Spoofing]→[Network Sniffers]→[dnschef]

ツールと使用方法

dnschef [options]:
 
例 dnschef –file=yahoo.dns
 
【実行イメージ】少し端折って整形しています。
┌──(root__kali)-[/home/kali]
└─# dnschef --file=yahoo.dns
         | | version 0.4  | |        / _|
       __| |_ __  ___  ___| |__   ___| |_
      / _` | '_ \/ __|/ __| '_ \ / _ \  _|
     | (_| | | | \__ \ (__| | | |  __/ |
      \__,_|_| |_|___/\___|_| |_|\___|_|
                   iphelix@thesprawl.org
(10:10:33) [*] DNSChef started on interface: 127.0.0.1
(10:10:33) [*] Using the following nameservers: 8.8.8.8
(10:10:33) [*] Cooking A replies for domain *.yahoo.co.jp with '192.168.56.2'

オプション(optional arguments)

-h, –help

show this help message and exit.
このヘルプメッセージを表示して終了します。

–fakedomains thesprawl.org,google.com

A comma separated list of domain names which will be resolved to FAKE values specified in the the above parameters. All other domain names will be resolved to their true values.
上記のパラメータで指定されたFAKE値に解決されるドメイン名のコンマ区切りリストです。その他のドメイン名は、真の値に解決されます。

–truedomains thesprawl.org,google.com

A comma separated list of domain names which will be resolved to their TRUE values. All other domain names will be resolved to fake values specified in the above parameters.
TRUE の値に解決されるドメイン名のコンマ区切りリストです。それ以外のドメイン名は、上記のパラメータで指定した偽の値に解決されます。

偽のDNSレコード(Fake DNS records)

–fakeip 192.0.2.1

IP address to use for matching DNS queries. If you use this parameter without specifying domain names, then all 'A’ queries will be spoofed. Consider using.
DNSクエリのマッチングに使用するIPアドレスです。ドメイン名を指定せずにこのパラメータを使用した場合、すべての「A」クエリが偽装されます。使用を検討してください。

–file

argument if you need to define more than one IP address.
複数のIPアドレスを定義する必要がある場合は、引数

–fakeipv6 2001:db8::1

IPv6 address to use for matching DNS queries. If you use this parameter without specifying domain names, then all 'AAAA’ queries will be spoofed. Consider using.
DNSクエリのマッチングに使用するIPv6アドレスです。ドメイン名を指定せずにこのパラメータを使用した場合、すべての「AAAA」クエリが偽装されます。使用を検討してください。

–file

argument if you need to define more than one IPv6 address.
複数のIPv6アドレスを定義する必要がある場合は、次の引数を使用します。

–fakemail mail.fake.com

 
MX name to use for matching DNS queries. If you use this parameter without specifying domain names, then all 'MX’ queries will be spoofed. Consider using.
DNSクエリのマッチングに使用するMX名です。ドメイン名を指定せずにこのパラメータを使用した場合、すべての「MX」クエリが偽装されます。使用を検討してください。

–file

argument if you need to define more than one MX record.
複数のMXレコードを定義する必要がある場合は、次の引数を使用します。

–fakealias www.fake.com

CNAME name to use for matching DNS queries. If you use this parameter without specifying domain names, then all 'CNAME’ queries will be spoofed. Consider using.
DNSクエリのマッチングに使用するCNAME名です。ドメイン名を指定せずにこのパラメータを使用した場合、すべての「CNAME」クエリが偽装されます。使用を検討してください。

–file

argument if you need to define more than one CNAME record.
複数のCNAMEレコードを定義する必要がある場合は、次の引数を使用します。

–fakens ns.fake.com

NS name to use for matching DNS queries. If you use this parameter without specifying domain names, then all 'NS’ queries will be spoofed. Consider using.
DNSクエリのマッチングに使用するNS名です。ドメイン名を指定せずにこのパラメータを使用した場合、すべての「NS」クエリが偽装されます。使用を検討してください。

–file

argument if you need to define more than one NS record.
複数のNSレコードを定義する必要がある場合は、次の引数を使用します。

–file FILE

Specify a file containing a list of DOMAIN=IP pairs (one pair per line) used for DNS responses. For example: go ogle.com=1. 1.1.1 will force all queries to  'google.com ' to be resolved to '1.1.1.1’. IPv6 addresses will be aut omatically detected. You can be even more specific by combining.
DNSの応答に使用するDOMAIN=IPのペアのリスト(1行に1ペア)を含むファイルを指定します。例:go ogle.com=1. 1.1.1.1」と指定すると、「google.com」へのすべての問い合わせが「1.1.1.1」に解決されます。IPv6アドレスは自動的に検出されます。さらに、以下のように組み合わせると、より具体的になります。

–file with

other arguments. However, data obtained from the file will take precedence over others.
他の引数を使用します。ただし、ファイルから取得したデータは他のものよりも優先されます。

オプションのランタイムパラメータ(Optional runtime parameters)

–logfile FILE

Specify a log file to record all activity.
すべてのアクティビティを記録するログファイルを指定します。

–nameservers 8.8.8.8#53 or 4.2.2.1#53#tcp or 2001:4860:4860::8888

A comma separated list of alternative DNS servers to use with proxied requests. Nameservers can have either IP or IP#PORT format. A randomly selected server from the list will be used for proxy requests when provided with multiple servers. By default, the tool uses Google’s public DNS server 8.8.8.8 when running in IPv4 mode and 2001:48 60:4860::88 88 when running in IPv6 mode.
プロキシされたリクエストに使用する代替DNSサーバーのコンマ区切りリスト。ネームサーバーは、IP または IP#PORT 形式のいずれかです。複数のサーバーが指定されている場合は、リストの中からランダムに選択されたサーバーがプロキシリクエストに使用されます。デフォルトでは、IPv4モードではGoogleのパブリックDNSサーバー8.8.8.8を使用し、IPv6モードでは2001:48 60:4860::88 88を使用します。

-i 127.0.0.1 or ::1, –interface 127.0.0.1 or ::1

Define an interface to use for the DNS listener. By default, the tool uses 127.0.0.1 for IPv4 mode and ::1 for IPv6 mode.
DNSリスナーに使用するインターフェースを定義します。デフォルトでは、IPv4モードでは127.0.0.1を、IPv6モードでは ::1を使用します。

-t, –tcp

Use TCP DNS proxy instead of the default UDP.
デフォルトのUDPではなく、TCPのDNSプロキシを使用する。

-6, –ipv6

Run in IPv6 mode.
IPv6モードで実行。

-p 53, –port 53

Port number to listen for DNS requests.
DNSリクエストを受け付けるポート番号。

-q, –quiet

Don’t show headers.
ヘッダーを表示しない。

dnschefツールのまとめ

このdnschefツールは、ブラウザにurlを入力してホームページにアクセスしたときに、異なるアドレスに飛ばしてしまうのですね。
これは以前記事にした「ドメインハイジャック」と同じではないでしょうか。
 
こんなのに引っかからないようにしないといけません。