<?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>Checkmate</title>
	<atom:link href="http://niiconsulting.com/checkmate/feed/" rel="self" type="application/rss+xml" />
	<link>http://niiconsulting.com/checkmate</link>
	<description>An Information Security Blog by NII Consulting</description>
	<lastBuildDate>Tue, 23 Feb 2010 05:46:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Format Preserving Encryption &#8211; In the guise yet retrievable as it is</title>
		<link>http://niiconsulting.com/checkmate/2010/02/09/format-preserving-encryption-in-the-guise-yet-retreivsble-as-it-is/</link>
		<comments>http://niiconsulting.com/checkmate/2010/02/09/format-preserving-encryption-in-the-guise-yet-retreivsble-as-it-is/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 11:11:02 +0000</pubDate>
		<dc:creator>Khushbu Jithra</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Encrypt with format intact]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Format Preserving Encryption]]></category>
		<category><![CDATA[German Data Privacy Law]]></category>
		<category><![CDATA[PCI DSS]]></category>
		<category><![CDATA[UK Data Privacy Act]]></category>

		<guid isPermaLink="false">http://niiconsulting.com/checkmate/?p=239</guid>
		<description><![CDATA[A recent dive into challenges faced from privacy compliance requirements unearthed an interesting patent. The unearthing of this new patent on the block came from the need of anonymizing data for several reasons including compliance (PCI DSS, German Data Privacy Law [BDSG], UK Data Privacy Act).]]></description>
			<content:encoded><![CDATA[<p>A recent dive into challenges faced from privacy compliance requirements unearthed an interesting patent. The unearthing of this new patent on the block came from the need of anonymizing data for several reasons including compliance (PCI DSS, German Data Privacy Law [BDSG], UK Data Privacy Act).<span id="more-239"></span></p>
<p>With inputs from experts in the domain here is an overview of this unique encryption technology.</p>
<p><strong>The challenge:</strong><br />
Simply randomizing the data won&#8217;t help if the data drives a process like indexing in a database &#8211; the introduction of database indexing problems, or destruction of the integrity of the data in the de-identification process may render it useless as far as a business application or statistical analysis is concerned even if the process should not access specific identifiable fields. So, if you need to de-identify or depersonalize yet still use the data, there needs to be a more thought put into it to ensure the process cannot be reversed and to ensure that the use of the de-identified data can be preserved.</p>
<p>For example, if we have two databases, both indexed on a national ID number containing e.g. health records but we need to de-identify the personal data, yet retain the referential integrity across internal database tables in addition to preserving record relationships across two independent databases, and replace the personal data with data that is still meaningful for analysis but truly de-identified, then we need to preserve referential integrity across all the de-identified databases.</p>
<p>What if we need this process to be selectively reversible for e.g. a e-discovery request or specific analysis where real data is needed? Traditionally, data owners would have to keep some kind of mapping table &#8211; an ugly solution as it simple moves the problem of de-identification to another place.</p>
<p><strong>The solution:</strong><br />
There are some new techniques that permit de-identification of data &#8211; in a secure fashion. Specifically Format Preserving Encryption (FFX/FFSEM mode AES) which can:</p>
<p>* Encrypt/De-identify data without changing length, structure, type, format, referential integrity of data (again optional if this is essential or if de-association of record relationships is actually required) on the fly</p>
<p>* Provide the dual purpose &#8211; de-identification or data protection in place (no database schema changes) or protection of data in live systems with a single technique</p>
<p>* reversible or non reversible by policy</p>
<p>* Supports native mainframe, open systems and legacy out of production systems.</p>
<p>In <a href="http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffsem/ffsem-spec.pdf">this</a> paper on Fiestal Finite Set Encryption (FFSEM), the author elaborates on the Pseudo-Random Permutation used in this mode and the security of the construction. The author is quoted, &#8220;In many applications, such as encryption of credit card numbers, it is desirable to encrypt items from an arbitrarily sized set onto that same set. Unfortunately, conventional cipher modes such as ECB, CBC, or CTR are unsuitable for this purpose. Feistel Finite Set Encryption Mode (FFSEM) allows encryption of a value ranging from 0..n with resultant ciphertext in that same range. This mode can be used to encrypt fields where the expansion associated with a block cipher is undesirable or the format of the data must be preserved.&#8221;</p>
<p>An <a href="http://eprint.iacr.org/2009/251">academic paper</a> on the subject summarizes &#8211; &#8220;Format-preserving encryption (FPE) encrypts a plaintext of some specified format into a ciphertext of identical format—for example, encrypting a valid credit-card number into a valid creditcard number. The problem has been known for some time, but it has lacked a fully general and rigorous treatment.We provide one, starting off by formally defining FPE and security goals for it.We investigate the natural approach for achieving FPE on complex domains, the “rank-then-encipher” approach, and explore what it can and cannot do. We describe two flavors of unbalanced Feistel networks that can be used for achieving FPE, and we prove new security results for each. We revisit the cycle-walking approach for enciphering on a non-sparse subset of an encipherable domain, showing that the timing information that may be divulged by cycle walking is not a damaging thing to leak.&#8221;</p>
<p>Now the interesting bit&#8230;.is it implemented and is it commercial?<br />
Yes. <a href="http://www.voltage.com/technology/format-preserving-encryption.htm">http://www.voltage.com/technology/format-preserving-encryption.htm</a></p>
<p>Full patent description is available here<br />
<a href="http://www.freshpatents.com/Format-preserving-cryptographic-systems-dt20080717ptan20080170693.php?type=description">http://www.freshpatents.com/Format-preserving-cryptographic-systems-dt20080717ptan20080170693.php?type=description</a></p>
<p>And of course, at the first look, Wikipedia also did not help understanding it much unless I read the background and the two papers</p>
<p><a href="http://en.wikipedia.org/wiki/Format-Preserving_Encryption">http://en.wikipedia.org/wiki/Format-Preserving_Encryption</a></p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2010/02/09/format-preserving-encryption-in-the-guise-yet-retreivsble-as-it-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GeoEdge &#8211; IP Address Locator</title>
		<link>http://niiconsulting.com/checkmate/2010/01/06/geoedge-ip-address-locator/</link>
		<comments>http://niiconsulting.com/checkmate/2010/01/06/geoedge-ip-address-locator/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 12:02:28 +0000</pubDate>
		<dc:creator>Nikhil Wagholikar</dc:creator>
				<category><![CDATA[Fundamentals]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[geoedge]]></category>
		<category><![CDATA[geotools]]></category>
		<category><![CDATA[ip locator]]></category>
		<category><![CDATA[MAP-Quest]]></category>
		<category><![CDATA[maxmind]]></category>
		<category><![CDATA[wikimapia]]></category>

		<guid isPermaLink="false">http://niiconsulting.com/checkmate/?p=192</guid>
		<description><![CDATA[From forensics point of view, investigating “which user did what on the application/server that lead to its compromise” is of the most importance. Similar scenario applies to Email investigation. It’s quite simple now to find out the IP Address of the person who is sending out fishy or threatening emails to the victim(s).]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Log analysis, is one of the very basic but crucial exercise of any Forensics Analyst. It includes many aspects for analysis; some of the important ones being:</p>
<ul>
<li>Determine actions/requests performed by User/Host/IP Address</li>
<li>The application’s or Server’s reactions towards user’s requests</li>
<li>Finding more information about a particular User/Host/IP Address who may be performing some extra-ordinary transactions with the application/server</li>
<li>Application/Server performance</li>
<li>Application/Server traffic monitoring to calculate business growth etc</li>
</ul>
<p>However from forensics point of view, investigating “which user did what on the application/server that lead to its compromise” is of the most importance. Similar scenario applies to Email investigation. It’s quite simple now to find out the IP Address of the person who is sending out fishy or threatening emails to the victim(s).</p>
<p>Here we are discussing a post investigation aspect of above and similar scenarios i.e. what after once the source IP Address (of the attacker) is identified? In this article we are going to discuss about a simple tool/script, which helps forensic analyst to get the exact location of the source IP Address on this very beautiful earth.<br />
<span id="more-192"></span><br />
<strong>Geo-Edge</strong></p>
<p>“geoedge.py” is a small Python utility/tool/script developed by Laramies from “<a href="http://www.edge-security.com/soft/geoedge.py">edge-security.com</a>” to get the exact location of the target host/IP Address on earth. This directly helps in finding the attacker’s physical location from where he carried out the attack.</p>
<p>However, those who don’t have a Python compiler/interpreter need not to worry, since NII Consulting have put in some more efforts and made this python script available in EXE format.</p>
<p>This tool can be downloaded as:</p>
<p>Original Python Version: Download <a href="http://www.edge-security.com/soft/geoedge.py">here</a></p>
<p>EXE Version: Download <a title="GeoEdge EXE version" href="http://www.niiconsulting.com/tools/geoedge.exe" target="_self">here</a></p>
<p>The beauty of this tool is that it queries two sources – <a href="http://www.maxmind.com/">Maxmind</a> and <a href="http://www.geoiptool.com/">geoiptool</a>, to extract information about given target host or IP Address. Hence possibility of availability and correctness of information about host or IP Address is high.</p>
<p><strong>Example</strong></p>
<p>Let’s first have a look how to use this tool:<br />
<a href="http://niiconsulting.com/checkmate/wp-content/uploads/2010/02/Pic1-Usage.jpg" target="_blank"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2010/02/Pic1-Usage.jpg" alt="" width="593" height="206" /></a></p>
<p>Now we’ll try to locate physical location of IP Address 64.246.16.151.</p>
<p>So for this, we’ll issue:</p>
<p><a href="http://niiconsulting.com/checkmate/wp-content/uploads/2010/02/Pic2-Sample.jpg" target="_blank"><br />
<img src="http://niiconsulting.com/checkmate/wp-content/uploads/2010/02/Pic2-Sample.jpg" alt="" width="593" height="371" /></a></p>
<p>As we can see, both the sources provided us with correct information about Latitude and Longitude of the target IP Address.</p>
<p>Now what? We have Latitude and Longitude information with us, but which country, which lane, which area this belongs to on earth?</p>
<p>So for this, we’ll refer to online world map available on <a href="http://www.mapquest.com/maps/latlong.adp">MAP-Quest</a> website.</p>
<p>We provide this obtained/derived information about Latitude and Longitude to this website, and find the exact location of this IP Address on earth.</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic3.jpg" alt="" width="586" height="612" /></p>
<p>The physical location of the target host/IP Address is shown using a red star marked on the map. Two kinds of views are available for getting the Latitude and Longitude information.</p>
<p>First view is the “Street View” in which we get the nearby street information about the target.</p>
<p><a href="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic4.jpg" target="_blank"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic4.jpg" alt="" width="461" height="277" /></a></p>
<p>A little further zoom can help us to get more information about the target host/IP Address.</p>
<p><a href="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic5.jpg" target="_blank"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic5.jpg" alt="" width="461" height="277" /></a></p>
<p>The second view is the “Aeriel view”, in which we get to see the exact satellite view of the target host/IP Address.</p>
<p><a href="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic6.jpg" target="_blank"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2010/01/Pic6.jpg" alt="" width="461" height="277" /></a></p>
<p>Further zoom is available subject to the database availability of MapQuest website.</p>
<p><strong>Conclusion</strong></p>
<p>So from this, we learn that it’s not at all difficult for any forensics analyst to find out the exact physical location of the attacker.</p>
<p>Besides this technique, “GeoTools” available at <a href="http://wikimapia.org/">WikiMapia</a> is also very handy and useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2010/01/06/geoedge-ip-address-locator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking Microsoft Windows 2003 Server with Microsoft SQL Server 2005</title>
		<link>http://niiconsulting.com/checkmate/2009/12/08/hacking-microsoft-windows-2003-server-with-microsoft-sql-server-2005/</link>
		<comments>http://niiconsulting.com/checkmate/2009/12/08/hacking-microsoft-windows-2003-server-with-microsoft-sql-server-2005/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 05:30:53 +0000</pubDate>
		<dc:creator>Taufiq Ali</dc:creator>
				<category><![CDATA[Case Studies]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://niiconsulting.com/checkmate/?p=119</guid>
		<description><![CDATA[This post is a complete switch over from my previous post on phishing modus operandi. A little background on the hack. I was doing an assessment of a financial application; the objective was to evaluate the security of the complete infrastructure on which the application will be hosted once it goes live. As oppose to [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a complete switch over from my previous post on phishing modus operandi. A little background on the hack. I was doing an assessment of a financial application; the objective was to evaluate the security of the complete infrastructure on which the application will be hosted once it goes live. As oppose to the routine list of findings this particular hack took the limelight. It was system compromise with Administrator access to the system. Yeah! </p>
<p><span id="more-119"></span></p>
<p>It was last day of our assessment; I had little time on hand before I could wind up for the day. So I thought why not bash the ‘sa’ account. I open the Microsoft SQL Server 2005 Management Studio and try some brute forcing for ‘sa’ account with common passwords, I get errors and disappointments. But this was short lived, it dint take me more than 7 tries to get the combination right. And that opens my way into the system. </p>
<p>Once I was inside, the next step was to use the stored procedure xp_cmdshell. The &#8220;xp_cmdshell&#8221; extended stored procedure runs operating system commands from within the database engine. You can use the query analyzer or T-SQL code to run the command. Back to the hack, I than open the query analyzer and type the following command</p>
<blockquote><p>
<em>exec xp_cmdshell &#8216;dir C:\&#8217;</em></p></blockquote>
<p>Though I was logged in &#8217;sa&#8217; account (the highest privilege account in SQL server), as expected I get this long error message.</p>
<blockquote><p><em>Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1<br />
SQL Server blocked access to procedure &#8217;sys.xp_cmdshell&#8217; of component &#8216;xp_cmdshell&#8217; because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of &#8216;xp_cmdshell&#8217; by using sp_configure. For more information about enabling &#8216;xp_cmdshell&#8217;, see &#8220;Surface Area Configuration&#8221; in SQL Server Books Online</em></p></blockquote>
<p>In short the error means, I cannot use the xp_cmdshell stored procedure to do my hack. Microsoft (MS) has turned this stored procedure OFF in the version above SQL 2000 as a part of the security configuration. The previous versions of SQL Server 2005 had full access to xp_cmdshell turned ON in the default setup. And hence it was easy to do the system compromise. One obvious advantage of disabling the xp_cmdshell is, once a hacker gets access to the SQL server, the system compromise would not become a cake walk. But let’s check out how you can still do cake walk on version above Microsoft SQL Server 2000. Just a little tricky but easy <img src='http://niiconsulting.com/checkmate/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you read the error carefully it gives out a lot more than it should. Check the last line of the error message. It says xp_cmdshell can be enabled using the &#8220;Surface Area Configuration&#8221;. I further Google and get plenty of articles that tell me how to use Surface Area Configuration wizard to enable the stored procedure. They would ideally work but it dint work for me for whatever reason. If you want to enable xp_cmdshell with Surface Area Configuration method on your own system, try the following</p>
<blockquote><p>
<em>Goto Microsoft SQL Server 2005<br />
Configuration Tools &gt; SQL Server Surface Area Configuration &gt; Surface Area Configuration for Feature &gt; Expand the SQL server Instance name &gt; Under Database engine goto xp_cmdshell &gt; Check &#8220;Enable xp_cmdshell&#8221; and Apply</em></p></blockquote>
<p>That&#8217;s it, you can have now enabled xp_cmdshell for your own box. You can again run the command mentioned above. You should not get any error now. The image below summarizes this</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/12/Enable_xp-cmdshell_local_sys" alt="Enabling xp_cmdshell with 'Surface Area Configuration Wizard' on your own box" /><br />
Fig: Enabling xp_cmdshell using the Surface Area Configuration Wizard</p>
<p>I had to enable xp_cmdshell on the remote system. I open my SQL Server Surface Area Configuration wizard and click on &#8220;Change computer&#8221; and specify the remote system SQL server instance name (or IP). It popped me with some error. I tried a few time but phew! It does not work for me. It was time, I try something else. I go back and start to find if there was some a command line to do the same thing. Again a few searches and I get my results. You can enable the xp_cmdshell in 4 simple steps.</p>
<blockquote><p><em>1) EXEC master.dbo.sp_configure &#8217;show advanced options&#8217;, 1 (ONE means ON, ZERO means OFF)<br />
2) RECONFIGURE<br />
3) EXEC master.dbo.sp_configure &#8216;xp_cmdshell&#8217;, 1<br />
4) RECONFIGURE</em></p></blockquote>
<p>sp_configure displays or changes global configuration settings for the current server. And the ‘sa’ account has privileges on this stored procedure. Eh! sp_configure is my key inside the system. So I first enable all the advance options than enable the xp_cmdshell. The image below shows my ‘xp_cmdshell’ in action on the remote system.</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/12/enable_xp_cmdshell.png" alt="xp_cmdshell in action on victim system" /><br />
Fig: xp_cmdshell in action on victim system</p>
<p>Once I enabled xp_cmdshell, it was time for me to add user. So I type the following commands at the query analyzer console,</p>
<blockquote><p><em>1) EXEC xp_cmdshell &#8216;net user pwnsauc3 h3ll0w0rld$ /ADD&#8217;<br />
2) EXEC xp_cmdshell &#8216;net group Administrators pwnsauc3 /ADD&#8217;</em></p></blockquote>
<p>In case the remote terminal service is not ON, goto to Start &gt; Run and type service.msc. Right click on the parent node and connect to remote services and use the above username and password. Start the Terminal Services. You can now sit and relax; you are a step away from administrator access to the system. Fire up your remote terminal client and type in the IP and login with the user name and password we created. The images below conclude my hack. </p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/12/connecting_to_remote_system.png" alt="Verify the user addition from command line" /><br />
Fig: Verify the user addition from command line</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/12/verifying_user_addition_to_sys.png" alt="Remote terminal to the victim system" /><br />
Fig: Remote terminal to the victim system</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/12/user_added_to_administrators group.png" alt="verifying the user added to Administrators group" /><br />
Fig: Verifying the user added to Administrators group</p>
<p>Adios!<br />
Taufiq Ali</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2009/12/08/hacking-microsoft-windows-2003-server-with-microsoft-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Phishy Story</title>
		<link>http://niiconsulting.com/checkmate/2009/11/05/a-phishy-story/</link>
		<comments>http://niiconsulting.com/checkmate/2009/11/05/a-phishy-story/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 12:17:40 +0000</pubDate>
		<dc:creator>Taufiq Ali</dc:creator>
				<category><![CDATA[Case Studies]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Incident Response]]></category>
		<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://niiconsulting.com/checkmate/?p=80</guid>
		<description><![CDATA[Phishing sounds similar to fishing. Fishes are to the volume of internet users today much like fishermen are to phishers. Zillions of fishes falling prey the nets is nothing less compared to internet users being phished through their own in boxes and messengers.  Phishers tend to have some personal favorites &#8211; personal information, credit [...]]]></description>
			<content:encoded><![CDATA[<p>Phishing sounds similar to fishing. Fishes are to the volume of internet users today much like fishermen are to phishers. Zillions of fishes falling prey the nets is nothing less compared to internet users being phished through their own in boxes and messengers.  Phishers tend to have some personal favorites &#8211; personal information, credit cards numbers, debit cards numbers with ATM pins, etc. Though phishing has been around for a long time, it became more prominent back in 2003. You can read more here on the big scams <a href="http://www.washingtonpost.com/wp-dyn/articles/A59350-2004Nov18.html">here</a>.</p>
<p>How does it all work?</p>
<p><span id="more-80"></span></p>
<p>
A typical modus operandi:</p>
<p>1)	The Phisher would either go out and buy a phishing kit from the underground channels or create a look alike page himself.</p>
<p>2)	 He would then need hacked websites or a server where the pages can be hosted. This can also be easily made available. He would pay or trade for a list of hacked websites on IRC channels, underground forums etc. These are some very common sources for such deals. He could also target systems that are vulnerable to a particular vulnerability or weakness in the website &#8211; vulnerability in the hosting providers control panel software, exploit for popular CMS like Joomla, 0day vulnerability in web server, etc. A zero-day (or zero-hour) attack or threat is a computer threat that tries to exploit computer application vulnerabilities that are unknown to others, undisclosed to the software vendor, or for which no security fix is available. (ref : <a href="http://en.wikipedia.org/wiki/Zero_day_vulnerability">http://en.wikipedia.org/wiki/Zero_day_vulnerability</a>)</p>
<p>3)	Once the hacked infrastructure is ready it’s time to spam. They would ideally send out emails in large volumes. These emails are crafted to perfection. They would have the company logo, an appealing message in the email; use the CSS as the company that is phished, etc. All this together make it look perfect. It’s like decorating the devils face with cosmetics to make it look innocent. But not to forget the devil under a thin layer of cosmetics. They will have a crafted link and the hyperlink actually pointing to some website where the pages are hosted.</p>
<p>However, the entire process is a gamble. Some may fall prey to their phish nets while others may not. Over the years, phishing scams have grown from simply stealing accounts into much more dangerous criminal intention. Assuming the user is a prey of the phish net, let us understand the ways in which a phisher can harvest the data of the victim. There are various ways in which this can be done.</p>
<p>1)	The attacker here uses services of websites that let you send HTML forms embedded in your email. On submit of this HTML form the phished page will redirect you to the legitimate website. This often tricks the user. They don’t realize what just happened. The details entered on the form are then emailed to the phisher’s inbox that is supposed to collect the details. The most common examples where you can see them are when advertising on the internet.</p>
<p>2)	Second, the email is scripted in a way that a user is tempted or forced to visit the copied website. The attacker can also use the tactic mentioned above and use services like www.emailmeform.com. Attacker creates an account here and links his entire phished page to use their service to capture the details and then email it to them. This is the most common method used by phishers. Also the pages are scripted in server side programming languages like PHP, .NET, JSP etc. Doing so it does not expose the modus operandi or the attacker’s identity in any way or other details in any way.</p>
<p>3)	The third type is where the phishers use nothing like above and instead writes all the output to a predefined file. In this way he needs no email address or anything mentioned above to capture the user details. This is what I am exactly going to write about.</p>
<p>Since I had some time off before I could start with the next takedown, I decided to dig further. Before we begin let me give you a brief about our service and the client. We offer take down services to a large public sector bank. We have a strict timeline defined of 24 hrs for every takedown. Every time a customer or their monitoring reports a phished page we have to takedown the site to protect the loss of financial and other details. While doing takedowns I also get a chance to research on understanding the modus operandi behind the operation. It is very interesting.</p>
<p>I have just started my day checking my email over a cup of coffee. I receive a new email on Tue 11/3/2009 10:22 AM about a phished link being up with the URL and we need to immediately start the takedown. He also sends me a sample email. We did the usual process and the link was down by noon. Have a look at a sample phishing email. </p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/fraudlent-email-sample1.jpg" alt="" /></p>
<p><br/><br/></p>
<p>The email looks so real. It has the logo of the customer and perfect login URL. On hover I found it was actually pointing to some server in Russia. The page &#8216;retails.html&#8217; simply redirects to the next URL where the phished page is hosted. Have a look at the closing lines of the email below. The phisher uses pressure tactic that will force the user to browse the URL.</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/2009-11-04_151209.jpg" alt="" /></p>
<p>Ok I now click and I am now redirected to the URL http://200.119.X.X/retail/login.php. The page looks like this</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/login-page.jpg" alt="" /></p>
<p>I then enter some fake details on this page and press the Enter key. I am now redirected to another page called &#8216;accounts.php&#8217; on the same domain. I quickly check the html source code (view source) of the page to check for the</p>
<form> tag. This is where I would see where the page is going on hitting &#8217;submit&#8217;. I am now redirected to another page hosted on a hacked domain called hxxp://stirileprotv.fnhost.org/bi/ib.php</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/2009-11-04_151925.jpg" alt="" /></p>
<p>I go a level up in the URL hxxp://200.119.X.X/retail/login.php and now I see the directory listing. I see 2 files under the retail folder namely &#8216;login.php&#8217; and &#8216;accounts.php&#8217;. Directory Listing has been common in all my takedowns. They don’t really care for the directory listings. What I also observed, at the bottom of the &#8216;account.php&#8217; page is more interesting. The page is has an IFRAME with src pointing to <a href="http://statanalyze.cn/lib/index.php">http://statanalyze.cn/lib/index.php</a>. This is some malware getting downloaded on victim system. </p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/2009-11-04_124018_malware.jpg" alt="" /></p>
<p>My anti virus immediately pops up an alert that a malware is getting downloaded. And it immediately blocks it. Coming back to &#8216;accounts.php&#8217; it asks for my Name, email address, credit card number, ATM pin and expiration date. On entering some fake details I am now redirected to a third domain hxxp://stirileprotv.fnhost.org/bi/ib.php. And from &#8216;ib.php&#8217; it redirects me to the legitimate page of my client website. I have changed that to hxxp://www.google.com in the code snippet. Aren’t these guys sick of so many re directions? Not really they have a smart modus operandi. They don’t use one domain to complete their operation.</p>
<p>I again go a level up on the <a href="http://stirileprotv.fnhost.org/bi/ib.php">http://stirileprotv.fnhost.org/bi/ib.php</a>. What I happen to find is something even more interesting. It had a page &#8216;ib.php&#8217; under the ib folder and a .txt file. When I tried accessing the file what I find is the actual account details of the people who have fallen prey to the trick with their usernames, credit card numbers, internet banking IDs and passwords. Check file snippet below</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/2009-11-05_113230.jpg" alt="" /> </p>
<p>I then contact the client to freeze the accounts and get in touch with the hosting providers. I make sure I ask the hosting providers to provide me with the pages as they aid to my research in understanding various modus operandi out on pr0wl. Most of the time they don’t give the pages but this time I was lucky. The tech support guys actually emailed me the contents of the ib folder. Have a look at the php code</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/the-actual-code.jpg" alt="" /></p>
<p>Let me explain the code in brief. It opens a stream to a file called x-account-all.txt and then captures the post variables from the URL http://200.119.X.X/retail/accounts.php. The following table explains what each variable means</p>
<p><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/11/table.jpg" alt="" /></p>
<p>I thought that was it. I was done with my research. I relaxed a bit and stretched my arms. But hold on readers I recollect that the website was also vulnerable to IFRAME injection. No more research on this malware guys I have colleagues who enjoys this. I will send this to him. Till he comes up with his analysis there are some who have already done it. Check the link below</p>
<p><a href="http://wepawet.iseclab.org/view.php?hash=363c95666cf1e80072656c7b562c4dbb&amp;type=js">http://wepawet.iseclab.org/view.php?hash=363c95666cf1e80072656c7b562c4dbb&amp;type=js</a> </p>
<p><a href="http://anubis.iseclab.org/?action=result&amp;task_id=1c109b3e2cc07d1f49168943cc884e1d2">http://anubis.iseclab.org/?action=result&amp;task_id=1c109b3e2cc07d1f49168943cc884e1d2</a></p>
<p><a href="http://www.virustotal.com/analisis/837508d65acc78ec684c0d7a907bea7f49ce223052a18a076240018fc61a0d7f-1257141946">http://www.virustotal.com/analisis/837508d65acc78ec684c0d7a907bea7f49ce223052a18a076240018fc61a0d7f-1257141946</a></p>
<p>I was still way too itchy to pull down a full stop. I picked some arbitrary entries from the file and picked the &#8216;ea&#8217; and &#8216;bb&#8217; field. Why only them? (I got this particular combination after trying out a few) I was able to login to the Yahoo accounts of the victim since the password used was the same for both the accounts. I then checked the spam box and found the email that the victim had received. There were similar emails and to my surprise I found another URL hosting the phished page. Ok guys that’s it, I need to get back to my next takedown immediately  Oh! By the way, this time it is some Windows 2003 server behind some ADSL router running the phished page on a XAMP server. I did RDP to the box, 3389 was found open. I will come back if I find something more interesting.</p>
<p>All the details in this post have being changed or rename to protect real identity of our client. </p>
<p>Adios!<br />
Taufiq Ali</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2009/11/05/a-phishy-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deobfuscating Javascript Malware</title>
		<link>http://niiconsulting.com/checkmate/2009/10/01/deobfuscating-javascript-malware/</link>
		<comments>http://niiconsulting.com/checkmate/2009/10/01/deobfuscating-javascript-malware/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 11:20:32 +0000</pubDate>
		<dc:creator>Wasim Halani</dc:creator>
				<category><![CDATA[Case Studies]]></category>
		<category><![CDATA[Malware Analysis]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[javascript deobfuscation]]></category>
		<category><![CDATA[javascript malware]]></category>

		<guid isPermaLink="false">http://niiconsulting.com/checkmate/?p=62</guid>
		<description><![CDATA[Some days back I was greeted by a Google Safe browsing warning when I tried visiting a &#8216;known&#8217; site. As I was sure it was supposed to be clean and harmless site, I thought it would be good to dig further into this problem. The trail led to interesting amounts of codes, concepts and techniques.
Malware [...]]]></description>
			<content:encoded><![CDATA[<p>Some days back I was greeted by a Google Safe browsing warning when I tried visiting a &#8216;known&#8217; site. As I was sure it was supposed to be clean and harmless site, I thought it would be good to dig further into this problem. The trail led to interesting amounts of codes, concepts and techniques.</p>
<p>Malware writers are very smart nowadays (haven&#8217;t they always been ?). They know that once their code is understood it most likely to be detected by anti-malware applications. To delay detection by such applications, they resort to a wide range of techniques. In this blog post I&#8217;ll be discussing the most potent and easily created malware.</p>
<p>Javascript has become the boon and bane of the Internet. It provides greater interactivity with the user but can also be used by malware writers to infect innocent users. Javascript is a client-side scripting technology which means the processing of the script is handled by the user&#8217;s browser.</p>
<blockquote><p><strong><em>Obfuscation is the concealment of intended meaning in communication, making communication confusing, intentionally ambiguous, and more difficult to interpret.</em></strong></p></blockquote>
<p><span id="more-62"></span></p>
<p>JavaScript is sometimes obfuscated to prevent users from easily understanding their functionality. ( Legitimate uses are to prevent stealing of code)</p>
<p>There may be many ways to obfuscate a code and similarly there may be multiple ways to de-obfuscate a code. What I&#8217;ve presented below is very raw and cannot be used to analyze many malicious JS. But since this is the beginning for me, I thought it may help others too.</p>
<p><strong>Disclaimer: Links presented below are live at the time of writing this blog post. Please do not visit them if you do not know what you are getting into.<br />
</strong></p>
<p>First thing first, we need to get the HTML source the malicious page. We can either use wget/curl or <a href="http://malzilla.sourceforge.net/">Malzilla</a>, which is what I used. It was observed that this page is dependent on the HTTP referrer. So if the domain receives a request for the page without a &#8216;valid&#8217; HTTP referrer page, the page is not returned.<br />
We get the &#8216;bad&#8217; HTML at http://mybetorwager.cn:8080/index.php with a valid HTTP referrer.</p>
<p>The complete HTML source can be viewed <a href="http://docs.google.com/View?id=dctvmpj6_28f9pwcrhd"><strong>here</strong></a> </p>
<p>The code starts off with the following in the SCRIPT tag.</p>
<blockquote><p><strong>Vhotzdq(function(p,a,c,k,e,d)</strong></p></blockquote>
<p>This section of the code shows that the javascript has been packed by the popular <a href="http://dean.edwards.name/packer/">Dean Edword JS Packer</a>. This packer is available online as well as in <a href="http://dean.edwards.name/download/#packer">download-able formats</a>. We use a GreaseMonkey script &#8220;<a href="http://userscripts.org/scripts/show/25935">Decode It!</a>&#8221; to enable the online &#8216; <em>Decoder</em>&#8216; on the webpage.<br />
</br><br />
We paste the code from Vhotzdq(function(p,a,c,k,e,d) onwards till the end and <strong>rename the function name Vhotzdq to eval</strong>. This will help us decode and evaluate the result. The output of which can be found <a href="http://docs.google.com/View?id=dctvmpj6_29hgzk3tdr"><strong>here</strong></a></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><strong>Update</strong><em><br />
Seems like Dean Edwards had coded an UNPACKER as well. It can be accessed at <a href="http://dean.edwards.name/unpacker/">http://dean.edwards.name/unpacker/</a>. If using this tool, simply <strong>replace the Vhotzdq to eval</strong> and run the script. No additional GreaseMonkey scripts are necessary <img src='http://niiconsulting.com/checkmate/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
</em></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<div id="attachment_82" class="wp-caption alignnone" style="width: 610px"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/10/js_unpack_1.jpg" alt="Fig: Unpacked Javascript using Dean Edwards Packer" title="Unpacked Javascript using Dean Edwards Packer" width="600" height="178" class="size-full wp-image-82" /><p class="wp-caption-text">Fig: Unpacked Javascript using Dean Edwards Packer</p></div>
<p>As can be seen above, we need to unescape the code to get the decoded output. This can be done in multiple ways:</p>
<ul>
<li>Replace <em>Vhotzdq </em>as <em>eval</em>, and execute the script</li>
<li>Use the Malzilla decoder feature &#8220;Decode UCS2 (%u)&#8221;</li>
<li>Use an online encoder/decoder like <a href="http://www.yehg.net/encoding/">PHP Charset Encoder/PHP String Encrypter</a></li>
</ul>
<p></br><br />
<div id="attachment_83" class="wp-caption aligncenter" style="width: 610px"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/10/js_decoded-php-charset-1.jpg?w=600" alt="Fig: Using the &#39;unescape&#39; feature provided by PHP Charset Encoder" title="Using the &#39;unescape&#39; feature provided by PHP Charset Encoder" width="600" height="315" class="size-full wp-image-83" /><p class="wp-caption-text">Fig: Using the 'unescape' feature provided by PHP Charset Encoder</p></div></p>
<p>The decoded output of the above step can be found <a href="http://docs.google.com/View?id=dctvmpj6_30dd9nvgdk"><strong>here</strong></a></p>
<p>Now the code is in a more human readable format. To further complicate analysis, the malware authors have implemented small amounts of string manipulations on the code. Also, the variables used have been obfuscated or mangled. This will not pose a problem to us as the variables can be given any names.</p>
<blockquote><p><em>Note that there exists a certain amount of code-block which is still encoded. Another <a href="http://wepawet.iseclab.org/view.php?hash=835f950f74bbdaebab4e91a28c73d1d8&amp;t=1250389682&amp;type=js">malware analysis</a> shows this section as the Shellcode. I will update this as I get more information on how to decode it.</em></p></blockquote>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p><strong>Update</strong><em><br />
OK, it turns out that the segment was indeed the shellcode. Using the Malzilla tool we concatenate the variable &#8220;<strong>var unf57UBnT</strong>&#8221;<br />
This presents us with an encoding which seems to be UCS2. Next, we can either use Malzilla to convert UCS2 to Hex (which does not provide reliable results) or use a shellcode to EXE converter available at <a href="http://sandsprite.com/shellcode_2_exe.php">http://sandsprite.com/shellcode_2_exe.php</a>.</em><br />
</br><div id="attachment_96" class="wp-caption aligncenter" style="width: 463px"><a href="http://sandsprite.com/shellcode_2_exe.php"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/10/shellcode-2-exe_2.jpg" alt="Fig: ShellCode 2 EXE" title="ShellCode 2 EXE" width="453" height="518" class="size-full wp-image-96" /></a><p class="wp-caption-text">Fig: ShellCode 2 EXE</p></div><br />
</br><br />
<em>Once we obtain the EXE from the shellcode, we can analyze this executable in a tool called <a href="http://www.webwasher.de/download/fileinsight/"><strong>FileInsight </strong>developed by Mcafee Labs</a>. Below is a snapshot of FileInsight analysis output which shows the malicious URL.</em><br />
</br><br />
<div id="attachment_97" class="wp-caption aligncenter" style="width: 610px"><img src="http://niiconsulting.com/checkmate/wp-content/uploads/2009/10/fileinsight-2.jpg" alt="Fig: FileInsight - Shellcode.exe analysis" title="FileInsight - Shellcode.exe analysis" width="600" height="420" class="size-full wp-image-97" /><p class="wp-caption-text">Fig: FileInsight - Shellcode.exe analysis</p></div> </br></p>
<p><em>URLMON.DLL is a system DLL generally used by malwares to download files from online locations</em></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
The next step is to execute the &#8216;replace&#8217; functions which involve Regular Expressions to clean out the manipulated code.<br />
As an example below is the line of code that we currently have in our decoded output.</p>
<blockquote><p>rqeqG6Spq.setAttribute(&#8216;i#)@d!&#8217;.replace(/\(|\!|&amp;|\$|@|\^|\)|#/ig, &#8221;),rqeqG6Spq);</p></blockquote>
<p>Let&#8217;s take this code in detail:</p>
<table>
<tr>
<td><strong>rqeqG6Spq</strong></td>
<td>&#8211;&gt;</td>
<td>declared variable</td>
</tr>
<tr>
<td><strong>setAttribute</strong></td>
<td>&#8211;&gt;</td>
<td>the property of the variable rqeqG6Spq</td>
</tr>
<tr>
<td><strong>/\(|\!|&amp;|\$|@|\^|\)|#/ig</strong></td>
<td>&#8211;&gt;</td>
<td>Regular Expression</td>
<tr>
<td colspan="3">
(In JavaScript, to define a regex pattern, we define it between <strong>/&#8230;../</strong> .<br />
&#8216;<strong>g</strong>&#8216; indicates <em>Global Match</em> and &#8216;<strong>i</strong>&#8216; is for <em>Case-Insensitive</em> search)
</td>
<tr>
<td><strong>.replace()</strong></td>
<td>&#8211;&gt;</td>
<td>is a JavaScript string manipulation function, which runs the regex on the &#8216;object&#8217; <strong>i#)@d!</strong></td>
</tr>
</table>
<p>After executing the replace() function, the output would look like this </p>
<blockquote><p><em>rqeqG6Spq.setAttribute(&#8216;id&#8217;,rqeqG6Spq);</em></p></blockquote>
<p>Similar replace operations are performed at all other places, till we get the final output as shown <a href="http://docs.google.com/View?id=dctvmpj6_32fhwmwdfz">here</a></p>
<p><strong>NOTE: Your Anti-Malware may issue an alert when you try to visit the above link. I have modified the malicious URL a bit so the script won&#8217;t move ahead.</strong></p>
<p>We are now at a stage where we can make a few observations on what the JavaScript does and how it works.<br />
The original malicious domain is found to be <strong>http://3c8.ru:8080/welcome.php</strong> .This domain serves the malware payload.<br />
The script tries to exploit a vulnerability in ActiveX which allows it to download and execute a malicious binary.<br />
I haven&#8217;t had the chance to go deeper into the execution of the malware But once I get the time, I&#8217;ll look into analyzing the binary as well.</p>
<p>Before I end this long post, just a quick note that to automate this entire process, we can use an online tool called <strong><em><a href="http://wepawet.iseclab.org/index.php">wepawet</a></em></strong>, which is a service for detecting and analyzing web-based malware. It currently handles Flash and JavaScript files.<br />
You can find the result of the analysis of our malicious page at <a href="http://wepawet.iseclab.org/view.php?hash=07fc283602731721a97f196c3ab19092&amp;type=js">http://wepawet.iseclab.org/view.php?hash=07fc283602731721a97f196c3ab19092&amp;type=js</a><br />
It provides for a comprehensive analysis. </p>
<p>Also, do check out the VirusTotal scan results for the obfuscated and deobfuscated Javascript<br />
<a href="http://www.virustotal.com/analisis/2cd3069c412cac7b1159d20070503ee91238f1e4682a5b90b003b29a569c9291-1251527312">Obfuscated Detection rate is 2/41</a><br />
<a href="http://www.virustotal.com/analisis/218209456d7c0dc654596eab91b8cf0127dbbe1642eef9f56a3366021835d504-1251527404">De-obfuscated Detection rate is 14/41</a></p>
<p>I  guess that&#8217;s it. Hope you liked this basic tutorial. Do leave your feedback in the comments section below</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2009/10/01/deobfuscating-javascript-malware/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Injection in Stored Procedure &amp; Preventing from the same</title>
		<link>http://niiconsulting.com/checkmate/2009/09/30/sql-injection-stored-procedure-prevention/</link>
		<comments>http://niiconsulting.com/checkmate/2009/09/30/sql-injection-stored-procedure-prevention/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 10:03:51 +0000</pubDate>
		<dc:creator>Dhiraj Ranka</dc:creator>
				<category><![CDATA[Secure Coding]]></category>
		<category><![CDATA[Sql Injection]]></category>
		<category><![CDATA[stored procedures]]></category>

		<guid isPermaLink="false">http://niiconsulting.com/checkmate/?p=58</guid>
		<description><![CDATA[Following is the small example of creating a stored procedure.
====================================================================
CREATE PROC sp_login (@loginid nvarchar(25),@password nvarchar(25))
AS
DECLARE @SQLString VARCHAR(500)
DECLARE @loginid VARCHAR(64)
DECLARE @password VARCHAR(64)
/* Build the SQL string once.*/
SET @SQLString = ‘SELECT * from cust_users WHERE login_id = ‘+ ””+@loginid+”” + ‘AND password = ‘+ ””+@password+””
EXECUTE sp_executesql @SQLString

====================================================================
Your ASP.NET Code would look like this:
oCmd.CommandText = “sp_login”;
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.Parameters.Add( [...]]]></description>
			<content:encoded><![CDATA[<p>Following is the small example of creating a stored procedure.</p>
<p>====================================================================</p>
<p>CREATE PROC sp_login (@loginid nvarchar(25),@password nvarchar(25))<br />
AS<br />
DECLARE @SQLString VARCHAR(500)<br />
DECLARE @loginid VARCHAR(64)<br />
DECLARE @password VARCHAR(64)</p>
<p>/* Build the SQL string once.*/</p>
<p>SET @SQLString = ‘SELECT * from cust_users WHERE login_id = ‘+ ””+@loginid+”” + ‘AND password = ‘+ ””+@password+””</p>
<p>EXECUTE sp_executesql @SQLString<br />
<span id="more-58"></span><br />
====================================================================</p>
<p>Your ASP.NET Code would look like this:</p>
<p>oCmd.CommandText = “sp_login”;<br />
oCmd.CommandType = CommandType.StoredProcedure;<br />
oCmd.Parameters.Add( “@loginId”, strUserName);<br />
oCmd.Paramerters.Add( “@password”, strPassword);<br />
oCon.Open();<br />
string result = (string)oCmd.ExecuteScalar();<br />
oCon.Close();</p>
<p>====================================================================</p>
<p>If the user input is as follows:<br />
loginId = ‘ OR 1=1 –<br />
password = junk</p>
<p>SQL injection will not work and ASP.NET will throw an exception</p>
<p>“Unclosed quotation mark after the character string ‘ OR 1=1 — and password=junk’.<br />
Incorrect syntax near ‘ OR 1=1 — and password=junk’.”</p>
<p>In this case you can use</p>
<p><strong>loginID = ” OR 1=1–</strong></p>
<p>password = junk</p>
<p>Two single quotations are used to complete where clause with null condition and OR is used to make the condition true always.</p>
<p>If you use <strong><em>sp_executesql</em></strong> this will definitely leads to the SQL Injection.</p>
<p>See more on this <a href="http://msdn.microsoft.com/en-us/library/ms188001.aspx">http://msdn.microsoft.com/en-us/library/ms188001.aspx</a></p>
<p><strong>Solution :</strong></p>
<p>Instead one should use the same stored procedure which he has created, for passing parameters.</p>
<p><strong>exec sp_login ‘param1′, ‘param2′</strong></p>
<p>param1 – would be loginID</p>
<p>param2 – would be password</p>
<p>And you are stored procedure would look like this i.e. with out <strong><em>sp_executesql</em></strong></p>
<p>====================================================================</p>
<p>CREATE PROC sp_login</p>
<p>@loginid VARCHAR(64)<br />
@password VARCHAR(64)</p>
<p>AS</p>
<p>BEGIN<br />
SELECT * FROM cust_users WHERE loginid=@loginid AND password=@password<br />
END</p>
<p>====================================================================</p>
<p><strong>This will avoid the possible SQL Injection</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2009/09/30/sql-injection-stored-procedure-prevention/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concurrent RDP connections hack &#8211; XP</title>
		<link>http://niiconsulting.com/checkmate/2009/03/26/concurrent-rdp-connections-hack-xp/</link>
		<comments>http://niiconsulting.com/checkmate/2009/03/26/concurrent-rdp-connections-hack-xp/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 16:56:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fundamentals]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Network Forensics]]></category>

		<guid isPermaLink="false">http://www.niiconsulting.com/checkmate/2009/03/concurrent-rdp-connections-hack-xp/</guid>
		<description><![CDATA[by Toufiq Ali, NII Consulting
Before you read further make sure you back up all the original settings of the registry or set create a restore point of your system. I assume reader know what a windows remote terminal service is. If not please refer to http://en.wikipedia.org/wiki/Terminal_Services
In Windows XP when a remote user tries to connect [...]]]></description>
			<content:encoded><![CDATA[<p><strong>by Toufiq Ali, <a href="http://www.niiconsulting.com//">NII Consulting</a></strong><br />
Before you read further make sure you back up all the original settings of the registry or set create a restore point of your system. I assume reader know what a windows remote terminal service is. If not please refer to http://en.wikipedia.org/wiki/Terminal_Services</p>
<p>In Windows XP when a remote user tries to connect using the Remote Desktop Connection (RDC) client in Windows XP, the local user is disconnected from his current session forcefully. RDC, unlike Terminal Server Services in Windows 2000, Server 2003 and Server 2008, is designed for only one session at a time.. This excerpt aims at making terminal services functionality of multiple user login from Windows server 2000, windows server 2003 etc in Windows XP. This would be very useful in environment where the network admin often troubleshoots problem on the network using RDC.</p>
<p>Keep reading as the hack unfolds to enable concurrent remote desktop connection sessions support in Windows XP using the following patched files.<span id="more-52"></span></p>
<ol>
<li>Download files.zip from the link given below on the system where you want to enable concurrent RDC connections.</li>
</ol>
<p><a target="_blank" title="Clikc here to download" href="http://www.niiconsulting.com/checkmate/wp-content/uploads/2009/03/files.zip">Download files.zip</a><br />
Windows XP SP1 and SP2: Windows XP RTM, SP1 and SP2.zip</p>
<p>Windows XP SP2: Windows XP SP2.zip</p>
<p>Windows XP SP3: Windows XP SP3.zip</p>
<p>Before you go ahead further, you should be in the safe mode (Press F8 during boot up). If you don’t want to prolong your wait to see this work,</p>
<p>1. goto &#8216;Start&#8217; > &#8216;Run&#8217; services.msc<br />
2. Right click on Terminal services &#038; goto Properties.<br />
3. From the startup type drop down choose disable or simply stop the services.<br />
4. Click on apply or Ok &#038; exit the services.msc file.</p>
<p>2. Go to %windir%\System32 and &#038; rename the termsrv.dll to anything that you can remember.<br />
3. Go to %windir%\System32\dllcache &#038; rename the termserv.dll.</p>
<p>4. Copy the downloaded termsrv.dll in the following two locations<br />
1. to %windir%\System32<br />
2. %windir%\System32\dllcache.</p>
<p>Note: when you copy the files Windows will pop up the Windows File Protection dialog box. Click the cancel button &#038; then Yes to keep this copy of the patched file.</p>
<p>5. Now, download and run the concurrent_sessions.bat file. Click yes to add these values to the registry or you can run Registry Editor to manually add the following registry value:</p>
<p>[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\Licensing Core]<br />
“EnableConcurrentSessions”=dword:00000001</p>
<p>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]<br />
“EnableConcurrentSessions”=dword:00000001</p>
<p>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]<br />
“AllowMultipleTSSessions”=dword:00000001</p>
<p>6. Click on Start Menu -> Run command and type gpedit.msc,</p>
<p>7. Navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Terminal Services.</p>
<p>8. Enable Limit Number of Connections and set the number of connections to number of concurrent sessions you want to allow</p>
<p>9. Restart the terminal services on that system again. Also enable Remote Desktop from the System Properties’ Remote tab &#038; check for Allow users to connect remotely to this computer.</p>
<p>10. Turn on Fast User Switching in Control Panel -> User Accounts -> Change the way users log on or off.</p>
<p>11. Restart the computer normally.</p>
<p>If the Windows XP computer is connected to a domain, every time you restart your computer Windows will set the value of the regkey “AllowMultipleTSSessions” to “0″. To ensure that multiple or unlimited Remote Desktop connection sessions is allowed in AD domain environment, the value data for “AllowMultipleTSSessions” has to be set to “1″ on system startup. To change the value, run the concurrent_sessions.bat every time the computer is started. Instead, put the concurrent_sessions.bat at C:\Documents and Settings\All Users\Start Menu\Programs\Startup folder.</p>
<p>With the release of Service Pack 2 (SP2) for Microsoft Windows XP, SP2 has introduced a feature that limits concurrent TCP connection attempts that are possible to 10 per seconds. In Service Pack 1 or without Service Pack, there is no limit on concurrent TCP connection attempts. So if you have set the value of “Limit Number of Connections” in step 8 greater than 10 and you happen to run a SP2, you need to apply the patch to override the max limit. You can download the file from the following link.</p>
<p>Just for your information on disassembling the original &#038; patched file following HEX code bits have being changed:</p>
<p>00022A17: 74 75<br />
00022A69: 7F 90<br />
00022A6A: 16 90</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2009/03/26/concurrent-rdp-connections-hack-xp/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Infosec Scenario in 2009</title>
		<link>http://niiconsulting.com/checkmate/2009/01/01/infosec-scenario-in-2009/</link>
		<comments>http://niiconsulting.com/checkmate/2009/01/01/infosec-scenario-in-2009/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 09:58:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Network Forensics]]></category>

		<guid isPermaLink="false">http://www.niiconsulting.com/checkmate/2009/01/infosec-scenario-in-2009/</guid>
		<description><![CDATA[1. Business continuity to get focus over disaster recovery
BCM is a process issue related to building the framework to increase business resiliency and restoration capability, while DR is about building redundancy through infrastructure investments. It is quite likely that new DR site investments might happen fewer than they did in 2008. But I would not [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1. Business continuity to get focus over disaster recovery</strong><br />
BCM is a process issue related to building the framework to increase business resiliency and restoration capability, while DR is about building redundancy through infrastructure investments. It is quite likely that new DR site investments might happen fewer than they did in 2008. But I would not advise cutting down on building your BCM capability &#8211; even if you are an SME. Each one of your people does need to know what needs to be done when things begin to fail. This does not require huge amounts of investment, but does require common sense, risk assessment, and regular training and awareness.<br />
<u>Counter:</u> Focus on an effective Business Continuity Plan that takes into account at least the following &#8211; fire, ISP failure, transportation link failure, and yes a terrorist attack as well.<br />
<strong>2. Capital expenditure on security technologies likely to be hit</strong><br />
This is one area that has seen the biggest hit and is likely to continue feeling the impact with new investments simply not happening. So fewer firewall upgrades, fewer adoptions of recently introduced solutions such as Data Leakage Prevention (DLP), Network Access Control (NAC), and others.<br />
<u>Counter:</u> Really look for ROI on your capital expenditure on security technologies.<span id="more-51"></span><br />
<strong>3. Focus on regulatory compliance to increase</strong><br />
Make sure you know very clearly what your responsibilities are towards data protection &#8211; not only for the specific industry you are in &#8211; but also for the countries that you do business in. I&#8217;ll soon be releasing a write-up on the Indian IT Act, and the new amendments recently pushed through in the Parliament, and what these mean for every individual and every business. Essentially, even if you are not ISO 27001 compliant or PCI DSS regulated, you are still very much legally liable to ensure due diligence to protect your customer&#8217;s data.<br />
<u>Counter:</u> While cutting budgets on infosec is fine, don&#8217;t end up putting the existence of your business at risk due to negligence towards data protection.<br />
<strong>4. Scareware, Social Networking Attacks, Phishing, and others</strong><br />
While Phishing attacks rose quite a bit in 2008, it is quite likely they will become more prevalent, more insidious and a huge pain in the wrong places in 2009. Combined with Scareware tactics (<a href="http://www.theregister.co.uk/2008/08/22/anatomy_of_a_hack/">http://www.theregister.co.uk/2008/08/22/anatomy_of_a_hack/</a>), exploitation of social networking sites (<a href="http://www.internetnews.com/security/article.php/3789496">http://www.internetnews.com/security/article.php/3789496</a> and <a href="http://news.cnet.com/8301-1009_3-10078353-83.html">http://news.cnet.com/8301-1009_3-10078353-83.html</a>), and even Google (<a href="http://go.theregister.com/feed/www.theregister.co.uk/2008/12/30/google_calendar_phish/">http://go.theregister.com/feed/www.theregister.co.uk/2008/12/30/google_calendar_phish/</a> and <a href="http://blogs.zdnet.com/Google/?p=1053">http://blogs.zdnet.com/Google/?p=1053</a>) is going to ensure attacks are highly smart, effective, and definitely lucrative for the attackers.<br />
<u>Counter:</u> Focus on awareness, not just within your organizations but also within your families and communities.<br />
<strong>5. Computer fraud may rise &#8211; a lot</strong><br />
Today attackers are not concerned with releasing the latest virus onto unsuspecting Internet users. Do we even remember how long ago it was when CodeRed or Slammer hit us bad? Attackers today &#8211; both external and internal &#8211; have one simple agenda &#8211; making as much money as they can within as short a time as possible. We&#8217;re already seeing SAP, Oracle Apps, and business applications becoming the most lucrative target of fraudsters. All they need is the knowledge (if you&#8217;re working with 2-3 years on the same system you know its flaws well enough), motive (layoffs, salary cuts, no bonuses), and opportunity.<br />
<u>Counter:</u> Invest in forensic accounting, and keep a panel of experts on standby to be called in when fraud happens. Get advice on a list of red flags to watch out for.<br />
<strong>6. Cyberwarfare could become a reality</strong><br />
At least as far as the South East Asian region is concerned, we&#8217;ve already seen an increase in the number of cyber attacks on Indian banks and government websites. This trend will get more serious and more malicious with some really sensitive data being targetted in the months to come. The next frontier for terrorism will be digital, and we&#8217;re all going to be facing the brunt of professional hacking, espionage, and digital sabotage.  We&#8217;re already seeing this with the current Israeli war on Gaza (<a href="http://blog.wired.com/defense/2008/12/israels-info-wa.html">http://blog.wired.com/defense/2008/12/israels-info-wa.html</a>), and the recent attacks by Pakistani hackers on the Eastern Railways site (<a href="http://in.news.yahoo.com/241/20081225/1262/twl-pak-hacker-attacks-e-rlys-site-threa.html">http://in.news.yahoo.com/241/20081225/1262/twl-pak-hacker-attacks-e-rlys-site-threa.html</a>), and a couple of PSU banks. See this link for in-depth Indo-Pak cyberwar coverage <a href="http://intelfusion.net/wordpress/?p=468">http://intelfusion.net/wordpress/?p=468</a><br />
<u>Counter:</u> If your organization is governmental, semi-governmental, public sector, or provides a service or utility of national importance, you are pretty much going to be targeted. Focus on securing your external perimeter and get it tested.</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2009/01/01/infosec-scenario-in-2009/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reasons for Failure of Business Continuity Plans</title>
		<link>http://niiconsulting.com/checkmate/2008/12/31/reasons-for-failure-of-business-continuity-plans/</link>
		<comments>http://niiconsulting.com/checkmate/2008/12/31/reasons-for-failure-of-business-continuity-plans/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 11:41:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Network Forensics]]></category>

		<guid isPermaLink="false">http://www.niiconsulting.com/checkmate/2008/12/reasons-for-failure-of-business-continuity-plans/</guid>
		<description><![CDATA[I was recently attending a conference on Business Continuity Management, and happened to attend an enlightening talk given by Mr. Vijay Sethi, CIO of Hero Honda &#8211; the world&#8217;s single-largest two wheeler company. The focus of the talk was on &#8220;Reasons for BCP Failure&#8221;, and I believe the points given below are highly applicable to [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently attending a conference on Business Continuity Management, and happened to attend an enlightening talk given by <strong>Mr. Vijay Sethi, CIO of Hero Honda</strong> &#8211; the world&#8217;s single-largest two wheeler company. The focus of the talk was on <strong>&#8220;Reasons for BCP Failure&#8221;</strong>, and I believe the points given below are highly applicable to a lot of organizations. With his permission, I am presenting the key ideas presented:</p>
<p><strong>1. Faulty drivers for implementing BCP</strong><br />
A lot of organizations implement BCP because customers demand it, or they need it for ISO 27001 certification, or because their auditors have repeatedly stated so.</p>
<p><strong>2. Not business-centric</strong><br />
A lot of BCPs end up becoming focused purely on IT infrastructure, and are more like Disaster Recovery Plans, rather than comprehensive Business Continuity Plans.</p>
<p><strong>3. No clear owner of the BCM process</strong><br />
The success or failure of the BCM depends on who is the internal driver or champion of the process. Thus the owner of the BCM should be clearly defined. While, the CIO or CTO could be the owner, he must ensure he has a larger business perspective, and more importantly the rest of the organization should not see it as an technology-focused initiative, rather as something that affects all of them.<span id="more-50"></span></p>
<p><strong>4. No regular BCP tests</strong><br />
The efficacy and strength of the BCP depends on the frequency and quality of tests carried out. More often than not, testing is done just before an audit. The lessons from a BCP test are also not incorporated into improving the BCP. The practical reason for this is that testing is not an easy process &#8211; it requires a lot of thought, effort, and resources to execute properly and efficiently.</p>
<p><strong>5. No regular updating of the BCP documents</strong><br />
Often the numbers given in a call-tree turn out to be not reachable or worse still the person no longer works for the organization. In today&#8217;s business environment, organizations are changing rapidly in terms of  processes, new technology, new lines of business, as well as people turnover. The BCP document can very quickly become obsolete and useless if it is not updated regularly.</p>
<p><strong>6. No regular training</strong><br />
The truth is that no one will have the time or occasion to read the BCP document when an emergency strikes. Therefore, the successful execution of the steps in the BCP is dependent on the level of training and awareness regarding the BCP. Again, people turnover results in training not being given to the people who have replaced earlier BCP team members.</p>
<p><strong>7. BCP is too rigid or too complex</strong><br />
No crisis will turn out exactly as envisioned in the BCP. Therefore, the BCP must allow for enough flexibility, fallback options, and enough authorization to the crisis management team to take decisions that they feel to be in the best interests of the organization. Teams should be trained to think outside-the-box. Primary focus should be on enabling and empowering the team, rather than the BCP document.</p>
<p><strong>8. No clear management involvemen</strong>t<br />
I would put this as the #1 reason. Management is often not truly interested in the development and maintenance of the BCM, and usually plays a peripheral role in developing and driving it within the organization.</p>
<p><strong>9. Cost cutting</strong><br />
In the current economic scenario, it is likely the first budget cuts might be to resources allocated to the BCM. Check whether within your organization, during budgetary discussions, it is the BCM that is losing out on getting priority.</p>
<p>To round out the number to 10, and to also add some post-script after the 26/11 attacks, I&#8217;d also like to add my 2-cents to the list above:<br />
<strong>10. Post 26/11 knee-jerk reactions</strong><br />
From what we are observing around the country, organizations are rushing in to implement security measures, which are not really based on a risk assessment or business impact analysis. Especially in hotels, malls, corporates and governmental organizations the measures are being implemented without taking into account realistic threat probabilities and actual business dependencies.</p>
<p>The talk was filled with very interesting quotes, and I&#8217;ll end this article by reproducing a very appropriate one here:</p>
<p><em>&#8220;The time to repair the roof is when the sun is shining&#8221;, John F. Kennedy.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2008/12/31/reasons-for-failure-of-business-continuity-plans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First conviction under IT Act</title>
		<link>http://niiconsulting.com/checkmate/2008/02/07/first-conviction-under-it-act/</link>
		<comments>http://niiconsulting.com/checkmate/2008/02/07/first-conviction-under-it-act/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 17:52:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Case Studies]]></category>

		<guid isPermaLink="false">http://www.niiconsulting.com/checkmate/2008/02/first-conviction-under-it-act/</guid>
		<description><![CDATA[Finally, we have our first conviction under the IT Act 2000 in India. After more than a 100 cases being lodged, and about half of them actually reaching the courts, we have our first conviction of an orthopaedic surgeon in Chennai being convicted of recording and uploading pornographic images. He and his brother in the [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, we have our first conviction under the IT Act 2000 in India. After more than a 100 cases being lodged, and about half of them actually reaching the courts, we have our first <a target="_blank" href="http://www.ibnlive.com/news/sex-doctor-gets-life-in-cyberporn-case/58375-3.html?xml">conviction of an orthopaedic surgeon</a> in Chennai being convicted of recording and uploading pornographic images. He and his brother in the US were found running a profitable pornographic website selling the videos and images.<br />
Other notable cases nowhere near conviction include the hacking of the Mumbai cybercrime cell, the financial defrauding of Citibank customers by its BPO Mphasis, the creation of an Orkut group criticising Shivaji which got an IT engineer in Bangalore wrongly incarcerated due to a serious goof-up by Bharti (the ISP), and others.<br />
Coming back to the original case, though, I wonder why the actions of the doc, warranted a life sentence? What is intriguing is the presence of machine gun bullets at his farmhouse &#8211; wonder where the machine gun correlating to the bullets might be? Maybe the doc was also a gun-runner in addition to being a pervert.</p>
]]></content:encoded>
			<wfw:commentRss>http://niiconsulting.com/checkmate/2008/02/07/first-conviction-under-it-act/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
