â¢ããã»ã¹ã¡ã¢ãªã®èªã¿åããé²æ¢ããã¢ãã¬ã¹ã¹ããŒã¹ãå¶åŸ¡
â¢ã¢ã³ããããã¬ãŒãšããŠæ©èœ
â¢ããã»ã¹ã€ã¡ãŒãžã®æŽåæ§ããã§ãã¯ãããã®ã»ã¯ã·ã§ã³ã®ããã·ã¥ãèšç®ããŸãã
â¢ããã°ã©ã ãã³ã³ãã¥ãŒã¿ãŒãªã©ã«ãã€ã³ãããŸãã
åå è ã¯ããã€ããŒãã€ã¶ãŒããã€ãã¹ããããã®éèŠãªè§£æ±ºçãèŠã€ããããã«é ãç ããªããã°ãªããŸããã§ããïŒ èªåã®å Žæãæ³åããŠããã€ããŒãã€ã¶ãŒãšæŠããäžæ©äžæ©ããã³ãŒã³ããè©°ããŠãæææ»ã£ãŠãæåŸã«ãç§ãã¡ã¯åã¡ãéµãæã«å ¥ããŸãïŒ ã«ããã·ãŒã³ã®äžã§-ãã€ããŒãã€ã¶ãŒãããŒãžã®ã¢ã¯ã»ã¹ãå¶åŸ¡ããæ¹æ³ãããã³åå è ããã€ãã¹ããæ¹æ³ãããŒã䜿çšããããšããæ¹æ³ã®è©³çŽ°ãªã¬ãã¥ãŒã
ãã¹ãŠã®å§ãŸã
NeoQUEST-2013ã®å¯Ÿé¢ãã¢ãŒã®åå è ïŒ2æã®NeoQUESTã®ãªã³ã©ã€ã³ãã¢ãŒã®åè ïŒã«ã¯ãåã€ããã®åŒ·åãªã€ã³ã»ã³ãã£ãããããŸããã 圌ãã¯ãå®å šã«ãã£ãšããããé»æ°æ€ åã§åŠåãããããšãé¿ããããã«ãååæã®å¯ããŠæ¹¿ã£ãå£ããæãåºãå¿ èŠããããŸããïŒ ãã¡ãããååæã¯ä»®æ³ã§ããããæ€ åã¯æ¬ç©ã§ããïŒ
åºå Žè ã¯ãéãããããã«8æéãäžããããåã¿ã¹ã¯ãå®äºããã®ã«çŽ2æéãããããšãæåŸ ããŠã5ã€ã®ã¿ã¹ã¯ãæºåããŸããïŒ1ã€ã¯äºåã§ãïŒïŒãã誰ãåæ Œããªãã£ããšæã£ãããšãããã£ãã®ã§ã 4ã€ã®ã¿ã¹ã¯ã§ååã§ããïŒã
NeoQUEST 2013ã®ã¿ã¹ã¯ã¯ãæå·åãã¯ã©ãŠãããã³Webãã¯ãããžãŒããããããããªã©ãæ å ±ã»ãã¥ãªãã£ã®å ±éé åã®äž¡æ¹ã®ã»ãã¥ãªãã£ãšãããã°ã©ãã³ã°ããå¿ èŠãšããéæšæºã®ããã€ã¹ããã³ãã¯ãããžãŒïŒãã€ããŒãã€ã¶ãŒãã¹ããŒãã«ãŒããªã©ïŒã®ã»ãã¥ãªãã£ã«é¢ãããã®ã§ããã ãããåºãã®ãéãç¹ã«Arduino SDKã³ã³ãããŒã©ãŒã ã¯ãšã¹ãã®åè ã§ããã NeoQUEST 2013ã®å¯Ÿé¢ãã¢ãŒã®äž»ãªè³ã§ãã£ãRSAã«ã³ãã¡ã¬ã³ã¹ããã¢ã ã¹ãã«ãã ã«æ»ã£ãã°ããã®AVictor ã¯ãããããã®ã¿ã¹ã¯ã«ã€ããŠå°ãæžããŠããŸãïŒ 2äœã¯v0s ïŒVlad Roskov ïŒã§ã Caterpillarããå ±é ¬ã§ä¿è·ãããCat B15ã¹ããŒããã©ã³ãåãåããŸããã
ãããŠä»ããã€ããŒãã€ã¶ãŒã«ã€ããŠã§ãïŒ
v0ã®ã¿ããã€ããŒãã€ã¶ãŒããã€ãã¹ã§ããŸããã ã¿ã¹ã¯ã¯æ¬¡ã®ããã«å®åŒåãããŸããïŒKeyReader.exeå®è¡å¯èœãã¡ã€ã«ãååšãã2ã€ã®åäžã®Windowsã³ã³ãã¥ãŒã¿ãŒãå©çšå¯èœã§ãã å ¥åæã«ã圌ã¯åå è ã®IDãåãåãã ãããŒãæ£åžžã«èªã¿åãããŸãããããšè¡šç€ºããŸãã çµäºããã«ã¯ä»»æã®ããŒãæŒããŠãã ããã ããã©ã«ãã§ã¯ãåå è ã¯ç®¡çè æš©éãæã€ã¢ã«ãŠã³ãã§äœæ¥ããŸãã ããŒãåãåãå¿ èŠããããŸãã
ããã2ã€ä»¥å€ã®ãã·ã³ã§èµ·åãããšãKeyReader.exeããšã©ãŒãå ±åããŸãã
åå è ã®ä»£ããã«èªåèªèº«ãæ³åããçå®ã«å°éããããã«ããŠãã ããïŒ ã¡ãã»ãŒãžããå€æãããšãããŒã¯ããã»ã¹ã¡ã¢ãªã«ãããããããèªã¿åãå¿ èŠããããŸãã ç°¡åã«èãããŸããããã£ãŠã¿ãŠãã ããã Windowsã¿ã¹ã¯ãããŒãžã£ãŒãå®è¡ããKeyReader.exeããã»ã¹ãèŠã€ããŠãããŒã¹ãããŒã¯ã®åŸ æ©æã«ãã³ããããã³ããRussinovichã®æååã«ãã£ãŒãããŸã ã ãã³ãã®ééã¯3.3MBã§ããŠãŒãã£ãªãã£ã¯55,000è¡ãæ€åºããŸãã ãããã®äžããããŒãæ€çŽ¢ããæ¹æ³ã¯ããŸãæããã§ã¯ãããŸããããããŒãšããåèªã§æ€çŽ¢ãããšã次ã®è¡ãèŠã€ãããŸãã
ããã¯å¿ èŠãªãã®ã§ã¯ãªãããã§ãã æ£ç¢ºã«äœãèµ·ãã£ãã®ãããã³ãã«ãã®è¡ãå«ãŸããŠããçç±ã¯ãŸã æããã§ã¯ãããŸããããããã¯æããã«ãã¹ã¯ãŒãã§ã¯ãããŸããã KeyReader.exeãIDAã䜿çšããŠã©ã®ããã«æ©èœããããç解ããŠã¿ãŸãããããã§ã«äœãèµ·ãã£ãŠããããååã«ç解ããäžã§ãã¿ã¹ã¯ãå®äºããŠãã ããã ããã°ã©ã ã¯ç°¡åã«éã³ã³ãã€ã«ã§ããäžè¬çã«ã¯ãã®æå³ãæ確ã«ãªããŸãã åºæ¬çãªããžãã¯ã¯æ¬¡ã®ãšããã§ãã
ããŒãžã¢ã©ã€ã³ã¡ã¢ãªãå²ãåœãŠããããŒãã«èšå®ãããåŸãåå è ã®IDãèªã¿åããã AcquireKeyé¢æ°ãåŒã³åºãããŸãã AcquireKeyé¢æ°ã¯å°ãããã¢ã»ã³ãã©ãŒæ¿å ¥ã§ãã£ã次ã®ã³ãŒããå«ãŸããŠããŸãã
ã³ãŒãã«ã¯ãvmcallåœä»€ãå«ãŸããŠããŸãããã®åœä»€ã¯ãã¬ãžã¹ã¿ãä»ããŠæž¡ããããã©ã¡ãŒã¿ãŒã䜿çšããŠãã€ããŒãã€ã¶ãŒãžã®åŒã³åºããå®è¡ããŸãã EAXã¬ãžã¹ã¿ã«ã¯å€ãNeoQããå«ãŸããEDXã¬ãžã¹ã¿ã«ã¯å€ãstrtããå«ãŸããEBXã¬ãžã¹ã¿ã«ã¯ä»¥åã«å²ãåœãŠãããã¡ã¢ãªããŒãžãžã®ãã€ã³ã¿ãå«ãŸããECXã¬ãžã¹ã¿ã«ã¯ããŒãžãµã€ãºãå«ãŸããEDIã¬ãžã¹ã¿ã«ã¯åå è IDãå«ãŸããŸãã åŒã³åºãã®çµæã¯ãESIã¬ãžã¹ã¿ãéããŠè¿ãããŸãã ç°¡åã«ããããã«ããã€ããŒãã€ã¶ãŒãååšããå Žåã¯vmcallåœä»€ããã€ããŒãã€ã¶ãŒã«å¶åŸ¡ã転éããååšããªãå Žåã¯#UDãåŒã³åºããšæ³å®ã§ããŸãã
åœä»€ã®æäœã¢ã«ãŽãªãºã ã®å®å šãªèª¬æã¯ãIntelã®ããã¥ã¡ã³ã64-ia-32-architectures-software-developer-vol-2b-manualã«ãããŸã ã ããã§ãããŒããã€ããŒãã€ã¶ãŒã«ä¿åãããç¹å®ã®ãã©ã¡ãŒã¿ãŒã§vmcallåœä»€ã䜿çšããŠã¢ã¯ã»ã¹ããããšãã«ããã°ã©ã ã¡ã¢ãªã«ã³ããŒãããããšãæããã«ãªããŸããã
ããã°ã©ã ã®ã¹ãããããããã°ããŠããã€ããŒãã€ã¶ãŒã«ã¢ã¯ã»ã¹ããåŸã®ã¡ã¢ãªå ã®å 容ã確èªããŠã¿ãŸãããã OllyDbg 2.01ããããã¬ãŒãšããŠäœ¿çšããŸãã ãããã°äžã«KeyReader.exeãå®è¡ããvmcallã®åŸã®æ¬¡ã®ã¹ããŒãã¡ã³ãã«ãã¬ãŒã¯ãã€ã³ããèšå®ããŸãã åå è IDãå ¥åããŠEnterãæŒãã確ç«ããããã¬ãŒã¯ãã€ã³ãã«å°éããŸãã EBXã¬ãžã¹ã¿ã«ã¯ã¢ãã¬ã¹0x1F5000ãå«ãŸããŠããŸããããŒãããããŸãã ESIã0ã§ãã
F9ãæŒããŠããšã©ãŒãçºçããããšã確èªããŸãã
3ã€ã®ãããã°ã¡ã«ããºã ããããŸãã
â¢ã³ãŒãããŒã«ãããint3åœä»€
â¢ååœä»€ã®åŸã«å²ã蟌ã¿int1ã䜿çšãã段éçãªãããã°
â¢ãããã°ã¬ãžã¹ã¿D0ãD7ãã¡ã¢ãªã¢ã¯ã»ã¹ããã£ããã§ããŸãã
ãã®å Žåãåœä»€ã«ãã¬ãŒã¯ãã€ã³ããã€ã³ã¹ããŒã«ãããšãã«ãåœä»€ã®æåã®ãã€ãã0xccïŒint 0x3ïŒã§äžæžãããŸãã ããã°ã©ã ããã®å Žæã«å°éãããšãint3ãå®è¡ãããå¶åŸ¡ããããã¬ãŒã«æž¡ãããæŠãåãããã€ãã埩å ããã埩å ãããåœä»€ãå®è¡ãããåœä»€ã®äžã«åã³int3ãæžã蟌ãŸããŸãã ãããã£ãŠããã¬ãŒã¯ãã€ã³ãã¯å®è¡äžã®ã€ã¡ãŒãžãå€æŽãããã€ããŒãã€ã¶ãŒã¯æããã«ãããŒãããã°ã©ã ã¡ã¢ãªã«ã³ããŒããåã«ãã®æŽåæ§ããã§ãã¯ããŸãã ãšã©ãŒã¡ãã»ãŒãžãããã瀺åããŠããŸãã
ãã®åé¡ã¯ã次ã®æ¹æ³ã§ç°¡åã«è§£æ±ºã§ããŸãã vmcallã®åã«ããã€ãã®åœä»€ããã¬ãŒã¯ãã€ã³ãã«ã€ã³ã¹ããŒã«ãããã¬ãŒã¯ãã€ã³ãã«å ¥ã£ãåŸããããåé€ããã¹ãããããšã«ã³ãŒããå®è¡ããŸãã Vmcallãå®è¡ãããšã次ã®çµæãåŸãããŸãã
EBXã¬ãžã¹ã¿ã§ã¯ãã¢ãã¬ã¹ã¯0x165000ã§ãããã®ã¢ãã¬ã¹ã«ã¯ãæ¢ã«ããªãã¿ã®æåå"keyïŒNICE TRYãTHIS IS NOT A KEY"ããããŸãã ãã€ããŒãã€ã¶ãŒã¯ãããŒãèªã¿åãããªãããã«ããŸãã
KeStackAttachProcessé¢æ°ãšKeUnstackDetachProcessé¢æ°ã䜿çšããŠããã»ã¹ã®ã¡ã¢ãªãèªã¿åãå°ããªãã©ã€ããŒãäœæã§ããŸãããããã«ãããæ©èœããªããšããŸãããã åä»ãªãã¹ã«é²ã¿ãWindowsã«é¢å¿ã®ããããã»ã¹ã®ã¡ã¢ãªããã£ã¹ã¯ã«åŒ·å¶çã«ã¢ã³ããŒããããpagefile.sysã解æããŠãããŒãæã€ãããã¡ãŒã«å¯Ÿå¿ããããŒãžãèŠã€ããããšãã§ããŸãã ãããããã®ããŒãžã«ã¯åãè¡ã衚瀺ãããŸãã
次ã®æ¹æ³ãè©ŠããŠã¿ãŸããã-dllãKeyReaderããã»ã¹ã«æ¿å ¥ããããããããŒã眮ãããŠããã¡ã¢ãªãèªã¿åããŸãã ãŸããããã»ã¹ãéå§ããOlly Dbgã䜿çšããŠããã»ã¹ã«ã¢ã¿ããããããŒãæã€ãããã¡ãŒãé 眮ãããŠããã¢ãã¬ã¹ã確èªããŸãã ãããã¡ãŒãžã®ãã€ã³ã¿ãŒã¯0x40eb3cã«ãããŸãã
ãã®å Žåããããã¡ã®ã¡ã¢ãªã¯0x600000ã«å²ãåœãŠããããããã¬ãšããŠãã¢ããªã±ãŒã·ã§ã³ã¯åŒãç¶ãåäœããŸãã ãã®ã¢ãã¬ã¹ã®ã¡ã¢ãªãèªã¿åããa.txtãã¡ã€ã«ã§ãã£ã¹ã¯ã«ä¿åããdllãäœæããŸãã ã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
ã€ã³ãžã§ã¯ã¿ãŒãšããŠãWindowsã®C / C ++çµç±ã®äŸã䜿çšããŸãã ã dllãæ¿å ¥ãã次ã®è¡ãå«ãa.txtãã¡ã€ã«ãååŸããŸãã
ãããéµã§ãã
KeyReaderããã»ã¹ã€ã¡ãŒãžã«å ¥ããªãã³ãŒãã€ã³ãžã§ã¯ã·ã§ã³ã®äž»é¡ã®ããªãšãŒã·ã§ã³ã¯è§£æ±ºçã«ãªããŸãã ããšãã°ããããã¬ãŒã®åå è ã®1人ããgetché¢æ°ã«ãã£ãŠåŒã³åºãããkernel32.dllã®ReadConsoleInputAé¢æ°ã®ã³ãŒããä¿®æ£ããããããæ¢ç¥ã®ã¢ãã¬ã¹ã®è¡ãèªã¿åããŸããã ã芧ã®ãšãããã¿ã¹ã¯ã¯æãé£ãããã®ã§ã¯ãããŸããããæçµçã«ã¯1人ã ããã¿ã¹ã¯ã管çããŸããã ã»ãšãã©ã®å Žåãããã¯æéã®äžè¶³ã«ãããã®ã§ãããã¿ã¹ã¯èªäœã¯ãçãã«ã€ãªããè«ççãªé£éãã»ãšãã©æå³ããªããããªãã®ã§ãã åå è ã¯ãããæç¹ã§äœæ¥ããŒãžã§ã³ã«ã€ãŸããããã«ãä»ã®èª°ãã®ããã»ã¹ã®èšæ¶ãèªãããã«ç¥ã£ãŠãããã¹ãŠã®æ¹æ³ãæŽçããªããã°ãªããŸããã§ããã
äžè¬ã«ããã®ã¿ã¹ã¯ãæºåããããšã¯ããããããããå®è¡ããããšãããããã«èå³æ·±ãã§ããã:)ã ããŒãžãžã®ã¢ã¯ã»ã¹ãå¶åŸ¡ããã«ã¯ãä»®æ³ã¢ãã¬ã¹ããç©çã¢ãã¬ã¹ãžã®ããŒãžã«é¢é£ä»ããããŠãããã¹ãŠã®å€æããŒãã«ã®å€æŽãå¶åŸ¡ããå¿ èŠããããŸããã ããŸããŸãªãããã³ã°ãªãã·ã§ã³ãšãã¢ã¯ã»ã¹ãå¶åŸ¡ããç©çããŒãžã®ã¢ãã¬ã¹ãå€æŽã§ãããšããäºå®ãèãããšãããã¯ããã»ã©ç°¡åã§ã¯ãããŸããã
ãã€ããŒãã€ã¶ãŒã¯ãããã±ãŒã¹ã§ã¯ããŒãžã®ã¢ã¯ã»ã¹ãèš±å¯ããå¥ã®ã±ãŒã¹ã§ã¯ããã§ã¯ãããŸãããïŒ ããŒã§ããŒãžã«ã¢ã¯ã»ã¹ãããšãã圌ã¯3ã€ã®æ¡ä»¶ããã§ãã¯ããŸããã
â¢èªã¿åãã¯ãŠãŒã¶ãŒã¢ãŒãããè¡ãå¿ èŠããããŸã
â¢ããŒã«ã¢ã¯ã»ã¹ããããã»ã¹ã€ã¡ãŒãžã®ãã®ã»ã¯ã·ã§ã³.textã®ããã·ã¥ã¯å³å¯ã«å®çŸ©ããå¿ èŠããããŸã
â¢ããŒã¯ãvmcallãããŒãåä¿¡ããããã«åŒã³åºãããã¢ãã¬ã¹ç©ºéããã®ã¿èªã¿åãããšãã§ããŸãã
æåã®æ¡ä»¶ã¯ãã«ãŒãã«ããããŒãèªã¿åããã¹ãŠã®è©Šã¿ãæåŠããŸããã ãããã«ã¯ãReadProcessMemoryé¢æ°ãšç¬èªã®ãã©ã€ããŒã®äœæãå«ãŸããŸãã 2çªç®ã®æ¡ä»¶ã§ã¯ãã€ã¡ãŒãžã³ãŒãã®å€æŽãšãã¬ãŒã¯ãã€ã³ãã®èšå®ãèš±å¯ãããŸããã§ããã ãšããã§ãããã¹ãã»ã¯ã·ã§ã³ã®ã¿ããã§ãã¯ããããããç°ãªãæ¹æ³ã§åŒã³åºãããã³ãŒãã䜿çšããŠç¬èªã®ã»ã¯ã·ã§ã³ãè¿œå ãããšã³ããªãã€ã³ããå€æŽã§ããŸãã 次ã«ãã³ãŒãããããŒãååŸããé¢æ°ãåŒã³åºããŠããã£ã¹ã¯ã«ä¿åããŸãã 3çªç®ã®æ¡ä»¶ã§ã¯ãKeyReaderããã»ã¹ã®ã¡ã¢ãªãããŒãèªã¿åãããã«èç©ãããä»ã®ããã»ã¹ã¯èš±å¯ãããŸããã§ããã ãã®ãããªç¶æ³ãååŸããã«ã¯ãWindows7ã§ãã®ãããªæ©èœãåããæ¢è£œã®ãŠãŒãã£ãªãã£ãèŠã€ãããªãã£ãããããã®ãããªç¶æ³ãååŸããã«ã¯ãç¬èªã®ãã©ã€ããŒãšãããšéä¿¡ããã¢ããªã±ãŒã·ã§ã³ãäœæããå¿ èŠãããããããã®æ¡ä»¶ã¯ãã倧ããã§ãã Windows XPã§ã¯ãç©çã¡ã¢ãªã®èªã¿åãæã«WinHex RAM Editorã¯åæ§ã®æ¹æ³ã§æ©èœããŸããã æ¡ä»¶ã®äž»ãªç®æšã¯ãæ¢æã®ãŠãŒãã£ãªãã£ã®ã¿ã䜿çšããŠã1è¡ã®ã³ãŒããèšè¿°ããããšãªãã¿ã¹ã¯ãå®äºã§ããªãããšã§ããã
ãããŠçµè«ãšããŠ...
ãã€ããŒãã€ã¶ãŒã䜿çšããŠã¿ã¹ã¯ãæºåããéãåå è ã«ã¿ã¹ã¯ã®ç°åžžãªæ§è³ªã«çåãæ±ãããããšæããŸããã çµå±ã®ãšãããããã»ã¹ã¡ã¢ãªããè¡ãèªã¿åãéã®åé¡ã¯äœã§ããããïŒ ãããŠã1人ã®åå è ã ããã¿ã¹ã¯ãå®äºãããšããäºå®ããå€æããŠãæåããŸããïŒ Habrã®èªè ã«ãšã£ãŠèå³æ·±ãããšãé¡ã£ãŠããŸãïŒ ããã«ãæããéãã®ã¿ã¹ã¯NeoQUEST-2013ã®è©³çŽ°ãªåæãå«ãèšäºãæåŸ ããŠãã ããïŒ