<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adwiteeya Agrawal &#8211; Adwiteeya Agrawal | Home</title>
	<atom:link href="https://adwiteeya.com/author/adwiteeya-agrawal/feed/" rel="self" type="application/rss+xml" />
	<link>https://adwiteeya.com</link>
	<description>Security fanatic. Reverse Engineer and Web App Specialist.</description>
	<lastBuildDate>Tue, 09 Feb 2016 04:55:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.7</generator>
	<item>
		<title>FireEye Tech-Talk@CMU Challenge Write-Up</title>
		<link>https://adwiteeya.com/fireeye-tech-talkcmu-challenge-write-up/</link>
					<comments>https://adwiteeya.com/fireeye-tech-talkcmu-challenge-write-up/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Tue, 09 Feb 2016 04:54:21 +0000</pubDate>
				<category><![CDATA[At the College]]></category>
		<category><![CDATA[Information Security]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/?p=530</guid>

					<description><![CDATA[First. the only string reference pointed to this section : Instruction at 0x00401310 checks if there is a command line argument. There is an irritating sleep function, you could either NOP the function or change the argument to 0. Next there is a reference to 0x417550 and then a Jump to the actual code. On [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>First. the only string reference pointed to this section :</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-531" src="http://adwiteeya.com/wp-content/uploads/2016/02/Capture.png" alt="Capture" width="952" height="191" srcset="https://adwiteeya.com/wp-content/uploads/2016/02/Capture.png 952w, https://adwiteeya.com/wp-content/uploads/2016/02/Capture-300x60.png 300w, https://adwiteeya.com/wp-content/uploads/2016/02/Capture-768x154.png 768w" sizes="(max-width: 952px) 100vw, 952px" /></p>
<p><span id="more-530"></span>Instruction at 0x00401310 checks if there is a command line argument. There is an irritating sleep function, you could either NOP the function or change the argument to 0. Next there is a reference to 0x417550 and then a Jump to the actual code.</p>
<p>On inspecting the memory at 0x417550, a plain text is received (274 bytes) when XOR-ed with 0x55.</p>
<p>&#8220;Good job! Keep going&#8230;.Good luck!&#8221;</p>
<p>Next, it checks that the name of the program is princesswarrior.exe, you can just bypass that or rename the executable, then the length of the string is checked, it should be 0x32.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-532" src="http://adwiteeya.com/wp-content/uploads/2016/02/Capture-1.png" alt="Capture" width="577" height="223" srcset="https://adwiteeya.com/wp-content/uploads/2016/02/Capture-1.png 577w, https://adwiteeya.com/wp-content/uploads/2016/02/Capture-1-300x116.png 300w" sizes="(max-width: 577px) 100vw, 577px" /></p>
<p>Lastly, the fun part, so</p>
<p>x1 = your string.</p>
<p>x2 = string at 4174E8</p>
<p>x3 = string at 417664</p>
<p>So the key =&gt; x1  = (x3 xor x2) &#8211; 12</p>
<p><img decoding="async" class="aligncenter wp-image-533 " src="http://adwiteeya.com/wp-content/uploads/2016/02/Capture-2.png" alt="Capture" width="323" height="181" srcset="https://adwiteeya.com/wp-content/uploads/2016/02/Capture-2.png 337w, https://adwiteeya.com/wp-content/uploads/2016/02/Capture-2-300x168.png 300w, https://adwiteeya.com/wp-content/uploads/2016/02/Capture-2-336x189.png 336w" sizes="(max-width: 323px) 100vw, 323px" /></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/fireeye-tech-talkcmu-challenge-write-up/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Send email via username@facebook.com</title>
		<link>https://adwiteeya.com/send-email-via-usernamefacebook-com/</link>
					<comments>https://adwiteeya.com/send-email-via-usernamefacebook-com/#respond</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Fri, 25 Jul 2014 10:17:09 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[facebook email]]></category>
		<category><![CDATA[facebook id]]></category>
		<category><![CDATA[send as user@fb]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/?p=503</guid>

					<description><![CDATA[Allright! So as per the default configuration, all emails that are sent to your facebook account ie username@facebook.com are forwarded to your primary email address. This quick post is about how can you send email from username@facebook.com to anyone! For example if example@gmail.com sends an email to username@facebook.com it will be sent to username@gmail.com (considering [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Allright! So as per the default configuration, all emails that are sent to your facebook account ie username@facebook.com are forwarded to your primary email address. This quick post is about how can you send email from username@facebook.com to anyone!</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-504" src="http://adwiteeya.com/wp-content/uploads/2014/07/fb-email.jpg" alt="fb email" width="664" height="221" srcset="https://adwiteeya.com/wp-content/uploads/2014/07/fb-email.jpg 664w, https://adwiteeya.com/wp-content/uploads/2014/07/fb-email-300x99.jpg 300w" sizes="auto, (max-width: 664px) 100vw, 664px" /></p>
<p><span id="more-503"></span></p>
<p>For example if example@gmail.com sends an email to username@facebook.com it will be sent to username@gmail.com (considering the person owning username@facebook.com has set username@gmail.com as his primary email address.) However, if the person clicks on reply, the email is sent as username@gmail.com. This is the default setting.<br />
<script src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" async=""></script><!-- Weblare support --> <ins class="adsbygoogle" style="display: inline-block; width: 336px; height: 280px;" data-ad-client="ca-pub-3665990395431012" data-ad-slot="8776790945"></ins><script>// <![CDATA[
(adsbygoogle = window.adsbygoogle || []).push({});
// ]]&gt;</script></p>
<p>However, gmail allows you to send mail as any id as long as you can click on a link send to that email id. 3:)</p>
<p>Just follow these steps to be able to send as username@facebook.com :</p>
<p>1. Click on Settings Button in your gmail account &gt; settings &gt; Accounts and Imports</p>
<p>2.  In accounts and imports click on &#8216;add another email address you own&#8217;</p>
<p>3. Enter the your facebookusername@facebook.com and uncheck &#8220;Treat as an alias&#8221;.</p>
<p>4. Click Next and in the next set of options select &#8220;Send through gmail.&#8221;</p>
<p>5. Wait for the confirmation email to be forwarded to your gmail id and once it arrives click on the link and close this pop up!</p>
<p>&nbsp;</p>
<p>You are done and good to go! Just click on compose and you should be able select your facebook id to send emails from!</p>
<p>&nbsp;</p>
<p>Thanks</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/send-email-via-usernamefacebook-com/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>College Assignments &#8211; Jugaad</title>
		<link>https://adwiteeya.com/college-assignments-jugaad/</link>
					<comments>https://adwiteeya.com/college-assignments-jugaad/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Sun, 29 Dec 2013 08:38:20 +0000</pubDate>
				<category><![CDATA[At the College]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[adwiteeya]]></category>
		<category><![CDATA[assignments jugaad]]></category>
		<category><![CDATA[college assignments]]></category>
		<category><![CDATA[hacking assignments]]></category>
		<category><![CDATA[making a font]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=459</guid>

					<description><![CDATA[Hello reader! All right a quick introduction about this blog post. Just as any/every engineering students the word &#8220;assignments&#8221; terrifies me. I mean everybody knows we copy! But then, our profs are smart! They(specific profs) now ask us to write the entire thing(the assignment) rather than taking a print out! :( And for instance we [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hello reader!<br />
All right a quick introduction about this blog post. Just as any/every engineering students the word &#8220;assignments&#8221; terrifies me. I mean everybody knows we copy! But then, our profs are smart! They(specific profs) now ask us to write the entire thing(the assignment) rather than taking a print out! :( And for instance we had a subject like compiler, where we had to copy codes as long as 200+ lines in our handwriting. I don&#8217;t get the point, seriously!! So, I decided to have a little fun. 3:D (*EVIL SMILEY*).</p>
<p><span id="more-459"></span></p>
<p>All right so the solution that I came up with; was developing a font, with which I can exactly replicate my handwriting and can simply convert the code by selecting that font. :)</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/12/fonts.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-460" src="http://adwiteeya.com/wp-content/uploads/2013/12/fonts.png" alt="fonts" width="746" height="359" srcset="https://adwiteeya.com/wp-content/uploads/2013/12/fonts.png 746w, https://adwiteeya.com/wp-content/uploads/2013/12/fonts-300x144.png 300w, https://adwiteeya.com/wp-content/uploads/2013/12/fonts-624x300.png 624w" sizes="auto, (max-width: 746px) 100vw, 746px" /></a>The above pic is a sample conversion. The results are super awesome believe me. This picture is a screen shot of the very first attempt that i made, the first line is written in Calibri and the second in &#8220;JUGAAD&#8221;  and with a little rework one can do wonders.  Especially, for a subject like compiler where you had to write &#8220;code&#8221; in your handwriting this is extremely full proof! ;)</p>
<p>Now comes the main question!! How! You&#8217;d probably already know it and if you don&#8217;t, believe me its very VERY easy!.<br />
<script src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" async=""></script><!-- Weblare support --> <ins class="adsbygoogle" style="display: inline-block; width: 336px; height: 280px;" data-ad-client="ca-pub-3665990395431012" data-ad-slot="8776790945"></ins><script>// <![CDATA[
(adsbygoogle = window.adsbygoogle || []).push({});
// ]]&gt;</script><br />
Step1. Download a template file from www.paintfont.com by clicking on &#8220;create template&#8221;. Basically this template contains small boxes with characters printed inside them in light gray color. The characters you want to create are already selected if you want anymore characters you can add those as well!</p>
<p>Step2. Take a print out of the template and fill the template. Take a bold marker and overwrite the light gray characters.</p>
<p>Step3. Now scan the two files. For instance here are the files I created.<br />
FILE 1: <a href="http://adwiteeya.com/wp-content/uploads/2013/12/ab.jpeg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-464" src="http://adwiteeya.com/wp-content/uploads/2013/12/ab-744x1024.jpeg" alt="ab" width="625" height="860" srcset="https://adwiteeya.com/wp-content/uploads/2013/12/ab-744x1024.jpeg 744w, https://adwiteeya.com/wp-content/uploads/2013/12/ab-218x300.jpeg 218w, https://adwiteeya.com/wp-content/uploads/2013/12/ab-624x858.jpeg 624w, https://adwiteeya.com/wp-content/uploads/2013/12/ab.jpeg 1700w" sizes="auto, (max-width: 625px) 100vw, 625px" /></a></p>
<p>FILE 2:</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/12/ba.jpeg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-465" src="http://adwiteeya.com/wp-content/uploads/2013/12/ba-744x1024.jpeg" alt="ba" width="625" height="860" srcset="https://adwiteeya.com/wp-content/uploads/2013/12/ba-744x1024.jpeg 744w, https://adwiteeya.com/wp-content/uploads/2013/12/ba-218x300.jpeg 218w, https://adwiteeya.com/wp-content/uploads/2013/12/ba-624x858.jpeg 624w, https://adwiteeya.com/wp-content/uploads/2013/12/ba.jpeg 1700w" sizes="auto, (max-width: 625px) 100vw, 625px" /></a></p>
<p>&nbsp;</p>
<p>Step 4 : Now you need to upload these files at http://www.paintfont.com/#tabUpload, select OTF format and click on &#8220;Send File&#8221;.</p>
<p>Step 5 : The font is ready and you get a screen like : <a href="http://adwiteeya.com/wp-content/uploads/2013/12/font-generated.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-463" src="http://adwiteeya.com/wp-content/uploads/2013/12/font-generated.png" alt="font generated" width="749" height="312" srcset="https://adwiteeya.com/wp-content/uploads/2013/12/font-generated.png 749w, https://adwiteeya.com/wp-content/uploads/2013/12/font-generated-300x124.png 300w, https://adwiteeya.com/wp-content/uploads/2013/12/font-generated-624x259.png 624w" sizes="auto, (max-width: 749px) 100vw, 749px" /></a></p>
<p>Step 6: Now just download the myfont.otf and on the downloaded file, right click &gt; install. You can now go to your favorite editor and type in your handwriting! :)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/college-assignments-jugaad/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
		<item>
		<title>Code Obfusction &#124; Writing a VM</title>
		<link>https://adwiteeya.com/code-obfusction-writing-a-vm/</link>
					<comments>https://adwiteeya.com/code-obfusction-writing-a-vm/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Tue, 03 Dec 2013 07:18:19 +0000</pubDate>
				<category><![CDATA[At the College]]></category>
		<category><![CDATA[Information Security]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[adwiteeya agrawal]]></category>
		<category><![CDATA[Code Obfusction]]></category>
		<category><![CDATA[OIVM]]></category>
		<category><![CDATA[Protection Against Reversing]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Virtual Machine in C]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=444</guid>

					<description><![CDATA[What is this Blog About ? It is about a minor project that i recently completed. That is writing a virtual machine to slow down the process of reverse engineering. This is not a tutorial to do the same however I have included the presentation that i used during the final presentation, the PDFs for [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>What is this Blog About ?</strong></p>
<p>It is about a minor project that i recently completed. That is writing a virtual machine to slow down the process of reverse engineering. This is not a tutorial to do the same however I have included the presentation that i used during the final presentation, the PDFs for System Design and Sample Runs and one step by step sample run.<span id="more-444"></span></p>
<p><strong>#Presentation</strong></p>
<p><center><br />
<iframe loading="lazy" style="border: 1px solid #CCC; border-width: 1px 1px 0; margin-bottom: 5px;" src="http://www.slideshare.net/slideshow/embed_code/28832154" height="356" width="427" allowfullscreen="" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></center></p>
<div style="margin-bottom: 5px; text-align: center;"><strong> <a title="OIVM" href="https://www.slideshare.net/adwiteeyaagrawal/oivm" target="_blank">OIVM</a> </strong> from <strong><a href="http://www.slideshare.net/adwiteeyaagrawal" target="_blank">Adwiteeya Agrawal</a></strong></div>
<div style="margin-bottom: 5px;"></div>
<div style="margin-bottom: 5px;"></div>
<div style="margin-bottom: 5px;"><strong>#Design</strong></div>
<div style="margin-bottom: 5px;"></div>
<p><iframe loading="lazy" style="border: 1px solid #CCC; border-width: 1px 1px 0; margin-bottom: 5px;" src="http://www.slideshare.net/slideshow/embed_code/28832223" height="613" width="574" allowfullscreen="" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<div style="margin-bottom: 5px;"></div>
<div style="margin-bottom: 5px;"><strong>#Implementation &#8211; Sample Runs</strong></div>
<p><iframe loading="lazy" style="border: 1px solid #CCC; border-width: 1px 1px 0; margin-bottom: 5px;" src="http://www.slideshare.net/slideshow/embed_code/28832221" height="613" width="574" allowfullscreen="" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>#Code</strong></p>
<p><script src="https://gist.github.com/adwiteeya/7765256.js"></script></p>
<p><strong>#Sample Run</strong></p>
<p>In this sample run I am going to implement the POC expansion algorithm that was the final program that was written for OIVM.1. Make sure bootrom.txt and OIVM.exe are in the same folder.<br />
2. Open the Bootrom.txt using a Hex Editor (example : Hex Workshop) and write the following hex stream to it.</p>
<p><strong>3F <span style="color: #000080;">11</span> 25 <span style="color: #333399;">00</span> 2F <span style="color: #333399;">08</span> 3F <span style="color: #333399;">38</span> 3F <span style="color: #333399;">38</span> 41 <span style="color: #333399;">3D</span> 09 <span style="color: #333399;">1B</span> 3C<span style="color: #333399;"> 4C</span> <span style="color: #000000;">21<span style="color: #000080;"> 25</span> 00 <span style="color: #000080;">2F</span> 14 <span style="color: #000080;">7C</span> 67 <span style="color: #000080;">63</span> 55 <span style="color: #000080;">64</span> 61 <span style="color: #000080;">38</span> 67 <span style="color: #000080;">7C</span> 63</span> <span style="color: #000080;">38</span> 55 <span style="color: #000080;">64</span> 61 <span style="color: #000080;">38</span> 37 <span style="color: #000080;">41</span> 3D <span style="color: #000080;">15</span> C9 <span style="color: #000080;">45</span> 3F <span style="color: #000080;">11</span> 3F 12 18 <span style="color: #000080;">68</span> 3C <span style="color: #000080;">25</span> 00 <span style="color: #000080;">2F</span> 08 <span style="color: #000080;">12</span> 86 <span style="color: #000080;">C5</span> 38 <span style="color: #000080;">41</span> 3D <span style="color: #000080;">09</span> 00 <span style="color: #000080;">02</span> 04 <span style="color: #000080;">06</span> 08 </strong></p>
<p>3. Save the file. This is basically in the format of [STUB][Compressed Code]. The stub is 60 Bytes long and extends till the 0x09 in the second line of the hexadecimal stream. The parallel <strong>assembly</strong> for this code is as follows :</p>
<p><strong>[EXPANSION STUB]</strong><br />
scanf(&#8220;%d&#8221;,&amp;STACK[SP])<br />
MOV A,STACK[SP]<br />
FLAG=A-ROM[++IP]<br />
JE 8 BYTES<br />
scanf(&#8220;%d&#8221;,&amp;STACK[SP])<br />
++SP<br />
scanf(&#8220;%d&#8221;,&amp;STACK[SP])<br />
++SP<br />
&#8211;A<br />
JMP -9 BYTES<br />
MOV B,ROM[++IP] //STUB LENGTH<br />
A = fileLen<br />
A=A-B<br />
FLAG=A-ROM[++IP]<br />
JE 14 BYTES<br />
MOV C ,ROM[B]<br />
MOV D,SP<br />
MOV SP,C<br />
MOV C,STACK[SP]<br />
MOV SP,D<br />
MOV STACK[SP],C<br />
++SP<br />
MOV D,SP<br />
MOV C,ROM[B]<br />
MOV SP,C<br />
++SP<br />
MOV C,STACK[SP]<br />
MOV SP,D<br />
MOV STACK[SP],C<br />
++SP<br />
++B<br />
&#8211;A<br />
JMP -21 BYTES<br />
ROM=(char *)realloc(ROM,ROM[++IP]) //FILE EXPANDED<br />
scanf(&#8220;%d&#8221;,&amp;STACK[SP])<br />
MOV A,STACK[SP]<br />
scanf(&#8220;%d&#8221;,&amp;STACK[SP])<br />
MOV B,STACK[SP]<br />
MOV SP,B<br />
MOV C,ROM[++IP]<br />
FLAG=A-ROM[++IP]<br />
JE 8 BYTES<br />
MOV B,STACK[SP]<br />
MOV ROM[C],B<br />
++C<br />
++SP<br />
&#8211;A<br />
JMP -9 BYTES<br />
<strong>[COMPRESSED FORM]</strong><br />
00 02 04 06 08</p>
<p>4. Now run the program.If however you dont speak assembly that doesnt matter here is the <strong>algorithm</strong> for it :</p>
<p>1. Enter the Number of elements in the dictionary.<br />
2. Enter the dictionary.<br />
(Dictionary is stored on the stack)<br />
(The dictionary is looked up for values corresponding to compressed code)<br />
(The new Values are updated over the stack)<br />
3. Enter the New Size.<br />
4. Enter the SP (which could have been hardcoded as well)<br />
(The code expands)<br />
(The execution is now passed on to the expanded program)<br />
5. Enter the first element. Hit Enter.<br />
6. Enter the second element. Hit Enter.<br />
7. The sum is Displayed.<br />
8. OIVM halts.</p>
<p><strong>Results/Output</strong></p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/12/output.png"><img loading="lazy" decoding="async" class="size-full wp-image-453 aligncenter" alt="Output" src="http://adwiteeya.com/wp-content/uploads/2013/12/output.png" width="438" height="325" srcset="https://adwiteeya.com/wp-content/uploads/2013/12/output.png 438w, https://adwiteeya.com/wp-content/uploads/2013/12/output-300x222.png 300w" sizes="auto, (max-width: 438px) 100vw, 438px" /></a>#Thanks</p>
<p><strong>Special thanks</strong> to Mr. Atul Alex Cherian, Ms. Nishtha Jatana and Ms. Kritika Sobti.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/code-obfusction-writing-a-vm/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Trolling func1()</title>
		<link>https://adwiteeya.com/trolling-func1/</link>
					<comments>https://adwiteeya.com/trolling-func1/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Wed, 18 Sep 2013 05:44:28 +0000</pubDate>
				<category><![CDATA[Information Security]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[breakpoint]]></category>
		<category><![CDATA[Loader]]></category>
		<category><![CDATA[OllyDbg]]></category>
		<category><![CDATA[openprocess]]></category>
		<category><![CDATA[Return Address]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[stack]]></category>
		<category><![CDATA[waitfordebugevent]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows debugging]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=418</guid>

					<description><![CDATA[A note to the technical reader : This is basically a custom loader I wrote so that i could edit the return address of functions on the stack. Hi, non technical reader. Introduction So basically this is the small program I wrote, which we are going to play with. In this program there are two [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>A note to the technical reader</strong> : This is basically a custom loader I wrote so that i could edit the return address of functions on the stack.</p>
<p>Hi, non technical reader.<span id="more-418"></span></p>
<p><span style="text-decoration: underline;"><strong>Introduction</strong></span></p>
<p>So basically this is the small program I wrote, which we are going to play with. In this program there are two functions : func1() and func2(). func1() is called from main, but func2() is never called.</p>
<p><script type="text/javascript" src="https://gist.github.com/adwiteeya/6605006.js"></script>So our aim is to execute func2 at run time.Here is the first run :</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/first-run.png"><img loading="lazy" decoding="async" class="size-full wp-image-423 aligncenter" alt="first run" src="http://adwiteeya.com/wp-content/uploads/2013/09/first-run.png" width="401" height="111" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/first-run.png 401w, https://adwiteeya.com/wp-content/uploads/2013/09/first-run-300x83.png 300w" sizes="auto, (max-width: 401px) 100vw, 401px" /></a></p>
<p>As you can see we do not go inside func2.</p>
<p><span style="text-decoration: underline;"><strong>Reverse Engineering solution</strong></span> The first and the lot easier approach to this is, a RE solution. In this solution i just change some return addresses on the stack and we are done. Lets go step by step.</p>
<p><strong>Step1</strong> : Loading the program in OllyDbg</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/print2-in-olly.png"><img loading="lazy" decoding="async" class="size-full wp-image-424 aligncenter" alt="print2 in olly" src="http://adwiteeya.com/wp-content/uploads/2013/09/print2-in-olly.png" width="663" height="328" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/print2-in-olly.png 663w, https://adwiteeya.com/wp-content/uploads/2013/09/print2-in-olly-300x148.png 300w, https://adwiteeya.com/wp-content/uploads/2013/09/print2-in-olly-624x308.png 624w" sizes="auto, (max-width: 663px) 100vw, 663px" /></a></p>
<p>As can be seen there are three functions main, func1 and func2. These are indicated by the square brackets. The order of these functions is func1, func2 and lastly main.</p>
<p><strong>Step2</strong> : Now I am going to put a breakpoint on func1 and then observe the stack.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/print2-hit-breakpoint.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-425" alt="print2 hit breakpoint" src="http://adwiteeya.com/wp-content/uploads/2013/09/print2-hit-breakpoint.png" width="734" height="528" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/print2-hit-breakpoint.png 734w, https://adwiteeya.com/wp-content/uploads/2013/09/print2-hit-breakpoint-300x215.png 300w, https://adwiteeya.com/wp-content/uploads/2013/09/print2-hit-breakpoint-624x448.png 624w" sizes="auto, (max-width: 734px) 100vw, 734px" /></a></p>
<p>We have two images here the first one represents the assembly view of print2.cpp when i hitthe breakpoint and the second one represents the stack when I hit the breakpoint. In figure 1 it can be seen that the func1 starts at 401334 and it(the address) is in read with black background. Which indicates that we have hit the breakpoint. In figure two we can see that the return address for func1() is 0040139A. If we look up this address in the assembly dump, it is the one just after func1() is called that is 401395. Hence, things are fine here, the function always returns to the immediate expression after a call to it. So we have two deductions from here. First that the return address is 40139A which can be changed to make the func1() jump somewhere else. and secondly that this address is placed on the memory address starting 28FF0C. <strong> </strong></p>
<p><strong>Step3</strong> : Now we are going to edit 40139A to 401359 so that we can jump over to func2().</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/stck-modified.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-427" alt="stck modified" src="http://adwiteeya.com/wp-content/uploads/2013/09/stck-modified.png" width="457" height="148" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/stck-modified.png 457w, https://adwiteeya.com/wp-content/uploads/2013/09/stck-modified-300x97.png 300w" sizes="auto, (max-width: 457px) 100vw, 457px" /></a></p>
<p>After the modification even the comment changes to print2.00401359, which suggests that it is call. And as expected we enter the func2().</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/func2-entered.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-428" alt="func2 entered" src="http://adwiteeya.com/wp-content/uploads/2013/09/func2-entered.png" width="712" height="328" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/func2-entered.png 712w, https://adwiteeya.com/wp-content/uploads/2013/09/func2-entered-300x138.png 300w, https://adwiteeya.com/wp-content/uploads/2013/09/func2-entered-624x287.png 624w" sizes="auto, (max-width: 712px) 100vw, 712px" /></a></p>
<p>However this is not enough. In a similar way we have to edit the return address of func2 to 40139A which was the original return address of func1. Now to be able to identify where is the return address of func2, we single step through func2 till we reach RETN.</p>
<p><strong>Step4</strong> : Here the top address on the stack is the return address for the stack. We need to change this address. In order to return and exit normally.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/func2-return.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-431" alt="func2 return" src="http://adwiteeya.com/wp-content/uploads/2013/09/func2-return.png" width="570" height="296" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/func2-return.png 570w, https://adwiteeya.com/wp-content/uploads/2013/09/func2-return-300x155.png 300w" sizes="auto, (max-width: 570px) 100vw, 570px" /></a></p>
<p>As can be seen on the stack 0028FF10 is the address where the return address 00403050 is stored. We modify this and then run the program.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/re-success.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-432" alt="re success" src="http://adwiteeya.com/wp-content/uploads/2013/09/re-success.png" width="457" height="161" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/re-success.png 457w, https://adwiteeya.com/wp-content/uploads/2013/09/re-success-300x105.png 300w" sizes="auto, (max-width: 457px) 100vw, 457px" /></a></p>
<p>We are able to do it neatly. :)</p>
<p><span style="text-decoration: underline;"><strong>Program Solution</strong></span></p>
<p>Now the RE solution was though easy, it wasn&#8217;t automated, and i had no fuckin idea about how do i make a permanent modification. What i mean here is like if you want to completely change an instruction you can do that and simply save changes to the new executable. But the stack is a dynamic memory region, it is not a part of the exe file that you save. So there was something more, some workaround that was needed. And thanks to Atul Alex Cherian, who told me about loader. So a loader is basically a program that lets the entire exe load in memory and then plays around with it. I first thought about using a tool for this, but then why not just code this shit out. So here is the algorithm that i followed for this. <strong></strong></p>
<p><strong>Step1</strong>. Use fread to read the bytes of print2.exe to an array.</p>
<p><strong>Step2</strong>. In this array modify the byte that represents beginning of func1 to CC (breakpoint).</p>
<p><strong>Step3.</strong> Save this array to a new myf.exe</p>
<p><strong>Step4</strong>. Detach pointer to myf.exe and open process myf.exe as a DEBUG_PROCESS <strong></strong></p>
<p><strong>Step5</strong>. Waitforadebugevent and use a simple condition to check that it orignates from the one that you forced.</p>
<p><strong>Step6</strong>. On receiving the EXCEPTION_BREAKPOINT DEBUG_EVENT suspend the thread using process information of myf.exe</p>
<p><strong>Step7</strong>, Now change the CC that you placed to the original byte</p>
<p><strong>Step8</strong>. Getthreadcontext of this thread and access the context structure to decrement EIP.</p>
<p><strong>Step9</strong>. Now change return addresses of func1 and func2. For func1 only one byte is edited and for func2 one has to edit 2 bytes.</p>
<p><strong>Step10</strong>. Resume thread. Myf.exe should exit after you press the first enter, then loader.exe should exit after you press the second enter. Here is the code :<script type="text/javascript" src="https://gist.github.com/adwiteeya/6605021.js"></script></p>
<p>Here is the screen shot showing its execution.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/09/program-success.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-434" alt="program success" src="http://adwiteeya.com/wp-content/uploads/2013/09/program-success.png" width="671" height="338" srcset="https://adwiteeya.com/wp-content/uploads/2013/09/program-success.png 671w, https://adwiteeya.com/wp-content/uploads/2013/09/program-success-300x151.png 300w, https://adwiteeya.com/wp-content/uploads/2013/09/program-success-624x314.png 624w" sizes="auto, (max-width: 671px) 100vw, 671px" /></a></p>
<p>And special thanks to Dhanesh sir. :)</p>
<p>H3LL Y34H! :)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/trolling-func1/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Information Security Education in India &#124; Universities &#038; Colleges</title>
		<link>https://adwiteeya.com/information-security-education-in-india-universities-colleges/</link>
					<comments>https://adwiteeya.com/information-security-education-in-india-universities-colleges/#respond</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Mon, 22 Jul 2013 00:36:15 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[colleges security india]]></category>
		<category><![CDATA[Information security india]]></category>
		<category><![CDATA[universities information security]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=366</guid>

					<description><![CDATA[Following is a list of all Indian Universities that provide any course related to Security. (The order is just random) 1. Symbiosis Centre for Information Technology (SCIT) MBA in (ITBM) with Elective Informations Security Management [Link Here] &#160; 2.Amity Noida I am not very sure if Amity still provides an Mtech in Information Security &#38; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p style="text-align: center;"><span style="color: #000000;"><span style="color: #333333;">Following is a list of all Indian Universities that provide any course related to Security. (The order is just random)</span> <span id="more-366"></span></span></p>
<h3 style="text-align: left;"></h3>
<h3 style="text-align: left;"><span style="color: #000000;"><span style="text-decoration: underline;"><strong>1. Symbiosis Centre for Information Technology</strong> (SCIT)</span></span></h3>
<p style="text-align: left;"><span style="color: #000000;"><span style="text-decoration: underline;"><span style="color: #333333; text-decoration: underline;"><strong>MBA</strong> in (<strong>ITBM</strong>) with Elective Informations Security Management</span></span><br />
<span style="color: #333333;"> [<a title="SCIT MBA-ITBM" href="http://www.scit.edu/academics.php" target="_blank"><span style="color: #333333;">Link Here</span></a>]</span></span></p>
<p>&nbsp;</p>
<h3 style="text-align: left;"><span style="text-decoration: underline; color: #000000;"><span style="text-decoration: underline;"><strong>2.Amity</strong> Noida</span></span></h3>
<p>I am not very sure if Amity still provides an Mtech in <strong>Information Security &amp; Cyber Forensics</strong> [<a href="http://www.amity.edu/asetau/Course.asp?c=A23295&amp;fn=M.Tech+-+Information+Security+%26+Cyber+Forensics" target="_blank">Link Here</a>]. They did not provide any details for the same online.</p>
<p style="text-align: left;"><span style="color: #000000;"><strong><br />
</strong></span></p>
<h3 style="text-align: left;"><span style="color: #000000;"><span style="text-decoration: underline;"><strong>3.Amrita School Of Engineering</strong></span></span></h3>
<p>3.1 Mtech in <strong>Cyber Security</strong><br />
[<a href="http://engineering.amrita.edu/curriculum.php" target="_blank">Link Here</a>]</p>
<p>3.2 Mtech in <strong>Cyber Security Systems and Networks</strong></p>
<p>3.3 <strong>Dual Degree Programs</strong> :</p>
<p>Students pursuing mtech in cyber security are eligible for :</p>
<p>1. M.Tech-MS with University of New Mexico, USA [<a href="http://www.amrita.edu/global/dual-Mtechms.html" target="_blank">Link Here</a>]<br />
2. Dual Degree Program with Vrije University, Amsterdam, Netherlands[<a href="http://www.amrita.edu/global/dualvu.html" target="_blank">Link Here</a>]</p>
<h3 style="text-align: left;"></h3>
<h3 style="text-align: left;"><span style="text-decoration: underline; color: #000000;"><span style="text-decoration: underline;"><strong>4. Indraprastha Institute of Information Technology, Delhi</strong></span></span></h3>
<p><span style="color: #000000;">4<strong>.</strong>1 Mtech in computer science with <strong>specialization in Information Security</strong>. </span></p>
<p><span style="color: #000000;">These subjects include and are not limited to<br />
</span></p>
<p>[<a href="http://www.iiitd.ac.in/education/mtech/info-sec" target="_blank">link here</a>]</p>
<ul>
<li><span style="color: #000000;"><strong>Secure Coding</strong> (<a href="http://www.iiitd.ac.in/education/courses#CSE500" target="_blank"><span style="color: #000000;">CSE500</span></a>)</span></li>
<li><span style="color: #000000;"><strong>Distributed Systems Security</strong> (<a href="http://www.iiitd.ac.in/education/courses#CSE530" target="_blank"><span style="color: #000000;">CSE530</span></a>)</span></li>
<li><span style="color: #000000;"><b>Foundations to Computer Security</b> (<a href="http://www.iiitd.ac.in/education/courses#CSE545" target="_blank"><span style="color: #000000;">CSE545</span></a>)</span></li>
<li><span style="color: #000000;"><b>Applied Cryptography</b> (<a href="http://www.iiitd.ac.in/education/courses#CSE546" target="_blank"><span style="color: #000000;">CSE546</span></a>)</span></li>
<li><span style="color: #000000;"><strong>Digital and Cyber Forensics</strong> (<a href="http://www.iiitd.ac.in/education/courses#CSE645" target="_blank"><span style="color: #000000;">CSE645</span></a>)</span></li>
<li><span style="color: #000000;"><strong>Mobile and Cellular Network Security</strong> (<a href="http://www.iiitd.ac.in/education/courses#CSE647" target="_blank"><span style="color: #000000;">CSE647</span></a>)</span></li>
</ul>
<p><span style="color: #000000;">The institute also offers a PhD in Privacy and Security.</span></p>
<h3 style="text-align: left;"></h3>
<h3 style="text-align: left;"><span style="color: #000000;"><strong><span style="text-decoration: underline;">5. International Institute of Information Technology, Hyderabad</span></strong></span></h3>
<p>5.1 M.Tech in <strong>Computer Science and Information Security</strong></p>
<p>[<a href="http://www.iiit.ac.in/academics/programmes/postgraduate/mtechcsis">Link Here</a>]</p>
<p>&nbsp;</p>
<h3 style="text-align: left;"><strong><span style="text-decoration: underline;"><span style="color: #000000; text-decoration: underline;"> 6. IGNOU courses</span></span></strong></h3>
<p><span style="color: #000000;">6.1 Post Graduate Diploma in Information Security (PGDIS) [<a href="http://www.ignou.ac.in/ignou/aboutignou/school/sovet/programmes/detail/428/2">Link Here</a>]<br />
</span></p>
<p>6.2 Advanced Certificate in Information Security (ACISE) [<a href="http://www.ignou.ac.in/ignou/aboutignou/school/sovet/programmes/detail/431/2">Link Here</a>]</p>
<h3 style="text-align: left;"><span style="color: #000000;"> </span></h3>
<h3 style="text-align: left;"><span style="color: #000000;"><strong><span style="text-decoration: underline;">7.SRM University</span></strong></span></h3>
<div><span style="color: #000000;">7.1 M.Tech (Information Security &amp; Computer Forensics) [<a href="http://www.srmuniv.ac.in/node/448">Link here</a>]<br />
</span></div>
<div>
<div dir="ltr">
<p><span style="color: #000000;"> </span><span style="color: #000000;"> </span></p>
<h3 style="text-align: left;"><span style="color: #000000;"><span style="text-decoration: underline;"><strong><span style="text-decoration: underline;">8.Pondicherry Engineering College</span></strong></span><strong>  </strong></span></h3>
<div><span style="color: #333333;">8.1 <span style="font-size: small;">M.Tech. Computer Science &amp; Engineering [<strong>Information Security</strong>]</span></span> [<a href="http://www.cse.pec.edu/#COURSES%20OFFERED">Link Here</a>]</div>
<div>
<h3></h3>
<h3><span style="text-decoration: underline; color: #000000;"><strong>9.IIIT, Allahabad</strong></span></h3>
<p><span style="color: #000000;">9.1 <span style="font-family: sans-serif; font-size: small;">Masters of Science in Cyber Law &amp; Information Security</span> [<a href="http://ms.iiita.ac.in/">Link Here</a>] </span></p>
<p>&nbsp;</p>
<h3><strong><span style="text-decoration: underline;"><span style="color: #000000; text-decoration: underline;">10. Birla Institute of Technology &amp; Science Hyderabad </span></span></strong></h3>
<p>Integrated Masters (M.E.) in &#8220;Computer Science&#8221; with specialization in Information Security. [<a href="http://sites.bits-hyderabad.ac.in/infosec/">Link Here</a>]</p>
<p align="justify">
<p><span style="color: #000000;">IMT with BLUE, Jodhpur </span></p>
<p><span style="color: #000000;"> CDAC, Gorakhpur</span><br />
<span style="color: #000000;"> Digital Forensics programs at Inst of For Sc, Mumbai; Aurangabad; GandhinagarThese come to mind right away. Will check and share more names if I can find them.1) Msc Information Security , University of madras</span></p>
<div><span style="color: #000000;"><span style="color: #000000;"><br />
</span></span><a href="http://Law.www.cyberlawcollege.com" target="_blank">www.cyberlawcollege.com</a> founded by Naavi.National Law School of India (University of Bangalore)<br />
Cyber Law College (Chennai, Mysore, Mangalore, Bangalore)<br />
Asian School of Cyber Law<br />
Indian Law Institute (Delhi)<br />
NALSAR (Hyderabad)National Academy of Legal Studies and Research (University of Law in Hyderabad)<br />
Symbiosis society&#8217;s Law College (Pune)<br />
Centre for Distance Education (University of Hyderabad)<br />
Amity Law School (Delhi)<br />
Department of Law (University of Delhi)</p>
</div>
<div>
<div></div>
<div>Hyderabad Central University is offering M.Tech IT with Specialization in Banking Technology &amp; Information Security</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/information-security-education-in-india-universities-colleges/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debbuging Code by Modifying an EXE</title>
		<link>https://adwiteeya.com/one-hell-of-a-debug/</link>
					<comments>https://adwiteeya.com/one-hell-of-a-debug/#respond</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Fri, 12 Jul 2013 17:20:20 +0000</pubDate>
				<category><![CDATA[Information Security]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Anti-debugging]]></category>
		<category><![CDATA[GetCurrentThread]]></category>
		<category><![CDATA[GetProcAddress]]></category>
		<category><![CDATA[Load Library]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Windows API]]></category>
		<category><![CDATA[ZwGetInformationThread]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=351</guid>

					<description><![CDATA[Hey, So moving on to a relatively advanced API based debugger detection or anti-debugging techniques, i am going to today discuss the implmentation of ZwSetInformationThread routine. Now this is an undocumented win32 API and we need to get a pointer to the function inside a library and then make a call to the function. The [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hey,<br />
So moving on to a relatively advanced API based debugger detection or anti-debugging techniques, i am going to today discuss the implmentation of ZwSetInformationThread routine. Now this is an undocumented win32 API and we need to get a pointer to the function inside a library and then make a call to the function. The very first implementation is as follows (by the way I code on Code:Blocks 12.11): <span id="more-351"></span></p>
<p style="padding-left: 30px;"><span style="color: #339966;">#include &#8220;stdafx.h&#8221;</span><br />
<span style="color: #339966;">#include &#8220;windows.h&#8221;</span></p>
<p><strong><span style="color: #003366;">void</span></strong> antidebug<span style="color: #ff0000;">()</span>;<br />
<span style="color: #003366;"><strong>void</strong></span> antidebug<span style="color: #ff0000;">()</span><br />
<span style="color: #ff0000;">{</span><br />
HMODULE lib<span style="color: #ff0000;">;</span><br />
FARPROC _ZwSetInformationThread<span style="color: #ff0000;">;</span><br />
lib = LoadLibrary<span style="color: #ff0000;">(&#8220;</span><span style="color: #3366ff;">ntdll.dll</span><span style="color: #ff0000;">&#8220;)</span><span style="color: #ff0000;">;</span><br />
_ZwSetInformationThread <span style="color: #ff0000;">=</span> GetProcAddress<span style="color: #ff0000;">(</span>lib<span style="color: #ff0000;">, &#8220;</span><span style="color: #3366ff;">ZwSetInformationThread</span><span style="color: #ff0000;">&#8220;);</span><br />
<span style="color: #ff0000;">(</span>_ZwSetInformationThread<span style="color: #ff0000;">)(</span>GetCurrentThread<span style="color: #ff0000;">(),</span>0x11<span style="color: #ff0000;">,</span>0<span style="color: #ff0000;">,</span>0<span style="color: #ff0000;">);</span><br />
MessageBox<span style="color: #ff0000;">(</span>NULL<span style="color: #ff0000;">, &#8220;</span><span style="color: #3366ff;">Debugger Detached</span><span style="color: #ff0000;">&#8220;, &#8220;</span><span style="color: #3366ff;">Debugger Detached</span><span style="color: #ff0000;">&#8220;,</span> MB_OK<span style="color: #ff0000;">);</span><br />
<span style="color: #ff0000;">}</span></p>
<p><strong><span style="color: #003366;">int</span></strong> _tmain<span style="color: #ff0000;">(</span><strong><span style="color: #003366;">int</span></strong> argc<span style="color: #ff0000;">,</span> _TCHAR* argv<span style="color: #ff0000;">[])</span><br />
<span style="color: #ff0000;">{</span><br />
antidebug<span style="color: #ff0000;">();</span><br />
MessageBox<span style="color: #ff0000;">(</span>NULL<span style="color: #ff0000;">, &#8220;</span><span style="color: #3366ff;">Double Check&#8230;</span><span style="color: #ff0000;">&#8220;, &#8220;</span><span style="color: #3366ff;">Double Check</span><span style="color: #ff0000;">&#8220;,</span> MB_OK<span style="color: #ff0000;">);</span><br />
<span style="color: #003366;"><strong>return</strong></span> 0<span style="color: #ff0000;">;</span><br />
<span style="color: #ff0000;">}</span></p>
<p>Before I get into the BUGs lemme just try and explain what is happening here, so we are basically loading a handle to ntdll.dll by calling the LoadLibrary process and then we load the callback to _ZwSetInformationThread which is of datatype FARPROC[<a title="More on FARPROC" href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633571%28v=vs.85%29.aspx" target="_blank">more on FARPROC</a>] then we call ZwSetInformationThread routine which has four parameters as per http://msdn.microsoft.com/en-us/library/windows/hardware/ff567101%28v=vs.85%29.aspx .</p>
<p>The firstparameter is the handle to the current thread and since we want to run this function within our program we use the GetCurrentThread() function call which returns a handle to the current thread. Next is a value 11. This is basically the value because of which the debugger would get detached from the process. Now how did i get this value. As per documentation on msdn the second parameter is of the enumeration type _THREADINFOCLASS which is as follows <a title="THREADINFOCLASS enum" href="http://www.reversing.be/forum/viewtopic.php?t=520" target="_blank">[source]</a> :</p>
<p style="padding-left: 30px;">typedef enum _THREADINFOCLASS {<br />
ThreadBasicInformation,<br />
ThreadTimes,<br />
ThreadPriority,<br />
ThreadBasePriority,<br />
ThreadAffinityMask,<br />
ThreadImpersonationToken,<br />
ThreadDescriptorTableEntry,<br />
ThreadEnableAlignmentFaultFixup,<br />
ThreadEventPair_Reusable,<br />
ThreadQuerySetWin32StartAddress,<br />
ThreadZeroTlsCell,<br />
ThreadPerformanceCount,<br />
ThreadAmILastThread,<br />
ThreadIdealProcessor,<br />
ThreadPriorityBoost,<br />
ThreadSetTlsArrayAddress,<br />
ThreadIsIoPending,<br />
<strong>ThreadHideFromDebugger,</strong><br />
ThreadBreakOnTermination,<br />
MaxThreadInfoClass<br />
} THREADINFOCLASS;</p>
<p>So ThreadHideFromDebugger is 17 which is basically 11 in hex. And the remaining two parameters are obviously not of importance to us. :D</p>
<p>Now coming to the bugs. &#8220;|17|error: too many arguments to function|&#8221; But MSDN said that it needed four :O and now i started removing one parameter at a time and the function ran when i did not pass any arguments. After having searched a lot! The only solution that i could think of was to use the asm function and pass these arguments manually.</p>
<p>So i made the following changes.</p>
<p>(_ZwSetInformationThread)();<br />
GetCurrentProcess();<br />
<strong><span style="color: #000080;">asm</span></strong><span style="color: #ff0000;">(&#8220;</span><span style="color: #339966;">pushl 0</span><span style="color: #ff0000;">&#8220;);</span><br />
<span style="color: #000080;"><strong>asm</strong></span><span style="color: #ff0000;">(&#8220;</span><span style="color: #339966;">pushl 0</span><span style="color: #ff0000;">&#8220;);</span><br />
<span style="color: #000080;"><strong>asm</strong></span><span style="color: #ff0000;">(&#8220;</span><span style="color: #339966;">pushl 0x11<span style="color: #ff0000;">&#8220;</span></span><span style="color: #ff0000;">);</span><br />
<span style="color: #000080;"><strong>asm</strong></span><span style="color: #ff0000;">(&#8220;</span><span style="color: #339966;">pushl %eax</span><span style="color: #ff0000;"><span style="color: #339966;">&#8220;</span>);</span></p>
<p>Oh and by the way the assembly syntax utilized on GCC is the AT&amp;T asm. So yeah! I had to first read that because i have being doing the intel format. I read [<a title="ASM AT&amp;T on code::blocks" href="http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html" target="_blank">this</a>]</p>
<p>So this was some success because atleast the exe compiled, i had already though that now i would easily debug everything on OllyDbg and get it through. But this is what GCC(or i) had done to the code. :</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/07/asm.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-352" alt="asm" src="http://adwiteeya.com/wp-content/uploads/2013/07/asm.png" width="631" height="324" srcset="https://adwiteeya.com/wp-content/uploads/2013/07/asm.png 631w, https://adwiteeya.com/wp-content/uploads/2013/07/asm-300x154.png 300w" sizes="auto, (max-width: 631px) 100vw, 631px" /></a></p>
<p>So this wasnt the best solution.But it was some success since i was atleast able to compile the exe now and look it up in Olly (Somehow i am more comfortable with that.)</p>
<p>I decided that since the value passed as the handle to the process is the only thing that i do not know lemme pass other values by modifying the assembly code manually in Olly and changed the code to the following :</p>
<p>HANDLE hndle = GetCurrentThread();<br />
(_NtSetInformationThread)();</p>
<p>The exe did compile and i was getting the pop up messages too.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/07/popup.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-353" alt="popup" src="http://adwiteeya.com/wp-content/uploads/2013/07/popup.png" width="675" height="318" srcset="https://adwiteeya.com/wp-content/uploads/2013/07/popup.png 675w, https://adwiteeya.com/wp-content/uploads/2013/07/popup-300x141.png 300w" sizes="auto, (max-width: 675px) 100vw, 675px" /></a></p>
<p>Next thing was to immediately load this exe into my dearest OllyDbg and get started. Here is the very first look.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/07/asm2.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-354" alt="asm2" src="http://adwiteeya.com/wp-content/uploads/2013/07/asm2.png" width="600" height="407" srcset="https://adwiteeya.com/wp-content/uploads/2013/07/asm2.png 600w, https://adwiteeya.com/wp-content/uploads/2013/07/asm2-300x203.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>You can see that a call gets made to GetCurrentThread at 00401365 and the value is returned into EAX which is them moved to our variable &#8220;handle&#8221; (EBP-14). So after a couple of runs i realized that this value was always the same and always returning FFFFFFFE i am not sure if this is a fixed constant for a each system or is it just the local handle to every thread. But this is what it was in the case that I had in front of me. Then later you can see that a different value is moved into EAX and at 00401370 we make a call to that address (call eax) hence this is the handle to the ZwSetInformationThread.</p>
<p>So far so good. Next i had to modify the code so that i could push values to the stack before the call eax is executed. If you at the address 00401362 you would see that MOV EBP-10,EAX instruction is executed just after GetProcAddress so basically this is the place where the handle to ZwGetInformationThread is placed on the stack hence we can only modify the code after this. That is from 401365 to 40136D where the value is pushed back into EAX. (Or we could NOP both of these so that the value remains unchanged)</p>
<p>So here are the modifications that i did, wait and after this modification i clicked analyse code. So you&#8217;d see that now Olly recognizes this as a function ^_^</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/07/asm3.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-355" alt="asm3" src="http://adwiteeya.com/wp-content/uploads/2013/07/asm3.png" width="618" height="259" srcset="https://adwiteeya.com/wp-content/uploads/2013/07/asm3.png 618w, https://adwiteeya.com/wp-content/uploads/2013/07/asm3-300x125.png 300w" sizes="auto, (max-width: 618px) 100vw, 618px" /></a></p>
<p>so we have obviously overwritten the call to GetCurrentThread but the code seems to fit just fine! :)</p>
<p>Now do you see a push -2 at 0040136B i had assembled PUSH 0xFFFFFFFE. :) And also since this is windows you would have to push the last argument first&#8230; just in case you did not know this.<br />
Now before you run the code remember to save all modifications to exe because if the code is successful you would be detached from the debugger.<br />
And finally we run the program. We Get the pop ups. And next we are detached from the debugger. :) (The code screen goes blank. Try reloading with &lt;&lt; button.<br />
The Blank Screen :</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/07/asm4.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-356" alt="asm4" src="http://adwiteeya.com/wp-content/uploads/2013/07/asm4.png" width="607" height="256" srcset="https://adwiteeya.com/wp-content/uploads/2013/07/asm4.png 607w, https://adwiteeya.com/wp-content/uploads/2013/07/asm4-300x126.png 300w" sizes="auto, (max-width: 607px) 100vw, 607px" /></a></p>
<p>The Error :</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/07/error.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-357" alt="error" src="http://adwiteeya.com/wp-content/uploads/2013/07/error.png" width="460" height="178" srcset="https://adwiteeya.com/wp-content/uploads/2013/07/error.png 460w, https://adwiteeya.com/wp-content/uploads/2013/07/error-300x116.png 300w" sizes="auto, (max-width: 460px) 100vw, 460px" /></a></p>
<p>H3LL Y34H! B)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/one-hell-of-a-debug/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CheckRemoteDebuggerPresent API</title>
		<link>https://adwiteeya.com/checkremotedebuggerpresent-api/</link>
					<comments>https://adwiteeya.com/checkremotedebuggerpresent-api/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Thu, 11 Jul 2013 18:21:26 +0000</pubDate>
				<category><![CDATA[Information Security]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Anti-debugging]]></category>
		<category><![CDATA[RE]]></category>
		<category><![CDATA[summer project]]></category>
		<category><![CDATA[win32 api]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=346</guid>

					<description><![CDATA[Hi, I am currently working on anti-debugging techniques which will also be my project for this year in college.Though i know for a fact  most basic anti-debug techniques are  API based techniques, but i am still doing this post because firstly i did not find any working code and whatever non-working code was present was [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hi,</p>
<p>I am currently working on anti-debugging techniques which will also be my project for this year in college.Though i know for a fact  most basic anti-debug techniques are  API based techniques, but i am still doing this post because firstly i did not find any working code and whatever non-working code was present was also implemented locally&#8230; By the way I am really impressed by the work compiled by Tyler Shields in 2009 and he has put up some of the best resources out there!</p>
<p>This post is basically about one of those standard API&#8217;s &gt; CheckRemoteDebuggerPresent function. <span id="more-346"></span>Now there is enough stuff on msdn and other websites that you can find about its implementations and about the working of the function however for some reason they did not work for me! So here is what finally worked. And I have done a remote process example too.</p>
<p><strong>Implementation for process locally </strong></p>
<p><span style="color: #339966;">#ifndef _WIN32_WINNT</span><br />
<span style="color: #339966;">#define _WIN32_WINNT 0x0601</span><br />
<span style="color: #339966;">#endif</span><br />
<span style="color: #339966;">#include&lt;windows.h&gt;</span><br />
<span style="color: #339966;">#include&lt;stdio.h&gt;</span><br />
<span style="color: #339966;">#include&lt;conio.h&gt;</span></p>
<p>int main()<br />
{<br />
BOOL pblsPresent = FALSE;<br />
HANDLE hndle = NULL;</p>
<p>CheckRemoteDebuggerPresent(GetCurrentProcess(),&amp;pblsPresent);<br />
if(pblsPresent){<br />
printf(&#8220;<span style="color: #3366ff;">Being Debugged\n</span>&#8220;);<br />
}<br />
else{<br />
printf(&#8220;<span style="color: #3366ff;">Not being debugged\n</span>&#8220;);<br />
}<br />
getch();<br />
return 0;<br />
}</p>
<p><strong>Implementation For Remote Process (</strong>with PID 2800<strong>)</strong></p>
<p><span style="color: #339966;">#ifndef _WIN32_WINNT</span><br />
<span style="color: #339966;">#define _WIN32_WINNT 0x0601</span><br />
<span style="color: #339966;">#endif</span><br />
<span style="color: #339966;">#include&lt;windows.h&gt;</span><br />
<span style="color: #339966;">#include&lt;stdio.h&gt;</span><br />
<span style="color: #339966;">#include&lt;conio.h&gt;</span></p>
<p>int main()<br />
{<br />
BOOL pblsPresent = FALSE;<br />
HANDLE hndle = NULL;</p>
<p>hndle=OpenProcess(PROCESS_ALL_ACCESS,FALSE,2800);</p>
<p>if(hndle){<br />
printf(&#8220;<span style="color: #3366ff;">Done getting a handle \n</span>&#8220;);<br />
}else {<br />
printf(&#8220;<span style="color: #3366ff;">Invalid PID \n</span>&#8220;);<br />
}<br />
CheckRemoteDebuggerPresent(hndle,&amp;pblsPresent);<br />
if(pblsPresent){<br />
printf(&#8220;<span style="color: #3366ff;">Being Debugged\n</span>&#8220;);<br />
}<br />
else{<br />
printf(&#8220;<span style="color: #3366ff;">Not being debugged\n</span>&#8220;);<br />
}<br />
getch();<br />
return 0;<br />
}</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/checkremotedebuggerpresent-api/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Attempt to make stuff chaap at home : Results</title>
		<link>https://adwiteeya.com/attempt-to-make-stuff-chaap-at-home-results/</link>
					<comments>https://adwiteeya.com/attempt-to-make-stuff-chaap-at-home-results/#respond</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Mon, 27 May 2013 14:06:07 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[chaap]]></category>
		<category><![CDATA[soyabean]]></category>
		<category><![CDATA[stuff chaap]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=339</guid>

					<description><![CDATA[Hey, i tried making stuff chaap, a soyabean dish at home. This is what i&#8217;d say :D For : Extremely simple to cook. Hygienic. Customizable. Against : Consumes way more time cooking, than finishing it or buying and eating. Doesnt taste upto the mark(6.5/10) . Verdict : You can give it a shot if you [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hey, i tried making stuff chaap, a soyabean dish at home. This is what i&#8217;d say :D</p>
<p><strong>For</strong> : Extremely simple to cook. Hygienic. Customizable.<span id="more-339"></span></p>
<p><strong>Against</strong> : Consumes way more time cooking, than finishing it or buying and eating. Doesnt taste upto the mark(6.5/10) .</p>
<p><strong>Verdict</strong> : You can give it a shot if you like cooking. Not for you, if, taste is your only interest. :D</p>
<p>&nbsp;</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/05/25052013074.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-340" alt="25052013074" src="http://adwiteeya.com/wp-content/uploads/2013/05/25052013074-1024x802.jpg" width="539" height="421" srcset="https://adwiteeya.com/wp-content/uploads/2013/05/25052013074-1024x802.jpg 1024w, https://adwiteeya.com/wp-content/uploads/2013/05/25052013074-300x235.jpg 300w" sizes="auto, (max-width: 539px) 100vw, 539px" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/attempt-to-make-stuff-chaap-at-home-results/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Recycling at its best!</title>
		<link>https://adwiteeya.com/recycling-at-its-best/</link>
					<comments>https://adwiteeya.com/recycling-at-its-best/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Thu, 23 May 2013 17:13:46 +0000</pubDate>
				<category><![CDATA[At the College]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=330</guid>

					<description><![CDATA[I just came across this this when i was going through my facebook feed. :D Waste your money and you&#8217;re only out of money, but waste your time and you&#8217;ve lost a part of your life. Hence one must reuse a banner! :D xD &#160; #Orginally, created and put up by 2nd Shift IT/CSE ~ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I just came across this this when i was going through my facebook feed. :D Waste your money and you&#8217;re only out of money, but waste your time and you&#8217;ve lost a part of your life. Hence one must reuse a banner! :D xD <span id="more-330"></span></p>
<p>&nbsp;</p>
<p>#Orginally<strong>, created and put up </strong>by<strong> 2nd Shift IT/CSE ~ MSIT  </strong>for farewell of batch 2009-2013.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/05/945341_494475427286813_1373550394_n.jpg"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-331" alt="945341_494475427286813_1373550394_n" src="http://adwiteeya.com/wp-content/uploads/2013/05/945341_494475427286813_1373550394_n.jpg" width="679" height="509" srcset="https://adwiteeya.com/wp-content/uploads/2013/05/945341_494475427286813_1373550394_n.jpg 960w, https://adwiteeya.com/wp-content/uploads/2013/05/945341_494475427286813_1373550394_n-300x225.jpg 300w" sizes="auto, (max-width: 679px) 100vw, 679px" /></a></p>
<p><strong>#Reused</strong> by <strong>BCA</strong> :</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/05/960237_4623037587046_1149681792_n.jpg"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-332" alt="960237_4623037587046_1149681792_n" src="http://adwiteeya.com/wp-content/uploads/2013/05/960237_4623037587046_1149681792_n.jpg" width="706" height="529" srcset="https://adwiteeya.com/wp-content/uploads/2013/05/960237_4623037587046_1149681792_n.jpg 960w, https://adwiteeya.com/wp-content/uploads/2013/05/960237_4623037587046_1149681792_n-300x225.jpg 300w" sizes="auto, (max-width: 706px) 100vw, 706px" /></a></p>
<p>I hope they did not name their farwell Au Revoir :D</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/recycling-at-its-best/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
	</channel>
</rss>
