Rainbowcrack meg a Debian
Írta: Kerekes Attila
Jun/091
Mivel egyre aktívabban foglalkozom szivárványtáblás kódvisszafejtésekkel, gondoltam beszerzem a RainbowCrack programcsomagot is. Leginkább nem is az rcrack hanem az rtgen miatt. Linuxra ahogy néztem az 1.2-es verzió érhető el a hivatalos honlapról. Letöltöttem, kicsomagoltam, majd a readme alapján nekifutottam egy make -f makefile.linux paranccsal. Az eredmény lenyűgöző volt:
rogue:~/tools/rainbowcrack-1.2-src/src# make -f makefile.linux
g++ Public.cpp ChainWalkContext.cpp HashAlgorithm.cpp HashRoutine.cpp RainbowTableGenerate.cpp -lssl -O3 -o rtgen
In file included from Public.cpp:11:
Public.h:25: error: u_int64_t does not name a type
Public.h:26: error: u_int64_t does not name a type
Public.h:37: error: u_int64_t was not declared in this scope
Public.h:38: error: u_int64_t was not declared in this scope
Public.cpp:113: error: redefinition of std::string uint64tostr
Public.h:37: error: std::string uint64tostr previously declared here
Public.cpp:113: error: u_int64_t was not declared in this scope
Public.cpp:126: error: redefinition of std::string uint64tohexstr
Public.h:38: error: std::string uint64tohexstr previously declared here
Public.cpp:126: error: u_int64_t was not declared in this scope
In file included from ChainWalkContext.h:11,
from ChainWalkContext.cpp:11:
Public.h:25: error: u_int64_t does not name a type
Public.h:26: error: u_int64_t does not name a type
Public.h:37: error: u_int64_t was not declared in this scope
Public.h:38: error: u_int64_t was not declared in this scope
In file included from ChainWalkContext.cpp:11:
ChainWalkContext.h:30: error: u_int64_t does not name a type
ChainWalkContext.h:31: error: u_int64_t does not name a type
ChainWalkContext.h:34: error: u_int64_t does not name a type
ChainWalkContext.h:37: error: u_int64_t does not name a type
ChainWalkContext.h:56: error: u_int64_t does not name a type
ChainWalkContext.h:61: error: u_int64_t has not been declared
ChainWalkContext.h:68: error: u_int64_t does not name a type
ChainWalkContext.cpp:31: error: u_int64_t CChainWalkContext::m_nPlainSpaceUpToX [257] is not a static member of class CChainWalkContext
ChainWalkContext.cpp:32: error: u_int64_t CChainWalkContext::m_nPlainSpaceTotal is not a static member of class CChainWalkContext
ChainWalkContext.cpp:35: error: u_int64_t CChainWalkContext::m_nReduceOffset is not a static member of class CChainWalkContext
ChainWalkContext.cpp: In static member function static bool CChainWalkContext::LoadCharset(std::string):
ChainWalkContext.cpp:119: error: memcpy was not declared in this scope
ChainWalkContext.cpp: In static member function static bool CChainWalkContext::SetPlainCharset(std::string, int, int):
ChainWalkContext.cpp:165: error: m_nPlainSpaceUpToX was not declared in this scope
ChainWalkContext.cpp:178: error: m_nPlainSpaceTotal was not declared in this scope
ChainWalkContext.cpp: In static member function static bool CChainWalkContext::SetRainbowTableIndex(int):
ChainWalkContext.cpp:188: error: m_nReduceOffset was not declared in this scope
ChainWalkContext.cpp: At global scope:
ChainWalkContext.cpp:303: error: no u_int64_t CChainWalkContext::GetPlainSpaceTotal() member function declared in class CChainWalkContext
ChainWalkContext.cpp: In static member function static void CChainWalkContext::Dump():
ChainWalkContext.cpp:339: error: m_nPlainSpaceTotal was not declared in this scope
ChainWalkContext.cpp:342: error: m_nReduceOffset was not declared in this scope
ChainWalkContext.cpp: In member function void CChainWalkContext::GenerateRandomIndex():
ChainWalkContext.cpp:348: error: m_nIndex was not declared in this scope
ChainWalkContext.cpp:349: error: m_nPlainSpaceTotal was not declared in this scope
ChainWalkContext.cpp: At global scope:
ChainWalkContext.cpp:352: error: prototype for void CChainWalkContext::SetIndex(u_int64_t) does not match any in class CChainWalkContext
ChainWalkContext.h:61: error: candidate is: void CChainWalkContext::SetIndex(int)
ChainWalkContext.cpp: In member function void CChainWalkContext::SetHash(unsigned char*):
ChainWalkContext.cpp:359: error: memcpy was not declared in this scope
ChainWalkContext.cpp: In member function void CChainWalkContext::IndexToPlain():
ChainWalkContext.cpp:367: error: m_nIndex was not declared in this scope
ChainWalkContext.cpp:367: error: m_nPlainSpaceUpToX was not declared in this scope
ChainWalkContext.cpp:374: error: m_nIndex was not declared in this scope
ChainWalkContext.cpp:374: error: m_nPlainSpaceUpToX was not declared in this scope
ChainWalkContext.cpp: In member function void CChainWalkContext::HashToIndex(int):
ChainWalkContext.cpp:438: error: m_nIndex was not declared in this scope
ChainWalkContext.cpp:438: error: m_nReduceOffset was not declared in this scope
ChainWalkContext.cpp:438: error: m_nPlainSpaceTotal was not declared in this scope
ChainWalkContext.cpp: At global scope:
ChainWalkContext.cpp:441: error: no u_int64_t CChainWalkContext::GetIndex() member function declared in class CChainWalkContext
ChainWalkContext.cpp: In member function bool CChainWalkContext::CheckHash(unsigned char*):
ChainWalkContext.cpp:491: error: memcmp was not declared in this scope
In file included from ChainWalkContext.h:11,
from RainbowTableGenerate.cpp:18:
Public.h:25: error: u_int64_t does not name a type
Public.h:26: error: u_int64_t does not name a type
Public.h:37: error: u_int64_t was not declared in this scope
Public.h:38: error: u_int64_t was not declared in this scope
In file included from RainbowTableGenerate.cpp:18:
ChainWalkContext.h:30: error: u_int64_t does not name a type
ChainWalkContext.h:31: error: u_int64_t does not name a type
ChainWalkContext.h:34: error: u_int64_t does not name a type
ChainWalkContext.h:37: error: u_int64_t does not name a type
ChainWalkContext.h:56: error: u_int64_t does not name a type
ChainWalkContext.h:61: error: u_int64_t has not been declared
ChainWalkContext.h:68: error: u_int64_t does not name a type
RainbowTableGenerate.cpp: In function int main(int, char**):
RainbowTableGenerate.cpp:113: error: strcmp was not declared in this scope
RainbowTableGenerate.cpp:115: error: atoi was not declared in this scope
RainbowTableGenerate.cpp:128: error: atoi was not declared in this scope
RainbowTableGenerate.cpp:207: error: u_int64_t was not declared in this scope
RainbowTableGenerate.cpp:207: error: expected `;' before nIndex
RainbowTableGenerate.cpp:208: error: nIndex was not declared in this scope
RainbowTableGenerate.cpp:222: error: nIndex was not declared in this scope
RainbowTableGenerate.cpp:222: error: class CChainWalkContext has no member named GetIndex
make: *** [rtgen] Error 1
Vajon az idő járt el a forrás felett, vagy sose fordult csak úgy Debianon? Mindenesetre kicsit komolyabban átnézve a logot, egyértelmű volt, hogy a Public.h -ban nem stimmel valami, amihez bizony az u_int64_t -nek is köze van. Azonnal elő is kaptam kedvenc vim editorom, és néztem vajon mik hiányoznak. A fájl elején az #include-k között kell keresni a hibát:
rogue:~/tools/rainbowcrack-1.2-src/src# vi Public.h ... #include <stdio.h> #include <string> #include <vector> #include <list> ...
Ami innét hiányzik nekünk az a cstdlib és a cstring. Orvosoljuk a hibát, a header fájl eleje így nézzen ki:
rogue:~/tools/rainbowcrack-1.2-src/src# vi Public.h ... #include <stdio.h> #include <string> #include <vector> #include <list> #include <cstring> #include <cstdlib> ...
Ezek után nekifutva a fordításnak ezt kapjuk:
rogue:~/tools/rainbowcrack-1.2-src/src# make -f makefile.linux g++ Public.cpp ChainWalkContext.cpp HashAlgorithm.cpp HashRoutine.cpp RainbowTableGenerate.cpp -lssl -O3 -o rtgen g++ Public.cpp ChainWalkContext.cpp HashAlgorithm.cpp HashRoutine.cpp RainbowTableDump.cpp -lssl -o rtdump g++ Public.cpp RainbowTableSort.cpp -o rtsort RainbowTableSort.cpp: In function ‘int QuickSortPartition(RainbowChain*, int, int)’: RainbowTableSort.cpp:37: warning: integer overflow in expression g++ Public.cpp ChainWalkContext.cpp HashAlgorithm.cpp HashRoutine.cpp HashSet.cpp MemoryPool.cpp ChainWalkSet.cpp CrackEngine.cpp RainbowCrack.cpp -lssl -O3 -o rcrack
És már működik is minden, nyugodtan generálhatjuk a szivárvány táblázatainkat a nagyvilágnak :)
#eof
IT-Security
Írta: Kerekes Attila
Jun/090
Pörögnek a napjaim, rengeteg új témával foglalkozom. Ma a Balabit IT-Securitytől járt nálunk egy úriember és tartott egy rövid 1 napos bemutató a Zorp felépítéséről és működéséről. Nagyon élveztem az előadást, de sajnos a vége előtt el kellett mennem vizsgázni róla. Bár nagyon érdekes megoldást alkalmaznak a biztonságos protokollok megfigyelésére, azért a zorp esetében sem nézhetünk csak úgy büntetlenül a titkosított adat forgalomba. Sok új tapasztalattal és 2 IT-Securitys bögrével gazdagabban hagyhattam el a szakirány labort.
Jobban utánajártam, hogyan érdemes nekiállni bruteforce módszerrel jelszavakat erősségét tesztelni. Teljesen meglepődve tapasztaltam mennyi előre legyártott szivárvány tábla létezik. DVD-ken rendelhetünk 2-3 gigás tábláktól egészen az 500gigás csomagig mindent. De a számomra legérdekesebb amit találtam egy olyan gyűjtemény, mely 1000 különböző ssid-re tartalmaz 1 000 000 darabos jelszó gyűjteményből álló táblákat. Az egész cucc 33 gigát foglalna, ami nekem nagyon sok, de a népszerű ssidkhez gyártott táblákat azért beszereztem (default, d-link, linksys, belkin54g, smc…). A gyűjtemény összeállításához többek között Kevin Mitnick is hozzájárult, ami miatt aztán tényleg nagyon hype számomra az egész. Pár teszt menetet toltam eddig aircrack-ng-vel, 80 000 kulcs/sec körül van a határ a laptopom procija mellett. Az itthoni “gyenge” 9 véletlen alfanumerikus karaktert tartalmazó kulcsunk igenhamar megkerült. De persze szivárványtáblák nem csak wpa-hoz léteznek, XP és Vista számára további 500gb-nyi tábla letölthető már illetve megrendelhető internetről. Az egyetemen pihen egy cluster ami épp nem csinál semmit, ha lenne pár terra tárhely hozzá, már tudom mire lehetne használni… :)
Olvasgatva john és aircrack-ng man oldalait vettem észre, hogy míg john stdoutra tudja küldeni a különböző módszerekkel generált jelszavakat, addig aircack stdinről is tudja olvasni a tesztelendő kulcsokat. Persze én is arra gondoltam itt amire előttem már sokan, és jó páran már meg is valósítottak….
john --stdout --wordlist=specialrules.lst --rules | aircrack-ng -e test -a 2 -w - /root/capture/wpa.cap
Az aircrack-ng dokumentáció is felhívja a figyelmünket, hogy a wpa szabványos kulcsok hossza 8-63 karakter, így megfontolandó, hogy érdemes e a szótár fájlban benthagyni a rövidebb kifejezéseket… És talán az, mivel ha maga a “bodri” nem is használható jelszó, a “bodri123″ már az, amit a john jobb esetben le is generál nekünk, de csak akkor, ha az eredeti 5 betűs formája is szerepel a szótárban.
Ajánlott irodalom:
http://www.renderlab.net/projects/WPA-tables/
http://www.freerainbowtables.com
http://project-rainbowcrack.com
http://www.aircrack-ng.org/doku.php?id=aircrack-ng
#eof