<?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>Soroush Dalili - Computer Security Is My Interest! &#187; Security Articles</title>
	<atom:link href="http://soroush.secproject.com/blog/category/securityarticles/feed/" rel="self" type="application/rss+xml" />
	<link>http://soroush.secproject.com/blog</link>
	<description>Soroush Dalili&#039;s blog - بلاگ سروش دلیلی</description>
	<lastBuildDate>Tue, 10 Jan 2012 22:54:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Drag and Drop XSS in Firefox by HTML5 (Cross Domain in frames)</title>
		<link>http://soroush.secproject.com/blog/2011/12/drag-and-drop-xss-in-firefox-by-html5-cross-domain-in-frames/</link>
		<comments>http://soroush.secproject.com/blog/2011/12/drag-and-drop-xss-in-firefox-by-html5-cross-domain-in-frames/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 03:23:24 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[My Advisories]]></category>
		<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[drag and drop XSS]]></category>
		<category><![CDATA[Drag Drop HTML5 XSS]]></category>
		<category><![CDATA[Firefox Javascript Protocol Bypass]]></category>
		<category><![CDATA[XSS by Feed Protocol]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=446</guid>
		<description><![CDATA[Bug has been reported/NoScript users are safe First of all, this vulnerability and the related techniques have already been reported to Mozilla on 21st Nov 2011, without having any specific result till the date of this report (issue ID 704354 – works on all the latest versions which support HTML5). I had raised this bug [...]]]></description>
			<content:encoded><![CDATA[<h4 style="text-align: justify;">Bug has been reported/NoScript users are safe</h4>
<p style="text-align: justify;">First of all, this vulnerability and the related techniques have already been reported to Mozilla on 21st Nov 2011, without having any specific result till the date of this report (issue ID 704354 – works on all the latest versions which support HTML5). I had raised this bug as a major issue, but it seems it was not important from Mozilla Firefox point of view and its risk is not high at all.</p>
<p style="text-align: justify;">However, <strong>NoScript can protect the users against it from version 2.2.3</strong> [released about three weeks ago] (<a href="http://noscript.net/changelog">http://noscript.net/changelog</a>) &#8211; thanks to Giorgio Maone for the fast response and quick fix.</p>
<p style="text-align: justify;">As there is already a solution for this issue and its impact is not high, I am going to publish my research results as they belong to 2011!</p>
<h4 style="text-align: justify;">Introduction</h4>
<p style="text-align: justify;">As you may have noticed, most of the modern browsers are recently protecting their users from running unwanted JavaScript by copying and pasting it in the address bar or even by dragging and dropping it into a web page. In this research, I have found a technique to bypass Drag/Drop protection in Mozilla Firefox to run a JavaScript. As a final result, it is possible to drag and drop a hidden JavaScript into a predefined HTML5 box and run the Javascript code. Unfortunately, if you put this page in an IFrame, the Javascript code can be run on the context of the main site that includes the IFrame. For instance, When Facebook opens any URL in a frame, it is possible to run a JavaScript code on Facebook website by drag and drop jacking.</p>
<h4 style="text-align: justify;">The current protection</h4>
<p style="text-align: justify;">In order to understand the Mozilla Firefox protection against JavaScript Drag and Drop, follow these steps:</p>
<p style="text-align: justify;">1- Go to Mozilla Firefox address bar and type &#8220;javascript:alert(1)&#8221; without pressing Enter.</p>
<p style="text-align: justify;">2- Select all the string that you have just typed (&#8220;javascript:alert(1)&#8221; without quote signs).</p>
<p style="text-align: justify;">3- Drag and drop it on a new tab or on the context of the same tab that you currently have. You will not receive any alert message.</p>
<h4 style="text-align: justify;">First bypass method- Letter Capitalization</h4>
<p style="text-align: justify;">Now, in previous steps, capitalize one or more letters in the &#8220;javascript:&#8221; string (for instance &#8220;jAvAscript:&#8221;) and drag/drop it into the page. You should be able to see an alert message as you have bypassed the Mozilla Firefox protection!</p>
<h4 style="text-align: justify;">Second bypass method- XSS by Feed Protocol</h4>
<p style="text-align: justify;">I have also found another interesting protocol in Mozilla Firefox that can lead to running a JavaScript. This protocol can be used as follows to bypass the Mozilla Firefox prevention method:</p>
<p style="text-align: justify;">&#8220;feed:javascript:alert(1)&#8221;</p>
<p style="text-align: justify;">&#8220;feed:feed:feed:javascript:alert(1)&#8221;</p>
<p style="text-align: justify;">&#8220;feed:javascript:javascript:feed:alert(1)&#8221;</p>
<p style="text-align: justify;">&#8220;feed:feed:javascript:javascript:feed:alert(1)&#8221;</p>
<p style="text-align: justify;">&#8221; feed:feed:feed:javascript:alert(1)&#8221;</p>
<h4 style="text-align: justify;">A possible exploitation method – HTML5 drag/drop functionality</h4>
<p style="text-align: justify;">In this step, I had to find a way to use the issue and exploit the system to prove that it can be an important security risk; however, there are two facts that made it a bit difficult:</p>
<p style="text-align: justify;">1- There is no point if we cannot run the JS code on the context of another site.</p>
<p style="text-align: justify;">2- We need the user interaction to d/d a JS code. And it is not easy to deceive the users to d/d a JavaScript code when it is visible.</p>
<p style="text-align: justify;">The first problem has been solved by using HTML5 D/D functionality that I have found from the following URL: &#8220;<a href="http://html5demos.com/drag">http://html5demos.com/drag</a>&#8220;; I found out, if I drag and drop the &#8220;feed:javascript:alert(1)&#8221; to the drop location, the JavaScript will run due to the redirection. And interestingly, if this drop location is inside an IFrame, the main page will be redirected and therefore we can conduct an XSS attack on the context of the main website.</p>
<p style="text-align: justify;">The second problem was also solved by using a hidden &#8220;textarea&#8221; tag that I found during my tests! In Mozilla Firefox, if you select a text with a hidden textarea, all the texts in that hidden textarea will be selected as well.</p>
<p style="text-align: justify;">I have created a proof of concept which can be found in the following link:</p>
<p style="text-align: justify;"><strong>PoC:</strong> <a href="http://soroush.secproject.com/downloadable/demo/FF_DragDrop_XSSHost_simp.html">http://soroush.secproject.com/downloadable/demo/FF_DragDrop_XSSHost_simp.html</a></p>
<h4 style="text-align: justify;">Conclusion</h4>
<p style="text-align: justify;">In this research, I was able to bypass Mozilla Firefox &#8211; Javascript Drag and Drop by using capitalization and Feed protocol. Then I was able to exploit this issue to run a JavaScript code in the context of another website which can accept an external frame by using the HTML5 drag and drop functionality.</p>
<h4 style="text-align: justify;">Future Works</h4>
<p style="text-align: justify;">It is still possible to bypass Mozilla Firefox prevention method by finding another protocol or maybe by using the encoding techniques.</p>
<p style="text-align: justify;">If someone drags and drops a JavaScript into a page with &#8220;chrome://&#8221; protocol, it can lead to a local code execution; however, this protocol is highly protected by Mozilla Firefox and I was not able to find a way to make it possible. As a PoC, drag and drop the following Javascript code into the &#8220;chrome://global/content/config.js&#8221; page to run the local Windows Calculator:</p>
<p style="text-align: justify;"><em>&#8220;feed:jAvAscript:file=Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);file.initWithPath(&#8216;c:\\windows\\system32\\calc.exe&#8217;);process=Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess);process.init(file);process.run(true,[],0);void(0);&#8221;</em></p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2011/12/drag-and-drop-xss-in-firefox-by-html5-cross-domain-in-frames/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Unrestricted File Download V1.0 – Windows Server</title>
		<link>http://soroush.secproject.com/blog/2011/01/unrestricted_file_download_v1_0/</link>
		<comments>http://soroush.secproject.com/blog/2011/01/unrestricted_file_download_v1_0/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 16:42:48 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Unrestricted File Download]]></category>
		<category><![CDATA[Unrestricted File Upload]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=421</guid>
		<description><![CDATA[Downlaod the PDF file: http://soroush.secproject.com/downloadable/Unrestricted_File_Download_V1.0.pdf Unrestricted File Download V1.0 – Windows Server I do not want to talk about Insecure Direct Object References without any protection as they are obviously exploitable; Instead, I want to talk about bypassing the protected ones! The problem that I want to explain here is how hard it is to [...]]]></description>
			<content:encoded><![CDATA[<p>Downlaod the PDF file: <a href="http://soroush.secproject.com/downloadable/Unrestricted_File_Download_V1.0.pdf">http://soroush.secproject.com/downloadable/Unrestricted_File_Download_V1.0.pdf</a></p>
<h2>Unrestricted File Download V1.0 – Windows Server</h2>
<p>I do not want to talk about Insecure Direct Object References without any protection as they are obviously exploitable; Instead, I want to talk about bypassing the protected ones! The problem that I want to explain here is how hard it is to protect a system that uses Insecure Direct Object References by using black-list technique.</p>
<p>Whenever penetration testers see a website which accepts a path as an input, they think about these questions:</p>
<p>1- Can I have access to the secret files?</p>
<p>2- Can I do directory traversal?</p>
<p>3- Can I modify another file?</p>
<p>4- Can I do race condition?</p>
<p>And so on.</p>
<p>The answer from programming point of view is: “it depends!”:</p>
<p>1- If they have no protection in-place: “Yes. Yay!”</p>
<p>2- If they are using black-list method: “Think about a bypass now! There should be a way and I just need to find it! Think about encodings, decoding, effective characters, behaviour of the system against special characters, and so on.”</p>
<p>3- If they are using white-list method: “Is there anything on the list that can be misused? Can I stick some of them together to make another character or change the behaviour of the system?”</p>
<p>My point is that there is often a way to bypass a black-list. However, it is not the same for white-list if you do it correctly.</p>
<h2>Let’s Bypass a Blacklist Method</h2>
<p>Now, I want to use a case to show an example of using black-list, and methods of bypass.</p>
<p>Assume we have “www.vulnerable.com/download.aspx” which accepts a file path as an input and reads it and loads it into the output. (To make it easier, “/upload” folder is on the root of the website)</p>
<p>For example: “/download.aspx?file=/upload/document.doc”</p>
<p>Now, if you try the following inputs, you will receive an “access denied” error from the page:</p>
<p>“/download.aspx?file=web.config”</p>
<p>“/download.aspx?file=download.aspx”</p>
<p>“/download.aspx?file=/download.aspx”</p>
<p>But, if you try the following inputs, you will receive a “file not found” error or a blank-page from the page:</p>
<p>“/download.aspx?file=test.doc”</p>
<p>“/download.aspx?file=/upload/../test.txt”</p>
<p>“/download.aspx?file=/test.f0ob4r”</p>
<p>According to the response of the page, obviously, it is using a black-list method.</p>
<p>These are the first things that I can think about (my pre-test-cases):</p>
<p>0- Use uppercase, lowercase, and Unicode in the extension. For ex: “/download.aspx?file=/wEB.CoNfiG” and so on.</p>
<p>1- As you might know, there are some characters after the filename that will be ignored by Windows.  So, I should try something like “/download.aspx?file=/web.config.” or “/download.aspx?file=/web.config&#8230; ..”</p>
<p>2- Using short filename format of the file: “/download.aspx?file=/web~1.con”</p>
<p>3- Using null character: “/download.aspx?file=/web.config%00.txt”</p>
<p>4- Using another extension in the path: “/download.aspx?file=/test.txt/../web.config”</p>
<p>5- Using different space characters in the path: “/download.aspx?file=/web.config%09”, “/download.aspx?file=/web.config%0a”, “/download.aspx?file=/web.config%0b”, “/download.aspx?file=/web.config%0c”, “/download.aspx?file=/web.config%0d”, “/download.aspx?file=/web.config%20”, and so on (similar to 1).</p>
<p>6- Finding a character that is removed by the web application automatically before loading a file to put it in the extension and bypass the black-list protection.</p>
<p> 7- Try alternate data stream to read the files: “/download.aspx?file=/web.config::$Data”</p>
<p>8- Try to use direct path and share path. Ex: “/download.aspx?file=c:\\windows\\win.ini”, “/download.aspx?file=\\?\c:\\windows\\win.ini”, or “/download.aspx?file=\\127.0.0.1\c$\WINDOWS\\win.ini”</p>
<p>9- Try to do directory traversal. Ex: “/download.aspx?file=../../../../../../../../../../../boot.ini”</p>
<p>10- Try other file-system understandable vectors. Ex: “/download.aspx?file=web.config/.”, “/download.aspx?file=web.config\.”, and so on (similar to 1).</p>
<p>And combination of the above solutions to create more complicated test cases!</p>
<p>What do you think? Please let me know if you know any other interesting test case. This is the result:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="60" valign="top">0</td>
<td width="543" valign="top">Successful: Web.config was downloaded</td>
</tr>
<tr>
<td width="60" valign="top">1,2</td>
<td width="543" valign="top">Failed: Show the source code in error message. Error: “Failed to map the path”</td>
</tr>
<tr>
<td width="60" valign="top">3,7,8</td>
<td width="543" valign="top">Failed: Show the source code in error message. Error: “is not a valid virtual path”</td>
</tr>
<tr>
<td width="60" valign="top">4</td>
<td width="543" valign="top">Failed: Access Denied</td>
</tr>
<tr>
<td width="60" valign="top">5</td>
<td width="543" valign="top">Successful: Web.config was downloaded</td>
</tr>
<tr>
<td width="60" valign="top">6</td>
<td width="543" valign="top">Failed: No character was found</td>
</tr>
<tr>
<td width="60" valign="top">9</td>
<td width="543" valign="top">Failed: Show the source code in error message. Error: “Cannot use a leading .. to exit above the top directory”</td>
</tr>
<tr>
<td width="60" valign="top">10</td>
<td width="543" valign="top">Successful: Web.config was downloaded. Some new vectors were found: “?file=\.”, “?file=/.”, “?file=/\./\.”</td>
</tr>
</tbody>
</table>
<p>Each of the above vectors could lead to bypassing the protection. Now, I can tell you that the actual vulnerable source code of the page was:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="603" valign="top">10    string fileName = Request.Params["File"];20    if (ForbidenExtentions.Contains(fileName.Substring(fileName.LastIndexOf(&#8220;.&#8221;))))</p>
<p>30    {</p>
<p>40        HttpContext.Current.Response.Redirect(&#8220;~/CustomError.aspx?msg=ForbidenFileDownload&#8221;);</p>
<p>50    }</p>
<p>60    if((fileName != null) &amp;&amp; (fileName != &#8220;&#8221;))</p>
<p>70    {</p>
<p>80        string strPath = Server.MapPath(&#8220;/&#8221; + fileName);</p>
<p>90        if(System.IO.File.Exists(strPath))</p>
<p>100     { …</td>
</tr>
</tbody>
</table>
<p>And, we can download the confidential files with different vectors (see number 0, 5, and 10 on the table above). Now, an attacker can download the entire website and look for the credentials, hidden files and folders, and find any other vulnerability such as SQL Injection by having the source code.</p>
<h2>Secure and Effective Solution</h2>
<p>Now, what can we do to stop this attack? These are the general solutions:</p>
<p>1- Do not use direct object references when it is possible:</p>
<p>For indirect references, use something random, hard to guess, and meaningless such as GUIDs. You need to implement more functions and invest more time on programming and debugging. However, your achievements are:</p>
<p>1.1- Increasing the Security by using strong random pointers such as GUIDs</p>
<p>1.2- Easier asset managing and have different access controls</p>
<p>2- Force yourself to always use white-lists:</p>
<p>It is very rare that you have to only use a black-list for an input! If an input is random and unpredictable, you may need to redesign that input. Write down the input purpose(s) and do whatever you can to restrict it to a range of characters. Now, think about this range and review the characters one by one. Is there anything in the list which can cause an issue? Do you need to allow any other characters besides [a-zA-Z0-9]? Why? Think about it and follow the best security practices.</p>
<p>Sometimes you need to use blacklist after passing the input from a white-list to have more security. For example: an input can contain a file path. Therefore, we should allow dot “.” character. However, we should not allow any double dot “..” as it can cause directory traversal.</p>
<p>If you are designing a system, look for the vulnerabilities which have been reported on the similar systems in Internet. You may find something that you had not had any knowledge about it before! Do not think that you know everything! Even a semi-colon or colon can compromise your system sometimes.</p>
<p>Talk about your system with the security people; with experts (not script kiddies). You can ask your questions in different security forums to find a clue. Ask them to break your protection to improve the security.</p>
<p><strong>Note 1</strong>: a bad implementation is worse than not having any implementation! When you don’t have any protection, at least you know you do not have anything to protect yourself and the system is unsafe!!! However, when you have an insecure/bad implementation, you think the system is safe enough but it is not, and attackers will find this out – trust me!</p>
<p><strong>Note 2</strong>: If you are putting different inputs next to each other, it is better to pass them at least through a black-list protection after concatenation.</p>
<p>Now, without using an indirect reference, two solutions for our vulnerable example (“www.vulnerable.com/download.aspx”) can be:</p>
<h2>Solution 1 (More White-list – more restricted):</h2>
<p>1- Replace all the “/” with “\” character in order to make the validation easier (for Windows OS).  (Black-List)</p>
<p>2- Replace all the dot characters before the backslash character (“.\”) with a single “\” character in order to make the validation easier. (Black-List)</p>
<p>3- Only accept limited characters as an input: RegEx: (([a-zA-Z0-9][\.]{1})|[a-zA-Z0-9\\])*</p>
<p>4- File name should start with: RegEx: ^[a-zA-Z0-9\\] (White-list)</p>
<p>5- File name should end with: RegEx: [a-zA-Z0-9]$ (White-list)</p>
<p>Then a general ReGex will be (include 3, 4, and 5):  ^([a-zA-Z0-9\\]{1})(([a-zA-Z0-9][\.]{1})|[a-zA-Z0-9\\])*([a-zA-Z0-9])$ (White-list)</p>
<p>6- Find the file extension by using the last dot “.” character of the file. This extension should be in the list of allowed extensions such as “gif”, “jpg”, “doc”, “docx”, “pdf”, “rtf”, and so on. (White-List)</p>
<p><strong>Limitation:</strong> It is not possible to use Unicode or special characters in the file or the directory name.</p>
<h2>Solution 2 (More Black-List – less restricted):</h2>
<p>1- Trim the input to remove unnecessary spaces (Black-List)</p>
<p>2- Replace all the “/” with “\” character in order to make the validation easier (for Windows OS).  (Black-List)</p>
<p>3- Replace all the “..” with “.” character in a loop till you cannot find any “..” anymore. (Black-List)</p>
<p>4- Replace all the space and dot characters before and after the “\” character with a single “\” character in order to make the validation easier. (Black-List)</p>
<p>5- Replace all the “\\” with “\” character in order to make the validation easier. (Black-List)</p>
<p>6- Path should not contain these characters:  RegEx: [^:*?"&lt;&gt;|;~]  &#8211; (for Windows OS)</p>
<p>7- Find the file extension by using the last dot “.” character of the file. This extension should be in the list of allowed extensions such as “gif”, “jpg”, “doc”, “docx”, “pdf”, “rtf”, and so on. (White-List)</p>
<h2>Quick Conclusion:</h2>
<p>Stop using blacklist protections for direct object references if you cannot use indirect ones. Moreover, do not forget to talk to the specialists to implement it correctly.</p>
<h2>Final Words</h2>
<p>Please send me your feedbacks via my email address (irsdl at yahoo dot com) to improve this white-paper. You can use whole or part of this document by putting a reference to the author (Soroush Dalili) and link of the main document.</p>
<p>Currently just by using Google, a lot of vulnerable websites and Content Management Systems (CMS) can be found. If you find an issue based on the content/idea of this paper in a permitted system (such as your website CMS), please report it to its legal authority to patch the system as soon as possible; and I would be thankful if you put a link to this document as a reference in your advisory.</p>
<p>However, please do not use this knowledge against any website or system without having a legal permission. And, I do not accept any responsibility for any usage from this white-paper and its content/idea.</p>
<h2>Reference(s):</h2>
<p>- OWASP, Unrestricted File Upload: <a href="http://www.owasp.org/index.php/Unrestricted_File_Upload">http://www.owasp.org/index.php/Unrestricted_File_Upload</a></p>
<p>&#8212;<br />
Downlaod the PDF file: <a href="http://soroush.secproject.com/downloadable/Unrestricted_File_Download_V1.0.pdf">http://soroush.secproject.com/downloadable/Unrestricted_File_Download_V1.0.pdf</a><br />
&#8212;<br />
Backup link is also available: <a href="http://0me.me/files/soroush.secproject.com/Unrestricted_File_Download_V1.0.pdf" target="_blank">http://0me.me/files/soroush.secproject.com/Unrestricted_File_Download_V1.0.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2011/01/unrestricted_file_download_v1_0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Dotty Salty Directory: A Secret Place in NTFS for Secret Files!</title>
		<link>http://soroush.secproject.com/blog/2010/12/a-dotty-salty-directory-a-secret-place-in-ntfs-for-secret-files/</link>
		<comments>http://soroush.secproject.com/blog/2010/12/a-dotty-salty-directory-a-secret-place-in-ntfs-for-secret-files/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 23:36:54 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[$Data]]></category>
		<category><![CDATA[$Index_Allocation]]></category>
		<category><![CDATA[ADS]]></category>
		<category><![CDATA[Alternate Data Stream]]></category>
		<category><![CDATA[Directory by Dot]]></category>
		<category><![CDATA[File By Dot]]></category>
		<category><![CDATA[Hidden Folders in NTFS]]></category>
		<category><![CDATA[Hide files in NTFS]]></category>
		<category><![CDATA[NTFS]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=398</guid>
		<description><![CDATA[I was playing with “::$Index_allocation” and “:$I30:$Index_Allocation” in an NTFS partition to make a directory which ends with some dot characters (“.”) or just includes some dots! The result was a bit interesting and scary! I could find a secret place that important data can be hidden in as well as the malwares! I want [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I was playing with “::$Index_allocation” and “:$I30:$Index_Allocation” in an NTFS partition to make a directory which ends with some dot characters (“.”) or just includes some dots!</p>
<p style="text-align: justify;">The result was a bit interesting and scary! I could find a secret place that important data can be hidden in as well as the malwares! I want to share it with you as some malware writers might already know about this. It is actually another Microsoft weird feature!</p>
<p style="text-align: justify;">In order to create a dotty directory and monitor its behavior, follow me:<br />
1- Open the Windows Command Line (cmd.exe).<br />
2- Go to a test directory.<br />
3.0- Now, insert the following commands and hit Enter:<br />
          md ..::$index_allocation &#8211;&gt; (Tested in Win XP)<br />
          md &#8230;::$index_allocation<br />
          md &#8230;.::$index_allocation<br />
          md irsdl<br />
          md irsdl.::$index_allocation<br />
          md irsdl..::$index_allocation<br />
3.1- You can use “echo test &gt; ” instead of “MD” if you have any problem.<br />
4- Now get a directory list from the folder that you are currently in (by using “Dir”)<br />
5- In order to open each of these directories use “CD DirName::$Index_Allocation”.<br />
          cd &#8230;::$index_allocation<br />
6- You can create some files inside these directories as well.<br />
7- Now use Windows Explorer to see these directories.</p>
<p style="text-align: justify;">The result in <strong>Windows XP:<br />
</strong>- The double dot (“..”) directory is hidden and you cannot see it.<br />
- In windows explorer, directories with a single dot at the end show the files which are inside a directory with same name but without any dot. For example: “irsdl.” shows content of “irsdl”. Directories with a double dot at the end show the files which are inside a directory with the same name but with a single dot. For example: “irsdl..” shows content of “irsdl.”. And so on.<br />
- In Windows Explorer, if you modify a directory with some dots at the end, the modification will be applied on a directory with a dot lesser than the modified directory. Therefore, if you delete “irsdl.”, “irsdl” folder will be deleted instead!<br />
- It is not possible to delete these directories by Windows Explorer. (use “del DirName::$Index_Allocation\*.* &amp; RD DirName::$Index_Allocation” instead)</p>
<p style="text-align: justify;"><strong>In Windows 7:<br />
</strong>- It is very similar to Windows XP. However, if you click on the directories by Windows Explorer, it may show you the content of a specific directory for all the Dotty ones.<br />
- It is not also possible to create a folder with only double dots “..”.<br />
The directories which only contain several dots such as “…”, show the content of their root directory although it is not so real!</p>
<p style="text-align: justify;"><strong>Result:<br />
</strong>Dotty directories are very good places to hide some files and data! It is not easy to be detected and it is not easy to be deleted! As malwares can use the same technique to hide themselves inside an NTFS partition, we should be very careful about it.</p>
<p style="text-align: justify;"><strong>Notes:<br />
</strong>Note 0: I might miss some other interesting points. Please let me know when you find one.<br />
Note 1: some of these directories might be accessible by IIS.<br />
Note 2: I experienced a crash in Windows Explorer in Win7 during playing with these directories.<br />
Note 3: Norton Internet Security 2011 in Win 7 could find and delete the EICAR virus inside these folders. It’s not tested on the other things.<br />
Note 4: Windows XP did checkdisk after a restart.<br />
Note 5: You can do the same to create a file by using “echo &gt; …::$Data”. And delete it by “del *.*”.</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2010/12/a-dotty-salty-directory-a-secret-place-in-ntfs-for-secret-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross Site URL Hijacking by using Error Object in Mozilla Firefox</title>
		<link>http://soroush.secproject.com/blog/2010/05/cross-site-url-hijacking-by-using-error-object-in-mozilla-firefox/</link>
		<comments>http://soroush.secproject.com/blog/2010/05/cross-site-url-hijacking-by-using-error-object-in-mozilla-firefox/#comments</comments>
		<pubDate>Thu, 27 May 2010 00:04:05 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[My Advisories]]></category>
		<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>
		<category><![CDATA[Cross Site URL Hijacking]]></category>
		<category><![CDATA[Cross Site URL Hijacking by Error Object]]></category>
		<category><![CDATA[XSUH by error object]]></category>
		<category><![CDATA[XSUH in Mozilla Firefox]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=245</guid>
		<description><![CDATA[In this paper, I want to represent a method for performing Cross Site URL Hijacking (which we can call XSUH) by using the error object of Mozilla Firefox. XSUH attack is used to steal another website URL. This URL can show the client’s situation on that website, and it can contain confidential parameters such as [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">In this paper, I want to represent a method for performing <strong>Cross Site URL Hijacking</strong> (which we can call <strong>XSUH</strong>) by using the<strong> error object</strong> of <strong>Mozilla Firefox</strong>. XSUH attack is used to steal another website URL. This URL can show the client’s situation on that website, and it can contain confidential parameters such as session ID as well. There is another useful article with a similar purpose but with a different approach which is “XSHM” article of CHECKMARX , and reading this article is highly recommended to you as well.<br />
As you might know, scripts error handling in Mozilla Firefox is quite useful for the developers as it can show the exact source of an error with some useful information. Now, this functionality can be misused to divulge the destination URL after the redirections (XSUH attack) which can lead to condition leakage or stealing some important parameters from the URL.</p>
<p><strong>Download From Here</strong>: <a href="http://soroush.secproject.com/downloadable/XSUH_FF_1.pdf">http://soroush.secproject.com/downloadable/XSUH_FF_1.pdf</a><br />
<strong>Or Here</strong>: <a href="http://0me.me/demo/XSUH/XSUH_FF_1.pdf">http://0me.me/demo/XSUH/XSUH_FF_1.pdf</a></p>
<p><strong>Proof of Concept</strong>: <a href="http://0me.me/demo/XSUH/XSUH_demo_firefox_all_in_1.html">http://0me.me/demo/XSUH/XSUH_demo_firefox_all_in_1.html</a></p>
<p>Note:  This technique has been tested on Mozilla Firefox 3.6.3, 3.5.9, 3.6.4build5 (26th May 2010).</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2010/05/cross-site-url-hijacking-by-using-error-object-in-mozilla-firefox/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New Method: Role of the “/” character in mapping the website directories! &#8211; Webservers fault?</title>
		<link>http://soroush.secproject.com/blog/2010/05/new-method-role-of-the-%e2%80%9c%e2%80%9d-character-in-mapping-the-website-directories/</link>
		<comments>http://soroush.secproject.com/blog/2010/05/new-method-role-of-the-%e2%80%9c%e2%80%9d-character-in-mapping-the-website-directories/#comments</comments>
		<pubDate>Thu, 06 May 2010 23:54:44 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>
		<category><![CDATA[Mapping directory]]></category>
		<category><![CDATA[Mapping folder]]></category>
		<category><![CDATA[Slash role]]></category>
		<category><![CDATA[using slash as a signature]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=240</guid>
		<description><![CDATA[One of the first steps of a black-box penetration testing of a website is mapping its files and directories.  And in order to do that, security scanners crawl into the website first, and then try to guess the possible directories and files. These scanners use the response header or body of the page to investigate [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">One of the first steps of a black-box penetration testing of a website is mapping its files and directories.  And in order to do that, security scanners crawl into the website first, and then try to guess the possible directories and files. These scanners use the response header or body of the page to investigate a valid file or directory. For instance, the header status “404” can be the sign of “File Not Found” and “200” can be the sign of a valid file. Also, the status “403 Forbidden” can be the sign of a valid directory without any index page. However, many websites such as Yahoo, Google, Facebook, Microsoft, and so on do not like to show the “403 Forbidden” errors for a valid directory, and instead, they show a “Page Not found” or another default page to the users. Although this functionality makes the website more user-friendly, it is not good for the scanners at all; as there is no difference between a valid and an invalid directory then.</p>
<p style="text-align: justify;">Therefore, we need something else as a signature to improve the scanners result. And as a solution we can use a “/” as an identifier. In case of requesting a valid directory without adding a slash at the end of it, the web-server will add an slash automatically, and in case of having an invalid directory there will not be any slash at the end of the directory name.</p>
<p>Some examples:</p>
<p>Invalid Directory: <a href="http://www.microsoft.com/foobars">http://www.microsoft.com/foobars</a></p>
<p>Valid Directory: <a href="http://www.microsoft.com/test">http://www.microsoft.com/test</a></p>
<p>&#8212;&#8212;&#8211;</p>
<p>Invalid Directory: <a href="http://code.google.com/foobars">http://code.google.com/foobars</a></p>
<p>Valid Directory: <a href="http://code.google.com/js">http://code.google.com/js</a></p>
<p>&#8212;&#8212;&#8211;</p>
<p>Invalid Directory: <a href="http://www.facebook.com/foobars">http://www.facebook.com/foobars</a></p>
<p>Valid Directory: <a href="http://www.facebook.com/admin">http://www.facebook.com/admin</a></p>
<p>&#8212;&#8212;&#8211;</p>
<p>Invalid Directory: <a href="http://uk.yahoo.com/foobars">http://uk.yahoo.com/foobars</a></p>
<p>Valid Directory: <a href="http://uk.yahoo.com/private">http://uk.yahoo.com/private</a></p>
<p>&#8212;&#8212;&#8211;</p>
<p>Cheers,</p>
<p><strong>Soroush Dalili</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2010/05/new-method-role-of-the-%e2%80%9c%e2%80%9d-character-in-mapping-the-website-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve File Uploaders’ Protections &#8211; Bypass Methods- Rev. 1.0</title>
		<link>http://soroush.secproject.com/blog/2010/03/improve-file-uploaders%e2%80%99-protections-rev-1-0/</link>
		<comments>http://soroush.secproject.com/blog/2010/03/improve-file-uploaders%e2%80%99-protections-rev-1-0/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 23:59:35 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[fckeditor bypass methods]]></category>
		<category><![CDATA[file uploader bypass methods]]></category>
		<category><![CDATA[file uploader security bypass]]></category>
		<category><![CDATA[file uploader security improvement]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=232</guid>
		<description><![CDATA[Some new methods of bypassing file uploaders protections have been discussed. As an example bypassing by using: trailing spaces and dots, “::$data.”, direct Null char, IIS semi-colon  bug, and so on. Uploading files by using web applications is very common. However, there is always a high risk around this matter. In case of uploading a [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
<p style="text-align: justify;"><span style="color: #ff0000;"><span style="color: #000000;">Some new methods of bypassing file uploaders protections have been discussed. As an example bypassing by using:<strong> </strong></span><span style="color: #000000;"><strong>trailing spaces and dots, </strong><strong>“::$data.”, </strong><strong>direct Null char, IIS semi-colon  bug,</strong> and so on.</span></span></p>
</blockquote>
<p style="text-align: justify;">Uploading files by using web applications is very common. However, there is always a high risk around this matter. In case of uploading a web-shell file which can be absolutely malicious, an attacker can get the same privilege of access as the web application to the server. In this paper, which is mostly around the Windows-based web applications, some general solutions for protecting against this type of attack have been suggested. Moreover, as a proof of concept, some of the most general protection methods and the way of bypassing them have been discussed.</p>
<p style="text-align: justify;">This article is an educational article to improve the security of the web applications. And, the author of this article (“Soroush Dalili”) does not accept and has no responsibility about the content or usage of this article in any other way. Any other usage of this article except the legal ones is completely prohibited.</p>
<p style="text-align: justify;">Please respect the copyright and mention the name of the author (“Soroush Dalili”) in case of using this article.</p>
<p style="text-align: left;"><a title="http://soroush.secproject.com/downloadable/Improve File Uploaders’ Protections.pdf" href="http://soroush.secproject.com/downloadable/Improve File Uploaders’ Protections.pdf" target="_blank"><strong>Download</strong> this article by clicking here.</a> (<a title="http://soroush.secproject.com/downloadable/Improve File Uploaders’ Protections.pdf" href="http://soroush.secproject.com/downloadable/Improve File Uploaders’ Protections.pdf" target="_blank">http://soroush.secproject.com/downloadable/Improve File Uploaders’ Protections.pdf</a>)</p>
<p style="text-align: justify;"> </p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2010/03/improve-file-uploaders%e2%80%99-protections-rev-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browsers’ Pain: A recursive function!</title>
		<link>http://soroush.secproject.com/blog/2009/12/browsers%e2%80%99-pain-a-recursive-function/</link>
		<comments>http://soroush.secproject.com/blog/2009/12/browsers%e2%80%99-pain-a-recursive-function/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 20:36:55 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>
		<category><![CDATA[Browsers’ Pain]]></category>
		<category><![CDATA[Mozilla Crash Function]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=188</guid>
		<description><![CDATA[I have written a recursive function by using Javascript “setInterval” function which calls itself. Unfortunately, none of the last version of famous browsers such as Internet Explorer (8), Chrome (3.0.195.38), and Mozilla Firefox (3.5.6) blocks this script. Moreover, it takes more than 50% of my CPU which is Intel Core 2 Dou 2.50 GHz. And [...]]]></description>
			<content:encoded><![CDATA[<p>I have written a recursive function by using Javascript “setInterval” function which calls itself. Unfortunately, none of the last version of famous browsers such as Internet Explorer (8), Chrome (3.0.195.38), and Mozilla Firefox (3.5.6) blocks this script. Moreover, it takes more than 50% of my CPU which is Intel Core 2 Dou 2.50 GHz.<br />
And the worst one is Mozilla Firefox which stops working after running this script instead of showing a page to stop the script.<br />
This script is:</p>
<blockquote><p>&lt;script&gt;<br />
function recursiveFunc(){setInterval(&#8220;recursiveFunc()&#8221;,1);}<br />
recursiveFunc();<br />
&lt;/script&gt;</p></blockquote>
<p>Just save it as an HTML file, and try to open it with your browsers. You can convert “1” to “0” to get better result in Mozilla Firefox and Chrome.<br />
I reported it to Mozilla Firefox as a bug.<br />
Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/12/browsers%e2%80%99-pain-a-recursive-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google captured my privacy!</title>
		<link>http://soroush.secproject.com/blog/2009/12/google-captured-my-privacy/</link>
		<comments>http://soroush.secproject.com/blog/2009/12/google-captured-my-privacy/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 15:32:40 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Normal Posts]]></category>
		<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Google captured my privacy]]></category>
		<category><![CDATA[Google captured your privacy]]></category>
		<category><![CDATA[Google is the best Firewall]]></category>
		<category><![CDATA[Google is the best Forensic Tool]]></category>
		<category><![CDATA[Privacy by Google]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=183</guid>
		<description><![CDATA[Google will be the best Firewall and Forensic Tool of the near future! Google will (or already) know the users&#8217; information! News: &#8220;Google pushes security with Public DNS&#8221; -&#62; So, Google DNS can collect all the websites which is viewed by the users &#8230; &#8220;Browsers use Google to detect web forgery -&#62; So, a browser [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>Google will be the best Firewall and Forensic Tool of the near future!</strong></h3>
<p>Google will (or already) know the users&#8217; information!</p>
<p>News:</p>
<p>&#8220;Google pushes security with Public DNS&#8221; -&gt; So, Google DNS can collect all the websites which is viewed by the users &#8230;</p>
<p>&#8220;Browsers use Google to detect web forgery -&gt; So, a browser send a request to Google before openning a website for you! &#8230;</p>
<p>&#8220;The best search engine for all&#8221; -&gt; So, Google can collect your keywords! &#8230;</p>
<p>&#8220;The best public mail service&#8221; -&gt; So, Google can collect your emails &#8230;</p>
<p>&#8220;Google owned Youtube&#8221; -&gt; So, Google can collect your videos &#8230;</p>
<p>&#8220;Google codes&#8221; -&gt; So, Google can collect your source codes &#8230;</p>
<p>&#8220;Google documents&#8221; -&gt; So, Google can collect your documents &#8230;</p>
<p>&#8220;Google photos&#8221; -&gt; So, Google can collect your photos &#8230;</p>
<p>&#8220;Google messenger&#8221; -&gt; So, Google can collect the messages &#8230;</p>
<p>&#8220;Most of the websites use Google web analyzer (tracker)&#8221; -&gt; So, Google can track the websites&#8217; information and also their customers! &#8230;</p>
<p>&#8220;Google Wave&#8221; -&gt; So, Google can collect the blogs ,e-mails, instant messaging, FTPs, social networking’s, and so on&#8217;s information! &#8230;</p>
<p>&#8220;Google powerful translators&#8221; -&gt; So, Google can understand why you are saying in other languages!</p>
<p>&#8220;Searchable images/sounds/videos by text or another object!&#8221; -&gt; So, Google can search in users&#8217; collected data &#8230;</p>
<p>&#8220;Chrome OS&#8221; -&gt; So, Google can do anything with your computer &#8230;</p>
<p>AND <strong>etc</strong> (see <a href="http://www.google.co.uk/intl/en/options/" target="_blank">http://www.google.co.uk/intl/en/options/</a> and <a href="http://www.googlelabs.com/" target="_blank">http://www.googlelabs.com/</a>)&#8230;</p>
<p>We are waiting for the most powerful shopping centre by Google!</p>
<h3><strong>However, we should trust Google in order to have happier and easier life!</strong></h3>
<h3><strong>Google = No Pain, No Gain!</strong></h3>
<p>Best wishes ;)</p>
<p>Soroush</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/12/google-captured-my-privacy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My belief: 70% of websites are vulnerable</title>
		<link>http://soroush.secproject.com/blog/2009/11/my-belief-70-of-websites-are-vulnerable/</link>
		<comments>http://soroush.secproject.com/blog/2009/11/my-belief-70-of-websites-are-vulnerable/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 15:57:31 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>
		<category><![CDATA[Critical vulnerabilities]]></category>
		<category><![CDATA[CSRF Attacks]]></category>
		<category><![CDATA[OWASP top 10]]></category>
		<category><![CDATA[SQL Injection Vulnerability]]></category>
		<category><![CDATA[website vulnerability]]></category>
		<category><![CDATA[XSS Vulnerability]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=180</guid>
		<description><![CDATA[When I was searching for a ticket in nationalrail.co.uk website, I suddenly found an XSS and also a SQL Injection vulnerabilities in it. I reported these two vulns. to its website just for having more security. And, I think these two vulnerabilities are fixed now. However, I believe that still 70% of webistes are vulnerable [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">When I was searching for a ticket in nationalrail.co.uk website, I suddenly found an XSS and also a SQL Injection vulnerabilities in it.</p>
<p style="text-align: justify;">I reported these two vulns. to its website just for having more security. And, I think these two vulnerabilities are fixed now.</p>
<p style="text-align: justify;">However, <strong>I believe that still 70% of webistes are vulnerable against the <a href="http://owasp.org/">OWASP</a> TOP 10! </strong></p>
<p style="text-align: justify;">Also, I think you should read &#8220;<a href="http://www.securityfocus.com/brief/1036"><span>Survey: Majority of Web sites vulnerable</span></a>&#8221; as well.</p>
<p style="text-align: justify;">Cheers,</p>
<p style="text-align: justify;">Soroush</p>
<p style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/11/my-belief-70-of-websites-are-vulnerable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to stop hardware key-loggers</title>
		<link>http://soroush.secproject.com/blog/2009/11/how-to-stop-hardware-key-loggers/</link>
		<comments>http://soroush.secproject.com/blog/2009/11/how-to-stop-hardware-key-loggers/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 14:33:22 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Normal Posts]]></category>
		<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Dynamic Keyboard]]></category>
		<category><![CDATA[Hardware Keyloggers]]></category>
		<category><![CDATA[Keyloggers]]></category>
		<category><![CDATA[Stop Hardware Keyloggers]]></category>
		<category><![CDATA[TPM for hardware keyloggers]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=171</guid>
		<description><![CDATA[Nowadays new generations of hardware key-loggers are emerged, and unfortunately attackers are using them intensively to steal the keystrokes of users. These key-loggers are OS independent and are in different shapes. They are even capable of stealing the BIOS password. Most of them look like a convertor for PS/2 and/or USB to PS/2 and/or USB [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Nowadays new generations of hardware key-loggers are emerged, and unfortunately attackers are using them intensively to steal the keystrokes of users. These key-loggers are OS independent and are in different shapes. They are even capable of stealing the BIOS password. Most of them look like a convertor for PS/2 and/or USB to PS/2 and/or USB (Fig. 1). Besides, some of them are chipsets which are embedded in the keyboard itself (Fig. 2). And others use electromagnetic features to steal the keystrokes which are put around the wire of the keyboard or work remotely by capturing the frequency spectrum of the keyboard communication<a href="#_ftn1">[1]</a>. The problem is that these hardware key-loggers have become very cheap and simply available<a href="#_ftn2">[2]</a>. Moreover, there are some free articles about how to make their circuits<a href="#_ftn3">[3]</a>.</p>
<p style="text-align: center;"><img class=" aligncenter" title="Simple Hardware Keyloggers" src="http://i45.tinypic.com/153216a.jpg" alt="Simple Hardware Keyloggers" width="400" height="120" /></p>
<p style="text-align: center;"><img class=" aligncenter" title="Embeded Hardware Keylogger" src="http://i45.tinypic.com/2sa1qhy.gif" alt="Figure 2. Embeded Hardware Keylogger" /></p>
<p style="text-align: justify;"><strong>So, how can we stop it if we could not remove its hardware from our computer or there is a danger of electromagnetic key-logger?</strong></p>
<p style="text-align: justify;">The first and the simplest idea is using an on-screen keyboard and click on it by using a mouse. However in order to get the best result, this on-screen keyboard should be dynamic in order to prevent a hardware key-logger for the mouse itself, which captures the mouse movements and its clicks. Another way is using encryption between the keyboard and its driver. For instance, there is no doubt that by using TPM and having strong encryption methods between keyboard and motherboard (or OS itself), the keyboard can encrypt the keystrokes before sending them to the computer. But, I want to be more initiative. Another idea can be using an optical-dynamic keyboard device which shows a keyboard on your desk or on your palm, and you can touch it in order to press a key (Fig. 3). There is also an application which claims that it can detect a hardware key-logger, but I have not tried it yet and I think it is still possible to hide a hardware key-logger completely from the OS.</p>
<div class="wp-caption aligncenter" style="width: 337px"><img class=" " title="iTech Dynamic Bluetooth Virtual Keyboard" src="http://i49.tinypic.com/r1kduf.jpg" alt="Figure 3." width="327" height="325" /><p class="wp-caption-text">Figure 3.</p></div>
<p style="text-align: justify;"><em>This text is completely based on my own idea, so please respect the copyright. </em></p>
<hr size="1" /><a href="#_ftnref1">[1]</a> http://keznews.com/4985_Researchers_hack_wired_keyboards__hijack_keystrokes</p>
<p><a href="#_ftnref2">[2]</a> http://www.google.co.uk/products?q=hardware+keylogger</p>
<p><a href="#_ftnref3">[3]</a> http://derek.chezmarcotte.ca/?page_id=24</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">
<p>.</p>
<p class="MsoNormal" style="text-align: justify;"><span>So, how can we stop it if we could not remove its hardware from our computer or there is a danger of electromagnetic key-logger?</span></p>
<p class="MsoNormal" style="text-align: justify;"><span>The first and the simplest idea is using an on-screen keyboard and click on it by using a mouse. However in order to get the best result, this on-screen keyboard should be dynamic in order to prevent a hardware key-logger for the mouse itself, which captures the mouse movements and its clicks. Another way is using encryption between the keyboard and its driver. For instance, there is no doubt that by using TPM and having strong encryption methods between keyboard and motherboard (or OS itself), the keyboard can encrypt the keystrokes before sending them to the computer. But, I want to be more initiative. Another idea can be using an optical-dynamic keyboard device which shows a keyboard on your desk or on your palm, and you can touch it in order to press a key (Fig. 3). There is also an application which claims that it can detect a hardware key-logger, but I have not tried it yet and I think it is still possible to hide a hardware key-logger completely from the OS.</span></p>
<p><span style="font-size: 11pt; line-height: 115%; font-family: &amp;amp;amp;">This text is completely based on my own idea, so please respect the copyright.</span></p>
<div>
<p><!--[if !supportFootnotes]--></p>
<hr size="1" /><!--[endif]--></p>
<div id="ftn1">
<p class="MsoFootnoteText"><a name="_ftn1" href="#_ftnref1"><span class="MsoFootnoteReference"><span lang="EN-GB"><span><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span style="font-size: 10pt; line-height: 115%; font-family: &amp;amp;amp;" lang="EN-GB">[1]</span></span><!--[endif]--></span></span></span></a><span lang="EN-GB"> http://keznews.com/4985_Researchers_hack_wired_keyboards__hijack_keystrokes</span><span> </span></p>
</div>
<div id="ftn2">
<p class="MsoFootnoteText"><a name="_ftn2" href="#_ftnref2"><span class="MsoFootnoteReference"><span lang="EN-GB"><span><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span style="font-size: 10pt; line-height: 115%; font-family: &amp;amp;amp;" lang="EN-GB">[2]</span></span><!--[endif]--></span></span></span></a><span lang="EN-GB"> http://www.google.co.uk/products?q=hardware+keylogger</span><span> </span></p>
</div>
<div id="ftn3">
<p class="MsoFootnoteText"><a name="_ftn3" href="#_ftnref3"><span class="MsoFootnoteReference"><span lang="EN-GB"><span><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span style="font-size: 10pt; line-height: 115%; font-family: &amp;amp;amp;" lang="EN-GB">[3]</span></span><!--[endif]--></span></span></span></a><span lang="EN-GB"> http://derek.chezmarcotte.ca/?page_id=24</span><span> </span></p>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/11/how-to-stop-hardware-key-loggers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to prevent phishing attacks? ‐ In 3 Pages ‐</title>
		<link>http://soroush.secproject.com/blog/2009/11/how-to-prevent-phishing-attacks-%e2%80%90-in-3-pages-%e2%80%90/</link>
		<comments>http://soroush.secproject.com/blog/2009/11/how-to-prevent-phishing-attacks-%e2%80%90-in-3-pages-%e2%80%90/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 18:06:46 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>
		<category><![CDATA[Phishing attacks]]></category>
		<category><![CDATA[Phishing methods]]></category>
		<category><![CDATA[Phishing prevention]]></category>
		<category><![CDATA[XSS in phishing attacks]]></category>
		<category><![CDATA[XSS Vulnerability]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=166</guid>
		<description><![CDATA[In only 3 pages, I tried to explain Phishing attacks and prevention methods. Although there are some books about this topic, I tried to do my best in 3 pages only! :D I hope you enjoy :) Click here to download this mini-article! Cheers, Soroush]]></description>
			<content:encoded><![CDATA[<p>In only 3 pages, I tried to explain Phishing attacks and prevention methods. Although there are some books about this topic, I tried to do my best in 3 pages only! :D</p>
<p>I hope you enjoy :)</p>
<p><a title="phishing_in_3_pages_march_2009.pdf" href="http://soroush.secproject.com/downloadable/phishing_in_3_pages_march_2009.pdf" target="_blank">Click here to download this mini-article!</a></p>
<p>Cheers,</p>
<p>Soroush</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/11/how-to-prevent-phishing-attacks-%e2%80%90-in-3-pages-%e2%80%90/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finding vulnerabilities of YaFtp 1.0.14 (a client-side FTP application)</title>
		<link>http://soroush.secproject.com/blog/2009/11/finding-vulnerabilities-of-yaftp-1-0-14-a-client-side-ftp-application/</link>
		<comments>http://soroush.secproject.com/blog/2009/11/finding-vulnerabilities-of-yaftp-1-0-14-a-client-side-ftp-application/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 19:31:44 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[computer science vulnerabilities]]></category>
		<category><![CDATA[educational bug finding]]></category>
		<category><![CDATA[ftp vulnerabilities]]></category>
		<category><![CDATA[java vulnerabilities]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=160</guid>
		<description><![CDATA[Abstract: In this report we are going to find the vulnerabilities of YaFtp program, a client-side FTP application, and we are also going to suggest some mitigation methods. This process will be performed by using a specific plan which plays an important role in finding the security issues and analyzing the program. First of all [...]]]></description>
			<content:encoded><![CDATA[<p>Abstract: In this report we are going to find the vulnerabilities of YaFtp program, a client-side FTP application, and we are also going to suggest some mitigation methods. This process will be performed by using a specific plan which plays an important role in finding the security issues and analyzing the program. First of all we must understand the problem and gather the information which is related to this program. In fact, gathering the information is the most important phase in finding the vulnerabilities which clears the problem for us. In the next phase, model of the application will be drawn. Then, possible vulnerabilities will be discussed and we will draw two possible attack trees for YaFtp program. Finally, by using some automation tools and also manually, we will find the vulnerable candidate points, and we will investigate them to find the vulnerabilities. To summarize, 9 important vulnerabilities were found in this report. And, there are some solutions and suggestions in the last section of this report for developers of this application.</p>
<p><a title="YaFtp Vulns. Report" href="http://soroush.secproject.com/downloadable/yaftp-report.pdf" target="_blank">Click here to download the PDF file.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/11/finding-vulnerabilities-of-yaftp-1-0-14-a-client-side-ftp-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web application security in ASP &#8211; (simple) JSP</title>
		<link>http://soroush.secproject.com/blog/2009/08/web-application-security-in-asp-simple-jsp/</link>
		<comments>http://soroush.secproject.com/blog/2009/08/web-application-security-in-asp-simple-jsp/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 03:32:14 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[final project article]]></category>
		<category><![CDATA[soroush dalili]]></category>
		<category><![CDATA[Web application security in ASP]]></category>
		<category><![CDATA[Web application security in ASP - (simple) JSP]]></category>
		<category><![CDATA[Web application security in JSP]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=158</guid>
		<description><![CDATA[Language of this article is Farsi (Persian). This article is ready to download from these links: http://soroush.secproject.com/downloadable/ASP_Security_Soroush_Dalili.pdf or http://rapidshare.com/files/273684865/ASP_Security_Soroush_Dalili.zip Cheers Soroush]]></description>
			<content:encoded><![CDATA[<p>Language of this article is Farsi (Persian).</p>
<p>This article is ready to download from these links:</p>
<p><a href="http://soroush.secproject.com/downloadable/ASP_Security_Soroush_Dalili.pdf" target="_blank">http://soroush.secproject.com/downloadable/ASP_Security_Soroush_Dalili.pdf</a></p>
<p>or</p>
<p><a href="http://rapidshare.com/files/273684865/ASP_Security_Soroush_Dalili.zip" target="_blank">http://rapidshare.com/files/273684865/ASP_Security_Soroush_Dalili.zip</a></p>
<p>Cheers</p>
<p>Soroush</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/08/web-application-security-in-asp-simple-jsp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some XSS Tricks</title>
		<link>http://soroush.secproject.com/blog/2009/01/some-xss-tricks/</link>
		<comments>http://soroush.secproject.com/blog/2009/01/some-xss-tricks/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 17:47:07 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=125</guid>
		<description><![CDATA[I had submitted some XSS vulnerabilities in xssed.com by these names: BugReport.ir (before soroush.secproject.com website) And Soroush.SecProject.Com (nowadays) Now, because of using some tricks in these XSSes, they can be interesting. I want to describe some of these tricks here: 1- Insert JavaScript code inside of available script. In order to insert proper arbitrary JavaScript, [...]]]></description>
			<content:encoded><![CDATA[<p>I had submitted some XSS vulnerabilities in xssed.com by these names:</p>
<p>BugReport.ir (before soroush.secproject.com website)</p>
<p>And</p>
<p>Soroush.SecProject.Com (nowadays)</p>
<p>Now, because of using some tricks in these XSSes, they can be interesting. I want to describe some of these tricks here:</p>
<p>1- Insert JavaScript code inside of available script. In order to insert proper arbitrary JavaScript, we must insert something to close left side of JavaScript, then insert our own JavaScript, and finally close the right side of JavaScript to prevent errors.</p>
<p>As you can see in &#8220;http://www.xssed.com/mirror/39834/&#8221;, the XSS query is this:</p>
<p>?sx=&#8221;});};document.write(&#8216;This is XSS test &#8211; BugReport.ir&#8217;);alert(&#8216;Safe XSS BugReport.ir&#8217;);function startVideoPlayer(){getFailQS({destURL:&#8221;",show:&#8221;</p>
<p>In this query, first I closed the defined function by ["});};] , and then I inserted my arbitrary script there. After that, I used [function startVideoPlayer(){getFailQS({destURL:"",show:"]  to open a function to complete the right side of the code to prevent a JavaScript error.</p>
<p>You can see some other example of this group:</p>
<p>http://www.xssed.com/mirror/41138/</p>
<p>http://www.xssed.com/mirror/41800/</p>
<p>http://www.xssed.com/mirror/55622/</p>
<p>2- Insert JavaScript code in another format. Sometimes we can insert our JavaScript code via the some other forms of input such as Base64. In this way, we must look for algorithms of inputs.</p>
<p>As you can see in &#8220;http://www.xssed.com/mirror/55624/&#8221;, I inserted a Base64 string in order to perform XSS attack.</p>
<p>3- Using http://ha.ckers.org/xss.html techniques. There are always something new and fantastic in this XSS cheat sheet! I learned many things from it.</p>
<p>Example to bypass filters: &#8220;http://www.xssed.com/mirror/56197/&#8221;</p>
<p>4- Use your own idea to insert your codes. We must be creative in performing XSS. For example in &#8220;http://www.xssed.com/mirror/56651/&#8221;, I could not insert any string for my alert() function, so I insert something in title of the page, and then read them in my alert() function. It is obvious that I could use eval() function to execute some codes by this method.</p>
<p>?wrd=Tested in Mozilla (Onmouseover) &#8212; IRSDL is HERE &#8212; Soroush.SecProject.Com &#8212; Another XSS Trick in Yahoo&amp;prn=[irsdl]&amp;pth=test&amp;opt=onmouseover%3dalert(window.document.title.substring(15)) onmouseout%3dalert(/SeeYou/)</p>
<p>Another example is &#8220;http://www.xssed.com/mirror/40384/&#8221; which is based on the &#8220;http://www.bugreport.ir/index_38.htm&#8221;:</p>
<p>[DNN URL] /Default.aspx/&#8221;onmouseover=&#8221;x=&#8217;al&#8217;;x=x+&#8217;ert(/WWW.BugReport.IR/)&#8217;;eval(x);alert().aspx</p>
<p>In this XSS, I used a feature of .Net which is &#8220;Slash after .aspx&#8221; in order to change PATH_INFO parameter in Server Variable. As &#8220;Dot Net Nuke (DNN)&#8221; used PATH_INFO instead of URL parameter, path was inserted into the default.aspx page without any checking. So I inserted &#8220;onmouseover&#8221; event there. But, there was a problem with alert() function which DNN could recognize it and omit it plus all of the string after it! So, I inserted alert() function as a string into the &#8220;x&#8221; variable, and then evaluate it by using eval() function. Another problem was that DNN needed &#8220;.aspx&#8221; at the end of the request (before Get parameters)! So, I inserted an &#8220;alert().aspx&#8221; at the end of the query which I knew that DNN will omit it plus all the string after that.</p>
<p>Moreover, you can see in &#8220;http://www.bugreport.ir/index_38.htm&#8221; that I used another query which is:</p>
<p>http://[DNN URL]/Default.aspx/bugreport/&#8221;onmouseover=&#8221;var a=&#8217;.aspx?&#8217;;document.location=&#8217;http://www.bugreport.ir/?archive&#8217;;</p>
<p>In this example, I must use a &#8220;:&#8221; for the &#8220;http://www.bugreport.ir/?archive&#8221;, but I could not insert it before the &#8220;?&#8221; because of getting error by the IIS (&#8220;:&#8221; is used to indicate a port). So, I inserted a &#8220;.aspx?&#8221; in a temp &#8220;a&#8221; variable in order to have: 1- a &#8220;.aspx&#8221; at the end of the query (before Get parameters) 2- insert &#8220;:&#8221; into the &#8220;http://&#8221;.</p>
<p>Note: I could not use &#8220;onmoueover&#8221; after the &#8220;?&#8221; because it replaced the double quotation in Get parameter by %22.</p>
<p>Good Luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/01/some-xss-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hackers can control their victims from free web hosting services!</title>
		<link>http://soroush.secproject.com/blog/2009/01/hackers-can-control-their-victims-from-free-web-hosting-services/</link>
		<comments>http://soroush.secproject.com/blog/2009/01/hackers-can-control-their-victims-from-free-web-hosting-services/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 01:28:13 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=105</guid>
		<description><![CDATA[By coming the powerful languages and new techniques for the web applications such as .Net, J2EE, PHP libraries, AJAX, and so on, we can have more powerful web applications. So, we must be happy because of these new technologies! But, hackers are also happy! Because by using these technologies, they can also design their tools [...]]]></description>
			<content:encoded><![CDATA[<p>By coming the powerful languages and new techniques for the web applications such as .Net, J2EE, PHP libraries, AJAX, and so on, we can have more powerful web applications.<br />
So, we must be happy because of these new technologies!<br />
But, hackers are also happy! Because by using these technologies, they can also design their tools easier, and disperse it all around the world, and control it from anywhere that they want. But, HOW?<br />
There are so many free web hosting in the Internet which do not need your correct information for registration. So, hackers can register a lot of accounts on them and setup their tools without concerning about compromising their identifications.<br />
Some of the hackers&#8217; tools are:<br />
Loggers -&gt; which log victims&#8217; information (by using some key loggers on the clients or XSS attacks).<br />
Request Senders -&gt; which send anonymous dangerous requests to the victims who can be a client or a server.<br />
Database Managers -&gt; which manage databases such as MSSQL, MySQL, Oracle, and so on remotely.<br />
Remote Desktop Managers -&gt; which connect to the computers by backshell or by a RDP. (I haven&#8217;t seen the graphical version yet!)<br />
Mail Senders -&gt; which send malicious emails to the clients.<br />
FTP Managers -&gt; which connect to a FTP with full modifying options.<br />
Exploit Executers -&gt; which execute malicious codes on the clients and the visitors to gain control of their computers.</p>
<p>I think anonymization with HTTP protocol is easier than the others when you are using TOR or some anonymous VPNs.<br />
So, I think:<br />
1- The free web hosting must have some process to identify their users correctly!<br />
2- Browsers must have some features to make free web hosting websites in max of security protection, and also, they must show some security warning about these websites.<br />
3- Firewalls and Antivirus must have some protection against these free websites.</p>
<p>Do you have any idea?</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/01/hackers-can-control-their-victims-from-free-web-hosting-services/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why using the &#8220;include&#8221; techniques are dangerous for the novice developers?</title>
		<link>http://soroush.secproject.com/blog/2009/01/why-using-include-techniques-are-dangerous-for-novice-developers/</link>
		<comments>http://soroush.secproject.com/blog/2009/01/why-using-include-techniques-are-dangerous-for-novice-developers/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 06:29:12 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=80</guid>
		<description><![CDATA[I don&#8217;t want to speak about the LFI (local file inclusion) or RFI (remote file inclusion) which we have a lot of articles about them. I just want to tell you about some simple facts ;) I have read a lot of source codes of web applications till now. And, I think one of the [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t want to speak about the LFI (local file inclusion) or RFI (remote file inclusion) which we have a lot of articles about them.<br />
I just want to tell you about some simple facts ;)<br />
I have read a lot of source codes of web applications till now.<br />
And, I think one of the most important logical vulnerabilities is incorrect using of &#8220;include&#8221; techniques.<br />
I want to explain this by some examples:<br />
&#8212;&#8212;&#8212;&#8211; Begin Example1 &#8212;&#8212;&#8212;&#8211;<br />
Example1. (ASP, PHP, JSP, ?)<br />
Assume that we have:<br />
1. Admin.asp -&gt;(Secured) which includes Check.asp, Header.asp, Main.asp<br />
2. Check.asp -&gt; Check admin session<br />
3. Header.asp -&gt; is for showing the top menu<br />
4. Main.asp -&gt; is for showing the administrator&#8217;s main page</p>
<p>So, if I execute Index.asp, I will execute all 3 other files which I mentioned too.</p>
<p>Question: What will happen if I point to the Main.asp or Header.asp directly without using the Index.asp?<br />
Answer: If Main.asp or Header.asp does not include Check.asp, attacker can see the admin page without having the administrator credential!<br />
Result: I see a lot of web application which had this problem!</p>
<p>Now assume that Check.asp is something like this:<br />
&#8212;&#8212;&#8212;&#8211; Begin Check.asp &#8212;&#8212;&#8212;&#8211;<br />
<em>some lines of codes blah blah blah<br />
&lt;%<br />
&#8216; Get an input from the user<br />
1 Input_CurrentFolder = Request(&#8220;currentFolder&#8221;)</em></p>
<p><em>2 &#8216; in order to get the root directory we must set an admin session<br />
3 session(&#8220;admin&#8221;)=true</em></p>
<p><em>4 directory = GetDirectory(Input_CurrentFolder)</em></p>
<p><em>&#8216;Terminate admin session for the security!<br />
5 session(&#8220;admin&#8221;)=false</em></p>
<p><em>%&gt;<br />
some lines of codes blah blah blah</em><br />
&#8212;&#8212;&#8212;&#8211; End Check.asp &#8212;&#8212;&#8212;&#8211;</p>
<p>I want to speak about the session. What do you think about these codes? Is there any security problem?</p>
<p>Question1: How can a user keep session(&#8220;admin&#8221;)=true for him/herself?<br />
Answer1: In order to do that, user needs to stop execution on line 4!<br />
Question2: Now, how can a user stop execution on line 4?<br />
Answer2: User must stop running the program on line 4. So, he/she must create an error on that line! So, actually it depends on some factors. And, I want to show you 2 of them which the first one is related to subject of this article.</p>
<p>1- First situation: Check.asp does not contain &#8220;GetDirectory&#8221; function and this function is in Header.asp. Now if attacker point directly to the Check.asp, he/she can get the admin session! Because the program will be crashed on line 4!<br />
2- Another situation: the &#8220;GetDirectory&#8221; function must not work with each &#8220;Input_CurrentFolder&#8221;. In other words, &#8220;GetDirectory&#8221; function must crash because of some value of &#8220;Input_CurrentFolder&#8221;.<br />
Note: we must not have something like &#8220;On error resume next&#8221; which force the program to continue.<br />
Result: I think this vulnerability is not a strange one; However, it is not very common. I had seen this vulnerability in some programs such as the old version of &#8220;hosting controller&#8221;!<br />
&#8212;&#8212;&#8212;&#8211; End Example1 &#8212;&#8212;&#8212;&#8211;<br />
&#8212;&#8212;&#8212;&#8211; Begin Example2 &#8212;&#8212;&#8212;&#8211;<br />
Example2. (PHP, ?)<br />
This is not new example but it is related to this subject.<br />
Assume that we have:<br />
1. SessionControl.php -&gt;(Secured) which control the user&#8217;s session<br />
2. EditContent.php -&gt; by using this file, administrator can edit the website&#8217;s pages<br />
3. AdminContent.php -&gt; (Secured) which includes SessionControl.php and EditContent.php.</p>
<p>And assume that EditContent.php is something like this:<br />
&#8212;&#8212;&#8212;&#8211; Begin EditContent.php &#8212;&#8212;&#8212;&#8211;<br />
<em>&lt;?<br />
if (!isset($_SESSION['Level'])) exit();<br />
if ($_SESSION['Level']==&#8217;admin&#8217;)<br />
{<br />
some lines of codes only for admin blah blah blah<br />
}<br />
?&gt;</em><br />
&#8212;&#8212;&#8212;&#8211; End EditContent.php &#8212;&#8212;&#8212;&#8211;</p>
<p>You can easily see that EditContent.php is insecure because there is not any session_start() in it and everyone can set $_SESSION['Level']. Just like this: http://[something]/EditContent.php?_SESSION[Level]=admin<br />
Note: php global variables must be on.<br />
&#8212;&#8212;&#8212;&#8211; End Example2 &#8212;&#8212;&#8212;&#8211;</p>
<p>So, you saw that the catastrophic vulnerability can easily create by the bad usage of &#8220;include&#8221; techniques.</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/01/why-using-include-techniques-are-dangerous-for-novice-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Incorrect solution to disable script execution by .htaccess</title>
		<link>http://soroush.secproject.com/blog/2009/01/incorrect-solution-to-disable-script-execution-by-htaccess/</link>
		<comments>http://soroush.secproject.com/blog/2009/01/incorrect-solution-to-disable-script-execution-by-htaccess/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 05:17:08 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Security Articles]]></category>
		<category><![CDATA[Security Posts]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=50</guid>
		<description><![CDATA[I saw some people use this code in &#8220;.htaccess&#8221; to disable script execution: &#60;Files ~ &#8220;(php\.ini&#124;\.htaccess&#124;\.php.?&#124;\.pl&#124;\.cgi&#124;\.spc&#124;\.jsp&#124;\.cfm&#124;\.passwd)$&#8221;&#62; order deny,allow deny from all &#60;/Files&#62; But I think, this code is not secure at all. I bypass it by uploading a file with this name: &#8220;testpage.PhP&#8221;. (I tested it on my web hosting) The problem is: This code [...]]]></description>
			<content:encoded><![CDATA[<p>I saw some people use this code in &#8220;.htaccess&#8221; to disable script execution:</p>
<p style="text-align: left; padding-left: 30px;"><strong><span style="color: #ff0000;"><em>&lt;Files ~ &#8220;(php\.ini|\.htaccess|\.php.?|\.pl|\.cgi|\.spc|\.jsp|\.cfm|\.passwd)$&#8221;&gt;<br />
order deny,allow<br />
deny from all<br />
&lt;/Files&gt;</em></span></strong>
</p>
<p style="text-align: left;">But I think, this code is not secure at all. I bypass it by uploading a file with this name: &#8220;testpage.PhP&#8221;. (I tested it on my web hosting)</p>
<p style="text-align: left;">The problem is:</p>
<p style="text-align: left;"><strong>This code has a case sensitive regular expression.</strong></p>
<p style="text-align: left;">Note: &lt;FilesMatch&gt; is similar to &lt;Files&gt; with this problem</p>
<p style="text-align: left;">One solution: use this code instead of that code:</p>
<p style="text-align: left; padding-left: 30px;"><span style="color: #008000;"><em><strong># secure directory by disabling script execution<br />
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi<br />
Options -ExecCGI</strong></em></span>
</p>
<p style="text-align: left;">Useful links:</p>
<p style="text-align: left;"><a href="http://www.askapache.com/htaccess/using-filesmatch-and-files-in-htaccess.html" target="_blank">http://www.askapache.com/htaccess/using-filesmatch-and-files-in-htaccess.html</a></p>
<p style="text-align: left;"><a href="http://blog.differentpixel.com/archives/198-Lots-of-.htaccess-tips,-tricks-and-hacks.html" target="_blank">http://blog.differentpixel.com/archives/198-Lots-of-.htaccess-tips,-tricks-and-hacks.html</a></p>
<p style="text-align: left;"><a href="http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/" target="_blank">http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/</a></p>
<p style="text-align: left;">
<p style="text-align: left;">Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/01/incorrect-solution-to-disable-script-execution-by-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

