
ãã®èšäºã§ã¯ãã¡ãã»ã³ãžã£ãŒã®ãããã³ã«ã調æ»ãããWhatsAppã¯ç§ãã¡ã®éä¿¡ãèªãããšãã§ããŸããïŒããšãã質åã«çããPHPã«å¿ èŠãªãã¹ãŠã®ã³ãŒããæ·»ä»ããæ¹æ³ã詳ããèŠãŠãããŸãã
äžè¬çãªæ å ±
WhatsAppã¯ãã¡ãã»ãŒãžåœ¢åŒãšããŠXMPPãããã³ã«ã®æŽæ°ããŒãžã§ã³ã䜿çšããŸãã ãã¹ãŠã®ã¡ãã»ãŒãžã¯ãé »ç¹ã«äœ¿çšãããåèªã1ãã€ããŸãã¯2ãã€ãã®ããŒã¯ã³ã«çœ®ãæããããšã«ãã£ãŠå§çž®ãããŸãïŒããšãã°ããã¡ãã»ãŒãžãã®ä»£ããã«ãã€ã0x5fãæžã蟌ã¿ãŸãïŒã
äžéšã®ããã±ãŒãžã¯ããªãã·ã§ã³ã§zlibå§çž®ãããŠããå ŽåããããŸãã åä¿¡ãããã±ããã¯AES GCM 256ãããã§æå·åããããµãŒããŒã«éä¿¡ãããŸãã
æå·åããŒãååŸããããã«ãã¯ã©ã€ã¢ã³ãã¯ãã€ãºãããã³ã«ãã³ãã·ã§ã€ã¯ãå®è¡ããŸãã ããã§ããã¯ãã説æãããŠããŸãã äœããã®çç±ã§ããªãŒãã³å®è£ ã®ãã¹ãŠã®éçºè ãã³ãŒããžã®å®è£ ãæåŠããããµããŒãçµäºããã€ãåã£ããããä¿®æ£ããŸãã
æåã®æ¥ç¶ã§ãå®å šãªãã³ãã·ã§ã€ã¯ãå®è¡ãããŸãã ãµãŒããŒãžã®æ¥ç¶ã«æåããåŸã次ã®ã»ãã·ã§ã³ã§æ°ããããŒãçºè¡ããããã³ã«ãããŒã亀æããã«åŸã§æ¥ç¶ã確ç«ãããŸãã
WhatsAppã¯libaxolotlïŒSignal ProtocolïŒã䜿çšãããšã³ãããŒãšã³ãã®æå·åããµããŒããã2ã€ã®ããŒãžã§ã³ãã³ãŒãã«å®è£ ãããŠããŸããæåã¯æå·åãè¡ãããã®åŸãã¢ã©ã€ã¡ã³ããè¿œå ããŠv2ãšåŒã³ãŸããã å¯äžã®åé¡ããããŸã-ãªããªã äžå€®éäžåã®ã·ã¹ãã ã§ããå ŽåãããŒè»¢éã¯WhatsAppãµãŒããŒãçµç±ãããããã¡ãã»ã³ãžã£ãŒéçºè ãåœã®æå·åããŒã転éããŠéä¿¡ãå®å šã«èªã¿åãããã®æè¡çãªé害ã¯ãŸã£ãããããŸããã ãã ããããã«ã¯é¡åå¹æã¯ãããŸãããåŸç¥æµã§ã¡ãã»ãŒãžãèªãããšã¯ã§ããŸããã
ãšããã§ãäžæ£ãªé£çµ¡å ããã¡ãã»ãŒãžãåä¿¡ãããšãã¡ãã»ã³ãžã£ãŒã«ãã¹ãã ã«ã€ããŠèŠæ ãç³ãç«ãŠãããã¿ã³ã衚瀺ãããŸããã¯ãªãã¯ãããšãé£çµ¡å ããããã¯ããã ãã§ãªããå®å šãªãã£ãã«ïŒæ¢ã«éããŠããïŒïŒçµç±ã§ã¡ãã»ãŒãžããã¹ãã転éããŸãã ã¢ããªã±ãŒã·ã§ã³ã³ãŒããå®å šã«èª¿æ»ããªããšããã®æ©èœãä»ã®å Žåã«äœ¿çšãããªãããšãä¿èšŒããæ¹æ³ã¯ãããŸããã
WhatsAppã¢ããªã±ãŒã·ã§ã³ã§æå·åããŒã®ä¿¡é Œæ§ã確èªããã«ã¯ãé£çµ¡å ã«ãŒãã«ç§»åããŠ[æå·å]é ç®ãéžæããŸãããã®åŸãã¢ããªã±ãŒã·ã§ã³ã¯åä¿¡è ã®ããã€ã¹ã§QRã³ãŒãã®ã¹ãã£ã³ãæäŸããŸãã ãããã£ãŠããšããã§ãWhatsAppãããã³ã«ã«åºã¥ããŠã«ã¹ã¿ã ã¢ããªã±ãŒã·ã§ã³ãäœæããæå·åããŒã®ã¹ããŒã¿ã¹ãåžžã«ç£èŠãããNSA is watching youããŸãã¯ãYou are safeããšããçŸãããã€ãçºè¡ã§ããŸããããŸããŸãªã€ã³ã¹ã¿ã³ãã¡ãã»ã³ãžã£ãŒãèããŠããã®ãã¡ã®1ã€ãã¢ããªã±ãŒã·ã§ã³ã¯ããã«äŸ¿å©ã«ãªããŸãã
æäœã¢ã«ãŽãªãºã ã¯æ¬¡ã®ããã«æ³å®ã§ããŸããQRã³ãŒãã衚瀺ããããã€ã¹ã¯å ¬éããŒããšã³ã³ãŒãããQRã³ãŒããèªã¿åãããã€ã¹ã¯ããŒãããŒã¿ããŒã¹å ã®ããŒãšæ¯èŒããŸãã ããã¯ãã¢ããªã±ãŒã·ã§ã³ã«ããã¯ããŒã¯ããªãå Žåã«ã®ã¿ãããŒãæ€èšŒããå®å šãªæ¹æ³ã§ãã
éä¿¡ãã«ãã¡ãã£ã¢ãã¡ã€ã«ãWhatsAppãµãŒããŒã«ã¢ããããŒãããããšããããã§æå·åãããŠãããã©ããã«ã€ããŠè¿œå ã®èª¿æ»ã¯è¡ããŸããã§ããã ã»ãšãã©ã®å Žåãæå·åãããŠããŸããã ã¢ããªã±ãŒã·ã§ã³éçºè ã¯èªåèªèº«ãä¿¡é Œãããã¡ã€ã«ãžã®ãªã³ã¯ã¯ãšã³ãããŒãšã³ãæå·åã§ä¿è·ããããã£ãã«ãä»ããŠéä¿¡ãããŸãã
ã¢ã«ãŠã³ãç»é²
ç»é²ã¯ãv.whatsapp.netãã¡ã€ã³ã«å¯Ÿãã3ã€ã®httpsèŠæ±ã§è¡ãããŸãïŒãããã¯ãburpãmitmproxyãªã©ã®æ¢ç¥ã®æ¹æ³ã§ã¹ãã€ãããå¯èœæ§ããããã¢ããªã±ãŒã·ã§ã³ã¯ssl killã¹ã€ããã®äœ¿çšããã€ãã¹ãã蚌ææžã®ãã³çãã䜿çšããŸãïŒã
v.whatsapp.net/v2/exists?cc=_&in=&id=id_&lg=en&lc=zz
æçšãªããšã¯äœãè¡ããããã®çªå·ãæ¢ã«ç»é²ãããŠãããã©ããã確èªããããã«äœ¿çšãããŠããŸããïŒããããã誰ããããŒã¿ããŒã¹ã®ãœãŒããéå§ãããŸã§ïŒ
v.whatsapp.net/v2/code?method=sms&cc=_&in=&token=&sim_mcc=mcc&sim_mnc=mnc&id=id_&lg=en&lc=zz&__
å®éã«ã¢ã¯ãã£ããŒã·ã§ã³SMSã³ãŒããèŠæ±ããŸãã åæ§ã®ãªã¯ãšã¹ãã䜿çšããŠãã³ãŒã«ãåä¿¡ããããšãã§ããŸãã ãšã³ãããŒãšã³ãã®æå·åèšå®ã¯ãªãã·ã§ã³ã§ã-ããã«æ¥ç¶ãããšãã«èšå®ã§ããŸãã ããŒã¯ã³ã¯æ¬¡ã®ããã«ãªããŸãã
md5ïŒ "0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM"ãmd5ïŒ "21752"ïŒã "phone"ïŒ
æåã®è¡ã¯ãæå·åãããæååã®ã©ã³ãã¹ã±ãŒãã§ãã ã¢ããªã±ãŒã·ã§ã³ã®ä»»æã®ããŒãžã§ã³ïŒ21752ïŒã«çœ®ãæããããšãã§ããŸãïŒæã奜å¥å¿ã匷ã人ã¯ããŸã ãªãªãŒã¹ãããŠããªãããŒãžã§ã³ã«ç»é²ããããšããããšãã§ããŸãïŒãã¢ããªã±ãŒã·ã§ã³ã³ãŒãã§ã¯ãããŒãžã§ã³ããã®ããã·ã¥ã¯æ¢è£œã§ãããmd5ããã·ã¥ã«äŒŒããã®ãããã«éžæãããŸãã
v.whatsapp.net/v2/register?cc=_&in=&code=__&id=id_&lg=en&lc=zz
ãã®ãªã¯ãšã¹ãã¯ãããããSMSãŸãã¯é話ã§åä¿¡ããã³ãŒãã§ç»é²ã確èªããŸãã
ãªã¯ãšã¹ãã¯ã
User-Agent: WhatsApp/2.17.52 iPhone_OS/7.1.2 Device/iPhone_4
ãŸãã ããŒã¯ã³ãæ£ããæ€èšŒããã«ã¯ãããããæ£ãããšãŒãžã§ã³ããå¿ èŠã§ãã
MITM
ããã¯ç¥ãããŠããæåã®æ¥ã§ã¯ãããŸãã-WA16ãããã³ã«ïŒChat-APIãYowsupïŒã®å®è£ ãããã€ããããŸããçŸåšã®WA20ãšã®éãã¯åºæ¬çã«ãã€ãºãããã³ã«ã®ã¿ã§ãã ãã®æ å ±ã䜿çšããŠã埩å·åãããã¢ããªã±ãŒã·ã§ã³ãã©ãã£ãã¯ã衚瀺ããããŒã«ã«MITMãéçºã§ããŸãã ãªããªã æåã¯ãXMPPã¢ããªã±ãŒã·ã§ã³ãããã³ã«-ããã«çºçããããšã¯ãã¹ãŠã解èªããããã©ãã£ãã¯ããããã«ç解ã§ãããããéã¢ã»ã³ãã©ãŒã®ãžã£ã³ã°ã«ã«é£ã³èŸŒãç¹å¥ãªå¿ èŠã¯ãããŸããã
MITMãèµ·åããã«ã¯ãå®éã®WhatsAppãµãŒããŒãšããŠèªåèªèº«ã玹ä»ããå®å šãªãã³ãã·ã§ã€ã¯ãå®è¡ããŸãããã®åŸãã¢ããªã±ãŒã·ã§ã³ã¯ãã©ãã£ãã¯ããªãã¹ã³ããå ã®whatsappãµãŒããŒã«ãªãã€ã¬ã¯ãããŸãã ãããè¡ãã«ã¯ãå ã®ã¢ããªã±ãŒã·ã§ã³ãå€æŽããå¿ èŠããããŸãã
ãã¹ãŠã®æäœã¯ãiPhone 4ãiOS 7.1.2ãIDA 7ãWhatsApp 2.17.52ã®æ§æã§å®è¡ãããŸãã
ãããé©çš
1.ãã¹ãŠã®æ¥ç¶ã§å®å šãªãã³ãã·ã§ã€ã¯ãå®è¡ããŸããããã«ãããç掻ãå€§å¹ ã«ç°¡çŽ åãããŸãã ã¡ãœãã
-[NoiseHandshakeManager initWithLoginPayload:clientStaticKeyPair:serverStaticPublicKey:]
with
serverStaticPublicKey
ã
ResumeHandshake
ã
serverStaticPublicKey
ããªãå Žåã


serverStaticPublicKeyã¯ã¬ãžã¹ã¿R0ã«æ ŒçŽãããååšããªãå Žåã¯FullHandshakeãžã®ç§»è¡ãå®è¡ãããŸãã ãããŠããã®ç§»è¡ãç¡æ¡ä»¶ã«ããŸãã ãããè¡ãã«ã¯ã2ãã€ãã眮ãæããŸã

ã«

çµæ

ãã³ã³ãã€ã©ã§ã¯ãæ¡ä»¶åå²ã®1ã€ãå°éäžèœã«ãªãã衚瀺ãããªãããšãããããŸãã

2.ãµãŒããŒçœ²åã®æ€èšŒãç¡å¹ã«ããŸãã å ã®ãµãŒããŒã®ç§å¯éµã¯ãããŸããã ãã®å€æŽããªããã°ããã©ãã£ãã¯ãèãããšã¯ã§ããŸããã ãããè¡ãã«ã¯ãïŒboolïŒã¡ãœããã«å€æŽãå ããŸã-
[NoiseHandshakeManager validateNoiseCertificate:serverHandshakeStaticPublicKey:]
ã

åžžã«1ãè¿ãé¢æ°ãå¿ èŠã§ãã ããã§ãã¬ãžã¹ã¿ãŒR6ããã®èšŒææžæ€èšŒã®çµæãR0ã«é 眮ãããŸãã

R0ã§ãŠããããæžããŸããã

çµæãšããŠã

ã¢ããªã±ãŒã·ã§ã³ã¯ãã¹ãŠã®ãããã°æ å ±ã䜿çšããŠã³ã³ãã€ã«ããããããããã«ååãå€æŽããæ§é ãèšè¿°ããäžè¬çã«éã®ããã»ã¹ãå®è¡ããŸããããããäœæããå Žåãå®éã«ã¯å¿ èŠãããŸããã ã€ã¡ãŒãžã¯ãéã³ã³ãã€ã©ãŒã®èµ·åçŽåŸã«è¡šç€ºãããè¿œå ã®åŠçã¯è¡ãããŸããã
iOS 7.1.2ã¯ãã¢ããªã±ãŒã·ã§ã³ãã€ããªãã¡ã€ã«ã®ä¿¡é Œæ§ãæ€èšŒããªãããããã¹ãŠã®å€æŽã¯ã¢ããªã±ãŒã·ã§ã³ãã¡ã€ã«ã§çŽæ¥è¡ãããšãã§ããŸãã iOSã®ä»¥éã®ããŒãžã§ã³ã§ã¯ãå®è¡äžã®ã¢ããªã±ãŒã·ã§ã³ã®ã¡ã¢ãªã«åãå€æŽãå ããããšãã§ããŸãã
ã³ãŒããæžã...
次ã«ãIDAãšé·å¹Žã®éªšã®æããåªåã®å©ããåããŠãWhatsAppãµãŒããŒã§NoiseHandshakeãæ£åžžã«å®è¡ããã³ãŒããæºåããŸãã 次ã«ãåœã®ãµãŒããŒãå®è£ ããŸãããã¹ãŠåãæå·åæäœãè¡ããŸãããéã®é åºã§è¡ããŸãïŒç°¡åã«èãããŸãããæ¯æ¥ãããè¡ããªããšããŸã é çã®çš®ã§ãïŒã å®æããã³ãŒãã¯ãã¡ãã§ãã
äžèšã®ãªã³ã¯ããååŸããMITMã¢ããªã±ãŒã·ã§ã³ãã³ã³ãã¥ãŒã¿ãŒã«ããŠã³ããŒãããŸãã PHP 5.6ãã€ã³ã¹ããŒã«ããŸãïŒå¥ã®ããŒãžã§ã³ãé©ããŠããŸãããã®ããŒãžã§ã³ã¯ç§ã®æ§æã§äœ¿çšãããŸããïŒã ãŸããããã«2ã€ã®ã©ã€ãã©ãªãå¿ èŠã§ãã
- æå
- äºçªç®
ã€ã³ã¿ãŒã»ããæ¥ç¶
çŸåšã§ã¯ãªããã¢ããªã±ãŒã·ã§ã³ããµãŒããŒã«æ¥ç¶ããã ãã§ãã ã¢ããªã±ãŒã·ã§ã³ã¯ãµãŒããŒã®1ã€eïŒ d.whatsapp.netïŒïŒ dã¯1ã16ã®æ°åãããšãã°e5.whatsapp.netïŒã«æ¥ç¶ãããããããè€æ°ã®IPã¢ãã¬ã¹ã«è§£æ±ºãããŸãã 300以äžã®ãµãŒããŒã æãç°¡åãªæ¹æ³ã¯ããµãŒããŒã®DNSå¿çã眮ãæããŠãMITMã䜿çšããŠã³ã³ãã¥ãŒã¿ãŒã«è»¢éããããšã§ãã
ãããè¡ãã«ã¯ãé»è©±ãšã³ã³ãã¥ãŒã¿ãŒãåããããã¯ãŒã¯äžã«é 眮ãïŒæåéããã¹ãŠã®wifiã«ãŒã¿ãŒãè¡ããŸãïŒã次ã®ãã¹ãã§bind9ãã€ã³ã¹ããŒã«ããã³ã³ãã¥ãŒã¿ãŒã«é»è©±ã®DNSãé 眮ããŸãã
$ TTL 86400 @ IN SOA ns.whatsapp.netã admin.whatsapp.netã ïŒ 2017100500 28800 7200 1209600 86400ïŒ @ IN NS @ @ããªãã®IP v IN A 184.173.136.86 v IN A 174.37.243.85 * IN CNAME @
ãã©ãã£ãã¯ãèŠã
次ã«ãmitm.phpãç·šéããŸãããŠãŒã¶ãŒåãã£ãŒã«ãã®é»è©±çªå·ãšãã¹ã¯ãŒããã£ãŒã«ãã®cck.datãã¡ã€ã«ïŒã¢ããªã±ãŒã·ã§ã³ãã£ã¬ã¯ããªã«ãããŸãïŒã®å 容ã眮ãæããå¿ èŠããããŸãã
php mitm.phpãå®è¡ããŸãã WhatsAppã¢ããªã±ãŒã·ã§ã³ãèµ·åãã次ã®å³ãåç §ããŠãã ããã

ã¹ã¯ãªãŒã³ã·ã§ããã¯ããµãŒããŒããã®2ã€ã®ãã±ããã瀺ããŠããŸã-æåããèªèšŒãšããã€ãã®èšå®ã«é¢ããã¡ãã»ãŒãžã ãããã£ãŠãã¢ããªã±ãŒã·ã§ã³ã®ãã¹ãŠã®ãã©ãã£ãã¯ã¯ãã®ããã«èŠããŸãããã¹ãŠãèªã¿åãå¯èœã§ãããããã«ãã»ãšãã©ã®å Žåãã¢ããªã±ãŒã·ã§ã³ãå解ããå¿ èŠã¯ãããŸããã
FunXMPPãèªã¿åãå¯èœãªããã¹ãã«å€æããã¢ã«ãŽãªãºã ã¯ããã¹ãŠã®WhatsAppã©ã€ãã©ãªã§å©çšã§ããŸãã æãåçŽãªã¹ããŒããã·ã³ã®å éšã§ã¯ãããã§ã¯è¿œå ã§ãã€ã³ãããŸããã
çµè«
ãã®ã¢ããªã±ãŒã·ã§ã³ã¯é«å質ã§äœæãããææ°ã®æå·åãããã³ã«ã䜿çšããŠããŸããããã®å¥¥æ·±ãã«ã¯ãå ã 䜿çšãããŠããejabberdã®XMPPãæ®ã£ãŠããŸãã ã¢ããªã±ãŒã·ã§ã³éçºã®çŸåšã®ãã¯ãã«ããå€æãããšãprotobufã䜿çšããæ¹ãè«ççã§ãããæŽå²çãªéºç£ã¯é«ãããŸãã
ãã®ãµãŒãã¹ã¯ã倧éã®ã¡ãŒã«ã§é·ãéèŠããã§ããŸãã-ãªãŒãã³ãœãŒã¹ãããžã§ã¯ãã®ã³ãŒããããã«åºãè²¢ç®ããŸããã çŸæç¹ã§ã¯ãé·ãéãã¥ãŒã¹ã¬ã¿ãŒãåä¿¡ããŠââããŸãã-éçºè ã¯ãèš±å¯ãããŠããªãé£çµ¡å ã«éä¿¡ãããã¡ãã»ãŒãžã®æ°ã«å¶éã課ããŠããŸãã ç§ã®æèŠã§ã¯ããã®ã¢ããªã³ïŒæè¡çã«ã¯ãµãŒããŒåŽã«å®å šã«å®è£ ãããŠããïŒããã¡ãŒãªã³ã°ãªã¹ãã®æ奜家ãšã¡ãŒã«å¯Ÿçéšéã®åŸæ¥å¡ïŒããããã°ïŒã®å¯Ÿç«ãæåºãšããŠçµãããããšæããŸãã
çŽç²ã«æè¡çã«ã¯ããã®ãããªã¢ã«ãŽãªãºã ã«è€éãªãã®ã¯ãããŸãããä»ã®ã¡ãã»ã³ãžã£ãŒïŒhelloãViberãç§ã¯å°ãªããšãæã«1åã¯ã¹ãã ãåãåããŸãïŒã®éçºè ã«ãšã£ãŠã¯ããã®ãã¯ããã¯ã«æ³šæãã䟡å€ããããŸãã
èªãã§ãããŠããããšããå匷ãããã®ãšåãããã楜ãããŠé¢çœãã£ããšæã£ãŠããŸãã