<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>www.reversecore.com</title>
		<link>http://www.reversecore.com/</link>
		<description>-= 리버싱 연구 =-</description>
		<language>ko</language>
		<pubDate>Mon, 05 Dec 2011 11:57:51 +0900</pubDate>
		<generator>Tistory 1.1 (http://www.tistory.com/)</generator>
		<managingEditor>reversecore</managingEditor>
		<image>
		<title>www.reversecore.com</title>
		<url><![CDATA[http://cfs12.tistory.com/upload_control/download.blog?fhandle=YmxvZzM1Mjc5OEBmczEyLnRpc3RvcnkuY29tOi9hdHRhY2gvMC8yMTAwMDAwMDAwMDAucG5n]]></url>
		<link>http://www.reversecore.com/</link>
		<description>-= 리버싱 연구 =-</description>
		</image>
		<item>
			<title>책 원고 작성 완료!</title>
			<link>http://www.reversecore.com/95</link>
			<description>&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;안녕하세요. ReverseCore 입니다.&amp;nbsp;&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;책 원고 작성을 완료하였습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;모든 컨텐츠 작성을 마치고 자체 퇴고(8회)를 완료하였습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;이제 출판사에 넘겨줄 수 있겠네요. ^^~&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;P style=&quot;BACKGROUND-COLOR: transparent; MARGIN: 0px&quot;&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile22.uf.tistory.com/original/20078A434EDB8EF60FEBD4&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;IMG_3826.jpg&quot; height=&quot;600&quot; width=&quot;448&quot;/&gt;&lt;/div&gt;&lt;/P&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;DIV style=&quot;TEXT-ALIGN: center; BACKGROUND-COLOR: transparent&quot;&gt;&amp;lt;퇴고 작업을 도와준 아이패드&amp;gt;&lt;/DIV&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent; FONT-SIZE: 14pt&quot;&gt;&lt;B&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;분량&lt;/FONT&gt;&lt;/B&gt;&lt;/SPAN&gt;&lt;br /&gt;

&lt;DIV style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;
&lt;HR style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/DIV&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;8섹션, 61챕터, A4 기준 1000 페이지 입니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;885 개의 이미지와 65 개의 소스파일이 담겨있습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;책 이름도 결정 하였습니다. (나중에 공개할 께요~ ^^)&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;&lt;SPAN style=&quot;FONT-SIZE: 14pt&quot;&gt;내용&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;

&lt;DIV style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;
&lt;HR style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/DIV&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;기존 블로그의 내용 60% + 새로운 컨텐츠 40% 로 구성하였습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;블로그에 있는 내용들은 Windows XP + Visual C++ 6.0/2008 환경에서 작업했었습니다. 이를 최신 Windows 7 32bit + Visual C++ 2010 환경으로 재작업을 하였구요. 컨텐츠들의 순서 조정에 많은 고민을 하였습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;새로 추가된 내용들은 아래와 같습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;FONT style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span color=#5c7fb0&gt;&lt;br /&gt;
&lt;/FONT&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent; COLOR: rgb(92,127,176)&quot; class=Apple-style-span&gt;
&lt;DIV style=&quot;BORDER-BOTTOM: rgb(121,165,228) 1px solid; BORDER-LEFT: rgb(121,165,228) 1px solid; PADDING-BOTTOM: 10px; BACKGROUND-COLOR: rgb(219,232,251); PADDING-LEFT: 10px; PADDING-RIGHT: 10px; BORDER-TOP: rgb(121,165,228) 1px solid; BORDER-RIGHT: rgb(121,165,228) 1px solid; PADDING-TOP: 10px&quot; class=txc-textbox&gt;
&lt;P style=&quot;MARGIN: 0px&quot;&gt;&lt;br /&gt;
64 bit Computing / Debugging&lt;FONT class=Apple-style-span color=#5c7fb0&gt;&lt;br /&gt;
고급 리버싱 (TLS, TEB, PEB, SEH, IA-32 Instruction 해석)&lt;br /&gt;
Anti-Debugging (Static, Dynamic, Advanced)&lt;br /&gt;
디버깅 실습 (Service, Self-Creation, PEImageSwitching, DebugBlocker)&lt;br /&gt;
&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;br /&gt;
&lt;/SPAN&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;&lt;SPAN style=&quot;FONT-SIZE: 14pt&quot;&gt;일정&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;

&lt;DIV style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;
&lt;HR style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/DIV&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;2010년 5월 1일 책을 쓰기로 마음 먹고 2011년 12월 3일 원고를 마감하였네요. 원고 작업만 19 개월 소요되었군요. (블로그 시작한날인 2009년 2월부터 따져보면 벌써 약 33 개월이 지났네요.)&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;아직까지는 제 인생 최대의 프로젝트라고 말할 수 있겠습니다. ^^&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;2011년 6월말쯤 8장 마지막 챕터를 끝내고 책에 뭐 빼먹은게 없나 살펴보니, 문득&amp;nbsp;제가 애초에 기획했던 모든 컨텐츠 작성을 끝냈다는 사실을 깨달았습니다. &lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;약간 멍~ 했죠. 조금 재충전을 하고 퇴고 작업에 들어갔습니다. 노트북으로 들고 다니며 보는데 한계가 있어서 문서를 출력해서 보다가 분량이 너무 많아서 힘들었습니다. 그래서 아이패드에 문서를 전부 입력하고 PDF Viewer 앱과 터치펜으로 퇴고 작업을 했습니다. (퍼포먼스가 확 향상되더군요.) 약 5 개월간의 기나긴 퇴고 작업 끝에 드디어 원고를 탈고 할 수 있었습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;마침 아내가 아기와 외출한 시간(12월 3일 토요일 오후 6시)에 제가 계획한 8 단계 퇴고작업의 마지막 작업을 끝마칠 수 있었네요.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent; FONT-SIZE: 12pt&quot;&gt;&lt;B&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;&lt;SPAN style=&quot;FONT-SIZE: 14pt&quot;&gt;소감&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;

&lt;DIV&gt;
&lt;HR style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/DIV&gt;&lt;/SPAN&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;일단 기분이 몹시 좋습니다. 몸과 마음이 날아갈듯 하네요.&amp;nbsp;^^&amp;nbsp;&lt;/SPAN&gt;&lt;br /&gt;
마치 오랜 여행을 마치고 집에 돌아온 느낌이 드네요.&amp;nbsp;기쁜 마음에 이렇게 블로그에 글을 올려 봅니다.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;# 작업 속도&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;책을 쓸 때는 생각보다 작업 속도가 너무 느려서 도대체 언제쯤 책이 완성될 수 있을까 싶었습니다. 하루에 그림 하나 또는 캡쳐 두개 정도 밖에 못 할 때도 많았거든요. 하지만 그런 날들이 하루 이틀 쌓이니까 어느 순간부터는 &quot;내가 언제 이렇게 많은 일을 했지?&quot; 라는 생각이 들면서 목표 지점이 희미하게나마 보이기 시작했습니다.&amp;nbsp;&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;# 재작업&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;책을 쓰면서 가장 힘들었던 순간은 이미 한번 쓴 글을 두번 세번 다시 쓸 때 였습니다. 독자분들께 최신의 리버싱 경험을 드리기 위해 개발도구를 Visual C++ 2010 으로 바꾸고 작업환경을 Windows 7 으로 바꾸었습니다. 그러다보니 기존 문서를 그에 맞게 다시 캡쳐하고 변경된 주소를 찾아 고치는 작업들이 많았습니다. 지금와서 뒤돌아보니 그런 작업들이 가장 기억에 많이 남습니다.&amp;nbsp;&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;# 슬럼프&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;10 여회의 크고 작은 슬럼프를 경험하였습니다. 수많은 재작업과 검증, 생각대로 나오지 않는 글쓰기, 예상보다 훨씬 오래 걸리는 시간, 개인적인 외부 요인 등으로 인해서 글을 쓰지도 못하고 글쓰기 자체가 싫어지는 상황이 몇 번 닥쳤었죠. 스트레스가 쌓인 겁니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;제가 새벽에 일어나 글을 쓰는 책상이 있는데요, 어느 순간에는 그쪽을 쳐다보기도 싫어지더군요. 그리고 저녁에는 퇴근 후 글을 쓰러 찾아가는 도서관이 있습니다. 한때는 그쪽으로 발길이 도저히 떨어지지 않는 날도 많았습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;다행인것은 그때마다 제 자신이 슬럼프 상황인걸 인식하고 극복하려고 노력했다는 것입니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;# 응원&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;가끔 블로그에 방문해서 댓글에 답변도 달아드리고 제 책을 응원하는 글을 보면서 힘을 얻곤 했습니다. 그리고 부모님, 아내, 친구들, 회사 동료들까지 많은 분들께서 관심을 가져주시고 격려를 해주셨습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;이 자리를 빌어서 모든 분들께 감사 드립니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;그리고 제가 좋아하는 독서도 많이 하고 사람들과 많이 어울려 다니면서 다시 용기를 얻어서 작업을 이어나갈 수 있었습니다. 그러다 결국 여기까지 올 수 있었구요.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;&lt;U&gt;&quot;포기하기 전까지 실패란 없다. 시행착오가 있을 뿐이다. 시행착오를 거듭하다보면 언젠가 결국 성공하게 된다.&quot;&lt;/U&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;위 명언을 계속 새기면서 포기하지 않고 꾸준히 작업했더니 결국 원고가 완성되었습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B style=&quot;BACKGROUND-COLOR: transparent&quot;&gt;&lt;FONT class=Apple-style-span color=#5c7fb0&gt;# 앞으로...&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;출판사와의 일정이 잡히면 블로그에 다시 공지해 드리겠습니다.&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;원고 작업을 한번 성공하니 자신감이 충만해 지는게 느껴집니다. 이번에 많은 경험과 시행착오를 겪어보니&amp;nbsp;두 번째 책도 금방 쓸 수 있을 것 같은 기분입니다.&amp;nbsp;(2 탄을 기획 중인데요. 구체적으로 정리되면 알려드릴께요~)&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;SPAN style=&quot;BACKGROUND-COLOR: transparent&quot; class=Apple-style-span&gt;다시 한번 모든 분들께 감사 드립니다. ^^~&lt;/SPAN&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;B&gt;&lt;FONT style=&quot;BACKGROUND-COLOR: rgb(255,255,190)&quot; class=Apple-style-span color=#5c7fb0&gt;ReverseCore&lt;/FONT&gt;&lt;/B&gt;&lt;br /&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=23178232&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>column</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>리버스코어</category>
			<category>소프트웨어 역공학</category>
			<category>원고</category>
			<category>책</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/95</guid>
			<comments>http://www.reversecore.com/95#entry95comment</comments>
			<pubDate>Mon, 05 Dec 2011 01:44:12 +0900</pubDate>
		</item>
		<item>
			<title>InjDll64.exe 버전업! - 64bit 지원</title>
			<link>http://www.reversecore.com/93</link>
			<description>&lt;br /&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
기존 InjDll.exe 유틸리티를 업그레이드(Ver. 1.1.1) 하였습니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&amp;nbsp;&amp;nbsp;1. 64bit 지원&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&amp;nbsp;&amp;nbsp;2. &amp;lt;dll path&amp;gt; 의 상대 경로 지원&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
☞&amp;nbsp;&lt;a href=&quot;http://www.reversecore.com/76&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/76]로 이동합니다.&quot;&gt;InjDll.exe - DLL Injection/Ejection 전용 도구&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: 굴림; font-size: 9pt; line-height: 1.5; background-color: transparent; &quot;&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div style=&quot;background-color: transparent; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot;&gt;Windows 7 64bit OS 가 보급됨에 따라 &lt;/font&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;리버싱 분야에도 점차 64bit 지원 여부가 중요한 이슈&lt;/font&gt;&lt;/b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot;&gt;가 되고 있습니다. 저 또한 최근에 64bit 관련 내용을 공부하면서 흥미로운 내용을 많이 접하였습니다. (이번에 작업 중인 리버싱 책에 64bit 리버싱 챕터를 추가시켰습니다.)&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;각 플랫폼(32/64bit) 별로 Dll Injection 을 하실 때 다음의 내용을 주의해 주시기 바랍니다.&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;- Target 프로세스가 32bit 인 경우 : Injector &amp;amp; Dll =&amp;gt; 모두 32bit (PE32 포멧)&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;- Target 프로세스가 64bit 인 경우 : Injector &amp;amp; Dll =&amp;gt; 모두 64bit (PE32+ 포멧)&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 64bit OS 에서는 32/64bit 프로세스가 모두 실행 가능하므로, Target 프로세스의 PE 포멧을 확인 하신 후 적절한 Injector(InjDll32/InjDll64) 와 DLL 을 사용하시면 됩니다.&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: rgb(51, 51, 51); &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* PE32+ 포멧의 파일을 생성하시려면 &lt;b&gt;&lt;i&gt;Visual C++ 2010 Express &amp;amp; Windows SDK &lt;/i&gt;&lt;/b&gt;를 설치하시면 됩니다.&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); &quot;&gt;
&lt;div style=&quot;background-color: transparent; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190);&quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#333333&quot; face=&quot;굴림&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; &quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; &quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; &quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; &quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; &quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; background-position: initial initial; background-repeat: initial initial; &quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; background-position: initial initial; background-repeat: initial initial; &quot;&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=10798142&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>column</category>
			<category>64</category>
			<category>64bit</category>
			<category>64bit 리버싱</category>
			<category>dll</category>
			<category>DLL Injection</category>
			<category>Ejection</category>
			<category>InjDll</category>
			<category>InjDll32</category>
			<category>InjDll64</category>
			<category>it</category>
			<category>PE</category>
			<category>PE32</category>
			<category>PE32+</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>windows 7</category>
			<category>리버스코어</category>
			<category>리버싱</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/93</guid>
			<comments>http://www.reversecore.com/93#entry93comment</comments>
			<pubDate>Fri, 29 Oct 2010 23:06:00 +0900</pubDate>
		</item>
		<item>
			<title>도대체 리버싱을 어떻게 공부해야 하나요?</title>
			<link>http://www.reversecore.com/92</link>
			<description>&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&quot;리버싱 공부를 어떻게 시작해야 할지 모르겠어요. 도와주세요.&quot; 라는 질문을 종종 받곤 합니다. 제가 블로그 활동을 하는 이유는 우리나라의 리버싱 기술 수준을 향상시키고, 리버싱 기술을 널리 전파하는데 작은 힘을 보태는 것입니다.&amp;nbsp;특히 리버싱에 처음 입문하시는 분들께 길잡이 역할을 할 수 있다면 더이상 바랄게 없습니다. &lt;br /&gt;
&lt;br /&gt;
과연 어떻게 하면 리버싱을 잘 할 수 있을지 제 생각을 얘기해 드리겠습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;1. 모든 공부에는 &quot;목표&quot;가 있어야 합니다.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&quot;리버싱 전문가가 되기 위해&quot;, &quot;취직을 위해&quot;, &quot;흥미를 위해&quot;, &quot;해커가 되기 위해&quot; 등의 자신만의 목표가 필요합니다. 이러한&amp;nbsp;목표가 없으면 힘든 공부를 지속하기 어렵습니다. (도중 포기할 확률이 높아진다는 뜻입니다.) 목표는 여러분들에게 방향을 제시합니다. 그 목표를 향해 한발 한발 전진하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;b&gt;2. &quot;긍정적인 마인드&quot;를 가지세요.&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
잘못된 편견을 가지신 분들이 많이 계십니다.&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;- &quot;저는 C 언어도 모르는데요... 리버싱을 할 수 있을까요?&quot; &amp;nbsp;---&amp;gt;&amp;gt;&amp;gt; 물론이죠.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;- &quot;저는 어셈블리를 해본적이 없는데요... 리버싱을 못 하겠지요?&quot; ---&amp;gt;&amp;gt;&amp;gt; 천만에요. 잘 하실 수 있습니다.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;- &quot;저는 윈도우즈 구조를 전혀 모르는데요... 그래도 리버싱을 할 수 있을까요?&quot; ---&amp;gt;&amp;gt;&amp;gt; 무지 잘하게 되실 겁니다.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
바로 위와 같이 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;저는 XXX 를 모르는데요&quot;&lt;/font&gt;&lt;/b&gt; 라던지 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;저는 YYY 를 해본적이 없는데요&quot;&lt;/font&gt;&lt;/b&gt; 라는 말은 리버싱을 공부할 때 전혀 의미없는 말입니다. 이런 말은 지레 겁을 먹게 만들고, 도전 의식을 꺾어버립니다. 시도조차 못해보고 포기하게 만드는 부정적인 말입니다. 오히려 &quot;XXX 를 모르기 때문에 배우고 싶다&quot; 라고 긍정적인 생각을 해보시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
배워야 할 가짓수를 따지자면 수십 가지가 넘을 것입니다.&amp;nbsp;리버싱 초보자가 그걸 처음부터 다 배워야 할까요?&amp;nbsp;너무 힘들겠지요. 지겨워질 겁니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그냥 새로운 내용이 튀어 나올때마다 다 해결하고 넘어가려고 하지 마시고&amp;nbsp;일단 맘에 묻어두시고 계속 진행하시는 것이 중요합니다. 반복 학습 하는 과정에서 한가지씩 차츰 차츰 배워나가시면 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
예를 들어 &lt;b&gt;&lt;i&gt;&quot;XOR EAX, EAX&quot;&lt;/i&gt;&lt;/b&gt; 의 의미는 디버깅을 몇 번 해보시면 저절로 체감하게 되는 내용입니다.&amp;nbsp;처음 볼때나 낯설고 흥미롭지요. 하지만 100번 봤다고 생각해 보세요.&amp;nbsp;그냥 당연하게 받아들이게 됩니다. 오히려 같은 의미의&amp;nbsp;&lt;b&gt;&lt;i&gt;&quot;MOV EAX, 0&quot;&lt;/i&gt;&lt;/b&gt; 명령어가 이상하게 보일겁니다. XOR EAX, EAX 를 왜 안썼을까 하고 말이죠.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;3. &quot;재미&quot;를 느끼셔야 합니다.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
초보일수록 더더욱 리버싱 과정에서의 재미를 찾으셔야 합니다.&amp;nbsp;어렵고 지겨운데 어떻게 계속 해나갈 수 있겠습니까? 리버싱이 재밌고, 하나씩 모르는 걸 배워나가고, 내가 맘먹은대로 프로그램을 패치시키는&amp;nbsp;이런 과정에서 재미를 찾으셔야 하지요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
사람은 재미있는 일이라면 남들이 아무리 말려도 스스로 하게 되어있답니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;4. &quot;검색&quot;을 생활화 하셔야 합니다.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;검색하면 9할은 나온다&quot;&lt;/font&gt;&lt;/b&gt; &amp;lt;- 제가 어디서 읽은 후 맘속에 담아둔 명언 입니다.&amp;nbsp;특히 리버싱 기술은 수많은 검색을 통한 지식 습득이 필수적입니다.&amp;nbsp;역사가 짧고 관련 전문가도 적고 관련 서적도 거의 없다시피 하니까요. 일단 믿고 검색해 보시기 바랍니다. 반드시 원하시는 내용을 찾을 수 있으실 겁니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;5. 제일 중요한건 &quot;실천&quot;입니다.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;Just Do It&quot;&lt;/font&gt;&lt;/b&gt; 아시죠~&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
뭔가를 이루고는 싶은데...&amp;nbsp;맘을 먹으셨으면... 행동을 하셔야죠... 그것도 지금 당장 하는겁니다...&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제 블로그에 있는 HelloWorld 부터 무작정 따라해보는 겁니다.&amp;nbsp;당연히 처음에는 하나도 아는게 없지요.&amp;nbsp;모든게 낯설게 느껴집니다. (특히 어셈블리 명령어는 거의 외계 언어로 보이죠.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
첫 목표는 디버거를 이용해서 main() 함수를 찾아가는 겁니다.&amp;nbsp;디버거에 일단 익숙해 지기 위해서 메뉴도 하나씩 건드려 보고요.&amp;nbsp;tracing(StepIn[F7], StepOut[F8] 명령어를 이용) 을 마구 해보는 겁니다.&amp;nbsp;차츰 감이 오다가 결국 main() 을 찾게 됩니다.&amp;nbsp;C 소스 코드와 Disasembly 코드의 차이도 확인해 보시구요.&amp;nbsp;시작은 성공하신 겁니다! 출발이 좋군요. ^^&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그다음 간단한 crackme, patchme, unpackme 등을 찾아서 해보시구요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
흔히 볼 수 있는 메모장, 계산기등을 패치해봅니다.&amp;nbsp;(아주 간단히 말이죠. 가령 기능을 막아본다던지 하는 그런 정도로요.) 그 후 차츰차츰 대상을 넓혀 가시는 겁니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;6. &quot;느긋한 마음&quot;을 가지세요.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
리버싱 초보자가 가장 걸리기 쉬운 병이 바로 &quot;조급증&quot; 입니다. 빨리 성과를 내고는 싶은데 공부가 만만치는 않고 실력은 제자리에서 맴돌고 있습니다. 자신이 얼마나 모르는 것인지, 제대로 가긴 하는 건지 너무 답답합니다. 어셈블리, 윈도우즈 내부구조, PE 파일 포멧, API 후킹 등 뭐 하나 쉬운게 없습니다. 어셈블리 한가지만 봐도 어디까지 공부를 해야 하는지 알 수 가 없지요.&amp;nbsp;이럴때 마음이 급해지고 목표를 잃어 버리게 됩니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제가 해드리는 얘기를 잘 읽어 보시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; &quot;&gt;&lt;b&gt;世界最强&amp;nbsp;&lt;/b&gt;&lt;/span&gt;大韓民國&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 한자들을 읽어 보세요. &quot;세계최강&amp;nbsp;대한민국&quot; 입니다. 대부분 정확히 읽으셨을 겁니다.&amp;nbsp;그렇다면 안보고 정확히 쓸 수도 있으신가요?&amp;nbsp;아마 안보고 쓰는건 쉽지 않으실 겁니다. ^^&amp;nbsp;위 8 글자 중에서 한 두 글자를 모르더라도 주변 글자들을 통해서 전체를 읽어 낼 수 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;u&gt;
저를 비롯한 많은 리버서들이 어셈블리 명령어를 100%&amp;nbsp;자유자재로 구사하지는 못합니다.&lt;/u&gt;&amp;nbsp;몇명은 그래도 어셈블리 프로그래밍이 가능하지만 많은 사람들은 그렇지 못합니다.&amp;nbsp;마치 위의 한자를 읽을 수만 있고 쓸 수는 없는 것과 비슷한 상황입니다.&amp;nbsp;그래도 리버싱만 잘해요~ ^^ 명령어를 모르면 찾아 보면 되니까요. 그 정도만 알아도 프로그램의 동작 흐름을 알아낼 수 있습니다. 아마 이런식으로 몇 년이 더 흐르면 지금보다 훨씬 잘하게 되겠지요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
중요한 것은 저와 제가 아는 모든 리버서들도 초보 시절에는 (여러분들과 같이) 다 고만고만한 조건이었다는 것입니다. 꾸준히 하다보니 자연스럽게 어느 정도의 실력이 쌓인 것이지요. 절대로 조급해 하지 않았습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;여러분들도 지금 당장 시작해보세요~&amp;nbsp;분명히 성과가 나타날 것입니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제가 어떻게 장담하냐구요? 저는 사실 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;구체적인 성공 사례&lt;/font&gt;&lt;/b&gt;를 알기 때문입니다. 블로그를 운영하면서 많은 분들께 과분한 감사의 메일을 받았습니다. 그 사연들을 읽어보면 감동에 이어 전율이 흐를 때도 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
- 대학 졸업작품이 단과대 전체 최우수 작품으로 선정되었습니다. (상까지 받으셨다는...)&lt;/div&gt;
&lt;div&gt;
- 개발 프로젝트에 후킹 기술을 적용해서 쉽게 해결할 수 있었습니다. (유명 회사 개발팀 소속이십니다.)&lt;/div&gt;
&lt;div&gt;
- XX소프트웨어 멤버십에 합격했습니다. (XX 취직이 보장된다는 그런 곳이라죠.)&lt;/div&gt;
&lt;div&gt;
- 리버싱 프로젝트(&quot;문서 암호화&quot;)를 성공시켰습니다. (아마 대학교 동아리 였던걸로 기억합니다.)&lt;/div&gt;
&lt;div&gt;
- 기타...&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이분들께서는 대부분 리버싱 초보셨습니다. 본인들의 불타는 열정으로 엄청난 성취를 이루어 내신 거지요. 따라서 제가 여러분도 할 수 있다고 장담할 수 있는 것이고요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
공부하시다가 모르시는 내용이 있으세요? 질문하세요~&amp;nbsp;저도 다른 분들의 생각을 들어보고 같이 고민하는 것을 좋아합니다.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
자, 지금 당장 시작하세요~ ^^&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190);&quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=10334476&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>column</category>
			<category>it</category>
			<category>Just Do It</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>Reversing</category>
			<category>검색</category>
			<category>긍정</category>
			<category>느긋함</category>
			<category>리버스엔지니어링</category>
			<category>리버싱</category>
			<category>리버싱 공부 방법</category>
			<category>목표</category>
			<category>소프트웨어 역공학</category>
			<category>실천</category>
			<category>재미</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/92</guid>
			<comments>http://www.reversecore.com/92#entry92comment</comments>
			<pubDate>Wed, 13 Oct 2010 00:57:57 +0900</pubDate>
		</item>
		<item>
			<title>리버싱 현업에서 사용되는 디버거(Debugger)들</title>
			<link>http://www.reversecore.com/91</link>
			<description>&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
리버서들이 가장 많이 사용하는 도구인 디버거(Debugger)에 대해 이야기 해보도록 하겠습니다.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
리버싱 현업에서 사용되는 Debugger 들을 간략히 정리해 보겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;1. OllyDbg&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.ollydbg.de/&quot;&gt;http://www.ollydbg.de/&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
OllyDbg 는 사용이 편리하고 가볍고 빠른 무료 Debugger 입니다. 도저히 무료라고 보기 힘든 다양한 기능과 많은 Plugin 을 통한 확장성으로 인하여 수 많은 리버서들의 열광적인 지지를 얻고 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 는 리버싱 초보부터 전문가까지 폭넓게 사용되는 가장 인기 있는 디버거입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile10.uf.tistory.com/original/1166ED0C4CA1F54B9EB6D2&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;OllyDbg.jpg&quot; height=&quot;480&quot; width=&quot;600&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;그림 1 - OllyDbg&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 의 장점으로는 가볍고 빠르며 상당히 다양한 기능과 많은 옵션을 제공한다는 것입니다. 또한 PlugIn 기능을 통한 확장성을 제공합니다. 가장 사용자가 많고 OllyDbg 를 이용한 리버싱 강좌가 많이 있기 때문에 초보자도 쉽게 배울 수 있습니다. 그리고 무료로 제공된다는 점도 큰 장점입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
단점으로는 개인이 혼자서 개발한 거라 업데이트와 후속 제품의 개발 주기가 늦다는 것입니다. 다행히 최근에 OllyDbg 2.0 Final 버전이 릴리즈 되었습니다. 비록 겉모습은 이전 버전과 동일하지만 내부 코드는 완전히 새롭게 프로그래밍 하여 속도와 정확성 등이 크게 향상되었다고 하네요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;2. IDA Pro&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞&amp;nbsp;&lt;a href=&quot;http://www.hex-rays.com/idapro/&quot;&gt;http://www.hex-rays.com/idapro/&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Hex-rays 사의 IDA Pro 는 현재 최고의 Disassembler &amp;amp; Debugger 라고 말할 수 있습니다. 과거에는 Disassembler 성격이 강했으나, 수많은 업데이트를 통해 Debugger 기능 또한 막강해 졌습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
수 많은 다양한 기능들을 설명하는 전문 서적이 따로 존재할 정도로 엄청난 기능을 자랑합니다. 또한 Decompiler Plugin 등을 추가로 장착하면 리버싱이 말할 수 없이 편리해 집니다. 그만큼 가격도 비싸지요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
많은 리버싱 전문가들이 IDA Pro 를 주력으로 삼으면서 리버싱 전문 툴로써의 입지를 탄탄히 굳히고 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
장점으로는 다 써보지도 못할 정도로 다양한 기능과 충실한 업데이트를 들 수 있습니다. 다만 가격이 비싸고 사용법이 비교적 복잡하며 초기 로딩 시간이 좀 걸린다는 것을 단점으로 들 수 있겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile3.uf.tistory.com/original/147819304CA1F5DE0858C2&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;IDAPro.jpg&quot; height=&quot;480&quot; width=&quot;600&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;그림 2 – IDA Pro&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;3. WinDbg&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.microsoft.com/whdc/devtools/debugging/default.mspx&quot;&gt;http://www.microsoft.com/whdc/devtools/debugging/default.mspx&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
WinDbg 는 DOS 시절 16 bit 디버거인 debug.exe 의 Windows 버전입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile6.uf.tistory.com/original/18237D314CA1F60EE27D27&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;Debug.jpg&quot; height=&quot;311&quot; width=&quot;600&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;그림 3 – Debug.exe&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
콘솔 화면에서 키보드만으로 디버깅을 하는 debug.exe 의 사용자 인터페이스를 그대로 가져왔습니다. 저는 이런 스타일의 프로그램을 매우 좋아하지만 반대로 거부감을 갖는 분들도 상당수 계십니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
유저 모드 디버깅(User Mode Debugging) 분야에서는 사용자 편리성이 뛰어난 OllyDbg 나 IDA Pro 가 꽉 잡고 있습니다. 따라서 WinDbg 는 주로 커널 모드 디버깅(Kernel Mode Debugging)에 주로 사용됩니다. 전설적인 커널 디버거인 SoftICE 의 후속 제품 개발이 중단된 이후 커널 디버깅 분야에서 사실상 독보적인 존재가 되어 버렸습니다. (경쟁 제품이 없는 상태입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
역사가 오래 된 만큼 기능도 다양하고 사용 방법에 대한 전문 서적이 여러 권 나와 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/1561890C4CA1F626A9E388&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;WinDbg.jpg&quot; height=&quot;480&quot; width=&quot;600&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;그림 4 - WinDbg&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
장점은 커널 디버깅이 가능하다는 것과 Microsoft 에서 직접 만든 디버거라는 점입니다. 시스템 파일에 대한 심볼(Symbol)을 직접 다운 받을 수 있어서 시스템 내부 구조체(Undocumented 포함) 및 API 에 대한 정보를 얻을 수 있습니다. 또한 Windows OS 의 덤프 파일을 읽어 들여 분석할 수 있기 때문에 시스템 크래쉬(Crash)가 발생했을 때 원인을 분석해 낼 수 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
단점으로는 다른 디버거들에 비해 좀 떨어지는 사용자 환경과 편의성을 꼽을 수 있겠습니다. (예를 들어 코드에 직접 주석을 입력할 수 없고, Disassembly 코드에서 호출되는 API 이름도 잘 표시되지 않는 등의 불편함이 있습니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그래도 커널 드라이버 개발과 유지보수에 필수적으로 사용되는 디버거 입니다. 리버싱에서는 커널 드라이버 파일 분석에 주로 사용됩니다. 최근에는 대부분 WinDbg 와 VirtualPC(또는 VMWare) 조합으로 커널 디버깅을 수행합니다. 향후 여러분들의 리버싱 실력이 쌓인 후 커널 드라이버(예: Rootkit) 등을 분석할 때 자주 사용될 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
+---+&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
지금까지 리버싱 현업에서 사용되는 대표적인 디버거들에 대해서 간략히 살펴보았습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제 경우에는 유저 모드 디버깅에 OllyDbg 1.10 를 사용하고, 커널 모드 디버깅에는 WinDbg 를 사용합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=9949712&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>tool</category>
			<category>debugger</category>
			<category>Hex-rays</category>
			<category>IDA Pro</category>
			<category>it</category>
			<category>Microsoft</category>
			<category>OllyDbg</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>Reversing</category>
			<category>softice</category>
			<category>windbg</category>
			<category>디버거</category>
			<category>리버스 엔지</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/91</guid>
			<comments>http://www.reversecore.com/91#entry91comment</comments>
			<pubDate>Wed, 29 Sep 2010 00:05:00 +0900</pubDate>
		</item>
		<item>
			<title>책소개</title>
			<link>http://www.reversecore.com/90</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;책소개&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
제가 요즘 회사일, 집안일 외에 대부분의 시간에 리버싱 서적을 열심히 쓰고 있습니다. 책 홍보를 위해 간략히 소개해 드리자면 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;타겟&lt;/span&gt;&lt;/font&gt;&lt;/b&gt; 독자층은 &quot;리버싱 입문을 원하는 초보자&quot;와 &quot;리버싱 레퍼런스가 필요한 중급자&quot; 입니다. &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;컨셉&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;은 &quot;내부 동작 원리를 아주 쉽고 뜨겁게 이야기&quot; 하는 것입니다. &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;분량&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;은 (제발) 1,000 페이지가 넘지 않도록 노력 중입니다. 책 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;내용&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;은 블로그 내용을 좀 다듬어서 60% 정도를 채우고, 새로운 주제를 써서 나머지 40% 정도를 채울 예정입니다. 그리고 실습 예제를 많이 넣으려고 합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;일정&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
집필 일정은 늦가을까지로 예정했었습니다. 그런데 쓰면 쓸수록 제 자신이 점점 진지해지면서 입문자에게 필요하다고 생각되는 &lt;u&gt;범위와 분량이 대폭 늘어나고 있습니다&lt;/u&gt;. 일정과 분량을 조절할 필요가 있네요. 욕심을 자제하려고 노력도 해봤지만, 진정한 &quot;리버싱 입문서&quot;를 독자에게 제공해야 한다는 사명감(?) 같은 게 생겨서 이젠 굳이 자제하려고 노력하지 않습니다. ^^&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;조언&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제 블로그를 방문하시는 분들 중에서 혹시 제가 책에서 다루면 좋겠다고 생각되는 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;주제(또는 조언, 건의, 아무거나)&lt;/font&gt;&lt;/b&gt;가 있으시다면 댓글로 알려주시기 바랍니다. 작업에 큰 도움이 될 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;b&gt;블로그&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
블로그에 글을 많이 올리지 못해서 자주 방문하시는 분들께 죄송하다는 말씀을 드립니다. &lt;u&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;집필이 끝나면 제 블로그에는 실전 리버싱 실습 위주로 포스팅을 할 예정입니다. 그리고 책에 미처 쓰지 못한 내용들을 올리게 될 것입니다&lt;/font&gt;.&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제 블로그는 매일 방문하고 있습니다. 댓글의 질문들에 답변도 올리고, 이메일로 문의하신 내용도 꼭 챙겨읽고 답변 드리고 있습니다. 리버싱 하시다가 궁금한 점 있으시면 부담 갖지 마시고 질문해 주세요. 저는 같이 생각해 보는 것을 좋아합니다. 답변 달면서 제가 더 많이 배우니까요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그리고 바쁘더라도 종종 글을 올려야겠어요. 예전에는 블로그 포스팅 하는게 저의 즐거움 이었는데 말이죠. 요즘엔 글을 쓰기만 하고 올리지는 않으니 즐거움이 하나 줄었어요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
방문해 주시는 모든 분들께 감사 드립니다.&lt;/div&gt;
&lt;div&gt;
댓글, 이메일 보내주시는 분들에게도 감사드려요. 여러분께서는 모두 가까운 미래에 &#039;열혈 리버서&#039; 가 되실 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
감사합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
* 제가 좋아하는 멘트를 하나 남길께요~ 제 트위터에도 쓴 내용입니다. (트위터를 혼잣말 하는 공간으로 활용하기 때문에 Follow, RT 이런거 없어요. ^^)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
&quot;똑같은 시기에 비슷한 생각을 하는 사람은 많지만 실천에 옮기는 사람은 드물다. 나는 생각을 행동에 옮겼을 뿐이다. 기회는 도전하고 실천하는 자가 받는 선물 같은 것이다.&quot; - 강덕수, STX 그룹 회장 (창업주)&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=9396616&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>column</category>
			<category>@reversecore</category>
			<category>it</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>Reversing</category>
			<category>stx</category>
			<category>강덕수</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>리버싱 책</category>
			<category>소프트웨어 역공학</category>
			<category>쉽고 뜨겁게</category>
			<category>창업자</category>
			<category>창업주</category>
			<category>회장</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/90</guid>
			<comments>http://www.reversecore.com/90#entry90comment</comments>
			<pubDate>Mon, 06 Sep 2010 01:00:00 +0900</pubDate>
		</item>
		<item>
			<title>리버서의 연륜을 말해주는 Opcode Manual</title>
			<link>http://www.reversecore.com/89</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
지난주부터 &quot;IA-32 Instruction&quot; 챕터를 작업하는 중인데요, IA-32 Instruction 이란 쉽게 말해 아래 그림에서 빨간 박스로 표시된 부분을 말하는 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/original/113C72104C78240A364477&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg00.png&quot; height=&quot;114&quot; width=&quot;387&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
디버거에 탑재된 Disassembler 가 저 Instruction 을 해석해서 우리가 익히 보는 (오른쪽의) Disassembly 코드를 만들어 내지요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&quot;IA-32 Instruction&quot; 챕터를 작업하면서 제 노하우를 공개하였습니다. 그건 바로 Intel IA-32 Manual 에서 Instruction 을 해독하기 위해 필요한 Opcode Map(Opcode Table) 부분만 프린터로 출력한 것입니다. 저한테는 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;&lt;u&gt;Opcode 매뉴얼&lt;/u&gt;&lt;/font&gt;인 셈이지요. (아래 그림 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile1.uf.tistory.com/original/1211692E4C7B852B75ECDE&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;manual.jpg&quot; height=&quot;375&quot; width=&quot;500&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
작업 중인 책 내용의 일부를 소개합니다. (참고 섹션 내용입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
* 참고&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;br /&gt;
&lt;/font&gt;
&lt;/i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
위 출력물이 너덜너덜 해질 때쯤 여러분은 IA-32 Instruction 해석의 고수가 되어 있으실 겁니다. 저 또한 5년 동안 손 때묻은 저만의 출력물을 한 부 가지고 있습니다. 후배나 동료가 Instruction 해석에 관해서 물어오면 자랑스럽게 꺼내서 가르쳐 줍니다. 많이 참고하다 보면 어떤 내용이 대충 어느 페이지에 있다는 감이 생겨서 한번에 그곳을 펼칠 수 있습니다. (생활의 달인?)&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;제가 가장 존경하는 선배님도 이러한 출력물을 가지고 계셨습니다. 그 당시에도 매우 낡아 보였지요. 어찌 보면 이것이 리버서의 연륜(?)을 나타내는 하나의 척도로 볼 수 도 있겠습니다. 여러분께서도 꼭 자신만의 출력물을 한 부 만들어서 활용해 보시기 바랍니다.&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이처럼 오랫동안 저랑 같이 작업한 제 손 때묻은 매뉴얼 이라서 어느덧 애정이 생겨 버렸습니다. (기술자들은 모두 그런 게 한두 개씩은 있잖아요? 자신과 오랫동안 함께 하면서 분신이 되어버린 도구 같은…)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
최근 1~2년은 주로 각종 자동화 시스템의 개발/유지보수 업무를 하면서 Opcode 매뉴얼을 거의 꺼내 보지 못했었는데, 이번에 &quot;IA-32 Instruction&quot; 챕터를 쓰면서 다시 꺼내어 보니 감개가 무량하더군요. (그동안 소홀해서 미안해~ 이번 챕터는 다 니 덕이야~ 고마워~)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
더불어 제게 처음 IA-32 Instruction 을 가르쳐 주시고(사실 개발, 분석을 다 가르쳐 주셨죠) 제가 가장 존경하는 선배님(형님)이 생각납니다. 지금은 외국에 계셔서 만나 뵙기는 힘듭니다만 오늘은 그분이 더 보고 싶네요. ^^~&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=9248933&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>column</category>
			<category>IA-32</category>
			<category>IA-32 Instruction</category>
			<category>IA-32 Opcode</category>
			<category>IA32</category>
			<category>ia32 instruction</category>
			<category>ia32 opcode</category>
			<category>Instruction</category>
			<category>Intel</category>
			<category>Manual</category>
			<category>map</category>
			<category>Opcode</category>
			<category>Opcode map</category>
			<category>opcode table</category>
			<category>x86</category>
			<category>x86 instruction</category>
			<category>x86 opcode</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/89</guid>
			<comments>http://www.reversecore.com/89#entry89comment</comments>
			<pubDate>Tue, 31 Aug 2010 01:00:00 +0900</pubDate>
		</item>
		<item>
			<title>어셈블리 언어를 이용한 Code Injection (5)</title>
			<link>http://www.reversecore.com/88</link>
			<description>&lt;br /&gt;
&lt;div&gt;
이전 강좌에서 이어지는 내용입니다.&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/87&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/87]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (4)&lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# MessageBoxA() 파라미터 입력 1 – MB_OK&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D002C &amp;nbsp; &amp;nbsp;6A 00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;PUSH 0&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 은 스택에 0 을 입력하는 명령입니다. 이 0 의 의미는 아래에서 호출될 MessageBoxA() API 의 네 번째 파라미터(uType)로 사용됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
참고로 MessageBoxA() API 는 아래와 같이 4 개의 파라미터를 받습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;int WINAPI MessageBox(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in_opt &amp;nbsp;HWND hWnd,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in_opt &amp;nbsp;LPCTSTR lpText,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in_opt &amp;nbsp;LPCTSTR lpCaption,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp; &amp;nbsp; &amp;nbsp;UINT uType&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;* 출처 : &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx&quot; target=&quot;_blank&quot; title=&quot;[http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx]로 이동합니다.&quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
uType 값이 0 이면 MB_OK 를 의미하며, 단순히 OK(“확인”) 버튼 한 개만 보여주게 됩니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# MessageBoxA() 파라미터 입력 2 – &quot;ReverseCore&quot;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D002E &amp;nbsp; &amp;nbsp;E8 0C000000 &amp;nbsp; CALL 002D003F&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0033 &amp;nbsp; &amp;nbsp;52 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH EDX&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0034 &amp;nbsp; &amp;nbsp;65:76 65 &amp;nbsp; &amp;nbsp; &amp;nbsp;JBE SHORT 002D009C&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0037 &amp;nbsp; &amp;nbsp;72 73 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JB SHORT 002D00AC&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0039 &amp;nbsp; &amp;nbsp;65:43 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INC EBX&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D003B &amp;nbsp; &amp;nbsp;6F &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OUTS DX,DWORD PTR ES:[EDI]&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D003C &amp;nbsp; &amp;nbsp;72 65 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JB SHORT 002D00A3&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D003E &amp;nbsp; &amp;nbsp;00&lt;/font&gt;E8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ADD AL,CH&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이번에는 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;u&gt;CALL 명령으로 코드 사이에 포함된 문자열 데이터 주소를 스택에 입력하는 기법&lt;/u&gt;&lt;/font&gt;&lt;/b&gt;을 소개하겠습니다. 이 역시 Assembly 프로그래밍 언어에서만 가능한 기법입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 2D0033 ~ 2D003E 주소 영역은 분명히 프로그램 코드 영역이지만 그 내용은 사실 &quot;ReverseCore&quot; 문자열 데이터 입니다. (붉은색 표시 부분) 즉, &quot;ReverseCore&quot; 문자열의 시작주소는 2D0033 입니다. 그리고 이 문자열은 MessageBoxA() API 의 세 번째 파라미터 (lpCaption)로 사용됩니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
함수 파라미터로 사용되려면 문자열 주소를 스택에 넣어줘야 하는데 과연 어떤 방식으로 입력할까요?&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D002E 주소의 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;CALL 002D003F&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 명령을 디버깅으로 쫓아 들어가 보겠습니다. (StepIn [F7]) 그리고 아래 그림과 같이 스택 주소를 봐주시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile30.uf.tistory.com/original/11366A1E4C30617053E79A&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;str_reversecore.png&quot; height=&quot;165&quot; width=&quot;591&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 13&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;u&gt;
스택에 &quot;ReverseCore&quot; 문자열 시작 주소인 2D0033 이 입력되었습니다!!!&lt;/u&gt; MessageBoxA() 의 세 번째 파라미터가 입력된 셈이죠.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
이 트릭은 CALL 명령어의 &quot;동작원리&quot;를 응용한 것입니다.&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
CALL 002D003F 명령을 수행하면 함수(2D003F) 가 종료된 후 돌아올 리턴 주소(2D0033)를 스택에 입력(PUSH)한 후 해당 함수 주소(2D003F)로 이동(JMP)합니다. &lt;u&gt;즉, CALL 명령어는 PUSH, JMP 명령어를 합쳐 놓은 것입니다.&amp;nbsp;&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
사실 2D003F 는 함수 형태가 아닙니다. RETN 명령어로 되돌아가는 형태가 아니란 얘기지요. 여기서의&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt; CALL 002D003F 명령어는 바로 뒤에 이어지는 &quot;ReverseCore&quot; 문자열 주소를 스택에 입력하고 그 다음 코드 명령어로 가기 위해서 사용&lt;/font&gt;되고 있는 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이해 되시나요? ^^ 재미있는 CALL 명령어 사용법입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# MessageBoxA() 파라미터 입력 3 – &quot;www.reversecore.com&quot;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D003F &amp;nbsp; &amp;nbsp;E8 14000000 &amp;nbsp; CALL 002D0058&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0044 &amp;nbsp; &amp;nbsp;77 77 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JA SHORT 002D00BD&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0046 &amp;nbsp; &amp;nbsp;77 2E &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JA SHORT 002D0076&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0048 &amp;nbsp; &amp;nbsp;72 65 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JB SHORT 002D00AF&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D004A &amp;nbsp; &amp;nbsp;76 65 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JBE SHORT 002D00B1&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D004C &amp;nbsp; &amp;nbsp;72 73 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JB SHORT 002D00C1&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D004E &amp;nbsp; &amp;nbsp;65:636F 72 &amp;nbsp; &amp;nbsp;ARPL WORD PTR GS:[EDI+72],BP&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0052 &amp;nbsp; &amp;nbsp;65: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PREFIX GS:&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0053 &amp;nbsp; &amp;nbsp;2E:636F 6D &amp;nbsp; &amp;nbsp;ARPL WORD PTR CS:[EDI+6D],BP&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;002D0057 &amp;nbsp; &amp;nbsp;00&lt;/font&gt;6A 00 &amp;nbsp; &amp;nbsp; &amp;nbsp; ADD BYTE PTR DS:[EDX],CH&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
역시 위 &quot;ReverseCore&quot; 문자열과 마찬가지로 MessageBoxA() API 의 두 번째 파라미터 lpText 문자열(&quot;www.reversecore.com&quot;)을 입력하는 명령입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드에서 빨간색으로 표시된 부분은 코드 명령어가 아니라 문자열 데이터(&quot;www.reversecore.com&quot;) 입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D003F 주소의 CALL 002D0058 명령어는 (앞에서 설명 드린 바와 같이) 바로 뒤에 이어지는 문자열(&quot;www.reversecore.com&quot;) 데이터의 주소(2D0044)를 스택에 입력하고 그 다음 명령어 주소(2D0058)로 갑니다. (아래 그림 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile30.uf.tistory.com/original/162577214C30623B17B2CE&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;str_wwwreversecorecom.png&quot; height=&quot;175&quot; width=&quot;590&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 14&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# MessageBoxA() 파라미터 입력 4 – NULL&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D0058 &amp;nbsp; &amp;nbsp;6A 00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
MessageBoxA() API 의 첫 번째 파라미터인 hWnd 값을 입력합니다. 일반적으로는 메시지 박스가 소속된 윈도우 핸들을 입력하지만, 여기서는 NULL 을 입력하여 무소속(?) 메시지 박스가 출력되도록 만들겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# MessageBoxA(NULL, &quot;www.reversecore.com&quot;, &quot;ReverseCore&quot;, MB_OK) 호출&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D005A &amp;nbsp; &amp;nbsp;FFD0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALL EAX&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
드디어 MessageBoxA() API 를 호출하는 CALL 명령어 입니다. 현재 EAX 레지스터에는 위에서 호출한 GetProcAddress() 에 의해서 리턴된 MessageBoxA() API 의 시작 주소(7793EA71)가 저장되어 있습니다. (&amp;lt;Fig. 12&amp;gt; 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D005A 주소의 CALL EAX 명령어까지 디버깅한 후 레지스터와 스택을 살펴보면 아래 그림과 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/original/176686244C3062BBBBE58D&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;call_MessageBoxA.png&quot; height=&quot;167&quot; width=&quot;590&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 15&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이 CALL EAX 명령어를 실행하면 메시지 박스가 나타날 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/143AE7254C3062D3679283&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;mgsbox_ReverseCore.png&quot; height=&quot;154&quot; width=&quot;182&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 16&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# ThreadProc() 리턴값 세팅&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D005C &amp;nbsp; &amp;nbsp;33C0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XOR EAX,EAX&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
notepad.exe 프로세스에 인젝션된 코드(ThreadProc() 스레드 함수) 가 종료될 준비를 합니다. 스레드 함수의 리턴값을 0 으로 세팅하기 위해서 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;XOR EAX, EAX&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 명령어가 사용됩니다. 함수의 리턴값은 EAX 레지스터를 사용한다는 것을 기억 하시죠?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;
* 참고&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
XOR EAX, EAX 명령어는 EAX 레지스터를 0 으로 초기화하는 가장 쉽고 빠른 명령어 입니다. 디버깅하면서 많이 접하게 될 것입니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# Stack Frame 해제 및 함수 리턴&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D005E &amp;nbsp; &amp;nbsp;8BE5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MOV ESP,EBP&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0060 &amp;nbsp; &amp;nbsp;5D &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;POP EBP&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0061 &amp;nbsp; &amp;nbsp;C3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RETN&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ThreadProc() 함수 시작할 때 생성한 Stack Frame 을 해제 합니다. 그리고 RETN 명령으로 함수가 종료됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이 ThreadProc() 함수에서 Stack Frame 은 매우 중요합니다. 앞에서 설명 드린 &quot;PUSH 를 이용한 스택에 문자열 넣는 기법&quot; 에서 스택에 입력된 문자열을 일일이 POP 명령으로 힘들게 없앨 필요 없이 Stack Frame 해제 명령어 한방으로 가볍게 초기화 시킬 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
* 참고&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
Stack Frame 관련 내용은 아래 링크를 참고하세요~&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/11&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/11]로 이동합니다.&quot;&gt;Stack Frame&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
+--+&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Assembly 언어를 이용한 Code Injection 에 관한 설명을 마치도록 하겠습니다. C 언어 보다 더 자유로운 Assembly 언어를 사용하여 다양하고 창의적인 코드를 생성해 보시기 바랍니다. Assembly 초보자도 OllyDbg 의 &quot;Assemble&quot; 명령어를 이용하면 좀 더 쉽게 이용하실 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 실습을 다 끝내신 분께서는 한번 제 블로그 이미지에 있는 바이트 코드를 입력해서 실행해 보시기 바랍니다. ^^ 어떤 코드가 나타날까요?&amp;nbsp;(OllyDbg 의 편집 기능과 New Origin Here 기능을 사용하면 되겠지요~)&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190);&quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7946501&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>assembly</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OllyDbg</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>어셈블리</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/88</guid>
			<comments>http://www.reversecore.com/88#entry88comment</comments>
			<pubDate>Sun, 04 Jul 2010 19:18:55 +0900</pubDate>
		</item>
		<item>
			<title>어셈블리 언어를 이용한 Code Injection (4)</title>
			<link>http://www.reversecore.com/87</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
다른 프로세스에 인젝션된 코드를 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;디버깅&lt;/font&gt;&lt;/b&gt;하면서 동작 원리를 알아보도록 하겠습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이전 강좌의 내용은 아래 링크를 참조하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/84&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/84]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/85&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/85]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/86&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/86]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;notepad.exe 디버깅&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile2.uf@112C0B024C3058D660C578.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; CodeInjection2.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
notepad.exe 프로세스에 어셈블리 언어로 제작한 코드를 인젝션 시키고 디버깅을 해보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
Code Injection 기법의 디버깅 방법은 아래 링크를 참고하시기 바랍니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/83&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/83]로 이동합니다.&quot;&gt;Code Injection 기법 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위의 글에서 소개된 방법에 따라 notepad.exe 에 인젝션된 코드를 OllyDbg 로 보면 아래 그림과 같습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/1326A8134C3059235A19D1&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ThreadProc_ep.png&quot; height=&quot;385&quot; width=&quot;550&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;
* 참고&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;위 코드의 시작 주소(2D0000)는 사용자 환경에 따라서 틀려집니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드를 자세히 디버깅 해보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# Stack Frame 생성&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D0000 &amp;nbsp; &amp;nbsp;55 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH EBP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; # ThreadProc()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D0001 &amp;nbsp; &amp;nbsp;8BEC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MOV EBP,ESP&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
전형적인 스택 프레임 생성 명령어 입니다. 이 명령어가 낯 설은 분들께서는 이 기회에 &quot;55 8BEC&quot; 하고 외워두시는 것도 좋습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
스택 프레임을 생성하는 이유는 이후에 나오는 명령어들이 스택에 문자열들을 집어넣는 기법을 사용하기 때문에 위 ThreadProc() 함수가 종료될 때 스택을 깨끗이 정리하기 위해서입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# THREAD_PARAM 구조체 포인터&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0003 &amp;nbsp; &amp;nbsp;8B75 08 &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV ESI,DWORD PTR SS:[EBP+8]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
스택 프레임이 생성된 이후에 [EBP+8] 이 의미하는 것은 함수로 넘어온 첫 번째 파라미터 입니다. 이 경우에는 THREAD_PARAM 구조체 포인터가 될 것입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래에 THREAD_PARAM 구조체를 표시하였습니다. 구조체의 멤버는 2개의 함수 포인터인데 각각 “LoadLibraryA” 와 “GetProcAddress()” 의 포인터가 저장됩니다. (누가 이 포인터를 구해서 저장시켜 줬을까요? 네, 지난 강좌에서 소개한 CodeInjection2.exe 프로그램에서 구해서 notepad.exe 에 인젝션 시킨 후 스레드 실행할 때 파라미터로 넣어주었죠.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;typedef struct _THREAD_PARAM&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC pFunc[2]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // LoadLibraryA(), GetProcAddress()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;} THREAD_PARAM, *PTHREAD_PARAM;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 2D0003 주소의 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;MOV ESI, DWORD PTR SS:[EBP+8]&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 명령어를 실행한 이후에 ESI 레지스터에 저장된 주소를 따라가서 확인해 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile8.uf.tistory.com/original/1529D3034C305A12179455&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;esi_hex.png&quot; height=&quot;176&quot; width=&quot;459&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ESI 에 280000 주소가 저장되었으며 이 주소는 CodeInjection2.exe 에서 THREAD_PARAM 구조체를 위해 notepad.exe 프로세스 메모리 공간에 할당한 메모리 버퍼의 주소입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;
* 참고&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;THREAD_PARAM 구조체 주소(2D0000)는 사용자 환경에 따라서 틀려집니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&amp;lt;Fig. 2&amp;gt; 의 메모리 윈도우를 보면 280000 주소에 두 개의 4 byte 값들이 저장된 걸 확인할 수 있습니다. 저 값들이 &quot;LoadLibraryA&quot; 와 &quot;GetProcAddress&quot; API 함수의 시작 주소일 것입니다. 좀 더 직관적으로 확인하기 위해서 OllyDbg 메모리 윈도우의 보기 옵션을 변경해 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
메모리 윈도우에 커서를 위치시킨 후 마우스 우측 메뉴의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;Long – Address&quot;&lt;/font&gt;&lt;/b&gt; 항목을 선택해 주시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile4.uf.tistory.com/original/192FBB104C305A5AA214DA&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;menu_long_address.png&quot; height=&quot;233&quot; width=&quot;403&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 메뉴 항목을 선택하면 OllyDbg 의 메모리 윈도우는 아래 그림과 같이 표시 형식이 변경됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/14496F104C305A77383A58&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;esi_long_address.png&quot; height=&quot;52&quot; width=&quot;337&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
주소가 훨씬 더 직관적으로 표시되지요? 또한 친절하게 Comment 에 각 주소에 해당되는 API 이름을 표시해 주고 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# &quot;user32.dll&quot; 문자열&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0006 &amp;nbsp; &amp;nbsp;68 6C6C0000 &amp;nbsp; PUSH 6C6C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; “\0\0ll”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D000B &amp;nbsp; &amp;nbsp;68 33322E64 &amp;nbsp; PUSH 642E3233 &amp;nbsp; &amp;nbsp; ; “d.23”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0010 &amp;nbsp; &amp;nbsp;68 75736572 &amp;nbsp; PUSH 72657375 &amp;nbsp; &amp;nbsp; ; “resu”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드는 스택(Stack)에 문자열을 저장하는 기법입니다. 스택에 직접 접근할 수 있는 Assembly 프로그래밍 언어에서만 가능한 독특한 기법이지요.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D0006 주소의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;i&gt;PUSH 6C6C&lt;/i&gt;&lt;/font&gt;&lt;/b&gt; 명령어는 스택에 00006C6C 값을 저장하라는 뜻입니다. 6C 는 ASCII 로 &#039;l&#039; 이지요. 즉, 이 명령은 &quot;\0\0ll&quot; 문자열을 스택에 집어 넣는 것입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그 밑의 2D000B 와 2D0010 주소의 PUSH 명령어도 각각 &quot;d.23&quot; 문자열과 &quot;resu&quot; 문자열을 입력하는 명령어 입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;u&gt;
x86 CPU 의 Little Endian 표기법과 스택의 거꾸로 자라는 특성 때문에 &lt;b&gt;문자열을 뒤집어서 입력&lt;/b&gt;하는 것을 주의 깊게 보시기 바랍니다. 이것은 디버깅할 때 잘 알고 계셔야 하는 내용입니다.&lt;/u&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D0010 주소까지 디버깅 한 후 스택을 보면 아래 그림과 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile6.uf.tistory.com/original/12121D1D4C305B09467EC3&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;str_user32.png&quot; height=&quot;188&quot; width=&quot;590&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이와 같은 PUSH 명령어를 이용하여 원하는 문자열을 스택에 입력할 수 있습니다. 또한 Code Injection 할 때 문자열 데이터를 따로 인젝션 하지 않고 코드에 포함시켜서 코드만 인젝션 시킬 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;
* 참고&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&amp;nbsp;&amp;nbsp;- 문자열 데이타를 코드에 포함시키는 방법은 한가지가 더 있으며, 뒤에서 따로 소개합니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&amp;nbsp;&amp;nbsp;- 32 bit OS 에서 PUSH 명령어는 한번에 최대 4 byte 크기의 데이터만 스택에 저장이 가능합니다.&amp;nbsp;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# &quot;user32.dll&quot; 문자열 파라미터 입력&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D0015 &amp;nbsp; &amp;nbsp;54 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH ESP&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
LoadLibraryA() API 는 파라미터로 로딩시킬 DLL 파일 이름 문자열 주소를 받습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;HMODULE WINAPI LoadLibrary(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;LPCTSTR lpFileName&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;* 출처 : &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx&quot; target=&quot;_self&quot; title=&quot;[http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx]로 이동합니다.&quot;&gt;http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 &amp;lt;Fig. 5&amp;gt; 를 보시면 현재 ESP 의 값은 219FCD4 이며 이것은 &quot;user32.dll&quot; 문자열의 시작 주소입니다. 따라서 2D0015 주소의 PUSH ESP 명령어는 &quot;user32.dll&quot; 문자열 주소(219FCD4)를 스택에 입력하는 명령입니다. (아래 그림 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile27.uf.tistory.com/original/132E3C1A4C305BB130FBF6&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;stack_user32.png&quot; height=&quot;176&quot; width=&quot;591&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 6&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# LoadLibraryA(&quot;user32.dll&quot;) 호출&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;002D0016 &amp;nbsp; &amp;nbsp;FF16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALL DWORD PTR DS:[ESI] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; kernel32.LoadLibraryA&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ESI 레지스터는 &amp;lt;Fig. 4&amp;gt; 에서 보다시피 280000 값을 가지며 이 주소에는 LoadLibraryA() API 의 시작 주소(772C2864)가 저장되어 있습니다. 아래 그림을 봐주시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/original/16366F0F4C305C05941CA7&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;LoadLibraryA.png&quot; height=&quot;176&quot; width=&quot;591&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 7&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
어셈블리 언어의 메모리 참조 문법이 생소하신 분들께서는 이번 기회에 확실히 익혀 두시기 바랍니다. 아래와 같은 간단한 전개식을 사용하면 쉽게 이해하실 수 있습니다. ([ ] 는 C 언어의 포인터 참조와 같은 개념입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;[ESI] = [280000] = 772C2864 (address of kernel32.LoadLibraryA)&lt;/span&gt;&lt;/b&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D0016 주소의 &lt;i&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;CALL DWORD PTR DS:[ESI]&lt;/font&gt;&lt;/b&gt;&lt;/i&gt; 명령어를 실행하면 LoadLibraryA() API 가 호출되면서 파라미터로 입력된 &quot;user32.dll&quot; 이 로딩됩니다. notepad.exe 프로세스는 실행될 때 이미 user32.dll 를 로딩하였으므로 그 로딩 주소만 리턴합니다.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/11312B104C305C56790F79&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;register_eax.png&quot; height=&quot;108&quot; width=&quot;204&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 8&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
함수의 리턴값은 EAX 에 저장되므로 위 &amp;lt;Fig. 8&amp;gt; 을 보시면 EAX = 778E0000 이 저장되었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 메뉴의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;View – Executable modules [ALT + E]&quot;&lt;/font&gt;&lt;/b&gt; 항목을 선택하시면 아래 그림과 같이 프로세스 메모리에 로딩된 DLL 을 확인 할 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile4.uf.tistory.com/original/111A39114C305C9759D94F&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;user32_imagebase.png&quot; height=&quot;193&quot; width=&quot;445&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 9&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서 user32.dll 의 로딩 주소가 778E0000 임을 확인 할 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# &quot;MessageBoxA&quot; 문자열&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0018 &amp;nbsp; &amp;nbsp;68 6F784100 &amp;nbsp; PUSH 41786F &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; “\0Axo”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D001D &amp;nbsp; &amp;nbsp;68 61676542 &amp;nbsp; PUSH 42656761 &amp;nbsp; &amp;nbsp; &amp;nbsp; ; “Bega”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0022 &amp;nbsp; &amp;nbsp;68 4D657373 &amp;nbsp; PUSH 7373654D &amp;nbsp; &amp;nbsp; &amp;nbsp; ; “sseM”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
역시 PUSH 명령어를 이용해서 문자열 &quot;MessageBoxA&quot; 를 스택에 입력하는 명령어 입니다. (위의 &quot;user32.dll&quot; 문자열 입력과 동일합니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
2D0022 주소의 PUSH 명령까지 디버깅을 하고 나면 아래 그림과 같이 스택에 &quot;MessageBoxA&quot; 문자열이 저장됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile27.uf.tistory.com/original/175F99244C305CFB8C276C&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;str_messageboxa.png&quot; height=&quot;170&quot; width=&quot;597&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 10&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
# GetProcAddress(hMod, &quot;MessageBoxA&quot;) 호출&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0027 &amp;nbsp; &amp;nbsp;54 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH ESP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; - “MessageBoxA”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0028 &amp;nbsp; &amp;nbsp;50 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH EAX &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; - hMod (778E0000)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;002D0029 &amp;nbsp; &amp;nbsp;FF56 04 &amp;nbsp; &amp;nbsp; &amp;nbsp; CALL DWORD PTR DS:[ESI+4] &amp;nbsp; &amp;nbsp; &amp;nbsp; ; kernel32.GetProcAddress&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
현재 ESP 의 값은 0219FCC8 입니다. (&amp;lt;Fig. 10&amp;gt; 참고) 따라서 2D0027 주소의 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;PUSH ESP&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 명령어는 &quot;MessageBoxA&quot; 문자열 주소(0219FCC8) 를 스택에 입력하는 명령입니다. (이 문자열 주소는 2D0029 주소에서 호출되는 GetProcAddress() API 의 2nd 파라미터로 사용됩니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그리고 현재 EAX 의 값은 778E0000 입니다. 이는 user32.dll 모듈의 로딩 주소이지요. (&amp;lt;Fig. 8&amp;gt; 참고) 따라서 2D0029 주소의 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;PUSH EAX&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 명령어는 user32.dll 의 시작 주소(hMod)를 스택에 입력하는 명령입니다. (이 문자열 주소는 2D0029 주소에서 호출되는 GetProcAddress() API 의 1st &amp;nbsp;파라미터로 사용됩니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
여기까지 디버깅을 진행한 후 스택의 모습은 아래 그림과 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/original/1737231E4C305D603EACAA&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;getprocaddress_param.png&quot; height=&quot;40&quot; width=&quot;342&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 11&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ESI 레지스터의 값은 280000 입니다. 따라서 [ESI+4] 의 전개식은 다음과 같습니다. (&amp;lt;Fig. 4&amp;gt;, &amp;lt;Fig. 7&amp;gt; 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;[ESI+4] = [280004] = 772C1837 (address of kernel32.GetProcAddress)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
따라서 2D0029 주소의 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;CALL DWORD PTR DS:[ESI+4]&lt;/font&gt;&lt;/i&gt;&lt;/b&gt; 명령어는 GetProcAddress(778E0000, &quot;MessageBoxA&quot;) API 를 호출하는 것입니다. 이 CALL 명령어를 실행하면 user32.MessageBoxA() API 시작 주소가 EAX 레지스터에 저장됩니다. (사용자 환경에 따라서 이 주소는 틀려집니다. 제 경우에는 EAX = 7793EA71 입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile22.uf.tistory.com/original/133CBC144C305DE0EA0626&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;addr_MessageBoxA.png&quot; height=&quot;73&quot; width=&quot;547&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 12&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;(분량이 많아 다음 강좌에 이어서 하겠습니다.)&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7916347&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>assembly</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OllyDbg</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>어셈블리</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/87</guid>
			<comments>http://www.reversecore.com/87#entry87comment</comments>
			<pubDate>Sun, 04 Jul 2010 18:46:05 +0900</pubDate>
		</item>
		<item>
			<title>어셈블리 언어를 이용한 Code Injection (3)</title>
			<link>http://www.reversecore.com/86</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
어셈블리(Assembly) 언어로 생성한 코드를 가지고 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Injector &lt;/font&gt;&lt;/b&gt;를 만들어 보도록 하겠습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
이전 강좌의 내용은 아래 링크를 참조하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/84&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/84]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/85&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/85]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;ThreadProc() 함수의 Binary 코드 얻기&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile10.uf@12472B234C2B24D4221FFF.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; asmtest_patch.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
지난 강좌에서 생성한 asmtest_patch.exe 파일을 OllyDbg 로 열어 보겠습니다. 우리가 프로그래밍한 ThreadProc() 의 주소는 401000 입니다. 메모리 윈도우에서 401000 주소로 갑니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/original/185339234C2B24F6162786&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;code_dump.png&quot; height=&quot;135&quot; width=&quot;597&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ThreadProc() 함수는 401000 ~ 401061 의 주소 영역입니다. 위 그림과 같이 이 영역을 선택하신 후 마우스 우측 메뉴의&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt; &quot;Copy - To file&quot;&lt;/font&gt;&lt;/b&gt; 항목을 선택하시기 바랍니다. (아래 그림 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile27.uf.tistory.com/original/172D17274C2B252E4F387E&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;copy_to_file.png&quot; height=&quot;116&quot; width=&quot;444&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이렇게 저장한 파일을 텍스트 에디터로 열어보겠습니다. (&lt;a href=&quot;http://www.vim.org&quot; target=&quot;_blank&quot; title=&quot;[http://www.vim.org]로 이동합니다.&quot;&gt;GVIM &lt;/a&gt;또는 &lt;a href=&quot;http://www.acrosoft.pe.kr/board/ae_intro&quot; target=&quot;_blank&quot; title=&quot;[http://www.acrosoft.pe.kr/board/ae_intro]로 이동합니다.&quot;&gt;AcroEdit &lt;/a&gt;추천합니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile24.uf.tistory.com/original/1723AF034C2B25A6625096&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;GVIM_small.png&quot; height=&quot;170&quot; width=&quot;534&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;위 텍스트 파일의 내용은 Hex 값으로 표현된 ThreadProc() 함수로써, IA-32 OpCode (Operation Code) 명령어 입니다. 이 내용은 곧 &lt;b&gt;&lt;u&gt;상대방 프로세스에 인젝션 시킬 코드&lt;/u&gt;&lt;/b&gt;가 되는 것입니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 텍스트 파일을 아래와 같이 편집합니다. 불필요한 부분을 제거하고 모든 바이트마다 &quot;0x&quot; 표시를 붙여주고 &#039;,&#039; 로 연결합니다. 텍스트 에디터의 편집 기능(열 선택, 문자열 변경)을 적절히 사용하시면 편리합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile26.uf.tistory.com/original/1126D3284C2B25DF271CC4&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;GVIM_edit.png&quot; height=&quot;263&quot; width=&quot;548&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서 편집된 텍스트 내용을 보면 마치 C 언어의 BYTE 배열처럼 보이지 않습니까? 이게 바로 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;인젝션 시킬 코드 버퍼&lt;/font&gt;&lt;/b&gt;입니다. (아래 설명되는 CodeInjection2.cpp 파일에서 사용됩니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
편집된 텍스트 파일을 첨부합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile23.uf@186C26264C2B261D4F1AC8.txt&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/txt.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; RVA.txt&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림, gulim, sans-serif&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;CodeInjection2.cpp&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile29.uf@127C2A1B4C2B265D4CE165.cpp&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/110706133414/blog/image/extension/unknown.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; CodeInjection2.cpp&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Injector 프로그램의 소스 코드입니다. 위에서 텍스트 에디터로 만든 코드 버퍼는 아래 소스에서 g_InjectionCode 배열에 사용되었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고!&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;아래 소스코드는 MS Visual C++ 2008 Express Edition 에서 개발되었으며, Windows 7 32bit 환경에서 테스트 되었습니다. 또한 설명의 편의를 위하여 리턴 값 체크와 에러 처리 코드는 생략되었습니다. 원본 소스 코드는 위에 첨부된 CodeInjection2.cpp 파일을 참고하시기 바랍니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;typedef struct _THREAD_PARAM&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC pFunc[2]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // LoadLibraryA(), GetProcAddress()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;} THREAD_PARAM, *PTHREAD_PARAM;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;// ThreadProc()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;BYTE g_InjectionCode[] =&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x55, 0x8B, 0xEC, 0x8B, 0x75, 0x08, 0x68, 0x6C, 0x6C, 0x00,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x00, 0x68, 0x33, 0x32, 0x2E, 0x64, 0x68, 0x75, 0x73, 0x65,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x72, 0x54, 0xFF, 0x16, 0x68, 0x6F, 0x78, 0x41, 0x00, 0x68,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x61, 0x67, 0x65, 0x42, 0x68, 0x4D, 0x65, 0x73, 0x73, 0x54,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x50, 0xFF, 0x56, 0x04, 0x6A, 0x00, 0xE8, 0x0C, 0x00, 0x00,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x00, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x43, 0x6F,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x72, 0x65, 0x00, 0xE8, 0x14, 0x00, 0x00, 0x00, 0x77, 0x77,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x77, 0x2E, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x63,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x6F, 0x72, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x6A, 0x00,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0xFF, 0xD0, 0x33, 0xC0, 0x8B, 0xE5, 0x5D, 0xC3&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;/*&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;// ThreadProc()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;004010ED &amp;nbsp; &amp;nbsp;55 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH EBP&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;004010EE &amp;nbsp; &amp;nbsp;8BEC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV EBP,ESP&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;004010F0 &amp;nbsp; &amp;nbsp;8B75 08 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MOV ESI,DWORD PTR SS:[EBP+8]&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;004010F3 &amp;nbsp; &amp;nbsp;68 6C6C0000 &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 6C6C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;004010F8 &amp;nbsp; &amp;nbsp;68 33322E64 &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 642E3233&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;004010FD &amp;nbsp; &amp;nbsp;68 75736572 &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 72657375&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401102 &amp;nbsp; &amp;nbsp;54 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH ESP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401103 &amp;nbsp; &amp;nbsp;FF16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CALL DWORD PTR DS:[ESI]&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401105 &amp;nbsp; &amp;nbsp;68 6F784100 &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 41786F&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040110A &amp;nbsp; &amp;nbsp;68 61676542 &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 42656761&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040110F &amp;nbsp; &amp;nbsp;68 4D657373 &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 7373654D&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401114 &amp;nbsp; &amp;nbsp;54 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH ESP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401115 &amp;nbsp; &amp;nbsp;50 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUSH EAX &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401116 &amp;nbsp; &amp;nbsp;FF56 04 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALL DWORD PTR DS:[ESI+4] &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401119 &amp;nbsp; &amp;nbsp;6A 00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040111B &amp;nbsp; &amp;nbsp;E8 0C000000 &amp;nbsp; &amp;nbsp; &amp;nbsp;CALL 0040112C&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401120 &amp;nbsp; &amp;nbsp;&amp;lt;ASCII&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040112C &amp;nbsp; &amp;nbsp;E8 14000000 &amp;nbsp; &amp;nbsp; &amp;nbsp;CALL 00401145&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401131 &amp;nbsp; &amp;nbsp;&amp;lt;ASCII&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401145 &amp;nbsp; &amp;nbsp;6A 00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PUSH 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401147 &amp;nbsp; &amp;nbsp;FFD0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CALL EAX &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;00401149 &amp;nbsp; &amp;nbsp;33C0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XOR EAX,EAX &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040114B &amp;nbsp; &amp;nbsp;8BE5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MOV ESP,EBP&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040114D &amp;nbsp; &amp;nbsp;5D &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; POP EBP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;0040114E &amp;nbsp; &amp;nbsp;C3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RETN&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;*/&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;BOOL InjectCode(DWORD dwPID)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HMODULE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hMod &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;THREAD_PARAM &amp;nbsp; &amp;nbsp;param &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hProcess &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hThread &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPVOID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pRemoteBuf[2] &amp;nbsp; = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hMod = GetModuleHandleA(&quot;kernel32.dll&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;&amp;nbsp; &amp;nbsp;// set THREAD_PARAM&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;param.pFunc[0] = GetProcAddress(hMod, &quot;LoadLibraryA&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;param.pFunc[1] = GetProcAddress(hMod, &quot;GetProcAddress&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt; &amp;nbsp;// Open Process&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hProcess = OpenProcess(PROCESS_ALL_ACCESS, &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FALSE, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwPID); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt; &amp;nbsp;// Allocation for THREAD_PARAM&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pRemoteBuf[0] = VirtualAllocEx(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sizeof(THREAD_PARAM),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MEM_COMMIT, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PAGE_READWRITE); &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WriteProcessMemory(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf[0], &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (LPVOID)&amp;amp;param, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sizeof(THREAD_PARAM), &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt;&amp;nbsp;// Allocation for g_InjectionCode&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pRemoteBuf[1] = VirtualAllocEx(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sizeof(g_InjectionCode),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MEM_COMMIT, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PAGE_EXECUTE_READWRITE);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WriteProcessMemory(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf[1], &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (LPVOID)&amp;amp;g_InjectionCode, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sizeof(g_InjectionCode), &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hThread = CreateRemoteThread(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (LPTHREAD_START_ROUTINE)pRemoteBuf[1],&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf[0], &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WaitForSingleObject(hThread, INFINITE);&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CloseHandle(hThread);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CloseHandle(hProcess);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return TRUE;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;코드 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위의 코드와 지난번 CodeInjection.cpp 의 코드와의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;가장 큰 차이점은 인젝션 시키는 코드 내에 필요한 문자열 데이터를 같이 포함시킨 것&lt;/font&gt;&lt;/b&gt;입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
따라서 _THREAD_PARAM 구조체에서 문자열 멤버가 사라졌습니다. 그리고 기존 C로 된 ThreadProc() 함수 대신 &amp;lt;Fig. 4&amp;gt; 의 OpCode 버퍼(g_InjectionCode)가 사용됩니다. (이 OpCode 버퍼를 생성하기 위해 OllyDbg 의 “Assembly” 명령을 사용했던 것을 기억하시죠?)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
조금 더 정교하게 프로그래밍을 했다면 _THREAD_PARAM 구조체조차 필요 없도록 만들 수도 있습니다. 세부적인 구현 방법은 어디까지나 구현하는 사람의 마음입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;중요한 것은 어셈블리 프로그래밍을 통해서 생성된 OpCode 버퍼를 Injector 소스코드에 사용하여 상대방 프로세스에 인젝션 시킨다는 것입니다.&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
예전에 설명 드린 CodeInjection.cpp 소스 코드와 비교해서 보시면 차이점을 더 명확히 이해할 수 있을 것입니다. (위 &amp;lt;코드 1&amp;gt; 의 세부 설명은 생략합니다. Code Injection 의 구현 방법에 대해서는 밑의 링크된 설명을 참고하시기 바랍니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;☞ 참고 : &lt;a href=&quot;http://www.reversecore.com/82&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/82]로 이동합니다.&quot;&gt;Code Injection 기법 (2)&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다음 강좌에서 실제로 상대방 프로세스에 인젝션 시킨 후 디버깅을 하면서 저 어셈블리 코드가 어떤 의미를 가지고 있는지 알아보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
☞&amp;nbsp;&lt;a href=&quot;http://www.reversecore.com/85&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/85]로 이동합니다.&quot;&gt;&lt;a href=&quot;http://www.reversecore.com/87&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/87]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (4)&lt;/a&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190);&quot;&gt;ReverseCore&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7845214&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>assembly</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OllyDbg</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>어셈블리</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/86</guid>
			<comments>http://www.reversecore.com/86#entry86comment</comments>
			<pubDate>Wed, 30 Jun 2010 20:02:54 +0900</pubDate>
		</item>
		<item>
			<title>어셈블리 언어를 이용한 Code Injection (2)</title>
			<link>http://www.reversecore.com/85</link>
			<description>&lt;br /&gt;
&lt;div&gt;
지난 강좌에 이어지는 내용입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/84&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/84]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;ThreadProc()&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Assembly 언어로 ThreadProc() 함수를 만들겠습니다. 지난 강좌에서 C 로 만든 ThreadProc() 과의 차이점은&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt; Code 사이에 필요한 Data(문자열)를 포함 시키는 것&lt;/font&gt;&lt;/b&gt;입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
각자 아래 그림과 같이 입력해 주시기 바랍니다. 각 Assembly 명령어에 대한 설명은 뒤쪽에서 하겠습니다. (“Fill with NOP’s” 옵션은 uncheck 해주시고, 오타가 나면 그 주소에 가서 다시 입력하시면 됩니다.)&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile4.uf.tistory.com/original/1317C50C4C28ABBF8706A0&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;threadproc1.png&quot; height=&quot;404&quot; width=&quot;534&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
40102E 주소의 &lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;CALL 0040103F&lt;/font&gt;&lt;/i&gt; 명령어까지 잘 입력하셨나요? 그 다음에는 문자열을 입력합니다. Assemble 윈도우를 닫아주세요. OllyDbg의 코드 윈도우에서 401033 주소에 커서를 위치시킨 후 아래 그림과 같이 &quot;Edit&quot; 명령(단축키 : [Ctrl+E])을 내려줍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile27.uf.tistory.com/original/2023B60D4C28ABFEB35C78&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;str_ReverseCore.png&quot; height=&quot;207&quot; width=&quot;369&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 6&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림의 Edit 윈도우에서 &quot;ASCII&quot; 항목에 &quot;ReverseCore&quot; 를 입력합니다. 문자열은 반드시 NULL 로 끝나야 하므로 &quot;HEX&quot; 항목에서 00 값을 추가해 줍니다. (&quot;Keep size&quot; 옵션은 uncheck 로 해주세요.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이와 같이 입력한 후 OllyDbg 에서 코드를 보면 아래 그림과 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/17604F114C28AC35073BF5&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;code1.png&quot; height=&quot;210&quot; width=&quot;510&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 7&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서 푸른색으로 반전된 영역이 바로 &quot;ReverseCore&quot; 문자열 영역입니다. 매우 이상한 명령어로 표시된 것을 볼 수 있습니다. 이렇게 표시되는 이유는 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;u&gt;OllyDbg 의 Disassembler 가 문자열을 IA-32 명령어로 잘 못 해석&lt;/u&gt;&lt;/font&gt;한 것입니다. 이것은 어디까지나 Code 위치에 문자열을 입력한 저의 잘못(?)이지 OllyDbg 의 Disassembler 의 문제는 아닙니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
* 참고&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;디버깅을 할 때 이와 같은 상황을 종종 부딪히게 됩니다. 또한 이를 이용한 Anti-Debugging 기법도 있습니다. 향후 Anti-Debugging 에 대해서 설명할 때 소개해 드리겠습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 &amp;lt;Fig. 7&amp;gt; 화면처럼 문자열을 선택한 상태에서 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;Analysis&quot; 명령&lt;/font&gt;&lt;/b&gt;(단축키 : Ctrl+A)을 내려보겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
* 참고&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;OllyDbg 의 “Analysis” 명령은 코드를 다시 해석하라는 명령입니다. 주로 Unpack 된 코드를 재 해석할 때 많이 사용하게 됩니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile21.uf.tistory.com/original/130B25224C28ACF15B6BF0&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;analysis.png&quot; height=&quot;498&quot; width=&quot;501&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 8&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림은 Analysis 명령이 수행된 이후에 코드의 모습입니다. 401033 주소의 &quot;ReverseCore&quot; 문자열은 잘 보입니다만, 401000 주소 이후의 명령어들은 잘 못 해석이 되었습니다. (OllyDbg 2.0 에서도 코드와 데이터를 100% 정확히 구별해서 보여주지는 못합니다. 사실 이게 문자열인지 명령어인지 판단하기 어렵습니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 &amp;lt;Fig. 8&amp;gt; 은 코드를 보기 어려우므로 마우스 우측 메뉴의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&quot;Analysis – Remove analysis from module&quot;&lt;/font&gt;&lt;/b&gt; 명령을 사용하여 코드를 원래대로 되돌립니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/181F86214C28AD2B812F71&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;remove_analysis.png&quot; height=&quot;85&quot; width=&quot;589&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 9&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 Remove analysis 명령을 사용하면 다시 위의 &amp;lt;Fig. 7&amp;gt; 과 같은 형태의 코드로 보이게 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제 401033 주소의 &quot;ReverseCore&quot; 문자열 뒤의 &lt;b&gt;40103F 주소&lt;/b&gt;부터 다시 입력할 차례입니다. (&amp;lt;Fig. 7&amp;gt;, &amp;lt;Fig. 8&amp;gt; 의 40102E 주소의 &lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;CALL 40103F&lt;/font&gt;&lt;/i&gt; 명령어 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile5.uf.tistory.com/original/207AA6124C28AD57276D5D&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;40103f.png&quot; height=&quot;108&quot; width=&quot;329&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 10&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그리고 401044 주소에 문자열(&quot;www.reversecore.com&quot;)을 입력합니다. (마지막에 NULL 입력을 잊지 마시구요.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile26.uf.tistory.com/original/165A45114C28AD762CBE57&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;str_www.reversecore.com.png&quot; height=&quot;207&quot; width=&quot;369&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 11&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
401058 주소부터 아래와 같이 명령어를 입력합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile26.uf.tistory.com/original/155A64114C28AD9553277E&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;lastcode.png&quot; height=&quot;240&quot; width=&quot;501&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 12&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이것으로써 ThreadProc() 코드 입력이 모두 완료되었습니다. 아래 그림에 전체 코드가 나타나 있으니 각자 오타를 점검해보시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile24.uf.tistory.com/original/20546C0C4C28ADAC02A2F1&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;fullcode.png&quot; height=&quot;627&quot; width=&quot;498&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 13&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(227, 22, 0); &quot;&gt;* 참고&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;401033, 401044 주소의 내용은 명령어가 아니고 문자열입니다. OllyDbg 에서 문자열을 명령어로 인식하여 이상하게 표시하고 있습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;Save File&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위에서 생성한 코드를 잘 저장합니다. OllyDbg 의 코드 윈도우에서 마우스 우측 버튼 메뉴 중 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;&quot;Copy to executable \ All modifications&quot;&lt;/font&gt;&lt;/b&gt; 를 선택합니다. (아래 그림 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile1.uf.tistory.com/original/115B1D024C28DD840172D5&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;copy_to_executable.png&quot; height=&quot;145&quot; width=&quot;466&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: center; &quot;&gt;
&amp;lt;Fig. 14&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래 그림과 같이 확인 메시지 창이 뜹니다. &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;&quot;Copy all&quot;&lt;/font&gt;&lt;/b&gt; 을 선택해 주세요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/194B16244C28DED434EABD&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;copy_msgbox.png&quot; height=&quot;90&quot; width=&quot;266&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 15&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
마지막으로 변경 내용을 보여주는 창이 나타납니다. 마우스 우측 메뉴의 &quot;Save file&quot; 항목을 선택합니다. (아래 그림 참고)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/165CA7244C28DF7B12B1A5&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;save_file.png&quot; height=&quot;256&quot; width=&quot;460&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 16&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이후에 나타나는 파일 저장 다이알로그에서 적당한 파일 이름(asmtest_patch.exe)을 적어준 후 저장합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile27.uf@11403D114C28E084076B04.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; asmtest_patch.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
다음 강좌에서 asmtest_patch.exe 의 어셈블리 코드를 이용해서 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;Injector &lt;/font&gt;&lt;/b&gt;를 만들어 보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;* 참고 : 새롭게 소개된 OllyDbg 명령어&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Assemble [Space]&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Analysis [Ctrl+A]&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;New origin here [Ctrl+Gray *]&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7802447&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>assembly</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>어셈블리</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/85</guid>
			<comments>http://www.reversecore.com/85#entry85comment</comments>
			<pubDate>Mon, 28 Jun 2010 23:00:45 +0900</pubDate>
		</item>
		<item>
			<title>어셈블리 언어를 이용한 Code Injection (1)</title>
			<link>http://www.reversecore.com/84</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
어셈블리(Assembly) 프로그래밍 언어를 이용하여 Code Injection 기법에 사용되는 코드를 생성해 보도록 하겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Code Injection 관련 내용은 아래 강좌를 참고하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/81&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/81]로 이동합니다.&quot;&gt;Code Injection 기법 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/82&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/82]로 이동합니다.&quot;&gt;Code Injection 기법 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/83&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/83]로 이동합니다.&quot;&gt;Code Injection 기법 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;Goal&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
이번 강좌에서는 OllyDbg 의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Assemble &lt;/font&gt;&lt;/b&gt;기능을 이용하여 Assembly 언어로 인젝션 시킬 코드(ThreadProc() 함수)를 만들어 보도록 하겠습니다. &lt;u&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Assembly 언어는 C 언어보다 훨씬 더 자유로운 (정형화 되지 않은) 코드를 생성할 수 있습니다. (예: 스택(Stack), 레지스터(Register) 를 직접 access 가능)&lt;/font&gt;&lt;/u&gt;&amp;nbsp;그리고 CodeInjection.cpp 소스코드를 수정하여 Assembly 언어로 제작된 ThreadProc() 함수를 notepad.exe 프로세스에 인젝션 시켜보도록 하겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이전 강좌에서 설명 드린 (C 언어로 생성된) ThreadProc() 과 어떤 차이점이 있는지 잘 살펴보시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;b&gt;Assembly 프로그래밍&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;C/C++ 언어&lt;/font&gt;의 대표적인 개발 툴은 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;MicroSoft Visual C++&lt;/font&gt; 와 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Borland C++ Builder&lt;/font&gt; 입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Assembly 언어&lt;/font&gt;에도 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;MASM(MicroSoft Macro Assembler), TASM(Borland Turbo Assembler), FASM(Flat Assembler)&lt;/font&gt; 등의 개발 툴(Assembler)이 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
참고로 저는 C/C++ 언어는 MS Visual C++ 로 개발하고 Assembly 언어는 MASM 으로 개발합니다. 특히 MASM 은 다양한 Macro 함수와 라이브러리를 지원하기 때문에 거의 C 언어와 비슷한 수준으로 편리하게 프로그래밍을 할 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Assembly 프로그래밍을 정식으로 하시려면 MASM 을 설치하고 프로그래밍 하시면 됩니다. 또는 Visual C++ 와 같은 C 언어 개발 툴에서 인라인 어셈블리(Inline Assembly)를 사용할 수 도 있습니다. 이런 방식은 개발자에게 잘 어울리는 방식입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
우리는 모두 리버서(Reverser)이기 때문에 이번 강좌에서는 리버서에게 좀 더 잘 어울리는 방법을 소개하겠습니다. 바로 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;OllyDbg 에서 지원하는 &quot;Assemble&quot; 기능을 이용해서 프로그래밍&lt;/font&gt;&lt;/b&gt;을 하는 것입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;OllyDbg 의 &quot;Assemble&quot; 기능은 간단한 Assembly 프로그래밍을 지원하는데, 이는 리버싱에 매우 유용하게 사용됩니다. (디버깅하면서 코드를 이리저리 수정할 일이 많기 때문이지요.)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;OllyDbg 의 &quot;Assemble&quot; 명령&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
OllyDbg 의 “Assemble” 명령어를 이용하여 Assembly 프로그래밍을 해보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile22.uf@1835F20D4C270C7414F914.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; asmtest.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위에 첨부된 asmtest.exe 실행 파일을 OllyDbg 로 열어보겠습니다. (asmtest.exe 는 Assembly 프로그래밍 테스트 용도로 제작된 -아무런 기능이 없는- 실행 파일입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/134DE10E4C270C8F06EB30&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;asmtest.png&quot; height=&quot;326&quot; width=&quot;464&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림과 같이 코드 섹션의 맨 윗부분(401000)을 봐주시기 바랍니다. OllyDbg 의 새로운 명령어를 소개해 드리겠습니다. 바로 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;EIP 를 원하는 주소로 바꿔버리는 기능&lt;/font&gt;&lt;/b&gt;입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 의 코드 윈도우에서 401000 주소에 커서를 위치시킨 후 마우스 우측 메뉴의&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt; &quot;New origin here [Ctrl+Gray*]&quot; &lt;/b&gt;&lt;/font&gt;항목을 선택해 주세요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/176541044C270CD377F0BC&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;neworiginhere.png&quot; height=&quot;136&quot; width=&quot;285&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래 그림과 같이 EIP는 401000 주소로 변하게 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/1164DC044C270CF5C2F57E&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;changed_eip.png&quot; height=&quot;157&quot; width=&quot;568&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 EIP 변경 기능은 디버깅에 유용하게 사용될 수 있으므로 잘 기억해 두시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고!&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;New origin here&quot; 기능은 단순히 EIP 만 바꿔버리는 것이기 때문에 직접 디버깅을 해서 그 주소로 가는 것과는 틀립니다. 레지스터와 스택의 내용은 전혀 바뀌지 않기 때문입니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제 401000 주소에서 &quot;Assemble&quot; 명령(단축키 : [Space])을 내리면 아래 그림과 같은 Assemble 입력 창이 나타납니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/162887264C270D2C384CDF&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;assemble.png&quot; height=&quot;108&quot; width=&quot;329&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제부터 OllyDbg 에서 간단한 Assembly 프로그래밍을 할 수 있게 되었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;위 &amp;lt;Fig. 4&amp;gt; 에서 &quot;Fill with NOP’s&quot; 항목은 uncheck 해주시기 바랍니다. OllyDbg 의 Assemble 명령은 해당 주소에 사용자 코드를 입력하는 것입니다. 만약 이 항목이 check 되어 있으면 기존의 코드 보다 짧은 길이의 코드를 입력했을 때 남은 길이만큼 NOP (No Operation) 명령어를 채워 넣어서 전체적인 Code Alignment 를 맞춰주게 됩니다. 이번 강좌에서는 설명의 편의를 위해서 uncheck 상태로 진행하도록 하겠습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
(내용이 많아 다음 강좌에 이어서 하겠습니다.)&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/85&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/85]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7775957&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>assembly</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>어셈블리</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/84</guid>
			<comments>http://www.reversecore.com/84#entry84comment</comments>
			<pubDate>Sun, 27 Jun 2010 17:23:55 +0900</pubDate>
		</item>
		<item>
			<title>Code Injection 기법 (3)</title>
			<link>http://www.reversecore.com/83</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Code Injection 기법에 의해서 인젝션된 코드를 디버깅 하는 방법에 대해서 알아보도록 하겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
이전 강좌의 내용은 아래 링크를 참조하시기 바랍니다.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/81&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/81]로 이동합니다.&quot;&gt;Code Injection 기법 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/82&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/82]로 이동합니다.&quot;&gt;Code Injection 기법 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;Code Injection 디버깅 실습&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile2.uf@132298264C22B91181BF1C.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; CodeInjection.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;1. notepad.exe 디버깅&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 를 이용하여 notepad.exe 파일의 디버깅을 시작합니다. 아래 그림과 같이 실행[F9] 버튼을 선택해서 notepad.exe 를 &quot;Running&quot; 상태로 만들어주세요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/1471B9244C22B93D89FFED&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_notepad.png&quot; height=&quot;491&quot; width=&quot;549&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;2. OllyDbg 옵션 변경&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Code Injection 은 상대방 프로세스에 새로운 스레드를 생성하는 기법이므로 아래와 같이 OllyDbg 의 옵션을 변경하면 인젝션된 스레드 코드 시작부터 디버깅이 가능합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/207161244C22B95EC10610&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_option.png&quot; height=&quot;384&quot; width=&quot;474&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제부터 notepad.exe 프로세스에서 스레드가 생성된다면 해당 스레드 함수 시작코드에서 멈추게 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;3. CodeInjection.exe 실행&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Process Explorer 를 이용하여 notepad.exe 프로세스의 PID 를 구합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/162855204C22B97C8A4547&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp.png&quot; height=&quot;474&quot; width=&quot;356&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
PID 값을 실행 파라미터로 하여 CodeInjection.exe 를 실행합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/original/11166C234C22B98F384DDA&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd.png&quot; height=&quot;101&quot; width=&quot;427&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;4. 스레드 시작 코드&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
CodeInjection.exe 프로세스가 실행되어 코드 인젝션이 성공하면 아래 그림과 같이 인젝션된 스레드 코드 시작 위치에서 디버깅이 멈추게 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/original/192974204C22B9AC42A02B&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_threadproc.png&quot; height=&quot;399&quot; width=&quot;540&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
주의 하실점은 디버깅이 멈춘 것이지 EIP 가 이곳으로 세팅된 것이 아닙니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림의 150000 주소에 BP 를 설치한 후 실행[F9] 시켜 주세요. 실행 제어가 정확히 BP 설치 주소(150000)에 멈추게 되고 이제부터 펀안하게 디버깅을 진행하시면 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고!&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;실행 환경에 따라서 위 주소는 다르게 표시될 수 있습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 의 편리한 기능을 이용하여 인젝션된 코드를 디버깅 하는 방법에 대해서 살펴보았습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다음 강좌에는 C 언어가 아닌 Assembly 언어를 이용해서 인젝션 코드를 만들어 보도록 하겠습니다. 많이 기대해 주세요~&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
☞&amp;nbsp;&lt;a href=&quot;http://www.reversecore.com/84&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/84]로 이동합니다.&quot;&gt;어셈블리 언어를 이용한 Code Injection (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7721420&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/83</guid>
			<comments>http://www.reversecore.com/83#entry83comment</comments>
			<pubDate>Thu, 24 Jun 2010 10:43:46 +0900</pubDate>
		</item>
		<item>
			<title>Code Injection 기법 (2)</title>
			<link>http://www.reversecore.com/82</link>
			<description>&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;﻿&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Code Injection 실습 예제인 CodeInjection.exe 의 소스 코드(CodeInjection.cpp)를 살펴보도록 하겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이전 강좌의 내용은 아래 링크를 참조하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/81&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/81]로 이동합니다.&quot;&gt;Code Injection 기법 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;b&gt;CodeInjection.cpp&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile6.uf@1803DB124C20D47F706366.zip&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/zip.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; CodeInjection.zip&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;CodeInjection.cpp 는 Visual C++ 2008 Express Edition 으로 개발되었으며 Windows 7 32bit 환경에서 테스트 되었습니다. 또한 Visual C++ 의 코드 최적화 기능을 사용하지 않고 빌드 하였습니다. (/Od)&amp;nbsp;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래 소개되는 코드들은 설명의 편의를 위하여 에러 처리 부분을 생략하였습니다. 완전한 코드는 첨부된 CodeInjection.cpp 파일을 참고하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;main()&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
먼저 main() 함수를 살펴 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;int main(int argc, char *argv[])&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD dwPID &amp;nbsp; &amp;nbsp; = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( argc != 2 )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;\n USAGE &amp;nbsp;: %s &amp;lt;pid&amp;gt;\n&quot;, argv[0]);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return 1;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// code injection&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dwPID = (DWORD)atol(argv[1]);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;InjectCode(dwPID);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;코드 1 – main() 함수&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
main() 함수의 역할은 InjectCode() 함수를 호출하는 것입니다. 이때 함수 파라미터로 상대방 프로세스의 PID 값을 넘겨줍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;ThreadProc()&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제 상대방 프로세스에 인젝션 시킬 코드(스레드 함수)를 살펴보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// Thread Parameter&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;typedef struct _THREAD_PARAM&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC pFunc[2]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // LoadLibraryA(), GetProcAddress()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;char &amp;nbsp; &amp;nbsp;szBuf[4][128]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &quot;user32.dll&quot;, &quot;MessageBoxA&quot;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &quot;www.reversecore.com&quot;, &quot;ReverseCore&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;} THREAD_PARAM, *PTHREAD_PARAM;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// LoadLibraryA()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;typedef HMODULE (WINAPI *PFLOADLIBRARYA)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPCSTR lpLibFileName&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// GetProcAddress()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;typedef FARPROC (WINAPI *PFGETPROCADDRESS)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HMODULE hModule,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPCSTR lpProcName&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// MessageBoxA()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;typedef int (WINAPI *PFMESSAGEBOXA)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HWND hWnd,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPCSTR lpText,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPCSTR lpCaption,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;UINT uType&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// Thread Procedure&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;DWORD WINAPI ThreadProc(LPVOID lParam)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PTHREAD_PARAM &amp;nbsp; pParam &amp;nbsp; &amp;nbsp; &amp;nbsp;= (PTHREAD_PARAM)lParam;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HMODULE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hMod &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pFunc &amp;nbsp; &amp;nbsp; &amp;nbsp; = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// LoadLibrary(“user32.dll”)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// &amp;nbsp; pParam-&amp;gt;pFunc[0] = kernel32!LoadLibraryA()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// &amp;nbsp; pParam-&amp;gt;szBuf[0] = “user32.dll”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hMod = ((PFLOADLIBRARYA)pParam-&amp;gt;pFunc[0])(pParam-&amp;gt;szBuf[0]);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// GetProcAddress(“MessageBoxA”)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// &amp;nbsp; pParam-&amp;gt;pFunc[1] = kernel32!GetProcAddress()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// &amp;nbsp; pParam-&amp;gt;szBuf[1] = “MessageBoxA”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pFunc = (FARPROC)((PFGETPROCADDRESS)pParam-&amp;gt;pFunc[1])(hMod, pParam-&amp;gt;szBuf[1]);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// MessageBoxA(NULL, “www.reversecore.com”, “ReverseCore”, MB_OK)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// &amp;nbsp; pParam-&amp;gt;pFunc[1] = kernel32!GetProcAddress()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// &amp;nbsp; pParam-&amp;gt;szBuf[1] = “MessageBoxA”&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;((PFMESSAGEBOXA)pFunc)(NULL, pParam-&amp;gt;szBuf[2], pParam-&amp;gt;szBuf[3], MB_OK);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;코드 2 – ThreadProc() 함수&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드에서 실제로 인젝션 되는 부분은 ThreadProc() 함수입니다. 그 위의 typedef 문은 C 언어 문법을 위한 것이므로 인젝션 시킬 필요가 없습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ThreadProc() 의 코드는 함수 포인터를 많이 사용해서 얼핏 복잡하게 보이지만 사실 내용은 아래와 같이 간단합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(254, 137, 67); border-right-color: rgb(254, 137, 67); border-bottom-color: rgb(254, 137, 67); border-left-color: rgb(254, 137, 67); background-color: rgb(254, 222, 199); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;hMod = LoadLibraryA(“user32.dll”);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;pFunc = GetProcAddress(hMod, “MessageBoxA”);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;pFunc(“www.reversecore.com”, “ReverseCore”);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&amp;lt;코드 2&amp;gt; 의 주석을 참조하시면 ThreadProc() 의 코드는 쉽게 이해가 가실 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
중요한 것은 ThreadProc() 코드의 개념입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;u&gt;Code Injection 기법의 핵심은 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;독립 실행 코드&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;를 인젝션 시키는 것입니다.&amp;nbsp;&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그러기 위해서 코드와 (코드에서 참조하는) 데이터를 같이 인젝션 시키는 것입니다. 그리고 인젝션 시키는 코드에서 역시 인젝션 시킨 데이터를 정확히 참조할 수 있도록 해야 합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;위 ThreadProc() 함수를 보시면 직접 API 를 호출 하지 않습니다. 또한 문자열도 직접 정의해서 사용하지 않습니다. 전부 스레드 파라미터로 넘어온 THREAD_PARAM 구조체에서 가져다 사용하고 있습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
만약 일반적인 프로그램이라면 ThreadProc() 의 코드는 아래와 같이 간단히 작성할 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;DWORD WINAPI ThreadProc(LPVOID lParam)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MessageBoxA(NULL, &quot;www.reversecore.com&quot;, &quot;ReverseCore&quot;, MB_OK);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;코드 3 – 일반적인 프로그램에서의 ThreadProc()&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 &amp;lt;코드 3&amp;gt;을 빌드하여 생성된 파일을 디버거로 보면 아래 그림과 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/1670821E4C20D6B4C66916&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ThreadProc.png&quot; height=&quot;64&quot; width=&quot;525&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림의 코드(10001000 ~ 10001018 영역)를 다른 프로세스에 그대로 인젝션 시킨다면 정상적으로 실행되지 않습니다. 그 이유는 코드에서 사용되는 10009290, 1000929C, 100080F0 주소의 내용이 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;상대방 프로세스에는 없기 때문&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;따라서 저 주소에 해당하는 문자열과 API 주소를 같이 인젝션 시켜야 합니다. 또한 &amp;lt;Fig. 1&amp;gt;의 코드 역시 그 인젝션된 데이터의 주소를 정확히 참조하도록 프로그래밍 되어야 합니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이와 같은 조건을 만족시키기 위해서 &amp;lt;코드 2&amp;gt; 의 ThreadProc() 함수는 THREAD_PARAM 구조체를 이용해서 2 개의 API 주소와 4 개의 문자열 데이터를 받아들입니다. 2 개의 API 는 바로 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;“LoadLibraryA()”&lt;/b&gt;&lt;/font&gt; 와 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;“GetProcAddress()”&lt;/font&gt;&lt;/b&gt; 입니다. 이 2 개의 API 만 있으면 모든 라이브러리의 함수를 호출 할 수 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(254, 137, 67); border-right-color: rgb(254, 137, 67); border-bottom-color: rgb(254, 137, 67); border-left-color: rgb(254, 137, 67); background-color: rgb(254, 222, 199); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고 사항&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;1. 위 실습 예제의 경우에 LoadLibraryA() 와 GetProcAddress() 의 주소 말고 MessageBoxA() 의 주소를 직접 전달하여 사용해도 됩니다. 하지만 정석은 LoadLibraryA() 와 GetProcAddress() 만을 전달한 후 이를 이용해서 필요한 DLL 을 로딩시켜 원하는 함수 주소를 직접 구하는 것입니다. 이 방식의 장점은 해당 라이브러리를 프로세스에 정확히 로딩시킨다는 것입니다. 가령 notepad.exe 프로세스에 윈도우 소켓 API 인 ws2_32!connect() 의 주소를 넘겨주면 에러가 발생할 것입니다. (notepad.exe 에 기본적으로 ws2_32.dll 이 로딩되지 않았으니까요.)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;2. 대부분의 유저 모드 프로세스는 kernel32.dll 을 로딩하므로 LoadLibraryA(), GetProcAddress() 의 주소를 직접 넘기는 것은 크게 무리가 없습니다. 단, kernel32.dll 을 로딩하지 않는 시스템 프로세스(예: smss.exe)도 있으니 사전에 꼭 확인하시기 바랍니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;3. Kernel32.dll 같은 시스템 라이브러리는 OS 가 부팅되어 있는 상태에서는 모든 프로세스에서 동일한 주소에 로딩되어 있습니다. OS 버전이 틀리거나 재부팅(Vista, 7 의 경우)을 하거나 하면 같은 모듈이라도 로딩 주소는 틀려집니다.&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 &amp;lt;코드 2&amp;gt; 의 내용을 디버거로 살펴보면 아래 그림과 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile10.uf.tistory.com/original/115B6D1C4C20D721CC849E&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_threadproc.png&quot; height=&quot;399&quot; width=&quot;540&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위의 &amp;lt;Fig. 2&amp;gt; 의 코드를 보시면 모든 중요한 데이터는 스레드 파라미터인 pParam 으로 받아서 사용하는 것을 알 수 있습니다. 즉, &amp;lt;Fig. 2&amp;gt; 의 ThreadProc() 함수는 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;독립 실행 코드&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;라고 말 할 수 있습니다. 위의 &amp;lt;Fig. 2&amp;gt; 와 앞에서 소개한 &amp;lt;Fig. 1&amp;gt; 를 비교해 보시면 그 차이점을 확인하실 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;Visual C++ 2008 Express Edition 에서 프로젝트의 [Release/Debug] 모드와 [최적화] 옵션에 따라서 CodeInjection.cpp 파일은 &amp;lt;Fig. 2&amp;gt; 와는 다른 형태로 빌드 될 수 있습니다. 위 실습 예제는 Release 모드에서 최적화 옵션 사용 안함(/Od)으로 빌드 하였습니다.&amp;nbsp;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12pt; &quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;InjectCode()&lt;/font&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래는 Code Injection 기법의 핵심인 InjectCode() 함수입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;BOOL InjectCode(DWORD dwPID)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HMODULE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; hMod &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;THREAD_PARAM &amp;nbsp; &amp;nbsp;param &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hProcess &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hThread &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPVOID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pRemoteBuf[2] &amp;nbsp; = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwSize &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hMod = GetModuleHandleA(&quot;kernel32.dll&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// set THREAD_PARAM&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;param.pFunc[0] = GetProcAddress(hMod, &quot;LoadLibraryA&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;param.pFunc[1] = GetProcAddress(hMod, &quot;GetProcAddress&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;strcpy_s(param.szBuf[0], &quot;user32.dll&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;strcpy_s(param.szBuf[1], &quot;MessageBoxA&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;strcpy_s(param.szBuf[2], &quot;www.reversecore.com&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;strcpy_s(param.szBuf[3], &quot;ReverseCore&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Open Process&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hProcess = OpenProcess(PROCESS_ALL_ACCESS, &amp;nbsp;// dwDesiredAccess&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FALSE, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // bInheritHandle&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwPID); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// dwProcessId&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Allocation for THREAD_PARAM&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dwSize = sizeof(THREAD_PARAM);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pRemoteBuf[0] = VirtualAllocEx(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// hProcess&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpAddress&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwSize, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// dwSize&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MEM_COMMIT, &amp;nbsp; &amp;nbsp; &amp;nbsp;// flAllocationType&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PAGE_READWRITE); // flProtect&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WriteProcessMemory(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// hProcess&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf[0], &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // lpBaseAddress&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (LPVOID)&amp;amp;param, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpBuffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwSize, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// nSize&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // [out] lpNumberOfBytesWritten&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Allocation for ThreadProc()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dwSize = (DWORD)InjectCode - (DWORD)ThreadProc;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pRemoteBuf[1] = VirtualAllocEx(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// hProcess&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpAddress&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwSize, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// dwSize&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MEM_COMMIT, &amp;nbsp; &amp;nbsp; &amp;nbsp;// flAllocationType&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PAGE_EXECUTE_READWRITE); // flProtect&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WriteProcessMemory(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// hProcess&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf[1], &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // lpBaseAddress&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (LPVOID)ThreadProc, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpBuffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwSize, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// nSize&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // [out] lpNumberOfBytesWritten&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hThread = CreateRemoteThread(hProcess, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// hProcess&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpThreadAttributes&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // dwStackSize&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (LPTHREAD_START_ROUTINE)pRemoteBuf[1],&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf[0], &amp;nbsp; &amp;nbsp; // lpParameter&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // dwCreationFlags&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // lpThreadId&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;WaitForSingleObject(hThread, INFINITE);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CloseHandle(hThread);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CloseHandle(hProcess);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return TRUE;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;코드 4 - InjectCode() 함수&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드는 DLL Injection 코드와 매우 유사합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
InjectCode() 함수의 앞 부분은 THREAD_PARAM 구조체 변수를 세팅하고 있습니다. 이 값들은 상대방 프로세스에 인젝션 되어 ThreadProc() 스레드 함수에 파라미터로 전달될 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;Windows 7 에서 모든 프로세스에 로딩된 kernel32.dll 의 주소가 동일하므로 CodeInjection.exe 프로세스에서 구한 API(“LoadLibraryA”, “GetProcAddress”) 주소와 notepad.exe 프로세스에서 구한 API(“LoadLibraryA”, “GetProcAddress”) 주소가 서로 동일하다는 것을 기억하시기 바랍니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그리고 API 함수 호출이 이어지는데요, 핵심 API 함수들의 호출 흐름만 살펴보면 아래와 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;OpenProcess()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// data : THREAD_PARAM&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;VirtualAllocEx()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;WriteProcessMemory()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;// code : ThreadProc()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;VirtualAllocEx()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;WriteProcessMemory()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;CreateRemoteThread()&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드의 핵심은 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#5C7FB0&quot;&gt;&lt;u&gt;상대방 프로세스에 data 와 code 를 각각 메모리 할당하고 인젝션&lt;/u&gt;&lt;/font&gt; 시켜 준다는 것입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
마지막으로 CreateRemoteThread() API 를 이용해서 원격 스레드를 실행시킵니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
+---+&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이로써 Code Injection 기법을 이용한 실습 예제 소스코드에 대한 설명을 마치도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
설명의 편의성을 위하여 매우 기초적인 실습 예제를 소개하였습니다. Code Injection 의 개념을 이해하시는데 어려움이 없을 거라 생각됩니다. 위 개념을 이해하셨다면 다양한 아이디어로 자신만의 Code Injection 기법을 연습해 보시기 바랍니다&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;제가 Code Injection 기법을 구현할 때 인젝션 시킬 코드 부분은 어셈블리 언어로 프로그래밍 합니다. 복잡한 것은 MASM 을 사용하고, 간단한 것은 OllyDbg 의 “Assemble” 명령을 사용합니다. (단축키 [Space]) 이렇게 만들어진 Hex 코드 버퍼를 위 InjectCode() 함수 내에서 상대방 프로세스에 인젝션 시켜줍니다. 이러한 방법은 좀 더 직관적인 인젝션 코드를 만드는데 도움이 됩니다. Code Injection 마지막 강좌에서 간단히 실습해보도록 하겠습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다음 강좌에서는 Code Injection 기법을 디버깅 하는 방법에 대해서 알아보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;☞ &lt;a href=&quot;http://www.reversecore.com/83&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/83]로 이동합니다.&quot;&gt;Code Injection 기법 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; &quot;&gt;ReverseCore&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7695150&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/82</guid>
			<comments>http://www.reversecore.com/82#entry82comment</comments>
			<pubDate>Wed, 23 Jun 2010 00:15:20 +0900</pubDate>
		</item>
		<item>
			<title>Code Injection 기법 (1)</title>
			<link>http://www.reversecore.com/81</link>
			<description>&lt;span style=&quot;font-size: 9pt; &quot;&gt;﻿&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Code Injection 기법에 대해 설명하고 실습 예제를 분석하겠습니다. DLL Injection 기법과 어떻게 다른지 비교 분석해보겠습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 본문 내용을 편하게 읽기 위해서는 아래의 배경지식이 필요합니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/38&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/38]로 이동합니다.&quot;&gt;DLL Injection – 다른 프로세스에 침투하기 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/73&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/73]로 이동합니다.&quot;&gt;DLL Injection in Windows 7 (1)&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;Code Injection&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Code Injection&lt;/font&gt;&lt;/b&gt; 이란 상대방 프로세스에 &lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;독립 실행 코드&lt;/font&gt;&lt;/i&gt;를 삽입한 후 실행 시키는 기법입니다. 일반적으로 CreateRemoteThread() API 를 이용하여 원격 스레드 형태로 실행 시키므로 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Thread Injection&lt;/font&gt;&lt;/b&gt; 이라고도 얘기합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래 그림은 Code Injection 의 개념을 보여주고 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/122CF9124C1F858F819382&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;code_injection.png&quot; height=&quot;225&quot; width=&quot;472&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
인젝션 대상이 되는 target.exe 프로세스에 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;코드와 데이터를 삽입&lt;/font&gt;&lt;/b&gt;합니다. 이때 코드의 형식은 스레드 프로시져(Thread Procedure) 형식으로 해주고, 코드에서 사용되는 데이터는 스레드의 파라미터로 전달해 주면 됩니다. 즉, 코드와 데이터를 각각 인젝션 시켜주는 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이와 같이 개념은 간단한데, 구현에 있어서 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;주의해야 할 내용&lt;/font&gt;&lt;/b&gt;이 있습니다. Code Injection 구현의 주의 사항에 대해서 DLL Injection 과 비교하여 설명 드리겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;☞ 참고 :&amp;nbsp;&lt;/font&gt;&lt;a href=&quot;http://www.reversecore.com/38&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/38]로 이동합니다.&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;DLL Injection – 다른 프로세스에 침투하기 (1)&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;DLL Injection vs Code Injection&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
아래와 같이 간단한 코드가 있습니다. 코드의 내용은 윈도우 메시지 박스를 출력하는 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;DWORD WINAPI ThreadProc(LPVOID lParam)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MessageBoxA(NULL, &quot;www.reversecore.com&quot;, &quot;ReverseCore&quot;, MB_OK);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
DLL Injection 기법이라면 위 코드를 DLL 파일 형태로 만든 후 다른 프로세스에 인젝션 시키면 됩니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 를 실행시켜 위 ThreadProc() 코드 영역을 살펴보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile5.uf.tistory.com/original/12463E054C1F86A6922D0B&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ThreadProc.png&quot; height=&quot;64&quot; width=&quot;525&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;u&gt;위 그림의 코드에서 사용되는 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;주소&lt;/font&gt;&lt;/b&gt;를 주목하시기 바랍니다.&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
먼저 10001002 주소의 &lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;PUSH 10009290&lt;/b&gt;&lt;/font&gt;&lt;/i&gt; 명령어와 그 밑의 &lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;PUSH 1000929C&lt;/b&gt;&lt;/font&gt;&lt;/i&gt; 명령어에 사용된 10009290, 1000929C 주소를 보겠습니다. 이 명령어들은 MessageBoxA() API 에 사용될 문자열(“ReverseCore”, “www.reversecore.com”) 주소를 스택에 저장시킵니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile3.uf.tistory.com/original/1318AD024C1F86EB7DB051&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;string.png&quot; height=&quot;70&quot; width=&quot;447&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;위 그림을 보시면 이 문자열들의 주소(10009290, 1000929C)는 &lt;b&gt;DLL의 데이터 섹션 영역&lt;/b&gt;에 위치합니다.&amp;nbsp;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이번에는 &amp;lt;Fig. 2&amp;gt; 에서 1000100E 주소의 &lt;b&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;CALL DWORD PTR DS:[100080F0]&lt;/font&gt; &lt;/i&gt;&lt;/b&gt;명령어에 사용된 100080F0 주소를 보겠습니다. 참고로 이 CALL 명령어는 바로 user32!MessageBoxA() API 호출 명령입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile6.uf.tistory.com/original/136511034C1F871A63D7D8&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;iat.png&quot; height=&quot;79&quot; width=&quot;351&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;위 그림에서 100080F0 주소는 바로 &lt;b&gt;DLL 의 IAT(Import Address Table) 영역&lt;/b&gt;임을 알 수 있습니다&lt;/font&gt;. (그 위로 다른 API 들의 주소를 확인 할 수 있습니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이와 같이 DLL 의 코드에서 사용되는 모든 데이터는 DLL 의 데이터 영역에 위치합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
따라서 &lt;u&gt;DLL Injection 기법으로 DLL 을 통째로 상대방 프로세스 메모리에 삽입시키면 코드와 데이터가 같이 메모리에 존재하기 때문에 코드는 정상적으로 실행될 수 있습니다.&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;Code Injection 은 필요한 코드(&amp;lt;Fig. 2&amp;gt;)를 인젝션 시키는 것입니다. 하지만 코드에서 사용되는 데이터(&amp;lt;Fig. 3&amp;gt;, &amp;lt;Fig. 4&amp;gt;) 도 같이 인젝션 시켜줘야 정상적으로 코드의 실행이 가능해집니다. (또한 인젝션된 데이터의 주소를 코드에서 잘 알아볼 수 있도록 프로그래밍 해야 합니다.)&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이러한 이유 때문에 DLL Injection 기법 보다 고려할 사항이 좀 더 많습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아래의 실습 예제 코드를 보시면 더 확실히 파악하실 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;코드 인젝션을 사용하는 이유&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
코드 인젝션은 DLL 인젝션과 비교하여 기능은 비슷하면서 고려해야 할 사항은 더 많기 때문에 사용하기 불편하게 느껴질 수 있습니다. 과연 코드 인젝션의 장점은 무엇일까요?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;1) 메모리를 적게 차지한다.&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
아주 작은 크기의 코드와 데이터를 인젝션 할 때는 DLL 로 만들어서 인젝션 시킬 필요가 없습니다. 간단히 코드 인젝션으로 구현하면 DLL 인젝션과 같은 기능을 제공하면서 메모리를 훨씬 적게 차지합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;2) 흔적을 찾기 어렵다.&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
DLL 인젝션은 해당 프로세스 메모리에 흔적을 남기기 때문에 간단히 인젝션 여부를 알 수 있습니다. 하지만 Code 인젝션은 쉽게 흔적을 남기지 않습니다. (물론 이 역시 알아낼 수 있는 방법이 있습니다.) 이 특징 때문에 악성코드에서도 코드 인젝션을 많이 사용합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;3) 기타&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
별도의 DLL 파일 없이 Code Injector 프로그램만 있으면 됩니다. 또한 처음에는 생소하지만 일단 익숙해 지게 되면 아주 쉽고 편리하게 구현이 가능합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
간단히 정리하면 &lt;u&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;DLL Injection 은 규모가 크고 복잡한 일을 수행할 때 사용하고, Code Injection 은 규모가 작고 간단한 일을 수행할 때 사용합니다.&lt;/font&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;실습 예제(CodeInjection.exe)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile21.uf@20491A014C1F87C766AA91.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; CodeInjection.exe&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
실습 예제는 notepad.exe 프로세스에 간단한 코드를 인젝션 시켜서 메시지 박스를 출력하는 내용입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고!&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;CodeInjection.exe 는 Visual C++ 2008 Express Edition 으로 개발되었으며 Windows 7 32bit 환경에서 테스트 되었습니다.&amp;nbsp;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#1. notepad.exe 실행&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
notepad.exe 를 실행 시킨 후 Process Explorer 를 이용하여 notepad.exe 프로세스의 PID 를 확인합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile30.uf.tistory.com/original/183F170D4C1F8805A2EB0A&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_notepad.png&quot; height=&quot;471&quot; width=&quot;356&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
제 테스트 환경에서 notepad.exe 의 PID 는 1896 입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#2. CodeInjection.exe 실행&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
첨부된 CodeInjection.exe 파일을 실행시킵니다. 이때 실행 파라미터로 앞에서 구한 notepad.exe 의 PID 값을 입력합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile27.uf.tistory.com/original/1944A8194C1F89C8C8F7A6&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd_ci.png&quot; height=&quot;131&quot; width=&quot;530&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 6&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#3. 메시지 박스 확인&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile6.uf.tistory.com/original/201AD9164C1F89E4A2E38D&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;notepad_msgbox.png&quot; height=&quot;249&quot; width=&quot;372&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 7&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
메시지 박스가 notepad.exe 윈도우의 밑에 깔려 있으므로 확인 하실 때 주의하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다음 강좌에서 실습 예제의 소스 코드를 보면서 어떻게 구현되었는지 자세히 확인해 보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;☞ &lt;a href=&quot;http://www.reversecore.com/82&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/82]로 이동합니다.&quot;&gt;Code Injection 기법 (2)&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; &quot;&gt;ReverseCore&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; font-weight: bold; &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7674394&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>API Hooking</category>
			<category>Code Injection</category>
			<category>CreateRemoteThread</category>
			<category>GetProcAddress</category>
			<category>GetThreadContext</category>
			<category>it</category>
			<category>LoadLibrary</category>
			<category>MessageBox</category>
			<category>OpenProcess</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>SetThreadContext</category>
			<category>Thread Injection</category>
			<category>VirtualAllocEx</category>
			<category>WriteProcessMemory</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/81</guid>
			<comments>http://www.reversecore.com/81#entry81comment</comments>
			<pubDate>Tue, 22 Jun 2010 00:25:44 +0900</pubDate>
		</item>
		<item>
			<title>Advanced Global API Hooking – IE 접속 제어 (4)</title>
			<link>http://www.reversecore.com/80</link>
			<description>&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;﻿&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Global API Hooking 예제 코드를 분석하면서 해당 기술에 대한 이해를 돕습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
본 내용을 읽기 전에 이전 포스트를 참고하세요. 같이 이어지는 내용입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/77&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/77]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/78&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/78]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/79&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/79]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;모든 소스 코드는 MS Visual C++ 2008 Express Edition 으로 개발 되었으며, Windows 7 32bit &amp;amp; IE 8 에서 테스트 되었습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
전체 소스 코드는 아래 첨부된 파일을 참고하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile21.uf@16302A1F4BF01E0A8EA634.cpp&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/110706133414/blog/image/extension/unknown.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; redirect.cpp&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
주요 함수에 대해 설명 드리겠습니다. &lt;u&gt;설명의 편의를 위해서 에러 처리 관련 코드는 제거하였습니다.&lt;/u&gt; 에러 처리 코드가 포함된 원본 함수의 전체 코드는 첨부된 파일에서 확인하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;b&gt;DllMain()&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
먼저 DllMain() 함수를 살펴보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;char &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;szCurProc[MAX_PATH] = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;char &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*p = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;switch( fdwReason )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case DLL_PROCESS_ATTACH :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GetModuleFileName(NULL, szCurProc, MAX_PATH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;p = strrchr(szCurProc, &#039;\\&#039;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if( (p != NULL) &amp;amp;&amp;amp; !_stricmp(p+1, &quot;iexplore.exe&quot;) )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// wininet!InternetConnectW() API 를 후킹 하기 전에&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp; 미리 wininet.dll 을 로딩 시킴&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;LoadLibrary(&quot;wininet.dll&quot;);&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;&amp;nbsp;// hook&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hook_by_code(&quot;ntdll.dll&quot;, &quot;ZwResumeThread&quot;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (PROC)NewZwResumeThread, g_pZWRT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hook_by_code(&quot;wininet.dll&quot;, &quot;InternetConnectW&quot;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (PROC)NewInternetConnectW, g_pICW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case DLL_PROCESS_DETACH :&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5FB636&quot;&gt; &amp;nbsp; &lt;/font&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;&amp;nbsp;// unhook&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;unhook_by_code(&quot;ntdll.dll&quot;, &quot;ZwResumeThread&quot;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_pZWRT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;unhook_by_code(&quot;wininet.dll&quot;, &quot;InternetConnectW&quot;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_pICW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return TRUE;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
DllMain() 함수의 핵심 기능은 ntdll!ZwResumeThread() 와 wininet!InternetConnectW() API 의 hook/unhook 입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
한가지 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;특이한 코드&lt;/b&gt;&lt;/font&gt;는 실행 프로세스 이름이 iexplorer.exe 인 경우 wininet.dll 을 로딩 시키는 코드입니다. iexplore.exe 프로세스가 정상적으로 실행되면 기본적으로 wininet.dll 을 로딩하고 있는데 왜 굳이 추가적으로 로딩을 시키는 걸까요? 그 이유는 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Global API Hooking&lt;/font&gt;&lt;/b&gt; 때문입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ntdll!ZwResumeThread() 를 이용한 API 후킹은 해당 프로세스의 메인 스레드가 시작되기 전에 제&lt;/div&gt;
&lt;div&gt;
어를 가로채기 때문에 우리가 후킹하려는 wininet.dll 모듈이 아직 로딩되어 있지 않는 상황이 발생할 수 있습니다. 이를 방지 하기 위해서 iexplore.exe 프로세스인 경우 wininet!InternetConnectW() API 를 후킹하기 전에 무조건 wininet.dll 을 로딩시키는 것입니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;NewInternetConnectW()&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
wininet!InternetConnectW() 의 후킹 함수인 NewInternetConnectW() 함수에 대한 설명입니다. 이 함수는 IE 의 접속 주소를 모니터링 하면서 특정 사이트에 접속을 시도할 때 원하는 사이트로 접속을 돌리는 역할을 수행합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;HINTERNET WINAPI NewInternetConnectW&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HINTERNET hInternet,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;LPCWSTR lpszServerName,&lt;/b&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;INTERNET_PORT nServerPort,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPCTSTR lpszUsername,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPCTSTR lpszPassword,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD dwService,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD dwFlags,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD_PTR dwContext&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HINTERNET hInt = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC pFunc = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HMODULE hMod = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// unhook&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unhook_by_code(&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;wininet.dll&quot;&lt;/font&gt;, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;InternetConnectW&quot;&lt;/font&gt;, g_pICW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// call original API&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hMod = GetModuleHandle(&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;wininet.dll&quot;&lt;/font&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pFunc = GetProcAddress(hMod, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;InternetConnectW&quot;&lt;/font&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( !_wcsicmp(lpszServerName, L&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;www.naver.com&quot;&lt;/font&gt;) ||&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;!_wcsicmp(lpszServerName, L&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;www.daum.net&quot;&lt;/font&gt;) ||&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;!_wcsicmp(lpszServerName, L&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;www.nate.com&quot;&lt;/font&gt;) ||&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;!_wcsicmp(lpszServerName, L&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;www.yahoo.com&quot;&lt;/font&gt;) )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hInt = ((PFINTERNETCONNECTW)pFunc)(hInternet,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; L&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;www.reversecore.com&quot;&lt;/font&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nServerPort,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lpszUsername,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lpszPassword,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwService,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwFlags,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwContext);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hInt = ((PFINTERNETCONNECTW)pFunc)(hInternet,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lpszServerName,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nServerPort,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lpszUsername,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lpszPassword,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwService,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwFlags,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwContext);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;&amp;nbsp;// hook&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;!hook_by_code(&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;wininet.dll&quot;&lt;/font&gt;, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;InternetConnectW&quot;&lt;/font&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(PROC)NewInternetConnectW, g_pICW;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return hInt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 함수의 코드는 매우 단순합니다. 함수의 2 번째 파라미터인 lpszServerName 문자열이 바로 접속 주소입니다. 이 접속주소를 모니터링 하여 우리나라 4 대 포탈 사이트(Naver, Daum, Nate, Yahoo)인 경우, 제 블로그(ReverseCore)로 연결을 바꿔버립니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
hook_by_code() / unhook_by_code() 에 대한 설명은 아래 포스트를 참고하시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/67&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/67]로 이동합니다.&quot;&gt;API Hooking – ‘스텔스’ 프로세스 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;NewZwResumeThread()&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
ntdll!ZwResumeThread() 의 후킹 함수인 NewZwResumeThread() 함수입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;NTSTATUS WINAPI NewZwResumeThread(HANDLE ThreadHandle, PULONG SuspendCount)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;NTSTATUS status, statusThread;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC pFunc = NULL, pFuncThread = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD dwPID = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;static DWORD dwPrevPID = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;THREAD_BASIC_INFORMATION tbi;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HMODULE hMod = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;char szModPath[MAX_PATH] = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// call ntdll!ZwQueryInformationThread()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hMod = GetModuleHandle(&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ntdll.dll&quot;&lt;/font&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pFuncThread = GetProcAddress(hMod, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ZwQueryInformationThread&quot;&lt;/font&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;statusThread = ((PFZWQUERYINFORMATIONTHREAD)pFuncThread)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (ThreadHandle, 0, &amp;amp;tbi, sizeof(tbi), NULL);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// Dll Injection to the new child process&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dwPID = (DWORD)tbi.ClientId.UniqueProcess;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ( (dwPID != GetCurrentProcessId()) &amp;amp;&amp;amp; (dwPID != dwPrevPID) )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dwPrevPID = dwPID;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// change privilege&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;SetPrivilege(SE_DEBUG_NAME, TRUE);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// get injection dll path&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GetModuleFileName(GetModuleHandle(STR_MODULE_NAME),&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;szModPath,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MAX_PATH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// call InjectDll()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InjectDll(dwPID, szModPath);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;&amp;nbsp;// unhook&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unhook_by_code(&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ntdll.dll&quot;&lt;/font&gt;, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ZwResumeThread&quot;&lt;/font&gt;, g_pZWRT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// call ntdll!ZwResumeThread()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;pFunc = GetProcAddress(hMod, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ZwResumeThread&quot;&lt;/font&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;status = ((PFZWRESUMETHREAD)pFunc)(ThreadHandle, SuspendCount);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#2B8400&quot;&gt;// hook&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;hook_by_code(&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ntdll.dll&quot;&lt;/font&gt;, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&quot;ZwResumeThread&quot;&lt;/font&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (PROC)NewZwResumeThread, g_pZWRT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return status;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
NewResumeThread() 함수의 첫 번째 파라미터는 resume 시킬 스레드의 ThreadHandle 입니다. 지난번 설명에서 이 스레드는 바로 &lt;u&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;자식 프로세스의 메인 스레드&lt;/font&gt;&lt;/u&gt;라고 설명 드렸습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ 참고 : &lt;a href=&quot;http://www.reversecore.com/79&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/79]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
따라서 NewResumeThread() 함수 초반부의 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;ZwQueryInformationThread() API 를 호출하는 이유&lt;/b&gt;&lt;/font&gt;는 바로 ThreadHandle 이 가리키는 스레드(자식 프로세스의 스레드) 가 소속된 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;자식 프로세스의 PID 를 얻기 위함&lt;/b&gt;&lt;/font&gt;입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이렇게 ThreadHandle 파라미터를 이용하여 (지금 막 생성된) 자식 프로세스의 PID 를 얻어 내었습니다. 이 PID 를 이용하여 redirect.dll (후킹 DLL) 을 인젝션 시켜 줍니다. &lt;u&gt;해당 자식 프로세스는 메인 스레드가 실행되기도 전에 이미 redirect.dll 이 인젝션 되면서 자동으로 API 후킹이 걸리게 됩니다.&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
마지막으로 ntdll!ZwResumeThread() API 를 정상적으로 호출하여 자식 프로세스의 메인 스레드를 resume 시킵니다. 이제 자식 프로세스는 API 가 후킹된 채로 정상 실행됩니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;High-Level API Hooking vs Low-Level API Hooking&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
위의 ntdll!ZwResumeThread() API 후킹 방법은 단순히 kernel32!CreateProcess() API 를 후킹하는 것보다 더 강력하고 편리한 방법입니다. 왜냐하면 CreateProcess() 는 내부적으로 CreateProcessInternal() 을 호출합니다. 만약 프로그램에서 CreateProcessInternal() 을 직접 호출한다면 정상적인 후킹이 되지 않습니다. (차라리 CreateProcessInternal() 을 후킹하는 것이 더 좋은 방법입니다. – 좋은 방법을 가르쳐 주신 iwillhackyou 님께 감사드립니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;u&gt;
이런 식으로 Low-Level API (ntdll.dll 에서 제공되는 API) 를 후킹할수록 더 강력합니다. 하지만 대부분의 Low-Level API 들은 undocumented 되어 있으며, OS 버전에 따라 변경될 가능성이 존재합니다. 반면에 High-Level API (kernel32.dll 레벨 - documented) 들은 변경될 가능성이 없고 잘 문서화 되어 있기 때문에 안정적인 후킹이 가능합니다. 대신에 후킹 성능이 좀 떨어집니다.&lt;/u&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
따라서 High-Level API 후킹과 Low-Level API 후킹은 서로 일장 일단이 있기 때문에 상황에 맞게 적절히 선택하여 구현하시는 것이 현명한 방법입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
+---+&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다음 강좌는 Code Injection 을 통한 API 후킹에 대한 내용입니다. 지금까지는 DLL 을 인젝션 시켜서 API 후킹을 진행하였지만, 짤막한 코드를 삽입시켜 동일한 기능을 구현하는 것입니다. DLL Injection 방법과 많은 차이점이 있으며, 이 또한 흥미로운 주제가 될 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(48, 88, 210); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; &quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(62, 62, 62); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; font-weight: normal; line-height: 21px; font-size: 14px; &quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot; face=&quot;&#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif&quot; size=&quot;4&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px; line-height: 21px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=7056959&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>CreateProcess</category>
			<category>CreateProcessInternal</category>
			<category>Global API Hooking</category>
			<category>hook_by_code</category>
			<category>IE</category>
			<category>Internet Explorer</category>
			<category>InternetConnect</category>
			<category>it</category>
			<category>kernel32.dll</category>
			<category>NtCreateUserProcess</category>
			<category>NtResumeThread</category>
			<category>redirect</category>
			<category>redirection</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>unhook_by_code</category>
			<category>wininet.dll</category>
			<category>ZwCreateUserProcess</category>
			<category>ZwResumeThread</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>우회</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/80</guid>
			<comments>http://www.reversecore.com/80#entry80comment</comments>
			<pubDate>Mon, 17 May 2010 01:29:58 +0900</pubDate>
		</item>
		<item>
			<title>Advanced Global API Hooking – IE 접속 제어 (3)</title>
			<link>http://www.reversecore.com/79</link>
			<description>&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Global API Hooking 예제를 실습하겠습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
본 내용을 읽기 전에 이전 포스트를 참고하세요. 같이 이어지는 내용입니다.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/77&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/77]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/78&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/78]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고!&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;모든 소스 코드는 MS Visual C++ 2008 Express Edition 으로 개발 되었으며, Windows 7 32bit &amp;amp; IE 8 에서 테스트 되었습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;실습 예제 – IE 접속 제어&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile30.uf@1643E5184BE2DFE17C837E.dll&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/dll.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; redirect.dll&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile22.uf@142F84184BE2DFDF01FAAD.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; InjDll.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;# 실습 내용&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 프로세스의 특정 API 를 후킹 하여 국내 4 대 포탈 사이트(Naver, Daum, Nate, Yahoo)에 접속 시도할 때 &lt;a href=&quot;http://www.reversecore.com&quot; target=&quot;_blank&quot; title=&quot;[http://www.reversecore.com]로 이동합니다.&quot;&gt;www.reversecore.com&lt;/a&gt; 주소로 연결 시켜버립니다. 또한 IE 의 탭이 새로 생성되면서 동시에 프로세스가 추가되는 경우를 대비해서 Global API Hooking 기법을 사용하였습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
API 후킹은 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;redirect.dll 을 인젝션&lt;/font&gt; 시켜서 구현합니다. redirect.dll 은 아래 2 개의 API 를 후킹합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;wininet!InternetConnectW() &amp;nbsp; - IE 프로세스의 접속 주소를 제어하기 위해 후킹&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;ntdll!ZwResumeThread() &amp;nbsp; &amp;nbsp; &amp;nbsp; – Global API Hooking 구현을 위해 후킹&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
* Global API Hooking 에 대한 자세한 설명은 아래 글을 참고하세요.&lt;/div&gt;
&lt;div&gt;
☞&amp;nbsp;&lt;a href=&quot;http://www.reversecore.com/78&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/78]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#1. IE 실행&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
실습을 위해서 먼저 IE 를 실행시켜 주시기 바랍니다. 그리고 Process Explorer 를 이용하여 현재 실행중인 IE 프로세스의 구조를 살펴 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile28.uf.tistory.com/original/177B2D024BE2E0BE6BAA02&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_ie.png&quot; height=&quot;511&quot; width=&quot;360&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림을 보시면 IE 프로세스는 부모-자식 관계로 실행되는 것을 알 수 있습니다.&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;u&gt; 부모 프로세스만 ntdll!ZwResumeThread() API 를 후킹해도 이후부터 생성되는 모든 IE 프로세스들은 자동으로 후킹됩니다.&lt;/u&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#2. DLL Injection&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
redirect.dll 파일을 IE 프로세스(iexplore.exe) 에 인젝션 시킵니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile6.uf.tistory.com/original/1220C81A4BE2E0F5587850&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd_inject.png&quot; height=&quot;173&quot; width=&quot;514&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Process Explorer 를 이용해서 IE 프로세스에 redirect.dll 파일이 정상적으로 인젝션 되었는지 확인합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/1760471D4BE2E115436239&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_search_redirect.png&quot; height=&quot;272&quot; width=&quot;508&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3 &amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#3. 새로운 탭 생성&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 에서 새로운 탭을 생성합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile23.uf.tistory.com/original/1608A21E4BE2E1363C9C61&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ie_new_tab.png&quot; height=&quot;312&quot; width=&quot;578&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Process Explorer 를 이용해서 새로 생긴 탭과 연결된 프로세스(PID:3136)에 redirect.dll 이 제대로 인젝션 되었는지 확인합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/114DCA054BE2E15799DDC3&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_ie_new_tab.png&quot; height=&quot;511&quot; width=&quot;360&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ntdll!ZwResumeThread() API 후킹을 통한 Global API Hooking 이 성공하였습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#4. 포탈 사이트 접속&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 의 아무 탭에서 국내 4 대 포탈 사이트에 접속을 시도해 보세요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
www.naver.com&lt;/div&gt;
&lt;div&gt;
www.daum.net&lt;/div&gt;
&lt;div&gt;
www.nate.com&lt;/div&gt;
&lt;div&gt;
www.yahoo.com&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/113B2E0D4BE2E1AC1408F6&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ie_redirect_on.png&quot; height=&quot;312&quot; width=&quot;578&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 6&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서처럼 주소는 naver 지만 실제로는 ReverseCore 사이트가 연결되었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#5. DLL Ejection&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 프로세스에서 redirect.dll 을 내려보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/original/2037CE1C4BE2E24333F9E0&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd_eject.png&quot; height=&quot;181&quot; width=&quot;521&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 7&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Process Explorer 를 이용하여 redirect.dll 가 정상적으로 ejection 되었는지 확인합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile8.uf.tistory.com/original/1174D31E4BE2E25C7A6396&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_search_redirect_no.png&quot; height=&quot;272&quot; width=&quot;508&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 8&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제 다시 naver 에 접속해보면 이제는 정상적으로 접속하는 것을 확인하실 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/125722184BE2E2899488DF&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ie_no_redirect.png&quot; height=&quot;312&quot; width=&quot;578&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 9&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;#6. 추가 실습&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위에 소개된 InjDll.exe 와 redirect.dll 파일을 이용해서 각자 좀 더 실습을 많이 해보시기 바랍니다. Global API Hooking 기법에 대한 개념을 확실히 이해하실 수 있으실 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;
- 전체 프로세스 후킹&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;- explorer.exe 만 후킹 (이후 IE 실행)&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
+---+&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
실습 내용이 길어진 관계로 redirect.dll 파일의 소스 코드 설명은 다음 강좌에 하겠습니다. (조금 빨리 올리겠습니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/80&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/80]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (4)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(62, 62, 62); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; font-weight: normal; line-height: 21px; font-size: 14px; &quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(62, 62, 62); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; font-weight: normal; line-height: 21px; font-size: 14px; &quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190); &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(62, 62, 62); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; font-weight: normal; line-height: 21px; font-size: 14px; &quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(62, 62, 62); font-weight: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 255);&quot;&gt;위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=6917100&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>CreateProcess</category>
			<category>CreateProcessInternal</category>
			<category>Global API Hooking</category>
			<category>IE</category>
			<category>Internet Explorer</category>
			<category>InternetConnect</category>
			<category>it</category>
			<category>kernel32.dll</category>
			<category>NtCreateUserProcess</category>
			<category>NtResumeThread</category>
			<category>redirect</category>
			<category>redirection</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>wininet.dll</category>
			<category>ZwCreateUserProcess</category>
			<category>ZwResumeThread</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>우회</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/79</guid>
			<comments>http://www.reversecore.com/79#entry79comment</comments>
			<pubDate>Fri, 07 May 2010 00:26:16 +0900</pubDate>
		</item>
		<item>
			<title>Advanced Global API Hooking – IE 접속 제어 (2)</title>
			<link>http://www.reversecore.com/78</link>
			<description>&lt;font class=&quot;Apple-style-span&quot; face=&quot;&#039;Courier New&#039;&quot;&gt;&lt;br /&gt;
&lt;/font&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Global API Hooking 에 대한 기본 개념을 정리합니다. 또한 ntdll!ZwResumeThread() API 의 후킹을 통한 Global API Hooking 기법의 원리를 살펴봅니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/115E841F4BD454B26DAA65&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;global_api_hooking2.png&quot; height=&quot;370&quot; width=&quot;530&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Global API Hooking&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
본 내용을 읽기 전에 이전 포스트를 참고하세요. 같이 이어지는 내용입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/77&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/77]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;&lt;i&gt;* 참고!&lt;/i&gt;&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;모든 소스 코드는 MS Visual C++ 2008 Express Edition 으로 개발 되었으며, Windows 7 32bit &amp;amp; IE 8 에서 테스트 되었습니다.&lt;/i&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;Global API Hooking&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
Global API Hooking 에 대해서 다시 한번 간단히 정리하고 넘어가겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
지금까지의 강좌를 통해서 우리는 특정 프로세스에 대해 원하는 API 의 후킹을 간단하게 구현할 수 있게 되었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;
* 참고&amp;nbsp;&lt;/i&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;☞ &lt;/i&gt;&lt;/font&gt;&lt;a href=&quot;http://www.reversecore.com/59&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/59]로 이동합니다.&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;API Hooking – 계산기, 한글을 배우다 (1)&lt;/i&gt;&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;☞ &lt;/i&gt;&lt;/font&gt;&lt;a href=&quot;http://www.reversecore.com/65&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/65]로 이동합니다.&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;API Hooking – ‘스텔스’ 프로세스 (1)&lt;/i&gt;&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
#1. 일반적인 API Hooking&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
일반적인 API 후킹의 문제는 후킹을 원하는 프로세스가 생성될 때마다 매번 API 후킹을 해줘야 한다는 것입니다. 아래 그림은 DLL Injection 기법을 이용한 일반적인 API Hooking 을 표현한 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile21.uf.tistory.com/original/150DC70C4BD455CB44BBD9&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;normal_api_hooking2.png&quot; height=&quot;370&quot; width=&quot;530&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서 후킹 대상 프로세스는 Test.exe(PID:2492) 입니다. InjDll.exe 프로그램을 이용해서 Hook.dll 을 Test.exe 프로세스에 인젝션 시켜서 원하는 API 를 후킹 하였습니다. (1)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그런데 이후에 또 다른 Test.exe(PID:3796) 프로세스가 생성되었다면 이 프로세스에도 역시 Hook.dll 을 인젝션 시켜줘야 (PID:3796 프로세스에 대한) 정상적인 API 후킹이 이루어 질 것입니다. (2)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;u&gt;
즉, 후킹 대상 프로세스가 새로 생성 될 때마다 계속해서 수동으로 API 후킹을 시켜야 합니다.&lt;/u&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
#2. Global API Hooking&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이번에는 Global API Hooking 을 살펴보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile3.uf.tistory.com/original/195920194BD455FD06FB32&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;global_api_hooking2.png&quot; height=&quot;370&quot; width=&quot;530&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
InjDll.exe 는 Windows 운영체제의 기본 쉘(Shell) 인 Explorer.exe 프로세스에 gHook.dll 을 인젝션 시킵니다. (후킹하고자 하는 Test.exe 가 아닌, Test.exe 를 실행시켜주는 프로세스인 Explorer.exe 를 후킹한다는 것이 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;핵심&lt;/b&gt;&lt;/font&gt;입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
gHook.dll 은 &amp;lt;Fig. 1&amp;gt; 의 Hook.dll 의 기능에다가&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt; 자식 프로세스 생성에 관련된 API 를 후킹하여 자식 프로세스를 생성할 때마다 자신(gHook.dll)을 인젝션 시키는 기능&lt;/font&gt;을 가지고 있습니다. (위 &amp;lt;Fig. 2&amp;gt; 참조)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;u&gt;
따라서 Windows 쉘인 Explorer.exe 프로세스에 gHook.dll 을 한번 인젝션 시켜놓으면 그 이후 Explorer.exe 에서 생성되는 모든 자식 프로세스들에게 자동으로 gHook.dll 이 인젝션 됩니다.&lt;/u&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이것이 자동 API Hooking 의 기본 개념이며, 이를 시스템에 실행중인 모든 프로세스를 대상으로 확장한 것이 바로&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt; Global API Hooking&lt;/font&gt;&lt;/b&gt; 입니다.&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/i&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;Explorer.exe 외에 다른 프로세스들도 자식 프로세스를 생성할 수 있습니다. 따라서 원칙적으로 Global API Hooking 을 완벽히 구현하려면 현재 실행중인 모든 프로세스들을 후킹 해야 합니다.&amp;nbsp;&lt;/i&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;하지만 시스템 안정성과 불필요한 오버헤드를 막기 위해 작업 내용에 따라서 특정 프로세스만 후킹 하는 경우도 있습니다. (제가 실습 예제로 준비한 IE 후킹이 대표적인 경우입니다.)&lt;/i&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이상으로 Global API Hooking 개념에 대해서 정리해 보았습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이제부터 어떤 API 를 후킹해야 Global API Hooking 을 쉽게 구현할 수 있는지 알아보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;ntdll!ZeResumeThread() API&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
자식 프로세스를 생성하는 API 에 대해서 생각해 보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
프로세스를 생성하는 API 는 단연 kernel32!CreateProcess() API 가 대표적입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
* 참고 – kernel32!CreateProcess() API 를 이용한 Global API Hooking 방법&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;☞&amp;nbsp;&lt;/font&gt;&lt;/i&gt;&lt;a href=&quot;http://www.reversecore.com/65&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/65]로 이동합니다.&quot;&gt;&lt;i&gt;&lt;/i&gt;&lt;/a&gt;&lt;a href=&quot;http://www.reversecore.com/68&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/68]로 이동합니다.&quot;&gt;&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;API Hooking – ‘스텔스’ 프로세스 (4)&lt;/font&gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
CreateProcess() API 의 디버깅을 위하여 다음과 같이 간단한 프로그램을 만들어 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;// cptest.cpp&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;#include &quot;windows.h&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;#include &quot;tchar.h&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;void main()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;STARTUPINFO &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; si = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PROCESS_INFORMATION &amp;nbsp; &amp;nbsp; pi = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;TCHAR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; szCmd[MAX_PATH] = {0,};&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;si.cb = sizeof(STARTUPINFO);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_tcscpy(szCmd, L&quot;notepad.exe&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( !CreateProcess(NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpApplicationName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; szCmd, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // lpCommandLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpProcessAttributes&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpThreadAttributes&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FALSE, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // bInheritHandles&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NORMAL_PRIORITY_CLASS, &amp;nbsp; &amp;nbsp; // dwCreationFlags&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpEnvironment&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// lpCurrentDirectory&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;si, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // lpStartupInfo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;pi) ) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // lpProcessInformation&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( pi.hProcess != NULL )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CloseHandle(pi.hProcess);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 코드로 빌드 시킨 프로그램입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile4.uf@130F8E154BD4574AD87AB7.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; cptest.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
cptest.exe 를 디버깅 해보면 프로세스 생성과 관련된 API 들의 호출 흐름을 알 수 있습니다.&lt;/div&gt;
&lt;div&gt;
아래 그림은 cptest.exe 의 kernel32!CreateProcessW() 호출 코드입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;
* 참고 : CreateProcessW 는 CreateProcess 의 Wide Character (유니코드)버전입니다.&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/original/162DF9154BD4577B6C0C76&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cptest.png&quot; height=&quot;241&quot; width=&quot;594&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
kernel32!CreateProcessW() 내부로 따라 들어가면 아래 그림과 같이 kernel32!CreateProcessInternalW() 호출 코드를 볼 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile5.uf.tistory.com/original/1317C7214BD457B038E2DD&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;createprocessw.png&quot; height=&quot;294&quot; width=&quot;560&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서 아래쪽의 스택 메모리를 보시면 &amp;lt;Fig. 3&amp;gt; 의 스택(함수 파라미터)이 거의 동일하게 넘어온걸 알 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
kernel32!CreateProcessInternalW() 내부로 들어가 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/13505E224BD457D54F6706&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;createprocessinternalw1.png&quot; height=&quot;136&quot; width=&quot;561&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
kernel32!CreateProcessInternalW() 는 상당히 큰 함수입니다. 아래로 쭉 스크롤을 내리면 아래 그림과 같이 ntdll!ZwCreateProcess() 를 호출하는 코드가 나타납니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile28.uf.tistory.com/original/1253E4174BD4580F019024&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;createprocessinternalw2.png&quot; height=&quot;285&quot; width=&quot;557&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 6&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림에서 아래쪽의 스택을 보시면 &amp;lt;Fig. 4&amp;gt; 에서의 스택과는 많이 다른 형태인 것을 알 수 있습니다. 2번째 파라미터(Arg2)는 어떤 구조체 인데 왼쪽의 Hex dump 창을 보시면 구조체 멤버 중에 12F950 주소의 12FD38(“notepad”) 문자열 주소를 확인 하실 수 있습니다. (&amp;lt;Fig. 3&amp;gt; 스택 참조)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Ntdll!ZwCreateUserProcess() 가 호출되면 자식 프로세스가 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;SUSPEND 모드로 실행&lt;/font&gt;&lt;/b&gt;됩니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile22.uf.tistory.com/original/12396C154BD4583B2B0C10&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp1.png&quot; height=&quot;388&quot; width=&quot;320&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 7&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
notepad.exe 프로세스는 생성되었지만 아직 EP 코드가 실행되지 않은 상태입니다.&lt;/div&gt;
&lt;div&gt;
&amp;lt;Fig. 6&amp;gt; 코드에서 계속 아래로 진행하면 ntdll!ZwResumeThread() API 호출 코드가 나타납니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/121D221E4BD458550A087F&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;createprocessinternalw3.png&quot; height=&quot;74&quot; width=&quot;494&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 8&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ntdll!ZwResumeThread() 는 함수 이름 그대로 스레드를 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;RESUME&amp;nbsp;&lt;/b&gt;&lt;/font&gt;시켜줍니다. 이 스레드가 바로 자식 프로세스(notepad.exe) 의 메인 스레드입니다. 따라서 이 API 가 호출되면 비로소 자식 프로세스의 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;EP 코드가 실행&lt;/font&gt;&lt;/b&gt;됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile7.uf.tistory.com/original/125C931B4BD4588F1B6598&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp2.png&quot; height=&quot;388&quot; width=&quot;320&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 9&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
지금까지의 API 호출 흐름을 정리하면 아래와 같습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;kernel32!CreateProcessW&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;kernel32!CreateProcessInternalW&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;ntdll!ZwCreateUserProcess &amp;nbsp; &amp;nbsp; &amp;nbsp;// 프로세스 생성됨 (메인 스레드는 suspend 상태)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ntdll!ZwResumeThread&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;	&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;// 메인 스레드 resume 시킴 (프로세스 실행됨)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
자식 프로세스 생성에 있어서 가장 마지막에 호출되는 API 가 바로 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;ntdll!ZwResumeThread()&lt;/b&gt;&lt;/font&gt; 입니다. 따라서 우리는 이 API 를 후킹함으로써&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt; 자식 프로세스의 EP 코드가 실행되기 직전에 제어를 가로챈 후 원하는 API 를 후킹&lt;/b&gt;&lt;/font&gt;시킬 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
ntdll!ZwResumeThread() 는 undocumented API 이며, 함수 정의는 아래와 같습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(193, 193, 193); border-right-color: rgb(193, 193, 193); border-bottom-color: rgb(193, 193, 193); border-left-color: rgb(193, 193, 193); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;NTSTATUS NtResumeThread(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp;IN &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;HANDLE ThreadHandle,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp;OUT&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;PULONG SuspendCount OPTIONAL&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;* 출처&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size:10.0pt;mso-bidi-font-size:
11.0pt;font-family:&amp;quot;맑은 고딕&amp;quot;;mso-ascii-theme-font:minor-latin;mso-fareast-theme-font:
minor-fareast;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;
mso-bidi-theme-font:minor-bidi;mso-ansi-language:EN-US;mso-fareast-language:
KO;mso-bidi-language:AR-SA&quot;&gt;&lt;a href=&quot;http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Thread/NtResumeThread.html&quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/NT%20Objects/Thread/NtResumeThread.html&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/font&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;* 참고&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;User Mode &lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;에서&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt; ntdll!ZwResumeThread() API &lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;와&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt; ntdll!NtResumeThread() API &lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;는 동일합니다&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;i&gt;.&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위에서 소개한 4 개의 API (CreateProcessW, CreateProcessInternalW, ZwCreateUserProcess, ZwResumeThread) 중에서 어떤걸 후킹해도 Global API Hooking 이 가능합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다만 상위에 위치한 CreateProcessW() 함수를 후킹하면 특정 경우(CreateProcessInternalW 를 직접 호출하는 경우)에 후킹이 되지 않을 수 있습니다. 따라서 CreateProcessInternalW() 이하를 후킹하는 것이 더 좋은 방법입니다. (각자 장단점이 있을 수 있으므로 모두 연습해 두시는 것이 좋을 것 같습니다.)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
다음 시간에는 Global 후킹 실습을 한 후 실제 코드를 살펴보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;☞ &lt;a href=&quot;http://www.reversecore.com/79&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/79]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (3)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(62, 62, 62); font-family: &#039;맑은 고딕&#039;, Gulim, Dotum, Verdana, AppleGothic, sans-serif; line-height: 21px; font-size: 14px; &quot;&gt;&lt;strong&gt;&lt;font color=&quot;#3058d2&quot; style=&quot;background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=6751332&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>CreateProcess</category>
			<category>CreateProcessInternal</category>
			<category>Global API Hooking</category>
			<category>IE</category>
			<category>Internet Explorer</category>
			<category>InternetConnect</category>
			<category>it</category>
			<category>kernel32.dll</category>
			<category>NtCreateUserProcess</category>
			<category>NtResumeThread</category>
			<category>redirect</category>
			<category>redirection</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>wininet.dll</category>
			<category>ZwCreateUserProcess</category>
			<category>ZwResumeThread</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>우회</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/78</guid>
			<comments>http://www.reversecore.com/78#entry78comment</comments>
			<pubDate>Sun, 25 Apr 2010 23:40:59 +0900</pubDate>
		</item>
		<item>
			<title>Advanced Global API Hooking – IE 접속 제어 (1)</title>
			<link>http://www.reversecore.com/77</link>
			<description>&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;﻿&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
좀 더 고급스러운 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;Global API Hooking&lt;/font&gt;&lt;/b&gt; 방법에 대해서 알아보겠습니다.&lt;/div&gt;
&lt;div&gt;
실습 예제로는 IE(Internet Explorer) 를 후킹하여 특정 사이트로 향하는 접속을 우회시켜 제 블로그로 접속하도록 만들겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile24.uf.tistory.com/original/1717D60F4BB091AF9404A9&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;2505257008_9f190451d2.jpg&quot; height=&quot;400&quot; width=&quot;500&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;&lt;a href=&quot;http://www.flickr.com/photos/tattoodjay/2505257008/&quot; target=&quot;_blank&quot; title=&quot;[http://www.flickr.com/photos/tattoodjay/2505257008/]로 이동합니다.&quot;&gt;Tattooed JJ&lt;/a&gt; on &lt;a href=&quot;http://www.flickr.com/&quot; target=&quot;_blank&quot; title=&quot;[http://www.flickr.com/]로 이동합니다.&quot;&gt;flickr&lt;/a&gt;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
본 내용은 지난 번에 설명한 Global API Hooking 강좌에 추가되는 내용입니다.&lt;/div&gt;
&lt;div&gt;
Global API Hooking 의 개념에 대해서는 아래 강좌를 참고하여 주시기 바랍니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ 참고 : &lt;a href=&quot;http://www.reversecore.com/66&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/66]로 이동합니다.&quot;&gt;API Hooking – Stealth 프로세스 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ 참고 : &lt;a href=&quot;http://www.reversecore.com/68&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/68]로 이동합니다.&quot;&gt;API Hooking – Stealth 프로세스 (4)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;* 참고!&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;모든 소스 코드는 &lt;a href=&quot;http://www.microsoft.com/express/Downloads/#2008-Visual-CPP&quot; target=&quot;_self&quot; title=&quot;[http://www.microsoft.com/express/Downloads/#2008-Visual-CPP]로 이동합니다.&quot;&gt;MS Visual C++ 2008 Express&lt;/a&gt;&lt;a href=&quot;http://www.microsoft.com/express/Downloads/#2008-Visual-CPP&quot; target=&quot;_blank&quot; title=&quot;[http://www.microsoft.com/express/Downloads/#2008-Visual-CPP]로 이동합니다.&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.microsoft.com/express/Downloads/#2008-Visual-CPP&quot; target=&quot;_self&quot; title=&quot;[http://www.microsoft.com/express/Downloads/#2008-Visual-CPP]로 이동합니다.&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.microsoft.com/express/Downloads/#2008-Visual-CPP&quot; target=&quot;_self&quot; title=&quot;[http://www.microsoft.com/express/Downloads/#2008-Visual-CPP]로 이동합니다.&quot;&gt;&amp;nbsp;Edition&lt;/a&gt; 으로 개발 되었으며, Windows 7 x86 &amp;amp; IE 8 에서 테스트 되었습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;&lt;b&gt;실습 예제&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;실습 목표&lt;/font&gt;&lt;/b&gt;는 &lt;u&gt;IE 프로세스의 API 를 후킹하여 특정 사이트로 향하는 접속을 다른 사이트로 우회&lt;/u&gt;시키는 것입니다. 주소 창에 직접 입력을 하던, 링크를 클릭하던 제가 막아놓은 사이트에는 접속하지 못하도록 만드는 것입니다. (유해 사이트 차단 기능을 생각 하시면 이해하시기 쉬울 것입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;
* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;유해 사이트 차단 기능 자체로 보면 사실 방화벽 차원에서 지원해주는 것이 훨씬 효과적입니다. 어디까지나 실습을 위한 예제이므로 실제 제품에 위 기능을 염두에 두신다면 이점을 고려하시기 바랍니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;wininet!InternetConnect()&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;API Hooking 에서 가장 핵심적인 사항은 바로 후킹 대상 API 를 선정하는 것입니다.&amp;nbsp;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이 부분은 사실 개개인의 노하우가 필요한 부분입니다. 개발 경험 혹은 API 후킹 경험이 많을수록 유리합니다. (요즘은 구글링으로 대부분 해결이 가능하지요.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
작업 전에 간단히 예상을 해보자면 소켓 라이브러리(ws2_32.dll) 혹은 MS 에서 제공하는 인터넷 관련 라이브러리(wininet.dll, winhttp.dll) 들을 후킹 하면 될 것 같습니다. (후자 쪽이 훨씬 수월한 작업이 되겠지요.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 를 실행 시켜서 간단히 분석해 보도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
먼저 Process Explorer 를 이용하여 로딩된 DLL 들을 살펴보도록 하겠습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile5.uf.tistory.com/original/1543E2154BB093EB905589&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_ie_loaded_dll.png&quot; height=&quot;549&quot; width=&quot;509&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
다행히 IE 에서는 ws2_32.dll 뿐만 아니라 Wininet.dll 도 같이 로딩하고 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Wininet.dll 에서 제공하는 API 중에 InternetConnect() 라는 API 가 있습니다. 함수 이름 그대로 어떤 웹사이트에 접속하려고 할 때 사용하는 API 입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(193, 193, 193); border-right-color: rgb(193, 193, 193); border-bottom-color: rgb(193, 193, 193); border-left-color: rgb(193, 193, 193); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;HINTERNET InternetConnect(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;HINTERNET hInternet,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;__in &amp;nbsp;LPCTSTR lpszServerName,&lt;/font&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;		&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;// 접속 URL&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;INTERNET_PORT nServerPort,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;LPCTSTR lpszUsername,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;LPCTSTR lpszPassword,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;DWORD dwService,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;DWORD dwFlags,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&amp;nbsp;&amp;nbsp;__in &amp;nbsp;DWORD_PTR dwContext&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;* 출처 : &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa384363(VS.85).aspx&quot; target=&quot;_blank&quot; title=&quot;[http://msdn.microsoft.com/en-us/library/aa384363(VS.85).aspx]로 이동합니다.&quot;&gt;http://msdn.microsoft.com/en-us/library/aa384363(VS.85).aspx&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
OllyDbg 를 IE 프로세스(PID : 3484 = D9Ch)에 attach 시킨 후 wininet!InternetConnectW() API 에 BP 를 설치하겠습니다. (InternetConnectW() API 는 InternetConnect() 의 Wide Character 버전입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile27.uf.tistory.com/original/187C8B154BB094560AAABF&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_ie_internetconnectw.png&quot; height=&quot;162&quot; width=&quot;529&quot;/&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이 상태에서 IE 주소 창에 접속하려는 사이트의 주소를 입력해 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/original/122FCF174BB094726F171A&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;IE_url.png&quot; height=&quot;134&quot; width=&quot;458&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 3&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위에서 설치한 BP 에 걸렸습니다. 이 때 프로세스의 스택 메모리를 살펴보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/134C68164BB094873CFAF4&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_ie_stack.png&quot; height=&quot;82&quot; width=&quot;456&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 4&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
스택의 정보를 보면 접속 주소(lpszServerName)는 www.google.com 이라는 것을 알 수 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
시험 삼아 이 주소를 한번 조작해 볼까요?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile21.uf.tistory.com/original/156536124BB094A9778BF1&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;ollydbg_ie_dump_edit_url.png&quot; height=&quot;249&quot; width=&quot;446&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 5&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 그림과 같이 &quot;www.google.com&quot; 문자열을 &quot;www.reversecore.com&quot; 문자열로 변경합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;
* 주의!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;위 주소들은 모두 UNICODE 문자열이므로 마지막에 2 byte NULL (0000) 로 끝나야 합니다. (HEX 창에서 문자열 끝에 00 00 을 입력하시면 됩니다.)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위와 같이 접속 주소를 수정한 후 디버거를 실행 시킵니다. 아마 wininet!InternetConnectW() 에 설치된 BP 에서 계속 멈출 것입니다. 이는 보통 하나의 웹사이트가 여러 개의 링크 주소로 이루어져 있기 때문입니다. BP 를 제거 후 계속 실행 해 주세요. (스택 조작은 최초 InternetConnectW() 호출에서 한번만 하시면 됩니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
결과적으로 IE 는 아래 그림과 같이 (원래 의도했던) www.google.com 이 아닌 (변경된) www.reversecore.com 주소로 접속하게 됩니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile29.uf.tistory.com/original/207D5B114BB094DF684A78&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;IE_redirect_reversecore.png&quot; height=&quot;339&quot; width=&quot;524&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 6&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
따라서 wininet!InternetConnectW() 를 후킹 한 후 lpszServerName 파라미터를 조작하면 IE 접속을 제어할 수 있게 됩니다.&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
원리는 매우 간단하지요. 다행히 IE 에서 wininet.dll 를 사용하기 때문에 쉽게 API 후킹할 수 있었습니다. 여기까지는 일반적인 API Hooking 방법과 동일합니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
하지만 실제 구현에 있어서 한가지 중요한 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;고려사항&lt;/font&gt;이 있습니다.&lt;/div&gt;
&lt;div&gt;
바로 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;IE 8 의 독특한 프로세스 구조&lt;/font&gt; 때문에 &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;b&gt;Global API Hooking&lt;/b&gt;&lt;/font&gt; 기법을 써야 한다는 것입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;
&lt;span style=&quot;font-size: 14pt; &quot;&gt;IE 프로세스 구조&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
IE 를 새롭게 실행 한 후 탭(tab) 을 여러 개 띄워서 각각 다른 사이트에 접속해 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/original/1475750D4BB0951D799C6D&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;IE.png&quot; height=&quot;318&quot; width=&quot;610&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 7&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Process Explorer 를 이용하여 IE 프로세스 구조를 살펴보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/original/11262E0C4BB0953401B3E3&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;procexp_ie.png&quot; height=&quot;368&quot; width=&quot;509&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Fig. 8&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 &amp;lt;Fig. 7&amp;gt; 과 &amp;lt;Fig. 8&amp;gt; 을 보시면 IE 에 7 개의 탭이 띄워져 있고, IE 프로세스(iexplore.exe)는 총 5 개 실행되고 있습니다. 그리고 iexplore.exe 프로세스(PID:3784)는 나머지 iexplore.exe 프로세스들과 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;부모-자식 관계&lt;/font&gt;&lt;/b&gt;를 형성하고 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 프로세스 구조를 봤을 때 IE 어플리케이션은 부모에 해당되는 메인 프로세스(PID:3784)가 각 탭들에 해당되는 자식 프로세스들을 관리하는 구조라고 볼 수 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
IE 7 부터 탭 개념을 도입하면서 위와 같은 프로세스 구조로 변경되었는데요, 이 방식의 장점은 탭 별로 독립적인 프로세스로 동작하기 때문에 하나의 탭 에서 오류가 발생하더라도 나머지 탭들과 부모 프로세스(IE 본체)에게는 영향을 끼치지 않는다는 것입니다. (최신 웹 브라우저들에서 사용되는 방법입니다.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;
이와 같이 IE 프로그램은 각 탭에 해당하는 자식 iexplore.exe 프로세스가 실제 접속을 담당하므로 탭 프로세스가 생성되는 순간에 (해당 프로세스의) API 를 자동으로 후킹할 수 있어야 합니다. 즉, &amp;nbsp;&lt;b&gt;Global API Hooking &lt;/b&gt;방법으로 구현되어야 한다는 뜻입니다.&lt;/font&gt; 그렇지 않다면 새로운 탭으로 접속하는 경우에는 후킹이 되지 않을 것이기 때문이지요.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
지난 번에 Global API Hooking 을 구현하기 위하여 kernel32!CreateProcess() API 를 후킹하는 방법에 대해서 소개하였습니다. 하지만 CreateProcess() API 를 후킹하는 방법에는 약간의 제한 사항이 있다는 것도 같이 설명 드렸습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ 참고 : &lt;a href=&quot;http://www.reversecore.com/68&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/68]로 이동합니다.&quot;&gt;API Hooking – Stealth 프로세스 (4)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
이번 포스트의 목적은 CreateProcess() API 의 후킹을 통한 Global API Hooking 방법의 불편함을 없애고 좀 더 안정적이고 편리한 방법으로 Global API Hooking 을 구현하는데 있습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그 방법이란 바로 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;ntdll!ZwResumeThread()&lt;/font&gt;&lt;/b&gt; API 를 후킹하여 프로세스가 생성된 후 메인 스레드가 resume 될 때 원하는 API 를 후킹하는 방법입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
글이 길어진 관계로 다음 시간에 ntdll!ZwResumeThread() API 의 후킹을 통한 Global API Hooking 방법에 대해 자세히 설명하도록 하겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;☞ &lt;a href=&quot;http://www.reversecore.com/78&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/78]로 이동합니다.&quot;&gt;Advanced Global API Hooking – IE 접속 제어 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: rgb(255, 255, 190); &quot;&gt;ReverseCore&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=6366350&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>study</category>
			<category>API</category>
			<category>CreateProcess</category>
			<category>Global API Hooking</category>
			<category>IE</category>
			<category>Internet Explorer</category>
			<category>InternetConnect</category>
			<category>it</category>
			<category>kernel32.dll</category>
			<category>NtResumeThread</category>
			<category>redirect</category>
			<category>redirection</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>ReverseCore</category>
			<category>Reversing</category>
			<category>wininet.dll</category>
			<category>ZwResumeThread</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<category>우회</category>
			<category>후킹</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/77</guid>
			<comments>http://www.reversecore.com/77#entry77comment</comments>
			<pubDate>Mon, 29 Mar 2010 20:38:13 +0900</pubDate>
		</item>
		<item>
			<title>InjDll.exe – DLL Injection/Ejection 전용 도구</title>
			<link>http://www.reversecore.com/76</link>
			<description>&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div style=&quot;BORDER-BOTTOM: rgb(121,165,228) 1px solid; BORDER-LEFT: rgb(121,165,228) 1px solid; PADDING-BOTTOM: 10px; BACKGROUND-COLOR: rgb(219,232,251); PADDING-LEFT: 10px; PADDING-RIGHT: 10px; BORDER-TOP: rgb(121,165,228) 1px solid; BORDER-RIGHT: rgb(121,165,228) 1px solid; PADDING-TOP: 10px&quot; class=&quot;txc-textbox&quot;&gt;
&lt;div&gt;
제가 개발한 &lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058d2&quot;&gt;InjDll.exe &lt;/font&gt;&lt;/b&gt;프로그램을 소개합니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
이 프로그램을 이용해서 원하는 DLL 을 대상 프로세스에 Injection/Ejection 시킬 수 있습니다.&lt;/div&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058d2&quot;&gt;DLL Injection&lt;/font&gt;&lt;/b&gt; 에 관련된 설명을 아래 링크를 참조하세요.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
☞ &lt;a title=&quot;[http://www.reversecore.com/38]로 이동합니다.&quot; href=&quot;http://www.reversecore.com/38&quot; target=&quot;_self&quot;&gt;DLL Injection – 다른 프로세스에 침투하기 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
☞ &lt;a title=&quot;[http://www.reversecore.com/73]로 이동합니다.&quot; href=&quot;http://www.reversecore.com/73&quot; target=&quot;_self&quot;&gt;DLL Injection in Windows 7&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;b&gt;&lt;span style=&quot;FONT-SIZE: 14pt&quot;&gt;InjDll.exe (Ver 1.0.0)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div&gt;
&lt;hr style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
제 블로그 study 에서 자주 소개되는 프로그램입니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
소스를 조금 다듬고 기능을 추가시켜서 정식 버전(1.0.0)으로 배포합니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile24.uf@1142031A4B9CFE90675D97.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; InjDll.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058d2&quot;&gt;이 프로그램은 공개용이며, 자유롭게 사용하실 수 있습니다.&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#e31600&quot;&gt;&lt;b&gt;* 주의!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#e31600&quot;&gt;기본적으로 Windows 2000 이상만 지원합니다. (Windows 7, XP 에서 테스트 되었습니다.)&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#e31600&quot;&gt;Windows 9X 계열에서는 사용하실 수 없습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
사용방법은 아래와 같습니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div style=&quot;BORDER-BOTTOM: rgb(203,203,203) 1px solid; BORDER-LEFT: rgb(203,203,203) 1px solid; PADDING-BOTTOM: 10px; BACKGROUND-COLOR: rgb(255,255,255); PADDING-LEFT: 10px; PADDING-RIGHT: 10px; BORDER-TOP: rgb(203,203,203) 1px solid; BORDER-RIGHT: rgb(203,203,203) 1px solid; PADDING-TOP: 10px&quot; class=&quot;txc-textbox&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;InjDll.exe &amp;lt;procname|pid|*&amp;gt; &amp;lt;-i|-e&amp;gt; &amp;lt;dll path&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;lt;procname|pid|*&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp;&amp;nbsp;procname &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;Process name (ex: explorer.exe, notepad.exe, etc)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp;&amp;nbsp;pid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Process ID&lt;/span&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;lt;-i|-e&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;span style=&quot;WHITE-SPACE: pre&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;-i&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;span style=&quot;WHITE-SPACE: pre&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;Injection Mode&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;span style=&quot;WHITE-SPACE: pre&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;-e&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;span style=&quot;WHITE-SPACE: pre&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;Ejection Mode&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-STYLE: normal; FONT-FAMILY: 굴림; COLOR: rgb(51,51,51); FONT-WEIGHT: normal&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-STYLE: normal; FONT-FAMILY: 굴림; COLOR: rgb(51,51,51); FONT-WEIGHT: normal&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;lt;dll path&amp;gt;&lt;/span&gt;&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림&quot;&gt;&lt;span style=&quot;WHITE-SPACE: pre&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;FONT-FAMILY: &#039;Courier New&#039;&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;FONT-FAMILY: Courier New&quot;&gt;DLL File Path (relative or full)&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;b&gt;&lt;span style=&quot;FONT-SIZE: 14pt&quot;&gt;사용 예&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div&gt;
&lt;hr style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile30.uf@123DA3274B9CFEF376B2A0.dll&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/dll.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; dummy.dll&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
- PID 2840 프로세스에게 dummy.dll 파일을 Injection 시킬 때&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile21.uf.tistory.com/original/133FFD254B9CFFD691274B&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd_1.png&quot; height=&quot;118&quot; width=&quot;515&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
- IE 프로세스에게 dummy.dll 파일을 Injection 시킬 때&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile22.uf.tistory.com/original/124D73284B9CFFEE032A58&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd_2.png&quot; height=&quot;154&quot; width=&quot;515&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
- 모든 프로세스에게 dummy.dll 파일을 Injection 시킬 때&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile8.uf.tistory.com/original/200E57244B9D00165C030D&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;cmd_3.png&quot; height=&quot;321&quot; width=&quot;572&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
Ejection 은 –i 대신 –e 를 사용하면 됩니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;InjDll.exe (Ver 1.1.1)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;div&gt;
&lt;hr style=&quot;border-bottom-color: black; border-right-width: 0px; border-top-color: black; display: block; border-top-width: 1px; border-bottom-width: 0px; height: 1px; border-right-color: black; border-left-color: black; border-left-width: 0px; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;InjDll.exe 가 버전업 되었습니다.&amp;nbsp;(2010.10.29)&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile6.uf@146241164CC9DDAF3F8437.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; InjDll32.exe&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile25.uf@186302164CC9DDAF103454.exe&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/exe.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; InjDll64.exe&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile23.uf@144E63194CC9DDC12BF38A.dll&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/dll.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; dummy32.dll&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile6.uf@194E56194CC9DDC13D2826.dll&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/dll.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; dummy64.dll&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; &quot;&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;추가/변경 사항&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;u&gt;1. 64bit 지원&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
InjDll64.exe 를 이용하여 64bit 프로세스에 64bit DLL 파일을 인젝션 시킬 수 있습니다.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
* 64bit 프로세스에 DLL Injection 을 하기 위해서는 Injector(InjDll64.exe) &amp;amp; DLL 파일이 모두 64bit(PE32+) 이어야 합니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;u&gt;2. &amp;lt;dll path&amp;gt; 의 &quot;상대 경로&quot; 지원&amp;nbsp;&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
아래와 같이 Dll 파일 위치를 상대 경로로 입력할 수 있습니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;InjDll32.exe notepad.exe -i dummy32.dll&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;InjDll32.exe calc.exe -i ..\hook.dll&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;...&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; &quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;&lt;b&gt;&lt;span style=&quot;FONT-SIZE: 14pt&quot;&gt;주의사항&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div&gt;
&lt;hr style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
1) 원격 스레드를 실행시켜 LoadLibrary() 를 호출하는 방식이므로 대상 프로세스에 kernel32.dll 이 로딩되어 있지 않다면 Injection/Ejection 작업은 실패합니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
2) 접근 권한이 제한된 (보호받는) 프로세스나 Anti-Injection 기법이 적용된 프로세스 들에게도 역시 Injection/Ejection 작업은 실패합니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
3) 원칙적으로 Injection 을 N 번 시켰을 때 Ejection 도 같은 횟수로 호출해 줘야 해당 DLL 이 제대로 unloading 됩니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;b&gt;&lt;span style=&quot;FONT-SIZE: 14pt&quot;&gt;Bugs&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div&gt;
&lt;hr style=&quot;BORDER-BOTTOM-COLOR: black; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: black; DISPLAY: block; BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 1px; BORDER-RIGHT-COLOR: black; BORDER-LEFT-COLOR: black; BORDER-LEFT-WIDTH: 0px&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
사용하시다가 버그가 발견된다면 댓글로 알려주시면 감사하겠습니다.&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: rgb(51, 51, 51); background-color: transparent; font-size: 9pt; line-height: 1.5; &quot;&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;BACKGROUND-COLOR: rgb(255,255,190)&quot; class=&quot;Apple-style-span&quot;&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#5c7fb0&quot;&gt;ReverseCore&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
위 글이 도움이 되셨다면 추천(VIEW ON) 부탁 드려요~&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div style=&quot;background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 191); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; line-height: normal; text-align: left; width: auto; direction: ltr; z-index: 99995; &quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-news-widget&quot; style=&quot;width: 100%; text-align: center&quot;&gt;
		  					&lt;embed src=&quot;http://api.v.daum.net/static/recombox1.swf&quot; quality=&quot;high&quot; flashvars=&quot;nid=6166731&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;false&quot; bgcolor=&quot;#ffffff&quot; width=&quot;400&quot; height=&quot;80&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;
						&lt;/div&gt;</description>
			<category>tool</category>
			<category>dll</category>
			<category>DLL Injection</category>
			<category>dummy.dll</category>
			<category>Eject</category>
			<category>InjDll.exe</category>
			<category>inject</category>
			<category>it</category>
			<category>Reverse Code Engineering</category>
			<category>Reverse Engineering</category>
			<category>Reversing</category>
			<category>리버스 엔지니어링</category>
			<category>리버싱</category>
			<category>소프트웨어 역공학</category>
			<author>reversecore</author>
			<guid>http://www.reversecore.com/76</guid>
			<comments>http://www.reversecore.com/76#entry76comment</comments>
			<pubDate>Mon, 15 Mar 2010 00:23:57 +0900</pubDate>
		</item>
		<item>
			<title>DLL Injection in Windows 7 (3)</title>
			<link>http://www.reversecore.com/75</link>
			<description>&lt;font class=&quot;Apple-style-span&quot; face=&quot;&#039;Courier New&#039;&quot;&gt;&lt;br /&gt;
&lt;/font&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
Windows 7 (&amp;amp; Vista) 에 맞는 InjectDll.exe 를 개발하고 소스 코드를 살펴보겠습니다.&lt;/div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
이전 포스트에서 이어지는 내용입니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/73&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/73]로 이동합니다.&quot;&gt;DLL Injection in Windows 7 (1)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
☞ &lt;a href=&quot;http://www.reversecore.com/74&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/74]로 이동합니다.&quot;&gt;DLL Injection in Windows 7 (2)&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;모든 소스 코드는 MS Visual C++ 2008 Express Edition SP1 으로 개발 되었으며, Windows 7&amp;nbsp;(32bit)&amp;nbsp;&amp;amp; XP SP3&amp;nbsp;(32bit)&amp;nbsp;환경에서 테스트 되었습니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;지난 내용 정리&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
시작하기 전에 먼저 지난 시간에 소개해 드린 내용을 짧게 정리해 보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Windows 7 (or Vista) 에서는 Session 관리 정책이 변경됨에 따라서 kernel32!CreateRemoteThread() API 내부 구현이 변경되었습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ 참고 : &lt;a href=&quot;http://www.reversecore.com/72&quot; target=&quot;_self&quot; title=&quot;[http://www.reversecore.com/72]로 이동합니다.&quot;&gt;Session in Windows 7&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
그 결과 CreateRemoteThread() 를 사용한 DLL Injection 기술이 Windows 7 (or Vista) 의 서비스 프로세스(Session 0) 에게는 정상적으로 동작하지 않습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Kernel32!CreateRemoteThread() 를 디버깅 한 결과 원인은 API 내부에서 리모트 스레드를 생성할 때 suspend 모드로 생성하는데, &lt;font class=&quot;Apple-style-span&quot; color=&quot;#3058D2&quot;&gt;만약 리모트 프로세스가 Session 0 라면 resume 시키지 않고 그냥 에러를 리턴&lt;/font&gt;하기 때문이었습니다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 참고!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;리모트 스레드를 생성할 때 일단 suspend 모드로 생성시킨 후 resume 시키는 구현 방법은 예전 XP 때부터 사용되던 방식입니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
Kernel32!CreateRemoteThread() API 내부에서 호출되는 ntdll!ZwCreateThreadEx() API 의 파라미터를 조작 하거나 에러 조건 분기를 강제로 변경하면 정상적으로 리모트 스레드가 생성되면서 DLL Injection 이 성공하는 것을 확인 하였습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 14pt; &quot;&gt;InjectDll.exe&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;hr style=&quot;height: 1px; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; display: block; &quot;&gt;&lt;/div&gt;
&lt;br /&gt;
Windows 7 에서는 kernel32!CreateRemoteThread() 를 호출하는 것보다는 ntdll!ZwCreateThreadEx() API 를 직접 호출하는 것이 더 좋은 방법임을 알게 되었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
☞ 참고 : &lt;a href=&quot;http://blog.naver.com/PostView.nhn?blogId=rkawk01&amp;amp;logNo=70046078078&quot; target=&quot;_blank&quot; title=&quot;[http://blog.naver.com/PostView.nhn?blogId=rkawk01&amp;amp;logNo=70046078078]로 이동합니다.&quot;&gt;비스타에서 CreateRemoteThread 를 이용하여 dll 인젝션하기&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;&lt;b&gt;* 주의!&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; color=&quot;#E31600&quot;&gt;ntdll!ZwCreateThreadEx() API 는 Vista 이후부터 추가된 API 이므로 XP 이하에서는 계속 CreateRemoteThread() 를 사용해야 합니다.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
새로 알게 된 지식을 바탕으로 InjectDll.exe 프로그램을 새롭게 만들었습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림, gulim, sans-serif&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: normal;&quot;&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://reversecore.tistory.com/attachment/cfile27.uf@176636204BA6BB2976133B.cpp&quot;&gt;&lt;img src=&quot;http://i1.daumcdn.net/cfs.tistory/v/110706133414/blog/image/extension/unknown.gif&quot; alt=&quot;&quot; style=&quot;vertical-align: middle;&quot; /&gt; InjectDll.cpp&lt;/a&gt;&lt;/div&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;굴림, gulim, sans-serif&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
새롭게 프로그래밍한 InjectDll() 함수를 살펴보겠습니다.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(203, 203, 203); border-right-color: rgb(203, 203, 203); border-bottom-color: rgb(203, 203, 203); border-left-color: rgb(203, 203, 203); background-color: rgb(255, 255, 255); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;font class=&quot;Apple-style-span&quot; face=&quot;&#039;Courier New&#039;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: 굴림; &quot;&gt;&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;typedef DWORD (WINAPI *PFNTCREATETHREADEX)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PHANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ThreadHandle,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ACCESS_MASK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DesiredAccess,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPVOID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ObjectAttributes,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ProcessHandle,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPTHREAD_START_ROUTINE &amp;nbsp;lpStartAddress,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPVOID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lpParameter,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;BOOL&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CreateSuspended,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dwStackSize,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre; &quot;&gt;	&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dw1,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DWORD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dw2,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPVOID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Unknown&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;BOOL IsVistaOrLater()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;OSVERSIONINFO osvi;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ZeroMemory(&amp;amp;osvi, sizeof(OSVERSIONINFO));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;GetVersionEx(&amp;amp;osvi);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// 커널 버전이 6 이상인지 확인!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( osvi.dwMajorVersion &amp;gt;= 6 )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return TRUE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return FALSE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;BOOL MyCreateRemoteThread&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;(HANDLE hProcess, LPTHREAD_START_ROUTINE pThreadProc, LPVOID pRemoteBuf)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HANDLE &amp;nbsp; &amp;nbsp; &amp;nbsp;hThread = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FARPROC &amp;nbsp; &amp;nbsp; pFunc = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// OS 가 Vista 이상인지 확인!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( IsVistaOrLater() ) &amp;nbsp; &amp;nbsp;// Vista, 7, Server2008&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pFunc = GetProcAddress(GetModuleHandle(L&quot;ntdll.dll&quot;), &quot;NtCreateThreadEx&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if( pFunc == NULL )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;GetProcAddress(\&quot;NtCreateThreadEx\&quot;) failed!!! [%d]\n&quot;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GetLastError());&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return FALSE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// NtCreateThreadEx() 호출&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;((PFNTCREATETHREADEX)pFunc)(&amp;amp;hThread,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x1FFFFF,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hProcess,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pThreadProc,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pRemoteBuf,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FALSE,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NULL);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if( hThread == NULL )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;NtCreateThreadEx() failed!!! [%d]\n&quot;, GetLastError());&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return FALSE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// 2000, XP, Server2003&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hThread = CreateRemoteThread(hProcess,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pThreadProc,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pRemoteBuf,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NULL);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if( hThread == NULL )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;CreateRemoteThread() failed!!! [%d]\n&quot;, GetLastError());&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return FALSE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( WAIT_FAILED == WaitForSingleObject(hThread, INFINITE) )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(&quot;WaitForSingleObject() failed!!! [%d]\n&quot;, GetLastError());&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return FALSE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return TRUE;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;BOOL InjectDll(DWORD dwPID, char *szDllName)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 9pt; &quot;&gt;&lt;span style=&quot;font-family: &#039;Courier New&#039;; &quot;&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nb
