<?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>onHacks &#187; Testing</title>
	<atom:link href="http://onhacks.org/lang/en/tag/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://onhacks.org</link>
	<description>On Hacking Across Boundaries</description>
	<lastBuildDate>Wed, 02 Jun 2010 05:48:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Concept of Virtual Machines and Honeypots Detection Techniques</title>
		<link>http://onhacks.org/lang/en/2009/08/21/concept-of-virtual-machines-and-honeypots-detection-techniques</link>
		<comments>http://onhacks.org/lang/en/2009/08/21/concept-of-virtual-machines-and-honeypots-detection-techniques#comments</comments>
		<pubDate>Fri, 21 Aug 2009 09:00:30 +0000</pubDate>
		<dc:creator>log0</dc:creator>
				<category><![CDATA[Honeypot]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://onhacks.org/?p=522</guid>
		<description><![CDATA[In &#8220;Who is Hacking Me?&#8220;, I mentioned using Nmap to do a service probe on a low interaction honeypot. I wrote briefly how to do it in my last post. The &#8220;How&#8221; part of this article [add link to the previous article] is not uninteresting, but it is the &#8220;Why&#8221; part I&#8217;d like to focus [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en">In &#8220;<a href="http://onhacks.org/lang/en/2009/07/21/who-is-hacking-me" target="_blank">Who is Hacking Me?</a>&#8220;, I mentioned using Nmap to do a service probe on a low interaction honeypot. I wrote briefly how to do it in <a href="http://onhacks.org/lang/en/2009/08/13/one-method-to-detect-low-interaction-honeypots" target="_blank">my last post</a>. The &#8220;How&#8221; part of this article [add link to the previous article] is not uninteresting, but it is the &#8220;Why&#8221; part I&#8217;d like to focus on. You know, we hackers know why things are done so, not just how. So,</span></p>
<p><span lang="en">Why does the methodology work?</span></p>
<p><span lang="en">First, ask yourself :</span></p>
<p><span lang="en">How do you tell a human from a computer?</span></p>
<p><span lang="en">The CAPTCHA solution : You test the target to recognize some text in an image. If the target passed the test, it&#8217;s likely human. If not, it&#8217;s likely computer. The idea is that computers cannot do image recognition well, and actually quite bad.</span></p>
<p><span lang="en">Generalizing, we ask the target to do things only a human can do well but not computers. If the target being tested fails our human test, we conclude it with certain confidence that it is not human.</span></p>
<p><span lang="en">Well, CAPTCHA works for computers and humans. What about real services and emulated services?</span></p>
<p><span lang="en">In the same manner, the concept is that : <strong>an emulated service and a real service is technically different in implementation, and that difference makes them distinguishable</strong>. By targetting these differences, it gives you a hint to the identity of the service.</span></p>
<p><span lang="en">Let&#8217;s go through yet another real example. One question people loves to ask is :</span></p>
<p><span lang="en"><strong>How do I analyze a malware with anti-virtual-machine technology?</strong> It does not run in my vmware! Should I use a physical machine?</span></p>
<p><span lang="en">Wait, but it runs in my VirtualBox. Oh!</span></p>
<p><span lang="en">Go download any SdBot online or any found in the wild. They are normally armed with an anti-VM (anti-virtual machine) module, which stops the bot execution if it detects it&#8217;s in a VM. You can try that in VMWare, specifically VMWare. Then, go try it in VirtualBox. But, save yourself some time, I have tested already. =)</span></p>
<p><span lang="en">Wrong question, what you shouldask is :</span></p>
<p><span lang="en"><strong>How does the SdBot tell between VMware and a physical machine?</strong></span></p>
<p><span lang="en">It works because there are technical differences between the implementation of a VM and a physical machine. It is the same idea of emulated services and real services mentioned in the previous article. When I said that it is because of technical differences, it means it is related to its implementation.</span></p>
<p><span lang="en">Precisely, SdBot running in VirtualBox but not VMware means that SdBot is not anti-VM but anti-VMWare because it is specifically targetting VMWare, but not VirtualBox.</span></p>
<p><span lang="en">Consider these points :</span></p>
<ul>
<li><span lang="en">VMWare could set a register when a physical machine doesn&#8217;t.</span></li>
<li><span lang="en">There&#8217;s a dhcpd service provided by the VMware which is not generally present in real machines.</span></li>
<li><span lang="en">Some instructions in physical CPU are not implemented/supported in VMware.</span></li>
</ul>
<p><span lang="en">These techniques are all based on the principle above.</span></p>
<p><span lang="en">Though, the above also implicated something else : the anti-vm techniques are specific to certain implementations, and you can use some less common virtual machine implementation (VirtualBox, Xen, etc&#8230; ) and the SdBot <strong>WILL</strong> execute, because the anti-vm technique does not apply to VirtualBox, Xen, etc. However, there is no guarantee the anti-vm technique can only hit one implementation, it can target multiple implementation weaknesses.</span></p>
<p><span lang="en">So, if you have to analyze SdBot in a virtualized environment. You do not need to run it on a physical machine with test automation to take care of the environment. You can create an environment or disable the technique or whatsoever. That is how it works behind the scenes. That goes the same for honeypots in the general idea. So, happy honeypot hunting!</span></p>










































]]></content:encoded>
			<wfw:commentRss>http://onhacks.org/lang/en/2009/08/21/concept-of-virtual-machines-and-honeypots-detection-techniques/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Method to Detect Low Interaction Honeypots</title>
		<link>http://onhacks.org/lang/en/2009/08/13/one-method-to-detect-low-interaction-honeypots</link>
		<comments>http://onhacks.org/lang/en/2009/08/13/one-method-to-detect-low-interaction-honeypots#comments</comments>
		<pubDate>Thu, 13 Aug 2009 13:51:46 +0000</pubDate>
		<dc:creator>log0</dc:creator>
				<category><![CDATA[Honeypot]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://onhacks.org/?p=536</guid>
		<description><![CDATA[In &#8220;Who is Hacking Me?&#8220;, I mentioned using Nmap service probes on the honeypot to yield interesting results. Here is the scan without service probes (sanitized) : # Nmap 4.90RC1 scan initiated Sat Jul 11 00:39:13 2009 as: nmap -oN result.sS.txt -v -sS &#60;XXXXXX&#62; Host &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd) is up (0.092s latency). Interesting ports on &#60;xxxxxx&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en">In &#8220;<a href="http://onhacks.org/2009/07/21/who-is-hacking-me" target="_blank">Who is Hacking Me?</a>&#8220;, I mentioned using Nmap service probes on the honeypot to yield interesting results.</span></p>
<p><span lang="en">Here is the scan without service probes (sanitized) :</span></p>




<blockquote><p># Nmap 4.90RC1 scan initiated Sat Jul 11 00:39:13 2009 as: nmap -oN result.sS.txt -v -sS &#60;XXXXXX&#62;</p>
<p>Host &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd) is up (0.092s latency).<br />
Interesting ports on &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd):<br />
Not shown: 550 filtered ports, 434 closed ports<br />
PORT     STATE SERVICE<br />
21/tcp   open  ftp<br />
22/tcp   open  ssh<br />
25/tcp   open  smtp<br />
110/tcp  open  pop3<br />
139/tcp  open  netbios-ssn<br />
143/tcp  open  imap<br />
443/tcp  open  https<br />
465/tcp  open  smtps<br />
993/tcp  open  imaps<br />
995/tcp  open  pop3s<br />
1023/tcp open  netvenuechat<br />
1025/tcp open  NFS-or-IIS<br />
2103/tcp open  zephyr-clt<br />
2105/tcp open  eklogin<br />
2107/tcp open  unknown<br />
3372/tcp open  msdtc<br />
Read data files from: /usr/local/share/nmap<br />
# Nmap done at Sat Jul 11 00:41:08 2009 &#8212; 1 IP address (1 host up) scanned in 114.52 seconds</p></blockquote>
<p><span lang="en">Here is the scan with service probes :</span></p>


<blockquote><p># Nmap 4.90RC1 scan initiated Sat Jul 11 00:43:00 2009 as: nmap -oN result.sS.O.sV.txt -O -sV -v -sS &#60;xxxxxx&#62;<br />
Increasing send delay for aaa.bbb.ccc.ddd from 0 to 5 due to 24 out of 79 dropped probes since last increase.<br />
Initiating OS detection (try #1) against &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd)<br />
Retrying OS detection (try #2) against &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd)<br />
Host &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd) is up (0.091s latency).<br />
Interesting ports on &#60;xxxxxx&#62; (aaa.bbb.ccc.ddd):<br />
Not shown: 550 filtered ports, 434 closed ports<br />
PORT     STATE SERVICE       VERSION<br />
21/tcp   open  ftp           <strong>Nepenthes HoneyTrap fake vulnerable ftpd</strong><br />
22/tcp   open  ssh           OpenSSH 5.1p1 Debian 5ubuntu1 (protocol 2.0)<br />
25/tcp   open  smtp<strong>?</strong><br />
110/tcp  open  pop3<strong>?</strong><br />
139/tcp  open  netbios-ssn<strong>?</strong><br />
143/tcp  open  imap<strong>?</strong><br />
443/tcp  open  ssh           OpenSSH 5.1p1 Debian 5ubuntu1 (protocol 2.0)<br />
465/tcp  open  smtps<strong>?</strong><br />
993/tcp  open  imaps<strong>?</strong><br />
995/tcp  open  pop3s<strong>?</strong><br />
1023/tcp open  netvenuechat<strong>?</strong><br />
1025/tcp open  NFS-or-IIS<strong>?</strong><br />
2103/tcp open  zephyr-clt<strong>?</strong><br />
2105/tcp open  eklogin<strong>?</strong><br />
2107/tcp open  unknown<br />
3372/tcp open  msdtc<strong>?</strong><br />
4 services unrecognized despite returning data. If you know the service/version, please submit the following fingerprints at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :</p>
<p>&#8230;<br />
&#8230;</p>
<p>Read data files from: /usr/local/share/nmap<br />
OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .<br />
# Nmap done at Sat Jul 11 00:48:38 2009 &#8212; 1 IP address (1 host up) scanned in 338.94 seconds</p></blockquote>
<p><span lang="en">Nmap shows a lot of question marks because these services all show odd behaviour from many known implementations. That&#8217;s because a low interaction honeypot only emulates a part of the target service, which means its missing basic behaviour could be detected as something unknown by Nmap service probes. The service probes are used to identify the software version and actual software using the port. If you see similar output, this is unlikely a real computer &#8211; an emulated service, i.e. a honeypot. Of course, this is just one of the ways, and you can probably think of other ways to accomplish the same as well.</span></p>
<p><span lang="en">Oh yes, this works for some other low interaction honeypots other than Nepenthes, too. In my next post, I will talk about how VM-detection, honeypot-detection and how to analyze a malware that does not run in VM.<br />
</span></p>




<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 1547px; width: 1px; height: 1px;">http://onhacks.org/lang/zh-hk/2009/07/12/%e8%aa%b0%e5%9c%a8%e5%85%a5%e4%be%b5%e6%88%91%e7%9a%84%e7%b3%bb%e7%b5%b1</div>
]]></content:encoded>
			<wfw:commentRss>http://onhacks.org/lang/en/2009/08/13/one-method-to-detect-low-interaction-honeypots/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to examine a bad word filter?</title>
		<link>http://onhacks.org/lang/en/2009/05/31/how-to-examine-a-bad-word-filter</link>
		<comments>http://onhacks.org/lang/en/2009/05/31/how-to-examine-a-bad-word-filter#comments</comments>
		<pubDate>Sun, 31 May 2009 00:02:16 +0000</pubDate>
		<dc:creator>.hac</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Analysis]]></category>
		<category><![CDATA[Black box]]></category>
		<category><![CDATA[Filtering]]></category>

		<guid isPermaLink="false">http://onhacks.org/?p=352</guid>
		<description><![CDATA[Testing something is always a good practice before learning how to hack something, the methodologies we use in testing sometimes are applicable in hacking. So, I am planning to write some entries related to testing in the coming few months. See if we can have discover a systematic way to hack. Here is the first [...]]]></description>
			<content:encoded><![CDATA[<p>Testing something is always a good practice before learning how to hack something, the methodologies we use in testing sometimes are applicable in hacking. So, I am planning to write some entries related to testing in the coming few months. See if we can have discover a systematic way to hack. Here is the first challenge, it is very simple.</p>
<p><strong>Problem</strong><br />
Network managers always want to or are forced to control the information flowing around a network. Most of the time, filtering is a good way to do the control. Inside this big category, we always like to use block list to prevent information comes in or goes out, to and from the network.</p>
<p><strong>Scenarios</strong><br />
Flora doesn&#8217;t want her daughter wallow in Japan pop star. Flora knows that her daughter always navigate to some sites with domain name ending as &#8216;.jp&#8217;, she is looking for a tool that can control what kinds of websites their PC can reach.</p>
<p>IT administrator in PC middle school discovered that their mail system started receiving porn advertisement and students are trying to share these links through the mail system, they are planning to have a filter that can block all such mail flows.</p>
<p>Justin loves blogging so much, he is writing them weekly. He loves to collect and read feedbacks from the audiences. However, he hates those spammer pasting unrelated advertisement on his posts. He want to figure out a way to stop them appearing from other audiences.</p>
<p><strong>Solution</strong><br />
The trivial filtering solution to help these people out is bad word filtering. The basic idea is the same as general block list, users can specify the tokens they want to look for when deciding to block the information. In general, there are at least two different definitions to distinguish whether we found the bad word or not. Given an input message M,</p>
<ol>
<li>Split the message M into a sequence of words Ws, we found a bad word bW is in the message only if Ws contains bW.</li>
<li>Take the message M as an input stream, we found a bad word bW when there is a list of consecutive characters equals bW.</li>
</ol>
<p>Both definition has there own advantages and disadvantages, but we will keep this discussion later since the current topic is how to test the filter. Let&#8217;s say we pick the first definition for our filter, then what should we test? (Take some time to think about scenarios before continue reading)</p>
<p><strong>Functional Test</strong><br />
According the input of this filter (input message M), we can design few functional test cases. Basic scenarios are,</p>
<ul>
<li>empty message [Expected: Accept];</li>
<li>only a word (either good or bad word) [Expected: good - Accept, bad - Reject];</li>
<li>two words (good and bad) with different delimiter [Expected: Depends on how the feature define delimiter];</li>
<li>a list of word and contains (0, 1, 2, all) bad words [Expected: all reject];</li>
<li>a bad word is embedded in a word (eg. assume evil is bad word, message conatins residentevil.com) [Expect: By design, this message will be accepted]</li>
</ul>
<p>Beside these functional test cases, we should to have a lengthy message to check boundary cases of the feature. Assume the longest message we accept is N characters, we need to have message with length N, N+1 and N+2. On the other hand, globalization and localization test may be required, depends on who is your target user.</p>
<p><strong>Security Concern</strong><br />
Then we would ask: is there other way to bypass the filter (eg. message using different encoding)? Is it possible to have code injection or script injection attack? Who can use the feature? Where is the bad word list? Who have rights to touch the list? These are security concerns when testing the feature. Drawing a data flow diagram always help to identify what kind of security issues we may have. However, this post only focus on functional testing a feature. May be next time we can discuss how to design security test cases of a feature.</p>
<p><strong>Conclusion</strong><br />
We have only discussed some elementary skills to design the test plan of a feature. You can consider what kind of input the feature can have, both valid and invalid input. Output is another way to discover new scenarios, output is anything that the feature shown. Since we assumed that this filter only say accept or reject of a message and throw some exceptions (eg. input size exceed), the test cases we found here are almost dominated by what we found with the input. Now, you are able to test your program more systematically!</p>
<p>Have a good weekend!</p>
<p><strong>Practice (Just for fun)</strong><br />
Should you want to have some practice, we can discuss how to test an IP block list filter. Here is a simple definition:</p>
<p><strong>INPUT</strong>: Only allow IPv4 address, one at a time<br />
<strong>IMPLEMENTATION</strong>: An IP block list is stored as a text file in the same folder of the filter, user need to directly modify the text file if he want to Add/Remove/Edit an IP address in the block list. The filter will perform a binary search to see if the input address is on the list. If it is, then it will announce reject, otherwise output accept.<br />
<strong>OUTPUT</strong>: Accept/ Reject the address</p>
]]></content:encoded>
			<wfw:commentRss>http://onhacks.org/lang/en/2009/05/31/how-to-examine-a-bad-word-filter/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
