Virus °æ (¾«»ªÇø)
·¢ÐÅÈË: Kernel (Kernel), ÐÅÇø: Virus
±ê Ìâ: ·´²¡¶¾ÒýÇæÉè¼Æ(תÔØ)
·¢ÐÅÕ¾: ¹þ¹¤´ó×϶¡Ïã (Thu Oct 2 22:57:07 2003), Õ¾ÄÚÐżþ
´´½¨Ê±¼ä£º2003-10-02
ÎÄÕÂÊôÐÔ£º×ªÔØ
ÎÄÕÂÌá½»£ºNJUE (admin_at_ourmm.com)
±¾ÎĽ«¶Ôµ±½ñÏȽøµÄ²¡¶¾/·´²¡¶¾¼¼Êõ×öÈ«Ãæ¶øϸÖµĽéÉÜ£¬Öص㵱Ȼ·ÅÔÚÁË·´²¡¶¾ÉÏ£¬ÌØ
±ðÊÇÐéÄâ»úºÍʵʱ¼à¿Ø¼¼Êõ¡£ÎÄÖÐÊ×ÏȽéÉܼ¸ÖÖµ±½ñ½ÏΪÁ÷ÐеIJ¡¶¾¼¼Êõ£¬°üÀ¨»ñȡϵͳ
ºËÐÄ̬ÌØȨ¼¶£¬×¤Áô£¬½Ø»ñϵͳ²Ù×÷£¬±äÐκͼÓÃܵȡ£È»ºó·ÖÎå½ÚÏêϸÌÖÂÛÐéÄâ»ú¼¼Êõ£º
µÚÒ»½Ú¼òµ¥½éÉÜÒ»ÏÂÐéÄâ»úµÄ¸ÅÂÛ£»µÚ¶þ½Ú½éÉܼÓÃܱäÐβ¡¶¾£¬×÷Õß»á·ÖÎöÁ½¸öÖøÃû±äÐÎ
²¡¶¾µÄ½âÃÜ×Ó£»µÚÈý½ÚÊÇÐéÄâ»úʵÏÖ¼¼ÊõÏê½â£¬ÆäÖлá¶ÔÁ½ÖÖ²»Í¬·½°¸½øÐбȽϣ¬Í¬Ê±½«
ÆÊÎöÒ»¸ö²é¶¾ÓÃÐéÄâ»úµÄ×ÜÌå¿ØÖƽṹ£»µÚËĽÚÖ÷ÒªÊǶÔÌض¨Ö¸Áî´¦Àíº¯ÊýµÄ·ÖÎö£»×îºó
ÔÚµÚÎå½ÚÖÐÁгöÁËһЩ·´ÐéÄâÖ´Ðм¼Êõ×öΪ½ñºó¸Ä½øµÄ²ÎÕÕ¡£ÂÛÎĵĵÚÈýÕÂÖ÷Òª½éÉÜʵʱ
¼à¿Ø¼¼Êõ£¬ÓÉÓÚwin9xºÍwinnt/2000ϵͳ»úÖƺÍÇý¶¯Ä£ÐͲ»Í¬£¬ËùÒÔ»á·Ö³ÉÁ½¸ö²Ù×÷ϵͳ½ø
ÐÐÌÖÂÛ¡£ÆäÖÐÉæ¼°µÄ¼¼ÊõºÜ¹ã·º£º°üÀ¨Çý¶¯±à³Ì¼¼Êõ£¬Îļþ¹³¹Ò£¬ÌØȨ¼¶¼äͨÐŵȵȡ£±¾
ÎĽéÉܵļ¼ÊõÉæ¼°²Ù×÷ϵͳµ×²ã»úÖÆ£¬ÄѶȽϴó¡£ËùÌṩµÄ´úÂ룬°üÀ¨Ò»¸öÐéÄâ»úCÓïÑÔÔ´
´úÂëºÍÁ½¸ö²¡¶¾ÊµÊ±¼à¿ØÇý¶¯³ÌÐò·´»ã±à´úÂ룬¾ßÓÐÒ»¶¨µÄÑо¿ºÍʵÓüÛÖµ¡£
¹Ø¼ü×Ö£º²¡¶¾£¬ÐéÄâ»ú£¬ÊµÊ±¼à¿Ø
ÎĵµÄÚÈÝĿ¼
1£®Ð÷ ÂÛ
1. 1¿ÎÌâ±³¾°
1.2µ±½ñ²¡¶¾¼¼ÊõµÄ·¢Õ¹×´¿ö
1.2.1ϵͳºËÐÄ̬²¡¶¾
1.2.2פÁô²¡¶¾
1.2.3½Ø»ñϵͳ²Ù×÷
1.2.4¼ÓÃܱäÐβ¡¶¾
1.2.5·´¸ú×Ù/·´ÐéÄâÖ´Ðв¡¶¾
1.2.6Ö±½ÓAPIµ÷ÓÃ
1.2.7²¡¶¾Òþ²Ø
1.2.8²¡¶¾ÌØÊâ¸ÐȾ·¨
2£®ÐéÄâ»ú²é¶¾
2.1ÐéÄâ»ú¸ÅÂÛ
2. 2¼ÓÃܱäÐβ¡¶¾
2.3ÐéÄâ»úʵÏÖ¼¼ÊõÏê½â
2.4ÐéÄâ»ú´úÂëÆÊÎö
2.4.1²»ÒÀÀµ±êÖ¾¼Ä´æÆ÷Ö¸ÁîÄ£Ä⺯ÊýµÄ·ÖÎö
2.4.2ÒÀÀµ±êÖ¾¼Ä´æÆ÷Ö¸ÁîÄ£Ä⺯ÊýµÄ·ÖÎö
2.5·´ÐéÄâ»ú¼¼Êõ
3£®²¡¶¾ÊµÊ±¼à¿Ø
3.1ʵʱ¼à¿Ø¸ÅÂÛ
3.2²¡¶¾ÊµÊ±¼à¿ØʵÏÖ¼¼Êõ¸ÅÂÛ
3.3WIN9XϵIJ¡¶¾ÊµÊ±¼à¿Ø
3.3.1ʵÏÖ¼¼ÊõÏê½â
3.3.2³ÌÐò½á¹¹ÓëÁ÷³Ì
3.3.3HOOKSYS.VXDÄæÏò¹¤³Ì´úÂëÆÊÎö
3.4WINNT/2000ϵIJ¡¶¾ÊµÊ±¼à¿Ø
3.4.1ʵÏÖ¼¼ÊõÏê½â
3.4.2³ÌÐò½á¹¹ÓëÁ÷³Ì
3.4.3HOOKSYS.SYSÄæÏò¹¤³Ì´úÂëÆÊÎö
½áÂÛ
ÖÂл
Ö÷Òª²Î¿¼ÎÄÏ×
1£®Ð÷ ÂÛ
±¾ÂÛÎÄÑо¿µÄÖ÷ÒªÄÚÈÝÕýÈçÆäÌâÄ¿ËùʾÊÇÉè¼Æ²¢±àдһ¸öÏȽøµÄ·´²¡¶¾ÒýÇæ¡£Ê×ÏÈÐèÒª¶Ô
Õâ¡°ÏȽø¡±¶þ×Ö×öÒ»¸ö½âÊÍ£¬ºÎΪ¡°ÏȽø¡±£¿ÖÚËùÖÜÖª£¬´«Í³µÄ·´²¡¶¾Èí¼þʹÓõÄÊÇ»ùÓÚ
ÌØÕ÷ÂëµÄ¾²Ì¬É¨Ãè¼¼Êõ£¬¼´ÔÚÎļþÖÐÑ°ÕÒÌض¨Ê®Áù½øÖÆ´®£¬Èç¹ûÕÒµ½£¬¾Í¿ÉÅж¨Îļþ¸ÐȾ
ÁËijÖÖ²¡¶¾¡£µ«ÕâÖÖ·½·¨ÔÚµ±½ñ²¡¶¾¼¼ÊõѸÃÍ·¢Õ¹µÄÐÎÊÆÏÂÒѾÆð²»µ½ºÜºÃµÄ×÷ÓÃÁË¡£Ô
ÒòÎÒ»áÔÚÒÔϵÄÕ½ÚÖоßÌåÃèÊö¡£Òò´Ë±¾ÂÛÎĽ«²»¶Ôɱ¶¾ÒýÇæÖеÄÌØÕ÷ÂëɨÃèºÍ²¡¶¾´úÂë
Çå³ýÄ£¿é×ö·ÖÎö¡£ÎÒÃÇÒªÌÖÂÛµÄÊÇΪӦ¸¶ÏȽøµÄ²¡¶¾¼¼Êõ¶ø±ØÐèµÄÁ½´ó·´²¡¶¾¼¼Êõ--ÐéÄâ
»úºÍʵʱ¼à¿Ø¼¼Êõ¡£¾ßÌåʲôÊÇÐéÄâ»ú£¬Ê²Ã´ÊÇʵʱ¼à¿Ø£¬ÎÒ»áÔÚÏàÓ¦µÄÕ½ÚÖÐ×öÏ꾡µÄ
½éÉÜ¡£ÕâÀïÎÒҪ˵Ã÷µÄÒ»µãÊÇ£¬ÕâÁ½Ïî¼¼ÊõËäÈ»ÔÚÇ°È˵Ť×÷ÖÐÒÑÓÐËùÌåÏÖ£¨±»Ò»Ð©¹úÄÚ
ÍâÏȽøµÄ·´²¡¶¾³§¼ÒËùʹÓã©£¬µ«³öÓÚÉÌҵĿµÄ£¬ÕâЩ¼¼Êõ²¢Ã»Óб»ÍêÈ«¹«¿ª£¬ËùÒÔÄãÎÞ
ÂÛ´ÓÊé±¾ÎÄÏ×»¹ÊÇÍø·ÉϵÄ×ÊÁÏÖж¼ÎÞ·¨ÕÒµ½¹ØÓÚÕâЩ¼¼ÊõµÄÄÚÄ»¡£¶øÎÒ»áÔÚÏà¹ØµÄÕ½Ú
ÖÐÆÊÎö´óÁ¿µÄ³ÌÐòÔ´Â루Ö÷ÒªÊÇ2.4½ÚÖеÄÒ»¸öÍêÕûµÄÐéÄâ»úÔ´Â룩»òÊÇÄæÏò¹¤³Ì´úÂ루3
.3.3½ÚºÍ3.4.3½ÚÖÐÈý¸öÎÒÄæÏò¹¤³ÌµÄijÖøÃû·´²¡¶¾Èí¼þµÄʵʱ¼à¿ØÇý¶¯³ÌÐò¼°¿Í»§³ÌÐòµÄ
·´»ã±à´úÂ룩£¬²¢Í¬Ê±¹«²¼Ò»Ð©ÎÒ¸öÈËÍÚ¾òµÄ²Ù×÷ϵͳÄÚ²¿Î´¹«¿ªµÄ»úÖƺÍÊý¾Ý½á¹¹¡£ÁíÍâÎÒÔÚÎÄÖлá´óÁ¿µØÌáµ½»òÒýÓÃһЩ¹ØÓÚϵͳµ×²ã°ÂÃصĴóʦ¼¶¾µäͼ
Ê飬ÕâËãÊǸøϲ°®ÏµÍ³¼¶±à³Ìµ«ÓÖ¿àÓÚÕÒ²»µ½ºÏÊʽ̲ĵÄÅóÓÑ¿ªÁËÒ»·ÝÊéµ¥¡£ÏÂÃæ¾Í¿ªÊ¼
½øÈëÂÛÎĵÄÕýÌâ¡£
1.1¿ÎÌâ±³¾°
±¾ÂÛÎÄÉæ¼°µÄÁ½¸öÖ÷Òª¼¼Êõ£¬Ò²Êǵ±½ñ·´²¡¶¾½çʹÓõÄ×îΪÏȽøµÄ¼¼ÊõÖеÄÁ½¸ö£¬¾¿¾¹ÊÇ
×÷ºÎ¶øÓõÄÄØ£¿Ê×ÏÈ˵˵ÐéÄâ»ú¼¼Êõ£¬ËüÖ÷ÒªÊÇΪ²éɱ¼ÓÃܱäÐβ¡¶¾¶øÉè¼ÆµÄ¡£¼òµ¥µØÀ´
˵£¬ËùνÐéÄâ»ú²¢²»ÊǸöÐéÄâµÄ»úÆ÷£¬ËµµÃ¸üºÏÊÊһЩӦ¸ÃÊǸöÐéÄâCPU£¨ÓÃÈí¼þʵÏÖµÄC
PU£©£¬Ö»²»¹ý²¡¶¾½ç¶¼Õâô½Ð¶øÒÑ¡£ËüµÄ×÷ÓÃÖ÷ÒªÊÇÄ£ÄâINTEL X86 CPUµÄ¹¤×÷¹ý³ÌÀ´½âÊÍ
Ö´ÐпÉÖ´ÐдúÂ룬ÓëÕæÕýµÄCPUÒ»ÑùÄܹ»È¡Ö¸£¬ÒëÂë²¢Ö´ÐÐÏàÓ¦»úÆ÷Ö¸Áî¹æ¶¨µÄ²Ù×÷¡£µ±È»
ʲôÊǼÓÃܱäÐβ¡¶¾£¬ËüÃÇΪʲôÐèÒª±»ÐéÄâÖ´ÐÐÒÔ¼°ÔõÑùÐéÄâÖ´ÐеÈÎÊÌâ»áÔÚºÏÊʵÄÕÂ
½ÚÖеõ½½â´ð¡£ÔÙ˵ÁíÒ»¸öÖØÍ·Ï·--ʵʱ¼à¿Ø¼¼Êõ£¬ËüµÄÓô¦¸üΪ¹ã·º£¬²»½ö¾ÖÏÞÓÚ²éɱ
²¡¶¾¡£±»ÊµÊ±¼à¿ØµÄ¶ÔÏóÒ²ºÜ¶à£¬ÈçÖжϣ¨Intmon£©£¬Ò³Ãæ´íÎó£¨Pfmon£©£¬´ÅÅÌ·ÃÎÊ£¨D
iskmon£©µÈµÈ¡£ÓÃÓÚɱ¶¾µÄ¼à¿ØÖ÷ÒªÊÇÕë¶ÔÎļþ·ÃÎÊ£¬ÔÚÄãÒª¶ÔÒ»¸öÎļþ½øÐзÃÎÊʱ£¬Êµ
ʱ¼à¿Ø»áÏȼì²éÎļþÊÇ·ñΪ´ø¶¾Îļþ£¬ÈôÊÇ£¬ÔòÓÉÓû§Ñ¡ÔñÊÇÇå³ý²¡¶¾»¹ÊÇÈ¡Ïû´Ë´Î²Ù×÷
ÇëÇó¡£ÕâÑù¾Í¸øÁËÓû§Ò»¸öÏà¶Ô°²È«µÄÖ´Ðл·¾³¡£µ«Í¬Ê±£¬ÊµÊ±¼à¿Ø»áʹϵͳÐÔÄÜÓÐËùÏÂ
½µ£¬²»ÉÙɱ¶¾Èí¼þµÄÓû§¶¼±§Ô¹ËûÃǵÄʵʱ¼à¿ØÈÃϵͳ±äµÃÆæÂýÎޱȶøÇÒ²»Îȶ¨¡£Õâ¾Í¸ø
ÎÒÃǵÄÉè¼ÆÌá³öÁ˸ü¸ßµÄÒªÇ󣬼´ÔõÑùÔÚ±£Ö¤×¼È·À¹½ØÎļþ²Ù×÷µÄͬʱ£¬ÈÃʵʱ¼à¿ØÕ¼ÓõÄϵͳ×ÊÔ´¸üÉÙ¡£ÎÒ»áÔÚ²¡¶¾ÊµÊ±¼à¿ØÒ»½ÚÖÐרÃÅÌÖÂÛÕâ¸öÎÊÌâ¡£ÕâÁ
½Ïî¼¼ÊõÔÚ¹úÄÚÍâÏȽøµÄ·´²¡¶¾³§¼ÒµÄ²úÆ·Öж¼ÓÐʹÓã¬ËäÈ»ËüÃǵÄÔ´´úÂëûÓй«¿ª£¬µ«Î
ÒÃÇ»¹ÊÇ¿ÉÒÔͨ¹ýÄæÏò¹¤³ÌµÄ·½·¨À´¿úÊÓÒ»ÏÂËüÃǵÄÉè¼Æ˼·¡£ÆäʵÄãÓÃÒ»¸öÊ®Áù½øÖƱà¼
Æ÷À´´ò¿ªËüÃǵĿÉÖ´ÐÐÎļþ£¬Ò²Ðí¾Í»á¿´µ½Ò»Ð©Ã»ÓаþµôµÄµ÷ÊÔ·ûºÅ¡¢±äÁ¿Ãû×Ö»òÊä³öÐ
ÅÏ¢£¬ÕâЩÖëË¿Âí¼£¶ÔÓÚÀí½â´úÂëµÄÒâͼ´óÓÐñÔÒ档ͬʱ£¬ÔÚ·´²¡¶¾Èí¼þµÄ°²×°Ä¿Â¼Öкó×
ºÎª.VXD»ò.SYS¾ÍÊÇÖ´ÐÐʵʱ¼à¿ØµÄÇý¶¯³ÌÐò£¬¿ÉÒÔÄÃÀ´ÄæÏòһϣ¨²Î¿´ÎÒÔÚºóÃæ·ÖÎöÇý¶¯
Ô´´úÂëÖеÄÌÖÂÛ£©¡£ÏàÐÅÖÁ´Ë£¬ÎÒÃǶÔÕâÁ½Ïî¼¼ÊõÓÐÁËÒ»¸ö´óÌåµÄÁ˽⡣ºóÃæÎÒÃǽ«ÉîÈë
µ½¼¼ÊõµÄϸ½ÚÖÐÈ¥¡£
1.2µ±½ñ²¡¶¾¼¼ÊõµÄ·¢Õ¹×´¿ö
ÒªÌÖÂÛÔõÑù·´²¡¶¾£¬¾Í±ØÐë´Ó²¡¶¾¼¼Êõ±¾ÉíµÄÌÖÂÛ¿ªÊ¼¡£ÕýÊÇËùν¡°Öª¼ºÖª±Ë£¬°ÙÕ½²»´ù
¡±¡£Æäʵ£¬ÎÒÈÏΪĿǰ¹æ¶¨Ñо¿²¡¶¾¼¼ÊõÊôÓÚÎ¥·¨ÐÐΪ´æÔÚןܴóµÄ±×¶Ë¡£ºÜÄÑÏëÏóÒ»¸ö
ºÁÎÞ²¡¶¾Ð´×÷¾ÑéµÄÈË»á³ÉΪɱ¶¾¸ßÊÖ¡£¾ÝÎÒÁ˽⣬Ŀǰ¹úÄÚһЩÖøÃû·´²¡¶¾Èí¼þ¹«Ë¾µÄ
Ñз¢¶ÓÎéÖв»·¦²¡¶¾Ð´×÷¸ßÊÖ¡£Ö»²»¹ýËûÃǽ«Í¬ÑùµÄ¼¼ÊõÓõ½ÁËÕýµÀÉÏ£¬ÒÔ¡®¶¾¡¯¹¥¡®¶¾
¡¯¡£ËùÒÔÎÒÏ£ÍûÕâƪÂÛÎÄÄÜÆðµ½Å×שÒýÓñµÄ×÷Óã¬ÆÚ´ý×ÅÓиü¶àµÄÈ˻Ὣ²¡¶¾¼¼Êõ½éÉܸø
´óÖÚ¡£µ±½ñµÄ²¡¶¾ÓëDOSºÍWIN3.1ʱ´úϵĴӼ¼Êõ½Ç¶ÈÉÏ¿´Óкܶ಻ͬ¡£ÎÒÈÏΪ×î´óµÄת±ä
ÊÇ£ºÒýµ¼Çø²¡¶¾¼õÉÙÁË£¬¶ø½Å±¾ÐͲ¡¶¾¿ªÊ¼·ºÀÄ¡£ÔÒòÊÇÔÚµ±½ñµÄ²Ù×÷ϵͳÏÂÖ±½Ó¸Äд´Å
Å̵ÄÒýµ¼Çø»áÓÐÒ»¶¨µÄÄѶȣ¨DOSÔòûÓб£»¤£¬ÔÊÐíµ÷ÓÃINT13Ö±½ÓдÅÌ£©£¬¶øÇÒÒýµ¼ÇøµÄ
¸Ä¶¯ºÜÈÝÒ×±»·¢ÏÖ£¬ËùÒÔºÜÉÙÓÐÈËÔÙдÁË£»¶ø½Å±¾²¡¶¾ÒÔÆä´«²¥Ð§ÂʸßÇÒÈÝÒ×±àд¶øÉîµÃ
²¡¶¾×÷ÕßµÄÇàíù¡£µ±È»ÓÉÓÚÕâÁ½ÖÖ²¡¶¾ÓÃÎÒÉÏÃæ˵¹ýµÄ»ùÓÚÌØÕ÷ÂëµÄ¾²Ì¬É¨Ãè¼¼Êõ¾Í¿ÉÒÔ
²éɱ£¬ËùÒÔ²»ÔÚÎÒÃǵÄÌÖÂÛÖ®ÁС£ÎÒÒªÌÖÂ۵ļ¼ÊõÖ÷ÒªÀ´×ÔÓÚ¶þ½øÖÆÍâ¿ÇÐͲ¡¶¾£¨¸ÐȾÎÄ
¼þµÄ²¡¶¾£©£¬²¢ÇÒÕâЩ¼¼Êõ´ó¶¼ºÍ²Ù×÷ϵͳµ×²ã»úÖÆ»ò386ÒÔÉÏCPUµÄ±£»¤Ä£Ê½Ïà¹Ø£¬ËùÒÔ
ÖµµÃÑо¿¡£´ó¼Ò¶¼ÖªµÀDOSϵÄÍâ¿ÇÐͲ¡¶¾Ö÷Òª¸ÐȾ16λµÄCOM»òEXEÎļþ£¬ÓÉÓÚDOSûÓб£»¤£¬ËüÃÇÄܹ»ÇáËɵؽøÐÐפÁô£¬¼õÉÙ¿ÉÓÃÄڴ棨ͨ¹ýÐÞ¸ÄMCBÁ´£©£¬ÐÞ¸Ä
ϵͳ´úÂ룬À¹½Øϵͳ·þÎñ»òÖжϡ£¶øµ½ÁËWIN9XºÍWINNT/2000ʱ´ú£¬Ïëд¸öÔËÐÐÆäÉϵÄ32λ
WINDOWS²¡¶¾¾ø·ÇÒ×Ê¡£ÓÉÓÚÒ³Ãæ±£»¤£¬Äã²»¿ÉÄÜÐÞ¸ÄϵͳµÄ´úÂëÒ³¡£ÓÉÓÚI/OÐí¿ÉλͼÖÐ
µÄ¹æ¶¨£¬ÄãÒ²²»ÄܽøÐÐÖ±½Ó¶Ë¿Ú·ÃÎÊ¡£ÔÚWINDOWSÖÐÄã²»¿ÉÄÜÏóÔÚDOSÖÐÄÇÑùͨ¹ý½Ø»ñINT2
1HÀ´À¹½ØËùÓÐÎļþ²Ù×÷¡£×ÜÖ®£¬ÄãÒÔÒ»¸öÓû§Ì¬³ÌÐòÔËÐУ¬ÄãµÄÐÐΪ½«Êܵ½²Ù×÷ϵͳÑϸñ
µÄ¿ØÖÆ£¬²»¿ÉÄÜÔÙÏóDOSÏÂÄÇÑùΪËùÓûΪÁË¡£ÁíÍâÖµµÃÒ»ÌáµÄÊÇ£¬WINDOWSϲÉÓõĿÉÖ´ÐÐ
Îļþ¸ñʽºÍDOSϵÄEXE½ØÈ»²»Í¬£¨ÆÕͨ³ÌÐò²ÉÓÃPE¸ñʽ£¬Çý¶¯³ÌÐò²ÉÓÃLE£©£¬ËùÒÔ²¡¶¾µÄ
¸ÐȾÎļþµÄÄѶÈÔö´óÁË£¨PEºÍLE±È½Ï¸´ÔÓ£¬Öмä·ÖÁËÈô¸É¸ö½Ú£¬Èç¹û¸ÐȾ´íÁË£¬½«µ¼ÖÂÎÄ
¼þ²»ÄܼÌÐøÖ´ÐУ©¡£ÒòΪµ±½ñ²¡¶¾µÄм¼ÊõÌ«¶à£¬ÎÒ²»¿ÉÄܽ«ËüÃÇÖðÒ»ÏêϸÌÖÂÛ£¬ÓÚÊǾÍ
Ñ¡È¡ÁËһЩÖØÒª²¢¾ßÓдú±íÐÔµÄÔÚ±¾Õµĸ÷С½ÚÖнøÐÐÌÖÂÛ¡£
1.2.1ϵͳºËÐÄ̬²¡¶¾
ÔÚ½éÉÜʲôÊÇϵͳºËÐÄ̬²¡¶¾Ö®Ç°£¬ÓбØÒªÌÖÂÛһϺËÐÄ̬ÓëÓû§Ì¬µÄ¸ÅÄî¡£ÆäʵֻҪËæ
±ã·¿ªÒ»±¾¹ØÓÚ386±£»¤Ä£Ê½»ã±à³ÌÐòÉè¼ÆµÄ½Ì¿ÆÊ飬¶¼¿ÉÒÔÕÒµ½¶ÔÕâÁ½¸ö¸ÅÄîµÄ½²Êö¡£3
86¼°ÒÔÉϵÄCPUʵÏÖÁË4¸öÌØȨ¼¶Ä£Ê½£¨WINDOWSÖ»Óõ½ÁËÆäÖÐÁ½¸ö£©£¬ÆäÖÐÌØȨ¼¶0£¨Ring
0£©ÊÇÁô¸ø²Ù×÷ϵͳ´úÂ룬É豸Çý¶¯³ÌÐò´úÂëʹÓõģ¬ËüÃǹ¤×÷ÓÚϵͳºËÐÄ̬£»¶øÌØȨ¼«3
£¨Ring3£©Ôò¸øÆÕͨµÄÓû§³ÌÐòʹÓã¬ËüÃǹ¤×÷ÔÚÓû§Ì¬¡£ÔËÐÐÓÚ´¦ÀíÆ÷ºËÐÄ̬µÄ´úÂë²»ÊÜ
ÈκεÄÏÞÖÆ£¬¿ÉÒÔ×ÔÓɵطÃÎÊÈκÎÓÐЧµØÖ·£¬½øÐÐÖ±½Ó¶Ë¿Ú·ÃÎÊ¡£¶øÔËÐÐÓÚÓû§Ì¬µÄ´úÂë
ÔòÒªÊܵ½´¦ÀíÆ÷µÄÖî¶à¼ì²é£¬ËüÃÇÖ»ÄÜ·ÃÎÊÓ³ÉäÆäµØÖ·¿Õ¼äµÄÒ³±íÏîÖй涨µÄÔÚÓû§Ì¬ÏÂ
¿É·ÃÎÊÒ³ÃæµÄÐéÄâµØÖ·£¬ÇÒÖ»ÄܶÔÈÎÎñ״̬¶Î£¨TSS£©ÖÐI/OÐí¿Éλͼ£¨I/O Permission B
itmap£©Öй涨µÄ¿É·ÃÎʶ˿ڽøÐÐÖ±½Ó·ÃÎÊ£¨´Ëʱ´¦ÀíÆ÷״̬ºÍ¿ØÖƱêÖ¾¼Ä´æÆ÷EFLAGSÖеÄ
IOPLͨ³£Îª0£¬Ö¸Ã÷µ±Ç°¿ÉÒÔ½øÐÐÖ±½ÓI/OµÄ×îµÍÌØȨ¼¶±ðÊÇRing0£©¡£ÒÔÉϵÄÌÖÂÛÖ»ÏÞÓÚ±£
»¤Ä£Ê½²Ù×÷ϵͳ£¬ÏóDOSÕâÖÖʵģʽ²Ù×÷ϵͳÔòûÓÐÕâЩ¸ÅÄÆäÖеÄËùÓдúÂ붼¿É±»¿´×÷
ÔËÐÐÔÚºËÐÄ̬¡£¼ÈÈ»ÔËÐÐÔÚºËÐÄ̬ÓÐÈç´ËÖ®¶àµÄÓÅÊÆ£¬ÄÇô²¡¶¾µ±È»Ã»ÓÐÀíÓɲ»ÏëµÃµ½Ri
ng0¡£´¦ÀíÆ÷ģʽ´ÓRing3ÏòRing0µÄÇл»·¢ÉúÔÚ¿ØÖÆȨתÒÆʱ£¬ÓÐÒÔÏÂÁ½ÖÖÇé¿ö£º·ÃÎʵ÷ÓÃÃŵij¤×ªÒÆÖ¸ÁîCALL£¬·ÃÎÊÖжÏÃÅ»òÏÝÚåÃŵÄINTÖ¸Áî¡£¾ßÌåµÄתÒÆ
ϸ½ÚÓÉÓÚÉæ¼°¸´Ôӵı£»¤¼ì²éºÍ¶ÑÕ»Çл»£¬²»ÔÙ׸Êö£¬Çë²ÎÔÄÏà¹Ø×ÊÁÏ¡£ÏÖ´úµÄ²Ù×÷ϵͳ
ͨ³£Ê¹ÓÃÖжÏÃÅÀ´Ìṩϵͳ·þÎñ£¬Í¨¹ýÖ´ÐÐÒ»ÌõÏÝÈëÖ¸ÁîÀ´Íê³ÉģʽÇл»£¬ÔÚINTEL X86ÉÏ
ÕâÌõÖ¸ÁîÊÇINT£¬ÈçÔÚWIN9XÏÂÊÇINT30£¨±£»¤Ä£Ê½»Øµ÷£©£¬ÔÚLINUXÏÂÊÇINT80£¬ÔÚWINNT/2
000ÏÂÊÇINT2E¡£Óû§Ä£Ê½µÄ·þÎñ³ÌÐò£¨ÈçϵͳDLL£©Í¨¹ýÖ´ÐÐÒ»¸öINTXXÀ´ÇëÇóϵͳ·þÎñ£¬
È»ºó´¦ÀíÆ÷ģʽ½«Çл»µ½ºËÐÄ̬£¬¹¤×÷ÓÚºËÐÄ̬µÄÏàÓ¦µÄϵͳ´úÂ뽫·þÎñÓÚ´Ë´ÎÇëÇó²¢½«
½á¹û´«¸øÓû§³ÌÐò¡£ÏÂÃæ¾Í¾ÙÀý×Ó˵Ã÷²¡¶¾½øÈëϵͳºËÐÄ̬µÄ·½·¨¡£
ÔÚWIN9XϽø³ÌÐéÄâµØÖ·¿Õ¼äÖÐÓ³Éä¹²Ïíϵͳ´úÂëµÄ²¿·Ö£¨3G--4G£©ÖгýÁË×îÉÏÃæ4MÒ³±íÓÐ
Ò³Ãæ±£»¤ÍâÆäËüµØ·½¿ÉÓÉÓû§³ÌÐò¶Áд¡£Èç¹ûÄãÓÃSoftice£¨ÏµÍ³¼¶µ÷ÊÔÆ÷£©µÄPAGEÃüÁî²é
¿´ÕâЩµØÖ·µÄÒ³ÊôÐÔ£¬ÔòÄã»á¾ªÆæµØ·¢ÏÖU RW룬Õâ˵Ã÷ÕâЩµØÖ·¿É´ÓÓû§Ì¬Ö±½Ó¶Á³ö»ò
дÈë¡£ÕâÒâζ×ÅÈκÎÒ»¸öÓû§³ÌÐò¶¼Äܹ»ÔÚÆäÔËÐйý³ÌÖжñÒâ»òÎÞÒâµØÆÆ»µ²Ù×÷ϵͳ´úÂë
Ò³¡£Óɴ˲¡¶¾¾Í¿ÉÒÔÔÚGDT£¨È«¾ÖÃèÊö·û±í£©£¬LDT£¨¾Ö²¿ÃèÊö·û±í£©ÖÐËæÒâ¹¹ÔìÃÅÃèÊö·û
²¢½è´Ë½øÈëºËÐÄ̬¡£µ±È»£¬Ò²²»Ò»¶¨Òª½èÖúÃÅÃèÊö£¬»¹ÓÐÐí¶à·½·¨¿ÉÒԵõ½Ring0¡£¾ÝÎÒËù
ÖªµÄ·½·¨¾Í²»ÏÂ10ÓàÖÖÖ®¶à,Èçͨ¹ýµ÷ÓÃÃÅ£¨Callgate£©£¬ÖжÏÃÅ£¨Intgate£©£¬ÏÝÚåÃÅ£¨
Trapgate£©£¬Òì³£ÃÅ£¨Fault£©£¬ÖжÏÇëÇó£¨IRQs£©£¬¶Ë¿Ú£¨Ports£©£¬ÐéÄâ»ú¹ÜÀíÆ÷£¨VM
M£©£¬»Øµ÷£¨Callback£©£¬ÐÎʽת»»£¨Thunks£©£¬É豸IO¿ØÖÆ£¨DeviceIOControl£©,APIº¯
Êý£¨SetThreadContext£© ,ÖжÏ2E·þÎñ£¨NTKERN.VxD£©¡£ÓÉÓÚƪ·ùµÄÏÞÖÆÎÒ²»¿ÉÄܽ«ËùÓÐ
µÄ·½·¨ÖðÒ»ÃèÊöÇå³þ£¬ÕâÀïÎÒ½öÑ¡È¡×î¾ßÓдú±íÐÔµÄCIH²¡¶¾1.5°æ¿ªÍ·µÄÒ»¶Î´úÂë¡£
ÈËÃdz£ËµCIH²¡¶¾ÔËÓÃÁËVXD£¨ÐéÄâÉ豸Çý¶¯£©¼¼Êõ£¬ÆäʵËü±¾Éí²¢²»ÊÇVXD¡£Ö»²»¹ýËüÀûÓÃ
WIN9XÉÏÊö©¶´£¬ÔÚIDT£¨ÖжÏÃèÊö·û±í£©Öй¹ÔìÁËÒ»¸öDPL£¨¶ÎÌØȨ¼¶£©Îª3µÄÖжÏÃÅ£¨Òâ
ζ×Å¿ÉÒÔ´ÓRing3ÏÂÖ´ÐзÃÎʸÃÖжÏÃŵÄINTÖ¸Á£¬²¢Ê¹ÃèÊö·ûÖ¸Ïò×Ô¼ºË½ÓеØÖ·¿Õ¼äÖÐ
µÄÒ»¸öÐèÒª¹¤×÷ÔÚRing0ϵĺ¯ÊýµØÖ·¡£ÕâÑùÒ»À´CIH¾Í¿ÉÒÔͨ¹ý¼òµ¥µÄÖ´ÐÐÒ»ÌõINTXXÖ¸Áî
£¨CIHÑ¡ÔñʹÓÃINT3£¬ÊÇΪÁËʹͬÑù½Ó¹ÒINT3µÄϵͳµ÷ÊÔÆ÷SofticeÎÞ·¨Õý³£¹¤×÷ÒÔ´ïµ½·´
¸ú×ÙµÄÄ¿µÄ£©½øÈëϵͳºËÐÄ̬£¬´Ó¶øµ÷ÓÃϵͳµÄVMMºÍVXD·þÎñ¡£ÒÔÏÂÊÇÎÒ×¢Ê͵ÄÒ»¶ÎCIH1
.5µÄÔ´´úÂ룺
; *************************************
; * ÐÞ¸ÄIDTÒÔÇóµÃºËÐÄ̬ÌØȨ¼¶ *
; *************************************
push eax
sidt [esp-02h] £»È¡µÃIDT±í»ùµØÖ·
pop ebx
add ebx, HookExceptionNumber*08h+04h £»ZF = 0
cli £»¶ÁÈ¡ÐÞ¸ÄϵͳÊý¾ÝʱÏȽûÖ¹ÖжÏ
mov ebp, [ebx]
mov bp, [ebx-04h] £»È¡µÃÔÀ´µÄÖжÏÈë¿ÚµØÖ·
lea esi, MyExceptionHook-@1[ecx] £»È¡µÃÐèÒª¹¤×÷ÔÚRing0µÄº¯ÊýµÄÆ«ÒƵØÖ·
push esi
mov [ebx-04h], si
shr esi, 16
mov [ebx+02h], si £»ÉèÖÃΪеÄÖжÏÈë¿ÚµØÖ·
pop esi
; *************************************
; * ²úÉúÒ»¸öÒì³£À´½øÈëRing0 *
; *************************************
int HookExceptionNumber £»²úÉúÒ»¸öÒì³£
µ±È»£¬ºóÃ滹Óлָ´ÔÀ´ÖжÏÈë¿ÚµØÖ·ºÍÒì³£´¦ÀíÖ¡µÄ´úÂë¡£
¸Õ²ÅËùÌÖÂ۵ļ¼Êõ½öÏÞÓÚWIN9X£¬ÏëÔÚWINNT/2000ϽøÈëRing0ÔòûÓÐÕâôÈÝÒס£Ö÷ÒªµÄÔ
ÒòÊÇWINNT/2000ûÓÐÉÏÊöµÄ©¶´£¬ËüÃǵÄϵͳ´úÂëÒ³Ã棨2G--4G£©ÓкܺõÄÒ³±£»¤¡£´óÓÚ
0x80000000µÄÐéÄâµØÖ·¶ÔÓÚÓû§³ÌÐòÊDz»¿É¼ûµÄ¡£Èç¹ûÄãÓÃSofticeµÄPAGEÃüÁî²é¿´ÕâЩµØ
Ö·µÄÒ³ÊôÐÔ£¬Äã»á·¢ÏÖS룬Õâ˵Ã÷ÕâЩµØÖ·½ö¿É´ÓºËÐÄ̬·ÃÎÊ¡£ËùÒÔÏëÔÚIDT£¬GDTËæÒâ¹¹
ÔìÃèÊö·û£¬ÔËÐÐʱÐÞ¸ÄÄÚºËÊǸù±¾×ö²»µ½µÄ¡£ËùÄÜ×öµÄ½öÊÇͨ¹ý¼ÓÔØÒ»¸öÇý¶¯³ÌÐò£¬Ê¹ÓÃ
ËüÀ´×öÄãÔÚRing3ÏÂ×ö²»µ½µÄÊÂÇé¡£²¡¶¾¿ÉÒÔÔÚËüÃǼÓÔصÄÇý¶¯ÖÐÐÞ¸ÄÄں˴úÂ룬»òΪ²¡¶¾
±¾Éí´´½¨µ÷ÓÃÃÅ£¨ÀûÓÃNTÓÉNtoskrnl.exeµ¼³öµÄδ¹«¿ªµÄϵͳ·þÎñKeI386AllocateGdtSel
ectors£¬KeI386SetGdtSelector£¬KeI386ReleaseGdtSelectors£©¡£ÈçFunlove²¡¶¾¾ÍÀûÓÃ
Çý¶¯À´ÐÞ¸ÄϵͳÎļþ£¨Ntoskrnl.exe£¬Ntldr£©ÒÔÈƹý°²È«¼ì²é¡£µ«ÕâÀïÃæÓÐÁ½¸öÎÊÌ⣬Æä
Ò»ÊÇÇý¶¯³ÌÐò´ÓÄÄÀïÀ´£¬ÏÖ´ú²¡¶¾ÆÕ±éʹÓÃÒ»¸ö³ÆΪ¡°Drop¡±µÄ¼¼Êõ£¬¼´ÔÚ²¡¶¾Ìå±¾Éí°ü
º¬Çý¶¯³ÌÐò¶þ½øÖÆÂ루¿ÉÒÔ½øÐÐѹËõ»ò¶¯Ì¬¹¹ÔìÎļþÍ·£©£¬ÔÚ²¡¶¾ÐèҪʹÓÃʱ£¬¶¯Ì¬Éú³É
Çý¶¯³ÌÐò²¢½«ËüÃÇÈÓµ½´ÅÅÌÉÏ£¬È»ºóÂíÉÏͨ¹ýÔÚSCM£¨·þÎñ¿ØÖƹÜÀíÆ÷£©×¢²á²¢×îÖÕµ÷ÓÃS
tartServiceÀ´Ê¹Çý¶¯³ÌÐòµÃÒÔÔËÐУ»Æä¶þÊǼÓÔØÒ»¸öÇý¶¯³ÌÐòÐèÒª¹ÜÀíÔ±Éí·Ý£¬ÆÕͨÕʺÅÔÚµ÷ÓÃÉÏÊöµÄ¼ÓÔغ¯Êýʱ»á·µ»Øʧ°Ü£¨°²È«×ÓϵͳҪ¼ì²éÓû§µÄ·Ã
ÎÊÁîÅÆ£¨Token£©ÖÐÓÐÎÞSeLoadDriverPrivilegeÌØȨ£©£¬µ«¶àÊýÓû§ÔÚ´ó¶àʱºòµÇ¼ʱ»á
Ñ¡Ôñ¹ÜÀíÔ±Éí·Ý£¬·ñÔòÁ¬²¡¶¾ÊµÊ±¼à¿ØÇý¶¯Ò²Í¬ÑùÎÞ·¨¼ÓÔØ£¬ËùÒÔÁô¸ø²¡¶¾µÄ»ú»á»¹ÊǺÜ
¶àµÄ¡£
1.2.2פÁô²¡¶¾
פÁô²¡¶¾ÊÇÖ¸ÄÇЩÔÚÄÚ´æÖÐÑ°ÕÒºÏÊʵÄÒ³Ãæ²¢½«²¡¶¾×ÔÉí¿½±´µ½ÆäÖÐÇÒÔÚϵͳÔËÐÐÆÚ¼äÄÜ
¹»Ê¼ÖÕ±£³Ö²¡¶¾´úÂëµÄ´æÔÚ¡£×¤Áô²¡¶¾±ÈÄÇЩֱ½Ó¸ÐȾ£¨Direct-action£©ÐͲ¡¶¾¸ü¾ßÒþ±Î
ÐÔ£¬Ëüͨ³£Òª½Ø»ñijЩϵͳ²Ù×÷À´´ïµ½¸ÐȾ´«²¥µÄÄ¿µÄ¡£½øÈëÁ˺ËÐÄ̬µÄ²¡¶¾¿ÉÒÔÀûÓÃϵ
ͳ·þÎñÀ´´ïµ½´ËÄ¿µÄ£¬ÈçCIH²¡¶¾Í¨¹ýµ÷ÓÃÒ»¸öÓÉVMMµ¼³öµÄ·þÎñVMMCALL _PageAllocateÔÚ
´óÓÚ0xC0000000µÄµØÖ·ÉÏ·ÖÅäÒ»¿éÒ³Ãæ¿Õ¼ä¡£¶ø´¦ÓÚÓû§Ì¬µÄ³ÌÐòÒªÏëÔÚ³ÌÐòÍ˳öºóÈÔפ
Áô´úÂëµÄ²¿·ÖÓÚÄÚ´æÖÐËƺõÊDz»¿ÉÄܵģ¬ÒòΪÎÞÂÛÓû§³ÌÐò·ÖÅäºÎÖÖÄڴ涼½«×÷Ϊ½ø³ÌÕ¼
ÓÃ×ÊÔ´µÄÒ»²¿·Ö£¬Ò»µ©½ø³Ì½áÊø£¬ËùÕ¼×ÊÔ´½«Á¢¼´±»ÊÍ·Å¡£ËùÒÔÎÒÃÇÒª×öµÄÊÇ·ÖÅäÒ»¿é½ø
³ÌÍ˳öºóÈԿɱ£³ÖµÄÄÚ´æ¡£
²¡¶¾Ð´×÷С×é29AµÄ³ÉÔ±GriYo ÔËÓõÄÒ»¸ö¼¼ÊõºÜÓд´Ò⣺Ëûͨ¹ýCreateFileMappingA ºÍ
MapViewOfFile´´½¨ÁËÒ»¸öÇøÓò¶ÔÏó²¢Ó³ÉäËüµÄÒ»¸öÊÓ¿Úµ½×Ô¼ºµÄµØÖ·¿Õ¼äÖÐÈ¥£¬²¢°Ñ²¡¶¾
Ìå°áµ½ÄÇÀÓÉÓÚÎļþÓ³ÉäËùÔÚµÄÐéÄâµØÖ·´¦ÓÚ¹²ÏíÇøÓò£¨Äܹ»±»ËùÓнø³Ì¿´µ½£¬¼´ËùÓÐ
½ø³ÌÓÃÓÚÓ³Éä¹²ÏíÇøÄÚÐéÄâµØÖ·µÄÒ³±íÏîÈ«¶¼Ö¸ÏòÏàͬµÄÎïÀíÒ³Ã棩£¬ËùÒÔÏÂÒ»²½Ëûͨ¹ý
ÏòExplorer.exeÖÐ×¢ÈëÒ»¶Î´úÂ루ÀûÓÃWriteProcessMemoryÀ´ÏòÆäËü½ø³ÌµÄµØÖ·¿Õ¼äдÈë
Êý¾Ý£©£¬¶øÕâ¶Î´úÂë»á´ÓExplorer.exeµÄµØÖ·¿Õ¼äÖÐÔÙ´ÎÉêÇë´ò¿ªÕâ¸öÎļþÓ³Éä¡£Èç´ËÒ»
À´£¬¼´±ã²¡¶¾Í˳ö£¬µ«ÓÉÓÚExplorer.exe»¹¶ÔÓ³ÉäÒ³Ãæ±£³ÖÒýÓã¬ËùÒÔÒ»·Ý²¡¶¾Ìå´úÂë¾Í
Ò»Ö±±£³ÖÔÚ¿ÉÒÔÓ°ÏìËùÓнø³ÌµÄÄÚ´æÒ³ÃæÖÐÖ±ÖÁExplorer.exeÍ˳ö¡£
ÁíÍ⻹¿ÉÒÔͨ¹ýÐÞ¸Äϵͳ¶¯Ì¬Á¬½ÓÄ£¿é£¨DLL£©À´½øÐÐפÁô¡£WIN9XÏÂϵͳDLL£¨ÈçKernel3
2.dll Ó³ÉäÖÁBFF70000£©´¦ÓÚϵͳ¹²ÏíÇøÓò£¨2G-3G£©£¬Èç¹ûÔÚÆä´úÂë¶Î¿Õ϶ÖÐдÈëһС¶Î
²¡¶¾´úÂëÔò¿ÉÒÔÓ°ÏìÆäËüËùÓнø³Ì¡£µ«Kernel32.dllµÄ´úÂë¶ÎÔÚÓû§Ì¬ÊÇÖ»ÄܶÁ²»ÄÜдµÄ
¡£ËùÒÔ±ØÐëÏÈͨ¹ýÌØÊâÊÖ¶ÎÐÞ¸ÄÆäÒ³±£»¤ÊôÐÔ£»¶øÔÚWINNT/2000ÏÂϵͳDLLËùÔÚÒ³Ãæ±»Ó³Éä
µ½½ø³ÌµÄ˽Óпռ䣨ÈçKernel32.dll Ó³ÉäÖÁ77ED0000£©ÖУ¬²¢¾ßÓÐдʱ¿½±´ÊôÐÔ£¬¼´Ã»ÓÐ
½ø³ÌÊÔͼдÈë¸ÃÒ³Ãæʱ£¬ËùÓнø³Ì¹²ÏíÕâ¸öÒ³Ã棻¶øµ±Ò»¸ö½ø³ÌÊÔͼдÈë¸ÃÒ³Ãæʱ£¬ÏµÍ³
µÄÒ³Ãæ´íÎó´¦Àí´úÂ뽫ÊÕµ½´¦ÀíÆ÷µÄÒì³££¬²¢¼ì²éµ½¸ÃÒì³£²¢·Ç·ÃÎÊÎ¥Àý£¬Í¬Ê±·ÖÅä¸øÒý
·¢Òì³£µÄ½ø³ÌÒ»¸öÐÂÒ³Ã棬²¢¿½±´ÔÒ³ÃæÄÚÈÝÓÚÆäÉÏÇÒ¸üнø³ÌµÄÒ³±íÒÔÖ¸ÏòзÖÅäµÄÒ³
¡£ÕâÖÖ¹²ÏíÄÚ´æµÄÓÅ»¯¸ø²¡¶¾µÄд×÷´øÀ´ÁËÒ»¶¨µÄÂé·³£¬²¡¶¾²»ÄÜÏóÔÚWIN9XÏÂÄÇÑù½öÐÞ¸Ä
Kernel32.dllÒ»´¦´úÂë±ã¿ÉÒ»ÀÍÓÀÒÝ¡£ËüÐèÒªÀûÓÃWriteProcessMemoryÀ´Ïòÿ¸ö½ø³ÌÓ³Éä
Kernel32.dllµÄµØַдÈ벡¶¾´úÂ룬ÕâÑùÿ¸ö½ø³Ì¶¼»áµÃµ½²¡¶¾ÌåµÄÒ»¸ö¸±±¾£¬ÕâÔÚ²¡¶¾
½ç±»³ÆΪ¶à½ø³ÌפÁô»òÿ½ø³ÌפÁô£¨Muti-Process Residence or Per-Process Residenc
e £©¡£
1.2.3½Ø»ñϵͳ²Ù×÷
½Ø»ñϵͳ²Ù×÷ÊDz¡¶¾¹ßÓõļ¿Á©¡£DOSʱ´úÈç´Ë£¬WINDOWSʱ´úÒ²²»ÀýÍâ¡£ÔÚDOSÏ£¬²¡¶¾Í¨
¹ýÔÚÖжÏÏòÁ¿±íÖÐÐÞ¸ÄINT21HµÄÈë¿ÚµØÖ·À´½Ø»ñDOSϵͳ·þÎñ£¨DOSÀûÓÃINT21HÀ´Ìṩϵͳ
µ÷Óã¬ÆäÖаüÀ¨´óÁ¿µÄÎļþ²Ù×÷£©¡£¶ø´ó²¿·ÖÒýµ¼Çø²¡¶¾»á½Ó¹ÒINT13H£¨Ìṩ´ÅÅ̲Ù×÷·þ
ÎñµÄBIOSÖжϣ©´Ó¶øÈ¡µÃ¶Ô´ÅÅÌ·ÃÎʵĿØÖÆ¡£WINDOWSϵIJ¡¶¾Í¬ÑùÕÒµ½Á˹³¹Òϵͳ·þÎñµÄ
°ì·¨¡£±È½ÏµäÐ͵ÄÈçCIH²¡¶¾¾ÍÊÇÀûÓÃÁËIFSMGR.VXD£¨¿É°²×°Îļþϵͳ£©ÌṩµÄÒ»¸öϵͳ¼¶
Îļþ¹³×ÓÀ´½Ø»ñϵͳÖÐËùÓÐÎļþ²Ù×÷£¬ÎÒ»áÔÚÏà¹ØÕ½ÚÖÐÏêϸÌÖÂÛÕâ¸öÎÊÌ⣬ÒòΪWIN9XÏÂ
µÄʵʱ¼à¿ØÒ²Ö÷ÒªÀûÓÃÕâ¸ö·þÎñ¡£³ý´ËÖ®Í⣬»¹ÓбðµÄ·½·¨¡£µ«Ð§¹ûûÓÐÕâ¸öϵͳ¼¶Îļþ
¹³×Ӻã¬Ö÷ÒªÊDz»¹»µ×²ã£¬»á¶ªÊ§Ò»Ð©Îļþ²Ù×÷¡£
ÆäÖÐÒ»¸ö·½·¨ÊÇÀûÓÃAPIHOOK£¬¹³¹ÒAPIº¯Êý¡£ÆäʵϵͳÖв¢Ã»ÓÐÏֳɵÄÕâÖÖ·þÎñ£¬ÓÐÒ»¸ö
SetWindowsHookEx¿ÉÒÔ¹³×¡Êó±êÏûÏ¢£¬µ«¶Ô½Ø»ñAPIº¯ÊýÔòÎÞÄÜΪÁ¦¡£ÎÒÃÇÄÜ×öµÄÊÇ×Ô¼º¹¹
ÔìÕâÑùµÄHOOK¡£·½·¨ÆäʵºÜ¼òµ¥£º±ÈÈçÄãÒª½Ø»ñKernel32.dllµ¼³öµÄº¯ÊýCreateFile£¬Ö»
ÐëÔÚÆ亯Êý´úÂëµÄ¿ªÍ·£¨BFF7XXXX£©¼ÓÈëÒ»¸öÌøתָÁîµ½ÄãµÄ¹³×Óº¯ÊýµÄÈë¿Ú£¬ÔÚÄãµÄº¯
ÊýÖ´ÐÐÍêºóÔÙÌø»ØÀ´¡£ÈçÏÂͼËùʾ£º
;; Target Function£¨Òª½Ø»ñµÄÄ¿±êº¯Êý£©
¡¡
TargetFunction:£¨Òª½Ø»ñµÄÄ¿±êº¯ÊýÈë¿Ú£©
jmp DetourFunction£¨Ìøµ½¹³×Óº¯Êý£¬5¸ö×Ö½Ú³¤µÄÌøתָÁ
TargetFunction+5:
push edi
¡¡
;; Trampoline£¨ÄãµÄ¹³×Óº¯Êý£©
¡¡
TrampolineFunction:£¨ÄãµÄ¹³×Óº¯ÊýÖ´ÐÐÍêºóÒª·µ»ØÔº¯ÊýµÄµØ·½£©
push ebp
mov ebp,esp
push ebx
push esi£¨ÒÔÉϼ¸ÐÐÊÇÔº¯ÊýÈë¿Ú´¦µÄ¼¸ÌõÖ¸Á¹²5¸ö×Ö½Ú£©
jmp TargetFunction+5£¨Ìø»ØÔº¯Êý£©
¡¡
µ«ÕâÖÖ·½·¨½Ø»ñµÄ½ö½öÊǺÜСһ²¿·ÖÎļþ´ò¿ª²Ù×÷¡£
ÔÚWIN9XÏ»¹ÓÐÒ»¸öÏÊΪÈËÖªµÄ½Ø»ñÎļþ²Ù×÷µÄ°ì·¨£¬ËµÆðÀ´ÕâÓ¦¸ÃËãÊÇWIN9XµÄÒ»´óºóÃÅ
¡£Ëü¾ÍÊÇKernel32.dllÖÐÒ»¸öδ¹«¿ªµÄ½Ð×öVxdCall0µÄAPIº¯Êý¡£·´»ã±àÕâ¸öº¯ÊýµÄ´úÂëÈç
주
mov eax,dword ptr [esp+00000004h] £»È¡µÃ·þÎñ´úºÅ
pop dword ptr [esp] £»¶ÑÕ»ÐÞÕý
call fword ptr cs:[BFFC9004] £»Í¨¹ýÒ»¸öµ÷ÓÃÃŵ÷ÓÃ3B¶Îij´¦µÄ´úÂë
Èç¹ûÎÒÃǼÌÐø¸ú×ÙÏÂÈ¥£¬Ôò»á¿´µ½£º
003B:XXXXXXXX int 30h £»ÕâÊǸöÓÃÒÔÏÝÈëVWIN32.VXDµÄ±£»¤Ä£Ê½»Øµ÷
ÓйØVxdCallµÄÏêϸÄÚÈÝ£¬Çë²Î¿´Matt PietrekµÄ¡¶Windows 95 System Programming Sec
rets¡·¡£
µ±·þÎñ´úºÅΪ0X002A0010ʱ£¬±£»¤Ä£Ê½»Øµ÷»áÏÝÈëVWIN32.VXDÖÐÒ»¸ö½Ð×öVWIN32_Int21Di
spatchµÄ·þÎñ¡£ÕâÕý˵Ã÷ÁËWIN9X»¹ÔÚÒÀÀµÓÚMSDos£¬¾¡¹Ü΢ÈíÉù³ÆWIN9X²»ÔÙÒÀÀµÓÚMSDos
¡£µ÷Óù淶ÈçÏ£º
my_int21h:push ecx
push eax £»ÀàËÆDOSÏÂINT21HµÄAXÖд«ÈëµÄ¹¦ÄܺÅ
push 002A0010h
call dword ptr [ebp+a_VxDCall]
ret
ÎÒÃÇ¿ÉÒÔ½«ÉÏÃæVxdCall0º¯ÊýµÄÈë¿Ú´¦µÚÈýÌõÔ¶µ÷ÓÃÖ¸Áî·ÃÎʵÄKernel32.dllÊý¾Ý¶ÎÖÐ
Óû§Ì¬¿ÉдµØÖ·BFFC9004¦´æ´¢µ?FWORD'Áù¸ö×Ö½Ú¸ÄΪָÏòÎÒÃÇ×Ô¼º¹³×Óº¯ÊýµÄµØÖ·£¬²¢ÔÚ
¹³×ÓÖмì²é´«Èë·þÎñºÅºÍ¹¦ÄܺÅÀ´È·¶¨ÊÇ·ñÊÇÇëÇóVWIN32_Int21DispatchÖеÄij¸öÎļþ·þ
Îñ¡£ÖøÃûµÄHPS²¡¶¾¾ÍÀûÓÃÁËÕâ¸ö¼¼ÊõÔÚÓû§Ì¬ÏÂÖ±½Ó½Ø»ñϵͳÖеÄÎļþ²Ù×÷£¬µ«ÕâÖÖ·½·¨
½Ø»ñµÄÒ²½ö½öÊÇһС²¿·ÖÎļþ²Ù×÷¡£
1.2.4¼ÓÃܱäÐβ¡¶¾
¼ÓÃܱäÐβ¡¶¾ÊÇÐéÄâ»úÒ»ÕµÄÖصãÄÚÈÝ£¬½«·Åµ½Ïà¹ØÕ½ÚÖнéÉÜ¡£
1.2.5·´¸ú×Ù/·´ÐéÄâÖ´Ðв¡¶¾
·´¸ú×Ù/·´ÐéÄâÖ´Ðв¡¶¾ºÍÐéÄâ»úÁªÏµÃÜÇУ¬ËùÒÔÒ²½«·Åµ½ÏàÓ¦µÄÕ½ÚÖнéÉÜ¡£
1.2.6Ö±½ÓAPIµ÷ÓÃ
Ö±½ÓAPIµ÷ÓÃÊǵ±½ñWIN32²¡¶¾³£ÓõÄÊֶΣ¬ËüÖ¸µÄÊDz¡¶¾ÔÚÔËÐÐʱֱ½Ó¶¨Î»APIº¯ÊýÔÚÄÚ´æ
ÖеÄÈë¿ÚµØÖ·È»ºóµ÷ÓÃÖ®µÄÒ»ÖÖ¼¼Êõ¡£ÆÕͨ³ÌÐò½øÐÐAPIµ÷ÓÃʱ£¬±àÒëÆ÷»á½«Ò»¸öAPIµ÷ÓÃ
Óï¾ä±àÒëΪ¼¸¸ö²ÎÊýѹջָÁîºó¸úÒ»Ìõ¼ä½Óµ÷ÓÃÓï¾ä£¨ÕâÊÇÖ¸Microsoft±àÒëÆ÷£¬Borland
±àÒëÆ÷ʹÓÃJMP
DWORD PTR [XXXXXXXXh]£©ÐÎʽÈçÏ£º
push arg1
push arg2
¡¡
call dword ptr[XXXXXXXXh]
µØÖ·XXXXXXXXhÔÚ³ÌÐòÓ³ÏóµÄµ¼È루Import Section£©¶ÎÖУ¬µ±³ÌÐò±»¼ÓÔØÔËÐÐʱ£¬ÓÉ×°Èë
Æ÷¸ºÔðÏòÀïÃæÌíÈëAPIº¯ÊýµÄµØÖ·£¬Õâ¾ÍÊÇËùνµÄ¶¯Ì¬Á´½Ó»úÖÆ¡£²¡¶¾ÓÉÓÚΪÁ˱ÜÃâ¸ÐȾһ
¸ö¿ÉÖ´ÐÐÎļþʱÔÚÎļþµÄµ¼Èë¶ÎÖй¹Ô첡¶¾Ìå´úÂëÖÐÓõ½µÄAPIµÄÁ´½ÓÐÅÏ¢£¬ËüÑ¡ÔñÔËÓÃ×Ô
¼ºÔÚÔËÐÐʱֱ½Ó¶¨Î»APIº¯ÊýµØÖ·µÄ´úÂë¡£ÆäʵÕâЩº¯ÊýµØÖ·¶ÔÓÚ²Ù×÷ϵͳµÄij¸ö°æ±¾ÊÇÏà
¶Ô¹Ì¶¨µÄ£¬µ«²¡¶¾²»ÄÜÒÀÀµÓÚ´Ë¡£ÏÖÔÚ½ÏΪÁ÷ÐеÄ×ö·¨ÊÇÏȶ¨Î»°üº¬APIº¯ÊýµÄ¶¯Ì¬Á¬½Ó¿â
µÄ×°Èë»ùÖ·£¬È»ºóÔÚÆäµ¼³ö¶Î£¨Export Section£©ÖÐÑ°ÕÒµ½ÐèÒªµÄAPIµØÖ·¡£ºóÃæÒ»²½¼¸ºõ
ûÓÐÄѶȣ¬Ö»ÒªÄãÊìϤµ¼³ö¶Î½á¹¹¼´¿É¡£¹Ø¼üÔÚÓÚµÚÒ»²½--È·¶¨DLL×°ÈëµØÖ·¡£ÆäʵϵͳD
LL×°Èë»ùÖ·¶ÔÓÚ²Ù×÷ϵͳµÄij¸ö°æ±¾Ò²Êǹ̶¨µÄ£¬µ«²¡¶¾ÎªÈ·±£ÆäÎȶ¨ÐÔÈÔ²»ÄÜÒÀÀµÕâÒ»
µã¡£Ä¿Ç°²¡¶¾´ó¶¼ÀûÓÃÒ»¸ö½Ð×ö½á¹¹»¯Òì³£´¦ÀíµÄ¼¼ÊõÀ´²¶»ñ²¡¶¾ÌåÒý·¢µÄÒì³£¡£ÕâÑùÒ»
À´²¡¶¾¾Í¿ÉÒÔÔÚÒ»¶¨Äڴ淶ΧÄÚËÑË÷Ö¸¶¨µÄDLL£¨DLLʹÓÃPE¸ñʽ£¬Í·²¿Óй̶¨±êÖ¾£©£¬¶ø
²»±Øµ£ÐÄ»áÒòÒý·¢Ò³Ãæ´íÎó¶ø±»²Ù×÷ϵͳɱµô¡£
ÓÉÓÚÒì³£´¦ÀíºÍºóÃæµÄ·´ÐéÄâÖ´Ðм¼ÊõÃÜÇÐÏà¹Ø£¬ËùÒÔÌؽ«½á¹¹»¯Òì³£´¦Àí¼òµ¥½âÊÍÈçÏÂ
£º
¹²ÓÐÁ½ÀàÒì³£´¦Àí£º×îÖÕÒì³£´¦ÀíºÍÿÏß³ÌÒì³£´¦Àí¡£
ÆäÒ»£º×îÖÕÒì³£´¦Àí
µ±ÄãµÄ½ø³ÌÖÐÎÞÂÛÄĸöÏ̷߳¢ÉúÁËÒì³££¬²Ù×÷ϵͳ½«µ÷ÓÃÄãÔÚÖ÷Ïß³ÌÖе÷ÓÃSetUnhandled
ExceptionFilter½¨Á¢µÄÒì³£´¦Àíº¯Êý¡£ÄãÒ²ÎÞÐëÔÚÍ˳öʱ²ðÈ¥Äã°²×°µÄ´¦Àí´úÂë,ϵͳ»á
ΪÄã×Ô¶¯Çå³ý¡£
PUSH OFFSET FINAL_HANDLER
CALL SetUnhandledExceptionFilter
¡¡
CALL ExitProcess
£»************************************
FINAL_HANDLER:
¡¡
;(eax=-1 reload context and continue)
MOV EAX,1
RET £»program entry point
¡¡
£»code covered by final handler
¡¡
£»code to provide a polite exit
¡¡
£»eax=1 stops display of closure box
£»eax=0 enables display of the box
Æä¶þ£ºÃ¿Ïß³ÌÒì³£´¦Àí
FSÖеÄÖµÊÇÒ»¸öÊ®ÁùλµÄÑ¡Ôñ×Ó£¬ËüÖ¸Ïò°üº¬Ïß³ÌÖØÒªÐÅÏ¢µÄÊý¾Ý½á¹¹TIB,Ïß³ÌÐÅÏ¢¿é¡£
ÆäµÄÊ×Ë«×Ö½ÚÖ¸ÏòÎÒÃdzÆΪERRµÄ½á¹¹£º
1st dword +0 pointer to next err structure
(ÏÂÒ»¸öerr½á¹¹µÄÖ¸Õë)
2nd dword +4 pointer to own exception handler
(µ±Ç°Ò»¼¶µÄÒì³£´¦Àíº¯ÊýµÄµØÖ·)
ËùÒÔÒì³£´¦ÀíÊdzÊÁ·×´µÄ£¬Èç¹ûÄã×Ô¼ºµÄ´¦Àíº¯Êý²¶×½²¢´¦ÀíÁËÕâ¸öÒì³££¬ÄÇôµ±ÄãµÄ³Ì
Ðò·¢ÉúÁËÒ쳣ʱ£¬²Ù×÷ϵͳ¾Í²»»áµ÷ÓÃËüȱʡµÄ´¦Àíº¯ÊýÁË£¬Ò²¾Í²»»á³öÏÖÒ»¸öÌÖÑáµÄÖ´
ÐÐÁË·Ç·¨²Ù×÷µÄºì²æ¡£
ÏÂÃæÊÇcihµÄÒì³£¶Î£º
MyVirusStart:
push ebp
lea eax, [esp-04h*2]
xor ebx, ebx
xchg eax, fs:[ebx] £»½»»»ÏÖÔÚµÄerr½á¹¹ºÍÇ°Ò»¸ö½á¹¹µÄµØÖ·
£» eax=Ç°Ò»¸ö½á¹¹µÄµØÖ·
£» fs:[0]=ÏÖÔÚµÄerr½á¹¹Ö¸Õ루ÔÚ¶ÑÕ»ÉÏ£©
call @0
@0:
pop ebx
lea ecx, StopToRunVirusCode-@0[ebx] £»ÄãµÄÒì³£´¦Àíº¯ÊýµÄÆ«ÒÆ
push ecx £»ÄãµÄÒì³£´¦Àíº¯ÊýµÄÆ«ÒÆѹջ
push eax £»Ç°Ò»¸öerr½á¹¹µÄµØַѹջ
£»¹¹Ôìerr½á¹¹£¬¼ÇÕâʱºòµÄesp(err½á¹¹Ö¸Õë)Ϊesp0
¡¡
StopToRunVirusCode:
@1 = StopToRunVirusCode
xor ebx, ebx £»·¢ÉúÒ쳣ʱϵͳÔÚÄãµÄÁ·Ç°ÓÖ¼ÓÁËÒ»¸öerr½á¹¹£¬
£»ËùÒÔÒªÏÈÕÒµ½ÔÀ´µÄ½á¹¹µØÖ·
mov eax, fs:[ebx] £» È¡ÏÖÔÚµÄerr½á¹¹µÄµØÖ·eax
mov esp, [eax] £» ȡϸö½á¹¹µØÖ·¼´eps0µ½esp
RestoreSE: £»Ã»Óз¢ÉúÒ쳣ʱ˳ÀûµÄ»Øµ½ÕâÀï,ÄãÕâʱµÄespΪ±¾esp0
pop dword ptr fs:[ebx] £»µ¯³öÔÀ´µÄÇ°Ò»¸ö½á¹¹µÄµØÖ·µ½fs:0
pop eax £»µ¯³öÄãµÄÒì³£´¦ÀíµØÖ·£¬Æ½Õ»¶øÒÑ
1.2.7²¡¶¾Òþ²Ø
ʵÏÖ½ø³Ì»òÄ£¿éÒþ²ØÓ¦¸ÃÊÇÒ»¸ö³É¹¦²¡¶¾Ëù±ØÐë¾ß±¸µÄÌØÕ÷¡£ÔÚWIN9XÏÂKernel32.dllÓÐÒ»
¸ö¿ÉÒÔʹ½ø³Ì´Ó½ø³Ì¹ÜÀíÆ÷½ø³ÌÁбíÖÐÏûʧµÄµ¼³öº¯ÊýRegisterServiceProcess £¬µ«Ëü²»
ÄÜʹ²¡¶¾ÌÓÀëһЩ½ø³Ìä¯ÀÀ¹¤¾ßµÄ¼àÊÓ¡£µ«µ±ÄãÖªµÀÕâЩ¹¤¾ßÊÇÈçºÎÀ´Ã¶¾Ù½ø³Ìºó£¬ÄãÒ²
»áÕÒµ½¶Ô¸¶ÕâЩ¹¤¾ßÏàÓ¦µÄ°ì·¨¡£½ø³Ìä¯ÀÀ¹¤¾ßÔÚWIN9XÏ´ó¶¼Ê¹ÓÃÒ»¸ö½Ð×öToolHelp32.
dllµÄ¶¯Ì¬Á¬½Ó¿âÖеÄProcess32FirstºÍProcess32NextÁ½¸öº¯ÊýÀ´ÊµÏÖ½ø³Ìö¾ÙµÄ£»¶øÔÚ
WINNT/2000ÀïÒ²ÓÐPSAPI.DLLµ¼³öµÄEnumProcess¿ÉÓÃÒÔʵÏÖͬÑùÖ®¹¦ÄÜ¡£ËùÒÔ²¡¶¾¾Í¿ÉÒÔ
¿¼ÂÇÐÞ¸ÄÕâЩ¹«Óú¯ÊýµÄ²¿·Ö´úÂ룬ʹ֮²»ÄÜ·µ»ØÌض¨½ø³ÌµÄÐÅÏ¢´Ó¶øʵÏÖ²¡¶¾µÄÒþ²Ø¡£
µ«ÊÂÇéԶûÓÐÏëÏóÖÐÄÇô¼òµ¥£¬Ë×»°Ëµ¡°µÀ¸ßÒ»³ß£¬Ä§¸ßÒ»ÕÉ¡±£¬´ËÀí²»Ãý¡£ÓÉÓÚÏÖÔÚºÜ
¶àÄæÏ³ÌʦµÄŬÁ¦£¬Î¢ÈíÁ¦Í¼Òþ²ØµÄÐí¶àÃØÃÜÒѾÖð²½±»ÈËÃÇËùÍÚ¾ò³öÀ´¡£µ±È»ÆäÖоÍ
°üÀ¨WINDOWSÄÚºËʹÓõĹÜÀí½ø³ÌºÍÄ£¿éµÄÄÚ²¿Êý¾Ý½á¹¹ºÍ´úÂë¡£±ÈÈçWINNT/2000ÓÃÓÉnto
skrnl.exeµ¼³öµÄÄں˱äÁ¿PsInitialSystemProcessËùÖ¸ÏòµÄ½ø³ÌEprocess¿éË«ÏòÁ´±íÀ´Ãè
ÊöϵͳÖÐËùÓлµÄ½ø³Ì¡£Èç¹û½ø³Ìä¯ÀÀ¹¤¾ßÖ±½ÓÔÚÇý¶¯³ÌÐòµÄ°ïÖúÏ´ÓϵͳÄں˿ռäÖÐ
¶Á³öÕâЩÊý¾ÝÀ´Ã¶¾Ù½ø³Ì£¬ÄÇôÈκβ¡¶¾Ò²ÎÞ·¨´ÓÖÐÌÓÍÑ¡£
ÓйØEprocessµÄ¾ßÌå½á¹¹ºÍ¹¦ÄÜ£¬Çë²Î¿´David A.SolomonºÍMark E.RussinovichµÄ¡¶Ins
ide Windows2000¡·µÚÈý°æ¡£
1.2.8²¡¶¾ÌØÊâ¸ÐȾ·¨
¶Ô²¡¶¾ÉÔ΢ÓÐЩ³£Ê¶µÄÈ˶¼ÖªµÀ£¬ÆÕͨ²¡¶¾ÊÇͨ¹ý½«×ÔÉí¸½¼Óµ½ËÞÖ÷β²¿£¨Èç´ËÒ»À´£¬ËÞ
Ö÷µÄ´óС¾Í»áÔö¼Ó£©£¬²¢Ð޸ijÌÐòÈë¿ÚµãÀ´Ê¹²¡¶¾µÃµ½»÷»î¡£µ«ÏÖÔÚ²»ÉÙ²¡¶¾Í¨¹ýʹÓÃÌØ
ÊâµÄ¸ÐȾ¼¼ÇÉÄܹ»Ê¹ËÞÖ÷´óС¼°ËÞÖ÷ÎļþÍ·ÉϵÄÈë¿Úµã±£³Ö²»±ä¡£
¸½¼ÓÁ˲¡¶¾´úÂëȴʹ±»¸ÐȾÎļþ´óС²»±äÌýÆðÀ´ÈÃÈ˲»¿É˼Ò飬ÆäʵËüÊÇÀûÓÃÁËPEÎļþ¸ñ
ʽµÄÌص㣺PEÎļþµÄÿ¸ö½ÚÖ®¼äÁôÓа´´Ø´óС¶ÔÆëºóµÄ¿Õ¶´£¬²¡¶¾ÌåÈç¹û×㹻СÔò¿ÉÒÔ½«
×ÔÉí·Ö³É¼¸·Ý²¢·Ö±ð²åÈ뵽ÿ¸ö½Ú×îºóµÄ¿Õ϶ÖУ¬ÕâÑù¾Í²»±Ø¶îÍâÔö¼ÓÒ»¸ö½Ú£¬Òò¶øÎļþ
´óС±£³Ö²»±ä¡£ÖøÃûµÄCIH²¡¶¾ÕýÊÇÔËÓÃÕâÒ»¼¼ÊõµÄµäÐÍ·¶Àý£¨ËüµÄ´óСֻÓÐ1K×óÓÒ£©¡£
²¡¶¾ÔÚ²»ÐÞ¸ÄÎļþÍ·Èë¿ÚµãµÄÇ°ÌáÏÂÒªÏë»ñµÃ¿ØÖÆȨ²¢·ÇÒ×Ê£ºÈë¿Úµã²»±äÒâζ×ųÌÐòÊÇ
´ÓÔ³ÌÐòµÄÈë¿Ú´úÂë´¦¿ªÊ¼Ö´Ðеģ¬²¡¶¾±ØÐëÒª½«Ô³ÌÐò´úÂëÖеÄÒ»´¦ÐÞ¸ÄΪµ¼Ïò²¡¶¾Èë
¿ÚµÄÌøתָÁî¡£ÔÀí¾ÍÊÇÕâÑù£¬µ«ÆäÖл¹´æÔںܶà¿ÉÌÖÂ۵ĵط½£¬ÈçÔÚÔ³ÌÐò´úÂëµÄºÎ´¦
²åÈëÕâÌõÌøתָÁһЩ²é¶¾¹¤¾ßɨÃè¿ÉÖ´ÐÐÎļþÍ·²¿µÄÈë¿ÚµãÓò£¬Èç¹û·¢ÏÖËüÖ¸ÏòµÄµØ
·½²»Õý³££¬¼´²»ÔÚ´úÂë½Ú¶øÔÚ×ÊÔ´½Ú»òÖض¨Î»½ÚÖУ¬ÔòÓÐÀíÓÉ»³ÒÉÎļþ¸ÐȾÁËijÖÖ²¡¶¾¡£
ËùÒÔ¸Õ²ÅÌÖÂÛÄÇÖÖ²¡¶¾½ç³Æ֮ΪEPO£¨Èë¿ÚµãÄ£ºý£©µÄ¼¼Êõ¿ÉÒԺܺõĶԸ¶ÕâÑùµÄɨÃ裬ͬ
ʱËü»¹ÊÇ·´ÐéÄâÖ´ÐеÄÖØÒªÊֶΡ£
ÁíÍâÖµµÃÒ»ÌáµÄÊÇÏÖÔÚ²»ÉÙ²¡¶¾ÒѾ֧³Ö¶ÔѹËõÎļþµÄ¸ÐȾ¡£ÈçWin32.crypto²¡¶¾¾Í¿ÉÒÔ
¸ÐȾZIP£¬ARJ£¬RAR£¬ACE£¬CAB µÈÖî¶àÀàÐ͵ÄѹËõÎļþ¡£ÕâЩ²¡¶¾µÄ´úÂëÖк¬ÓжÔÌض¨Ñ¹
ËõÎļþÀàÐͽâѹ²¢Ñ¹ËõµÄ´úÂë¶Î£¬¿ÉÒÔÏÈ°ÑѹËõÎļþÖеÄÄÚÈݽâѹ³öÀ´£¬È»ºó¶ÔºÏÊʵÄÎÄ
¼þ½øÐиÐȾ£¬×îºóÔÙ½«¸ÐȾºóÎļþѹËõ»ØÈ¥²¢Í¬Ê±ÐÞ¸ÄѹËõÎļþÍ·²¿µÄУÑéºÍ¡£Ä¿Ç°²»ÉÙ
·´²¡¶¾Èí¼þ¶¼Ö§³Ö²é¶àÖÖ¸ñʽµÄѹËõÎļþ£¬µ«¶ÔÓÐЩȾ¶¾µÄѹËõÎļþÎÞ·¨É±³ý¡£ÔÒòÎÒÏë
¿ÉÄÜÊÇÅÂÓÉÓÚijÖÖÔµ¹Ê£¬Èç½âѹ»òѹËõÓÐÎó£¬Ð£ÑéºÍ¼ÆËã²»¶ÔµÈ£¬Ê¹µÃÇå³ýºóѹËõÎļþ¸ñ
ʽ±»ÆÆ»µ¡£²¡¶¾È´²»ÓöÔÓû§µÄÎļþË𻵸ºÔð£¬ËùÒÔ²»´æÔÚÕâÖÖµ£ÐÄ¡£
2£®ÐéÄâ»ú²é¶¾
2.1ÐéÄâ»ú¸ÅÂÛ
½üЩÄê,ÐéÄâ»ú£¬ÔÚ·´²¡¶¾½çÒ²±»³ÆΪͨÓýâÃÜÆ÷£¬ÒѾ³ÉΪ·´²¡¶¾Èí¼þÖÐ×îÒýÈËעĿµÄ²¿
·Ö£¬¾¡¹Ü·´²¡¶¾Õ߶ÔÓÚËüµÄÔËÓû¹Ô¶Ã»Óдﵽһ¸öÍêÃÀµÄ³Ì¶È£¬µ«ÐéÄâ»úÒÔÆäÖîÈç"²¡¶¾Ö¸
ÁîÂëÄ£ÄâÆ÷"ºÍ"Stryker"µÈ¶à±äµÄÃû³ÆΪ·´²¡¶¾²úÆ·µÄÊг¡ÏúÊÛ´øÀ´Á˹âÃ÷µÄÇ°¾°¡£ÒÔÏÂ
µÄÌÖÂÛ½«°ÑÎÒÃÇ´øÈëÒ»¸ö¾«²ÊµÄÐéÄâ¼¼ÊõµÄÊÀ½çÖС£
Ê×ÏÈҪ̸¼°µÄÊÇÐéÄâ»úµÄ¸ÅÄîºÍËüÓëÖîÈçVmware£¨ÃÀ¹úVMWARE¹«Ë¾Éú²úµÄÒ»¿îÐéÄâ»ú£¬Ëü
Ö§³ÖÔÚWINNT/2000»·¾³ÏÂÔËÐÐÈçLinuxµÈÆäËü²Ù×÷ϵͳ£©ºÍWIN9XϵÄVDM£¨DOSÐéÄâ»ú£¬Ëü
ÓÃÀ´ÔÚ32λ±£»¤Ä£Ê½»·¾³ÖÐÔËÐÐ16ʵģʽ´úÂ룩µÄÇø±ð¡£ÆäʵÕâЩÐéÄâ»úµÄÉè¼Æ˼ÏëÊÇÓÐ
Ô¨Ô´¿ÉÑ°µÄ£¬ÔçÔÚÉϸöÊÀ¼Í60Äê´úIBM¾Í¿ª·¢ÁËÒ»Ì×ÃûΪVM/370µÄ²Ù×÷ϵͳ¡£VM/370ÔÚ²»Í¬
µÄ³ÌÐòÖ®¼äÌṩÇÀÏÈʽ¶àÈÎÎñ£¬×÷·¨ÊÇÔÚµ¥Ò»Êµ¼ÊµÄÓ²¼þÉÏģʽ³ö¶à²¿ÐéÄâ»úÆ÷¡£µäÐ͵Ä
VM/370»á»°£¬Ê¹ÓÃÕß×øÔÚµçÀÂÁ¬½ÓµÄÔ¶³ÌÖÕ¶ËÇ°£¬¾ÓÉ¿ØÖƳÌÐòµÄÒ»¸öIPLÃüÁģÄâÕæʵ
»úÆ÷µÄ³õʼ»¯³ÌÐò×°ÔزÙ×÷£¬ÓÚÊÇ Ò»Ì×ÍêÕûµÄ²Ù×÷ϵͳ±»ÔØÈëÐéÄâ»úÆ÷ÖУ¬²¢¿ªÊ¼ÎªÊ¹ÓÃ
Õß×ÅÊÖ´´½¨Ò»¸ö»á»°¡£ÕâÌ×Ä£ÄâϵͳÊÇÈç´ËµÄÍ걸£¬ÏµÍ³³ÌÐòÔ±ÉõÖÁ¿ÉÒÔÔËÐÐËüµÄÒ»¸öÐé
Ä⸱±¾£¬À´¶Ôа汾½øÐгý´í¡£VmwareÓë´Ë·Ç³£ÏàËÆ£¬Ëü×÷ΪԲÙ×÷ϵͳϵÄÒ»¸öÓ¦ÓóÌ
Ðò¿ÉÒÔΪÔËÐÐÓÚÆäÉϵÄÄ¿±ê²Ù×÷ϵͳ´´½¨³öÒ»²¿ÐéÄâµÄ»úÆ÷£¬Ä¿±ê²Ù×÷ϵͳ¾ÍÏóÔËÐÐÔÚµ¥
¶Àһ̨ÕæÕý»úÆ÷ÉÏ£¬Ë¿ºÁ²ì¾õ²»µ½×Ô¼º´¦ÓÚVmwareµÄ¿ØÖÆ֮ϡ£µ±ÔÚVmwareÖа´ÏµçÔ´¼ü
£¨Power On£©Ê±£¬´°¿ÚÀï³öÏÖÁË»úÆ÷×Ô¼ì»Ã棬½Ó×ÅÊDzÙ×÷ϵͳµÄÔØÈ룬һÇж¼ºÍÕæµÄÒ»
Ñù¡£¶øWIN9XΪÁËÈöà¸ö³ÌÐò¹²ÏíCPUºÍÆäËüÓ²¼þ×ÊÔ´¾ö¶¨Ê¹ÓÃVMs£¨ËùÓÐWin32Ó¦ÓóÌÐòÔËÐÐÔÚÒ»²¿ÏµÍ³ÐéÄâ»úÉÏ£»¶øÿ¸ö16λDOS³ÌÐòÓµÓÐÒ»²¿DOSÐéÄâ»ú£©¡£
VMÊÇÒ»¸öÍêÈ«ÓÉÈí¼þÐé¹¹³öÀ´µÄ¶«Î÷£¬ÒÔºÍÕæʵµçÄÔÍêÈ«ÏàͬµÄ·½Ê½À´»ØÓ¦Ó¦ÓóÌÐòËùÌá
³öµÄÐèÇó¡£´ÓijÖֽǶÈÀ´¿´£¬Äã¿ÉÒÔ½«Ò»²¿±ê×¼µÄPCµÄ½á¹¹ÊÓΪһÌ×API¡£ÕâÌ×APIµÄÔªËØ
°üÀ¨Ó²¼þI/Oϵͳ£¬ºÍÒÔÖжÏΪ»ù´¡µÄBIOSºÍMS-DOS¡£WIN9X³£³£ÒÔËü×Ô¼ºµÄÈí¼þÀ´´úÀíÕâ
Щ´«Í³µÄAPIÔªËØ£¬ÒÔ±ãÄܹ»¶ÔÕä¹óµÄÓ²¼þ¶àÖØ·¢Ñ¶¡£ÔÚVMÉÏÔËÐеÄÓ¦ÓóÌÐòÈÏΪ×Ô¼º¶ÀÕ¼
Õû¸ö»úÆ÷£¬ËüÃÇÏàÐÅ×Ô¼ºÊÇ´ÓÕæÕýµÄ¼üÅ̺ÍÊó±ê»ñµÃÊäÈ룬²¢´ÓÕæÕýµÄÆÁÄ»ÉÏÊä³ö¡£ÉÔ±»
¼ÓÒ»µãÏÞÖÆ£¬ËüÃÇÉõÖÁ¿ÉÒÔÈÏΪ×Ô¼ºÍêÈ«ÓµÓÐCPUºÍÈ«²¿Äڴ档ʵÏÖÐéÄâ¼¼Êõ¹Ø¼üÔÚÓÚÈí¼þ
ÐéÄ⻯ºÍÓ²¼þÐéÄ⻯£¬ÏÂÃæ¼òÒª½éÉÜWIN9XϵÄDOSÐéÄâ»úµÄʵÏÖ¡£
µ±WindowsÒÆÍù±£»¤Ä£Ê½ºó£¬±£»¤Ä£Ê½³ÌÐòÎÞ·¨Ö±½Óµ÷ÓÃʵģʽµÄMS-DOS´¦ÀíÀý³Ì£¬Ò²²»ÄÜ
Ö±½Óµ÷ÓÃʵģʽµÄBIOS¡£Èí¼þÐéÄ⻯¾ÍÊÇÓÃÀ´ÃèÊö±£»¤Ä£Ê½Windows²¿¼þÊÇÈçºÎÄܹ»ºÍʵģ
ʽMS-DOSºÍBIOS±Ë´Ë»¥¶¯¡£Èí¼þÐéÄ⻯ҪÇó²Ù×÷ϵͳÄܹ»À¹½ØÆóͼ¿çÔ½±£»¤Ä£Ê½ºÍʵģʽ
±ß½çµÄµ÷Ó㬲¢ÇÒµ÷ÕûÊʵ±µÄ²ÎÊý¼Ä´æÆ÷ºó£¬¸Ä±äCPUģʽ¡£WIN9XʹÓÃÐéÄâÉ豸Çý¶¯£¨VX
D£©À¹½ØÀ´×Ô±£»¤Ä£Ê½µÄÖжϣ¬Í¨¹ýʵģʽÖжÏÏòÁ¿±í£¨IVT£©£¬½«Ö®×ª»»ÎªÊµÄ£Ê½Öжϵ÷
Óá£×öΪת»»µÄÒ»²¿·Ö£¬VXD±ØÐëʹÓÃÖÃÓÚ±£»¤Ä£Ê½À©Õ¹ÄÚ´æÖеIJÎÊý£¬Éú³É³öÊʵ±µÄ²ÎÊý
£¬²¢½«Ö®·ÅÔÚʵģʽ£¨V86£©²Ù×÷ϵͳ¿ÉÒÔ´æÈ¡µÄµØ·½¡£·þÎñ½áÊøºó£¬VXDÔڰѽá¹û½»¸øÀ©
Õ¹ÄÚ´æÖб£»¤Ä£Ê½µ÷Óöˡ£16λDOS³ÌÐòÖдóÁ¿µÄ21HºÍ13HÖжϵ÷Óþʹ˽â¾ö£¬µ«ÆäÖл¹´æ
ÔÚ²»ÉÙÖ±½Ó¶Ë¿ÚI/O²Ù×÷£¬Õâ¾ÍÐèÒªÒýÈëÓ²¼þÐéÄ⻯À´½â¾ö¡£ÐéÄâÓ²¼þµÄ³öÏÖÊÇΪÁËÔÚÓ²¼þ
ÖжÏÇëÇóÏßÉϲúÉúÖжÏÇëÇó£¬ÎªÁË»ØÓ¦INºÍOUTÖ¸Á¸Ä±äÌØÊâÄÚ´æÓ³ÉäλÖõÈÔÒò¡£Ó²¼þ
ÐéÄ⻯ÒÀÀµÓÚIntel 80386+µÄ¼¸¸öÌØÐÔ¡£ÆäÖÐÒ»¸öÊÇI/OÐí¿ÉÑÚÂ룬ʹ²Ù×÷ϵͳ¿ÉÄÜÓÕ²¶£¨
Trap£©¶ÔÈκÎÒ»¸ö¶Ë¿ÚµÄËùÓÐIN/OUTÖ¸Áî¡£ÁíÒ»¸öÌØÐÔÊÇ£ºÓÉÓ²¼þ¸¨ÖúµÄ·ÖÒ³»úÖÆ£¬Ê¹²Ù
×÷ϵͳÄܹ»ÌṩÐéÄâÄڴ棬²¢À¹½Ø¶ÔÄÚ´æµØÖ·µÄ´æÈ¡²Ù×÷£¬½«Video RAMÐéÄ⻯ÊǴ˺ܺõÄÀýÖ¤¡£×îºóÒ»¸ö±ØÒªµÄÌØÐÔÊÇCPUµÄÐéÄâ8086£¨V86£©Ä£Ê½ £¬ÈÃ
DOS³ÌÐòÏóÔÚʵģʽÖÐÄÇÑùµØÖ´ÐС£
ÎÒÃÇÏÂÃæÌÖÂÛÓÃÓڲ鶾µÄÐéÄâ»ú²¢²»ÊÇÏóijЩÈËÏëÏóµÄ£ºÈçVmwareÒ»ÑùΪ´ý²é¿ÉÖ´ÐгÌÐò
´´½¨Ò»¸öÐéÄâµÄÖ´Ðл·¾³£¬ÌṩËü¿ÉÄÜÓõ½µÄÒ»ÇÐÔªËØ£¬°üÀ¨Ó²ÅÌ£¬¶Ë¿ÚµÈ£¬ÈÃËüÔÚÆäÉÏ
×ÔÓÉ·¢»Ó£¬×îºó¸ù¾ÝÆäÐÐΪÀ´Åж¨ÊÇ·ñΪ²¡¶¾¡£µ±È»ÕâÊǸö²»´íµÄ¹¹Ï룬µ«¿¼Âǵ½ÆäÉè¼Æ
ÄѶȹý´ó£¨ÐèÄ£ÄâÔªËعý¶àÇÒÐÐΪ·ÖÎöÒª½èÖúÈ˹¤ÖÇÄÜÀíÂÛ£©£¬Òò¶øÖ»ÄÜ×÷ΪÒÔºó·¢Õ¹µÄ
·½Ïò¡£ÎÒÉè¼ÆµÄÐéÄâ»úÑϸñµÄ˵²»ÄܳÆ֮ΪÐéÄâ»úÆ÷£¬¶ø½Ð×öÐéÄâCPU£¬Í¨ÓýâÃÜÆ÷µÈ¸üΪ
ºÏÊÊһЩ£¬µ«ÓÉÓÚ·´²¡¶¾½çÏ°¹ß³Æ֮ΪÐéÄâ»ú£¬ËùÒÔÔÚÏÂÃæµÄÌÖÂÛÖÐÎÒ»¹½«ÑÓÐøÕâ¸öÃû³Æ
¡£²é¶¾µÄÐéÄâ»úÊÇÒ»¸öÈí¼þÄ£ÄâµÄCPU£¬Ëü¿ÉÒÔÏóÕæÕýCPUÒ»ÑùÈ¡Ö¸£¬ÒëÂ룬ִÐУ¬Ëü¿ÉÒÔ
Ä£ÄâÒ»¶Î´úÂëÔÚÕæÕýCPUÉÏÔËÐеõ½µÄ½á¹û¡£¸ø¶¨Ò»×é»úÆ÷ÂëÐòÁУ¬ÐéÄâ»ú»á×Ô¶¯´ÓÖÐÈ¡³ö
µÚÒ»ÌõÖ¸Áî²Ù×÷Â벿·Ö£¬ÅжϲÙ×÷ÂëÀàÐͺÍÑ°Ö··½Ê½ÒÔÈ·¶¨¸ÃÖ¸Á¶È£¬È»ºóÔÚÏàÓ¦µÄº¯
ÊýÖÐÖ´ÐиÃÖ¸Á²¢¸ù¾ÝÖ´ÐкóµÄ½á¹ûÈ·¶¨ÏÂÌõÖ¸ÁîµÄλÖã¬Èç´ËÑ»··´¸´Ö±µ½Ä³¸öÌض¨
Çé¿ö·¢ÉúÒÔ½áÊø¹¤×÷£¬Õâ¾ÍÊÇÐéÄâ»úµÄ»ù±¾¹¤×÷ÔÀíºÍ¼òµ¥Á÷³Ì¡£Éè¼ÆÐéÄâ»ú²é¶¾µÄÄ¿µÄ
ÊÇΪÁ˶Ը¶¼ÓÃܱäÐβ¡¶¾£¬ÐéÄâ»úÊ×ÏÈ´ÓÎļþÖÐÈ·¶¨²¢¶ÁÈ¡²¡¶¾Èë¿Ú´¦´úÂ룬ȻºóÒÔÉÏÊö
¹¤×÷²½Öè½âÊÍÖ´Ðв¡¶¾Í·²¿µÄ½âÃܶΣ¨decryptor£©£¬×îºóÔÚÖ´ÐÐÍêµÄ½á¹û£¨½âÃܺóµÄ²¡¶¾ÌåÃ÷ÎÄ£©ÖвéÕÒ²¡¶¾µÄÌØÕ÷Âë¡£ÕâÀïËùνµÄ¡°ÐéÄ⡱£¬²¢·ÇÊÇ´´½¨ÁË
ʲôÐéÄâ»·¾³£¬¶øÊÇָȾ¶¾Îļþ²¢Ã»ÓÐʵ¼ÊÖ´ÐУ¬Ö»²»¹ýÊÇÐéÄâ»úÄ£ÄâÁËÆäÕæʵִÐÐʱµÄ
Ч¹û¡£Õâ¾ÍÊÇÐéÄâ»ú²é¶¾»ù±¾ÔÀí£¬¾ßÌå½éÉÜÇë²Î¿´ºóÃæµÄÏà¹ØÕ½ڡ£
µ±È»£¬ÐéÄâÖ´Ðм¼ÊõʹÓ÷¶Î§Ô¶²»Ö¹×Ô¶¯ÍÑ¿Ç£¨ÐéÄâ»ú²é¶¾Êµ¼ÊÉÏÊÇ×Ô¶¯¸ú×Ù²¡¶¾Èë¿ÚµÄ
½âÃÜ×Ó½«¼ÓÃܵIJ¡¶¾Ìå°´Æä½âÃÜËã·¨½øÐнâÃÜ£©£¬Ëü»¹¿ÉÒÔÓ¦ÓÃÔÚ¿çƽ̨¸ß¼¶ÓïÑÔ½âÊÍÆ÷
£¬¶ñÒâ´úÂë·ÖÎö£¬µ÷ÊÔÆ÷¡£ÈçÁõÌÎÌÎÉè¼ÆµÄ¹ú²úµ÷ÊÔÆ÷Trdos¾ÍÊÇÍêÈ«ÀûÓÃÐéÄâ¼¼Êõ½âÊÍÖ´
Ðб»µ÷ÊÔ³ÌÐòµÄÿÌõÖ¸ÁÕâÖÖµ÷ÊÔÆ÷±È½ÏÆð´«Í³µÄ¶Ïµãʽµ÷ÊÔÆ÷£¨Debug,SofticeµÈ£©¾ß
ÓÐÖî¶àÓÅÊÆ£¬Èç²»Ò×±»±»µ÷ÊÔÕß²ì¾õ£¬¶Ïµã¸öÊýûÓÐÏÞÖƵȡ£
2.2¼ÓÃܱäÐβ¡¶¾
Ç°ÃæÌáµ½¹ýÉè¼ÆÐéÄâ»ú²é¶¾µÄÄ¿µÄÊÇΪÁ˶Ը¶¼ÓÃܱäÐβ¡¶¾¡£ÕâÒ»Õ¾ÍÖصã½éÉܼÓÃܱäÐÎ
¼¼Êõ¡£
ÔçÆÚ²¡¶¾Ã»ÓÐʹÓÃÈκθ´Ôӵķ´¼ì²â¼¼Êõ£¬Èç¹ûÄ÷´»ã±à¹¤¾ß´ò¿ª²¡¶¾Ìå´úÂë¿´µ½µÄ½«ÊÇ
ÕæÕýµÄ»úÆ÷Âë¡£Òò¶ø¿ÉÒÔÓɲ¡¶¾ÌåÄÚij´¦Ò»¶Î»úÆ÷´úÂëºÍ´Ë´¦¾àÀ벡¶¾Èë¿Ú£¨×¢Òâ²»ÊÇÎÄ
¼þÍ·£©Æ«ÒÆÖµÀ´Î¨Ò»È·¶¨Ò»ÖÖ²¡¶¾¡£²é¶¾Ê±Ö»Ðè¼òµ¥µÄÈ·¶¨²¡¶¾Èë¿Ú²¢ÔÚÖ¸¶¨Æ«ÒÆ´¦É¨Ãè
Ìض¨´úÂë´®¡£ÕâÖÖ¾²Ì¬É¨Ãè¼¼Êõ¶Ô¸¶ÆÕͨ²¡¶¾ÊÇÍòÎÞһʧµÄ¡£
Ëæ×Ų¡¶¾¼¼ÊõµÄ·¢Õ¹£¬³öÏÖÁËÒ»Àà¼ÓÃܲ¡¶¾¡£ÕâÀಡ¶¾µÄÌصãÊÇ£ºÆäÈë¿Ú´¦¾ßÓнâÃÜ×Ó£¨
decryptor£©£¬¶ø²¡¶¾Ö÷Ìå´úÂë±»¼ÓÁËÃÜ¡£ÔËÐÐʱÊ×Ïȵõ½¿ØÖÆȨµÄ½âÃÜ´úÂ뽫¶Ô²¡¶¾Ö÷Ìå
½øÐÐÑ»·½âÃÜ£¬Íê³Éºó½«¿ØÖƽ»¸ø²¡¶¾Ö÷ÌåÔËÐУ¬²¡¶¾Ö÷Ìå¸ÐȾÎļþʱ»á½«½âÃÜ×Ó£¬ÓÃËæ
»úÃÜÔ¿¼ÓÃܹýµÄ²¡¶¾Ö÷Ì壬ºÍ±£´æÔÚ²¡¶¾ÌåÄÚ»òǶÈë½âÃÜ×ÓÖеÄÃÜԿһͬдÈë±»¸ÐȾÎļþ
¡£ÓÉÓÚͬһÖÖ²¡¶¾µÄ²»Í¬´«È¾ÊµÀýµÄ²¡¶¾Ö÷ÌåÊÇÓò»Í¬µÄÃÜÔ¿½øÐмÓÃÜ£¬Òò¶ø²»¿ÉÄÜÔÚÆä
ÖÐÕÒµ½Î¨Ò»µÄÒ»¶Î´úÂë´®ºÍÆ«ÒÆÀ´´ú±í´Ë²¡¶¾µÄÌØÕ÷£¬Ëƺõ¾²Ì¬É¨Ãè¼¼Êõ¶Ô´Ë¼´½«Ê§Ð§¡£
µ«×ÐϸÏëÏ룬²»Í¬´«È¾ÊµÀýµÄ½âÃÜ×ÓÈÔ±£³Ö²»±ä»úÆ÷ÂëÃ÷ÎÄ£¨´ÓÀíÂÛÉϽ²ÈκμÓÃܳÌÐòÖÐ
¶¼´æÔÚδ¼ÓÃܵĻúÆ÷Â룬·ñÔò³ÌÐòÎÞ·¨Ö´ÐУ©£¬ËùÒÔ½«ÌØÕ÷ÂëÑ¡ÓÚ´Ë´¦ËäÈ»»áðһ¶¨µÄÎó
±¨·çÏÕ£¨½âÃÜ×ÓÖдúÂëȱÉÙ²¡¶¾ÌØÐÔ£¬Í¬ÑùµÄÌØÕ÷ÂëÒ²»á³öÏÖÔÚÕý³£³ÌÐòÖУ©£¬µ«ÈÔ²»Ê§
ΪһÖÖÓÐЧµÄ·½·¨¡£
ÓÉÓÚ¼ÓÃܲ¡¶¾»¹Ã»ÓÐÄܹ»ÍêÈ«ÌÓÍѾ²Ì¬ÌØÕ÷ÂëɨÃ裬ËùÒÔ²¡¶¾Ð´×÷ÕßÔÚ¼ÓÃܲ¡¶¾µÄ»ù´¡Ö®
ÉϽøÐиĽø£¬Ê¹½âÃÜ×ӵĴúÂë¶Ô²»Í¬´«È¾ÊµÀý³ÊÏÖ³ö¶àÑùÐÔ£¬Õâ¾Í³öÏÖÁ˼ÓÃܱäÐβ¡¶¾¡£
ËüºÍ¼ÓÃܲ¡¶¾·Ç³£ÀàËÆ£¬Î¨Ò»µÄ¸Ä½øÔÚÓÚ²¡¶¾Ö÷ÌåÔÚ¸ÐȾ²»Í¬Îļþ»á¹¹Ôì³öÒ»¸ö¹¦ÄÜÏàͬ
µ«´úÂ벻ͬµÄ½âÃÜ×Ó£¬Ò²¾ÍÊDz»Í¬´«È¾ÊµÀýµÄ½âÃÜ×Ó¾ßÓÐÏàͬµÄ½âÃܹ¦Äܵ«´úÂëÈ´½ØÈ»²»
ͬ¡£±ÈÈçÔ±¾Ò»ÌõÖ¸ÁîÍêÈ«¿ÉÒÔ²ð³É¼¸ÌõÀ´Íê³É£¬Öмä¿ÉÄܻᱻ²åÈëÎÞÓõÄÀ¬»ø´úÂë¡£Õâ
Ñù£¬ÓÉÓÚÎÞ·¨ÕÒµ½²»±äµÄÌØÕ÷Â룬¾²Ì¬É¨Ãè¼¼Êõ¾Í³¹µ×ʧЧÁË¡£ÏÂÃæÏȾÙÁ½¸öÀý×Ó˵Ã÷¼Ó
ÃܱäÐβ¡¶¾½âÃÜ×Ó¹¹Ô죬ȻºóÔÙÌÖÂÛÔõÑùÓÃÐéÄâÖ´Ðм¼Êõ¼ì²â¼ÓÃܱäÐβ¡¶¾¡£
ÖøÃû¶àÐβ¡¶¾MarburgµÄ±äÐνâÃÜ×Ó£º
00401020: movsx edi,si £»²¡¶¾Èë¿Ú
00401023: movsx edx,bp
00401026: jmp 00408a99
......
00407400: £»²¡¶¾ÌåÈë¿Ú
¼ÓÃܵIJ¡¶¾Ö÷Ìå
00408a94: £»½âÃÜÖ¸Õë³õʼֵ
......
00408a99: mov dl,f7
00408a9b: movsx edx,bx
00408a9e: mov ecx,cf4b9b4f
00408aa3: call 00408ac4
......
00408ac4: pop ebx
00408ac5: jmp 00408ade
......
00408ade: mov cx,di
00408ae1: add ebx,9fdbd22d
00408ae7: jmp 00408b08
......
00408b08: add ecx,80c1fbc1
00408b0e: mov ebp,7fcdeff3 £»Ñ»·½âÃܼÇÊýÆ÷³õÖµ
00408b13: sub cl,39
00408b16: movsx esi,si
00408b19: add dword ptr[ebx+60242dbf],9ef42073 £»½âÃÜÓï¾ä£¬9ef42073ÊÇÃÜÔ¿
00408b23: mov edx,6fd1d4cf
00408b28: mov di,dx
00408b2b: inc ebp
00408b2c: xor dl,a3
00408b2f: mov cx,si
00408b32: sub ebx,00000004 £»Òƶ¯½âÃÜÆ«ÒÆÖ¸Õ룬ÄæÏò½âÃÜ
00408b38: mov ecx,86425df9
00408b3d: cmp ebp,7fcdf599 £»ÅжϽâÃܽáÊøÓë·ñ
00408b43: jnz 00408b16
00408b49: jmp 00408b62
......
00408b62: mov di,bp
00408b65: jmp 00407400 £»½«¿ØÖÆȨ½»¸ø½âÃܺóµÄ²¡¶¾ÌåÈë¿Ú
ÖøÃû¶àÐβ¡¶¾HpsµÄ±äÐνâÃÜ×Ó£º
005365b8: £»½âÃÜÖ¸Õë³õʼֵºÍ²¡¶¾ÌåÈë¿Ú
¼ÓÃܵIJ¡¶¾Ö÷Ìå
......
005379cd: call 005379e2
......
005379e2: pop ebx
005379e3: sub ebx,0000141a £»ÉèÖýâÃÜÖ¸Õë³õÖµ
005379e9: ret
......
005379f0: dec edx £»¼õÉÙÑ»·¼ÇÊýÖµ
005379f1: ret
......
00537a00: xor dword ptr[ebx],10e7ed59 £»½âÃÜÓï¾ä£¬10e7ed59ÊÇÃÜÔ¿
00537a06: ret
......
00537a1a: sub ebx,ffffffff
00537a20: sub ebx,fffffffd £»Òƶ¯½âÃÜÖ¸Õ룬ÕýÏò½âÃÜ
00537a26: ret
......
00537a30: mov edx,74d9cb97 £»ÉèÖÃÑ»·¼ÇÊý³õÖµ
00537a35: ret
......
00537a3f: call 005379cd £»²¡¶¾Èë¿Ú
00537a44: call 00537a30
00537a49: call 00537a00
00537a4e: call 00537a1a
00537a53: call 005379f0
00537a58: mov esi,edx
00537a5a: cmp esi,74d9c696 £»ÅжϽâÃܽáÊøÓë·ñ
00537a60: jnz 00537a49
00537a66: jmp 005365b8 £»½«¿ØÖÆȨ½»¸ø½âÃܺóµÄ²¡¶¾ÌåÈë¿Ú
ÒÔÉϵĴúÂë¿´ÉÏÈ¥¾ø¶Ô²»»áÊÇÓñàÒëÆ÷±àÒë³öÀ´£¬»òÊDZà³ÌÕßÊÖ¹¤Ð´³öÀ´µÄ£¬ÒòΪÆäÖÐ
³ä³âÁË´óÁ¿µÄÂÒÊýºÍÀ¬»ø¡£´úÂëÖÐûÓÐ×¢ÊͲ¿·Ö¾ù¿ÉÈÏΪÊÇÀ¬»ø´úÂ룬ÓÐÓò¿·ÖÍê³ÉµÄ¹¦
ÄܽöÊÇÑ»·Ïò¼ÓÃܹýµÄ²¡¶¾ÌåµÄÿ¸öË«×Ö¼ÓÉÏ»òÒì»òÒ»¸ö¹Ì¶¨Öµ¡£ÕâÖ»ÊDZäÐβ¡¶¾´«È¾Êµ
ÀýµÄÆäÖÐÒ»¸ö£¬±ðµÄʵÀýµÄ½âÃÜ×ӺͲ¡¶¾Ì彫²»»áÈç´Ë£¬¼«¶È±äÐÎÒÔÖÁÈÃÈËÎÞ·¨±çʶ¡£ÖÁ
ÓÚ±äÐβ¡¶¾µÄʵÏÖ¼¼ÊõÓÉÓÚÉæ¼°¸´ÔÓµÄËã·¨ºÍ¿ØÖÆ£¬Òò´Ë²»ÔÚÎÒÃÇÌÖÂÛ·¶Î§ÄÚ¡£
ÕâÖÖ¼ÓÃܱäÐβ¡¶¾µÄ¼ì²âÓô«Í³µÄ¾²Ì¬ÌØÕ÷ÂëɨÃè¼¼ÊõÏÔÈ»ÒѾ²»ÐÐÁË¡£Îª´ËÎÒÃDzÉÈ¡µÄ
·½·¨ÊǶ¯Ì¬ÌØÕ÷ÂëɨÃè¼¼Êõ£¬Ëùν¡°¶¯Ì¬ÌØÕ÷ÂëɨÃ衱ָÏÈÔÚÐéÄâ»úµÄÅäºÏ϶Բ¡¶¾½øÐÐ
½âÃÜ£¬½Ó×ÅÔÚ½âÃܺ󲡶¾ÌåÃ÷ÎÄÖÐÑ°ÕÒÌØÕ÷Âë¡£ÎÒÃÇÖªµÀ½âÃܺ󲡶¾ÌåÃ÷ÎÄÊÇÎȶ¨²»±äµÄ
£¬Ö»ÒªÄܹ»µÃµ½½âÃܺóµÄ²¡¶¾Ìå¾Í¿ÉÒÔʹÓÃÌØÕ÷ÂëɨÃèÁË¡£ÒªµÃµ½²¡¶¾ÌåÃ÷ÎÄÊ×ÏȱØÐëÀû
ÓÃÐéÄâ»ú¶Ô²¡¶¾µÄ½âÃÜ×Ó½øÐнâÊÍÖ´ÐУ¬µ±¸ú×Ù²¢È·¶¨ÆäÑ»·½âÃÜÍê³É»ò´ïµ½¹æ¶¨´ÎÊýºó
£¬Õû¸ö²¡¶¾ÌåÃ÷ÎÄ»ò²¿·ÖÒѱ»±£´æµ½Ò»¸öÄÚ²¿»º³åÇøÖÐÁË¡£ÐéÄâ»úÖ®ËùÒÔÓÖ±»³ÆΪͨÓýâ
ÃÜÆ÷ÔÚÓÚËü²»ÓÃÊÂÏÈÖªµÀ²¡¶¾ÌåµÄ¼ÓÃÜËã·¨£¬¶øÊÇͨ¹ý¸ú×Ù²¡¶¾×ÔÉíµÄ½âÃܹý³ÌÀ´¶ÔÆä½ø
ÐнâÃÜ¡£ÖÁÓÚÐéÄâ»úÔõÑù½âÊÍÖ¸ÁîÖ´ÐУ¬ÔõÑùÈ·¶¨¿ÉÖ´ÐдúÂëÓÐÎÞÑ»·½âÃܶεÈϸ½Ú½«ÔÚ
ÏÂÒ»½ÚÖнéÉÜ¡£
2.3ÐéÄâ»úʵÏÖ¼¼ÊõÏê½â
ÓÐÁËÇ°Ãæ¹ØÓÚ¼ÓÃܱäÐβ¡¶¾µÄ½éÉÜ£¬ÏÖÔÚÎÒÃÇÖªµÀ¶¯Ì¬ÌØÕ÷ÂëɨÃè¼¼ÊõµÄ¹Ø¼ü¾ÍÔÚÓÚ±ØÐë
µÃµ½²¡¶¾Ìå½âÃܺóµÄÃ÷ÎÄ£¬¶øµÃµ½Ã÷ÎIJúÉúµÄʱ»ú¾ÍÊDz¡¶¾×ÔÉí½âÃÜ´úÂë½âÃܵÄÍê±Ï¡£Ä¿
Ç°ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ¸ú×Ù¿ØÖƲ¡¶¾µÄÿһ²½Ö´ÐУ¬²¢Äܹ»ÔÚ²¡¶¾Ñ»·½âÃܽáÊøºó´ÓÄÚ´æÖжÁ
³ö²¡¶¾ÌåÃ÷ÎÄ¡£Ò»ÖÖÊǵ¥²½ºÍ¶Ïµã¸ú×Ù·¨£¬ºÍĿǰһЩ³ÌÐòµ÷ÊÔÆ÷ÏàÀàËÆ£»ÁíÒ»ÖÖ·½·¨µ±
È»¾ÍÊÇÐéÄâÖ´Ðз¨¡£ÏÂÃæ·Ö±ð·ÖÎöµ¥²½ºÍ¶Ïµã¸ú×Ù·¨ºÍÐéÄâÖ´Ðз¨µÄ¼¼Êõϸ½Ú¡£
µ¥²½¸ú×ٺͶϵãÊÇʵÏÖ´«Í³µ÷ÊÔÆ÷µÄ×î¸ù±¾¼¼Êõ¡£µ¥²½µÄ¹¤×÷ÔÀíºÜ¼òµ¥£ºµ±CPUÔÚÖ´ÐÐÒ»
ÌõÖ¸Áî֮ǰ»áÏȼì²é±êÖ¾¼Ä´æÆ÷£¬Èç¹û·¢ÏÖÆäÖеÄÏÝÚå±êÖ¾±»ÉèÖÃÔò»áÔÚÖ¸ÁîÖ´ÐнáÊøºó
Òý·¢Ò»¸öµ¥²½ÏÝÚåINT1H¡£ÖÁÓڶϵãµÄÉèÖÃÓÐÈíÓ²Ö®·Ö£¬Èí¼þ¶ÏµãÊÇÖ¸µ÷ÊÔÆ÷ÓÃÒ»¸öͨ³£ÊÇ
µ¥×ֽڵĶϵãÖ¸ÁCC£¬¼´INT3H£©Ìæ»»µôÓû´¥·¢Ö¸ÁîµÄÊ××Ö½Ú£¬µ±³ÌÐòÖ´ÐÐÖÁ¶ÏµãÖ¸Áî´¦
£¬Ä¬Èϵĵ÷ÊÔÒì³£´¦Àí´úÂ뽫±»µ÷Ó㬴Ëʱ±£´æÔÚÕ»ÖеĶÎ/Æ«ÒƵØÖ·¾ÍÊǶϵãÖ¸ÁîºóÒ»×Ö
½ÚµÄµØÖ·£»¶øÓ²¼þ¶ÏµãµÄÉèÖÃÔòÀûÓÃÁË´¦ÀíÆ÷±¾ÉíµÄµ÷ÊÔÖ§³Ö£¬ÔÚµ÷ÊԼĴæÆ÷£¨DR0--DR4
£©ÖÐÉèÖô¥·¢Ö¸ÁîµÄÏßÐεØÖ·²¢ÉèÖõ÷ÊÔ¿ØÖƼĴæÆ÷£¨DR7£©ÖÐÏà¹ØµÄ¿ØÖÆ룬CPU»áÔÚÔ¤
ÉèÖ¸ÁîÖ´ÐÐʱ×Ô¶¯Òý·¢µ÷ÊÔÒì³£¡£¶øWindows±¾ÉíÓÖÌṩÁËÒ»Ì×µ÷ÊÔAPI£¬Ê¹µÃµ÷ÊÔ¸ú×ÙÒ»
¸ö³ÌÐò±äµÃ·Ç³£¼òµ¥£ºµ÷ÊÔÆ÷±¾Éí²»ÓýӹÒĬÈϵĵ÷ÊÔÒì³£´¦Àí´úÂ룬¶øÖ»Ðëµ÷ÓÃWaitFo
rDebugEventµÈ´ýϵͳ·¢À´µÄµ÷ÊÔʼþ£»µ÷ÊÔÆ÷¿ÉÀûÓÃGetThreadContext¹ÒÆð±»µ÷ÊÔÏ̻߳ñ
È¡ÆäÉÏÏÂÎÄ£¬²¢ÉèÖÃÉÏÏÂÎÄÖеıêÖ¾¼Ä´æÆ÷ÖеÄÏÝÚå±ê־룬×îºóͨ¹ýSetThreadContext
ʹÉèÖÃÉúЧÀ´½øÐе¥²½µ÷ÊÔ£»µ÷ÊÔÆ÷»¹¿Éͨ¹ýµ÷ÓÃÁ½¸ö¹¦ÄÜÇ¿´óµÄµ÷ÊÔAPI--ReadProcess
MemoryºÍWriteProcessMemoryÀ´Ïò±»µ÷ÊÔÏ̵߳ĵØÖ·¿Õ¼äÖÐ×¢Èë¶ÏµãÖ¸Áî¡£¸ù¾ÝÎÒÄæÏòºóµÄ·ÖÎö½á¹û£¬VC++µÄµ÷ÊÔÆ÷¾ÍÊÇÖ±½ÓÀûÓÃÕâÌ×µ÷ÊÔAPIд³ÉµÄ¡£Ê¹ÓÃ
ÒÔÉϵĵ÷ÊÔ¼¼Êõ¼ÈÈ»¿ÉÒÔд³öÏñVC++ÄÇÑù¹¦ÄÜÆëÈ«µÄµ÷ÊÔÆ÷£¬ÄÇôûÓÐÀíÓɲ»Äܽ«Ö®ÔËÓÃ
ÓÚ²¡¶¾´úÂëµÄ×Ô¶¯½âÃÜÉÏ¡£×î¼òµ¥µÄ×î·¨£º´´½¨´ý²é¿ÉÖ´ÐÐÎļþΪµ÷ÊÔÆ÷µÄµ÷ÊÔ×Ó½ø³Ì£¬
È»ºóÓÃÉÏÊö·½·¨¶ÔÆä½øÐе¥²½¸ú×Ù£¬Ã¿µ±ÊÕµ½¾ßÓÐEXCEPTION_SINGLE_STEPÒì³£´úÂëµÄʼþ
ʱ¾Í¿ÉÒÔ·ÖÎö¸ÃÌõÒÔµ¥²½Ä£Ê½Ö´ÐеÄÖ¸Á×îºóµ±Åжϲ¡¶¾µÄÕû¸ö½âÃܹý³Ì½áÊøºó¼´¿Éµ÷
ÓÃReadProcessMemory¶Á³ö²¡¶¾ÌåÃ÷ÎÄ¡£
Óõ¥²½ºÍ¶Ïµã¸ú×Ù·¨µÄΨһһµãºÃ´¦¾ÍÔÚÓÚËü²»Óô¦ÀíÿÌõÖ¸ÁîµÄÖ´ÐÐ--ÕâÒâζ×ÅËüÎÞÐè
±àд´óÁ¿µÄÌض¨Ö¸Áî´¦Àíº¯Êý£¬ÒòΪËùÓеĽâÃÜ´úÂ붼½»ÓÉCPUÈ¥Ö´ÐУ¬µ÷ÊÔÆ÷²»¹ýÊÇÔÚ´ú
Âë±»µ¥²½Öжϵļä϶µÃµ½¿ØÖÆȨ¶øÒÑ¡£µ«ÕâÖÖ·½·¨µÄȱµãÒ²ÊÇÏ൱Ã÷ÏԵģºÆäÒ»ÈÝÒ×±»²¡
¶¾¾õ²ìµ½£¬²¡¶¾Ö»Ðë½øÐмòµ¥µÄ¶ÑÕ»¼ì²é£¬»òÖ±½Óµ÷ÓÃIsDebugerPresent¾Í¿ÉÈ·¶¨×Ô¼ºÕý
´¦ÓÚ±»µ÷ÊÔ״̬£»Æä¶þÓÉÓÚûÓÐÏàÓ¦µÄ»úÆ÷Âë·ÖÎöÄ£¿é£¬Ö¸ÁîµÄÒëÂ룬ִÐÐÍêÈ«ÒÀÀµÓÚCP
U£¬ËùÒÔ½«µ¼ÖÂÎÞ·¨×¼È·µØ»ñÈ¡Ö¸ÁîÖ´ÐÐϸ½Ú²¢¶ÔÆä½øÐÐÓÐЧµÄ¿ØÖÆ¡££»ÆäÈýµ¥²½ºÍ¶Ïµã¸ú
×Ù·¨ÒªÇó´ý²é¿ÉÖ´ÐÐÎļþÕæʵִÐУ¬¼´Æ佫×öΪϵͳÖÐÒ»¸öÕæʵµÄ½ø³ÌÔÚ×Ô¼ºµÄµØÖ·¿Õ¼ä
ÖÐÔËÐУ¬Õ⵱ȻÊDz¡¶¾É¨ÃèËù²»ÄÜÔÊÐíµÄ¡£ºÜÏÔÈ»£¬µ¥²½ºÍ¶Ïµã¸ú×Ù·¨¿ÉÒÔÓ¦ÓÃÔÚµ÷ÊÔÆ÷
£¬×Ô¶¯Íѿǵȷ½Ã棬µ«¶ÔÓڲ鶾ȴÊDz»ºÏÊʵġ£
¶øʹÓÃÐéÄâÖ´Ðз¨µÄΨһһµãȱµã¾ÍÔÚÓÚËü±ØÐëÔÚÄÚ²¿´¦ÀíËùÓÐÖ¸ÁîµÄÖ´ÐÐ--ÕâÒâζ×ÅËü
ÐèÒª±àд´óÁ¿µÄÌض¨Ö¸Áî´¦Àíº¯ÊýÀ´Ä£ÄâÿÖÖÖ¸ÁîµÄÖ´ÐÐЧ¹û£¬ÕâÀï¸ù±¾²»´æÔÚºÎʱµÃµ½
¿ØÖÆȨµÄÎÊÌ⣬ÒòΪ¿ØÖÆȨ½«ÓÀÔ¶ÕÆÎÕÔÚÐéÄâ»úÊÖÖС£ÓÃÈí¼þ·½·¨Ä£ÄâCPU²¢·ÇÒ×Ê£¬ÐèÒª
¶ÔÆä»úÖÆÓÐ×ã¹»µÄÁ˽⣬·ñÔòÄ£ÄâЧ¹û½«ÓëÕæʵִÐÐÏàÈ¥ÉõÔ¶¡£¾ÙÁ½¸öÀý×Ó£ºÒ»¸öÊDz¡¶¾
³£Óõij˷¨ºóASCIIµ÷ÕûÖ¸ÁîAAM£¬ÕâÌõÖ¸ÁîÒòΪ´æÔÚδ¹«¿ªµÄÐÐΪ´Ó¶ø³£³£±»²¡¶¾ÓÃÀ´¿¼
ÑéÐéÄâ»úÉè¼ÆµÄÓÅÁÓ¡£Í¨³£Çé¿öÏÂAAMÊÇË«×Ö½ÚÖ¸Á²Ù×÷ÂëΪD4 0A£¨Æäʵ0AÒþº¬´ú±íÁË
²Ù×÷Êý10£©£»µ«Ò²¿É×÷Ϊµ¥×Ö½ÚÖ¸ÁîÃ÷È·µØÖ¸¶¨µÚ¶þ×Ö½Ú³ýÊýΪÈÎÒâ8λÁ¢¼´Êý£¬´Ëʱ²Ù×÷
Âë½öΪD4¡£ÐéÄâ»ú±ØÐ迼Âǵ½ºóÒ»ÖÖÖ¸¶¨³ýÊýµÄÇé¿öÀ´±£Ö¤Ä£Äâ½á¹ûµÄÕýÈ·ÐÔ£»»¹ÓÐÒ»¸ö
Àý×ÓÊǹØÓÚ´¦ÀíÆ÷ÏìÓ¦Öжϵķ½Ê½£¬¼´CPUÔÚ¸Õ´ò¿ªÖжϺ󽫲»»áÂíÉÏÏìÓ¦Öжϣ¬¶ø±ØÐë¸ô
Ò»¸öÖ¸ÁîÖÜÆÚ¡£Èç¹ûÐéÄâ»úûÓп¼Âǵ½¸Ã»úÖÆÔòºÜ¿ÉÄÜÐéÄâÖ´ÐÐÁ÷³Ì»áÓëÕæʵÇé¿ö²»·û¡£
µ«ÐéÄâÖ´ÐеÄÓŵãÒ²ÊǺÜÃ÷ÏԵģ¬Í¬Ê±ËüÕýºÃÌî²¹Á˵¥²½ºÍ¶Ïµã¸ú×Ù·¨ËùÁ¦²»Äܼ°µÄ·½Ãæ
£ºÊ×ÏÈÊDz»¿ÉÄܱ»²¡¶¾¾õ²ìµ½£¬ÒòΪÐéÄâ»ú½«ÔÚÆäÄÚ²¿»º³åÇøÖÐΪ±»ÐéÄâÖ´ÐдúÂëÉèÁ¢×¨
ÓõĶÑÕ»£¬ËùÒÔ¶ÑÕ»¼ì²é½á¹ûÓëʵ¼ÊÖ´ÐÐÎÞ¶þ£¨²»»áÏò¶ÑÕ»ÖÐѹÈëµ¥²½ºÍ¶ÏµãÖжÏʱµÄ·µ»ØµØÖ·£©£»Æä´ÎÓÉÓÚÐéÄâ»ú×ÔÉíÍê³ÉÖ¸ÁîµÄ½âÂëºÍµØÖ·µÄ¼ÆË㣬ËùÒÔ
Äܹ»»ñȡÿÌõÖ¸ÁîµÄÖ´ÐÐϸ½Ú²¢¼ÓÒÔ¿ØÖÆ£»×îºó£¬×îΪ¹Ø¼üµÄÒ»ÌõÔÚÓÚÐéÄâÖ´ÐÐȷʵ×öµ½
ÁË¡°ÐéÄ⡱ִÐУ¬ÏµÍ³Öв»»á²úÉú´ú±í±»Ö´ÐÐÕߵĽø³Ì£¬ÒòΪ±»Ö´ÐÐÕߵļĴæÆ÷×éºÍ¶ÑÕ»
µÈÖ´ÐÐÒªËؾùÔÚÐéÄâ»úÄÚ²¿ÊµÏÖ£¬Òò¶ø¿ÉÒÔÈÏΪËüÔÚÐéÄâ»úµØÖ·¿Õ¼äÖÐÖ´ÐС£¼øÓÚÐéÄâÖ´
Ðз¨Öî¶àµÄÓŵ㣬ËùÒÔ½«ÆäÔËÓÃÓÚͨÓò¡¶¾Ìå½âÃÜÉÏÊÇÔٺò»¹ýµÄÁË¡£
ͨ³££¬ÐéÄâ»úµÄÉè¼Æ·½°¸¿ÉÒÔ²ÉÈ¡ÒÔÏÂÈýÖÖÖ®Ò»£º×Ôº¬´úÂëÐéÄâ»ú£¨SCCE£©£¬»º³å´úÂëÐé
Äâ»ú£¨BCE£©£¬ÓÐÏÞ´úÂëÐéÄâ»ú£¨LCE£©¡£
×Ôº¬´úÂëÐéÄâ»ú¹¤×÷ÆðÀ´ÏóÒ»¸öÕæÕýµÄCPU¡£Ò»ÌõÖ¸ÁîÈ¡×ÔÄڴ棬ÓÉSCCE½âÂ룬²¢±»´«Ë͵½
ÏàÓ¦µÄÄ£ÄâÕâÌõÖ¸ÁîµÄÀý³Ì£¬ÏÂÒ»ÌõÖ¸ÁîÔò¼ÌÐøÕâ¸öÑ»·¡£ÐéÄâ»ú»á°üº¬Ò»¸öÀý³ÌÀ´¶ÔÄÚ
´æ/¼Ä´æÆ÷Ñ°Ö·²Ù×÷Êý½øÐнâÂ룬Ȼºó»¹»á°üÀ¨Ò»¸öÓÃÓÚÄ£Äâÿ¸ö¿ÉÄÜÔÚCPUÉÏÖ´ÐеÄÖ¸Áî
µÄÀý³Ì¼¯¡£ÕýÈçÄãËùÏëµ½µÄ£¬SCCEµÄ´úÂë»á±äµÄÎޱȵľ޴ó¶øÇÒËÙ¶ÈÒ²»áºÜÂý¡£È»¶øSCCE
¶ÔÓÚÒ»¸öÏȽøµÄ·´²¡¶¾Èí¼þÊǺÜÓÐÓõġ£ËùÓÐÖ¸ÁÔÚÄÚ²¿±»´¦Àí£¬ÐéÄâ»ú¿ÉÒÔ¶ÔÿÌõÖ¸
ÁîµÄ¶¯×÷×ö³ö·Ç³£ÏêϸµÄ±¨¸æ£¬ÕâЩ±¨¸æºÍÆô·¢Ê½Êý¾ÝÒÔ¼°Í¨ÓÃÇå³ýÄ£¿é½«Ï໥²ÎÕÕÐγÉ
Ò»¸öÓÐЧµÄ·´¶¾ÏµÍ³¡£Í¬Ê±£¬·´²¡¶¾³ÌÐòÄܹ»×ȷµØ¿ØÖÆÄÚ´æºÍ¶Ë¿ÚµÄ·ÃÎÊ£¬ÒòΪËü×Ô
¼º´¦ÀíµØÖ·µÄ½âÂëºÍ¼ÆËã¡£
»º³å´úÂëÐéÄâ»úÊÇSCCEµÄÒ»¸öËõÂÔ°æ,ÒòΪÏà¶ÔÓÚSCCEËü¾ßÓнÏСµÄ³ß´çºÍ¸ü¿ìµÄÖ´ÐÐËÙ¶È
¡£ÔÚBCEÖУ¬Ò»ÌõÖ¸ÁîÊÇ´ÓÄÚ´æÖÐÈ¡µÃµÄ£¬²¢ºÍÒ»¸öÌØÊâÖ¸Áî±íÏà±È½Ï¡£Èç¹û²»ÊÇÌØÊâÖ¸Áî
£¬ÔòËü±»½øÐмòµ¥µÄ½âÂëÒÔÇóµÃÖ¸ÁîµÄ³¤¶È£¬ËæºóËùÓÐÕâÑùµÄÖ¸Áî»á±»µ¼Èëµ½Ò»¸ö¿ÉÒÔͨ
ÓõØÄ£ÄâËùÓзÇÌØÊâÖ¸ÁîµÄС¹ý³ÌÖС£¶øÌØÊâÖ¸ÁֻռÕû¸öÖ¸ÁµÄһС²¿·Ö£¬ÔòÔÚÌØ
¶¨µÄС´¦Àí³ÌÐòÖнøÐÐÄ£Äâ¡£BCEͨ¹ý½«ËùÓзÇÌØÊâÖ¸ÁîÓÃÒ»¸öСµÄͨÓõĴ¦Àí³ÌÐòÄ£ÄâÀ´
¼õÉÙËü±ØÐëÌØÊâ´¦ÀíµÄÖ¸ÁîÌõÊý£¬ÕâÑùÒ»À´ËüÏ÷¼õÁË×ÔÉíµÄ´óС²¢Ìá¸ßÁËÖ´ÐÐËٶȡ£µ«Õâ
Òâζ×ÅËü½«²»ÄÜÕæÕýÏÞÖƶÔij¸öÄÚ´æÇøÓò£¬¶Ë¿Ú»òÆäËûÀàËƶ«Î÷µÄ·ÃÎÊ£¬Í¬Ê±ËüÒ²²»¿ÉÄÜ
Éú³ÉÈçSCCEÌṩµÄͬÑùÈ«ÃæµÄ±¨¸æ¡£
ÓÐÏÞ´úÂëÐéÄâ»úÓеãÏóÓÃÓÚͨÓýâÃܵÄÐéÄâϵͳËù´¦µÄ¼¶±ð¡£LCEʵ¼ÊÉϲ¢·ÇÒ»¸öÐéÄâ»ú£¬
ÒòΪËü²¢²»ÕæÕýµÄÄ£ÄâÖ¸ÁËüÖ»¼òµ¥µØ¸ú×ÙÒ»¶Î´úÂëµÄ¼Ä´æÆ÷ÄÚÈÝ£¬Ò²Ðí»áÌṩһ¸öС
µÄ±»¸Ä¶¯µÄÄÚ´æµØÖ·±í£¬»òÊǵ÷ÓùýµÄÖжÏÖ®ÀàµÄ¶«Î÷¡£Ñ¡ÔñʹÓÃLCE¶ø·Ç¸ü´ó¸ü¸´ÔÓµÄϵ
ͳµÄÔÒò£¬ÔÚÓÚ¼´Ê¹Ö»¶Ô¼«ÉÙÊýÖ¸ÁîµÄÖ§³Ö±ã¿ÉÒÔÔÚ½âÃÜÔʼ¼ÓÃܲ¡¶¾µÄ·ÉÏ×ߺÜÔ¶£¬Òò
Ϊ²¡¶¾½ö½öʹÓÃÁËINTELÖ¸ÁµÄһС²¿·ÖÀ´¼ÓÃÜÆäÖ÷Ì塣ʹÓÃLCE£¬Ô±¾´¦ÀíÕû¸öINTELÖ¸
ÁʱµÄ´óÁ¿»¨·ÑûÓÐÁË£¬´øÀ´µÄÊÇËٶȵľ޴óÔö³¤¡£µ±È»£¬ÕâÊÇÒÔ²»ÄÜ´¦Àí¸´ÔÓ½âÃܳÌ
Ðò¶ÎΪ´ú¼ÛµÄ¡£µ±ÐèÒª½øÐпìËÙÎļþɨÃèʱLCE¾Í±äµÄÓÐÓÃÆðÀ´£¬ÒòΪһ¸öСÐ͵«ÏóÑùµÄL
CE¿ÉÒÔÓÃÀ´¿ìËÙ¼ì²éÖ´ÐÐÎļþµÄ¿ÉÒÉÐÐΪ£¬·´Ö®¶Ôÿ¸öÎļþ¶¼Ê¹ÓÃSCCEËã·¨½«»áµ¼ÖÂÎÞ·¨
ÈÌÊܵĻºÂý¡£µ±È»£¬Èç¹ûÒ»¸öÎļþ¿´ÆðÀ´¿ÉÒÉ£¬LCE»¹¿ÉÒÔÆô¶¯Ä³¸öSCCE´úÂë¶ÔÎļþ½øÐÐÈ«
Ãæ¼ì²é¡£
ÏÂÃ濪ʼ½éÉÜ32λ×Ôº¬´úÂëÐéÄâ»úw32encode£¨w32encode.cpp£¬Tw32asm.h£¬Tw32asm.cpp
×öΪ²é¶¾ÒýÇæµÄÒ»²¿·ÖºÍÆäËüËÑË÷Çå³ýÄ£¿éÁª±àΪRsengine.dll£©µÄ³ÌÐò½á¹¹ºÍÁ÷³Ì¡£ÓÉ
ÓÚÕâÊÇÒ»¸öÉè¼ÆÍ걸ÇÒ¸´ÔӵĴóÐÍÉÌÓÃÐéÄâ»ú£¬ÆäÖв»¿É±ÜÃâµØ°üº¬Á˶ÔijЩÌض¨²¡¶¾µÄ
Ìض¨´¦Àí£¬ÎªÁËʹÐéÄâ»úÄ£Ð͵ĽṹÇåÎúÂöÂç·ÖÃ÷£¬·ÖÎöʱÎÒ½«×öÊʵ±µÄ¼ò»¯¡£
w32encodeµÄ¹¤×÷ÔÀíºÜ¼òµ¥£ºËüÊ×ÏÈÉèÖÃÄ£Äâ¼Ä´æÆ÷×飨ÓÃÒ»¸öDWORDÈ«¾Ö±äÁ¿Ä£ÄâÕæʵ
CPUÄÚ²¿µÄÒ»¸ö¼Ä´æÆ÷£¬ÈçENEAX£©µÄ³õʼֵ£¬³õʼ»¯Ö´ÐжÑÕ»Ö¸Õ루ÐéÄâ»úÓÃÄÚ²¿µÄÒ»¸ö
Êý×éstatic int STACK[0x20]À´Ä£Äâ¶ÑÕ»£©¡£È»ºó½øÈëÒ»¸öÑ»·£¬½âÊÍÖ´ÐÐÖ¸Á³åÇøPr
ogBufferÖеÄÍ·256ÌõÖ¸ÁÈç¹ûÑ»·Í˳öʱÈÔδ·¢ÏÖ²¡¶¾µÄ½âÃÜÑ»·Ôò¿ÉÓÉ´ËÅж¨·Ç¼ÓÃÜ
±äÐβ¡¶¾£¬Èô·¢ÏÖÁ˽âÃÜÑ»·Ôòµ÷ÓÃEncodeInstº¯ÊýÖظ´Ö´ÐÐÑ»·½âÃܹý³Ì£¬½«²¡¶¾ÌåÃ÷
ÎĽâÃܵ½DataSeg1»òDataSeg2ÖС£Ïà¹Ø²¿·Ö´úÂëÈçÏ£º
W32Encode0ÖÐ×ÜÌåÁ÷³Ì¿ØÖƲ¿·Ö´úÂ룺
for (i=0;i<0x100;i++) //Ê×ÏÈÐéÄâÖ´ÐÐ256ÌõÖ¸ÁîÊÔͼ·¢ÏÖ²¡¶¾Ñ»·½âÃÜ×Ó
{
if (InstLoc>=0x280)
return(0);
if (InstLoc+ProgSeekOff>=ProgEndOff)
return(0); //ÒÔÉÏÁ½ÌõÅжÏÓï¾ä¼ì²éÖ¸ÁîλÖõĺϷ¨ÐÔ
saveinstloc(); //´æ´¢µ±Ç°Ö¸ÁîÔÚÖ¸Á³åÇøÖеÄÆ«ÒÆ
HasAddNewInst=0;
if (!(j=parse())) //ÐéÄâÖ´ÐÐÖ¸Á³åÇøÖеÄÒ»ÌõÖ¸Áî
return(0); //Óöµ½²»ÈÏʶµÄÖ¸ÁîʱÍ˳öÑ»·
if (j==2) //·µ»ØֵΪ2˵Ã÷·¢ÏÖÁ˽âÃÜÑ»·
break;
}
if (i==0x100) //Ö´Ðйý256ÌõÖ¸ÁîºóÈÔδ·¢ÏÖÑ»·ÔòÍ˳ö
return(0);
PreParse=0;
ProcessInst();
if (!EncodeInst()) //µ÷ÓýâÃܺ¯ÊýÖظ´Ö´ÐÐÑ»·½âÃܹý³Ì
return(0);
jmpÖÐÅж¨Ñ»·³öÏÖ²¿·Ö´úÂ룺
if ((loc>=0)&&(loc<InstLoc)) //ÈôתÒƺóÖ¸ÁîÖ¸ÕëСÓÚµ±Ç°Ö¸ÁîÖ¸ÕëÔò¿ÉÄܳöÏÖÑ»·
if (!isinstloc(loc)) //ÔÚ±£´æµÄÖ¸ÁîÖ¸ÕëÊý×éInstLocArrayÖвéÕÒתÒƺóÖ¸
...... //ÁîÖ¸ÕëÖµ£¬Èç·¢ÏÖÔò¿ÉÅж¨Ñ»·³öÏÖ
else
{
......
return(2); //·µ»ØÖµ2´ú±í·¢ÏÖÁ˽âÃÜÑ»·
}
parseÖÐÐéÄâÖ´ÐÐÿÌõÖ¸ÁîµÄ¹ý³Ì½Ï¸´ÔÓһЩ£ºÍ¨³£parse»á´ÓÈ¡µÃÖ¸Á³åÇøProgBuff
erÖÐÈ¡µÃµ±Ç°Ö¸ÁîµÄÍ·Á½¸ö×Ö½Ú£¨°üÀ¨ÁËÈ«²¿²Ù×÷Â룩²¢¸ù¾ÝËüÃǵÄÖµµ÷ÓÃÏàÓ¦µÄÖ¸Áî´¦
Àíº¯Êý¡£ÀýÈçµ±µÚÒ»¸ö×Ö½ÚµÈÓÚ0F²¢ÇÒµÚ¶þ¸ö×Ö½ÚλÓëBEºóµÈÓÚBEʱ£¬¿ÉÅж¨´ËÖ¸ÁîΪmo
vszx²¢Í¬Ê±µ÷ÓÃmovszx½øÐд¦Àí¡£µ±Ö´ÐнøÈëÌض¨Ö¸ÁîµÄ´¦Àíº¯ÊýÖÐʱ£¬Ê×ÏÈҪͨ¹ýÅжÏ
Ñ°Ö··½Ê½£¨µ÷ÓÃmodregrm»òmodregrm1£©È·¶¨Ö¸Á¶È²¢½«¿ØÖÆȨ½»¸øsaveinstº¯Êý¡£sav
einstÔÚ±£´æ¸ÃÖ¸ÁîµÄÏà¹ØÐÅÏ¢ºó»áµ÷ÓÃÕæÕýÖ¸ÁîÖ´Ðк¯ÊýW32ExecuteInst¡£Õâ¸öº¯ÊýºÍp
arse·Ç³£ÏàËÆ£¬Ëü´ÓSaveInstBuf1ÖÐÈ¡µÃµ±Ç°Ö¸ÁîµÄÍ·Á½¸ö×Ö½Ú²¢¸ù¾ÝËüÃǵÄÖµµ÷ÓÃÏàÓ¦
µÄÖ¸ÁîÄ£Ä⺯ÊýÒÔÍê³ÉÒ»ÌõÖ¸ÁîµÄÖ´ÐС£Ïà¹Ø²¿·Ö´úÂëÈçÏ£º
W32ExecuteInstÖÐÖ¸Áî·ÖDz²¿·Ö´úÂ룺
if ((c&0xf0)==0x50)
{if (ExecutePushPop1(c)) //Ä£ÄâpushºÍpop
return(gotonext());
return(0);
}
if (c==0x9c)
{if (ExecutePushf()) //Ä£Äâpushf
return(gotonext());
return(0);
}
if (c==(char)0x9d)
{if (ExecutePopf()) //Ä£Äâpopf
return(gotonext());
return(0);
}
if ((c==0xf)&&((c2&0xbe)==0xbe))
{if (i=ExecuteMovszx(0)) //Ä£Äâmovszx
return(gotonext());
return(0);
}
2.4ÐéÄâ»ú´úÂëÆÊÎö
×ÜÌåÁ÷³Ì¿ØÖƺͷÖDz²¿·ÖµÄÏà¹Ø´úÂ룬ÔÚÉÏÒ»ÕÂÖж¼ÒÑ·ÖÎö¹ýÁË¡£ÏÂÃæ·ÖÎö¾ßÌåµÄÌض¨Ö¸
ÁîÄ£Ä⺯Êý£¬Õâ²ÅÊÇÐéÄâ»úµÄ¾«»ªÖ®ËùÔÚ¡£ÎÒ½«Ö¸Áî·Ö³É²»ÒÀÀµ±êÖ¾¼Ä´æÆ÷ºÍÒÀÀµ±êÖ¾¼Ä
´æÆ÷Á½´óÀà·Ö±ð½éÉÜ£º
2.4.1²»ÒÀÀµ±êÖ¾¼Ä´æÆ÷Ö¸ÁîÄ£Ä⺯ÊýµÄ·ÖÎö
pushºÍpopÖ¸ÁîµÄÄ£Ä⣺
static int ExecutePushPop1(int c)
{
if (c<=0x57)
{if (StackP<0) //Èëջǰ¼ì²é¶ÑÕ»»º³åÖ¸ÕëµÄºÏ·¨ÐÔ
return(0);
}
else
if (StackP>=0x40) //³öջǰ¼ì²é¶ÑÕ»»º³åÖ¸ÕëµÄºÏ·¨ÐÔ
return(0);
if (c<=0x57) {
StackP--;
ENESP-=4; //Èç¹ûÊÇÈëÕ»Ö¸ÁîÔòÔÚÈëջǰ¼õÉÙ¶ÑÕ»Ö¸Õë
}
switch (c)
{case 0x50:STACK[StackP]=ENEAX; //Ä£Äâpush eax
break;
......
case 0x5f:ENEDI=STACK[StackP]; //Ä£Äâpush edi
break;
}
if (c>=0x58) {
StackP++;
ENESP+=4; //Èç¹ûÊdzöÕ»Ö¸ÁîÔòÔÚ³öÕ»ºóÔö¼Ó¶ÑÕ»Ö¸Õë
}
return(1);
}
2.4.2ÒÀÀµ±êÖ¾¼Ä´æÆ÷Ö¸ÁîÄ£Ä⺯ÊýµÄ·ÖÎö
CW32AsmÀàÖÐcmpÖ¸ÁîµÄÄ£Ä⣺
void CW32Asm:: cmpw(int c1,int c2)
{
char FlgReg;
__asm {
mov eax,c1 //È¡µÃµÚÒ»¸ö²Ù×÷Êý
mov ecx,c2 //È¡µÃµÚ¶þ¸ö²Ù×÷Êý
cmp eax,ecx //±È½Ï
lahf //½«±È½ÏºóµÄ±êÖ¾½á¹û×°Èëah
mov FlgReg,ah //±£´æ½á¹ûÔÚ¾Ö²¿±äÁ¿FlgRegÖÐ
}
FlagReg=FlgReg; //±£´æ½á¹ûÔÚÈ«¾Ö±äÁ¿FlagRegÖÐ
}
CW32AsmÀàÖÐjnzÖ¸ÁîµÄÄ£Ä⣺
int CW32Asm::JNE()
{int i;
char FlgReg=FlagReg; //Óñ£´æµÄFlagReg³õʼ»¯¾Ö²¿±äÁ¿FlgReg
__asm
{
mov ah,FlgReg //ÉèÖÃahΪ±£´æµÄÄ£Äâ±êÖ¾¼Ä´æÆ÷Öµ
pushf //±£´æÐéÄâ»ú×ÔÉíµ±Ç°±êÖ¾¼Ä´æÆ÷
sahf //½«Ä£Äâ±êÖ¾¼Ä´æÆ÷Öµ×°ÈëÕæʵ±êÖ¾¼Ä´æÆ÷ÖÐ
mov eax,1
jne l //Ö´ÐÐjnz
popf //»Ö¸´ÐéÄâ»ú×ÔÉí±êÖ¾¼Ä´æÆ÷
xor eax,eax
l:
popf //»Ö¸´ÐéÄâ»ú×ÔÉí±êÖ¾¼Ä´æÆ÷
mov i,eax
}
return(i); //·µ»ØֵΪ1´ú±íÐèÒªÌøת
}
2.5·´ÐéÄâ»ú¼¼Êõ
ÈκÎÒ»¸öÊÂÎﶼ²»ÊǾ¡Éƾ¡ÃÀ£¬ÎÞи¿É»÷µÄ£¬ÐéÄâ»úÒ²²»ÀýÍâ¡£ÓÉÓÚ·´ÐéÄâÖ´Ðм¼ÊõµÄ³ö
ÏÖ£¬Ê¹µÃÐéÄâ»ú²é¶¾Êܵ½ÁËÒ»¶¨µÄÌôÕ½¡£ÕâÀï½éÉܼ¸¸ö±È½ÏµäÐ͵ķ´ÐéÄâÖ´Ðм¼Êõ£º
Ê×ÏÈÊDzåÈëÌØÊâÖ¸Áî¼¼Êõ£¬¼´ÔÚ²¡¶¾µÄ½âÃÜ´úÂ벿·ÖÈËΪ²åÈëÖîÈ縡µã£¬3DNOW£¬MMXµÈÌØ
ÊâÖ¸ÁîÒÔ´ïµ½·´ÐéÄâÖ´ÐеÄÄ¿µÄ¡£¾¡¹ÜÐéÄâ»úʹÓÃÈí¼þ¼¼ÊõÄ£ÄâÕæÕýCPUµÄ¹¤×÷¹ý³Ì£¬Ëü±Ï
¾¹²»ÊÇÕæÕýµÄCPU£¬ÓÉÓÚ¾«Á¦ÓÐÏÞ£¬ÐéÄâ»úµÄ±àÂëÕß¿ÉÄÜʵÏÖ¶ÔÕû¸öIntelÖ¸ÁµÄÖ§³Ö£¬
Òò¶øµ±ÐéÄâ»úÓöµ½Æä²»ÈÏʶµÄÖ¸Áîʱ½«»áÁ¢¿ÌÍ£Ö¹¹¤×÷¡£µ«Í¨¹ý¶ÔÕâÀಡ¶¾´úÂëµÄ·ÖÎöºÍ
ͳ¼Æ£¬ÎÒÃÇ·¢ÏÖͨ³£ÕâЩÌØÊâÖ¸Áî¶ÔÓÚ²¡¶¾µÄ½âÃܱ¾ÉíûÓз¢ÉúÈκÎÓ°Ï죬ËüÃǵIJåÈë½ö
½öÊÇΪÁ˸ÉÈÅÐéÄâ»úµÄ¹¤×÷£¬»»¾ä»°Ëµ¾ÍÊDz¡¶¾¸ù±¾²»»áÀûÓÃÕâÌõËæ»úµÄÀ¬»øÖ¸ÁîµÄÔËËã
½á¹û¡£ÕâÑùÒ»À´£¬ÎÒÃÇ¿ÉÒÔ½ö¹¹ÔìÒ»ÕÅËùÓÐÌØÊâÖ¸Áî¶ÔÓ¦ÓÚ²»Í¬Ñ°Ö··½Ê½µÄÖ¸Á¶È±í£¬
¶ø²»±ØΪÿ¸öÌØÊâÖ¸Áî±àдһ¸öרÓõÄÄ£Ä⺯Êý¡£ÓÐÁËÕâÕűíºó£¬µ±ÐéÄâ»úÓöµ½²»ÈÏʶµÄ
Ö¸Áîʱ¿ÉÒÔÓÃÖ¸ÁîµÄ²Ù×÷ÂëË÷Òý±í¸ñÒÔÇóµÃÖ¸ÁîµÄ³¤¶È£¬È»ºó½«µ±Ç°Ä£ÄâµÄÖ¸ÁîÖ¸Õ루EI
P£©¼ÓÉÏÖ¸Á¶ÈÀ´Ìø¹ýÕâÌõÀ¬»øÖ¸Áî¡£µ±È»£¬»¹ÓÐÒ»¸ö¸üΪ±£Ïյİ취ÄǾÍÊÇ£ºµÃµ½Ö¸Áî
³¤¶Èºó£¬¿ÉÒÔ½«ÕâÌõÎÒÃDz»ÈÏʶµÄÖ¸Áî·Åµ½Ò»¸ö³äÂú¿Õ²Ù×÷Ö¸ÁNOP£©µÄ»º³åÇøÖУ¬½Ó×Å
ÎÒÃǽ«Ìøµ½»º³åÇøÖÐÈ¥Ö´ÐУ¬ÕâµÈÓÚÈÃÕæÕýµÄCPU°ïÎÒÃÇÀ´Ö´ÐÐÕâÌõÖ¸Á×îºóÒ»²½µ±È»ÊÇ
½«Ö´ÐкóÕæʵ¼Ä´æÆ÷ÖеĽá¹û·Å»ØÎÒÃǵÄÄ£Äâ¼Ä´æÆ÷ÖС£ÕâÐéÄâÖ´ÐкÍÕæʵִÐвΰ뷽·¨µÄºÃ´¦ÔÚÓÚ£º¼´±ãÔÚÌØÊâÖ¸Áî¶ÔÓÚ²¡¶¾ÊÇÓÐÒâÒåµÄ£¬¼´²¡¶¾ÒÀÀµÆä·
µ»Ø½á¹ûµÄÇé¿öÏ£¬ÐéÄâ»úÈԿɱ£Ö¤ÐéÄâÖ´Ðнá¹ûµÄÕýÈ·¡£
Æä´ÎÊǽṹ»¯Òì³£´¦Àí¼¼Êõ£¬¼´²¡¶¾µÄ½âÃÜ´úÂëÊ×ÏÈÉèÖÃ×Ô¼ºµÄÒì³£´¦Àíº¯Êý£¬È»ºó¹ÊÒâ
Òý·¢Ò»¸öÒì³£¶øʹ³ÌÐòÁ÷³ÌתÏòÔ¤ÏÈÉèÁ¢µÄÒì³£´¦Àíº¯Êý¡£ÕâÖÖÁ÷³ÌתÒÆÊÇCPUºÍ²Ù×÷ϵͳ
Ï໥ÅäºÏµÄ½á¹û£¬²¢ÇÒÔںܴó³Ì¶ÈÉÏ£¬²Ù×÷ϵͳÔÚÆäÖÐÆðÁ˺ܴóµÄ×÷Óá£ÓÉÓÚÄ¿Ç°µÄÐéÄâ
»ú½ö½öÄ£ÄâÁËûÓб£»¤¼ì²éµÄCPUµÄ¹¤×÷¹ý³Ì£¬¶ø¶ÔÓÚϵͳ»úÖÆûÓнøÐд¦Àí¡£ËùÒÔÃæ¶ÔÒý
·¢Òì³£µÄÖ¸Áî»áÓÐÁ½ÖÖ½á¹û£ºÆäÒ»ÊÇijЩÉè¼ÆÓÐȱÏݵÄÐéÄâ»úÎÞ·¨Åжϱ»Ä£ÄâÖ¸ÁîµÄºÏ·¨
ÐÔ£¬ËùÒÔÄ£ÄâÕâÑùµÄÖ¸ÁʹÐéÄâ»ú×ÔÉíÖ´ÐзǷ¨²Ù×÷¶øÍ˳ö£»Æä¶þÐéÄâ»úÅжϳö±»Ä£Äâ
Ö¸ÁîÊôÓÚ·Ç·¨Ö¸ÁÈçÊÔͼÏòÖ»¶ÁÒ³ÃæдÈëµÄÖ¸ÁÔòÁ¢¿ÌÍ£Ö¹ÐéÄâÖ´ÐС£Í¨³£²¡¶¾Ê¹ÓÃ
¸Ã¼¼ÊõµÄÄ¿µÄÔÚÓÚ½«ÕæÕýÑ»·½âÃÜ´úÂë·Åµ½Òì³£´¦Àíº¯Êýºó£¬Èç´ËÐéÄâ»ú½«ÔÚ½øÈëÒì³£´¦
Àíº¯ÊýÇ°¾ÍÍ£Ö¹Á˹¤×÷£¬´Ó¶øʹ½âÃÜ×ÓÓлú»áÌÓ±ÜÐéÄâÖ´ÐС£Òò¶øÒ»¸öºÃµÄÐéÄâ»úÓ¦¸Ã¾ß
±¸·¢ÏֺͼǼ²¡¶¾°²×°Òì³£¹ýÂ˺¯ÊýµÄ²Ù×÷²¢ÔÚÆäÒý·¢Ò쳣ʱ×Ô¶¯½«¿ØÖÆתÏòÒì³£´¦Àíº¯
ÊýµÄÄÜÁ¦¡£
ÔÙ´ÎÊÇÈë¿ÚµãÄ£ºý£¨EPO£©¼¼Êõ£¬¼´²¡¶¾ÔÚ²»ÐÞ¸ÄËÞÖ÷ÔÈë¿ÚµãµÄÇ°ÌáÏ£¬Í¨¹ýÔÚËÞÖ÷´úÂë
ÌåÄÚij´¦²åÈëÌøתָÁîÀ´Ê¹²¡¶¾»ñµÃ¿ØÖÆȨ¡£Í¨¹ýÇ°ÃæµÄ·ÖÎö£¬ÎÒÃÇÖªµÀÐéÄâ»úɨÃ財¶¾
ʱ³öÓÚЧÂÊ¿¼ÂDz»¿ÉÄÜÐéÄâÖ´Ðдý²éÎļþµÄËùÓдúÂ룬ͨ³£µÄ×ö·¨ÊÇ£ºÉ¨Ãè´ý²éÎļþ´úÂë
Èë¿Ú£¬¼ÙÈçÔڹ涨²½ÊýÖÐûÓз¢ÏÖ½âÃÜÑ»·£¬ÔòÓÉ´ËÅж¨¸ÃÎļþûÓÐЯ´ø¼ÓÃܱäÐβ¡¶¾¡£
ÕâÖÖ¼¼ÊõÖ®ËùÒÔÄÜÆðµ½·´ÐéÄâÖ´ÐеÄ×÷ÓÃÔÚÓÚËüÕýºÃÀûÓÃÁËÐéÄâ»úµÄÕâ¸ö¼ÙÉ裺ÓÉÓÚ²¡¶¾
ÊÇ´ÓËÞÖ÷Ö´Ðе½Ò»°ëʱ»ñµÃ¿ØÖÆȨµÄ£¬ËùÒÔÐéÄâ»úÊ×ÏȽâÊÍÖ´ÐеÄÊÇËÞÖ÷Èë¿ÚµÄÕý³£³ÌÐò
£¬µ±È»Ôڹ涨²½ÊýÖв»¿ÉÄÜ·¢ÏÖ½âÃÜÑ»·£¬Òò¶ø²úÉúÁË©±¨¡£Èç¹ûÐéÄâ»úÄÜÔö¼Ó¹æ¶¨²½Êý
µÄ´óС£¬ÔòºÜÓпÉÄÜËæ×Ų¡¶¾²åÈëµÄÌøתָÁî¸ú×Ù½øÈ벡¶¾µÄ½âÃÜ×Ó£¬µ«È·¶¨¹æ¶¨²½Êý´ó
СʵÔÚÊǼþÄÑÊ£ºÌ«´óÔò½«ÎÞνÔö¼ÓÕý³£³ÌÐòµÄ¼ì²âʱ¼ä£»Ì«Ð¡ÔòÈÝÒײúÉú©±¨¡£µ«ÎÒÃÇ
¶Ô´ËÒ²²»±Ø¹ýÓÚµ£ÐÄ£¬ÕâÀಡ¶¾ÓÉÓÚÆä±àд¼¼ÊõÄѶȽϴóËùÒÔΪÊý²»¶à¡£ÔÚûÓз´»ã±àºÍ
ÐéÄâÖ´ÐÐÒýÇæµÄ°ïÖúÏ£¬²¡¶¾ºÜÄÑÔÚËÞÖ÷ÌåÄÚ¶¨Î»Ò»ÌõÍêÕûÖ¸ÁîµÄ¿ªÊ¼´¦À´²åÈëÌøת£¬Í¬
ʱºÜÄѱ£Ö¤²åÈëµÄÌøתָÁîµÄÉî¶È´óÓÚÐéÄâ»úµÄ¹æ¶¨²½Êý£¬²¢ÇÒûÓаÑÎÕ²åÈëµÄÌøתָÁî
Ò»¶¨»á±»Ö´Ðе½¡£
ÁíÍ⻹ÓжàÏ̼߳¼Êõ£¬¼´²¡¶¾ÔÚ½âÃܲ¿·ÖÈë¿ÚÖ÷Ïß³ÌÖÐÓÖÆô¶¯Á˶îÍâµÄ¹¤×÷Ị̈߳¬²¢ÇÒ½«
ÕæÕýµÄÑ»·½âÃÜ´úÂë·ÅÖÃÓÚ¹¤×÷Ïß³ÌÖÐÔËÐС£ÓÉÓÚ¶àÏ̼߳äÇл»µ÷¶ÈÓɲÙ×÷ϵͳ¸ºÔð¹ÜÀí
£¬ËùÒÔÎÒÃǵÄÐéÄâ»úÖ»ÄÜÔÚ¼Ù¶¨±»Ö´ÐÐÏ̶߳ÀÕ¼´¦ÀíÆ÷ʱ¼ä£¬¼´±£Ö¤ÓÀÔ¶²»±»ÇÀÏÈ£¬µÄÇ°
ÌáϽøÐС£Èç´ËÒ»À´£¬ÐéÄâ»ú¶ÔÓÚÄ£ÄâÆôÓöàÏ̹߳¤×÷µÄ´úÂ뽫ºÜÄÑ×öµ½ÓëÕæʵЧ¹ûÒ»ÖÂ
¡£¶àÏ̺߳ͽṹ»¯Òì³£´¦ÀíÁ½ÖÖ¼¼Êõ¶¼ÀûÓÃÁËÌض¨µÄ²Ù×÷ϵͳ»úÖÆÀ´´ïµ½·´ÐéÄâÖ´ÐеÄÄ¿
µÄ£¬ËùÒÔÔÚÐéÄâCPUÖмÓÈë¶ÔÌض¨²Ù×÷ϵͳ»úÖƵÄÖ§³Ö½«ÊÇÎÒÃǽñºó¸Ä½øµÄÄ¿±ê¡£
×îºóÊÇÔª¶àÐμ¼Êõ£¨MetaPolymorphy£©,¼´²¡¶¾Öв¢·ÇÊǶàÐεĽâÃÜ×Ó¼Ó¼ÓÃܵIJ¡¶¾Ìå½á¹¹
£¬¶øÕûÌå¾ù²ÉÓñäÐμ¼Êõ¡£ÕâÖÖ²¡¶¾ÕûÌ嶼Ôڱ䣬ûÓÐËùν¡°²¡¶¾ÌåÃ÷ÎÄ¡±¡£µ±È»£¬Æä±à
дÄѶÈÊǺܴóµÄ¡£Èç¹û˵ǰ¼¸ÖÖ·´ÐéÄâ»ú¼¼ÊõÊÇÀûÓÃÁËÐéÄâ»úÉè¼ÆÉϵÄȱÏÝ£¬¿ÉÒÔͨ¹ý´ú
Âë¸Ä½øÀ´ÃÖ²¹µÄ»°£¬ÄÇôÕâÖÖÔª¶àÐμ¼ÊõȴʹÐéÄâ»úÅäºÏµÄ¶¯Ì¬ÌØÕ÷ÂëɨÃè·¨³¹µ×ʧЧÁË
£¬ÎÒÃDZØÐëÑ°ÇóÈçÐÐΪ·ÖÎöµÈ¸üÏȽøµÄ·½·¨À´½â¾ö¡£
3£®²¡¶¾ÊµÊ±¼à¿Ø
3.1ʵʱ¼à¿Ø¸ÅÂÛ
ʵʱ¼à¿Ø¼¼ÊõÆäʵ²¢·Çʲôм¼Êõ£¬ÔçÔÚDOS±à³Ìʱ´ú¾ÍÓÐÖ®¡£Ö»²»¹ýÄÇʱÈËÃÇûÓиøÕâÏî
¼¼Êõ¹ÚÒÔÕâÑùרҵµÄÃû×Ö¶øÒÑ¡£ÔçÆÚÔÚ¸÷´óרԺУ»ú·¿ÖÐÆÕ±éʹÓõÄÓ²ÅÌд±£»¤Èí¼þÕýÊÇ
ÀûÓÃÁËʵʱ¼à¿Ø¼¼Êõ¡£Ó²ÅÌд±£»¤Èí¼þÒ»°ã»á½«×ÔÉíдÈëÓ²ÅÌÁã´ÅÍ·¿ªÊ¼µÄ¼¸¸öÉÈÇø£¨ÓÉ
0´ÅÍ·0ÖùÃæ1ÉÈ×ʼµÄ64¸öÉÈÇøÊDZ£ÁôµÄ£¬DOS·ÃÎʲ»µ½£©²¢ÐÞ¸ÄÔÀ´µÄÖ÷Òýµ¼¼Ç¼ÒÔʹ
Æô¶¯Ê±Ó²ÅÌд±£»¤³ÌÐò¿ÉÒÔÈ¡µÃ¿ØÖÆȨ¡£Òýµ¼Ê±È¡µÃ¿ØÖÆȨµÄÓ²ÅÌд±£»¤³ÌÐò»áÐÞ¸ÄINT1
3HµÄÖжÏÏòÁ¿Ö¸Ïò×ÔÉíÒÑפÁôÓÚÄÚ´æÖеĹ³×Ó´úÂëÒÔ±ãËæʱÀ¹½ØËùÓжԴÅÅ̵IJÙ×÷¡£¹³×Ó
´úÂëµÄ×÷Óõ±È»ÊǺÜÃ÷ÏԵģ¬ËüÖ÷Òª¸ºÔðÓÉÅжÏÖжÏÈë¿Ú²ÎÊý£¬°üÀ¨¹¦Äܺţ¬´ÅÅÌÄ¿±êµØ
Ö·µÈÀ´¾ö¶¨¸ÃÀàÐͲÙ×÷ÊÇ·ñ±»ÔÊÐí£¬ÕâÑù¾Í¿ÉÒÔʵÏÖ¶ÔijһÌض¨ÇøÓòµÄд²Ù×÷±£»¤¡£ºóÀ´
ÓÖµ®ÉúÁËÔÚ´Ë»ù´¡Ö®ÉϽøÐиĽøÁ˵ĴÅÅָ̻´¿¨Ö®ÀàµÄ²úÆ·£¬ÆäÀûÓý«Ð´²Ù×÷Öض¨ÏòÖÁÄ¿
±êÇøÓòÍâµÄÁÙʱ·ÖÇø²¢±£´æ´ÅÅÌÏÈǰ״̬µÈ¼¼ÊõÀ´ÊµÏÖÔÊÐíдÈë²¢¿ÉËæʱ»Ö¸´Ö®¹¦ÄÜ¡£²»
¹ÜÔõô¸Ä½ø£¬ÕâÀà²úÆ·µÄºËÐļ¼Êõ»¹ÊǶԴÅÅ̲Ù×÷µÄʵʱ¼à¿Ø¡£¶Ô´ËÓÐÐËȤµÄÅóÓѿɲο´
¸ßÔÆÇìÖø¡¶Ó²Å̱£»¤¼¼ÊõÊֲᡷ¡£DOSÏ»¹ÓÐÐí¶àͨ¹ýפÁô²¢½Ø»ñһЩÓÐÓõÄÖжÏÀ´ÊµÏÖij
ÖÖÌض¨Ä¿µÄµÄ³ÌÐò£¬ÎÒÃÇͨ³£³Æ֮ΪTSR£¨ÖÕÖ¹²¢µÈ´ýפÁôterminate-and-stay-resident£¬´ËÖÖ³ÌÐò²»ÈÝÒ×±àºÃ£¬ÐèÒª´óÁ¿µÄ¹ØÓÚÓ²¼þºÍDosÖжϵÄ֪ʶ£¬»¹Òª
½â¾öDosÖØÈ룬tsr³ÌÐòÖØÈëµÈÎÊÌ⣬¸ã²»ºÃ¾Í»áµ±»ú£©¡£ÔÚWINDOWSÏÂҪʵÏÖʵʱ¼à¿Ø¾ö·Ç
Ò×Ê£¬ÆÕͨÓû§Ì¬³ÌÐòÊDz»¿ÉÄܼà¿ØϵͳµÄ»î¶¯µÄ£¬ÕâÒ²ÊdzöÓÚϵͳ°²È«µÄ¿¼ÂÇ¡£HPS²¡¶¾
ÄÜÔÚÓû§Ì¬ÏÂÖ±½Ó¼à¿ØϵͳÖеÄÎļþ²Ù×÷ÆäʵÊÇÓÉÓÚWIN9XÔÚÉè¼ÆÉÏ´æÔÚ©¶´¡£¶øÎÒÃÇÏÂÃæ
ÒªÌÖÂÛµÄÁ½¸ö²¡¶¾ÊµÊ±¼à¿Ø£¨For WIN9X&WINNT/2000£©¶¼Ê¹ÓÃÁËÇý¶¯±à³Ì¼¼Êõ£¬Èù¤×÷ÓÚ
ϵͳºËÐÄ̬µÄÇý¶¯³ÌÐòÈ¥À¹½ØËùÓеÄÎļþ·ÃÎÊ¡£µ±È»ÓÉÓÚ¹¤×÷ϵͳµÄ²»Í¬£¬ÕâÁ½¸öÇý¶¯³Ì
ÐòÎÞÂ۴ӽṹ»¹Êǹ¤×÷ÔÀí¶¼²»¾¡ÏàͬµÄ£¬µ±È»³ÌÐòд·¨ºÍ±àÒë»·¾³¸üÊÇǧ²îÍò±ðÁË£¬Ëù
ÒÔÎÒÃǾö¶¨½«Æä¸÷×ԷֳɶÀÁ¢µÄÒ»½ÚÀ´ÏêϸµØ¼ÓÒÔÌÖÂÛ¡£ÉÏÃæÌáµ½µÄ²¡¶¾ÊµÊ±¼à¿ØÆäʵ¾Í
ÊǶÔÎļþµÄ¼à¿Ø£¬Ëµ³ÉÊÇÎļþ¼à¿ØÓ¦¸Ã¸üΪºÏÀíһЩ¡£³ýÁËÎļþ¼à¿ØÍ⣬»¹Óи÷ÖÖ¸÷ÑùµÄ
ʵʱ¼à¿Ø¹¤¾ß£¬ËüÃÇÒ²¶¼¾ßÓи÷×Ô²»Í¬µÄÌصãºÍ¹¦Óá£ÕâÀïÏò´ó¼ÒÍƼöÒ»¸ö¹ØÓÚWINDOWSϵ
ͳÄں˱à³ÌµÄÕ¾µã:www.sysinternals.com¡£ÔÚÆäÉÏ¿ÉÒÔÕÒµ½ºÜ¶àʵʱ¼à¿ØС¹¤¾ß£¬±ÈÈçÄÜ
¹»¼àÊÓ×¢²á±í·ÃÎʵÄRegmon£¨Í¨¹ýÐÞ¸Äϵͳµ÷ÓñíÖÐ×¢²á±íÏà¹Ø·þÎñÈë¿Ú£©£¬¿ÉÒÔʵʱµØ
¹Û²ìTCPºÍUDP»î¶¯µÄTdimon£¨Í¨¹ýhookϵͳÐÒéÇý¶¯Tcpip.sysÖеÄdispatchº¯ÊýÀ´½Ø»ñtdi clinetÏòÆä·¢Ë͵ÄÇëÇ󣩣¬ÕâЩ¹¤¾ß¶ÔÓÚÁ˽âϵͳÄÚ²¿ÔË×÷ϸ½Ú
ÊǺÜÓÐñÔÒæµÄ¡£½éÉÜÍêÓйصı³¾°Çé¿öºó£¬ÎÒÃÇÀ´¿´¿´¹ØÓÚ²¡¶¾ ʵʱ¼à¿ØµÄ¾ßÌåʵÏÖ¼¼Êõ
µÄÇé¿ö¡£
3.2²¡¶¾ÊµÊ±¼à¿ØʵÏÖ¼¼Êõ¸ÅÂÛ
ÕýÈçÉÏÃæÌáµ½µÄ²¡¶¾ÊµÊ±¼à¿ØÆäʵ¾ÍÊÇÒ»¸öÎļþ¼àÊÓÆ÷£¬Ëü»áÔÚÎļþ´ò¿ª£¬¹Ø±Õ£¬Çå³ý£¬
дÈëµÈ²Ù×÷ʱ¼ì²éÎļþÊÇ·ñÊDz¡¶¾Ð¯´øÕߣ¬Èç¹ûÊÇÔò¸ù¾ÝÓû§µÄ¾ö¶¨Ñ¡Ôñ²»Í¬µÄ´¦Àí·½°¸
£¬ÈçÇå³ý²¡¶¾£¬½ûÖ¹·ÃÎʸÃÎļþ£¬É¾³ý¸ÃÎļþ»ò¼òµ¥µØºöÂÔ¡£ÕâÑù¾Í¿ÉÒÔÓÐЧµØ±ÜÃⲡ¶¾
ÔÚ±¾µØ»úÆ÷ÉϵĸÐȾ´«²¥£¬ÒòΪ¿ÉÖ´ÐÐÎļþ×°ÈëÆ÷ÔÚ×°ÈëÒ»¸öÎļþÖ´ÐÐʱÊ×ÏÈ»áÒªÇó´ò¿ª
¸ÃÎļþ£¬¶øÕâ¸öÇëÇóÓÖÒ»¶¨»á±»ÊµÊ±¼à¿ØÔÚµÚһʱ¼ä½Ø»ñµ½£¬ËüÈ·±£ÁËÿ´ÎÖ´ÐеĶ¼ÊǸÉ
¾»µÄ²»´ø¶¾µÄÎļþ´Ó¶ø²»¸ø²¡¶¾ÒÔÈκÎÖ´Ðкͷ¢×÷µÄ»ú»á¡£ÒÔÉÏ˵µÄ½öÊDz¡¶¾ÊµÊ±¼à¿ØÒ»
¸ö´ÖÂԵŤ×÷¹ý³Ì£¬ÏêϸµÄ˵Ã÷½«Áôµ½ºóÃæÏàÓ¦µÄÕ½ÚÖС£²¡¶¾ÊµÊ±¼à¿ØµÄÉè¼ÆÖ÷Òª´æÔÚ
ÒÔϼ¸¸öÄѵ㣺
ÆäÒ»ÊÇÇý¶¯³ÌÐòµÄ±àд²»Í¬ÓÚÆÕͨÓû§Ì¬³ÌÐòµÄд×÷£¬ÆäÄѶȺܴó¡£Ð´Óû§Ì¬³ÌÐòʱÄãÐè
ÒªµÄ½ö½ö¾ÍÊǵ÷ÓÃһЩÊìÖªµÄAPIº¯ÊýÀ´Íê³ÉÌض¨µÄÄ¿µÄ£¬±ÈÈç´ò¿ªÎļþÄãÖ»Ðèµ÷ÓÃCreat
eFile¾Í¿ÉÒÔÁË£»µ«ÔÚÇý¶¯³ÌÐòÖÐÄ㽫ÎÞ·¨Ê¹ÓÃÊìϤµÄCreateFile¡£ÔÚNT/2000ÏÂÄã¿ÉÒÔʹ
ÓÃZwCreateFile»òNtCreateFile£¨native API£©£¬µ«ÕâЩº¯Êýͨ³£»áÒªÇóÔËÐÐÔÚij¸öIRQL
£¨ÖжÏÇëÇ󼶣©ÉÏ£¬Èç¹ûÄã¶ÔÈçÖжÏÇëÇ󼶣¬ÑÓ³Ù/Òì²½¹ý³Ìµ÷Ó㬷ǷÖÒ³/·ÖÒ³ÄÚ´æµÈ¸Å
Äî²»ÊÇÌرðÇå³þ£¬ÄÇôÄãдµÄÇý¶¯½«ºÜÈÝÒ×µ¼ÖÂÀ¶ÆÁËÀ»ú£¨BSOD£©£¬Ring0ϵÄÒì³£½«ÍùÍù
µ¼ÖÂϵͳ±ÀÀ££¬ÒòΪËü¶ÔÓÚϵͳ×ÜÊDZ»ÐÅÈεģ¬ËùÒÔûÓÐÏàÓ¦´¦Àí´úÂëÈ¥²¶»ñÕâ¸öÒì³£¡£
ÔÚNT϶ÔKeBugCheckExµÄµ÷Óý«µ¼ÖÂÀ¶ÆÁµÄ³öÏÖ£¬½Ó×Åϵͳ½«½øÐÐת´¢²¢ËæºóÖØÆô¡£ÁíÍâ
Çý¶¯³ÌÐòµÄµ÷ÊÔ²»ÈçÓû§Ì¬³ÌÐòÄÇÑù·½±ã£¬ÓÃÏóVC++ÄÇÑùµÄµ÷ÊÔÆ÷ÊDz»Ðеģ¬Äã±ØÐëʹÓÃ
ϵͳ¼¶µ÷ÊÔÆ÷£¬Èçsoftice,kd,trwµÈ¡£
Æä¶þÊÇÇý¶¯³ÌÐòÓëring3Ï¿ͻ§³ÌÐòµÄͨÐÅÎÊÌâ¡£Õâ¸öÎÊÌâµÄÌá³öÊǺÜ×ÔÈ»µÄ£¬ÊÔÏëµ±Çý¶¯
³ÌÐò½Ø»ñµ½Ä³¸öÎļþ´ò¿ªÇëÇóʱ£¬Ëü±ØÐë֪ͨλÓÚring3ϵIJ鶾ģ¿é¼ì²é±»´ò¿ªµÄÎļþ£¬
Ëæºó²é¶¾Ä£¿é»¹Ð轫²é¶¾µÄ½á¹ûͨ¹ýijÖÖ·½Ê½´«¸øring0ϵļà¿Ø³ÌÐò£¬×îºóÇý¶¯³ÌÐò¸ù¾Ý
·µ»ØµÄ½á¹û¾ö¶¨ÇëÇóÊÇ·ñ±»ÔÊÐí¡£ÕâÀïÃæÏÔÈ»´æÔÚÒ»¸öË«ÏòµÄͨÐŹý³Ì¡£Ð´¹ýÇý¶¯³ÌÐòµÄ
È˶¼ÖªµÀÒ»¸ö¿ÉÒÔÓÃÀ´ÏòÇý¶¯³ÌÐò·¢ËÍÉ豸I/O¿ØÖÆÐÅÏ¢µÄAPIµ÷ÓÃDeviceIoControl£¬ËüµÄ
½Ó¿ÚÔÚMSDNÖпÉÒÔÕÒµ½£¬µ«ËüÊǵ¥ÏòµÄ£¬¼´ring3Ï¿ͻ§³ÌÐò¿ÉÒÔͨ¹ýµ÷ÓÃDeviceIoContr
ol½«Ä³Ð©ÐÅÏ¢´«¸øring0ϵļà¿Ø³ÌÐòµ«·´¹ýÀ´²»ÐС£¼ÈÈ»ÎÞ·¨ÕÒµ½Ò»¸öÏֳɵĺ¯ÊýʵÏÖ´Ó
ring0ϵļà¿Ø³ÌÐòµ½ring3Ï¿ͻ§³ÌÐòµÄͨÐÅ£¬ÔòÎÒÃDZØÐë²ÉÓÃÓػصİ취À´¼ä½Ó×öµ½Õâ
Ò»µã¡£Îª´ËÎÒÃDZØÐëÒýÈëÒì²½¹ý³Ìµ÷Óã¨APC£©ºÍʼþ¶ÔÏóµÄ¸ÅÄËüÃǾÍÊÇʵÏÖÌØȨ¼¶¼ä
»½ÐѵĹؼüËùÔÚ¡£ÏÖÔÚÏȼòµ¥½éÉÜÒ»ÏÂÕâÁ½¸ö¸ÅÄ¾ßÌåµÄÓ÷¨Çë²Î¿´ºóÃæµÄÿ×ÓÕÂÖеÄ
¼¼ÊõʵÏÖϸ½Ú¡£Òì²½¹ý³Ìµ÷ÓÃÊÇÒ»ÖÖϵͳÓÃÀ´µ±Ìõ¼þºÏÊÊʱÔÚij¸öÌض¨Ï̵߳ÄÉÏÏÂÎÄÖÐÖ´
ÐÐÒ»¸ö¹ý³ÌµÄ»úÖÆ¡£µ±ÏòÒ»¸öÏ̵߳ÄAPC¶ÓÁÐÅŶÓÒ»¸öAPCʱ£¬ÏµÍ³½«·¢³öÒ»¸öÈí¼þÖжϣ¬
µ±ÏÂÒ»´ÎÏ̱߳»µ÷¶Èʱ£¬APCº¯Êý½«µÃÒÔÔËÐС£APC·Ö³ÉÁ½ÖÖ£ºÏµÍ³´´½¨µÄAPC³ÆΪÄÚºËģʽAPC£¬ÓÉÓ¦ÓóÌÐò´´½¨µÄAPC³ÆΪÓû§Ä£Ê½APC¡£ÁíÍâÖ»Óе±Ï̴߳¦
Óڿɱ¨¾¯£¨alertable£©×´Ì¬Ê±²ÅÄÜÔËÐÐÒ»¸öAPC¡£±ÈÈçµ÷ÓÃÒ»¸öÒ첽ģʽµÄReadFileExʱ
¿ÉÒÔÖ¸¶¨Ò»¸öÓû§×Ô¶¨ÒåµÄ»Øµ÷º¯ÊýFileIOCompletionRoutine£¬µ±Òì²½µÄI/O²Ù×÷Íê³É»ò
±»È¡Ïû²¢ÇÒÏ̴߳¦Óڿɱ¨¾¯×´Ì¬Ê±º¯Êý±»µ÷Óã¬Õâ¾ÍÊÇAPCµÄµäÐÍÓ÷¨¡£Kernel32.dllÖе¼
³öµÄQueueUserAPCº¯Êý¿ÉÒÔÏòÖ¸¶¨Ï̵߳ĶÓÁÐÖÐÔö¼ÓÒ»¸öAPC¶ÔÏó£¬ÒòΪÎÒÃÇдµÄÊÇÇý¶¯³Ì
Ðò£¬Õâ²¢²»ÊÇÎÒÃÇÒªµÄÄǸöº¯Êý¡£ºÜÐÒÔ˵ÄÊÇÔÚVwin32.vxdÖе¼³öÁËÒ»¸öͬÃûº¯ÊýQueueU
serAPC£¬¼à¿Ø³ÌÐòÀ¹½Øµ½Ò»¸öÎļþ´ò¿ªÇëÇóºó£¬ËüÂíÉϵ÷ÓÃÕâ¸ö·þÎñÅŶÓÒ»¸öring3Ï¿ͻ§
³ÌÐòÖÐÐèÒª±»»½Ðѵĺ¯ÊýµÄAPC£¬Õâ¸öº¯Êý½«ÔÚ²»¾Ã¿Í»§³ÌÐò±»µ÷¶Èʱ±»µ÷Óá£ÕâÖÖAPC»½
ÐÑ·¨ÊÊÓÃÓÚWIN9X£¬ÔÚWINNT/2000ÏÂÎÒÃǽ«Ê¹ÓÃÈ«¾Ö¹²ÏíµÄʼþºÍÐźÅÁ¿¶ÔÏóÀ´½â¾ö»¥Ï໽
ÐÑÎÊÌâ¡£ÓйØWINNT/2000ϵĶÔÏó×éÖ¯½á¹¹ÎÒ½«ÔÚ3.4.2½ÚÖÐÏêϸ˵Ã÷¡£NT/2000°æ¼à¿Ø³Ì
ÐòÖÐÎÒÃǽ«ÀûÓÃKeReleaseSemaphoreÀ´»½ÐÑÒ»¸öÔÚring3Ï¿ͻ§³ÌÐòÖеȴýµÄÏ̡߳£Ä¿Ç°²»
ÉÙ·´²¡¶¾Èí¼þÒѽ«Çý¶¯Ê¹ÓõIJ鶾ģ¿éÒƵ½ring0£¬¼´ÈçÆäËùÐû´«µÄ¡°Ö÷¶¯Óë²Ù×÷ϵͳÎÞ·ì
Á¬½Ó¡±£¬ÕâÑù×öÊ¡È´ÁËͨÐŵÄÏûºÄ£¬µ«°Ñ²é¶¾Ä£¿éд³ÉÇý¶¯ÐÎʽҲͬʱ»á´øÀ´Ò»Ð©Âé·³£¬Èç²»Äܵ÷ÓôóÁ¿ÊìÖªµÄAPI£¬²»ÄÜÓëÓû§ÊµÊ±½»»¥£¬ËùÒÔÎÒÃÇ»¹ÊÇ
Ñ¡ÔñÆÊÎö´«Í³µÄ·´²¡¶¾Èí¼þµÄ¼à¿Ø³ÌÐò¡£
ÆäÈýÊÇÇý¶¯³ÌÐòËùÕ¼ÓÃ×ÊÔ´ÎÊÌâ¡£Èç¹ûÓÉÓÚ¼à¿Ø³ÌÐòƵ·±µØÀ¹½ØÎļþ²Ù×÷¶øʹϵͳÐÔÄÜÏÂ
½µ¹ý¶à£¬ÔòÕâÑùµÄ³ÌÐòÊÇûÓÐÆä´æÔڵļÛÖµµÄ¡£±¾ÂÛÎĽ«¶ÔÒ»¸ö³É¹¦µÄ·´²¡¶¾Èí¼þµÄ¼à¿Ø
³ÌÐò×ö³¹µ×µÄÆÊÎö£¬ÆäÖоͰüº¬ÓзÖÎöÆäÓÃÒÔÌá¸ß×ÔÉíÐÔÄܵļ¼ÇɵIJ¿·Ö£¬ÈçÉèÖÃÀúÊ·¼Ç
¼£¬ÄÚÖÃÎļþÀàÐ͹ýÂË£¬ÉèÖõȴý³¬Ê±µÈ¡£
3.3WIN9XϵIJ¡¶¾ÊµÊ±¼à¿Ø
3.3.1ʵÏÖ¼¼ÊõÏê½â
WIN9Xϲ¡¶¾ÊµÊ±¼à¿ØµÄʵÏÖÖ÷ÒªÒÀÀµÓÚÐéÄâÉ豸Çý¶¯£¨VXD£©±à³Ì£¬¿É°²×°Îļþϵͳ¹³¹Ò
£¨IFSHook£©£¬VXDÓëring3Ï¿ͻ§³ÌÐòµÄͨÐÅ£¨APC/EVENT£©ÈýÏî¼¼Êõ¡£
ÎÒÃÇÔø¾Ìáµ½¹ýÖ»Óй¤×÷ÓÚϵͳºËÐÄ̬µÄÇý¶¯³ÌÐò²Å¾ßÓÐÓÐЧµØÍê³ÉÀ¹½Øϵͳ·¶Î§Îļþ²Ù
×÷µÄÄÜÁ¦£¬VXD¾ÍÊÇÊÊÓÃÓÚWIN9XϵÄÐéÄâÉ豸Çý¶¯³ÌÐò£¬ËùÒÔÕý¿Éµ±´ËÖØÈΡ£µ±È»£¬VXDµÄ
¹¦ÄÜÔ¶²»Ö¹ÓÉIFSMGR.vxdÌṩµÄÀ¹½ØÎļþ²Ù×÷ÕâÒ»ÏϵͳµÄVXDs¼¸ºõÌṩÁËËùÓеĵײã
²Ù×÷µÄ½Ó¿Ú--¿ÉÒÔ°ÑVXD¿´³Éring0ϵÄDLL¡£ÐéÄâ»ú¹ÜÀíÆ÷±¾Éí¾ÍÊÇÒ»¸öVXD£¬Ëüµ¼³öµÄµ×
²ã²Ù×÷½Ó¿ÚÒ»°ã³ÆΪVMM·þÎñ£¬¶øÆäËûVXDµÄµ÷ÓýӿÚÔò³ÆΪVXD·þÎñ¡£
¶þÕßring0µ÷Ó÷½·¨¾ùÏàͬ£¬¼´ÔÚINT20£¨CD 20£©ºóÃæ½ô¸ú×ÅÒ»¸ö·þÎñʶ±ðÂ룬VMM»áÀûÓÃ
·þÎñʶ±ðÂëµÄÇ°°ë²¿·ÖÉ豸±êʶ--Device IdÕÒµ½¶ÔÓ¦µÄVXD£¬È»ºóÔÙÀûÓ÷þÎñʶ±ðÂëµÄºó
°ë²¿·ÖÔÚVXDµÄ·þÎñ±í£¨Service Table£©Öж¨Î»·þÎñº¯ÊýµÄÖ¸Õë²¢µ÷ÓÃÖ®£º
CD 20 INT 20H
01 00 0D 00 DD VKD_Define_HotKey
ÕâÌõÖ¸ÁîµÚÒ»´ÎÖ´Ðкó£¬VMM½«ÒÔÒ»¸öͬÑù6×Ö½Ú¼ä½Óµ÷ÓÃÖ¸ÁîÌæ»»Ö®£¨²¢²»¶¼ÊÇÐÞÕýΪCA
LLÖ¸ÁÓÐʱ»áÀûÓÃJMPÖ¸Á£¬´Ó¶øÊ¡È´Á˲éѯ·þÎñ±íµÄ¹¤×÷£º
FF 15 XX XX XX XX CALL [$VKD_Define_HotKey]
±ØÐë×¢Ò⣬ÉÏÊöµ÷Ó÷½·¨Ö»ÊÊÓÃÓÚring0£¬¼´Ö»ÊÇÒ»¸ö´ÓVXDÖе÷ÓÃVXD/VMM·þÎñµÄring0½Ó
¿Ú¡£VXD»¹ÌṩÁËV86£¨ÐéÄâ8086ģʽ£©£¬Win16±£»¤Ä£Ê½£¬Win32±£»¤Ä£Ê½µ÷Óýӿڡ£ÆäÖÐ
V86ºÍWin16±£»¤Ä£Ê½µÄµ÷ÓýӿڱȽÏÆæ¹Ö£º
XOR DI DI
MOV ES,DI
MOV AX,1684 £»INT 2FH,AX = 1684H-->È¡µÃÉ豸Èë¿Ú
MOV BX,002A £»002AH = VWIN32.VXDµÄÉ豸±êʶ
INT 2F
MOV AX,ES £»ÏÖÔÚES:DIÖÐÓ¦¸Ã°üº¬×ÅÈë¿Ú
OR AX,AX
JE failure
MOV AH,00 £»VWIN32 ·þÎñ 0 = VWIN32_Get_Version
PUSH DS
MOV DS,WORD PTR CS:[0002]
MOV WORD PTR [lpfnVMIN32],DI
MOV WORD PTR [lpfnVMIN32+2],ES £»±£´æESºÍDI
CALL FAR [lpfnVMIN32] £»call gate£¨µ÷ÓÃÃÅ£©
ES:DIÖ¸ÏòÁË3B¶ÎµÄÒ»¸ö±£»¤Ä£Ê½»Øµ÷£º
003B£º000003D0 INT 30 £»#0028:C025DB52 VWIN32£¨04£©+0742
INT30Ç¿ÆÈCPU´Óring3ÌáÉýµ½ring0£¬È»ºóWIN95µÄINT30´¦Àíº¯ÊýÏȼì²éµ÷ÓÃÊÇ·ñ·¢×Ô3B¶Î
£¬ÈçÊÇÔòÀûÓÃÒý·¢»Øµ÷µÄCS:IPË÷ÒýÒ»¸ö±£»¤Ä£Ê½»Øµ÷±íÒÔÇóµÃÒ»¸öring0µØÖ·¡£±¾ÀýÖÐÊÇ
0028:C025DB52 £¬¼´ËùÐè·þÎñVWIN32_Get_VersionµÄÈë¿ÚµØÖ·¡£
VXDµÄWin32±£»¤Ä£Ê½µ÷ÓýӿÚÎÒÃÇÔÚÇ°ÃæÒѾÌáµ½¹ý¡£Ò»¸öÊÇDeviceIoControl£¬ÎÒÃǵÄr
ing3¿Í»§³ÌÐòÀûÓÃËüÀ´ºÍ¼à¿ØÇý¶¯½øÐе¥ÏòͨÐÅ£»ÁíÒ»¸öÊÇVxdCall£¬ËüÊÇKernel32.dllµÄ
Ò»¸öδ¹«¿ªµÄµ÷Ó㬱»ÏµÍ³Æµ·±Ê¹Ó㬶ÔÎÒÃÇÔòûÓжà´óÓô¦¡£
Äã¿ÉÒԲο´WIN95DDKµÄ°ïÖú£¬ÆäÖжÔÿ¸öϵͳVXDÌṩµÄµ÷ÓýӿھùÓÐÏêϸ˵Ã÷£¬¿É°´ÕÕÐè
ҪѡÔñÏàÓ¦µÄ·þÎñ¡£
¿É°²×°Îļþϵͳ¹³¹Ò£¨IFSHook£©¾ÍÔ´×ÔIFSMGR.VXDÌṩµÄÒ»¸ö·þÎñIFSMgr_InstallFileS
ystemApiHook£¬ÀûÓÃÕâ¸ö·þÎñÇý¶¯³ÌÐò¿ÉÒÔÏòϵͳע²áÒ»¸ö¹³×Óº¯Êý¡£ÒÔºóϵͳÖÐËùÓÐÎÄ
¼þ²Ù×÷¶¼»á¾¹ýÕâ¸ö¹³×ӵĹýÂË£¬WIN9XÏÂÎļþ¶Áд¾ßÌåÁ÷³ÌÈçÏ£º
ÔÚ¶Áд²Ù×÷½øÐÐʱ£¬Ê×ÏÈͨ¹ýδ¹«¿ªº¯ÊýEnterMustCompleteÀ´Ôö¼ÓMUSTCOMPLETECOUNT±ä
Á¿µÄ¼ÇÊý£¬¸æËß²Ù×÷ϵͳ±¾²Ù×÷±ØÐëÍê³É¡£¸Ãº¯ÊýÉèÖÃÁËKERNEL32Ä£¿éÀïµÄÄÚ²¿±äÁ¿À´ÏÔ
ʾÏÖÔÚÓиö¹Ø¼ü²Ù×÷ÕýÔÚ½øÐС£ÓоäÌâÍâ»°£¬ÔÚVMMÀïͬÑùÓиöº¯Êý£¬º¯ÊýÃûÒ²ÊÇEnterMu
stComplete¡£ÄǸöº¯ÊýͬÑù¸æËßVMM£¬Óиö¹Ø¼ü²Ù×÷ÕýÔÚ½øÐС£·ÀÖ¹Ï̱߳»É±µô»òÕß±»¹ÒÆð
¡£
½ÓÏÂÀ´£¬WIN9X½øÐÐÁËÒ»¸ö_MapHandleWithContext(ÓÖÊÇÒ»¸öδ¹«¿ªº¯Êý)²Ù×÷¡£¸Ã²Ù×÷±¾
ÉíµÄ¾ßÌåÒâÒåÉв»Çå³þ£¬µ«ÊÇÆä²Ù×÷È´Êǵõ½HANDLEËùÖ¸¶ÔÏóµÄÖ¸Õ룬²¢ÇÒÔö¼ÓÁËÒýÓüÆ
Êý¡£
Ëæºó£¬½øÐеÄÄËÊǸù±¾ÐԵIJÙ×÷£ºKERNEL32·¢³öÁËÒ»¸öµ÷ÓÃVWIN32_Int21DispatchµÄVxdC
all¡£ÏÝÈëVWIN32ºó£¬Æä ¼ì²éµ÷ÓÃÊÇ·ñÊǶÁд²Ù×÷¡£ÈôÊÇ£¬Ôò¸ù¾ÝÎļþ¾ä±úÇл»³ÉÒ»¸öFS
DÄÜʶ±ðµÄ¾ä±ú£¬²¢µ÷ÓÃIFSMgr_Ring0_FileIO¡£½ÓÏÂÀ´ÈÎÎñ¾Íתµ½ÁËIFS MANAGER¡£
IFS MANAGERÉú³ÉÒ»¸öIOREQ£¬²¢Ìøתµ½Ring0ReadWriteÄÚ²¿Àý³Ì¡£Ring0ReadWrite¼ì²é¾ä
±úÓÐЧÐÔ£¬²¢ÇÒ»ñÈ¡FSDÔÚ´´½¨Îļþ¾ä±úʱ·µ»ØµÄCONTEXT£¬Ò»Æð´«Èëµ½CallIoFuncÄÚ²¿Àý
³Ì¡£CallIoFunc¼ì²éIFSHOOKµÄ´æÔÚ£¬Èç¹û²»´æÔÚ£¬IFS MANAGERÉú³ÉÒ»¸öȱʡµÄIFS HOOK
£¬²¢ÇÒµ÷ÓÃÏàÓ¦µÄVFatReadFile/VFatWriteFileÀý³Ì(ÒòΪĿǰ MS±¾Éí½öÌṩÁËVFATÇý¶¯
)£»Èç¹ûIFSHOOK´æÔÚ£¬ÔòIFSHOOKº¯ÊýµÃµ½¿ØÖÆȨ£¬¶øIFS MANAGER±¾Éí¾ÍÍÑÀëÁËÎļþ¶Áд
´¦Àí¡£È»ºó£¬µ÷Óñ»²ã²ã·µ»Ø¡£KERNEL32µ÷ÓÃδ¹«¿ªº¯ÊýLeaveMustComplete£¬¼õÉÙMUSTC
OMPLETECOUNT¼ÆÊý£¬×îÖջص½µ÷ÓÃÕß¡£
Óɴ˿ɼûͨ¹ýIFSHookÀ¹½Ø±¾µØÎļþ²Ù×÷ÊÇÍòÎÞһʧµÄ£¬¶øͨ¹ýApiHook»òVxdCallÀ¹½ØÎļþ
Ôò¶àÓÐÒÅ©¡£ÖøÃûµÄCIH²¡¶¾ÕýÊÇÀûÓÃÁËÕâÒ»¼¼Êõ£¬ÊµÏÖÆäפÁô¸ÐȾµÄ£¬ÆäÖеĴúÂëƬ¶ÎÈç
주
lea eax, FileSystemApiHook-@6[edi] £»È¡µÃÓû°²×°µÄ¹³×Óº¯ÊýµÄµØÖ·
push eax
int 20h £»µ÷ÓÃIFSMgr_InstallFileSystemApiHook
IFSMgr_InstallFileSystemApiHook = $
dd 00400067h
mov dr0, eax £»±£´æÇ°Ò»¸ö¹³×ӵĵØÖ·
pop eax
ÕýÈçÎÒÃÇ¿´µ½µÄ£¬ÏµÍ³Öа²×°µÄËùÓй³×Óº¯Êý³ÊÁ´×´ÅÅÁС£×îºó°²×°µÄ¹³×Ó£¬×îÏȱ»
ϵͳµ÷Óá£ÎÒÃÇÔÚ°²×°¹³×ÓµÄͬʱ±ØÐ뽫µ÷Ó÷µ»ØµÄÇ°Ò»¸ö¹³×ӵĵØÖ·ÔÝ´æÒÔ±ãÔÚÍê³É´¦
ÀíºóÏòÏ´«µÝ¸ÃÇëÇó£º
mov eax, dr0 £»È¡µÃÇ°Ò»¸ö¹³×ӵĵØÖ·
jmp [eax] £» Ìøµ½ÄÇÀï¼ÌÐøÖ´ÐÐ
¶ÔÓÚ²¡¶¾ÊµÊ±¼à¿ØÀ´Ëµ£¬ÎÒÃÇÔÚ°²×°¹³×ÓʱͬÑùÐèÒª±£´æÇ°Ò»¸ö¹³×ӵĵØÖ·¡£Èç¹ûÎļþ²Ù
×÷µÄ¶ÔÏóЯ´øÁ˲¡¶¾£¬ÔòÎÒÃÇ¿ÉÒÔͨ¹ý²»µ÷ÓÃÇ°Ò»¸ö¹³×ÓÀ´¼òµ¥µÄÈ¡Ïû¸ÃÎļþÇëÇó£»·´Ö®
£¬ÎÒÃÇÔòÐ輰ʱÏòÏ´«µÝ¸ÃÇëÇó£¬ÈôÔÚ¹³×ÓÖÐÖÍÁôµÄʱ¼ä¹ý³¤--ÓÃÓڵȴýring3¼¶²é¶¾Ä£¿é
µÄ´¦Àí·´À¡--Ôò»áʹÓû§Ã÷ÏԸоõϵͳ±äÂý¡£
ÖÁÓÚ¹³×Óº¯ÊýÈë¿Ú²ÎÊý½á¹¹ºÍÔõÑù´Ó²ÎÊýÖÐÈ¡µÃ²Ù×÷ÀàÐÍ£¨ÈçIFSFN_OPEN£©ºÍÎļþÃû£¨ÒÔ
UNICODEÐÎʽ´æ´¢£©Çë²Î¿´ÏàÓ¦µÄ´úÂëÆÊÎö²¿·Ö¡£
ÎÒÃÇËùÐèµÄÁíÒ»Ïî¼¼Êõ--APC/EVENTÒ²ÊÇÔ´×ÔÒ»¸öVXDµ¼³öµÄ·þÎñ£¬Õâ±ãÊÇÖøÃûµÄVWIN32.v
xd¡£Õâ¸öÆæ¹ÖµÄVXDµ¼³öÁËÐí¶àÓëWIN32 API¶ÔÓ¦µÄ·þÎñ£ºÈç_VWIN32_QueueUserApc£¬_VWI
N32_WaitSingleObject£¬_VWIN32_ResetWin32Event£¬_VWIN32_Get_Thread_Context£¬_VW
IN32_Set_Thread_Context µÈ¡£Õâ¸öVXD½ÐÐéÄâWIN32£¬´ó¸ÅÃû³Æ¼´ÊÇÓɴ˶øÀ´µÄ¡£ËäÈ»·þ
ÎñµÄÃû³ÆÓëWIN32 APIÒ»Ñù£¬µ«µ÷ÓùæÔòÈ´´óÏྶͥ£¬Ç§Íò²»¿ÉÓÃ´í¡£_VWIN32_QueueUser
ApcÓÃÀ´×¢²áÒ»¸öÓû§Ì¬µÄAPC£¬ÕâÀïµÄAPCº¯Êýµ±È»ÊÇÖ¸ÎÒÃÇÔÚring3ÏÂÒԿɸ澯״̬˯Ãß
µÄ´ý²é¶¾Ï̡߳£ring3¿Í»§³ÌÐòÊ×ÏÈͨ¹ýIOCTL°Ñ´ý²é¶¾Ï̵߳ĵØÖ·´«¸øÇý¶¯³ÌÐò£¬È»ºóµ±
¹³×Óº¯ÊýÀ¹½Øµ½´ý²éÎļþʱµ÷Óô˷þÎñÅŶÓÒ»¸öAPC£¬µ±ring3¿Í»§³ÌÐòÏÂÒ»´Î±»µ÷¶Èʱ£¬
APCÀý³ÌµÃÒÔÖ´ÐС£_VWIN32_WaitSingleObjectÔòÓÃÀ´ÔÚij¸ö¶ÔÏóÉϵȴý£¬´Ó¶øʹµ±Ç°rin
g0Ïß³ÌÔÝʱ¹ÒÆð¡£ÎÒÃǵÄring3¿Í»§³ÌÐòÏȵ÷ÓÃWIN32 API--CreateEvent´´½¨Ò»×éʼþ¶ÔÏó
£¬È»ºóͨ¹ýÒ»¸öδ¹«¿ªµÄAPI--OpenVxdHandle½«Ê¼þ¾ä±úת»¯ÎªVXD¿É±çʶµÄ¾ä±ú£¨ÆäʵӦ
ÊÇÖ¸Ïò¶ÔÏóµÄÖ¸Õ룩²¢ÓÃIOCTL·¢¸øring0¶ËVXD£¬¹³×Óº¯ÊýÔÚÅŶÓAPCºóµ÷ÓÃ_VWIN32_Wait
SingleObjectÔÚʼþµÄVXD¾ä±úÉϵȴý²é¶¾µÄÍê³É£¬×îºóÓÉring3¿Í»§³ÌÐòÔڲ鶾Íê±Ïºóµ÷ÓÃWIN32 API--SetEventÀ´½â³ý¹³×Óº¯ÊýµÄµÈ´ý¡£
µ±È»£¬ÕâÀïÃæ´æÔÚ×ÅÒ»¸öºÜ¿ÉŵÄÎÊÌ⣺Èç¹ûÄã°´ÕÕµÄÎÒ˵µÄÄÇÑùÈ¥×ö£¬Äã»á·¢ÏÖËü»áÔÚ
Ò»¶Ëʱ¼äÄÚ¹¤×÷Õý³££¬µ«Ê±¼äÒ»³¤£¬ÏµÍ³¾Í±»¹ÒÆðÁË¡£¾ÍÁ¬Çý¶¯±à³Ì´óʦWalter OneyÔÚÆä
Öø×÷¡¶System Programming For Windows 95¡·µÄÅäÌ×Ô´ÂëµÄ˵Ã÷ÖÐÒ²³ÆÆäAPCÀý³ÌÔÚijЩ
ʱºò¹¤×÷»á²»Õý³£¡£¶ø΢ÈíµÄ¹¤³ÌʦÉù³ÆÎļþ²Ù×÷ÇëÇóÊDz»Äܱ»ÖжϵôµÄ£¬Äã²»ÄÜÔÚÇý¶¯
ÖÐ×è¶ÏÎļþ²Ù×÷²¢ÒÀÀµÓÚring3µÄ·´À¡À´×ö³öÏìÓ¦¡£ÍøÉϹØÓÚÕâ¸öÎÊÌâÒ²ÓÐһЩÌÖÂÛ£¬Òâ¼û
²»Ò»£ºÓÐÈËÈÏΪµ±ÏµÍ³DLL--KERNEL32ÔÚÆäµ÷ÓÃring0´¦ÀíÎļþÇëÇóʱӵÓÐÒ»¸ö»¥³âÁ¿£¨MU
TEX£©£¬¶øÔÚijЩÇé¿öÏÂΪÁË´¦ÀíAPCÒªÓµÓÐͬÑùµÄ»¥³âÁ¿£¬ËùÒÔËÀËø·¢ÉúÁË£»»¹ÓÐÈËÈÏΪ
¾¡¹ÜÔÚWIN9XÏÂ32λÏß³ÌÊÇÇÀÏȶàÈÎÎñµÄ£¬µ«Win16×ÓϵͳÊÇÒÔÐ×÷¶àÈÎÎñÀ´ÔËÐеġ£ÎªÁË
ÄÜƽ»¬µÄÔËÐÐÀϵÄ16λ³ÌÐò£¬ËüÒýÈëÁËÒ»¸öÈ«¾ÖµÄ»¥³âÁ¿--Win16Mutex¡£ÈκÎÒ»¸ö16λÏß
³ÌÔÚÆäÕû¸öÉúÃüÖÜÆÚÖж¼ÓµÓÐWin16Mutex¶ø32λÏ̵߳±Ëüת»¯³É16λ´úÂëÒ²Òª¾ðÈ¡´Ë»¥³â
Á¿£¬ÒòΪWIN9XÄÚºËÊÇ16λµÄ,ÈçKnrl386.exe,gdi.exe¡£Èç¹ûÀ´×ÔÓÚÓµÓÐWin16MutexµÄÏß³Ì
µÄÎļþÇëÇó±»×èÈû£¬ÏµÍ³½«ÏÝÈëËÀËø״̬¡£Õâ¸öÎÊÌâµÄÕýÈ·´ð°¸ËƺõÔÚûÓеõ½WIN9XÔ´Âë
µÄ֮ǰÓÀÔ¶²»¿ÉÄܱ»Ö¤Êµ£¬µ«ÕâÊÇÎÒÃÇʵʱ¼à¿ØµÄ¹Ø¼ü£¬ËùÒÔ±ØÐë½â¾ö¡£
ÎÒͨ¹ý¸ú×ÙWIN95Îļþ²Ù×÷µÄÁ÷³Ì£¬²¢·´¸´×öʵÑéÑéÖ¤£¬ÖÕÓÚÕÒµ½ÁËÒ»¸ö±È½ÏºÃµÄ½â¾ö°ì·¨
£ºÔÚÀ¹½Øµ½ÎļþÇëÇó»¹Ã»ÓÐÅŶÓAPC֮ǰÎÒÃÇͨ¹ýGet_Cur_Thread_HandleÈ¡µÃµ±Ç°Ï̵߳Ä
ring0tcb£¬´ÓÖÐÕÒµ½TDBX£¬ÔÙÔÚTDBXÖÐÈ¡µÃring3tcb¸ù¾ÝÆä½á¹¹£¬ÎÒÃÇ´ÓÆ«ÒÆ44H´¦µÃµ½F
lagsÓòÖµ£¬ÎÒ·¢ÏÖÈç¹ûËüµÈÓÚ10HºÍ20HʱÈÝÒ×µ¼ÖÂËÀËø£¬ÕâÖ»ÊÇÒ»¸öʵÑé½á¹û£¬ÀíÓÉÎÒÒ²
˵²»Çå³þ£¬´ó¸ÅÊÇÕâÑùµÄÎļþÇëÇó¶àÀ´×ÔÓÚÓµÓÐWin16MutexµÄỊ̈߳¬ËùÒÔ²»ÄÜ×èÈû£»ÁíÍâ
Ò»¸ö¸ù±¾µÄ½â¾ö·½·¨ÊÇÔÚµ÷ÓÃ_VWIN32_WaitSingleObjectʱָ¶¨³¬Ê±£¬Èç¹ûÔÚÖ¸¶¨Ê±¼äÀï
ûÓÐÊÕµ½ring3µÄ»½ÐÑÐźţ¬Ôò×Ô¶¯½â³ýµÈ´ýÒÔ·ÀÖ¹ËÀËøµÄ·¢Éú¡£
ÒÔÉ϶ÔWIN9XϵÄʵʱ¼à¿ØµÄÖ÷Òª¼¼Êõ¶¼×öÁËÏêϸµÄ²ûÊö¡£µ±È»£¬»¹ÓÐÒ»²¿·Ö¹ØÓÚVXDµÄ½á
¹¹£¬±àдºÍ±àÒëµÄ·½·¨ÓÉÓÚƪ·ùµÄ¹Øϵ²»¿ÉÄÜÔÚ´Ëһһ˵Ã÷¡£ÐèÒªÁ˽â¸üÏêϸÄÚÈݵģ¬Çë
²Î¿´Walter OneyµÄÖø×÷¡¶System Programming For Windows 95¡·£¬´ËÊéÉÐÓÐ̨Íåºò¿¡½Ü
·Òë°æ¡¶Windows 95ϵͳ³ÌʽÉè¼Æ¡·¡£
3.3.2³ÌÐò½á¹¹ÓëÁ÷³Ì
ÒÔϵijÌÐò½á¹¹ÓëÁ÷³Ì·ÖÎöÀ´×ÔÒ»ÖøÃû·´²¡¶¾Èí¼þµÄWIN9Xʵʱ¼à¿ØÐéÄâÉ豸Çý¶¯³ÌÐòHoo
ksys.vxd£º
1.µ±VXDÊÕµ½À´×ÔVMMµÄON_SYS_DYNAMIC_DEVICE_INITÏûÏ¢--ÐèҪעÒâÕâÊǸö¶¯Ì¬VXD£¬Ëü²»
»áÊÕµ½ÏµÍ³ÐéÄâ»ú³õʼ»¯Ê±·¢Ë͵ÄSys_Critical_Init, Device_InitºÍInit_Complete¿ØÖÆ
ÏûÏ¢--ʱ£¬Ëü¿ªÊ¼³õʼ»¯Ò»Ð©È«¾Ö±äÁ¿ºÍÊý¾Ý½á¹¹£¬°üÀ¨ÔÚ¶ÑÉÏ·ÖÅäÄڴ棨HeapAllocate
£©£¬´´½¨±¸Óã¬ÀúÊ·¼Ç¼£¬´ò¿ªÎļþ£¬µÈ´ý²Ù×÷£¬¹Ø±ÕÎļþ5¸öË«ÏòÑ»·Á´±í¼°ÓÃÓÚÁ´±í²Ù
×÷»¥³âµÄ5¸öÐźÅÁ¿£¨µ÷ÓÃCreate_Semaphore£©£¬Í¬Ê±½«È«¾Ö±äÁ¿_gNumOfFilters¼´ÎļþÃû
¹ýÂËÏî¸öÊýÉèÖÃΪ0¡£
2.µ±VXDÊÕµ½À´×ÔVMMµÄON_W32_DEVICEIOCONTROLÏûϢʱ£¬Ëü»á´ÓÈë¿Ú²ÎÊýÖÐÈ¡µÃÓû§³ÌÐò
ÀûÓÃDeviceIoControl´«ËͽøÀ´µÄIO¿ØÖÆ´úÂ루IOCtlCode£©£¬ÒÔ´ËÅжÏÓû§³ÌÐòµÄÒâͼ¡£
ºÍHooksys.vxdÐͬ¹¤×÷µÄring3¼¶¿Í»§³ÌÐòguidll.dll»áÒÀ´ÎÏòHooksys.vxd·¢ËÍIO¿ØÖÆÇë
ÇóÀ´Íê³ÉһϵÁй¤×÷£¬¾ßÌå´ÎÐòºÍ´úÂ뺬ÒåÈçÏ£º
83003C2B£º½«guidllÈ¡µÃµÄ²Ù×÷ϵͳ°æ±¾´«¸øÇý¶¯£¨±£´æÔÚiOSversion±äÁ¿ÖУ©£¬¸ù¾Ý´Ë
±äÁ¿ÖµµÄ²»Í¬£¬´Óring0tcb½á¹¹ÖÐÌáȡijЩÓòʱ½«²ÉÓò»Í¬µÄÆ«ÒÆ£¬ÒòΪ²Ù×÷ϵͳ°æ±¾²»
ͬ»áÓ°ÏìÄÚºËÊý¾Ý½á¹¹¡£
83003C1B£º³õʼ»¯ºó±¸Á´±í£¬½«guidll´«ÈëµÄÓÃOpenVxdHandleת»»¹ýµÄÒ»×éʼþÖ¸Õë±£´æ
ÔÚÿ¸öÁ´±íÔªËØÖС£
83003C2F£º½«guidllÈ¡µÃµÄÇý¶¯Æ÷ÀàÐÍÖµ´«¸øÇý¶¯£¨±£´æÔÚDriverType±äÁ¿ÖУ©£¬¸ù¾Ý´Ë
±äÁ¿ÖµµÄ²»Í¬£¬µ÷ÓÃVWIN32_WaitSingleObjectÉèÖò»Í¬µÄµÈ´ý³¬Ê±Öµ£¬ÒòΪ·Ç¹Ì¶¨Çý¶¯Æ÷
µÄ¶Áдʱ¼ä¿ÉÄÜ»áÉÔ³¤Ð©¡£
83003C0F£º±£´æguidll´«Ë͵ÄÓû§Ö¸¶¨µÄÀ¹½ØÎļþµÄÀàÐÍ£¬ÆäʵÕâ¸öÀàÐ͹ýÂËÆ÷Ôڲ鶾ģ
¿éÖÐÒÑ´æÔÚ£¬ÕâÀïÔÙÉèÖÃÏÔÈ»ÊÇΪÁËÌá¸ß´¦ÀíЧÂÊ£ºËüÈ·±£²»»á½«·ÇÖ¸¶¨ÀàÐÍÎļþË͵½ri
ng3¼¶²é¶¾Ä£¿é£¬½ÚÊ¡ÁËͨÐŵĿªÏú¡£¾¹ý½âÎöµÄ¸÷ÎļþÀàÐ͹ýÂË¿éÖ¸Õ뽫±£´æÔÚ_gaFile
NameFilterArraÊý×éÖУ¬Í¬Ê±¸üйýÂËÏî¸öÊý_gNumOfFilters ±äÁ¿µÄÖµ¡£
83003C23£º±£´æguidllÖеȴý²éɱ´ò¿ªÎļþµÄAPCº¯ÊýµØÖ·ºÍµ±Ç°Ïß³ÌKTHREADÖ¸Õë¡£
83003C13£º°²×°ÏµÍ³Îļþ¹³×Ó£¬Æô¶¯À¹½ØÎļþ²Ù×÷µÄ¹³×Óº¯ÊýFilemonHookProcµÄ¹¤×÷¡£
83003C27£º±£´æguidllÖеȴý²éɱ¹Ø±ÕÎļþµÄAPCº¯ÊýµØÖ·ºÍµ±Ç°Ïß³ÌKTHREADÖ¸Õë¡£
83003C17£ºÐ¶ÔØϵͳÎļþ¹³×Ó£¬Í£Ö¹À¹½ØÎļþ²Ù×÷µÄ¹³×Óº¯ÊýFilemonHookProcµÄ¹¤×÷¡£
ÒÔÉÏÁгöµÄIO¿ØÖÆ´úÂëµÄ·¢³öÊǹ̶¨£¬¶øµ±¹³×Óº¯ÊýÆô¶¯ºó£¬»¹»á·¢³öһЩËæ»úµÄ¿ØÖÆ´ú
Â룺
83003C07£ºÇý¶¯½«´ò¿ªÎļþÁ´±íµÄÍ·ÔªËؼ´×îÏȵÄÇëÇó´ò¿ªµÄÎļþɾ³ý²¢²åÈëµ½µÈ´ýÁ´±í
β²¿£¬Í¬Ê±½«ÔªËصÄÓû§¿Õ¼äµØÖ·´«ËÍÖÁring3¼¶µÈ´ý²éɱ´ò¿ªÎļþµÄAPCº¯ÊýÖд¦Àí¡£
83003C0B£ºÇý¶¯½«¹Ø±ÕÎļþÁ´±íµÄÍ·ÔªËؼ´×îÏȵÄÇëÇó¹Ø±ÕµÄÎļþɾ³ý²¢²åÈëµ½±¸ÓÃÁ´±í
β²¿£¬Í¬Ê±½«ÔªËØÖеÄÎļþÃû´®´«ËÍÖÁring3¼¶µÈ´ý²éɱ¹Ø±ÕÎļþµÄAPCº¯ÊýÖд¦Àí
83003C1F£ºµ±²éµÃ¹Ø±ÕÎļþÊDz¡¶¾Ê±£¬¸üÐÂÀúÊ·¼Ç¼Á´±í¡£
ÏÂÃæ½éÉܹ³×Óº¯ÊýºÍguidllÖеȴý²éɱ´ò¿ªÎļþµÄAPCº¯ÊýÐͬ¹¤×÷Á÷³Ì£¬Ð´ÎļþºÍ¹Ø±ÕÎÄ
¼þµÄ´¦ÀíÓëÖ®ÀàËÆ£º
µ±ÎļþÇëÇó½øÈë¹³×Óº¯ÊýFilemonHookProcºó£¬ËüÏÈ´ÓÈë¿Ú²ÎÊýÖÐÈ¡µÃ±»Ö´Ðеĺ¯ÊýµÄ´úºÅ
²¢ÅжÏÆäÊÇ·ñΪ´ò¿ª²Ù×÷£¨IFSFN_OPEN 24H£©£¬Èô·ÇÔòÂíÉϽ«Õâ¸öIRQÏòÏ´«µÝ£¬¼´¹¹ÔìÈë
¿Ú²ÎÊý²¢µ÷Óñ£´æÔÚPrevIFSHookProcÖÐÇ°Ò»¸ö¹³×Óº¯Êý£»ÈôÊÇÔò³ÌÐòÁ÷³ÌתÏò´ò¿ªÎļþÇë
ÇóµÄ´¦Àí·ÖÖ§¡£·ÖÖ§Èë¿Ú´¦Ê×ÏÈÒªÅжϵ±Ç°½ø³ÌÊÇ·ñÊÇÎÒÃÇ×Ô¼º£¬ÈôÊÇÔò±ØÐë·Å¹ýÈ¥£¬Òò
Ϊ²é¶¾Ä£¿éÖÐҪƵ·±µÄ½øÐÐÎļþ²Ù×÷£¬ËùÒÔÀ¹½ØÀ´×Ô×ÔÉíµÄÎļþÇëÇ󽫵¼ÖÂÑÏÖصÄϵͳËÀ
Ëø¡£½ÓÏÂÀ´ÊÇ´Ó¶ÑÕ»²ÎÊýÖÐÈ¡µÃÍêÕûµÄÎļþ·¾¶Ãû²¢Í¨¹ý±£´æµÄÎļþÀàÐ͹ýÂËÕóÁмì²éÆä
ÊÇ·ñÔÚÀ¹½ØÀàÐÍÖ®ÁУ¬Èçͨ¹ýÔò½øÒ»²½¼ì²éÎļþÊÇ·ñÊÇÒÔϼ¸¸öÐë·Å¹ýµÄÎļþÖ®Ò»£ºSYST
EM.DAT£¬USER.DAT£¬\PIPE\¡£È»ºó²éÕÒÀúÊ·¼Ç¼Á´±íÒÔÈ·¶¨¸ÃÎļþÊÇ·ñ×î½üÔø±»¼ì²é²¢¼Ç
¼¹ý£¬ÈôÔÚÀúÊ·¼Ç¼Á´±íÖÐÕÒµ½¹ØÓÚ¸ÃÎļþµÄ¼Ç¼²¢ÇҼǼδʧЧ¼´Æäʱ¼ä´ÁºÍµ±Ç°ÏµÍ³
ʱ¼äÖ®²î²»µÃ´óÓÚ1F4h£¬Ôò¿ÉÖ±½Ó´Ó¼Ç¼ÖжÁÈ¡²é¶¾½á¹û¡£ÖÁ´Ë²Å½øÈëÕæÕýµÄ¼ì²é´ò¿ªÎÄ
¼þº¯Êý_RAVCheckOpenFile£¬´Ëº¯ÊýÈë¿Ú´¦ÏÈ´Ó±¸Ó㬵ȴý»ò¹Ø±ÕÁ´±íÍ·²¿ÕªµÃÒ»¿ÕÏÐÔªËØ
£¨_GetFreeEntry£©²¢Ìî³äÖ®£¨Îļþ·¾¶ÃûÓòµÈ£©¡£½Ó×Åͨ¹ýÒ»ÄÚºËδ¹«¿ªµÄÊý¾Ý½á¹¹ÖеÄ
Öµ£¨ring3tcb->Flags£©ÅжϿɷñ¶Ô¸ÃÎļþÇëÇóÅŶÓAPC¡£Èç¿ÉÔò½«¿ÕÏÐÔªËؼÓÈë´ò¿ªÎļþÁ´±íβ²¿²¢ÅŶÓÒ»¸öring3¼¶¼ì²é´ò¿ªÎļþº¯ÊýµÄAPC¡£È»ºóµ÷ÓÃ_V
WIN32_WaitSingleObjectÔÚ¿ÕÏÐÔªËØÖб£´æµÄÒ»¸öʼþ¶ÔÏóÉϵȴýring3²é¶¾µÄÍê³É¡£µ±¹³
×Óº¯Êý¹ÒÆ𲻾úó£¬ring3µÄAPCº¯ÊýµÃµ½Ö´ÐУºËü»áÏòÇý¶¯·¢³öÒ»IO¿ØÖÆÂëΪ83003C07µÄ
ÇëÇóÒÔÈ¡µÃ´ò¿ªÎļþÁ´±íÍ·ÔªËؼ´±£´æ×îÏÈÌá½»¶øδ¾öµÄÎļþÇëÇó£¬Çý¶¯¿ÉÒÔ½«Äں˿ռä
ÖÐÔªËصÄÐéÄâµØÖ·Ö±½Ó´«¸øËü¶ø²»±Ø¿¼Âǽ«Ö®ÖØÐÂÓ³É䡣ʵ¼ÊÉÏÓÉÓÚWIN9XÄں˿ռäûÓÐÒ³
±£»¤Òò¶øring3¼¶³ÌÐò¿ÉÒÔÖ±½Ó¶Áд֮¡£½Ó×ÅËüµ÷ÓÃRsEngine.dllÖеÄfnScanOneFileº¯Êý
½øÐв鶾²¢ÔÚÔªËØÖÐÉèÖò鶾½á¹û룬Íê±ÏºóÔÙ¶ÔÔªËØÖб£´æµÄʼþ¶ÔÏóµ÷ÓÃSetEvent»½
ÐÑÔÚ´ËʼþÉϵȴýµÄ¹³×Óº¯Êý¡£±»»½ÐѵĹ³×Óº¯Êý¼ì²é±»ring3²é¶¾´úÂëÉèÖõĽá¹ûλÒÔ´Ë
¾ö¶¨¸ÃÎļþÇëÇóÊDZ»²ÉÄɼ´¼ÌÐøÏòÏ´«µÝ»¹ÊDZ»È¡Ïû¼´ÔÚEAXÖзÅÈë-1ºóÖ±½Ó·µ»Ø£¬Í¬Ê±Ôö
¼ÓÀúÊ·¼Ç¼¡£
ÒÔÉÏÖ»Êǹ³×Óº¯ÊýÓëAPCº¯ÊýÁ÷³ÌµÄÒ»¸ö¼òµ¥½éÉÜ£¬ÆäÖÐÊ¡ÂÔÁËÖîÈçÅжϹ̶¨Çý¶¯Æ÷£¬³¬Ê±
µÈÄÚÈÝ£¬¾ßÌåϸ½ÚÇë²Î¿´guidll.dllºÍhooksys.vxdµÄ·´»ã±à´úÂë×¢ÊÍ¡£
3.µ±VXDÊÕµ½À´×ÔVMMµÄON_SYS_DYNAMIC_DEVICE_EXITÏûϢʱ£¬ËüÊͷųõʼ»¯Ê±·ÖÅäµÄ¶ÑÄÚ
´æ£¨HeapFree£©£¬²¢Çå³ý5¸öÓÃÓÚ»¥³âµÄÐźÅÁ¿£¨Destroy_Semaphore£©¡£
3.3.3HOOKSYS.VXDÄæÏò¹¤³Ì´úÂëÆÊÎö
ÔÚÆÊÎö´úÂë֮ǰÓбØÒª½éÉÜÒ»ÏÂÄæÏò¹¤³ÌµÄ¸ÅÄî¡£ÄæÏò¹¤³Ì£¨Reverse Engineering£©ÊÇÖ¸
ÔÚûÓÐÔ´´úÂëµÄÇé¿ö϶ԿÉÖ´ÐÐÎļþ½øÐз´»ã±àÊÔͼÀí½â»úÆ÷Âë±¾ÉíµÄº¬Òå¡£ÄæÏò¹¤³ÌµÄ
ÓÃ;ºÜ¶à£¬ÈçÕªµôÈí¼þ±£»¤£¬¿úÊÓÆäÉè¼ÆºÍ±àд¼¼Êõ£¬·¢¾ò²Ù×÷ϵͳÄÚ²¿°ÂÃصȡ£±¾ÎÄÖÐ
ÎÒÃÇÓõ½µÄ²»ÉÙδ¹«¿ªÊý¾Ý½á¹¹ºÍ·þÎñ¾ÍÊÇÀûÓÃÄæÏòµÄ·½·¨µÃµ½µÄ¡£ÄæÏò¹¤³ÌµÄÄѶȿÉÏë
¶øÖª£ºÒ»¸ö1K´óСµÄexeÎļþ·´»ã±àºó¾ÍÓÐ1000ÐÐ×óÓÒ£¬¶øÎÒÃÇÒªÄæÏòµÄ3¸öÎļþ¼ÓÆðÀ´ÓÐ
80¶àK£¬×Ü´úÂëÁ¿ÊÇ8Íò¶àÐС£ËùÒÔ±ØÐëÕÆÎÕÒ»¶¨µÄÄæÏò¼¼ÇÉ£¬·ñÔò¹¤×÷ÆðÀ´½«ÊǷdz£À§ÄÑ
µÄ¡£
Ê×ÏÈÒªÍê³ÉÄæÏò¹¤×÷£¬±ØÐëÑ¡ÔñÓÅÐãµÄ·´»ã±à¼°µ÷ÊÔ¸ú×Ù¹¤¾ß¡£IDA£¨The Interactive D
isassembler£©ÊÇÒ»¿î¹¦ÄÜÇ¿´óµÄ·´»ã±à¹¤¾ß£ºËüÒÔ½»»¥ÄÜÁ¦Ç¿¶øÖø³Æ£¬ÔÊÐíʹÓÃÕßÔö¼Ó±ê
Ç©£¬×¢Êͼ°¶¨Òå±äÁ¿£¬º¯ÊýÃû³Æ£»ÁíÍâ²»ÉÙ·´»ã±à¹¤¾ß¶ÔÓÚÌØÊâ´¦ÀíµÄ·´ÄæÏòÎļþ£¬Èçµ¼
Èë½ÚË𻵵ÈÏÔµÃÎÞÄÜΪÁ¦£¬µ«IDAÈÔ¿ÉʤÈÎÖ®¡£µ±Îļþ±»¼Ó¹ý¿Ç»ò²åÈëÁ˸ÉÈÅÖ¸Áîʱ ¾ÍÐè
ҪʹÓõ÷ÊÔ¹¤¾ß½øÐж¯Ì¬¸ú×Ù¡£Numega¹«Ë¾µÄSofticeÊǵ÷ÊÔ¹¤¾ßÖеÄٮٮÕߣºËüÖ§³ÖËùÓÐ
ÀàÐ͵ĿÉÖ´ÐÐÎļþ£¬°üÀ¨vxdºÍsysÇý¶¯³ÌÐò£¬Äܹ»ÓÃÈȼüʵʱºô³ö£¬¿É¶Ô´úÂëÖ´ÐУ¬ÄÚ´æ
ºÍ¶Ë¿Ú·ÃÎÊÉèÖöϵ㣬×ÜÖ®¹¦Äܷdz£Ö®Ç¿´óÒÔÖÁÓÚÁ¬Î¢Èí×ܲñȶû¸Ç´Ä¶Ô´Ë¶¼¾ªÌ¾²»ÒÑ¡£
Æä´ÎÐèÒª¶Ô±àÒëÆ÷³£ÓõıàÒë½á¹¹ÓÐÒ»¶¨Á˽⣬ÕâÑùÓÐÖúÓÚÎÒÃÇÀí½â´úÂëµÄº¬Òå¡£
ÈçÏ´úÂëÊÇMS±àÒëÆ÷³£ÓõÄÒ»ÖÖ±àÒë¸ß¼¶ÓïÑÔº¯ÊýµÄÐÎʽ£º
0001224A push ebp £»±£´æ»ùÖ·¼Ä´æÆ÷
0001224B mov ebp, esp
0001224D sub esp, 5Ch £»ÔÚ¶ÑÕ»Áô³ö¾Ö²¿±äÁ¿¿Õ¼ä
00012250 push ebx
00012251 push esi
00012252 push edi
......
0001225B lea edi, [ebp-34h] £»ÒýÓþֲ¿±äÁ¿
......
0001238D mov esi, [ebp+08h] £»ÒýÓòÎÊý
......
00012424 pop edi
00012425 pop esi
00012426 pop ebx
00012427 leave
00012428 retn 8 £»º¯Êý·µ»Ø
ÈçÏ´úÂëÊÇMS±àÒëÆ÷³£ÓõÄÒ»ÖÖ±àÒë¸ß¼¶ÓïÑÔÈ¡´®³¤¶ÈµÄÐÎʽ£º
0001170D lea edi, [eax+1Ch] £»´®Ê×µØÖ·Ö¸Õë
00011710 or ecx, 0FFFFFFFFh £»½«ecxÖÃΪ-1
00011713 xor eax, eax £»É¨Ãè´®½áÊø·ûºÅ£¨NULL£©
00011715 push offset 00012C04h £»±àÒëÆ÷ÓÅ»¯
0001171A repne scasb £»É¨Ãè´®½áÊø·ûºÅλÖÃ
0001171C not ecx £»È¡·´ºóµÃµ½´®³¤¶È
0001171E sub edi, ecx £»»Ö¸´´®Ê×µØÖ·Ö¸Õë
×îºóÒ»µãÊDZØÐëÒªÓмáÈ̵ÄÒãÁ¦ºÍÇåÎúµÄÍ·ÄÔ¡£ÄæÏò¹¤³Ì±¾ÉíÊǼþÍ´¿àµÄ¹¤×÷£º¸ß¼¶ÓïÑÔ
Ô´´úÂëÖÐʹÓõıäÁ¿ºÍº¯ÊýÃû×ÖÔÚÕâÀï½öÊÇÒ»¸öµØÖ·£¬ÐèÒª·´¸´µ÷ÊÔ×ÁÄ¥²ÅÄÜÈ·¶¨Æ京Òå
£»ÁíÍâ±àÒëÆ÷ÓÅ»¯¸üΪÎÒÃÇÀí½â´úÂëÔö¼ÓÁ˲»ÉÙÕÏ°£¬ÈçÉÏÀýÖÐÄǾäѹջָÁîÊǽ«ºóÃ溯
Êýµ÷ÓÃʱ²ÎÊýÈëÕ»ÌáÇ°·ÅÖá£ËùÒÔÒãÁ¦ºÍÍ·ÄÔ¶þÕßȱһ²»¿É¡£
ÒÔϽøÈëhooksys.vxd´úÂëÆÊÎö£¬ÓÉÓÚ´úÂë¹ýÓÚÅÓ´ó£¬ÎÒֻѡÔñÓдú±íÐÔÇÒ¾«²ÊµÄ²¿·Ö½øÐÐ
½éÉÜ¡£´úÂëÖеıäÁ¿ºÍº¯Êý¼°±êÇ©ÃûÊÇÎÒ·ÖÎöºó×Ô¼ºÌí¼ÓµÄ£¬¿ÉÄÜ»áÓëÔ×÷ÕßµÄÒâͼÓÐЩ
³öÈë¡£
3.3.3.1¹³×Óº¯ÊýÈë¿Ú´úÂë
C00012E0 push ebp
C00012E1 mov ebp, esp
C00012E3 sub esp, 11Ch
C00012E9 push ebx
C00012EA push esi
C00012EB push edi
C00012EC mov eax, [ebp+arg_4] £» ±»Ö´Ðеĺ¯ÊýµÄ´úºÅ
C00012EF mov [ebp+var_11C], eax
C00012F5 cmp [ebp+var_11C], 1 £» IFSFN_WRITE
C00012FC jz writefile
C0001302 cmp [ebp+var_11C], 0Bh £» IFSFN_CLOSE
C0001309 jz closefile
C000130F cmp [ebp+var_11C], 24h £» IFSFN_OPEN
C0001316 jz short openfile
C0001318 jmp irqpassdown
¹³×Óº¯ÊýÈë¿Ú´¦£¬¶ÑÕ»²ÎÊý·Ö²¼ÈçÏ£º
ebp+00h -> ±£´æµÄEBPÖµ.
ebp+04h -> ·µ»ØµØÖ·.
ebp+08h -> ÌṩÕâ¸öAPIÒªµ÷ÓõÄFSDº¯ÊýµÄµÄµØÖ·
ebp+0Ch -> Ìṩ±»Ö´Ðеĺ¯ÊýµÄ´úºÅ
ebp+10h -> ÌṩÁ˲Ù×÷ÔÚÆäÉÏÖ´ÐеÄÒÔ1Ϊ»ù×¼µÄÇý¶¯Æ÷´úºÅ£¨Èç¹ûUNCΪ-1)
ebp+14h -> ÌṩÁ˲Ù×÷ÔÚÆäÉÏÖ´ÐеÄ×ÊÔ´µÄÖÖÀà¡£
ebp+18h -> ÌṩÁËÓû§´®´«µÝÆäÉϵĴúÂëÒ³
ebp+1Ch -> ÌṩIOREQ½á¹¹µÄÖ¸Õë¡£
¹³×Óº¯ÊýÀûÓÃ[ebp+0Ch]Öб£´æµÄ±»Ö´Ðеĺ¯ÊýµÄ´úºÅÀ´ÅжϸÃÇëÇóµÄÀàÐÍ¡£Í¬Ê±ËüÀûÓÃ[
ebp+0Ch]Öб£´æµÄIOREQ½á¹¹µÄÖ¸Õë´Ó¸Ã½á¹¹ÖÐÆ«ÒÆ0ch´¦path_t ir_ppathÓòÈ¡µÃÍêÕûµÄÎÄ
¼þ·¾¶Ãû³Æ¡£
3.3.3.2È¡µÃµ±Ç°½ø³ÌÃû³Æ´úÂë
C0000870 push ebx
C0000871 push esi
C0000872 push edi
C0000873 call VWIN32_GetCurrentProcessHandle £»ÔÚeaxÖзµ»Øring0 PDB£¨½ø³ÌÊý¾Ý
¿â£©
C0000878 mov eax, [eax+38h] £»HTASK W16TDB
£»Æ«ÒÆ38h´¦ÊÇWin16ÈÎÎñÊý¾Ý¿âÑ¡Ôñ×Ó
C000087B push 0 £»DWORD Flags
C000087D or al,
C000087F push eax £»DWORD Selector
C0000880 call Get_Sys_VM_Handle@0
C0000885 push eax £»È¡µÃϵͳVMµÄ¾ä±ú VMHANDLE hVM
C0000886 call _SelectorMapFlat £»½«Ñ¡Ôñ×Ó»ùÖ·Ó³ÉäΪƽ̹ģʽµÄÏßÐεØÖ·
C000088B add esp, 0Ch
C000088E cmp eax, 0FFFFFFFFh £»Ó³Éä´íÎó
C0000891 jnz short loc_C0000899
......
C0000899 lea edi, [eax+0F2h] £»´ÓÆ«ÒÆ0F2hÈ¡µÃÄ£¿éÃû³Æ
£»char TDB_ModName[8]
3.3.3.3ͨÐŲ¿·Ö´úÂë
hooksys.vxdÖдúÂ룺
C00011BC push ecx £»¿Í»§³ÌÐòµÄring0Ï߳̾ä±ú
C00011BD push ebx £»´«ÈëAPCµÄ²ÎÊý
C00011BE push edx £»ring3¼¶APCº¯ÊýµÄƽ̹ģʽµØÖ·
C00011BF call _VWIN32_QueueUserApc £»ÅŶÓAPC
C00011C4 mov eax, [ebp+0Ch] £»Ê¼þ¶ÔÏóµÄring0¾ä±ú
C00011C7 push eax
C00011C8 call _VWIN32_ResetWin32Event£»ÉèÖÃʼþ¶ÔÏóΪÎÞÐźÅ̬
......
C00011E7 mov eax, [ebp+0Ch]
C00011EA push 3E8h £»³¬Ê±ÉèÖÃ
C00011EF push eax £»Ê¼þ¶ÔÏóµÄring0¾ä±ú
C00011F0 call _VWIN32_WaitSingleObject £»µÈ´ýring3²é¶¾µÄÍê³É
guidll.dllÖдúÂ룺
APCº¯ÊýÈë¿Ú£º
10001AD1 mov eax, hDevice £»È¡µÃÉ豸¾ä±ú
10001AD6 lea ecx, [esp+4]
10001ADA push 0
10001ADC push ecx £»·µ»Ø×Ö½ÚÊý
10001ADD lea edx, [esp+8]
10001AE1 push 4 £»Êä³ö»º³åÇø´óС
10001AE3 push edx £»Êä³ö»º³åÇøÖ¸Õë
10001AE4 push 0 £»ÊäÈ뻺³åÇø´óС
10001AE6 push 0 £»ÊäÈ뻺³åÇøÖ¸Õë
10001AE8 push 83003C07h £»IO¿ØÖÆ´úÂë
10001AED push eax £»É豸¾ä±ú
10001AEE call ds:DeviceIoControl
10001AF4 test eax, eax
10001AF6 jz short loc_10001B05
10001AF8 mov ecx, [esp+0] £»µÃµ½´ò¿ªÎļþÁ´±íÍ·ÔªËØ
10001AFC push ecx
10001AFD call ScanOpenFile £»µ÷Óò鶾º¯Êý
ScanOpenFileº¯ÊýÖУº
1000185D call ds:fnScanOneFile £»µ÷ÓÃÕæÕý²é¶¾¿âµ¼³öº¯Êý
10001863 mov edx, hMutex
10001869 add esp, 8
1000186C mov esi, eax £»²é¶¾½á¹û
1000186E push edx
1000186F call ds:ReleaseMutex
10001875 test esi, esi £»¼ì²é½á¹û
10001877 jnz short OpenFileIsVirus £»Èç·¢ÏÖ²¡¶¾ÔòÌøµ½OpenFileIsViru½øÒ»²½´¦Àí
10001879 mov eax, [ebp+10h] £»Ê¼þ¶ÔÏóµÄring3¾ä±ú
1000187C mov byte ptr [ebp+16h], 0 £»ÉèÖÃÔªËØÖеĽá¹ûλΪÎÞ²¡¶¾
10001880 push eax
10001881 call ds:SetEvent £»ÉèÖÃʼþ¶ÔÏóΪÓÐÐźÅ̬»½Ðѹ³×Óº¯Êý
3.4WINNT/2000ϵIJ¡¶¾ÊµÊ±¼à¿Ø
3.4.1ʵÏÖ¼¼ÊõÏê½â
WINNT/2000ϲ¡¶¾ÊµÊ±¼à¿ØµÄʵÏÖÖ÷ÒªÒÀÀµÓÚNTÄÚºËģʽÇý¶¯±à³Ì£¬À¹½ØIRP£¬Çý¶¯Óërin
g3Ï¿ͻ§³ÌÐòµÄͨÐÅ£¨ÃüÃûµÄʼþÓëÐźÅÁ¿¶ÔÏó£©ÈýÏî¼¼Êõ¡£³ÌÐòµÄÉè¼Æ˼·ºÍ´óÌåÁ÷³Ì
ÓëÇ°Ãæ½éÉܵÄWIN9Xϲ¡¶¾ÊµÊ±¼à¿Ø·Ç³£ÏàËÆ£¬Ö»ÊÇÔÚʵÏÖ¼¼ÊõÓÉÓÚÔËÐл·¾³µÄ²»Í¬½«³ÊÏÖ
ºÜ´óµÄÇø±ð¡£
WINNT/2000ϲ»ÔÙÖ§³ÖVXD£¬ÎÒ½«ÔÚºóÃæÆÊÎöµÄhooksys.sysÆäʵÊÇÒ»ÖÖ³ÆΪNTÄÚºËģʽÉè
±¸Çý¶¯µÄÇý¶¯³ÌÐò¡£ÕâÖÖÇý¶¯³ÌÐòÎÞÂÛ´ÓÆä½á¹¹»¹Êǹ¤×÷·½Ê½¶¼ÓëVXDÓкܴó²»Í¬¡£±È½Ï¶ø
ÑÔ£¬NTÄÚºËģʽÉ豸Çý¶¯µÄ±àд±ÈVXDÄѶȸü´ó£ºÒòΪËüÒªÇó±à³ÌÕßÊìϤWINNT/2000µÄÕûÌå
¼Ü¹¹ºÍÔËÐлúÖÆ£¬NT/2000ÊÇ´¿32λ΢Äں˲Ù×÷ϵͳ£¬ÓëWIN9XÓкܴóÇø±ð£»ÄÜÁé»îʹÓÃÄÚ
ºËÊý¾Ý½á¹¹£¬ÈçÇý¶¯³ÌÐò¶ÔÏó£¬É豸¶ÔÏó£¬Îļþ¶ÔÏó£¬IOÇëÇó°ü£¬Ö´ÐÐÌå½ø³Ì/Ï߳̿飬ϵ
ͳ·þÎñµ÷¶È±íµÈ¡£ÁíÍâ±à³ÌÕßÔÚ±à³Ìʱ»¹Ðè×¢ÒâÐí¶àÖØÒªÊÂÏÈ統ǰϵͳÔËÐеÄIOÇëÇó
¼¶£¬·ÖÒ³/·Ç·ÖÒ³ÄÚ´æµÈ¡£
ÕâÀïÊ×ÏȽéÉܼ¸¸öÖØÒªµÄÄÚºËÊý¾Ý½á¹¹£¬ËüÃÇÔÚNTÄÚºËģʽÉ豸Çý¶¯µÄ±à³ÌÖо³£±»Óõ½
£¬°üÀ¨Îļþ¶ÔÏó£¬Çý¶¯³ÌÐò¶ÔÏó£¬É豸¶ÔÏó£¬IOÇëÇó°ü£¨IRP£©£¬IO¶ÑÕ»µ¥Ôª£¨IO_STACK_
LOCATION£©£º
ÎļþÃ÷ÏÔ·ûºÏNTÖеĶÔÏó±ê×¼£ºËüÃÇÊÇÁ½¸ö»òÁ½¸öÒÔÉÏÓû§Ì¬½ø³ÌµÄÏ߳̿ÉÒÔ¹²ÏíµÄϵͳ
×ÊÔ´£»ËüÃÇ¿ÉÒÔÓÐÃû³Æ£»ËüÃDZ»»ùÓÚ¶ÔÏóµÄ°²È«ÐÔËù±£»¤£»²¢ÇÒËüÃÇÖ§³Öͬ²½¡£¶ÔÓÚÓû§
̬Êܱ£»¤µÄ×Óϵͳ£¬Îļþ¶ÔÏóͨ³£´ú±íÒ»¸öÎļþ£¬É豸Ŀ¼£¬»ò¾íµÄ´ò¿ªÊµÀý£»¶ø¶ÔÓÚÉè
±¸ºÍÖмäÐÍÇý¶¯£¬Îļþ¶ÔÏóͨ³£´ú±íÒ»¸öÉ豸¡£Îļþ¶ÔÏó½á¹¹ÖеÄÓò´ó²¿·ÖÊÇ͸Ã÷µÄÇý¶¯
¿ÉÒÔ·ÃÎʵÄÓò°üÀ¨£º
PDEVICE_OBJECT DeviceObject£ºÖ¸ÏòÎļþÓÚÆäÉϱ»´ò¿ªµÄÉ豸¶ÔÏóµÄÖ¸Õë¡£
UNICODE_STRING FileName£ºÔÚÉ豸Éϱ»´ò¿ªµÄÎļþµÄÃû×Ö£¬Èç¹ûµ±ÓÉDeviceObject´ú±íµÄ
É豸±»´ò¿ªÊ±´Ë´®³¤¶È£¨FileName.Length£©Îª0¡£
Çý¶¯³ÌÐò¶ÔÏó´ú±í¿É×°ÔصÄÄÚºËģʽÇý¶¯µÄÓ³Ï󣬵±Çý¶¯±»¼ÓÔØÖÁϵͳÖÐʱ£¬ÓÐI/O¹ÜÀíÆ÷
¸ºÔð´´½¨¡£Ö¸ÏòÇý¶¯³ÌÐò¶ÔÏóµÄÖ¸Õ뽫×÷Ϊһ¸öÊäÈë²ÎÊý´«Ë͵½Çý¶¯µÄ³õʼ»¯Àý³Ì£¨Driv
erEntry£©£¬ÔÙ³õʼ»¯Àý³Ì£¨Reinitialize routines£©ºÍжÔØÀý³Ì£¨Unload routine£©¡£
Çý¶¯³ÌÐò¶ÔÏó½á¹¹ÖеÄÓò´ó²¿·ÖÊÇ͸Ã÷µÄ£¬Çý¶¯¿ÉÒÔ·ÃÎʵÄÓò°üÀ¨£º
PDEVICE_OBJECT DeviceObject£ºÖ¸ÏòÇý¶¯´´½¨µÄÉ豸¶ÔÏóµÄÖ¸Õë¡£µ±ÔÚ³õʼ»¯Àý³ÌÖгɹ¦
µ÷ÓÃIoCreateDeviceºóÕâ¸öÓò½«±»×Ô¶¯¸üС£µ±Çý¶¯Ð¶ÔØʱ£¬ËüµÄжÔØÀý³Ì½«Ê¹ÓôËÓòºÍ
É豸¶ÔÏóÖÐNextDeviceÓòµ÷ÓÃIoDeleteDeviceÀ´Çå³ýÇý¶¯´´½¨µÄÿ¸öÉ豸¶ÔÏó¡£
PDRIVER_INITIALIZE DriverInit£ºÓÉI/O¹ÜÀíÆ÷ÉèÖõijõʼ»¯Àý³Ì£¨DriverEntry£©Èë¿ÚµØ
Ö·¡£¸ÃÀý³Ì¸ºÔð´´½¨Çý¶¯³ÌÐò²Ù×÷µÄÿ¸öÉ豸µÄÉ豸¶ÔÏó£¬ÐèÒªµÄ»°»¹¿ÉÒÔÔÚÉ豸Ãû³ÆºÍ
É豸¶ÔÓû§Ì¬¿É¼ûÃû³Æ¼ä´´½¨·ûºÅÁ´½Ó¡£Í¬Ê±Ëü»¹°ÑÇý¶¯³ÌÐò¸÷Àý³ÌÈë¿ÚµãÌîÈëÇý¶¯³ÌÐò
¶ÔÏóÏàÓ¦µÄÓòÖС£
PDRIVER_UNLOAD DriverUnload£ºÇý¶¯³ÌÐòµÄжÔØÀý³ÌÈë¿ÚµØÖ·¡£
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]£ºÒ»¸ö»ò¶à¸öÇý¶¯³ÌÐòµ÷
¶ÈÀý³ÌÈë¿ÚµØÖ·Êý×顣ÿ¸öÇý¶¯±ØÐëÔÚ´ËÊý×éÖÐΪÇý¶¯´¦ÀíµÄIRP_MJ_XXXÇëÇó¼¯ÉèÖÃÖÁÉÙ
Ò»¸öµ÷¶ÈÈë¿Ú£¬ÕâÑùËùÓеÄIRP_MJ_XXXÇëÇó¶¼»á ±»I/O¹ÜÀíÆ÷µ¼Èëͬһ¸öµ÷¶ÈÀý³Ì¡£µ±È»
£¬Çý¶¯³ÌÐòÒ²¿ÉÒÔΪÿ¸öIRP_MJ_XXXÇëÇóÉèÖöÀÁ¢µÄµ÷¶ÈÈë¿Ú¡£
µ±È»£¬Çý¶¯³ÌÐòÖпÉÄÜ°üº¬µÄÀý³Ì½«Ô¶²»Ö¹ÒÔÉÏÁгöµÄ¡£±ÈÈçÆô¶¯I/OÀý³Ì£¬ÖжϷþÎñÀý³Ì
£¨ISR£©£¬ÖжϷþÎñDPCÀý³Ì£¬Ò»¸ö»ò¶à¸öÍê³ÉÀý³Ì£¬È¡ÏûI/OÀý³Ì£¬ÏµÍ³¹Ø±Õ֪ͨÀý³Ì£¬´í
Îó¼Ç¼Àý³Ì¡£Ö»²»¹ýÎÒÃǽ«ÒªÆÊÎöµÄhooksys.sysÖÐÖ»Óõ½Àý³ÌÖкÜÉÙÒ»²¿·Ö£¬¹ÊÆäÓàµÄ²»
ÓèÏêϸ½éÉÜ¡£
É豸¶ÔÏó´ú±íÒÑ×°ÔصÄÇý¶¯³ÌÐòΪ֮´¦ÀíI/OÇëÇóµÄÒ»¸öÂß¼£¬ÐéÄâ»òÎïÀíÉ豸¡£Ã¿¸öNTÄÚ
ºËģʽÇý¶¯³ÌÐò±ØÐëÔÚËüµÄ³õʼ»¯Àý³ÌÖÐÒ»´Î»ò¶à´Îµ÷ÓÃIoCreateDeviceÀ´´´½¨ËüÖ§³ÖµÄ
É豸¶ÔÏó¡£ÀýÈçtcpip.sysÔÚÆäDriverEntryÖоʹ´½¨ÁË3¸ö¹²ÓôËÇý¶¯µÄÉ豸¶ÔÏó£ºTcp£¬
Udp£¬Ip¡£Ä¿Ç°ÓÐÒ»ÖֱȽÏÁ÷ÐеijÆΪWDM£¨Windows Driver Model£©µÄÇý¶¯³ÌÐò£¬ÔÚ´ó¶à
ÊýÇé¿öÏ£¬Æä¶þ½øÖÆÓ³Ïñ¿ÉÒÔ¼æÈÝWIN98ºÍWIN2000(32λ°æ±¾)¡£WDMÓëNTÄÚºËģʽÇý¶¯³ÌÐò
µÄÖ÷ÒªÇø±ðÔÚÓÚÈçºÎ´´½¨É豸£ºÔÚWDMÇý¶¯³ÌÐòÖУ¬¼´²å¼´Óã¨PnP£©¹ÜÀíÆ÷¸æÖªºÎʱÏòϵ
ͳÖÐÌí¼ÓÒ»¸öÉ豸£¬»òÕß´ÓϵͳÖÐɾ³ýÉ豸¡£WDMÇý¶¯³ÌÐòÓÐÒ»¸öÌØÊâµÄAddDeviceÀý³Ì£¬
PnP¹ÜÀíÆ÷Ϊ¹²ÓøÃÇý¶¯µÄÿ¸öÉ豸ʵÀýµ÷Óøú¯Êý£»¶øNTÄÚºËģʽÇý¶¯³ÌÐòÐèÒª×ö´óÁ¿¶î
ÍâµÄ¹¤×÷£¬ËüÃDZØÐë̽²â×Ô¼ºµÄÓ²¼þ£¬ÎªÓ²¼þ´´½¨É豸¶ÔÏó(ͨ³£ÔÚDriverEntryÖÐ)£¬ÅäÖÃ
²¢³õʼ»¯Ó²¼þʹÆäÕý³£¹¤×÷¡£É豸³ÌÐò¶ÔÏó½á¹¹ÖеÄÓò´ó²¿·ÖÊÇ͸Ã÷µÄ£¬Çý¶¯¿ÉÒÔ·ÃÎʵÄ
Óò°üÀ¨£º
PDRIVER_OBJECT DriverObject£ºÖ¸Ïò´ú±íÇý¶¯³ÌÐò×°ÔØÓ³ÏóµÄÇý¶¯³ÌÐò¶ÔÏóµÄÖ¸Õë¡£
ËùÓÐI/O¶¼ÊÇͨ¹ýI/OÇëÇó°ü£¨IRP£©Çý¶¯µÄ¡£ËùνIRPÇý¶¯£¬ÊÇÖ¸I/O¹ÜÀíÆ÷¸ºÔðÔÚϵͳµÄ·Ç
·ÖÒ³ÄÚ´æÖзÖÅäÒ»¶¨µÄ¿Õ¼ä£¬µ±½ÓÊÜÓû§·¢³öµÄÃüÁî»òÓÉʼþÒý·¢ºó£¬½«¹¤×÷Ö¸Áî°´Ò»¶¨
µÄÊý¾Ý½á¹¹ÖÃÓÚÆäÖв¢´«µÝµ½Çý¶¯³ÌÐòµÄ·þÎñÀý³Ì¡£»»ÑÔÖ®£¬IRPÖаüº¬ÁËÇý¶¯³ÌÐòµÄ·þÎñ
Àý³ÌËùÐèµÄÐÅÏ¢Ö¸Áî¡£IRPÓÐÁ½²¿·Ö×é³É£º¹Ì¶¨²¿·Ö£¨³ÆΪ±êÌ⣩ºÍÒ»¸ö»ò¶à¸ö¶ÑÕ»µ¥Ôª¡£
¹Ì¶¨²¿·ÖÐÅÏ¢°üÀ¨£ºÇëÇóµÄÀàÐͺʹóС£¬ÊÇͬ²½ÇëÇó»¹ÊÇÒì²½ÇëÇó£¬ÓÃÓÚ»º³åI/OµÄÖ¸Ïò»º
³åÇøµÄÖ¸ÕëºÍÓÉÓÚÇëÇóµÄ½øÕ¹¶ø±ä»¯µÄ״̬ÐÅÏ¢¡£
PMDL MdlAddress£ºÖ¸ÏòÒ»¸öÄÚ´æÃèÊö·û±í(MDL)£¬¸Ã±íÃèÊöÁËÒ»¸öÓë¸ÃÇëÇó¹ØÁªµÄÓû§Ä£
ʽ»º³åÇø¡£Èç¹û¶¥¼¶É豸¶ÔÏóµÄFlagsÓòΪDO_DIRECT_IO£¬ÔòI/O¹ÜÀíÆ÷ΪIRP_MJ_READ»òI
RP_MJ_WRITEÇëÇó´´½¨Õâ¸öMDL¡£Èç¹ûÒ»¸öIRP_MJ_DEVICE_CONTROLÇëÇóµÄ¿ØÖÆ´úÂëÖ¸¶¨MET
HOD_IN_DIRECT»òMETHOD_OUT_DIRECT²Ù×÷·½Ê½£¬ÔòI/O¹ÜÀíÆ÷Ϊ¸ÃÇëÇóʹÓõÄÊä³ö»º³åÇø´´
½¨Ò»¸öMDL¡£MDL±¾ÉíÓÃÓÚÃèÊöÓû§Ä£Ê½ÐéÄ⻺³åÇø£¬µ«ËüͬʱҲº¬Óиûº³åÇøËø¶¨ÄÚ´æÒ³
µÄÎïÀíµØÖ·¡£
PVOID AssociatedIrp.SystemBuffer£ºSystemBufferÖ¸ÕëÖ¸ÏòÒ»¸öÊý¾Ý»º³åÇø£¬¸Ã»º³åÇø
λÓÚÄÚºËģʽµÄ·Ç·ÖÒ³ÄÚ´æÖÐÓÚIRP_MJ_READºÍIRP_MJ_WRITE²Ù×÷£¬Èç¹û¶¥¼¶É豸ָ¶¨DO_
BUFFERED_IO±êÖ¾I/O¹ÜÀíÆ÷¾Í´´½¨Õâ¸öÊý¾Ý»º³åÇø¡£¶ÔÓÚIRP_MJ_DEVICE_CONTROL²Ù×÷£¬Èç
¹ûI/O¿ØÖƹ¦ÄÜ´úÂëÖ¸³öÐèÒª»º³åÇø£¬ÔòI/O¹ÜÀíÆ÷¾Í´´½¨Õâ¸öÊý¾Ý»º³åÇø¡£I/O¹ÜÀíÆ÷°ÑÓÃ
»§Ä£Ê½³ÌÐò·¢Ë͸øÇý¶¯³ÌÐòµÄÊý¾Ý¸´ÖƵ½Õâ¸ö»º³åÇø£¬ÕâÒ²ÊÇ´´½¨IRP¹ý³ÌµÄÒ»²¿·Ö¡£ÕâЩ
Êý¾Ý¿ÉÒÔÊÇÓëWriteFileµ÷ÓÃÓйصÄÊý¾Ý£¬»òÕßÊÇDeviceIoControlµ÷ÓÃÖÐËùνµÄÊäÈëÊý¾Ý
¡£¶ÔÓÚ¶ÁÇëÇó£¬É豸Çý¶¯³ÌÐò°Ñ¶Á³öµÄÊý¾ÝÌîµ½Õâ¸ö»º³åÇø£¬È»ºóI/O¹ÜÀíÆ÷ÔÙ°Ñ»º³åÇøµÄ
ÄÚÈݸ´ÖƵ½Óû§Ä£Ê½»º³åÇø¡£¶ÔÓÚÖ¸¶¨ÁËMETHOD_BUFFEREDµÄI/O¿ØÖƲÙ×÷£¬Çý¶¯³ÌÐò°ÑËù
νµÄÊä³öÊý¾Ý·Åµ½Õâ¸ö»º³åÇø£¬ È»ºóI/O¹ÜÀíÆ÷ÔÙ°ÑÊý¾Ý¸´ÖƵ½Óû§Ä£Ê½µÄÊä³ö»º³åÇø¡£
IO_STATUS_BLOCK IoStatus£ºIoStatus(IO_STATUS_BLOCK)ÊÇÒ»¸ö½ö°üº¬Á½¸öÓòµÄ½á¹¹£¬Çý
¶¯³ÌÐòÔÚ×îÖÕÍê³ÉÇëÇóʱÉèÖÃÕâ¸ö½á¹¹¡£IoStatus.StatusÓò½«ÊÕµ½Ò»¸öNTSTATUS´úÂë¡£
PVOID UserBuffer£º¶ÔÓÚMETHOD_NEITHER·½Ê½µÄIRP_MJ_DEVICE_CONTROLÇëÇ󣬸ÃÓò°üº¬Êä
³ö»º³åÇøµÄÓû§Ä£Ê½ÐéÄâµØÖ·¡£¸ÃÓò»¹ÓÃÓÚ±£´æ¶ÁдÇëÇ󻺳åÇøµÄÓû§Ä£Ê½ÐéÄâµØÖ·£¬µ«
Ö¸¶¨ÁËDO_BUFFERED_IO»òDO_DIRECT_IO±êÖ¾µÄÇý¶¯³ÌÐò£¬Æä¶ÁдÀý³Ìͨ³£²»ÐèÒª·ÃÎÊÕâ¸ö
Óò¡£µ±´¦ÀíÒ»¸öMETHOD_NEITHER¿ØÖƲÙ×÷ʱ£¬Çý¶¯³ÌÐòÄÜÓÃÕâ¸öµØÖ·´´½¨×Ô¼ºµÄMDL¡£
ÈκÎÄÚºËģʽ³ÌÐòÔÚ´´½¨Ò»¸öIRPʱ£¬Í¬Ê±»¹´´½¨ÁËÒ»¸öÓëÖ®¹ØÁªµÄIO_STACK_LOCATION½á
¹¹Êý×飺Êý×éÖеÄÿ¸ö¶ÑÕ»µ¥Ôª¶¼¶ÔÓ¦Ò»¸ö½«´¦Àí¸ÃIRPµÄÇý¶¯³ÌÐò£¬ÁíÍ⻹ÓÐÒ»¸ö¶ÑÕ»µ¥
Ôª¹©IRPµÄ´´½¨ÕßʹÓ᣶ÑÕ»µ¥ÔªÖаüº¬¸ÃIRPµÄÀàÐÍ´úÂëºÍ²ÎÊýÐÅÏ¢ÒÔ¼°Íê³Éº¯ÊýµÄµØÖ·
¡£
UCHAR MajorFunction£º¸ÃIRPµÄÖ÷¹¦ÄÜÂë¡£Õâ¸ö´úÂëÓ¦¸ÃΪÀàËÆIRP_MJ_READÒ»ÑùµÄÖµ£¬²¢
ÓëÇý¶¯³ÌÐò¶ÔÏóÖÐMajorFunction±íµÄij¸öÅÉDzº¯ÊýÖ¸ÕëÏà¶ÔÓ¦¡£
UCHAR MinorFunction£º¸ÃIRPµÄ¸±¹¦ÄÜÂë¡£Ëü½øÒ»²½Ö¸³ö¸ÃIRPÊôÓÚÄĸöÖ÷¹¦ÄÜÀà¡£
PDEVICE_OBJECT DeviceObject£ºÓë¸Ã¶ÑÕ»µ¥Ôª¶ÔÓ¦µÄÉ豸¶ÔÏóµÄµØÖ·¡£¸ÃÓòÓÉIoCallDri
verº¯Êý¸ºÔðÌîд¡£
PFILE_OBJECT FileObject£ºÄÚºËÎļþ¶ÔÏóµÄµØÖ·£¬IRPµÄÄ¿±ê¾ÍÊÇÕâ¸öÎļþ¶ÔÏó¡£
ÏÂÃæ¼òÒª½éÉÜÒ»ÏÂWINNT/2000ÏÂI/OÇëÇó´¦ÀíÁ÷³Ì¡£ÏÈ¿´¶Ôµ¥²ãÇý¶¯³ÌÐòµÄͬ²½µÄI/OÇëÇó
£ºI/OÇëÇó¾¹ý×ÓϵͳDLL×ÓϵͳDLLµ÷ÓÃI/O¹ÜÀíÆ÷ÖÐÏàÓ¦µÄ·þÎñ¡£I/O¹ÜÀíÆ÷ÒÔIRPµÄÐÎʽ
¸øÉ豸Çý¶¯³ÌÐò·¢ËÍÇëÇó¡£Çý¶¯³ÌÐòÆô¶¯I/O²Ù×÷¡£ÔÚÉ豸Íê³ÉÁ˲Ù×÷²¢ÇÒÖжÏCPUʱ£¬Éè
±¸Çý¶¯³ÌÐò·þÎñÓÚÖжϡ£×îºóI/O¹ÜÀíÆ÷Íê³ÉI/OÇëÇó¡£ÒÔÉÏÁù²½Ö»ÊÇÒ»¸ö·Ç³£´ÖÂÔµÄÃèÊö
£¬ÆäÖеÄÖжϴ¦ÀíºÍI/OÍê³É½×¶Î±È½Ï¸´ÔÓ¡£
µ±É豸Íê³ÉÁËI/O²Ù×÷ºó£¬Ëü½«·¢³öÖжÏÇëÇó·þÎñ¡£É豸ÖжϷ¢Éúʱ£¬´¦ÀíÆ÷½«¿ØÖÆȨ½»¸ø
ÄÚºËÏÝÚå´¦Àí³ÌÐò£¬ÄÚºËÏÝÚå´¦Àí³ÌÐò½«ÔÚËüµÄÖжϵ÷¶È±í£¨IDT£©Öж¨Î»ÓÃÓÚÉ豸µÄISR
¡£Çý¶¯³ÌÐòµÄISRÀý³Ì»ñµÃ¿ØÖÆȨºó£¬Ëüͨ³£Ö»ÔÚÉ豸IRQLÉÏÍ£Áô»ñµÃÉ豸״̬Ëù±ØÐèµÄÒ»
¶Îʱ¼ä£¬È»ºóÍ£Ö¹É豸Öжϣ¬½Ó×ÅËüÅŶÓÒ»¸öDPC²¢Çå³ýÖжÏÍ˳ö²Ù×÷¡£IRQL½µµÍÖÁDispa
tch/DPC¼¶Ö®Ç°£¬ËùÓÐÖмäÓÅÏȼ¶ÖжÏÒò¶ø¿ÉÒԵõ½·þÎñ¡£µ±DPCÀý³ÌµÃµ½¿ØÖÆʱ£¬Ëü½«Æô
¶¯É豸¶ÓÁÐÖÐÏÂÒ»¸öI/OÇëÇó£¬È»ºóÍê³ÉÖжϷþÎñ¡£
µ±Çý¶¯µÄDPCÀý³ÌÖ´ÐÐÍêºó£¬ÔÚI/OÇëÇó¿ÉÒÔ¿¼ÂǽáÊø֮ǰ»¹ÓÐһЩ¹¤×÷Òª×ö¡£ÈçijЩÇé¿ö
Ï£¬I/Oϵͳ±ØÐ뽫´æ´¢ÔÚϵͳÄÚ´æÖеÄÊý¾Ý¸´ÖƵ½µ÷ÓÃÕßµÄÐéÄâµØÖ·¿Õ¼äÖУ¬È罫²Ù×÷½á
¹û¼Ç¼ÔÚµ÷ÓÃÕßÌṩµÄI/O״̬¿éÖлòÖ´Ðлº³åI/OµÄ·þÎñ½«Êý¾Ý·µ»Ø¸øµ÷ÓÃÏ̡߳£ÕâÑùµ±
DPCÀý³Ìµ÷ÓÃI/O¹ÜÀíÆ÷Íê³ÉÔʼI/OÇëÇóºó£¬I/O¹ÜÀíÆ÷»áΪµ÷ÓÃÏ̵߳÷ÓÃÏß³ÌÅŶÓÒ»¸öºË
ÐÄ̬APC¡£µ±Ï̱߳»µ÷¶ÈÖ´ÐÐʱ£¬¹ÒÆðµÄAPC±»½»¸¶¡£Ëü½«°ÑÊý¾ÝºÍ·µ»Ø״̬¸´ÖƵ½µ÷ÓÃÕß
µÄµØÖ·¿Õ¼ä£¬ÊÍ·Å´ú±íI/O²Ù×÷µÄIRP£¬²¢½«µ÷ÓÃÕßµÄÎļþ¾ä±ú»òµ÷ÓÃÕßÌṩµÄʼþ»òI/OÍê
³É¶Ë¿ÚÉèÖÃΪÓÐÐźÅ״̬¡£Èç¹ûµ÷ÓÃÕßÓÃÒì²½I/Oº¯ÊýReadFileExºÍWriteFileExÖ¸¶¨ÁËÓÃ
»§Ì¬APC£¬Ôò´Ëʱ»¹ÐèÒª½«Óû§Ì¬APCÅŶӡ£×îºó¿ÉÒÔ¿¼ÂÇÍê³ÉI/O¡£ÔÚÎļþ»òÆäËü¶ÔÏó¾ä±ú
ÉϵȴýµÄÏ߳̽«±»ÊÍ·Å¡£
»ùÓÚÎļþϵͳÉ豸µÄI/OÇëÇó´¦Àí¹ý³ÌÓë´ËÊÇ»ù±¾ÏàͬµÄ£¬Ö÷ÒªÇø±ðÔÚÓÚÔö¼ÓÒ»¸ö»ò¶à¸ö¸½
¼ÓµÄ´¦Àí²ã¡£ÀýÈç¶ÁÎļþ²Ù×÷£¬Óû§Ó¦ÓóÌÐòµ÷ÓÃ×Óϵͳ¿âKernel32.dllÖеÄAPIº¯ÊýRea
dFile£¬ReadFile½Ó×ŵ÷ÓÃϵͳ¿âNtdll.dllÖеÄNtReadFile£¬NtReadFileͨ¹ýÒ»¸öÏÝÈëÖ¸
ÁINT2E£©½«´¦ÀíÆ÷ģʽÌáÉýÖÁring0¡£È»ºóNtoskrnl.exeÖеÄϵͳ·þÎñµ÷¶È³ÌÐòKiSyst
emService½«ÔÚϵͳ·þÎñµ÷¶È±íÖж¨Î»Ntoskrnl.exeÖеÄNtWReadFile²¢µ÷ÓÃÖ®£¬Í¬Ê±½â³ý
Öжϡ£´Ë·þÎñÀý³ÌÊÇI/O¹ÜÀíÆ÷µÄÒ»²¿·Ö¡£ËüÊ×Ïȼì²é´«µÝ¸øËüÃǵIJÎÊýÒÔ±£»¤ÏµÍ³°²È«»ò
·ÀÖ¹Óû§Ä£Ê½³ÌÐò·Ç·¨´æÈ¡Êý¾Ý£¬È»ºó´´½¨Ò»¸öÖ÷¹¦ÄÜ´úÂëΪIRP_MJ_READµÄIRP£¬²¢½«Ö®
Ë͵½ÎļþϵͳÇý¶¯³ÌÐòµÄÈë¿Úµã¡£ÒÔÏµĹ¤×÷»áÓÉÎļþϵͳÇý¶¯³ÌÐòÓë´ÅÅÌÇý¶¯³ÌÐò·Ö²ã
À´Íê³É¡£ÎļþϵͳÇý¶¯³ÌÐò¿ÉÒÔÖØÓÃÒ»¸öIRP»òÊÇÕë¶Ôµ¥Ò»µÄI/OÇëÇó´´½¨Ò»×é²¢Ðй¤×÷µÄ
¹ØÁª£¨associated£©IRP¡£Ö´ÐÐIRPµÄ´ÅÅÌÇý¶¯³ÌÐò×îºó¿ÉÄÜ»á·ÃÎÊÓ²¼þ¡£¶ÔÓÚPIO·½Ê½µÄÉè
±¸£¬Ò»¸öIRP_MJ_READ²Ù×÷½«µ¼ÖÂÖ±½Ó¶ÁÈ¡É豸µÄ¶Ë¿Ú»òÕßÊÇÉ豸ʵÏÖµÄÄÚ´æ¼Ä´æÆ÷¡£¾¡¹Ü
ÔËÐÐÔÚÄÚºËģʽÖеÄÇý¶¯³ÌÐò¿ÉÒÔÖ±½ÓÓëÆäÓ²¼þ»á»°£¬µ«ËüÃÇͨ³£¶¼Ê¹ÓÃÓ²¼þ³éÏó²ã(HAL
)·ÃÎÊÓ²¼þ£º¶Á²Ù×÷×îÖÕ»áµ÷ÓÃHal.dllÖеÄREAD_PORT_UCHARÀý³ÌÀ´´Óij¸öI/O¿Ú¶ÁÈ¡µ¥×Ö½ÚÊý¾Ý¡£
WINNT/2000ÏÂÉ豸ºÍÇý¶¯³ÌÐòµÄÓÐ×ÅÃ÷ÏÔ¶Ñջʽ²ã´Î½á¹¹£º´¦ÓÚ¶ÑÕ»×îµ×²ãµÄÉ豸¶ÔÏó³Æ
ΪÎïÀíÉ豸¶ÔÏ󣬻ò¼ò³ÆΪPDO£¬ÓëÆä¶ÔÓ¦µÄÇý¶¯³ÌÐò³ÆΪ×ÜÏßÇý¶¯³ÌÐò¡£ÔÚÉ豸¶ÔÏó¶ÑÕ»
µÄÖмäij´¦ÓÐÒ»¸ö¶ÔÏó³ÆΪ¹¦ÄÜÉ豸¶ÔÏ󣬻ò¼ò³ÆFDO£¬Æä¶ÔÓ¦µÄÇý¶¯³ÌÐò³ÆΪ¹¦ÄÜÇý¶¯³Ì
Ðò¡£ÔÚFDOµÄÉÏÃæºÍÏÂÃ滹»áÓÐһЩ¹ýÂËÆ÷É豸¶ÔÏó¡£Î»ÓÚFDOÉÏÃæµÄ¹ýÂËÆ÷É豸¶ÔÏó³ÆΪ
Éϲã¹ýÂËÆ÷£¬Æä¶ÔÓ¦µÄÇý¶¯³ÌÐò³ÆΪÉϲã¹ýÂËÆ÷Çý¶¯³ÌÐò£»Î»ÓÚFDOÏÂÃæ(µ«ÈÔÔÚPDOÖ®ÉÏ)
µÄ¹ýÂËÆ÷É豸¶ÔÏó³ÆΪϲã¹ýÂËÆ÷£¬Æä¶ÔÓ¦µÄÇý¶¯³ÌÐò³ÆΪϲã¹ýÂËÆ÷Çý¶¯³ÌÐò¡£ÕâÖÖÕ»
ʽ½á¹¹¿ÉÒÔʹI/OÇëÇó¹ý³Ì¸ü¼ÓÃ÷ÁË¡£Ã¿¸öÓ°Ïìµ½É豸µÄ²Ù×÷¶¼Ê¹ÓÃIRP¡£Í¨³£IRPÏȱ»Ë͵½
É豸¶ÑÕ»µÄ×îÉϲãÇý¶¯³ÌÐò£¬È»ºóÖð½¥¹ýÂ˵½ÏÂÃæµÄÇý¶¯³ÌÐò¡£Ã¿Ò»²ãÇý¶¯³ÌÐò¶¼¿ÉÒÔ¾ö
¶¨ÈçºÎ´¦ÀíIRP¡£ÓÐʱ£¬Çý¶¯³ÌÐò²»×öÈκÎÊ£¬½ö½öÊÇÏòϲ㴫µÝ¸ÃIRP¡£ÓÐʱ£¬Çý¶¯³ÌÐò
Ö±½Ó´¦ÀíÍê¸ÃIRP£¬²»ÔÙÏòÏ´«µÝ¡£»¹ÓÐʱ£¬Çý¶¯³ÌÐò¼È´¦ÀíÁËIRP£¬ÓÖ°ÑIRP´«µÝÏÂÈ¥¡£Õâ
È¡¾öÓÚÉ豸ÒÔ¼°IRPËùЯ´øµÄÄÚÈÝ¡£
ͨ¹ýÉÏÃæµÄ½éÉܿɵÃÖª£ºÈç¹ûÎÒÃÇÏëÀ¹½ØϵͳµÄÎļþ²Ù×÷£¬¾Í±ØÐëÀ¹½ØI/O¹ÜÀíÆ÷·¢ÏòÎļþ
ϵͳÇý¶¯³ÌÐòµÄIRP¡£¶øÀ¹½ØIRP×î¼òµ¥µÄ·½·¨Äª¹ýÓÚ´´½¨Ò»¸öÉϲã¹ýÂËÆ÷É豸¶ÔÏó²¢½«Ö®
¼ÓÈëÎļþϵͳÉ豸ËùÔÚµÄÉ豸¶ÑÕ»ÖС£¾ßÌå·½·¨ÈçÏ£ºÊ×ÏÈͨ¹ýIoCreateDevice´´½¨×Ô¼º
µÄÉ豸¶ÔÏó£¬È»ºóµ÷ÓÃIoGetDeviceObjectPointerÀ´µÃµ½ÎļþϵͳÉ豸£¨Ntfs£¬Fastfat£¬
Rdr»òMrxsmb£¬Cdfs£©¶ÔÏóµÄÖ¸Õ룬×îºóͨ¹ýIoAttachDeviceToDeviceStack½«×Ô¼ºµÄÉ豸
·Åµ½É豸¶ÑÕ»ÉϳÉΪһ¸ö¹ýÂËÆ÷¡£
ÕâÊÇÀ¹½ØIRP×î³£ÓÃÒ²ÊÇ×î±£Ïյķ½·¨£¬Art BakerµÄ¡¶Windows NTÉ豸Çý¶¯³ÌÐòÉè¼ÆÖ¸ÄÏ
¡·ÖÐÓÐÏêϸ½éÉÜ£¬µ«ÓÃËüʵÏÖ²¡¶¾ÊµÊ±¼à¿ØÈ´´æÔÚÁ½¸öÎÊÌ⣺ÆäÒ»ÕâÖÖ·½·¨Êǽ«¹ýÂËÆ÷·Å
µ½¶ÑÕ»µÄ×îÉϲ㣬µ±´æÔÚÆäËüÉϲã¹ýÂËÆ÷ʱ¾Í²»Äܱ£Ö¤¹ýÂËÆ÷ÕýºÃÔÚÎļþϵͳÉ豸֮ÉÏ£»
Æä¶þÓÉÓÚ¹ýÂËÆ÷É豸ÐèÒª±íÏֵĺÍÎļþϵͳÉ豸һÑù£¬ÕâÑùÆäËùÓÐÌØÐÔ¶¼Ðè´ÓÎļþϵͳÉè
±¸Öи´ÖÆ¡£ÁíÍâÎļþϵͳÇý¶¯¶ÔÏóÖе÷¶ÈÀý³Ì¹ýÂËÆ÷Çý¶¯±ØÐ붼֧³Ö£¬Õâ¾ÍÒâζ×ÅÎÒÃÇÎÞ
·¨Ê¹¹ýÂËÆ÷Çý¶¯Öеĵ÷¶ÈÀý³Ì¹©×Ô¼ºµÄring3¼¶¿Í»§³ÌÐòËùרÓã¬ÒòΪԱ¾·¢ÍùÎļþϵͳÇý
¶¯µ÷¶ÈÀý³ÌµÄIRPÏÖÔÚ¶¼»áÏÈ´Ó¹ýÂËÆ÷Çý¶¯µÄµ÷¶ÈÀý³ÌÖо¹ý¡£
ËùÒÔHooksys.sysûÓÐʹÓÃÉÏÊö·½·¨¡£ËüµÄ·½·¨¸ü¼òµ¥ÇÒ¸üΪֱ½Ó£ºËüÏÈͨ¹ýObReference
ObjectByNameµÃµ½ÎļþϵͳÇý¶¯¶ÔÏóµÄÖ¸Õ롣Ȼºó½«Çý¶¯¶ÔÏóÖÐMajorFunctionÊý×éÖеĴò
¿ª£¬¹Ø±Õ£¬Çå³ý£¬ÉèÖÃÎļþÐÅÏ¢£¬ºÍдÈëµ÷¶ÈÀý³ÌÈë¿ÚµØÖ·¸ÄΪHooksys.sysÖÐÏàÓ¦¹³×Óº¯
ÊýµÄÈë¿ÚµØÖ·À´´ïµ½À¹½ØIRPµÄÄ¿µÄ¡£¾ßÌå²Ù×÷ϸ½ÚÇë²Î¿´´úÂëÆÊÎöÒ»½Ú¡£
ÏÂÃæ½éÉÜÇý¶¯Óëring3Ï¿ͻ§³ÌÐòµÄͨÐż¼Êõ¡£ÓëWIN9XÏÂÇý¶¯Óëring3Ï¿ͻ§³ÌÐòͨÐż¼Êõ
Ïàͬ£¬NT/2000ÈÔȻ֧³ÖʹÓÃDeviceIoControlʵÏÖ´Óring3µ½ring0µÄµ¥ÏòͨÐÅ£¬µ«´Óring
0ͨ¹ýÅŶÓAPCÀ´»½ÐÑring3Ï̵߳ķ½·¨È´ÎÞ·¨Ê¹ÓÃÁË¡£ÔÒòÊÇÎÒûÓÐÕÒµ½Ò»¸ö¹«¿ªµÄº¯ÊýÀ´
ʵÏÖ£¨Walter OneyµÄÊéÖÐ˵´æÔÚÒ»¸öδ¹«¿ªµÄº¯ÊýʵÏÖ´Óring0ÅŶÓAPC£©¡£Æäʵ²»Í¨¹ýA
PCÎÒÃÇÒ²¿ÉÒÔͨ¹ýÃüÃûµÄʼþ/ÐźÅÁ¿¶ÔÏóÀ´ÊµÏÖË«Ïò»½ÐÑ£¬¶øÇÒÕâ¿ÉÄܱÈAPC¸üΪ¿É¿¿Ð©
¡£
¶ÔÏó¹ÜÀíÆ÷ÔÚWindows NT/2000ÄÚºËÖÐÕ¼Á˼«ÆäÖØÒªµÄλÖã¬ÆäÒ»¸ö×îÖ÷ÒªÖ°ÄÜÊÇ×éÖ¯¹ÜÀí
ϵͳÄں˶ÔÏó¡£ÔÚWindows NT/2000ÖУ¬Äں˶ÔÏó¹ÜÀíÆ÷´óÁ¿ÒýÈëÁËC++ÃæÏò¶ÔÏóµÄ˼Ï룬
¼´ËùÓÐÄں˶ÔÏ󶼷â×°ÔÚ¶ÔÏó¹ÜÀíÆ÷ÄÚ²¿£¬³ý¶ÔÏó¹ÜÀíÆ÷×Ô¼ºÒÔÍ⣬¶ÔÆäËûËùÓÐÏëÒýÓÃÄÚ
ºË¶ÔÏó½á¹¹³ÉÔ±µÄ×Óϵͳ¶¼ÊDz»Í¸Ã÷µÄ£¬Ò²¼´¶¼Ðèͨ¹ý¶ÔÏó¹ÜÀíÆ÷·ÃÎÊÕâЩ½á¹¹¡£Micros
oft¼«Á¦ÍƼöÄÚºËÇý¶¯´úÂë×ñÑÕâÒ»ÔÔò£¨Óû§Ì¬´úÂë¸ù±¾²»ÄÜÖ±½Ó·ÃÎÊÕâЩÊý¾Ý£©£¬ËüÌá
¹©ÁËһϵÁÐÒÔOb¿ªÍ·µÄÀý³Ì¹©ÎÒÃÇʹÓá£
ÄÚºËÒÑÃüÃû¶ÔÏó´æÓÚϵͳȫ¾ÖÃüÃûÄÚºËÇø£¬Ó봫ͳµÄDOSĿ¼ºÍÎļþ×éÖ¯·½Ê½ÏàËÆ£¬¶ÔÏó¹Ü
ÀíÆ÷Ò²²ÉÓÃÊ÷×´½á¹¹¹ÜÀíÕâЩ¶ÔÏó£¬ÕâÑù¿ÉÒÔ¿ìËÙ¼ìË÷Äں˶ÔÏó¡£µ±È»Ê¹ÓÃÕâÖÖÊ÷×´½á¹¹
×éÖ¯ÄÚºËÒÑÃüÃû¶ÔÏ󣬻¹ÓÐÁíÒ»¸öÓŵ㣬ÄǾÍÊÇʹËùÓÐÒÑÃüÃû¶ÔÏó×éÖ¯µÄÊ®·ÖÓÐÌõÀí£¬Èç
É豸¶ÔÏó´¦ÓÚ\DeviceÏ£¬¶ø¶ÔÏóÀàÐÍÃû³Æ´¦ÓÚ\ObjectTypesϵȵȡ£ÔÙÕßÕâÑùÒ²Äܴﵽʹ
Óû§Ì¬½ø³Ì½öÄÜ·ÃÎÊ\??Óë\BaseNamedObjectsϵĶÔÏ󣬶øÄÚºË̬´úÂëÔòûÓÐÈκÎÏÞÖƵÄ
Ä¿µÄ¡£ÖÁÓÚϵͳÄÚ²¿ÈçºÎ×éÖ¯¹ÜÀíÕâЩÒÑÃüÃû¶ÔÏó£¬ÆäʵWindows NT/2000ÄÚ²¿ÓÉÄں˱äÁ¿
ObpRootDirectoryObjectÖ¸ÏòµÄDirectory¶ÔÏó´ú±í¸ùĿ¼£¬Ê¹ÓùþÏ£±í(HashTable)À´×é
Ö¯¹ÜÀíÕâЩÃüÃûÄں˶ÔÏó¡£
Hooksys.sysÖÐʹÓÃÃüÃûµÄÐźÅÁ¿À´»½ÐÑring3¼¶Ï̡߳£¾ßÌå×ö·¨ÈçÏ£ºÊ×ÏÈÔÚguidll.dll
Öе÷ÓÃCreateSemaphore´´½¨Ò»¸öÃüÃûÐźÅÁ¿Hookopen²¢ÉèΪÎÞÐźÅ״̬£¬Í¬Ê±µ÷ÓÃCreat
eThread´´½¨Ò»¸öÏ̡߳£Ï̴߳úÂëµÄÈë¿Ú´¦Í¨¹ýµ÷ÓÃWaitForSingleObjectÔÚ´ËÐźÅÁ¿ÉϵÈ
´ý±»ring0¹³×Óº¯Êý»½ÐѲ鶾¡£Çý¶¯³ÌÐòÕâ±ßÔòÔÚ³õʼ»¯¹ý³ÌÖÐͨ¹ýδ¹«¿ªµÄÀý³ÌObRefer
enceObjectByName£¨\BaseNamedObjects\Hookopen£©µÃµ½ÃüÃûÐźÅÁ¿¶ÔÏóHookopenµÄÖ¸Õë
£¬µ±ËüÀ¹½Øµ½Îļþ´ò¿ªÇëÇóʱµ÷ÓÃKeReleaseSemaphore½«HookopenÖÃΪÓÐÐźÅ״̬»½ÐÑri
ng3¼¶µÈ´ý¼ì²é´ò¿ªÎļþµÄÏ̡߳£Æäʵguidll.dll¹²´´½¨ÁËÁ½¸öÃüÃûÐźÅÁ¿£¬»¹ÓÐÒ»¸öHoo
kcloseÓÃÓÚ»½ÐÑring3¼¶µÈ´ý¼ì²é¹Ø±ÕÎļþµÄÏ̡߳£
guidll.dllÖÐʹÓÃÃüÃûµÄʼþÀ´»½ÐÑÔÝʱ¹ÒÆðµÈ´ý²é¶¾Íê±ÏµÄring0¹³×Óº¯Êý¡£¾ßÌå×ö·¨Èç
Ï£ºHooksys.sysÔÚÆä³õʼ»¯¹ý³ÌÖÐͨ¹ýZwCreateEventº¯Êý´´½¨Ò»×éÃüÃûʼþ¶ÔÏ󣨴˴¦
±ØÐëºÏÀíÉèÖð²È«ÃèÊö·û£¬·ñÔòring3Ï߳̽«ÎÞ·¨Ê¹ÓÃʼþ¾ä±ú£©²¢µÃµ½Æä¾ä±ú£¬Í¬Ê±Í¨¹ý
ObReferenceObjectByHandleµÃµ½¾ä±úÒýÓõÄʼþ¶ÔÏóµÄÖ¸Õ롣ȻºóHooksys.sys½«ÕâÒ»×é
ʼþ¾ä±úºÍÖ¸Õë¶ÔÒÔ¼°Ê¼þÃû±£´æÔÚ±¸ÓÃÁ´±íµÄÿ¸öÔªËØÖУºring3ʹÓþä±ú£¬ring0ʹÓÃ
Ö¸Õë¡£µ±¹³×Óº¯ÊýÀ¹½Øµ½ÎļþÇëÇóʱËüÊ×ÏÈ»½ÐÑring3²é¶¾Ị̈߳¬È»ºóÂíÉϵ÷ÓÃKeWaitFor
SingleObjectÔÚÒ»¸öʼþ\BaseNamedObjects\HookxxxxÉϵȴý²é¶¾µÄÍê³É¡£¶ø±»»½ÐѵÄri
ng3²é¶¾Ïß³Ìͨ¹ýOpenEventAº¯ÊýÓÉʼþÃû×ֵõ½Æä¾ä±ú£¬ÔÚ½áÊø²é¶¾ºó·¢³öÒ»¸öSetEven
tµ÷Óý«Ê¼þÖÃΪÓÐÐźÅ״̬´Ó¶ø»½ÐÑring0¹ÒÆðµÄ¹³×Óº¯Êý¡£µ±È»£¬ÒÔÉÏÌÖÂÛ½öÏÞÓÚ´ò¿ª
Îļþ²Ù×÷£¬¹³×Óº¯ÊýÔÚÀ¹½Øµ½ÆäËüÎļþÇëÇóʱ²¢²»µ÷ÓÃKeWaitForSingleObjectµÈ´ý²é¶¾µÄ
Íê³É£¬¶øÊÇ»½ÐÑring3²é¶¾Ï̺߳óÖ±½Ó·µ»Ø£»ÏàÓ¦µÄring3²é¶¾Ïß³ÌÒ²¾Í²»±ØÔڲ鶾Íê³Éºó
µ÷ÓÃSetEvent½øÐÐÔ¶³Ì»½ÐÑ¡£
ÁíÍâÔÚ±àдNTÄÚºËģʽÇý¶¯³ÌÐòʱ»¹±ØÐë×¢ÒâһЩÊÂÏî¡£Ê×ÏÈÊÇÖжÏÇëÇ󼶣¨IRQL£©£¬Õâ
ÊÇÔÚ½øÐÐNTÇý¶¯±à³ÌʱÌرðÖµµÃ×¢ÒâµÄÎÊÌ⡣ÿ¸öÄÚºËÀý³Ì¶¼ÒªÇóÔÚÒ»¶¨µÄIRQLÉÏÔËÐУ¬
Èç¹ûÔÚµ÷ÓÃʱ²»ÄÜÈ·¶¨µ±Ç°IRQLÔÚÄĸö¼¶±ð£¬Ôò¿Éµ÷ÓÃKeGetCurrentIrql»ñÈ¡µ±Ç°µÄIRQL
Öµ²¢½øÐÐÅжϡ£ÀýÈçÓû»ñµÃÖ¸Ïòµ±Ç°½ø³ÌEprocessµÄÖ¸Õë¿ÉÒÔ¿¼ÂÇÏÈÅжϵ±Ç°µÄIRQL£¬Èç
´óÓÚµÈÓÚDISPATCH_LEVELʱ¿Éµ÷ÓÃIoGetCurrentProcess£»¶øµ±IRQLСÓÚµ÷¶È/ÑÓ³Ù¹ý³Ìµ÷
Óü¶±ðʱ£¨DISPATCH_LEVEL/DPC£©Ôò¿ÉʹÓÃPsGetCurrentProcessIdºÍPsLookupProcessBy
ProcessId¡£Æä´ÎҪעÒâµÄÎÊÌâÊÇ·ÖÒ³/·Ç·ÖÒ³ÄÚ´æ¡£ÓÉÓÚÖ´ÐÐÔÚÌáÉýµÄIRQL¼¶ÉÏʱϵͳ½«
²»ÄÜ´¦ÀíÒ³¹ÊÕÏ£¬ÒòΪϵͳÔÚAPC¼¶´¦ÀíÒ³¹ÊÕÏ£¬Òò¶øÕâÀï×ܵÄÔÔòÊÇ£ºÖ´ÐÐÔÚ¸ßÓÚ»òµÈÓÚ
DISPATCH_LEVEL¼¶ÉϵĴúÂë¾ø¶Ô²»ÄÜÔì³ÉÒ³¹ÊÕÏ¡£ÕâÒ²Òâζ×ÅÖ´ÐÐÔÚ¸ßÓÚ»òµÈÓÚDISPATCH
_LEVEL¼¶ÉϵĴúÂë±ØÐë´æÔÚÓÚ·Ç·ÖÒ³ÄÚ´æÖС£´ËÍ⣬ËùÓÐÕâЩ´úÂëÒª·ÃÎʵÄÊý¾ÝÒ²±ØÐë´æ
ÔÚÓÚ·Ç·ÖÒ³ÄÚ´æÖС£×îºóÊÇͬ²½»¥³âÎÊÌ⣬Õâ¶ÔÓÚÈ粡¶¾ÊµÊ±¼à¿ØµÈϵͳ·¶Î§¹²ÏíµÄÇý¶¯
³ÌÐòÓÈÏÔÖØÒª¡£ËäÈ»ÔÚHooksysÖÐûÓд´½¨¶àỊ̈߳¨PsCreateSystemThread£©£¬µ«ÓÉÓÚËü¹Ò
½ÓÁËϵͳÎļþ¹³×Ó£¬ÏµÍ³ÖÐËùÓÐÏ̵߳ÄÎļþÇëÇ󶼻á´ÓHooksysÖо¹ý¡£µ±Ò»¸öÏ̵߳ÄÎļþÇëÇó±»´¦Àí¹ý³ÌÖÐHooksys»áÈ¥·ÃÎÊһЩȫ¾Ö¹²ÏíµÄÊý¾Ý£¬Èç¹ýÂËÆ÷£¬
ÀúÊ·¼Ç¼µÈ£¬ÓпÉÄÜÔÚ·ÃÎʽøÐе½Ò»°ëʱ¸ÃÏß³ÌÓÉÓÚijÖÖÔÒò±»ÇÀÕ¼ÁË£¬½á¹ûÊÇÆäËüÏß³Ì
µÄÎļþÇëÇó¾¹ýʱHooksys·ÃÎʵĹ²ÏíÊý¾Ý½«ÊÇ´íÎóµÄ¡£Îª´ËÇý¶¯³ÌÐò±ØÐëºÏÀíʹÓÃ×ÔÐýËø
£¬»¥³âÁ¿£¬×ÊÔ´µÈÄÚºËͬ²½¶ÔÏó¶Ô¹²ÏíÈ«¾ÖÊý¾ÝµÄËùÓÐÏ߳̽øÐÐͬ²½¡£
3.4.2³ÌÐò½á¹¹ÓëÁ÷³Ì
ÒÔϵijÌÐò½á¹¹ÓëÁ÷³Ì·ÖÎöÀ´×ÔÒ»ÖøÃû·´²¡¶¾Èí¼þµÄWINNT/2000ʵʱ¼à¿ØNTÄÚºËģʽÉ豸
Çý¶¯³ÌÐòHooksys.sys£º
1.³õʼ»¯Àý³Ì£¨DriverEntry£©£ºµ÷ÓÃ_GetProcessNameOffsetÈ¡µÃ½ø³ÌÃûÔÚEprocessÖеÄ
Æ«ÒÆ¡£³õʼ»¯±¸Ó㬴ò¿ªÎļþµÈ´ý²Ù×÷£¬¹Ø±ÕÎļþ£¬ÀúÊ·¼Ç¼5¸öË«ÏòÑ»·Á´±í¼°ÓÃÓÚÁ´±í
²Ù×÷»¥³âµÄ4°Ñ×ÔÐýËøºÍ1¸ö¿ìËÙ»¥³âÁ¿¡£½«È«¾Ö±äÁ¿_IrqCount£¨IRP¼ÇÊý£©ÉèÖÃΪ0¡£´´½¨
жÔر£»¤ÓÃʼþ¶ÔÏó¡£ÎªÎļþÃû¹ýÂËÊý×é³õʼ»¯Í¬²½ÓÃ×ÊÔ´±äÁ¿¡£ÔÚϵͳȫ¾ÖÃüÃûÄÚºËÇø
ÖмìË÷HookopenºÍHookcloseÁ½¸öÃüÃûÐźÅÁ¿£¨ _CreateSemaphore£©¡£Îª±¸Óã¨_Allocat
eBuffer£©ºÍÀúÊ·¼Ç¼£¨_AllocatHistoryBuf£©Á´±íÔÚϵͳ·Ç·ÖÒ³³ØÖзÖÅä¿Õ¼ä£¬Í¬Ê±´´½¨
Ò»×éÃüÃûʼþ¶ÔÏóHookxxxx²¢±£´æÖÁ±¸ÓÃÁ´±íµÄÿ¸öÔªËØÖУ¨_CreateOneEvent£©¡£´´½¨Éè
±¸£¬ÉèÖÃÇý¶¯Àý³ÌÈë¿Ú£¬ÎªÉ豸½¨Á¢·ûºÅÁ¬½Ó¡£´´½¨´ÅÅÌÇý¶¯Æ÷É豸¶ÔÏóÖ¸Õ루_QuerySy
mbolicLink£©ºÍÎļþϵͳÇý¶¯³ÌÐò¶ÔÏóÖ¸Õ루_HookSys£©ÁÐ±í¡£
2.´ò¿ªÀý³Ì£¨IRP_MJ_CREATE£©£º½«±¸ÓÃÁ´±íÓÃϵͳ·Ç·ÖÒ³Äڴ棨Ê×µØÖ·±£´æÔÚ_SysBufAd
drÖУ©Ó³Éäµ½Óû§¿Õ¼äÖУ¨±£´æÔÚ_UserBufAddr£©ÒÔ±ã´ÓÓû§Ì¬¿ÉÒÔÖ±½Ó·ÃÎÊÕâ¶ÎÄڴ棨
_MapMemory£©¡£
3.É豸¿ØÖÆÀý³Ì£¨IRP_MJ_DEVICE_CONTROL£©£ºËü»á´ÓÈë¿ÚIRPµ±Ç°¶ÑÕ»µ¥ÔªÖÐÈ¡µÃÓû§³Ì
ÐòÀûÓÃDeviceIoControl´«ËͽøÀ´µÄIO¿ØÖÆ´úÂ루IoControlCode£©£¬ÒÔ´ËÅжÏÓû§³ÌÐòµÄ
Òâͼ¡£ºÍHooksys.sysÐͬ¹¤×÷µÄring3¼¶¿Í»§³ÌÐòguidll.dll»áÒÀ´ÎÏòHooksys.sys·¢ËÍI
O¿ØÖÆÇëÇóÀ´Íê³ÉһϵÁй¤×÷£¬¾ßÌå´ÎÐòºÍ´úÂ뺬ÒåÈçÏ£º
83003C2F£º½«guidllÈ¡µÃµÄÇý¶¯Æ÷ÀàÐÍÖµ´«¸øÇý¶¯£¨±£´æÔÚDriverType±äÁ¿ÖУ©£¬¸ù¾Ý´Ë
±äÁ¿ÖµµÄ²»Í¬£¬ÉèÖò»Í¬µÄµÈ´ý£¨KeWaitForSingleObject£©³¬Ê±Öµ£¬ÒòΪ·Ç¹Ì¶¨Çý¶¯Æ÷µÄ
¶Áдʱ¼ä»áÉÔ³¤Ð©¡£
83003C0F£º±£´æguidll´«Ë͵ÄÓû§Ö¸¶¨µÄÀ¹½ØÎļþµÄÀàÐÍ£¬ÆäʵÕâ¸öÀàÐ͹ýÂËÆ÷Ôڲ鶾ģ
¿éÖÐÒÑ´æÔÚ£¬ÕâÀïÔÙÉèÖÃÏÔÈ»ÊÇΪÁËÌá¸ß´¦ÀíЧÂÊ£ºËüÈ·±£²»»á½«·ÇÖ¸¶¨ÀàÐÍÎļþË͵½ri
ng3¼¶²é¶¾Ä£¿é£¬½ÚÊ¡ÁËͨÐŵĿªÏú¡£¾¹ý½âÎöµÄ¸÷ÎļþÀàÐ͹ýÂË¿éÖ¸Õ뽫±£´æÔÚ_gaFile
NameFilterArraÊý×éÖУ¬Í¬Ê±¸üйýÂËÏî¸öÊý_gNumOfFilters±äÁ¿µÄÖµ¡£
83003C13£ºÐÞ¸ÄÎļþϵͳÇý¶¯³ÌÐò¶ÔÏóµ÷¶ÈÀý³ÌÈë¿Ú£¬Æô¶¯À¹½ØÎļþ²Ù×÷µÄ¹³×Óº¯ÊýµÄ¹¤
×÷¡£
83003C17£º»Ö¸´ÎļþϵͳÇý¶¯³ÌÐòÔµ÷¶ÈÀý³ÌÈë¿Ú£¬Í£Ö¹À¹½ØÎļþ²Ù×÷µÄ¹³×Óº¯Êý¹¤×÷¡£
ÒÔÉÏÁгöµÄIO¿ØÖÆ´úÂëµÄ·¢³öÊǹ̶¨£¬¶øµ±¹³×Óº¯ÊýÆô¶¯ºó£¬»¹»á·¢³öһЩËæ»úµÄ¿ØÖÆ´ú
Â룺
83003C07£ºÇý¶¯½«´ò¿ªÎļþÁ´±íµÄÍ·ÔªËؼ´×îÏȵÄÇëÇó´ò¿ªµÄÎļþɾ³ý²¢²åÈëµ½µÈ´ýÁ´±í
β²¿£¬Í¬Ê±½«ÔªËصÄÓû§¿Õ¼äµØÖ·´«ËÍÖÁring3¼¶µÈ´ý²éɱ´ò¿ªÎļþµÄÏß³ÌÖд¦Àí¡£
83003C0B£ºÇý¶¯½«¹Ø±ÕÎļþÁ´±íµÄÍ·ÔªËؼ´×îÏȵÄÇëÇó¹Ø±ÕµÄÎļþɾ³ý²¢²åÈëµ½±¸ÓÃÁ´±í
β²¿£¬Í¬Ê±½«ÔªËØÖеÄÎļþÃû´®´«ËÍÖÁring3¼¶µÈ´ý²éɱ¹Ø±ÕÎļþµÄÏß³ÌÖд¦Àí
83003C1F£ºµ±²éµÃ¹Ø±ÕÎļþÊDz¡¶¾Ê±£¬¸üÐÂÀúÊ·¼Ç¼Á´±í¡£
ÏÂÃæ½éÉܹ³×Óº¯Êý_HookCreateDispatchºÍguidllÖеȴý²éɱ´ò¿ªÎļþµÄÏß³ÌÐͬ¹¤×÷Á÷³Ì
£¬¶ø¹Ø±Õ£¬Çå³ý£¬ÉèÖÃÎļþÐÅÏ¢£¬ºÍдÈë²Ù×÷µÄ´¦ÀíÓë´Ë´óͬСÒ죺
µ±ÎļþÇëÇó½øÈë¹³×Óº¯Êý_HookCreateDispatchºó£¬ËüÊ×ÏÈ´ÓÈë¿ÚIRPÖж¨Î»µ±Ç°µÄ¶ÑÕ»µ¥
Ôª²¢´ÓÖÐÈ¡µÃ´ú±í´Ë´ÎÇëÇóµÄÎļþ¶ÔÏó¡£È»ºóÅжϵ±Ç°½ø³ÌÊÇ·ñΪÎÒÃÇ×Ô¼º£¬ÈôÊÇÔò±ØÐë
·Å¹ýÈ¥£¬ÒòΪ²é¶¾Ä£¿éÖÐҪƵ·±µÄ½øÐÐÎļþ²Ù×÷£¬ËùÒÔÀ¹½ØÀ´×ÔravmonµÄÎļþÇëÇ󽫵¼ÖÂ
ÑÏÖصÄϵͳËÀËø¡£½ÓÏÂÀ´ÀûÓöÑÕ»µ¥ÔªÖеÄÎļþ¶ÔÏóÈ¡µÃÍêÕûµÄÎļþ·¾¶Ãû²¢È·±£Îļþ²»
ÊÇ£º\PIPE\£¬\IPC¡£Ö®ºó²éÕÒÀúÊ·¼Ç¼Á´±íÒÔÈ·¶¨¸ÃÎļþÊÇ·ñ×î½üÔø±»¼ì²é²¢¼Ç¼¹ý£¬Èô
ÔÚÀúÊ·¼Ç¼Á´±íÖÐÕÒµ½¹ØÓÚ¸ÃÎļþµÄ¼Ç¼²¢ÇҼǼδʧЧ¼´Æäʱ¼ä´ÁºÍµ±Ç°ÏµÍ³Ê±¼äÖ®²î
²»µÃ´óÓÚ1F4h£¬Ôò¿ÉÖ±½Ó´Ó¼Ç¼ÖжÁÈ¡²é¶¾½á¹û¡£ÈçÀúÊ·Á´±íÖÐûÓиÃÎļþµÄ¼Ç¼ÔòÀûÓÃ
±£´æµÄÎļþÀàÐ͹ýÂËÕóÁмì²éÎļþÊÇ·ñÔÚ±»À¹½ØµÄÎļþÀàÐÍÖ®ÁС£ÖÁ´Ë²Å½øÈëÕæÕýµÄ¼ì²é
´ò¿ªÎļþº¯Êý_RAVCheckOpenFile£¬´Ëº¯ÊýÈë¿Ú´¦ÏÈ´Ó±¸Ó㬵ȴý»ò¹Ø±ÕÁ´±íÍ·²¿ÕªµÃÒ»¿Õ
ÏÐÔªËØ£¨_GetFreeEntry£©²¢Ìî³äÖ®£¬ÈçÎļþ·¾¶ÃûÓòµÈ¡£½Ó׎«¿ÕÏÐÔªËؼÓÈë´ò¿ªÎļþÁ´
±íβ²¿²¢ÊÍ·ÅHookopenÐźÅÁ¿»½ÐÑring3ϵȴý¼ì²é´ò¿ªÎļþµÄÏ̡߳£È»ºóµ÷ÓÃKeWaitFor
SingleObjectÔÚ¿ÕÏÐÔªËØÖб£´æµÄÒ»¸öʼþ¶ÔÏóÉϵȴýring3²é¶¾µÄÍê³É¡£µ±¹³×Óº¯Êý¹ÒÆð
ºó£¬ring3²é¶¾Ï̵߳õ½Ö´ÐУºËü»áÏòÇý¶¯·¢³öÒ»IO¿ØÖÆÂëΪ83003C07µÄÇëÇóÒÔÈ¡µÃ´ò¿ªÎļþÁ´±íÍ·ÔªËؼ´±£´æ×îÏÈÌá½»¶øδ¾öµÄÎļþÇëÇó£¬Çý¶¯»á½«ÔªËØÓ³Éä
µ½Óû§¿Õ¼äÖеÄÆ«ÒƵØÖ·Ö±½Ó´«¸øËü¡£½Ó×ÅËüµ÷ÓÃRsEngine.dllÖеÄfnScanOneFileº¯Êý½ø
Ðв鶾²¢ÔÚÔªËØÖÐÉèÖò鶾½á¹û룬Íê±ÏºóÔÙ¶ÔÔªËØÖб£´æµÄʼþ¶ÔÏóµ÷ÓÃSetEvent»½ÐÑ
ÔÚ´ËʼþÉϵȴýµÄ¹³×Óº¯Êý¡£±»»½ÐѵĹ³×Óº¯Êý¼ì²é±»ring3²é¶¾´úÂëÉèÖõĽá¹ûλÒԴ˾ö
¶¨¸ÃÎļþÇëÇóÊDZ»²ÉÄɼ´µ÷Óñ£´æµÄÔµ÷¶ÈÀý³Ì»¹ÊDZ»È¡Ïû¼´µ÷ÓÃIofCompleteRequestÖ±
½Ó·µ»Ø£¬Í¬Ê±Ôö¼ÓÀúÊ·¼Ç¼¡£
ÒÔÉÏÖ»Êǹ³×Óº¯ÊýÓëring3Ïß³ÌÁ÷³ÌµÄÒ»¸ö¼òµ¥½éÉÜ£¬ÆäÖÐÊ¡ÂÔÁËÖîÈçÅжϹ̶¨Çý¶¯Æ÷£¬³¬
ʱµÈÄÚÈÝ£¬¾ßÌåϸ½ÚÇë²Î¿´guidll.dllºÍhooksys.sysµÄ·´»ã±à´úÂë×¢ÊÍ¡£
4.¹Ø±ÕÀý³Ì£¨IRP_MJ_CLOSE£©£ºÍ£Ö¹¹³×Óº¯Êý¹¤×÷£¬»Ö¸´ÎļþϵͳÇý¶¯³ÌÐòÔµ÷¶ÈÈë¿Ú£¨
_StopFilter£©¡£½â³ýµ½Óû§¿Õ¼äµÄÄÚ´æÓ³Éä¡£
5.жÔØÀý³Ì£¨DriverUnload£©£ºÍ£Ö¹¹³×Óº¯Êý¹¤×÷£¬»Ö¸´ÎļþϵͳÇý¶¯³ÌÐòÔµ÷¶ÈÈë¿Ú¡£
ɾ³ýÉ豸ºÍ·ûºÅÁ¬½Ó¡£É¾³ý³õʼ»¯Ê±´´½¨µÄÒ»×éÃüÃûʼþ¶ÔÏóHookxxxx£¬°üÀ¨½â³ýÖ¸ÕëÒý
Ó㬹رմò¿ªµÄ¾ä±ú¡£ÊÍ·ÅΪMDL£¨_pMdl£©£¬±¸ÓÃÁ´±í£¨_SysBufAddr£©£¬ÀúÊ·¼Ç¼Á´±í£¨
_HistoryBuf£©ºÍ¹ýÂËÆ÷·ÖÅäµÄÄÚ´æ¿Õ¼ä¡£É¾³ýΪÎļþÃû¹ýÂËÊý×é·ÃÎÊͬ²½ÉèÖõÄ×ÊÔ´±äÁ¿
£¨_FilterResource£©¡£½â³ý¶Ôϵͳȫ¾ÖÃüÃûÄÚºËÇøÖÐHookopenºÍHookcloseÁ½¸öÃüÃûÐźÅ
Á¿µÄÖ¸ÕëÒýÓá£
3.4.3HOOKSYS.SYSÄæÏò¹¤³Ì´úÂëÆÊÎö
3.4.3.1È¡µÃµ±Ç°½ø³ÌÃû³Æ´úÂë
³õʼ»¯Àý³ÌÖÐÈ¡µÃ½ø³ÌÃûÔÚEprocessÖÐÆ«ÒÆ
00011889 call ds:__imp__IoGetCurrentProcess@0 £»µÃµ½µ±Ç°½ø³ÌSystemµÄEprocessÖ¸
Õë
0001188F mov edi, eax £»Eprocess»ùµØÖ·
00011891 xor esi, esi £»³õʼ»¯Æ«ÒÆΪ0
00011893 lea eax, [esi+edi] £»É¨ÃèÖ¸Õë
00011896 push 6 £»½ø³ÌÃû³¤¶È
00011898 push eax £»É¨ÃèÖ¸Õë
00011899 push offset $SG8452 ; "System" £»½ø³ÌÃû´®
0001189E call ds:__imp__strncmp £»±È½ÏɨÃèÖ¸Õë´¦ÊÇ·ñΪ½ø³ÌÃû
000118A4 add esp, 0Ch £»»Ö¸´¶ÑÕ»
000118A7 test eax, eax £»²âÊԱȽϽá¹û
000118A9 jz short loc_118B9 £»ÕÒµ½ÔòÌø³öÑ»·
000118AB inc esi £»Ôö¼ÓÆ«ÒÆÁ¿
000118AC cmp esi, 3000h £»ÔÚ12K·¶Î§ÖÐɨÃè
000118B2 jb short loc_11893 £»ÔÚ·¶Î§Ö®ÄÚÔò¼ÌÐø±È½Ï
¹³×Óº¯Êý¿ªÊ¼´¦È¡µÃµ±Ç°½ø³ÌÃû
00010D1E call ds:__imp__IoGetCurrentProcess@0 £»µÃµ½µ±Ç°½ø³ÌSystemµÄEprocess
Ö¸Õë
00010D24 mov ecx, _ProcessNameOffset £»È¡µÃ±£´æµÄ½ø³ÌÃûÆ«ÒÆÁ¿
00010D2A add eax, ecx £»µÃµ½Ö¸Ïò½ø³ÌÃûµÄÖ¸Õë
3.4.3.2Æô¶¯¹³×Óº¯Êý¹¤×÷´úÂë
000114F4 push 4 £»Ô¤ÏȽ«ÎļþϵͳÇý¶¯¶ÔÏó¸öÊýѹջ
000114F6 mov esi, offset FsDriverObjectPtrList £»È¡µÃÎļþϵͳÇý¶¯¶ÔÏóÖ¸ÕëÁбí
Æ«ÒƵØÖ·
000114FB pop edi £»ÓÃEDI×ö¼ÇÊýÆ÷£¬³õʼֵΪ4
000114FC mov eax, [esi] £»È¡µÃµÚÒ»¸öÇý¶¯¶ÔÏóµÄÖ¸Õë
000114FE test eax, eax £»²âÊÔÊÇ·ñºÏ·¨
00011500 jz short loc_11548 £»²»ºÏ·¨Ôò¼ÌÐøÏÂÒ»¸öÐÞ¸ÄÇý¶¯¶ÔÏó
00011502 mov edx, offset _HookCreateDispatch@8 £»È¡µÃ×Ô¼ºµÄ¹³×Óº¯ÊýµÄÆ«ÒƵØÖ·
00011507 lea ecx, [eax+38h] £»È¡µÃ¶ÔÏóÖдò¿ªµ÷¶ÈÀý³Ì£¨IRP_MJ_CREATE£©Æ«ÒÆ
0001150A call @InterlockedExchange@8 £»Ô×Ó²Ù×÷£¬Ìæ»»Çý¶¯¶ÔÏóÖдò¿ªµ÷¶ÈÀý³ÌµÄ
Èë¿ÚΪ¹³×Óº¯ÊýµÄÆ«ÒƵØÖ·
0001150F mov [esi-10h], eax £»±£´æÔ´ò¿ªµ÷¶ÈÀý³ÌµÄÈë¿Ú
3.4.3.3Ó³ÉäϵͳÄÚ´æÖÁÓû§¿Õ¼ä´úÂë
0001068E push esi £»ÏµÍ³ÄÚ´æ´óС
0001068F push _SysBufAddr £»ÏµÍ³ÄÚ´æ»ùµØÖ·
00010695 call ds:__imp__MmSizeOfMdl@8 £»¼ÆËãÃèÊöϵͳÄÚ´æËùÐèÄÚ´æÃèÊö·û±í£¨MD
L£©´óС
0001069B push 206B6444h £»µ÷ÊÔÓñêÇ©
000106A0 push eax £»MDL´óС
000106A1 push 0 £»ÔÚϵͳ·Ç·ÖÒ³ÄÚ´æ³ØÖзÖÅä
000106A3 call ds:__imp__ExAllocatePoolWithTag@12 £»ÎªMDL·ÖÅäÄÚ´æ
000106A9 push esi £»ÏµÍ³ÄÚ´æ´óС
000106AA mov _pMdl, eax £»±£´æMDLÖ¸Õë
000106AF push _SysBufAddr £»ÏµÍ³ÄÚ´æ»ùµØÖ·
000106B5 push eax £»MDLÖ¸Õë
000106B6 call ds:__imp__MmCreateMdl@12 £»³õʼ»¯MDL
000106BC push eax £»MDLÖ¸Õë
000106BD mov _pMdl, eax £»±£´æMDLÖ¸Õë
000106C2 call ds:__imp__MmBuildMdlForNonPagedPool@4
£»ÌîдMDLºóÎïÀíÒ³ÃæÊý×é
000106C8 push 1 £»·ÃÎÊģʽ
000106CA push _pMdl £»MDLÖ¸Õë
000106D0 call ds:__imp__MmMapLockedPages@8 £»Ó³ÉäMDLÃèÊöµÄÎïÀíÄÚ´æÒ³Ãæ
......
000106DB mov _UserBufAddr, eax £»±£´æÓ³ÉäºóµÄÓû§¿Õ¼äµØÖ·
_UserBufAddr ºÍ_SysBufAddrÓ³Éäµ½ÏàͬµÄÎïÀíµØÖ·¡£
½á ÂÛ
ÖÁ´Ë±¾ÂÛÎÄÒѸæ׫дÍê±Ï¡£±¾ÂÛÎÄÔÚ½éÉÜÁËÖî¶àÄ¿Ç°½ÏΪÁ÷ÐеIJ¡¶¾¼¼Êõºó×ÅÖØÌÖÂÛÁ˵±
½ñÁ½´ó·´²¡¶¾¼¼Êõ£ºÐéÄâ»úºÍʵʱ¼à¿Ø¡£
ÎÒ²ÎÓ뿪·¢µÄw32encodeÊÇÒ»¸ö¹¦ÄÜÍ걸Çҽṹ¸´ÔÓµÄÉÌÓÃÐéÄâ»ú£¬ËüÊôÓÚ32λ×Ôº¬Ö¸Áîʽ
ÐéÄâ»ú£¬ÓëÆäËüËÑË÷Çå³ýÄ£¿éºÏ²¢ÔÚÒ»Æð×é³ÉÁËÒ»¸ö¹¦ÄÜÇ¿´óµÄ·´²¡¶¾ÒýÇæ¡£ËäȻĿǰËü
»¹²»ÄÜÖ§³ÖËùÓеÄ386+Ö¸Á£¬µ«´ÓÆä²éɱ¶¾µÄÔËÐÐЧ¹ûÀ´¿´½á¹û»¹ÊǷdz£ÁîÈËÂúÒâµÄ£º
ÆÕͨµÄ¼ÓÃܱäÐβ¡¶¾¿ÉÒÔÔÚÐéÄâ»úĬÈϵĴ¦Àí³£Ê½Öвéɱ£»ÌØÊâµÄ£¬Èçhps,marburgµÈ¸´ÔÓ
¼ÓÃܱäÐβ¡¶¾Ôò¿Éͨ¹ýÏòÐéÄâ»úÖÐÌí¼ÓÉÙÁ¿µÄ²¡¶¾Ìض¨´¦Àí´úÂëÀ´Íê³É²éɱ¡£ÓÉÓÚ·´ÐéÄâ
Ö´Ðм¼ÊõµÄ³öÏÖ£¬ËùÒÔ½ñºó¶Ô´ËÐéÄâ»úÔ´´úÂëµÄ¸üÐÂ--ÏòÆäÖÐÌí¼Ó¸ü¶àµÄ¶Ô²Ù×÷ϵͳ»úÖÆ
µÄÖ§³Ö--»òÕßÖØд--³ÉΪÕæÕýµÄÐéÄâ»úÆ÷¶ø·ÇÐéÄâCPU--½«ÊDz»¿É±ÜÃâµÄ¡£
ͬʱ£¬ÎÒͨ¹ýÄæÏò¹¤³Ìij·´²¡¶¾Èí¼þµÄʵʱ¼à¿Ø³ÌÐò£¬ÔÚϵͳÔÀíºÍÇý¶¯±à³ÌÉÏÓÖÓÐÁËÐÂ
µÄÈÏʶ£¬²¢ÇÒËü´ó´óÔöÇ¿ÁËÎҵķ´»ã±à¹¦Á¦¡£½ñºóÎһὫעÊ͵ķ´»ã±à´úÂë±àд³ÉCÓïÑÔ°æ
Ô´´úÂ룬²¢°Ñ²¡¶¾É¨ÃèÄ£¿éÒƵ½ÏµÍ³ºËÐÄ̬Ϲ¤×÷£¬´Ó¶øʹÕû¸ö¹¤³Ì±äΪ¡°Ö÷¶¯µÄÓëÄÚºË
ÎÞ·ìÁ¬½Ó¡±Ê½¼à¿Ø¡£
×ÜÖ®µ±½ñ·´²¡¶¾¼¼ÊõµÄÖ÷Á÷·¢Õ¹·½ÏòÊÇÆÁÆú´«Í³µÄÌØÕ÷ÂëɨÃ裬´´½¨ÖÇÄܵļà¿ØÓëÐÐΪ·Ö
ÎöÒýÇ棬Õâ¾Í±ØȻҪÇó¸ü¼ÓÏȽøµÄÐéÄâ»úºÍʵʱ¼à¿Ø¼¼Êõ¡£
Ö л
ÔÚÕâ´Î±ÏÒµÉè¼ÆÖУ¬ÎÒÊ×ÏÈÌرðÒª¸ÐлµÄÊÇÎÒµÄÖ¸µ¼½ÌʦÕÔ²©Ê¿£¬ÊÇËûÔÚ°Ùæ֮ÖжÔÎÒÄÍ
Ðĵĸ¨µ¼²ÅʹÕâ´Î±ÏÒµÉè¼Æ˳ÀûÍê³É¡£
Æä´Î£¬¶ÔÎÒµÄÁªÏµ½ÌʦµËÀÏʦ±íʾÎÒµÄ×îÕæ³ÏµÄ¸Ðл¡£ËäÈ»ÎҺ͵ËÀÏʦ½Ó´¥µÄʱ¼ä²»ÊǺÜ
³¤£¬µ«ËýµÄÈÈÐijϿҺÍÈÏÕ渺Ôð¸øÎÒÁôÏÂÁËÉî¿ÌµÄÓ¡Ïó¡£
×îºó£¬ÎÒ»¹ÒªÏò±±¾©XXµçÄÔ¼¼Êõ¿ª·¢ÔðÈÎÓÐÏÞ¹«Ë¾µÄ¼¸Ãûͬʱíʾ¸Ðл¡£ËûÃÇÔÚ¼¼ÊõÉϸø
ÓèÁËÎҺܴóµÄÖ§³Ö£¬²¢ÇÒÕýÊÇËûÃÇÌṩÁ˲¡¶¾Ñù±¾²ÅʹµÃ±¾ÂÛÎÄÖÐÏà¹Ø²¿·ÖµÃÒÔÍê³É¡£
Ö÷Òª²Î¿¼ÎÄÏ×
David A. Solomon, Mark Russinovich ¡¶Inside Microsoft Windows 2000¡·September
2000
David A. Solomon ¡¶Inside Windows NT¡· May 1998
Prasad Dabak£¬Sandeep Phadke£¬Milind Borate ¡¶Undocumented Windows NT¡·October
1999
Matt Pietrek ¡¶Windows 95 System Programming Secrets¡· March 1996
Walter Oney ¡¶System Programming for Windows 95¡· March 1996
Walter Oney ¡¶Programming the Windows Driver Model¡· 1999
½÷ë ¡¶WINDOWS9XÎļþ¶ÁдInternal¡·2001
--
¡ù À´Ô´:£®¹þ¹¤´ó×϶¡Ïã bbs.hit.edu.cn [FROM: 218.108.198.232]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º615.393ºÁÃë