<?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>Information Security &#8211; Adwiteeya Agrawal | Home</title>
	<atom:link href="https://adwiteeya.com/category/information_security/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>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>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>First &#8220;Humla&#8221; at Null Delhi Chapter</title>
		<link>https://adwiteeya.com/first-humla-at-null-delhi-chapter/</link>
					<comments>https://adwiteeya.com/first-humla-at-null-delhi-chapter/#respond</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Sat, 11 May 2013 08:50:46 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Information Security]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=301</guid>

					<description><![CDATA[The very first Humla session at Null Delhi Chapter meet. Awkay, I am going to try and make this not sound like Chinese to people who have, no idea  about what this is. So &#8220;null&#8221; is an open community. Created and run by Aseem Jahakar sir, nation wide(india). This community is for hackers, for anybody [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The very first <strong>Humla</strong> session at <strong>Null Delhi Chapter</strong> meet. Awkay, I am going to try and make this not sound like Chinese to people who have, no idea  about what this is.<br />
So &#8220;null&#8221; is an open community. Created and run by <strong>Aseem Jahakar</strong> sir, nation wide(india). This community is for hackers, for anybody and everybody who relates or wishes to relate him/herself with security. Atleast that&#8217;s what I have experienced till now! :)<span id="more-301"></span></p>
<p><strong>So as a community what do we do?</strong><br />
As hackers or security enthusiasts we are always indulged in something or the other. Trying things and all possible combinations of those things&#8230; we accomplish things and get stuck at many places too&#8230;and at the end of the we are the kind of geeks who like to have fun and mean no harm. All this. All of it is what is null about. We meet. Monthly. Present what we have learned. Learn what others show. Discuss our technical problems. And have the chit chat we like to have. :D So this is what a null meet is about.</p>
<p>Coming to the humla session. &#8220;<strong>Humla</strong>&#8221; is a hindi word meaning &#8220;<strong>attack</strong>&#8220;. Or mapping it to our domain it simply means &#8220;<strong>offensive-security</strong>&#8220;. Now when u are a working in security u can specialize in any of its sub domains like web application security, reverse engineering, network security, forensics, auditing etc. And if for example I wish to try out a diff sub domain then that means I would have to dedicate some time each day and start learning from scratch. Not that we would not love to do it or can not do it.. but instead we have the concept of a &#8220;humla&#8221; session. This is  basically a workshop wherein u are given a kick start in that sub domain by someone who is already an expert. He is called the &#8220;<strong>humla champion</strong>&#8221; by the way, the trainer for that day. The duration of the workshop is typically 6 to 8 hours with small breaks in between. And all of this is organized free of cost but yes their is a selection process prior to this. And that is because there is only limited space available plus since advance concepts are covered so people with atleast a little pre requisite knowledge are preferred.</p>
<p>Now a little about the venue. This is how you reach the building. If you are coming for the first time you might need this.</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2013/05/map-to-tlabs.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-302" alt="Map to null venue" src="http://adwiteeya.com/wp-content/uploads/2013/05/map-to-tlabs.png" width="666" height="411" srcset="https://adwiteeya.com/wp-content/uploads/2013/05/map-to-tlabs.png 772w, https://adwiteeya.com/wp-content/uploads/2013/05/map-to-tlabs-300x185.png 300w" sizes="auto, (max-width: 666px) 100vw, 666px" /></a></p>
<p>Reached till here ? Cool. Next you have to get yourself a pass made at the reception and the guard there would tell you where do you need to go. At the entrance of the section where you were guided to by the previous gurad, sits another guard who would give you a document on which particulars of your laptop are to be mentioned. *security reasons* . Hehe. And he&#8217;d further guide you to &#8220;<strong>Tlabs</strong>&#8220;. And you&#8217;d realize that you have reached the place because generally its just us in there! :D If you dont, just in case, then look for either <strong>Sandeep Bhaiya</strong> or <strong>Vaibhav Bhaiya</strong>. The honorable mods of our chapter! :) From the inside the place is really nice just as one would imagine any office.</p>
<p>Coming back to the topic of this post! :D This time&#8217;s session was on &#8220;<strong>linux exploitation</strong>&#8221; &amp; our trainer or the humla champion was &#8220;<strong>mr. sohail&#8221;</strong>.(read 1337). I was really really excited. There have been a few subdomains of security I havent touched or infact touched and left them for a full fledged research to be done later. Exploit writing was one of them. I did try doing it&#8230; just read a few tutes from https://<strong>www.corelan.be</strong>/index.php/2009/07/19/exploit-writing-tutorial-part-1-stack-based-overflows/ and some stuff here and there to back it up. The stuff was really great but when I had started reading this, I did not know enough to go further. So kinda left that in between but this was the chance for me..as some one was there to spoon feed all of that to me! What better ?<br />
Hence, I reached the venue half an hour early. :D Its just the excitement that can do this to me. Usually i am late. Serious Late. No problem. Since perhaps there was this one other guy who was, i guess, more excited than I was.. and had reached earlier to me. Cool.! Around an hour later Vaibhav Bhaiya came and told us that this session would not be conducted at the place we usually sit. It would be conducted in a room that was at the end of the place we usually are in the beginning of. But when we went there it was a conference room YAY! a conference room! I was already getting the feel. :D</p>
<p>Now everybody started coming in I am only going to talk about the ones I know :D So the first surprise was to see <strong>rahul gurnani</strong> sir there. He is currently pursuing his ms in information security from IIIT ahemdabad so he is generally not able to join us for all the meets. Then there was ashutosh bhaiya&#8230; sandy bhaiya came in.. and the star <strong>rishi narang</strong> sir, the most interesting guy since the last two meets came in&#8230; and there was <strong>anupam</strong> sir&#8230; aah about anupam sir.. the very first time you see him you&#8217;d feel he is the kind of strict disciplined guy you&#8217;d rather not talk to&#8230; but then you gotta look at his presentation on cloud forensics!! maahnn! That was one hilariously put together presentation. You would rather come to know about his fun loving side.! :) i can almost go on writing about each member present there&#8230; (i obviously miss shubham bhaiya the most.)</p>
<p>In a conference table&#8230; the u shaped one&#8230; as you would already know &#8230; they have ports(3 inside one small box covered with a white coloured lid in the table itself&#8230;for every 3 chairs they would have one such box) to charge your laptops (or anything else for that matter). So there was this one lid that wont open.. and i figured it was all the lids that had the same problem. So on looking at it carefully i learned that it wasnt actually a problem.. that was THE locking mechanism. All you need to do it put your finger inside it and push a stick towards the opposite side. TADA!! it opened.</p>
<p>All right so finally came in our champion *drum roll please* the humla champion and he told us that he wasn&#8217;t prepared and wasn&#8217;t able to complete his sleep too because of some work&#8230;  sorry about the second part&#8230; but not being prepared&#8230; that was even better&#8230; because this just means we would do a lot more practicals and very less theory.. and that&#8217;s exactly what happened. We started of with very basics of <strong>virtual memory</strong>, <strong>stack</strong>, <strong>stack frames</strong>, <strong>calling conventions</strong> etc. Then there was the first hands on&#8230; it was basically about overwriting the return address by exploiting the <strong>strcpy</strong> function. Was nice but yes just the beginning.  Ahh! Also we were told to install <strong>virtual box</strong> on our machines so that sohail sir could equip us with the right tools. Now we started off with copying the &#8220;<strong>vdi</strong>&#8221; file to pendrives and distributing the software&#8230; this took about half an hour till we all had copies of the file. Normally a <strong>vmware workstation</strong> user would just just double click on the <strong>vdx</strong> file and it would run with the workstation software but this was a vdi file we had with us.. so what we needed to do was basically add this as a<strong> hardrive</strong> while creating a machine on virtual box&#8230;The operating system was ubuntu 6. We used this particular version because it does not have &#8220;<strong>Address Space Layout Randomization</strong>&#8220;. That is, now we can code our exploit without using registers we could directly use memory addresses. And we used <strong>gdb</strong> to do all the reverse engineering on the program we were running. Ohkay, after all of this was done.. Then we had our first break. We ordered pizzas and subs.(only ordered during the first break) and had coffee. Then we came back and did our second hands on which was putting in the shell code at the return address. So we the did the typical putting in the shellcode at in the input string then loading the address where the shellcode starts as the return address. Nicely done. By the way we used <strong>metasploit&#8217;s tools</strong> every now and then. We used the <strong>pattern-create</strong> and <strong>pattern-offset</strong> to get the string that we fed into the strcpy function. This done basically to get the exact address in memory of the place where the return address gets overwritten. All about number. ;) Now generating the shellcode was also fun since we first tried using metasploit&#8217;s payloads for that but later we used a <strong>shell-gen</strong> script and that quickly gave us the 96byte shell code and we used that in our code. Was really nice doing all this. By the way sohail sir also told us that the code is generally called shell code because back in the days this kind of code would generally be used to return a shell. YOU MUST GIVE IT A SHOT!.</p>
<p>After this we had our second break! We had pizza&#8217;s in this break and after a small wait the subs arrived for those who ordered them, they were definitely much tastier now! :D  And then was the third and the last section where we took an exploit and sohail sir explained that exploit by sort of going step by step and discussing how that was developed. In this exploit we did not use hard coded memory addresses but rather an address of an instruction that would call the register which would have the value of the offset to our entered code. ;)</p>
<p>Sohail sir was very expressive and i was getting everything that he was saying. And yes one more thing&#8230; i now knew most of the concepts that were required as I have been studying Reverse Engineering for a lot of time now! and that is probably why it all sounded very familiar.</p>
<p><strong>All in all it was one nice experience and for the Null Delhi Chapter. #Achivement Unlocked.</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/first-humla-at-null-delhi-chapter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Intersection of interests.</title>
		<link>https://adwiteeya.com/intersection-of-interests/</link>
					<comments>https://adwiteeya.com/intersection-of-interests/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Sun, 18 Nov 2012 00:03:32 +0000</pubDate>
				<category><![CDATA[At the College]]></category>
		<category><![CDATA[Information Security]]></category>
		<category><![CDATA[college magazine article]]></category>
		<category><![CDATA[cross site scripting]]></category>
		<category><![CDATA[disclosure]]></category>
		<category><![CDATA[national school of drama]]></category>
		<category><![CDATA[nsd hacked]]></category>
		<category><![CDATA[vision]]></category>
		<category><![CDATA[vulnerability]]></category>
		<category><![CDATA[web application vulnerability.]]></category>
		<category><![CDATA[xss]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=233</guid>

					<description><![CDATA[I have had a severe sprain in my neck for around 3 days now and was looking for &#8220;something different&#8221; to do after i get well. Also I had been writing an article on the cross-site scripting framework for the college&#8217;s annual magazine. (you will know where am I going with this soon). So as [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I have had a severe sprain in my neck for around 3 days now and was looking for &#8220;something different&#8221; to do after i get well. Also I had been writing an article on the cross-site scripting framework for the college&#8217;s annual magazine. (you will know where am I going with this soon). So as I was thinking it came to me that &#8221; watching theatre&#8221; could be the &#8220;something different&#8221;. <span id="more-233"></span>I am as it is a huge fan of the plays organized by the NSD Repertory Company and hence NSD was the first place I started looking for, for any upcoming shows. I am a lazy person and instead of calling the helpline preferred visiting the website. Just in case if you didn&#8217;t know the website, it is <a href="http://nsd.gov.in">http://nsd.gov.in</a> . Allright &#8230;um&#8230; NSD website + XSS article&#8230;.. NSD website + XSS article&#8230;.. NSD website + XSS article&#8230;.. NSD website + XSS article&#8230;.. NSD website + XSS article&#8230;. NSD website + XSS article.</p>
<p style="text-align: center;"><strong>EQUALS</strong></p>
<h3 style="text-align: center;">XSS on NSD&#8217;s website :D</h3>
<p>&nbsp;</p>
<p>Here is the alumni&#8217;s section. :)</p>
<p><a href="http://adwiteeya.com/wp-content/uploads/2012/11/xss-on-nsd.gov_.in_1.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-237 aligncenter" title="xss on nsd.gov.in" src="http://adwiteeya.com/wp-content/uploads/2012/11/xss-on-nsd.gov_.in_1.jpg" alt="" width="614" height="768" srcset="https://adwiteeya.com/wp-content/uploads/2012/11/xss-on-nsd.gov_.in_1.jpg 614w, https://adwiteeya.com/wp-content/uploads/2012/11/xss-on-nsd.gov_.in_1-239x300.jpg 239w" sizes="auto, (max-width: 614px) 100vw, 614px" /></a></p>
<p><strong>All right how did I find it. ?</strong></p>
<p>So for obvious reasons (look at the url , id=some integer) , I thought there could be a possible sqli vulnerability, though i knew i had a very little chance, i still pushed in the url to both havij and sqlmap. Havij failed however sqlmap listed that a boolean based blind could be executed in the format of 1=1, so for abvious reasons i tried a=a. Which did not work&#8230; ah&#8230;then finally came to me that and i executed the &#8216;a&#8217;=&#8217;a&#8217;. Finally replace the &#8216;a&#8217; with a script and tada! :D</p>
<p><strong>About the disclosures</strong>.</p>
<p>I wrote a mail to  indiaportal@gov.in, nationalschoolofdrama@gmail.com and info@cert-in.org.in. I also submitted it to thehackernews.com, xssed.com and null.co.in<br />
However I do not expect a reply any time soon.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/intersection-of-interests/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>The .onion Websites &#8211; Tutorial</title>
		<link>https://adwiteeya.com/the-onion-websites/</link>
					<comments>https://adwiteeya.com/the-onion-websites/#respond</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Sat, 01 Sep 2012 05:41:27 +0000</pubDate>
				<category><![CDATA[Information Security]]></category>
		<category><![CDATA[.onion website]]></category>
		<category><![CDATA[hosting .onion]]></category>
		<category><![CDATA[how to run .onion website]]></category>
		<category><![CDATA[the onion routing]]></category>
		<category><![CDATA[the tor project]]></category>
		<category><![CDATA[tor]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[video tutorial]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=196</guid>

					<description><![CDATA[What is a .onion website? The .onion website would be an http service hosted on your localhost and accessed by the TOR browser only. What is the TOR browser? It is a browser that looks like mozilla firefox and can give you a completely anonymous browsing. What is anonymous browsing? When you access the websites [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>What is a .onion website?</strong><br />
The .onion website would be an http service hosted on your localhost and accessed by the TOR browser only.</p>
<p><strong>What is the TOR browser?</strong><br />
It is a browser that looks like mozilla firefox and can give you a completely anonymous browsing.<span id="more-196"></span></p>
<p><strong>What is anonymous browsing?</strong><br />
When you access the websites they can have scripts running to capture you IP address or your location. To be able to hide that is called as anonymous browsing in the simplest form.<a href="http://adwiteeya.com/wp-content/uploads/2012/09/tor.jpg"><img loading="lazy" decoding="async" class="alignright size-full wp-image-199" title="tor" src="http://adwiteeya.com/wp-content/uploads/2012/09/tor.jpg" alt="" width="243" height="208" /></a><br />
<br />
<!-- Begin: adBrite, Generated: 2012-09-21 22:51:22  --><br />
<script type="text/javascript">
var AdBrite_Title_Color = '0000FF';
var AdBrite_Text_Color = '000000';
var AdBrite_Background_Color = 'FFFFFF';
var AdBrite_Border_Color = 'CCCCCC';
var AdBrite_URL_Color = '008000';
var AdBrite_Page_Url = '';
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';}
</script><br />
<script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=2213177&zs=3330305f323530&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'&purl='+encodeURIComponent(AdBrite_Page_Url)+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script></p>
<div><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=2213177&#038;afsid=1" style="font-weight:bold;font-family:Arial;font-size:13px;">Your Ad Here</a></div>
<p><!-- End: adBrite --></p>
<p><strong>Can you host other Services Using the same process?</strong><br />
Yes just run the service on the correct virtual port and then use the appropriate client to access the service.</p>
<p><strong>Do you need to forward the particular port on the gateway?</strong><br />
Yes, you need to forward the particular port in order to be able to host the service.</p>
<p><strong>Can this site be accessed outside TOR?</strong><br />
No, this site can only and only be accessed by the TOR browser.</p>
<p><iframe loading="lazy" src="http://www.youtube.com/embed/wFNY2ZT0u5c" frameborder="0" width="560" height="315"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/the-onion-websites/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The First Delhi Null Meet I attended and presented.</title>
		<link>https://adwiteeya.com/the-first-delhi-null-meet-i-attended-and-presented/</link>
					<comments>https://adwiteeya.com/the-first-delhi-null-meet-i-attended-and-presented/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Sun, 19 Aug 2012 04:29:30 +0000</pubDate>
				<category><![CDATA[Information Security]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[delhi meet]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[null delhi meet]]></category>
		<category><![CDATA[null meet]]></category>
		<category><![CDATA[nullcon]]></category>
		<category><![CDATA[presentation at null]]></category>
		<category><![CDATA[voip interception]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=175</guid>

					<description><![CDATA[Hi there, So today ie 18th august 2012. I attended my first null meet. I actually liked the concept there..wait let me start from the beginning. So i received the email regarding the Delhi meet&#8230; and after a little hesitation asked Mr. Aseem Jahakar if the meet would allow some on the spot presentations. He [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hi there,<br />
So today ie 18th august 2012. I attended my first null meet. I actually liked the concept there..wait let me start from the beginning. So i received the email regarding the Delhi meet&#8230; and after a little hesitation asked Mr. Aseem Jahakar if the meet would allow some on the spot presentations. He said that its planned before hand so, I need to tell him in advance if I wish to make a presentation. So, I told him that I am working on the project &#8230;the PBX vulnerabilities &#8230;but haven&#8217;t completed it yet.<span id="more-175"></span> He then encouraged me to present what ever I had prepared and try completing it before the meet. But then I obviously could not add anything because I had this seminar on 17th on sqli and had to prepare for that. So i decided that I would just present what all I have prepared till now. :)<a href="http://adwiteeya.com/wp-content/uploads/2012/08/pt_948_4878_o.jpg"><img loading="lazy" decoding="async" class="alignright size-medium wp-image-176" title="pt_948_4878_o" src="http://adwiteeya.com/wp-content/uploads/2012/08/pt_948_4878_o-300x231.jpg" alt="" width="300" height="231" srcset="https://adwiteeya.com/wp-content/uploads/2012/08/pt_948_4878_o-300x231.jpg 300w, https://adwiteeya.com/wp-content/uploads/2012/08/pt_948_4878_o.jpg 623w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br />
So the entire week I was really worried about this presentation because I had not even prepared a powerpoint presentation, I did not know the what kind of audience am i gonna get and also I did not know weather things would work there.(some attacks worked seldom)<br />
All right no problemo! Challenge accepted! (Meanwhile Mr. Jahakar had already to put up my presentation on the list. )<br />
So here comes the day, 18th august I was all set to give this a shot &#8230;. Now the venue for the meet as per the email was<br />
&#8220;Times Internet Limited,<br />
Tlabs, First floor, FC-6,<br />
Sector 16A, Film City, Noida<br />
(Next to huge Shiv murti)<br />
Very close to Noida Sector 18 Metro Station&#8221;</p>
<p>so I reached sector 16A by 4:00pm and was looking was the &#8220;Times Internet Limited&#8221; however there was no such building&#8230; I realised that after having walked for 3 kms around the same building&#8230; so I showed the exact address to one of gaurds (you will see a lot of them if you are in this area). He could locate where the plot FC-6 is.. so i had to walk back the entire boundary wall to reach the enterance gate of Times India Limited. (not times internet limited). So finally i confirmed with the gaurds of the building weather tlabs was in the same building or not they said it was and I was finally relaxed! I reached the place, it was huge&#8230;looked almost like a 5 star hotel&#8217;s reception. So when i entered the first floor they gave me a slip which was required for exit. :O So when I reached the lab the Tlabs the entire room was larger than the auditorium we have at MSIT. I was a bit nervous then getting to question myself &#8230;weather my presentation would be good enough.. are they gonna like it&#8230; But man awesome building. :D So now I had talk with my friend who motivated me to go there and just do it&#8230; so I just went there&#8230; and actually there were two events going on simultaneously some hacking event and our meet&#8230; that mean have of the crowd was actually going to be my audience&#8230;</p>
<p>aah there i saw mr. Aseem&#8230;. pulled up a chair.. and sat near the &#8220;group&#8221;. Now in the large room&#8230; there were only around 15 people who had come for the meet&#8230;so it more of a drawing room chit chat kind of a thing.. we had been bags sofas and chairs&#8230; in the shape of a U facing this LED tv where we were supposed to connect the laptop to give the presentation.. The first part of the presentation was Newsbyte &#8230; it was basically the &#8220;new stuff&#8221; and &#8220;update&#8221; section. I liked the part&#8230; the guy delivered his part nicely. :) Then there was a problem that we did not have much time for two presentations &#8230;hence only one of the two speakers me or shubham bhaiya could speak&#8230; So mr. aseem asked the duration of our presentations and my presentation was a shorter one so I was told to give it :) So i just got up and connected my laptop and started with my thing&#8230; now this presentation was different from any presentation i have ever given&#8230; i could see people understanding what i am saying :D that was nice&#8230;. plus yes.. i perhaps was the only one who was from college here&#8230; other people who came here were already working at different places&#8230; But offcourse my presentation was different&#8230; off beat&#8230; hence deserved the small round of applause :) So i did what i was here to do&#8230; then came back to my seat&#8230; and we started discussing about &#8220;things&#8221; and &#8220;stuff&#8221; :D Was a nice experience all together&#8230; Just that the duration was really less&#8230; we were actually almost kicked out of the building :D But i liked the whole concept of hackers meeting like this and presenting stuff &#8230;talking about security.. developments in the industry and the problems they are facing .. :) was cool really cool. Apart from that I also made good friends&#8230; the nice nature hackers.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/the-first-delhi-null-meet-i-attended-and-presented/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>The SQL injection Presentation.</title>
		<link>https://adwiteeya.com/the-sql-injection-presentation/</link>
					<comments>https://adwiteeya.com/the-sql-injection-presentation/#comments</comments>
		
		<dc:creator><![CDATA[Adwiteeya Agrawal]]></dc:creator>
		<pubDate>Sat, 18 Aug 2012 02:07:30 +0000</pubDate>
				<category><![CDATA[At the College]]></category>
		<category><![CDATA[Information Security]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[5th semester project]]></category>
		<category><![CDATA[adwiteeya agrawal]]></category>
		<category><![CDATA[attack]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[seminar]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[Surajmal]]></category>
		<guid isPermaLink="false">http://adwiteeya.com/blog/?p=165</guid>

					<description><![CDATA[Hi, so we have this subject called DBMS (database management system) which is taken up by Miss. Nishtha Jatana. Nishtha maam follows a different routine for her classes&#8230;a rather constructive one. She converts her initial 2 &#8211; 3 tutorial classes into presentations that are delivered by the students. If you don&#8217;t know what a tutorial [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Hi, so we have this subject called DBMS (database management system) which is taken up by Miss. Nishtha Jatana. Nishtha maam follows a different routine for her classes&#8230;a rather constructive one. She converts her initial 2 &#8211; 3 tutorial classes into presentations that are delivered by the students. If you don&#8217;t know what a tutorial class is.. it is basically a kind of an extra class where students can ask doubts or there can be revision of topics or some numerical problems related to the topics can be done. Now the presentations are conducted on a voluntary basis. There is no compulsion, so i decided<span id="more-165"></span>to give a presentation on SQL injection. Off course, this was the topic that was closely related to both DBMS and security. So I had the presentation scheduled for 13th august at 4:30pm. <a href="http://adwiteeya.com/wp-content/uploads/2012/08/presentation-boy-color.gif"><img loading="lazy" decoding="async" class="alignleft size-medium wp-image-171" title="presentation-boy-color" src="http://adwiteeya.com/wp-content/uploads/2012/08/presentation-boy-color-300x266.gif" alt="" width="300" height="266" srcset="https://adwiteeya.com/wp-content/uploads/2012/08/presentation-boy-color-300x266.gif 300w, https://adwiteeya.com/wp-content/uploads/2012/08/presentation-boy-color.gif 360w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a>BUT I reached the room 10 minutes late! and then my laptop for some reason(winsock reset) did not connect to tata photon that wasted another 20 minutes so i was practically left with 20 minutes only&#8230; we (initially i and my friend were giving the presentation together) started the presentation but offcourse it did not end and also there were only 6 students in the class :D . So maam postponed it to 17th august at 2:20pm and the awesome part was she booked the seminar hall !!! and also I had two periods for the presentation!!! and one of the periods was a lecture!! not a tute!! I really thank her for making me do this&#8230; because I too learned a lot while researching on SQLi.</p>
<p>Though I had in my mind that 2 periods! thats long &#8230;am I really gonna be able to make it till then..! Allright so this time the presentation in the seminar hall and all my classmates present there! :) The best part is that I knew they were bored like hell&#8230; obviously its not of there interest &#8230; but they supported me&#8230; they were quite and occasionally tried listening as well.. :) Thanks to them for being awesome. :) Now I started with the presentation (this time only I was doing it) and noticed that even my proctor Saba maam was present there&#8230; Then it went on &#8230;.things worked fine.. one of examples took time hence was not completed on the spot&#8230; like you know when your software does not recognize the version of the DBMS on the server&#8230; But apart from that it was nice&#8230; it went how i had planned&#8230; and also i loved the complements &#8230; in fact I got the best compliment from my proctor. She said that it was really practical&#8230; and generally seminars are not so practical!!! And that pretty much is the motto of my life&#8230; to keep things practical. :) Then my classmates&#8217; comments&#8230; which actually gave me the right feedback and scope for improvement&#8230; Things like i need to take breaks in between, i have to interact more with the audience, include less of backtrack and I could use the zoom tool&#8217;s bar feature rather than zooming the entire screen. I would keep that in mind next time :) &#8230; and lastly the shocking part was i fucking took the entire too periods!! sorry classmates. :D<br />
Also my offer of sharing the resources for a total of more than 12 types of sql injections is still open if you buy me a coke. :D</p>
]]></content:encoded>
					
					<wfw:commentRss>https://adwiteeya.com/the-sql-injection-presentation/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
	</channel>
</rss>
