ãããŒãäœãèµ·ããã®ïŒ
Firefoxã¯ã¢ãã¬ã¹ããŒã®è²ãå€æŽããå³äžé ã«ããã¯ã衚瀺ããããã220ããªç§ãè¶ ãããšãå€ãã®èå³æ·±ãããšãèµ·ãããŸããã ç§ã®ãæ°ã«å ¥ãã®WiresharkããŒã«ãšãããã«å€æŽãããFirefoxãããã°ãã«ãã䜿çšããŠãæ£ç¢ºã«äœãèµ·ãã£ãããææ¡ããããšããŸãã
RFC 2818ã«ãããFirefoxã¯ãhttpsããAmazon.comã«æ¥ç¶ããããã«ããŒã443ã䜿çšããå¿ èŠãããããšãæå³ããŠããããšãèªèããŠããŸãã
顧客æšæ¶
TLSã¯ããã¹ãŠã®ãã©ãã£ãã¯ãããŸããŸãªã¿ã€ãã®ãã¬ã³ãŒããã«ã©ããããŸãã HEXã®ãã±ããã®æåã®ãã€ãã¯0x16 = 22ã§ããããšãããããŸããããã¯ããã¬ã³ãŒãããããã³ãã·ã§ã€ã¯ãã§ããããšãæå³ããŸãã
次ã®2ãã€ãã¯0x0301ã§ãããŒãžã§ã³3.1ãæå³ããŸããã€ãŸããTLS 1.0ã¯å®éã«ã¯SSL 3.1ã§ãã
ãã³ãã·ã§ã€ã¯ã¬ã³ãŒãã¯ããã€ãã®ã¡ãã»ãŒãžã«åå²ãããŸãã 1ã€ç®ã¯ã顧客æšæ¶ãïŒ0x01ïŒã§ãã ããã«ã¯ããã€ãã®éèŠãªãã€ã³ãããããŸãã
- ã©ã³ãã ãã¹ïŒ
ãããã®4ãã€ãã¯ãçŸåšã®Unixæéã1970幎1æ1æ¥ããã®ç§æ°ã§ãããã®å Žåã0x4a2f07caã§ãã åŸã«å¿ èŠãª28ãã€ãã®ã©ã³ãã ãã€ããç¶ããŸãã - ã»ãã·ã§ã³IDïŒ
ç§ãã¡ã®å Žåããã®ãã£ãŒã«ãã¯ç©ºã§ãã æ°ç§åã«Amazon.comã«æ¥ç¶ããå Žåãã»ãã·ã§ã³ãç¶è¡ã§ããŸãããå®å šãªãã³ãã·ã§ã€ã¯ã¯ã§ããŸããã - æå·ã¹ã€ãŒãïŒ
ãã©ãŠã¶ã§ãµããŒããããŠãããã¹ãŠã®æå·åã¢ã«ãŽãªãºã ã®ãªã¹ãã ããã©ã«ãã§ã¯ãéåžžã«åŒ·åãªTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHAã䜿çšããããã®åŸã«33åã®ãªãã·ã§ã³ãç¶ããŸãã äœãåãããªããŠãå¿é ããªãã§ãã ããã 次ã«ãAmazonãããã©ã«ãã®ãªãã·ã§ã³ãåãå ¥ããªãããšãåŠã³ãŸãã - ãµãŒããŒåã®æ¡åŒµåïŒ
ãã©ãŠã¶ã«www.amazon.comã®ããŒãžãå¿ èŠã§ããããšãamazon.comã«äŒããæ¹æ³ã TLSãã³ãã·ã§ã€ã¯ã¯HTTPãã©ãã£ãã¯ã®ããªãåã«éå§ããããããããã¯éåžžã«äŸ¿å©ã§ãã HTTPã«ã¯ãHostãããããŒããããããã«ããåãIPã§æ°çŸã®ãµã€ãããã¹ãã§ããŸãã SSLã¯åŸæ¥ããµã€ãããšã«ç°ãªãIPãå¿ èŠãšããŠããŸãããããã®æ¡åŒµæ©èœã«ããããµãŒããŒã¯ç¹å®ã®ãµã€ãã®èšŒææžã§å¿çã§ããŸãã
ãµãŒããŒæšæ¶
Amazon.comã¯ããµã€ãºã2ãã±ããïŒ2,551ãã€ãïŒã®ããªã倧ããªãã³ãã·ã§ã€ã¯ã§å¿çããŸãã ããã¯ãåããã€ãã·ãŒã±ã³ã¹0x0301ã瀺ããŠããŸããã€ãŸããAmazonã¯TLS 1.0ã®äœ¿çšã«åæããŠããŸãã ã¬ã³ãŒãã«ã¯ãèå³æ·±ãããŒã¿ãå«ã3ã€ã®ãµãã¡ãã»ãŒãžããããŸãã
- ãµãŒããŒã®ãŠã§ã«ã«ã ã¡ãã»ãŒãžïŒ
- 4ã€ã®Unixæéãã€ããš28ã®ã©ã³ãã ãã€ãã
- 次ã®ãªã¯ãšã¹ããé«éåããããã®32ãã€ãã®ã»ãã·ã§ã³IDã
- ææ¡ãã34åã®ã¢ã«ãŽãªãºã ã®ãã¡ãAmazonã¯ãTLS_RSA_WITH_RC4_128_MD5ãïŒ0x0004ïŒãéžæããŸããã ããã¯ã蚌ææžã®çœ²åãšéµäº€æãæ€èšŒããããã«RSAã¢ã«ãŽãªãºã ã䜿çšãããããŒã¿ãæå·åããããã«RC4ã¢ã«ãŽãªãºã ããã³ã³ãã³ããæ€èšŒããããã«MD5ããã·ã¥é¢æ°ã䜿çšãããããšãæå³ããŸãã ããã«ã€ããŠã¯åŸã§è©³ãã説æããŸãã Amazonã«ã¯ãããšãã°CPUã®è² è·ãæžãããªã©ããããã®ç¹å®ã®ã¢ã«ãŽãªãºã ãéžæããç¬èªã®çç±ãããããã«æããŸãã å¯èœæ§ãäœããªãã·ã§ã³ã¯ãäžèšã®3ã€ã®ã¢ã«ãŽãªãºã ãã¹ãŠã®äœæè ã§ããRon Rivestã®ãããã§ãã
- 蚌ææžã¡ãã»ãŒãžïŒ
- ã¯ã©ã€ã¢ã³ããAmazon蚌ææžãæ€èšŒããããã«äœ¿çšã§ãã2.464ãã€ãã®å·šå€§ãªã¡ãã»ãŒãžãšãã®èšŒææžã ãããã¯ãã¹ãŠãã©ãŠã¶ã§ã衚瀺ã§ããŸãã
- ã¯ã©ã€ã¢ã³ããAmazon蚌ææžãæ€èšŒããããã«äœ¿çšã§ãã2.464ãã€ãã®å·šå€§ãªã¡ãã»ãŒãžãšãã®èšŒææžã ãããã¯ãã¹ãŠãã©ãŠã¶ã§ã衚瀺ã§ããŸãã
- ããµãŒããŒã®æšæ¶ãå®äºããŸããããšããã¡ãã»ãŒãž
ããããã€ããæ£åžžã«å®äºãããµãŒããŒãã¯ã©ã€ã¢ã³ã蚌ææžãèŠæ±ããªãããšã瀺ã空ã®ã¡ãã»ãŒãžã
蚌ææžã®æ€èšŒ
ãã©ãŠã¶ãAmazon.comãšæ確ã«éä¿¡ããããšã確èªã§ããããã«ã蚌ææžãå¿ èŠã§ãã 蚌ææžã®éå§æ¥ãšçµäºæ¥ã調ã¹ãå ¬ééµãç§å¯éµã®äº€æãèš±å¯ãããŠãããã©ããã確èªããŸãã
ãªã蚌ææžãä¿¡é Œããå¿ èŠãããã®ã§ããïŒ
ã眲åããæ·»ä»ãããŠããŸããããã°ãšã³ãã£ã¢ã³åœ¢åŒã®é·ãæ°åã§ãã
誰ã§ããããã®ãã€ããéä¿¡ã§ããŸãã ãªããã®çœ²åãä¿¡é Œããå¿ èŠãããã®ã§ããïŒ çããããã«ãæ°åŠã®äžçãžã®çãæ è¡ãããŸãã
RSAã®ç°¡åãªçŽ¹ä»
äžéšã®äººã ã¯ãæ°åŠãããã°ã©ãã³ã°ãšäœããã®é¢ä¿ãããã®ã§ã¯ãªãããšèããŠããŸãã 蚌ææžã¯ãæ°åŠã䜿çšããéåžžã«æçœãªã±ãŒã¹ã§ãã Amazon蚌ææžã¯ãRSAã䜿çšããŠçœ²åãæ€èšŒããå¿ èŠãããããšã瀺ããŠããŸãã RSAã¯1970幎ã«MIT Ron RivestææãAdu ShamirææãLen Adlemanææã«ãã£ãŠäœæããã2000幎ã®æ°åŠã®ã¢ã€ãã¢ãçµã¿åãããŠç°¡åãªã¢ã«ãŽãªãºã ãäœæããçŸããæ¹æ³ãèŠã€ããŸããã
2ã€ã®çŽ æ°ãpãšqãéžæããŸãã ããããæããŠnãååŸããŸãã 次ã«ãæå·åææ°ãšãªãåçŽãªå ¬éææ°eãšã解èªè ãšãªãç¹å¥ã«éžæãããéeãdãéžæããŸãã 次ã«ãnãšeãå ¬éããdãç§å¯ã«ããŸãã pãšqãå¿ããããdã§ä¿åã§ããŸãã
ããã§ãã¡ãã»ãŒãžãããå Žåã¯ããã®ãã€ããæ°å€Mã§è¡šãã ãã§æžã¿ãŸããã¡ãã»ãŒãžãæå·åããå¿ èŠãããå Žåã¯ã次ã®ããã«èšç®ããŸãã
Câ¡M e ïŒmod nïŒ
ã€ãŸããMãèªåã§eåæããå¿ èŠããããŸãã mod nã¯ãnã«ããé€ç®ã®æ®ãã®ã¿ãåãããšãæå³ããŸãã ããšãã°ãåå11æ+ 3æé=ååŸ2æïŒmod 12æéïŒã åä¿¡è ã¯dãèªèããéã®æäœãå®è¡ããŠåŸ©å·åã§ããŸãã
C dâ¡ïŒM e ïŒdâ¡M e * dâ¡M 1â¡MïŒmod nïŒ
ãŸããã¡ãã»ãŒãžMãdã§çŽ¯ä¹ããããšã«ãããdãæã€äººãããã¥ã¡ã³ãã«çœ²åã§ããããšãèå³æ·±ãã§ãã
M dâ¡SïŒmod nïŒ
ããã¯ã眲åè ãSãMãeãããã³nãå ¬éããããã«å¯èœã§ãã 誰ã§ãç°¡åãªèšç®ã§Sã®çœ²åãæ€èšŒã§ããŸãã
S eâ¡ïŒM d ïŒeâ¡M d * eâ¡M e * dâ¡M 1â¡MïŒmod nïŒ
å ¬éããŒæå·åã¯ãæå·åããŒïŒãã®å Žåã¯eïŒã埩å·åããŒïŒdïŒãšçãããªããããé察称ãšåŒã°ããŸãã RSAããžãã¯ã¯ãCâ¡M e ïŒmod nïŒãéåžžã«è¿ éã«èšç®ã§ããããæ©èœããŸãããdãããããªããšC dâ¡MïŒmod nïŒã¯ã»ãšãã©äžå¯èœã§ãã åã«èŠãããã«ãdã¯nãpãšqã«å解ããããšã§åŸãããŸãããããã¯ããªãè€éã§ãã
眲åæ€èšŒ
å®éã«RSAã䜿çšããå Žåããã¹ãŠã®æ°å€ã¯__éåžžã«å€§ãããªããã°ãªããªãããšã«æ³šæããããšãéèŠã§ãã ããã AmazonãVeriSign Class 3 Secure Server CAã«ãã£ãŠèªå® ããã¯ãnã2048ãããé·ã§ããå¿ èŠãããããšãæå³ããŸããããã¯10é²æ°ã§ãã
2091550579 0341204005 1169453804 7325464426 0479594122 4167270607 6731441028 3698615569 9947933786 3789783838 5829991518 1037601365 0218058341 7944190228 0926880299 3425241541 4300090021 1055372661 2125414429 9349272172 5333752665 6605550620 5558450610 3253786958 8361121949 2417723618 5199653627 5260212221 0847786057 9342235500 9443918198 9038906234 1550747726 8041766919 1500918876 1961879460 3091993360 1890572922 9464742433 9498401781 6528521078 8629616064 3051642608 4317020197 7241822595 6075980039 8371048211 4887504542 4200635317 0422636532 6376719337 6644159792 1249204891 7079005527 7689341573 9395596650 5484628101 0469658502 1566385762 0175231997 6268718746 7514321
ïŒpãšqãéžæãããšå¹žéã§ããå¯èœã§ããã°ãåœã®VeriSign蚌ææžãçæã§ããŸããïŒ
眲åSãpublic e VeriSignã§çŽ¯ä¹ããã¢ãžã¥ãŒã«nã«ããé€ç®ã®æ®ããååŸãããšã埩å·åããã眲åã16é²æ°ã§ååŸãããŸãã
0001FFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFF00302130 0906052B0E03021A 05000414C19F8786 871775C60EFE0542 E4C2167C830539DB
PKCSïŒ1 v1.5èŠæ Œã«ããã°ãæåã®ãã€ã00ã¯ãæå·åãããã¯ãæŽæ°ã«å€æããŠã¢ãžã¥ãŒã«ããå°ããããããã®ãã®ã§ãïŒã¢ãžã¥ãŒã«ãäœã§ãããã¯ãŸã ããããŸããã§ãã-ãããTranslãïŒã 2çªç®ã®ãã€ã01ã¯ããããç§å¯ããŒæäœã§ããããšã瀺ããŸãã 次ã«ã空ã®ã¹ããŒã¹ãç²åŸããããã«FFãã€ãã®æã ãã€ã00ã§çµäºãã次ã«ã·ãŒã±ã³ã¹ã30 21 30 09 06 05 2B 0E 03 02 1A 05 00 04 14ãã¯ãSHA-1é¢æ°ã®äœ¿çšãæå³ããŸãã æåŸã®20ãã€ãã¯ãsignedCertificateã®ãã€ãããã®SHA-1ã®çµæã§ãã
埩å·åãããå€ã¯æ£ãããã©ãŒããããããŠãããæåŸã®ãã€ãã¯èªåã§èšç®ã§ãããã®ã«å¯Ÿå¿ããŠãããããVeriSign Class 3 Secure Server CAç§å¯éµãç¥ã£ãŠãã誰ããããã«çœ²åãããšæ³å®ã§ããŸãã
ãã®ããã»ã¹ãç¹°ãè¿ããŠãVeriSign Class 3 Secure Server CA蚌ææžãVeriSignã®Class 3 Public Primary Certification Authorityã«ãã£ãŠçœ²åãããŠããããšã確èªã§ããŸãã
ãããããªã圌ãä¿¡é Œããå¿ èŠãããã®ã§ããããïŒ ãã®ä¿¡é Œãã§ãŒã³ã«ã¯ããã以äžã®ãªã³ã¯ã¯ãããŸããã
ã«ãŒãVeriSignã¯ã©ã¹3ãããªãã¯ãã©ã€ããªèªèšŒå±ã¯ãããèªäœã§çœ²åãããŸããã ãã®èšŒææžã¯ãç¡æ¡ä»¶ã«ä¿¡é Œã§ãã蚌ææžãšããŠMozilla補åã«çµã¿èŸŒãŸããŠããŸãã
ããªãã¹ã¿ãŒããŒ
Amazon.comã確èªããå ¬éæå·åææ°eãšã¢ãžã¥ãŒã«nãç¥ã£ãŠããŸãã ç§ãã¡ã®è©±ãèããŠãã人ãªã誰ã§ãåãããšãã§ããŸãã 次ã«ãæ»æè ãèªèããªãã©ã³ãã ããŒãçæããå¿ èŠããããŸãã Netscape Navigator 1.1ã®æ¬äŒŒä¹±æ°ãžã§ãã¬ãŒã¿ãŒã®è匱æ§ã«ãããåœæã®ãã·ã³ã§ã¯25ç§ã§SSLãã¯ã©ãã¯ãããå¯èœæ§ããããããèŠããã»ã©ç°¡åã§ã¯ãããŸããã å¶ç¶ã®äžèŽãé£ãããšæããªãå Žåã¯ãOpenSSLã¡ã³ãããŒã«DebianãäŸé Œã§ããŸãã
ããšãã°ãWindowsã§ã¯ãæ¬äŒŒä¹±æ°çæé¢æ°ã¯125ã®ãœãŒã¹ããããŒã¿ãååŸããŸãã Firefoxã¯ãã®çµæã䜿çšããŠãæ°ãããã®ç¬èªã®æ¬äŒŒã©ã³ãã ããŒã¿ãè¿œå ããŸã
å€ãã®ããšãæšæž¬ãããããã48ãã€ãã®ãããªãã¹ã¿ãŒããŒããç§å¯ã«ããããšãéåžžã«éèŠã§ãã FirefoxãèŠã€ãã«ããã®ãäžæè°ã§ã¯ãããŸããã ãããã°ããŒãžã§ã³ããã«ãããSSLDEBUGFILEããã³SSLTRACEãã©ã°ãèšå®ããŠè¡šç€ºããå¿ èŠããããŸããã
4456ïŒSSL [131491792]ïŒPre-Master Secret [ã¬ã³ïŒ48]
03 01 bb 7b 08 98 a7 49 de e8 e9 b8 91 52 ec 81 ... {... I ..... R ...
4c c2 39 7b f6 ba 1c 0a b1 95 50 29 be 02 ad e6 L.9 {...... PïŒ...
ad 6e 11 3f 20 c4 66 f0 64 22 57 7e e1 06 7a 3b .nãïŒ .fd "Wã..z;
å®å šã«ã©ã³ãã ã§ã¯ãããŸãããTLSæšæºã®æåã®2ãã€ãã¯03 01ã§ããå¿ èŠããããŸãã
ããŒäº€æ
次ã«ããã®ç§å¯ã®çªå·ãAmazon.comã«è»¢éããå¿ èŠããããŸãã Amazonã¯ãTLS_RSA_WITH_RC4_128_MD5ãã®äœ¿çšãæãã§ãããããRSAã§æå·åããŸãã ããªãã¹ã¿ãŒããŒã®48ãã€ãã®ã¿ãã¡ãã»ãŒãžãšããŠäœ¿çšã§ããŸãããPKCSïŒ1 v1.5æšæºã«åŸã£ãŠã空ã®ã¹ããŒã¹ã«ã©ã³ãã ããŒã¿ãå ¥åãããã±ãããµã€ãºã128ãã€ãã«ããå¿ èŠããããŸãã ãã®ãããæ»æè ãžã®ãã±ããã解èªããããšã¯ããå°é£ã«ãªããŸãã
æåŸã«ãFirefoxã¯æåŸã®æå·åãããŠããªãã¡ãã»ãŒãžãæå·ä»æ§ã®å€æŽããšã³ããªãéä¿¡ããŸãã
ããã¯ã以åã«æž¡ãããç§å¯éµã次ã®ã¡ãã»ãŒãžã«äœ¿çšããããšãAmazonã«äŒããFirefoxã®æ¹æ³ã§ãã
ã³ã³ãã¥ãŒãã£ã³ã°ãã¹ã¿ãŒã·ãŒã¯ã¬ãã
ãã¹ãŠãæ£ãããã°ãåæ¹ã¯48ãã€ãã®ããªãã¹ã¿ãŒããŒãèªèããŸãã ããªãã¹ã¿ãŒã«ã¯ã¯ã©ã€ã¢ã³ãããŒã¿ã®ã¿ãå«ãŸãããµãŒããŒããŒã¿ã¯å«ãŸããªããããAmazonåŽã«ã¯ããããªäžä¿¡æããããŸãã ãã¹ã¿ãŒããŒãèšç®ããŠãããä¿®æ£ããŸãã
master_secret = PRFïŒpre_master_secretãããã¹ã¿ãŒã·ãŒã¯ã¬ããããClientHello.random + ServerHello.randomïŒ
PRFã¯ãä»æ§ã§å®çŸ©ãããŠããç䌌ã©ã³ãã é¢æ°ã§ãããéåžžã«æ³šæãå¿ èŠã§ãã HMACããŒãžã§ã³MD5ããã³SHA-1ã䜿çšããŸãã å ¥åã®ååã¯åæ©èœã«éä¿¡ãããçµæã¯æ»æã«å¯ŸããŠéåžžã«æµæåããããŸãã
ãã®çµæã48ãã€ãã®ãã¹ã¿ãŒã·ãŒã¯ã¬ãããååŸããŸãã
4C AF 20 30 8F 4C AA C5 66 4A 02 90 F2 AC 10 00 39 DB 1D E0 1F CB E0 E0 9D D7 E6 BE 62 A4 6C 18 06 AD 79 21 DB 82 1D 53 84 DB 35 A7 1F C1 01 19
ä»ã®ããŒãçæãã
äž¡åŽã«ãã¹ã¿ãŒã·ãŒã¯ã¬ãããããã®ã§ãä»æ§ã«åŸã£ãŠãPRFã䜿çšããŠã»ãã·ã§ã³ã«å¿ èŠãªãã¹ãŠã®ããŒãèšç®ããŠããããŒãããã¯ããäœæããããããå¿ èŠãªããŒã¿ãååŸããŸãã
key_block = PRFïŒSecurityParameters.master_secretããããŒæ¡åŒµããSecurityParameters.server_random + SecurityParameters.client_randomïŒ;
ãããŒãããã¯ãã®ãã€ãã¯æ¬¡ã®å Žåã«å¿ èŠã§ãã
client_write_MAC_secret [SecurityParameters.hash_size]
server_write_MAC_secret [SecurityParameters.hash_size]
client_write_key [SecurityParameters.key_material_length]
server_write_key [SecurityParameters.key_material_length]
client_write_IV [SecurityParameters.IV_size]
server_write_IV [SecurityParameters.IV_size]
ãããã¯æå·åã§ã¯ãªãã¹ããªãŒãã³ã°ã䜿çšãããããåæåãã¯ãã«ã¯å¿ èŠãããŸããã ãã ããMD5ã®çµæã16ãã€ãé·ãªã®ã§ãååŽã«2ã€ã®ã¡ãã»ãŒãžèªèšŒã³ãŒãïŒMACïŒããŒããããã16ãã€ãå¿ èŠã§ãã ããã«ãRC4ã¯16ãã€ãã®ããŒã䜿çšããŸããããããäž¡æ¹ã®åœäºè ãå¿ èŠãšããŸãã äžè¬ã«ãããŒãããã¯ãã2 * 16 + 2 * 16 = 64ãã€ããå¿ èŠã§ãã
PRFãå®è¡ãããšã以äžãåŸãããŸãã
client_write_MAC_secret = 80 B8 F6 09 51 74 EA DB 29 28 EF 6F 9A B8 81 B0
server_write_MAC_secret = 67 7C 96 7B 70 C5 BC 62 9D 1D 1F 4A A6 79 81 61
client_write_key = 32 13 2C DD 1B 39 36 40 84 4A DE E5 6C 52 46 72
server_write_key = 58 36 C4 0D 8C 7C 74 DA 6D B7 34 0A 91 B6 8F A7
æå·åããæºåãããŠãã ããïŒ
ã¯ã©ã€ã¢ã³ããéä¿¡ããæåŸã®ãã³ãã·ã§ã€ã¯ã¡ãã»ãŒãžã¯ãæçµã¡ãã»ãŒãžãã§ãã ããã¯ã誰ããã³ãã·ã§ã€ã¯ãåœé ããŠããªãããšã蚌æããããŒãç¥ã£ãŠããããšã蚌æããããªãããŒãªã¡ãã»ãŒãžã§ãã ã¯ã©ã€ã¢ã³ãã¯ããã³ãã·ã§ã€ã¯ã¡ãã»ãŒãžãããã¹ãŠã®ãã€ããååŸãããããã¡ã«è¿œå ããŸãã 次ã«ãæ¬äŒŒä¹±æ°ãžã§ãã¬ãŒã¿ããã¹ã¿ãŒããŒããã¯ã©ã€ã¢ã³ãçµäºãè¡ãããã³ãããã¡ããã®MD5ãšSHA-1ã䜿çšããŠã12ãã€ãã®ç¢ºèªãèšç®ãããŸãã
verify_data = PRFïŒmaster_secretããclient finishedããMD5ïŒhandshake_messagesïŒ+ SHA-1ïŒhandshake_messagesïŒïŒ
çµæãååŸããå®äºã瀺ããã€ã0x14ãããã³ããããŒã«é·ã00 00 0ã®ãã€ããè¿œå ããŠã12ãã€ããéä¿¡ããŠããããšã瀺ããŸãã ãã®åŸãä»åŸã®ããã«ããã¹ãŠã®æå·åãããã¡ãã»ãŒãžã«ã€ããŠã誰ã解èªãããã³ã³ãã³ããåœé ããŠããªãããšã確èªããå¿ èŠããããŸãã MD5ããŸãã¯ããããã®HMACããŒãžã§ã³ã䜿çšããŸãã
HMAC_MD5ïŒããŒãmïŒ= MD5ïŒïŒããŒâopadïŒ++ MD5ïŒïŒããŒâipadïŒ++ mïŒ
ïŒâã¯XORã++ã¯é£çµããopadãã¯ãã€ãã5c 5c ... 5cãããipadãã¯ãã€ãã36 36 ... 36ããæå³ããŸãïŒã
äžè¬çã«ã次ã®èšç®ãè¡ããŸãã
HMAC_MD5ïŒclient_write_MAC_secretãseq_num + TLSCompressed.type + TLSCompressed.version + TLSCompressed.length + TLSCompressed.fragmentïŒïŒ;
ãæ°ã¥ããããããŸãããããªã¯ãšã¹ãçªå·ãæ··ããŠããã±ããã®ç¹°ãè¿ãã§ç¹å®ã®æ»æããä¿è·ããŸãã
æå·åããã ãã§ãã
RC4æå·å
éžæããæå·åã¢ã«ãŽãªãºã ã®ã»ããã¯ãRC4ã䜿çšããããã«æ瀺ããŸãã ãšãŠãç°¡åãªã®ã§ãæ°åã§ç¿åŸã§ããŸãã
RC4ã¯ã256ãã€ãã®é åSãäœæãã0ãã255ã®å€ãå ¥åããããšããå§ããŸãããã®åŸãããŒã®ãã€ãããå¹²æžãããããšã«ãã£ãŠé åã調ã¹ãå¿ èŠããããŸãã ããã¯ãã©ã³ãã ãã€ãã®çæã«äœ¿çšãããã¹ããŒããã·ã³ãäœæããããã«è¡ãããŸãã 次ã«ãé åSãæ··åããŸãã
ã°ã©ãã£ã«ã«ã«ã¯ã次ã®ããã«è¡šãããšãã§ããŸãã
ãã€ããæå·åããããã«ãæå·åããããã€ããšç䌌ã©ã³ãã ãã€ããXORããŸãã
ãã®ããããã¹ãŠãéåžžã«ã·ã³ãã«ã§ãããã«åäœããŸãã ãã®ãããAmazonã¯ãã®ã¢ã«ãŽãªãºã ãéžæããããã§ãã
ãclient_write_keyããšãserver_write_keyããããããšãæãåºããŠãã ããã ããã¯ãRC4ã®2ã€ã®ã€ã³ã¹ã¿ã³ã¹ãå¿ èŠã§ããããšãæå³ããŸãã1ã€ã¯å¿çã®åŸ©å·åçšããã1ã€ã¯èŠæ±ã®æå·åçšã§ãã
ãclient_writeãããã®æåã®ããã€ãã®ã©ã³ãã ãã€ãã¯ã7E 20 7A 4D FE FB 78 A7 33 ...ãã§ãã æå·åãããŠããªãããããŒã§ãããã®ãã€ããéžæããã¡ãã»ãŒãžã14 00 00 0C 98 F0 AE CB C4 ...ãã®ãã€ãã確èªãããšãäžã®Wiresharkã®ã¹ã¯ãªãŒã³ã·ã§ããã§ç¢ºèªã§ãããã®ãåŸãããŸãã
ãµãŒããŒã¯ã»ãŒåãããšãè¡ããŸãã ãæå·ä»æ§ã®å€æŽããéä¿¡ããŠããããã¹ãŠã®ãã³ãã·ã§ã€ã¯ã¡ãã»ãŒãžãšæå·åãããŠããªããæçµãã¡ãã»ãŒãžãå«ããæçµãã¡ãã»ãŒãžãéä¿¡ããŸãã ããã¯ããµãŒããŒãã¡ãã»ãŒãžã解èªã§ããããšãã¯ã©ã€ã¢ã³ãã«èšŒæããŸãã
ã¢ããªã±ãŒã·ã§ã³ã¬ãã«ãžããããïŒ
ããŠã220ããªç§åŸïŒ3æéåŸ-çŽTranslãïŒãæçµçã«ã¢ããªã±ãŒã·ã§ã³ã¬ãã«ã䜿çšããæºåãã§ããŸããã ããã§ãéåžžã®HTTPãã©ãã£ãã¯ã亀æã§ããŸããããã¯ãRC4ã䜿çšããŠTLSã§æå·åãããã¹ããŒãã£ã³ã°ã®å Žåã«ãã§ãã¯ãããŸãã
ããã§ãã³ãã·ã§ã€ã¯ãå®äºããŸããã TLSã¬ã³ãŒãã®ã³ã³ãã³ãã¯çŸåš0x17ã§ãã æå·åããããã©ãã£ãã¯ã¯17 03 01ããå§ãŸããããã¯ã¬ã³ãŒãã®ã¿ã€ããšTLSã®ããŒãžã§ã³ã瀺ããŸãã
ãã±ããæå·åïŒ
GET /gp/cart/view.html/ref=pd_luc_mri HTTP / 1.1
ãã¹ãïŒ www.amazon.com
ãŠãŒã¶ãŒãšãŒãžã§ã³ãïŒMozilla / 5.0ïŒWindows; U; Windows NT 6.0; en-US; rvïŒ1.9.0.10ïŒGecko / 2009060911 Minefield / 3.0.10ïŒ.NET CLR 3.5.30729ïŒ
èš±å¯ïŒtext / htmlãapplication / xhtml + xmlãapplication / xml; q = 0.9ã* / *; q = 0.8
Accept-LanguageïŒen-usãen; q = 0.5
Accept-EncodingïŒgzipãdeflate
Accept-CharsetïŒISO-8859-1ãutf-8; q = 0.7ã*; q = 0.7
ããŒãã¢ã©ã€ãïŒ300
æ¥ç¶ïŒããŒãã¢ã©ã€ã
...
ããã次ã®çµæãåŸãããŸãã
ãµãŒããŒã¯åãããšãè¡ããŸãã 埩å·åã«ããã以äžãæäŸãããŸãã
HTTP / 1.1 200 OK
æ¥ä»ïŒ2009幎6æ10æ¥æ°Žææ¥01:09:30 GMT
ãµãŒããŒïŒãµãŒããŒ
...
æ¥ç¶ïŒéãã
転éãšã³ã³ãŒãïŒãã£ã³ã¯
æ¥ç¶ã¯ãã©ã¡ããã®åŽãå®äºã®èŠåã¡ãã»ãŒãžãéä¿¡ãããŸã§éãããŸãŸã«ãªãããã®åŸæ¥ç¶ãéããŸãã åã®æ¥ç¶ãéããåŸããã«åæ¥ç¶ããå Žåãå€ãããŒã䜿çšããŠããã³ãã·ã§ã€ã¯ãå床å®è¡ããªãããã«ããããšãã§ããŸãã
ã¢ããªã±ãŒã·ã§ã³ã¬ãã«ã§ã¯ã絶察ã«äœã§ãã§ããããšãç解ããããšãéèŠã§ãã TLSã®äžã§å®è¡ã§ããä»ã®å€ãã®TCP / IPããŒã¹ã®ãããã³ã«ããããŸãã ããšãã°ãFTPSã èªè»¢è»ãçºæãããããTLSã䜿çšããæ¹ãåžžã«è¯ãã§ãã
ããã ãã§ãïŒ
TLS RFCã¯ããããŸã§è°è«ããŠããªãå€ãã®è©³çŽ°ãã«ããŒããŠããŸãã FirefoxãšAmazonéã®220ããªç§ã®ãã³ã¹ã®ã¿ã調ã¹ãŸããã 誰ããAmazonã®æ°nãpãšqã«å解ãããšã蚌ææžãå€æŽãããŸã§ãã¹ãŠã®Amazonãã©ãã£ãã¯ã解èªã§ããããšãåŠã³ãŸããã
ããã220ããªç§ã§ãã€ã³ã¿ãŒãããäžã®2ã€ã®ãã€ã³ããæ¥ç¶ãããçžäºã«ä¿¡é Œã®ããã®ååãªããŒã¿ãæäŸãããæå·åã¢ã«ãŽãªãºã ãèšå®ãããæå·åããããã©ãã£ãã¯ã®äº€æãéå§ãããŸããã
ãããŠããããçä¹³ãè²·ãããšãã§ããããã«ã