<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Willian Bachini - MZTBTG on Medium]]></title>
        <description><![CDATA[Stories by Willian Bachini - MZTBTG on Medium]]></description>
        <link>https://medium.com/@mztbtg?source=rss-c63d3006b709------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GUeGsUCQqGHHErv3TI2M3A.jpeg</url>
            <title>Stories by Willian Bachini - MZTBTG on Medium</title>
            <link>https://medium.com/@mztbtg?source=rss-c63d3006b709------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:28:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mztbtg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Did the PMKID Attack Surprise Researchers?]]></title>
            <link>https://medium.com/@mztbtg/why-did-the-pmkid-attack-surprise-researchers-6ebccc8185fa?source=rss-c63d3006b709------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ebccc8185fa</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pmkid]]></category>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[hashcat]]></category>
            <category><![CDATA[aircrack-ng]]></category>
            <dc:creator><![CDATA[Willian Bachini - MZTBTG]]></dc:creator>
            <pubDate>Wed, 04 Mar 2026 21:17:11 GMT</pubDate>
            <atom:updated>2026-03-04T21:17:11.897Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>During a security analysis of <strong>WPA3</strong>, <em>Jens ‘Atom’ Steube</em>, administrator and lead developer of<a href="https://github.com/hashcat/hashcat"> <em>Hashcat</em></a>,<a href="https://hashcat.net/forum/thread-7717.html"> discovered the leakage of the <strong><em>PMKID</em></strong></a> (Pairwise Master Key Identifier) in some router models, which would make it possible to crack the <strong><em>PSK</em></strong> (Pre Shared Key) without any client connected to the network.</p><p>Perhaps you even know how to execute this type of attack, but you may have lost a little of the excitement when you realized that the cracking time is similar to cracking the <em>4-Way Handshake</em> via the <em>MIC</em> (HMAC).</p><p>If it is not that different from the previous one, despite being <em>Clientless</em>, why did it generate such astonishment among researchers?</p><blockquote><strong>How is the PMKID generated?</strong></blockquote><p>In 2004, the Wi-Fi protocol (IEEE 802.11) received security updates through the amendment<a href="https://standards.ieee.org/ieee/802.11i/3127/"> <strong><em>IEEE 802.11i-2004</em></strong></a>, and was implemented under the name <strong><em>WPA2</em></strong>. Among all the security updates contained in this amendment, the <em>Robust Security Network</em> (<strong>RSN</strong>) was added, which, as its name suggests, is responsible for further increasing the security of a network by utilizing additional parameters in the negotiation frames between a <em>Station</em> and an <em>Access Point</em> (AP).</p><p>But until then the <em>PMKID</em> was unknown. This is because it would only be used in corporate networks (WPA2-Enterprise).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*KonVGXTUHXMW5koW-rFKYg.png" /><figcaption><a href="https://www.mdpi.com/1424-8220/17/10/2170">WPA2-Enterprise pairing process</a></figcaption></figure><p>After the <em>Association Requests/Responses</em>, if the Station chooses to connect through the corporate network, it would perform a process known as <em>802.1X-EAP Key Exchange</em>, where the PMK, which is the key responsible for generating the other security keys, is exchanged through a <em>secure</em> tunnel.</p><p>Since this <em>Key Exchange</em> process depends on more entities than just the Station and the AP, it is by far the most time-consuming pairing process (considering communication systems terms). And since companies are generally larger than simple homes, several APs are necessary throughout the location, and the Station must be able to switch networks without data exchange being compromised. This is where PMKSA (Pairwise Master Key Station Access) comes in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*N6M6ZaoyHkBc7lhJJf7zCQ.png" /><figcaption><a href="https://hostap.epitest.fi/wpa_supplicant/devel/ctrl_iface_page.html">Stored PMKSA</a></figcaption></figure><p>The PMKSA is a set of data that references a connection that a station previously made to that Extended Service Set (<strong>ESS</strong>), and is generated as soon as the <em>802.1X-EAP Key Exchange</em> is finalized. To avoid the need to search for such data through information that could be spoofed, an HMAC-SHA1 hash is computed over the PMK, a string “PMK Name” (the reason for this string is only to reference this data in the code), the AP’s MAC address, and the Station’s MAC address.</p><p><a href="http://w1.fi/hostapd/devel/wpa__common_8c.html#a5c044a0ddbf17712e5415e2ff944ed75"><em>Source code:</em></a></p><pre>PMKID = HMAC-SHA1–128(PMK, &quot;PMK Name&quot; || AA || SPA)</pre><p>As soon as a Station requests a reassociation to a new AP within the same <em>ESS</em>, it sends the list of <em>PMKIDs</em> it possesses within the <em>RSN</em> field of the (re)association frame. In this way, if the AP compares it with its database and confirms that the station has connected before, and its data is still valid, the entire <em>802.1X</em> key exchange process is ignored and only the <em>4-Way Handshake</em> is performed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*zY1qzXEEFj5H2aw_iEqmMw.png" /><figcaption><a href="https://mrncciew.com/category/wlan-secuirty/page/2/">Association Request with empty PMKID list</a></figcaption></figure><p>Even if someone intercepts this data, Enterprise networks use a <strong>PMK</strong>, which is the first 128/256 bits of the <strong>MSK</strong> (Master Session Key) stored on the <em>RADIUS</em> server, which would make the cracking this hash unfeasible. <strong>(keep this in mind!)</strong></p><blockquote><strong>When Did This Parameter Become Insecure?</strong></blockquote><p>The<a href="https://standards.ieee.org/ieee/802.11r/3954/"> <strong><em>IEEE 802.11R-2008</em></strong></a> standard is indirectly responsible.</p><p>Implemented as <em>Roaming</em>, <em>802.11R</em> was primarily responsible for reducing the time required to pair with another router of the same <strong>ESS</strong>, to only 2~3% of the usual. This was a huge leap, reducing it from approximately 900 ms to just 20 ms, which greatly benefited the entire communication chain, since everything would be done in the safest possible way and seamlessly (extremely superficial explanation).</p><p>A Station can jump from one AP to another in two ways:</p><ul><li><strong><em>Over-the-DS:</em></strong> Through the fictional AP called <em>“AP-1”</em>, the Station communicates with <em>“AP-2”</em>, via <em>Action Frames Requests/Responses</em>. As soon as it identifies the physical aspects of <em>“AP-2”</em>, an <em>FT Reassociation Request/Response</em> is performed, where the necessary data for the Station’s pre-authentication validation is inserted. At the end of the process, the Station simply starts communicating directly with <em>“AP-2”</em> without needing to forget or disassociate from <em>“AP-1”</em>, making this AP change basically imperceptible to the upper layers of the <em>OSI</em> model;</li><li><strong><em>Over-the-Air:</em></strong> Without ending its communication with <em>“AP-1”</em>, the Station identifies <em>“AP-2”</em> through <em>Beacon Frames</em>, and starts its communication through an <em>FT Authentication Request/Response</em>. Immediately after, an <em>FT (Re)Association Request/Response</em> is performed, so that <em>“AP-2”</em> can validate the network access data. After the conclusion of this stage with the <em>FT (Re)Association Response</em>, the station simply starts communicating with <em>“AP-2”</em>, maintaining the established communication.</li></ul><p>Note that neither of the two models involves <em>802.1X</em> or the <em>4-Way Handshake</em>.</p><p>But it is in <strong>Over-the-Air</strong> where the problem lies!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*0EVHdaRzy4kf5iTPDe8ezA.png" /><figcaption><a href="https://www.h3c.com/en/d_201907/1211833_294551_0.htm">Over-the-Air roaming</a></figcaption></figure><p><strong>802.11R</strong> brought a new possibility for network switching, speeding up even <em>Personal</em> networks. This was done through the possibility of generating <em>PMKSAs</em> using the <em>PSK</em>, in the same way it is used in a conventional <em>WPA2-PSK</em> authentication.</p><p>The problem is that the <em>PMKID</em> will be computed, replacing the <em>PMK</em> with the <em>PSK</em>, and since the other parameters are already constantly transmitted through other management frames, a malicious agent is capable of computing a <em>PMKID</em> using a <em>Passphrase</em>, and by comparing the resulting data, the agent can deduce whether the password used is the correct one or not, which was previously unfeasible. <strong>(got it?)</strong></p><blockquote><strong>Why Would a PMKID Be Sent in M1?</strong></blockquote><p>When a Station attempts to switch from one AP to another, it carries a list of <em>PMKIDs</em> corresponding to each AP for which its pre-authentication was performed. The “<em>AP-2</em>” may not contain this synchronized data, as this pre-authentication process is managed by the <em>WLAN Controller</em> (WLC).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*BQ9y2XijauV6l0HKGNsngQ.png" /><figcaption><a href="https://www.cwnp.com/uploads/802-11_rsn_ft.pdf">Basic WPA2-Enterprise structure with 802.11R</a></figcaption></figure><p>As soon as the Station sends this list of <em>PMKIDs</em> in the <em>RSN</em> field of the <em>(Re)Association Request</em>, the “AP-2” chooses which of the <em>PMKIDs</em> it will use and requests the updated list from the <em>WLC</em>. If this <em>PMKID</em> is not in this list, it may be that the station has dissociated from <em>“AP-1”</em>, or it is simply someone trying to impersonate another user. And that’s where <strong>M1</strong> comes in. (1st message of the <em>4-Way Handshake</em>)</p><p>For the station to know that it is necessary to reset its <em>PMKSAs</em>, the <em>“AP-2”</em> generates a new entry in the database containing this <em>PMKSA</em>, refers to it through a new PMKID computed with the updated data, and sends it in the <em>RSN</em> field of <strong><em>M1</em></strong>. Thus, the station can pair with <em>“AP-2”</em> by continuing the <em>Handshake</em> (if it is PSK), or ignores <strong><em>M1</em></strong> and waits for the start of <em>802.1X-EAP</em> for the keys to be renewed (if it is PMK). If that client has never connected to the network, after an <em>Association Response</em>, the <em>802.1X-EAP</em> is automatically initiated.</p><blockquote><strong>If the PMKID is Generated with Known Stations, Why Can an Attacker Request This Data from the AP?</strong></blockquote><p>That’s the point. It shouldn’t be possible!</p><p>By default, many manufacturers built the firmware with <em>802.11R</em> enabled and with the default sending of RSN data. This is because, in theory, it would facilitate switching between APs within the same ESS in home networks, without a technician having to configure these parameters.</p><p>The critical point is that this very poorly executed adaptation, carried out by these manufacturers, recognizes any new Station attempting to connect as a possible pre-authenticated one. So, if an attacker sends an Association Request indicating compatibility with RSN (standard on almost all Wi-Fi enabled devices), the AP generates the <em>PMKSA</em> (<strong>unnecessarily</strong>) and sends the <em>PMKID</em> in <em>M1</em> (<strong>even more unnecessarily</strong>).</p><p><strong>Reproduce on YOUR network!</strong></p><p>Nowadays, many tools are able to identify the presence of the <em>PMKID</em> in a connection attempt. For an attacker to request this data from the AP, they simply need to try to connect to the network with a wrong password. That’s it! (You can also use an automated tool, but you lose the thrill. :D)</p><p>When using <em>Aircrack-NG</em>, for example, we automatically detect the presence of the <em>PMKID</em> by observing the following data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*MBjTcWHpeXgEFBIFWuIpcw.png" /><figcaption>Command: airodump-ng wlan0mon -c 7 — bssid 58:10:8C:1A:08:2F -w pmkid</figcaption></figure><p>See that the capture of a “<em>WPA Handshake</em>” is reported, but the client that performed the communication has a “<em>PMKID</em>” as a note. The message needed to crack a Handshake is <strong><em>M2</em></strong>, while to crack the <em>PMKID</em> it is <strong><em>M1</em></strong>. As I attempted a connection like any other, this is the result.</p><p>Although Aircrack-NG has native support for PMKID cracking, we will use<a href="https://github.com/ZerBea/hcxtools"> <strong><em>HCXTools</em></strong></a>. A very powerful suite of tools for capturing and converting hashes into formats compatible with <em>Hashcat</em> and <em>John</em>.</p><p>Unlike <em>Aircrack-NG</em>, <strong><em>HCXDumpTool</em></strong> is capable of interacting with the AP and obtaining the necessary data, without the need for a “<em>legitimate</em>” connection attempt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*VvNdVwXRPdSiLO7988y4xQ.png" /><figcaption>Command: hcxdumptool -i wlan0 -f 2442 -w vish</figcaption></figure><p>The content of the resulting file, “<em>vish</em>”, is only the minimum necessary for converting the data into a computable hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*GJraqot-0B5ZYT99FQKNWw.png" /><figcaption>Wireshark analyzing “vish”</figcaption></figure><p>But these data are still not in the correct format. To format it, it is necessary to collect the proper information, or use another tool. In this case, <strong><em>HCXPcapngTool</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*3lxwnPtfruxDC4IyNfpG_Q.png" /><figcaption>Manual hash preparation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_jfV8P4IEkzyWlKG-qROQ.png" /><figcaption>Command: hcxpcapngtool `capture` -o `capture`-hash &amp;&amp; cat `capture`-hash</figcaption></figure><p>Note that the resulting hash data assembled by <strong><em>HCXPcapngTool</em></strong> in the “<em>pmkid-01.cap</em>” file captured by <em>Airodump-NG</em> contains two items, while the “<em>vish</em>” capture performed by HCXDumpTool has only 1. This occurs because it is capable of assembling as many hashes as there are in the file, whether they are from a partial <em>Handshake</em>, a total <em>Handshake</em>, or just the <em>PMKID</em>.</p><p>Keeping only the hash of type 01 (<em>WPA*01*…</em>) in the resulting file, we can use <em>John</em> or <em>Hashcat</em> to crack it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*vHcPg-xbiHHbgNMpmm4fGQ.png" /><figcaption>Command: hashcat -a0 -m22000 vish-hash /usr/share/wordlists/rockyou.txt</figcaption></figure><p>Notice that my 4th generation <em>Intel Core i5</em> was able to generate 4231 passwords per second, the network password was cracked with the Wordlist <em>“rockyou.txt”</em>, and the attack lasted <strong>0.01 second</strong>!</p><p><em>I hope you got here to </em><strong>learn</strong>, and not to copy and paste commands. The beauty of attacks lies in the process of executing them, in the challenges, and in their solutions.</p><p>Please, ask yourself: <em>If I deliver a Pentest today, will I be able to explain why, between two similar environments, one is vulnerable and the other is not?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ebccc8185fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Por Que o PMKID Attack Surpreendeu os Pesquisadores?]]></title>
            <link>https://medium.com/@mztbtg/por-que-o-pmkid-attack-surpreendeu-os-pesquisadores-c24737b1db48?source=rss-c63d3006b709------2</link>
            <guid isPermaLink="false">https://medium.com/p/c24737b1db48</guid>
            <category><![CDATA[aircrack-ng]]></category>
            <category><![CDATA[pmkid]]></category>
            <category><![CDATA[hashcat]]></category>
            <category><![CDATA[explicação]]></category>
            <category><![CDATA[wifi]]></category>
            <dc:creator><![CDATA[Willian Bachini - MZTBTG]]></dc:creator>
            <pubDate>Thu, 09 Nov 2023 22:36:02 GMT</pubDate>
            <atom:updated>2023-11-09T22:36:02.554Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Durante uma análise de segurança ao <strong>WPA3</strong>, <em>Jens ‘Atom’ Steube</em>, administrador e desenvolvedor líder do <a href="https://github.com/hashcat/hashcat"><em>Hashcat</em></a>, <a href="https://hashcat.net/forum/thread-7717.html">descobriu o vazamento do <strong><em>PMKID</em></strong></a> (Pairwise Master Key Identifier) em alguns modelos de roteadores, o que possibilitaria a quebra da <strong><em>PSK</em></strong> (Pre Shared Key) sem que haja algum cliente conectado na rede.</p><p>Talvez você até saiba executar esse tipo de ataque, mas é possível que você tenha perdido um pouquinho da empolgação quando percebeu que o tempo de quebra é similar à quebra do <em>4-Way Handshake</em> pelo <em>MIC </em>(HMAC).</p><p>Se ele não é tão diferente do anterior, apesar de ser <em>Clientless</em>, por que ele gerou tanto espanto nos pesquisadores?</p><blockquote><strong>Como o PMKID é gerado?</strong></blockquote><p>Em 2004, o protocolo <em>Wi-Fi</em> (IEEE 802.11) recebeu atualizações de segurança pela emenda <a href="https://standards.ieee.org/ieee/802.11i/3127/"><strong><em>IEEE 802.11i-2004</em></strong></a>, e foi implementada com o nome de <strong><em>WPA2</em></strong>. Entre todas as atualizações de seguranças contidas nessa emenda, houve a adição da <em>Robust Security Network</em> (<strong>RSN</strong>), que, assim como seu nome diz, é responsável por aumentar ainda mais a segurança de uma rede, utilizando de parâmetros adicionais nos frames de negociação entre um <em>Station</em> e um <em>Access Point</em> (AP).</p><p>Mas até então o <em>PMKID</em> se encontra desconhecido. Isso porque ele apenas seria utilizado em redes corporativas (WPA2-Enterprise).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*KonVGXTUHXMW5koW-rFKYg.png" /><figcaption><a href="https://www.mdpi.com/1424-8220/17/10/2170">Processo de pareamento no padrão WPA2-Enterprise</a></figcaption></figure><p>Após os <em>Association Requests/Responses</em>, caso o Station opte por se conectar através da rede corporativa, ele faria um processo conhecido como <em>802.1X-EAP Key Exchange</em>, onde através de um túnel <em>seguro</em>, ocorre a troca da PMK, que é a chave responsável por gerar as outras chaves de segurança.</p><p>Como esse processo de <em>Key Exchange</em> depende de mais entidades além do Station e do AP, é de longe o processo mais demorado de pareamento (considerando termos de sistemas de comunicação). E como empresas geralmente são maiores do que simples casas, são necessários diversos AP’s espalhados por todo o local, e o Station deve ser capaz de trocar de rede, sem que haja um prejuízo na troca de dados. É nesse ponto que entra o PMKSA (Pairwise Master Key Station Access).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*N6M6ZaoyHkBc7lhJJf7zCQ.png" /><figcaption><a href="https://hostap.epitest.fi/wpa_supplicant/devel/ctrl_iface_page.html">PMKSA armazenada</a></figcaption></figure><p>O PMKSA é uma série de dados que referenciam alguma conexão que uma estação realizou anteriormente àquele Extended Service Set (<strong>ESS</strong>), e é gerado assim que o <em>802.1X-EAP Key Exchange</em> é finalizado. Para que não seja necessário buscar tais dados através de dados que poderiam ser falsificados, é computado uma hash HMAC-SHA1 sob a PMK, uma string “PMK Name” (o motivo desta string é apenas referenciar este dado no código), o MAC do AP e o MAC do Station.</p><p><a href="http://w1.fi/hostapd/devel/wpa__common_8c.html#a5c044a0ddbf17712e5415e2ff944ed75"><em>Source code:</em></a></p><pre>PMKID = HMAC-SHA1-128(PMK, &quot;PMK Name&quot; || AA || SPA)</pre><p>Assim que um Station solicita uma reassociação à um novo AP dentro do mesmo <em>ESS</em>, ele envia a lista de <em>PMKID’s</em> que ele possui dentro do campo <em>RSN</em> do (re)association frame. Desta forma, se o AP compara com sua base de dados e confirma que ele já se conectou anteriormente, e seus dados continuam válidos, todo o processo de troca de chaves <em>802.1X</em> é ignorado e é feito apenas o <em>4-Way Handshake</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*zY1qzXEEFj5H2aw_iEqmMw.png" /><figcaption><a href="https://mrncciew.com/category/wlan-secuirty/page/2/">Association Request com a lista de PMKID vazia</a></figcaption></figure><p>Mesmo que alguém intercepte estes dados, as redes Enterprise utilizam uma <strong>PMK</strong>, que são os 128/256 primeiros bits da <strong>MSK</strong> (Master Session Key) armazenada no servidor <em>RADIUS</em>, o que tornaria a quebra dessa hash, algo inviável. <strong>(guarde isso!)</strong></p><blockquote><strong>Quando Esse Parâmetro se Tornou Inseguro?</strong></blockquote><p>O padrão <a href="https://standards.ieee.org/ieee/802.11r/3954/"><strong><em>IEEE 802.11R-2008</em></strong></a> é o responsável indiretamente.</p><p>Sendo implementado como <em>Roaming</em>, o <em>802.11R</em> foi o principal responsável por reduzir o tempo necessário para se parear à outro roteador de mesmo <strong>ESS</strong>, para apenas 2~3% do usual. Isso foi um salto enorme, reduzindo de aproximadamente 900ms, para apenas 20ms, o que beneficiou muito toda a cadeia de comunicação, já que tudo seria feito da forma mais segura possível e sem engasgos. (Explicação extremamente superficial)</p><p>Um Station pode pular de um AP para o outro de duas maneiras:</p><ul><li><strong><em>Over-the-DS:</em></strong> Através do AP fictício chamado <em>“AP-1”</em>, o Station se comunica com o <em>“AP-2”</em>, através de <em>Action Frames Requests/Responses</em>. Assim que ele identifica os aspectos físicos do <em>“AP-2”</em>, é realizado um <em>FT Reassociation Resquest/Response</em>, onde são inseridos os dados necessários para a validação da pré autenticação do Station. No final do processo, o Station simplesmente passa a se comunicar diretamente com o<em> “AP-2”</em> sem que seja necessário esquecer ou desassociar-se do <em>“AP-1”</em>, tornando essa troca de AP’s basicamente imperceptível para as capadas superiores do modelo <em>OSI</em>;</li><li><strong><em>Over-the-Air:</em> </strong>Sem finalizar sua comunicação com o <em>“AP-1”</em>, o Station identifica o <em>“AP-2”</em> através dos <em>Beacon Frames</em>, inicia sua comunicação através de um <em>FT Authentication Request/Response</em>. Logo em seguida é realizado um <em>FT (Re)Association Request/Response</em>, para que o <em>“AP-2”</em> possa validar os dados de acesso à rede. Após a conclusão desta etapa com o <em>FT (Re)Association Response</em>, a estação simplesmente passa a se comunicar com <em>“AP-2”</em>, mantendo toda a comunicação que fora realizada.</li></ul><p>Veja que nenhum dos dois modelos envolve o <em>802.1X</em> ou o <em>4-Way Handshake</em>.</p><p>Mas é no <strong>Over-the-Air</strong> que o problema se encontra!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*0EVHdaRzy4kf5iTPDe8ezA.png" /><figcaption><a href="https://www.h3c.com/en/d_201907/1211833_294551_0.htm">Roaming em Over-the-Air</a></figcaption></figure><p>O <strong>802.11R</strong> trouxe consigo uma nova possibilidade de troca de redes, acelerando até mesmo redes <em>Personal’s</em>. Isso foi feito através da possibilidade de gerar <em>PMKSA’s</em> utilizando a <em>PSK</em>, da mesma forma como é usada em uma autenticação <em>WPA2-PSK</em> convencional.</p><p>O problema é que o <em>PMKID</em> será computado, substituindo a <em>PMK</em> pela <em>PSK</em>, e como os outros parâmetros já são transmitidos constantemente através de outros frames de gerenciamento, um agente malicioso é capaz de computar um <em>PMKID</em> utilizando uma <em>Passphrase</em>, e comparando os dados resultantes, é capaz de deduzir se a senha utilizada é a correta ou não, o que antes era inviável. <strong>(entendeu?)</strong></p><blockquote><strong>Mas Por Qual Motivo um PMKID Seria Enviado na M1?</strong></blockquote><p>Quando um Station tenta trocar de um AP para o outro, ele carrega consigo uma lista de <em>PMKID’s</em> referente à cada AP que sua pré autenticação foi realizada. O “<em>AP-2”</em> pode não conter esses dados sincronizados, já que esse processo de pré autenticação é gerenciado pelo <em>WLAN Controller</em> (WLC).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*BQ9y2XijauV6l0HKGNsngQ.png" /><figcaption><a href="https://www.cwnp.com/uploads/802-11_rsn_ft.pdf">Estrutura básica de WPA2-Enterprise com 802.11R</a></figcaption></figure><p>Assim que o Station envia essa lista de <em>PMKID’s</em> no campo <em>RSN</em> do <em>(Re)Association Request</em>, o “AP-2” escolhe qual dos <em>PMKID’s</em> ele utilizará e solicita a lista atualizada ao <em>WLC</em>. Se esse <em>PMKID</em> não se encontra nessa lista, pode ser que a estação de desassociou do <em>“AP-1”</em>, ou simplesmente seja alguém tentando se passar por outro usuário. E é aí que entra a <strong>M1</strong>. (1ª mensagem do <em>4-Way Handshake</em>)</p><p>Para que a estação possa saber que é necessário resetar suas <em>PMKSA’s</em>, o <em>“AP-2”</em> gera uma nova entrada no banco de dados contendo essa <em>PMKSA</em>, se refere à ela através de um novo PMKID computado com os dados atualizados, e o envia no campo <em>RSN</em> da <strong><em>M1</em></strong>. Assim a estação pode se parear com o <em>“AP-2”</em> através da continuação do <em>Handshake</em> (caso seja PSK), ou ignora a <strong><em>M1</em></strong> e aguarda o início do <em>802.1X-EAP</em> para que as chaves sejam renovadas (caso seja PMK). Caso aquele cliente nunca tenha se conectado à rede, após um <em>Association Response</em>, é iniciado o <em>802.1X-EAP</em> automaticamente.</p><blockquote><strong>Se o PMKID é Gerado com Stations Conhecidos, Por Que um Atacante Pode Solicitar Esses Dados ao AP?</strong></blockquote><p>É aí que está. Não poderia!</p><p>Por padrão, muitos fabricantes construíram o firmware com o <em>802.11R</em> habilitado. Isso porque, em teoria, facilitaria a troca de AP de mesmo <em>ESS</em> em redes domésticas, sem que um técnico tenha que configurar estes parâmetros</p><p>O ponto crítico é que essa adaptação muito mal feita, reconhece qualquer novo Station que tente se conectar como um possível pré autenticado. Então se um atacante se conecta informando que possui <strong>compatibilidade</strong> com o <em>RSN</em>, o AP gera a <em>PMKSA</em> (<strong>desnecessariamente</strong>) e envia o <em>PMKID</em> na <em>M1</em> (<strong>mais desnecessário ainda</strong>).</p><h4>Reproduza na SUA rede!</h4><p>Hoje em dia muitas ferramentas são capazes de identificar a presença do <em>PMKID</em> em alguma tentativa de conexão. Para um atacante solicitar esse dado ao AP, ele precisa simplesmente tentar se conectar na rede com uma senha errada. Só! (Pode usar uma ferramenta automatizada também, mas perde a emoção. :D)</p><p>Ao utilizar o <em>Aircrack-NG</em> por exemplo, detectamos a presença do <em>PMKID</em> automaticamente observando o seguinte dado:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*MBjTcWHpeXgEFBIFWuIpcw.png" /><figcaption>Comando: airodump-ng wlan0mon -c 7 — bssid 58:10:8C:1A:08:2F -w pmkid</figcaption></figure><p>Veja que é informado a captura de um “<em>WPA Handshake”</em>, porém o cliente que realizou a comunicação possui um <em>“PMKID”</em> como nota. A mensagem necessária para quebrar um Handshake é a <strong><em>M2</em></strong>, já para quebrar o <em>PMKID</em> é o <strong><em>M1</em></strong>. Como realizei uma tentativa de conexão como outra qualquer, este é o resultado.</p><p>Infelizmente o <em>Aircrack-NG</em> não realiza este processo de quebra (pelo menos não no meu laboratório, com o <em>Aircrack-NG</em> padrão do repositório do <em>Kali</em>), então teremos que partir para o <a href="https://github.com/ZerBea/hcxtools"><strong><em>HCXTools</em></strong></a>.</p><p>O <em>HCXTools</em> é uma suite de ferramentas muito poderosa para a captura e conversão de Hashes em formatos compreensíveis pelo <em>Hashcat</em> e <em>John</em>.</p><p>Ao contrário do <em>Aircrack-NG</em>, a ferramenta <strong><em>HCXDumpTool</em></strong> é capaz de interagir com o AP e obter os dados necessários, sem a necessidade de uma tentativa de conexão “<em>legítima</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*VvNdVwXRPdSiLO7988y4xQ.png" /><figcaption>Comando: hcxdumptool -i wlan0 -f 2442 -w vish</figcaption></figure><p>O conteúdo do arquivo resultante “<em>vish</em>”, é apenas o mínimo necessário para a conversão dos dados em uma hash computável.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*GJraqot-0B5ZYT99FQKNWw.png" /><figcaption>Wireshark analisando “vish”</figcaption></figure><p>Mas esses dados ainda não estão no formato correto. Para formatá-los, é necessário a coleta das devidas informações, ou a utilização de uma outra ferramenta. No caso, <strong><em>HCXPcapngTool</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*3lxwnPtfruxDC4IyNfpG_Q.png" /><figcaption>Preparação da Hash manualmente</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_jfV8P4IEkzyWlKG-qROQ.png" /><figcaption>Comando: hcxpcapngtool `capture` -o `capture`-hash &amp;&amp; cat `capture`-hash</figcaption></figure><p>Veja que os dados resultantes da hash montada pelo <strong><em>HCXPcapngTool</em></strong>, no arquivo “<em>pmkid-01.cap</em>” capturado pelo <em>Airodump-NG</em> possui dois itens, enquanto na captura “<em>vish</em>” realizada pelo HCXDumpTool possui apenas 1. Isso ocorre porque ela é capaz de montar quantas hashes houver no arquivo, sejam elas provenientes de <em>Handshake</em> parcial, total, ou apenas o <em>PMKID</em>.</p><p>Mantendo apenas a hash do tipo 01 (<em>WPA*01*…</em>) no arquivo resultante, podemos utilizar o <em>John</em> ou o <em>Hashcat</em> para quebrá-la.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*vHcPg-xbiHHbgNMpmm4fGQ.png" /><figcaption>Comando: hashcat -a0 -m22000 vish-hash /usr/share/wordlists/rockyou.txt</figcaption></figure><p>Veja que meu <em>Intel Core I5</em> de 4ª geração foi capaz de gerar 4231 senhas por segundo, a senha da rede foi quebrada com a Wordlist <em>“rockyou.txt”</em>, e o ataque durou <strong>0,01 segundo</strong>!</p><p>Espero que você tenha chegado até aqui para <strong>aprender</strong>, e não pra copiar e colar comandos. A beleza dos ataques está no processo de executá-los, nos desafios e nas suas soluções.</p><p>Por favor, pergunte à si mesmo: <em>Se eu entregar um Pentest hoje, serei capaz de explicar o motivo de, entre dois ambientes similares, um ser vulnerável e outro não?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c24737b1db48" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>