<?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>Security Advancements at the Monastery &#187; Python</title>
	<atom:link href="http://blog.securitymonks.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.securitymonks.com</link>
	<description>Information about developments at the Monastery</description>
	<lastBuildDate>Fri, 03 Sep 2010 05:41:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Scanner for Debian OpenSSL Vulnerability</title>
		<link>http://blog.securitymonks.com/2008/05/22/scanner-for-debian-openssl-vulnerability/</link>
		<comments>http://blog.securitymonks.com/2008/05/22/scanner-for-debian-openssl-vulnerability/#comments</comments>
		<pubDate>Thu, 22 May 2008 23:31:46 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Vulnerability]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/2008/05/22/scanner-for-debian-openssl-vulnerability/</guid>
		<description><![CDATA[By now, you likely have heard about the Debian OpenSSL Vulnerability, found by Luciano Bello.  It was originally announced on May 13th.  What occurred is that code was removed because it caused the Valgrind and Purify tools to produce warnings about the use of uninitialized data in code that was linked to OpenSSL. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://images.eztools.com/?c=todas&#038;q=hackers"><img src="/images/hackers.jpg" alt="Vulnerability" width=150 align="left" /></a>By now, you likely have heard about the <a href="http://nvd.nist.gov/nvd.cfm?cvename=CVE-2008-0166">Debian OpenSSL Vulnerability</a>, found by Luciano Bello.  It was originally announced on May 13th.  What occurred is that code was removed because it caused the <a href="http://valgrind.org">Valgrind</a> and Purify tools to <a href="http://rt.openssl.org/Ticket/Display.html?id=521&#038;user=guest&#038;pass=guest">produce warnings</a> about the use of uninitialized data in code that was linked to OpenSSL.  This change caused only the current process ID to be used for the initial seed, crippling the seeding process for the OpenSSL <a href="http://statmath.wu-wien.ac.at/prng/">PRNG</a>.  To quote the <a href="http://nvd.nist.gov">National Vulnerability Database (NVD)</a>:<br />
<blockquote>OpenSSL 0.9.8c-1 up to 0.9.8g-9 on Debian-based operating systems uses a random number generator that generates predictable numbers, which makes it easier for remote attackers to conduct brute force guessing attacks against cryptographic keys.</p></blockquote>
<p>
Hubert Seiwert, Internet Security Specialist at Westpoint Ltd., released <a href="http://itsecurity.net/">debian_ssh_scan.py</a> on May 16th.  The code does remote check for weak Debian sshd host keys as identified in <a href="http://www.debian.org/security/2008/dsa-1571">CVE-2008-0166</a>.  The fingerprints are taken from keys generated by HD Moore&#8217;s <a href="http://metasploit.com/users/hdm/tools/debian-openssl/">common and uncommon keys</a>.  Mr. Seiwert also used Justin Azoff&#8217;s multi-threading code.  While it is not the only scanner, Mr. Seiwert did a very nice job.
</p>
<p>
For those who might be less familiar with <a href="http://www.python.org">Python</a>, I thought I would walk through getting debian_ssh_scan.py installed.  Most distributions of Linux and Unix have Python installed and with a few additional steps you will be ready to scan your hosts for vulnerabilities.</p>
<h3>Set HTTP_PROXY</h3>
<p>If you need to access the Internet through a proxy server, the HTTP_PROXY environment variables should be set.  This will allow <a href="http://www.gnu.org/software/wget/">wget</a>, Python’s <a href="http://www.python.org/doc/1.5.2p2/lib/module-urllib.html">urllib module</a>, and other applications (yum, apt-get etc) to use this environment variable to access http/https through the proxy server. </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# export HTTP_PROXY="http://&lt;proxy-server-ip>:&lt;port>"
</pre>
</td>
</table>
<p>Replace &#8220;&lt;<em>proxy-server-ip</em>>&#8221; with your proxy server name/ip and &#8220;&lt;<em>port</em>>&#8221; with the proxy&#8217;s port.</p>
<h3>Install setuptools</h3>
<p>The <a href="http://pypi.python.org/pypi/setuptools">setuptools</a> module is a way to allow developers an easy way to build and distribute Python packages in a single-file archive called an &#8220;<a href="http://peak.telecommunity.com/DevCenter/PythonEggs">egg</a>.&#8221;   The steps to get setuptools installed are:</p>
<ol>
<li>Download the appropriate egg for your version of Python (e.g. setuptools-0.6c8-py2.3.egg). Do NOT rename it.</li>
<li>Run it. Setuptools will install itself using the matching version of Python (e.g. python2.3), and will place the easy_install executable in the default location for installing Python scripts (as determined by the standard distutils configuration files, or by the Python installation).</li>
</ol>
<p>To install:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# cd /home/ger/software
# wget http://pypi.python.org/packages/2.3/s/setuptools/setuptools-0.6c8-py2.3.egg
# sh setuptools-0.6c8-py2.3.egg
</pre>
</td>
</table>
<h3>Install paramiko</h3>
<p>The python module <a href="http://www.lag.net/paramiko/">paramiko</a> implements SSH2 protocol for secure (encrypted and authenticated) connections to remote machines.  Below, the <strong>easy_install</strong> executable is used.  The Python module easy_install is bundled with <strong>setuptools</strong> and allows for automatically download, build, install, and management of Python packages.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# cd /home/ger/software
# wget http://www.lag.net/paramiko/download/paramiko-1.7.3.tar.gz
# tar xzf paramiko-1.7.3.tar.gz
# cd paramiko-1.7.3
# easy_install ./
</pre>
</td>
</table>
<h3>Pull Down debian_ssh_scan_v4</h3>
<p>The python script debian_ssh_scan_v4 can now be installed.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# cd /home/ger/software
# wget http://itsecurity.net/debian_ssh_scan_v4.tar.bz2
# bzip2 -cd debian_ssh_scan_v4.tar.bz2 | tar xvf -
 # cd debian_ssh_scan_v4
</pre>
</td>
</table>
<h3>Start Scanning</h3>
<p>You are now ready to start scanning.  The below IP is used only for demonstration purposes.  Use your own site&#8217;s IPs.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
#  ./debian_ssh_scan_v4.py 127.0.0.1:22
201691 fingerprints loaded.
127.0.0.1:22 sshd fingerprint 97382c98fe3d45fa779abd34bb65fb73 VULNERABLE (RSA 2048 bit key, pid 5214)
</pre>
</td>
</table>
<p>Modify  <strong>targets.txt</strong>, if you want to create a file of IPs.  Run the file of IPs through the scan program using the command:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# cat targets.txt | ./debian_ssh_scan_v4.py
</pre>
</td>
</table>
<h3>Final Words</h3>
<p>Debian has issued an update for OpenSSL. For affected systems, the software packages need to be updated and all cryptographic key material must be recreated.  Please see <a href="http://http://www.securityfocus.com/bid/29179/references">Security Focus references</a> for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/05/22/scanner-for-debian-openssl-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

