ã½ã«ãã®å¹ç¨
以åãRainbow Table ã®èª¬æã§ãã½ã«ãã«é¢ãã¦
id:JULY:20100515
Windows ã®ãã¹ã¯ã¼ãã®å ´åããã½ã«ããã¨å¼ã°ããããã¹ã¯ã¼ãã«ä»å ããä¹±æ°ãç¡ãã®ã§ãåããã¹ã¯ã¼ãããå¿ ãåãããã·ã¥å¤ãå¾ããããã¨ããå´é¢ãããã¾ããUNIX ç³» OS ã§ã¯ãã½ã«ãããä»å ãããã®ã§ãRainbow Table ãä½ãã¥ãããªã£ã¦ãã¾ãã
ã¨ãµã©ãã¨æµããã®ããèªåã§ãæ°ã«ãªã£ã¦ããã®ã§ãããã¨ãã»ãã¥ã¢ããã°ã®「ソルト付き SHA-1 は大丈夫か?」ã¨ãã話ã«è¨å*1ããã®ã§ãã½ã«ãã®å¹ç¨ã«é¢ãã¦æ¸ãã¦ã¿ã¾ãã
ã½ã«ãã¨ã¯
å¡©ã§ãã
ã¨ãããã±ã¯ç½®ãã¨ãã¦ããã¹ã¯ã¼ããä¿åããæã«ãä½ããã®ãéå¯éå¦çããè¡ã£ãçµæãä¿åãã¦ããäºã¯å¤ãã§ããWindows ã§ã® LM ããã·ã¥ã NTLM ããã·ã¥ãUNIX ç³»ã§ããã°ãå¤ãã¯ä¼çµ±çãªãcryptãé¢æ°ã使ã£ããã®ã ã£ãããä»æã 㨠MD5ãSHA1 ã¨ãã£ãããã·ã¥é¢æ°ã使ã£ãããã¦ãã¾ãã
ãããã¦ããã¨ã
- ä¿åããã¦ãããã¼ã¿ããã¯ãå ã®ãã¹ã¯ã¼ããè¨ç®ããäºãã§ããªãã
- ããããå ¥åãããæååã«å¯¾ãã¦ãåãéå¯éå¦çãè¡ã£ãçµæã¨ãä¿åããã¦ãããã¼ã¿ãæ¯è¼ãããã¨ã§ããã¹ã¯ã¼ãã®æ¤è¨¼ãå¯è½ã§ããã
ã¨ããç¶æ ã«ãªãã¾ãã
ãã®éå¯éå¦çãè¡ãéã«ãã©ã³ãã ãªãã¼ã¿ããã¹ã¯ã¼ãã«ä»ãå ãã¦ããå¦çãè¡ãã¨ãåããã¹ã¯ã¼ãã§ãã£ã¦ããå¦ççµæã¯éã£ããã®ã«ãªãã¾ãããã®ä»å ããããã¼ã¿ããã½ã«ããã¨è¨ãã¾ãã
ãã¹ã¯ã¼ãæ å ±ãä¿åããæã¯ããã®ã½ã«ãã®å¤ã¨å¦ççµæã®å¤ãä¿åãã¦ããã¾ããæ¤è¨¼ããæã«ã¯ãå ¥åããããã¹ã¯ã¼ãã¨ä¿åããã¦ããã½ã«ãã®å¤ãçµã¿åããã¦éå¯éå¦çãè¡ãããã®çµæã¨ä¿åããã¦ããå¤ãæ¯è¼ãã¾ãã
OpenLDAP ã§ã® SSHA ã®ä¾
OpenLDAP ã§ãã¹ã¯ã¼ãæ å ±ãä¿åãã userPassword ã¢ããªãã¥ã¼ãã«ãSSHAï¼ã½ã«ãä»ã SHAï¼ã®ãã¹ã¯ã¼ãæ å ±ãä¿åããã¦ããã±ã¼ã¹ãä¾ã«è¦ã¦ã¿ã¾ãã
ä¸è¨ã®ä¾ã¯ããtesttestãã¨ãããã¹ã¯ã¼ããä¿åããã¦ããæ§åã§ãã
userPassword:: e1NTSEF9Qmc3UEwwN2RQSjB0bzBrYm5rUWNJeFQ4MU1ibTl0VUo=
ãuserPasswordãã®å¾ãã«ã³ãã³ãï¼ã¤ç¶ãã¦ããã®ã¯ãç¶ãæååã Base64 ã§ã¨ã³ã³ã¼ããããçµæã§ããäºã表ãã®ã§ããã³ã¼ããã¦ã¿ã¾ãã以ä¸ã¯ãCentOS 5.5 ä¸ã§å®è¡ããæ§åã§ãããä»ã®ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã§ãåæ§ã ã¨æãã¾ãã使ã£ã¦ããã³ãã³ã㯠GNU çã® echoãbase64ãodãsha1sum ã§ãã
$ echo -n 'e1NTSEF9Qmc3UEwwN2RQSjB0bzBrYm5rUWNJeFQ4MU1ibTl0VUo=' | base64 -d; echo {SSHA}Bg7PL07dPJ0to0kbnkQcIxT81Mbm9tUJ
å é ã«ããã{SSHA}ãã¯ããã® userPassword ã SSHA ã®å½¢å¼ã§ããäºã示ãã¦ãã¦ãå¾ãããã®å¤ã«ãªãã¾ããã¤ã¾ããä¿åããã¦ãããã¹ã¯ã¼ãæ å ±ã¯ãBg7PL07dPJ0to0kbnkQcIxT81Mbm9tUJãã§ãã
ãã®æååèªä½ãBase64 ã§ã¨ã³ã³ã¼ããããçµæãªã®ã§ãã³ã¼ããã¦ã¿ã¾ããä½ãããã³ã¼ãããçµæã¯æåãã¼ã¿ã§ã¯ãªãã®ã§ããã³ã¼ãããçµæã 16 é²ãã³ããã¦ã¿ã¾ãã
$ echo -n 'Bg7PL07dPJ0to0kbnkQcIxT81Mbm9tUJ' | base64 -d | od -txC 0000000 06 0e cf 2f 4e dd 3c 9d 2d a3 49 1b 9e 44 1c 23 0000020 14 fc d4 c6 e6 f6 d5 09 0000030
SHA1 ã®ããã·ã¥å¤ã¯ 160bit = 20 ãã¤ãåºå®ã§ããå®éã®ãã¼ã¿ã¯ 24 ãã¤ãããã®ã§ãå¾ã 4 ãã¤ããã½ã«ãã®å¤ã«ãªãã¾ã*2ãã¤ã¾ããe6 f6 d5 09ããã½ã«ãã®å¤ã§ãã
ã§ã¯ãéã«ãã¹ã¯ã¼ãããè¨ç®ãã¦è¦ã¾ããããå ã®ä¾ã§ã¯ 16 é²ã§ãã³ããã¦ã¾ãããecho ã³ãã³ã㧠8 é²è¡¨è¨ãããé½åãããã®ã§ã8 é²ã§ãã³ããã¦ã¿ã¾ãã
$ echo -n 'Bg7PL07dPJ0to0kbnkQcIxT81Mbm9tUJ' | base64 -d | od -toC 0000000 006 016 317 057 116 335 074 235 055 243 111 033 236 104 034 043 0000020 024 374 324 306 346 366 325 011 0000030
8 é²è¡¨è¨ã ã¨ãã½ã«ãã®å¤ã¯ã346 366 325 011ãã«ãªãã¾ãããã¹ã¯ã¼ãæååããtesttestãã§ãããããããçµã¿åãããã¨ãä¸è¨ã®ããã«ãªãã¾ãã
$ echo -en 'testtest\0346\0366\0325\0011' | sha1sum 060ecf2f4edd3c9d2da3491b9e441c2314fcd4c6 -
ãã®çµæã«ã½ã«ãã®å¤ãã¤ãªããã¨ã{SSHA} ã®å¾ãã®æååããã³ã¼ãããçµæã«ä¸è´ãã¦ããäºãåããã¨æãã¾ãã
ã½ã«ã㨠Rainbow Table
ã½ã«ããå ãããã¨ã§ãåããã¹ã¯ã¼ãã§ãå¾ãããå¦ççµæãéã£ã¦ãã¾ããOpenLDAP ã® SSHA ã®å ´åãã½ã«ã㯠4 ãã¤ã = 32bit ã®ãã¼ã¿ãªã®ã§ã232 = 4,294,967,296 éãã®ã½ã«ããèãããã¾ãã
ã¨ããäºã¯ãï¼ã¤ã®ãã¹ã¯ã¼ãæååã«å¯¾ãã¦ã4,294,967,296 éãã®ããã·ã¥å¤ãèãããããã¨ãããã¨ã«ãªãã¾ãã
Rainbow Table ã¯ããããã·ã¥å¤ãããã ã£ããããã¹ã¯ã¼ãã¯ãããã¨ãããã¼ãã«ã§ããããã½ã«ããç¡ããã°ã
ããã·ã¥å¤ | ãã¹ã¯ã¼ã |
---|---|
51abb9636078defbf888d8457a7c76f85c8f114c | testtest |
ã¨ãã表ãä½ããã¾ããã¨ãããã½ã«ããããã¨ãåããã¹ã¯ã¼ãã§ãã½ã«ããéãã°ããã·ã¥å¤ãéã£ã¦ãã¾ãããããOpenLDAP ã® SSHA ç¨ Rainbow Table ãä½ãã¨ãªãã¨ã
ããã·ã¥å¤ + ã½ã«ã | ãã¹ã¯ã¼ã |
---|---|
55bc8442d5d0614101515ab345ee0a12b5989d4000000000 | testtest |
3955ef9cf1ba8a6341e40511d5347ba472d42a4600000001 | testtest |
c8c951ffb7c35a83eb36fad72105a8d66dcb8d3d00000002 | testtest |
.... | .... |
455f99a067b95a9477cd47f478224f188f91a411ffffffff | testtest |
ã¨ãã£ãå ·åã«ãªããï¼ã¤ã®ãã¹ã¯ã¼ã㧠4,294,967,296 è¡ã®ãã¼ã¿ãä½ãããäºã«ãªãã¾ã
Ophcrack ã§ä½¿ãã 7 æåã¾ã§ã® LM ããã·ã¥ã«å¯¾ãã Rainbow Table ã 7.5 GB ã§ãããLM ããã·ã¥ã§ã¯å¤§æåå°æåãåºå¥ããªãã®ã§ãããªãã³ã³ãã¯ããªãµã¤ãºã«ãªã£ã¦ãã¾ãããããã仮㫠LM ããã·ã¥ã« 4 ãã¤ãã®ã½ã«ããå ããã¨ãåç´è¨ç®ã§ 32,212,254 TB ã«ãªãã¾ã*3ãå®éã® SSHA ã§ã¯å¤§æåå°æåãåºå¥ãã¾ãããããã®æ°åã®ããã 100 åã«ãªãã¯ãã§ã*4ãæ¢ã«éç¾å®çãªå®¹éãªä¸ã«ã7 æåã¾ã§ã§ãã
ã½ã«ãã¨ãã«ã¼ããã©ã¼ã¹
ã½ã«ããä»ãããã¨ã§ãRainbow Table ã使ãã¢ããã¼ãã¯å®è³ªçã«ä½¿ããªããªãäºãåããã¾ãããããããæç´ã«ãã«ã¼ããã©ã¼ã¹ãè¡ãå ´åãããã«å¯¾æããããã®å¹æã¯ã½ã«ãã«ã¯ããã¾ããã
åè¿°ã®ããã«ãä¿åããã¦ãããã¹ã¯ã¼ãæ å ±ããã½ã«ãã®å¤èªä½ã¯åããã¾ãã試ããã¨ãããã¹ã¯ã¼ãåè£ã«å¯¾ãã¦ãèªã¿åã£ãã½ã«ããå ãã¦ããã·ã¥å¤ãæ±ããã°ããã®ãã¹ã¯ã¼ãåè£ãå½ãã£ã¦ãããã©ããã®ç¢ºèªã¯ã§ãã¾ãããã¡ãããï¼ã¤ã®ãã¹ã¯ã¼ãã«å¯¾ããæ¤è¨¼å¦çã§ãè¥å¹²ãå¦çãå¤ããªãï¼ã½ã«ãå¤ãèªã¿åºãå¦çã¨ããã¹ã¯ã¼ãåè£ã«ãã®å¤ãä»ãå ããå¦çï¼ã®ã§ãããå ¨ä½ã®å¦çããè¦ãã°ãã´ãã¿ãããªãã®ã§ãã
ã¾ã¨ã
ã½ã«ãã®å¹ç¨ã¯ãããã¾ã§ã Rainbow Table ã®ãããªããäºãããã·ã¥å¤ãè¨ç®ãã¦ãããã¨ããæ段ã«å¯¾æãããã®ã§ããã«ã¼ããã©ã¼ã¹ã®æ§ã«ãã²ãããããã·ã¥å¤ãè¨ç®ãã¦ãåè´ãããã®ãæ¢ããã¨ããæ段ã«ã¯ãã»ã¨ãã©å½±é¿ã¯ããã¾ããã
ãã ãOphcrack ã§åããããã«ãRainbow Table ã使ããã¨ããã«ã¼ããã©ã¼ã¹ã«æ¯ã¹ã¦åçã«çãæéã§ãã¹ã¯ã¼ããå¤æãã¾ãããããé²ããã®ã¯å¤§ããªã¡ãªããã§ãããã
ã¨ãã»ãã¥ã¢ã®ããã°ã§ãã½ã«ãä»ã SHA-1 ã¯å¤§ä¸å¤«ããã¨ããã®ã¯ãGPU ã使ãã¨ããã·ã¥å¤ãå¹çããè¨ç®ã§ããã®ã§ãããã¾ã§ã ã£ããããã«ã¼ããã©ã¼ã¹ã§è¦ã¤ããæã«ã¯ãæ»ãããã£ã¦ãããã¨è¨ãããã¹ã¯ã¼ãããæå¤ã«æ©ãè¦ã¤ãã£ã¦ãã¾ããã¨ããäºã§ã*5ã
ã§ãããã¹ã¯ã¼ããï¼æåå¢ããã ãã§ãè¦ã¤ããæéã¯ç´ 100 å ã«ãªãã¾ãã2 æåå¢ããã° 10,000 åã§ããä»ã¾ã§ãããï¼æåãããããã¹ã¯ã¼ããé·ãããæ¹ãè¯ãããã§ãã
*2:OpenLDAP ã userPassword ã«ä¿åããéã®ã½ã«ã㯠4 ãã¤ãã§ãããã½ã¼ã¹ãè¦ãã¨ãæ¤è¨¼æã«ã¯ã½ã«ãã®ãµã¤ãºã¯æ±ºã¾ã£ã¦ãªããå¾ããããã¼ã¿ã®ãã¡ã21 ãã¤ãç®ä»¥éãã½ã«ããã¨ããæ±ãã«ãªã£ã¦ããããã§ãããªã®ã§ãèªå㧠4 ãã¤ããã大ããªã½ã«ãã使ã£ã¦è¨ç®ããçµæãä¿åãã¦ããæ£ããæ¤è¨¼ãããã¯ãã§ãã
*3:ãã¡ããããã¼ã¿ãã¼ã¹ã®æ§é ãªã©ã工夫ãã¦ãå§ç¸®ã§ããå¯è½æ§ã¯ããããããã¾ãããã10 å 1 ã«ã§ãã¦ãç¼ãç³ã«æ°´ã§ãã
*4:id:JULY:20100515 ã§ã7 æåã¾ã§ã®ãã¹ã¯ã¼ãã大æåå°æåãåºå¥ããªã㨠100 åã® 1 ã«ãªããã¨ããã¨ãããåç §
*5:ãã®æå³ã§ã¯ãã½ã«ãä»ããå¦ãã¯ç¡é¢ä¿ã ã¨æãã®ã§ãã....