<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="html">cipherdyne.org | System and Network Security</title>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org"/>
<link rel="self" type="application/atom+xml" href="http://www.cipherdyne.org/atom.xml"/>
<updated>2010-01-07T22:55:03-05:00</updated>
<author>
<name>Michael Rash</name>
<uri>http://www.cipherdyne.org</uri>
</author>
<id>http://www.cipherdyne.org/</id>
<generator uri="http://www.cipherdyne.org" version="3.0">
perl
</generator>

<!-- begin_stories -->
<entry>
<title type="html">Software Release - fwsnort-1.1</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/01/software-release-fwsnort-1.1.html"/>
<id>http://www.cipherdyne.org/blog/2010/01/software-release-fwsnort-1.1.html</id>

<published>2010-01-07T21:01:30-05:00</published>
<updated>2010-01-07T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="/fwsnort">
<img align="right" src="/images/release.png" title="software release fwsnort-1.1" alt="software release fwsnort-1.1" /></link>
The 1.1 release of <link type="text/html" href="/fwsnort">fwsnort</link> is ready for <link type="text/html" href="/fwsnort/download">download</link>.
This is a significant release that adds support for
<link type="text/html" href="http://www.netfilter.org/projects/iptables/index.html">ip6tables</link> so
that SNORT  inspection logic can be applied to IPv6 traffic within the
Linux kernel.  This release also includes a new feature that allows fwsnort
to build perl commands interfaced with netcat that generate packet data that
matches Snort rules (for those that that can be faithfully
translated - see the <b>--include-perl-triggers</b> command line argument
and associated comments within the fwsnort.sh file).
<br/><br/>
Here is the complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwsnort/browser/fwsnort/tags/fwsnort-1.1/ChangeLog">fwsnort-1.1 ChangeLog</link>:
<br/><br/>
<ul>
<li>Added the ability to build an fwsnort policy that utilizes ip6tables
instead of iptables.  This allows fwsnort filtering and altering
capabilities to apply to IPv6 traffic instead of just IPv4 traffic.  To
enable ip6tables usage, use the "-6" or "--ip6tables" command line
arguments.</li>
<li>Added the --include-perl-triggers command line argument so that
translated Snort rules can easily be tested.  This argument instructs
fwsnort to include 'perl -e print ... ' commands as comments in the
/etc/fwsnort/fwsnort.sh script, and these commands can be combined
with netcat to send payloads across the wire that match Snort rules.</li>
<li>Updated fwsnort to create logs in the /var/log/fwsnort/ directory
instead of directly in the /var/log/ directory.  The path is controlled
by a new variable 'LOG_FILE' in the /etc/fwsnort/fwsnort.conf file.</li>
<li>Added several variables in /etc/fwsnort/fwsnort.conf to control paths
to everything from the config file to the snort rules path.  Coupled
with this is the ability to create variables within path components and
fwsnort will expand them (e.g. 'CONF_DIR /etc/fwsnort;
CONF_FILE $CONF_DIR/fwsnort.conf').</li>
<li>Added --Last-cmd arg so that it is easy to rebuild the fwsnort.sh script
with the same command line args as the previous execution.</li>
</ul>

Snort is a registered trademark of <link type="text/html" href="http://www.sourcefire.com">Sourcefire, Inc</link>.
<br/><br/>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">holisticinfosec.org on SPA Ghost Services</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/01/holisticinfosec.org-on-spa-ghost-services.html"/>
<id>http://www.cipherdyne.org/blog/2010/01/holisticinfosec.org-on-spa-ghost-services.html</id>

<published>2010-01-05T21:01:30-05:00</published>
<updated>2010-01-05T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://holisticinfosec.org">
<img align="right" src="/images/holisticinfosec_cropped.png" title="holisticinfosec.org on fwknop" alt="holisticinfosec.org on fwknop" /></link>
<link type="text/html" href="http://holisticinfosec.blogspot.com/">Russ McRee</link> of <link type="text/html" href="http://holisticinfosec.org">holisticinfosec.org</link>
has written the January <link type="text/html" href="http://holisticinfosec.blogspot.com/2010/01/single-packet-authorization-ghost-in.html">Toolsmith</link>
issue from the ISSA Journal about <link type="text/html" href="/fwknop/">fwknop</link> and the ability to create
ghost services with Single Packet Authorization.  In his Toolsmith paper, Russ emphasizes
the possibility of using the ghost services concept to bypass strict outbound network
filtering rules on a local network in order to access an external service that is bound
to a port that is filtered by the local firewall.  That is, the service is made accessible
by having the SPA packet created by the fwknop client request that the remote fwknopd server
create iptables DNAT rules to forward connections to a port that the local network actually
allows out to the port where the service is bound.  Russ uses this concept to access a file
that is piped through a netcat listener on TCP port 6543, but do it from the heavily
filtered network over TCP port 110 (normally associated with pop3).
<br/><br/>
Here is a link to the Toolsmith PDF entitled
"<link type="text/html" href="http://holisticinfosec.org/toolsmith/docs/january2010.html">Single Packet Authorization: The Ghost in the Machine</link>".
<br/><br/>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Creating Ghost Services with Single Packet Authorization</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/11/creating-ghost-services-with-single-packet-authorization.html"/>
<id>http://www.cipherdyne.org/blog/2009/11/creating-ghost-services-with-single-packet-authorization.html</id>

<published>2009-11-29T21:01:30-05:00</published>
<updated>2009-11-29T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="/fwknop/">
<img align="right" src="/images/chinesedoor5.jpg" width="180" height="120" title="Creating Ghost Services with Single Packet Authorization" alt="Creating Ghost Services with Single Packet Authorization" /></link>
Most usages of <link type="text/html" href="/fwknop/docs/SPA.html">Single Packet Authorization</link>
focus on gaining access to a service such
as sshd that is behind a default-drop packet filter.  The point being that anyone
who is scanning for the service cannot even tell that it is listening - let
alone target it with an exploit or an attempt to brute force a password.  This is fine,
but given that firewalls such as iptables offer well designed NAT capabilities, can
a more interesting access model be developed for SPA?  How about accessing sshd
<i>through</i> a port where another service (such as Apache on port 80) is already
bound?  Because iptables operates on packets within kernel space, NAT functions apply
before there is any conflict with a user space application such as Apache.  This
makes it possible to create "ghost" services where a port switches for a short
period of time to whatever service is requested within an SPA packet (e.g. sshd),
but everyone else always just sees the service that is normally bound there (e.g.
Apache on port 80).
<br/><br/>
To illustrate this concept, let's use fwknop from the <b>spaclient</b> system below
to access sshd on the <b>spaserver</b> system, but request the access be granted
through port 80.  Further, on the spaserver system, let's verify that Apache is
running and from the perspective of any scanner out on the Internet this is the only
service that is accessible.  That is, sshd and all other services are firewalled off
by iptables.  We'll assume that the spaclient system has IP 1.1.1.1, the spaserver
system has IP 2.2.2.2, and the scanner system has IP 3.3.3.3.
<br/><br/>

First, let's scan the spaserver system from the scanner system and verify that
only port 80 is accessible:

<br/><br/>
<code>
[scanner]# nmap -P0 -n -sV 2.2.2.2<br/>
<br/>
Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-29 15:14 EST<br/>
Interesting ports on 2.2.2.2:<br/>
Not shown: 999 filtered ports<br/>
PORT    STATE SERVICE VERSION<br/>
80/tcp  open  http    Apache httpd 2.2.8 ((Ubuntu) mod_python/3.3.1 Python/2.5.2)<br/>
<br/>
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .<br/>
Nmap done: 1 IP address (1 host up) scanned in 90.94 seconds
</code>
<br/><br/>

Good.  Now, from the spaclient system, let's fire up fwknop and request access to
sshd on the spaserver system.  But instead of just gaining access to port 22, we'll
request access to port 22 via port 80 - the fwknopd daemon will build the
appropriate DNAT iptables rules to make this work:

<br/><br/>
<code>
[spaclient]$ fwknop -A tcp/22 --NAT-access 2.2.2.2:80 --NAT-local -a 1.1.1.1 -D 2.2.2.2<br/>
<br/>
[+] Starting fwknop client (SPA mode)...<br/>
[+] Enter an encryption key. This key must match a key in the file<br/>
    /etc/fwknop/access.conf on the remote system.<br/>
<br/>
Encryption Key:<br/>
<br/>
[+] Building encrypted Single Packet Authorization (SPA) message...<br/>
[+] Packet fields:<br/>
<br/>
        Random data:    3829970026924871<br/>
        Username:       mbr<br/>
        Timestamp:      1259526613<br/>
        Version:        1.9.12<br/>
        Type:           5   (Local NAT access mode)<br/>
        Access:         0.0.0.0,tcp/22<br/>
        NAT access:     2.2.2.2,80<br/>
        SHA256 digest:  Om/GsIVQIRyAp6UWyqjXVqlEQhxz+lVsQhCl1rFBfuI<br/>
<br/>
[+] Sending 182 byte message to 2.2.2.2 over udp/62201...<br/>
    Requesting NAT access to tcp/22 on 2.2.2.2 via port 80<br/>

</code>
<br/><br/>

With the receipt of the SPA packet, the fwknopd daemon has reconfigured iptables
to allow an ssh connection through port 80 from the spaclient IP 1.1.1.1 (note
the "<b>-p 80</b>" argument on the ssh command line):

<br/><br/>
<code>
[spaclient]$ ssh -p 80 -l mbr 2.2.2.2<br/>
mbr@2.2.2.2's password:<br/>
[spaserver]$
</code>
<br/><br/>

If we can the spaserver again from the scanner system, we still only see
Apache:

<br/><br/>
<code>
[scanner]# nmap -P0 -n -sV 2.2.2.2<br/>
<br/>
Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-29 15:29 EST<br/>
Interesting ports on 2.2.2.2:<br/>
Not shown: 999 filtered ports<br/>
PORT    STATE SERVICE VERSION<br/>
80/tcp  open  http    Apache httpd 2.2.8 ((Ubuntu) mod_python/3.3.1 Python/2.5.2)<br/>
<br/>
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .<br/>
Nmap done: 1 IP address (1 host up) scanned in 89.22 seconds
</code>
<br/><br/>

So, the IP 1.1.1.1 has access to sshd, but all the scanner can ever see is
'Apache httpd 2.2.8'.
<br/><br/>
A legitimate question at this point is 'why is this useful?'.  Well, I have been
on networks before where local access controls only allowed outbound DNS, HTTP
and HTTPS traffic, so this technique allows ssh connections to be made in a
manner that is consistent with these access controls.  (This assumes that HTTP
connections are not made through a proxy, and that the fwknopd daemon is
configured to sniff SPA packets over port 53.)  Further, to anyone who is able to
sniff traffic, it can be hard to figure out what is really going on in terms
of SPA packets and associated follow-on connections.  This is especially
true when other tricks such as
<link type="text/html" href="/blog/2008/06/single-packet-authorization-with-port-randomization.html">
port randomization</link> are also applied.
<br/><br/>
I demonstrated the service ghosting technique at
<link type="text/html" href="http://www.dojocon.org/">DojoCon</link> a few weeks ago, and
the video of this is available <link type="text/html" href="http://www.ustream.tv/recorded/2505225">here</link>
(towards the end of the video).


</p>
</div>
</content>
</entry>

<entry>
<title type="html">Speaking at the SANS Incident Detection Summit</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/11/speaking-at-the-sans-incident-detection-summit.html"/>
<id>http://www.cipherdyne.org/blog/2009/11/speaking-at-the-sans-incident-detection-summit.html</id>

<published>2009-11-24T21:01:30-05:00</published>
<updated>2009-11-24T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://www.sans.org/incident-detection-summit-2009/">
<img align="right" src="/images/sans_logo.gif" title="speaking at SANS Incident Detection Summit" alt="speaking at SANS Incident Detection Summit" /></link>
At the upcoming <link type="text/html" href="http://www.sans.org/incident-detection-summit-2009/">
SANS Incident Detection Summit</link> on December 9th and 10th I will be participating
in two panel discussions.  The first is entitled "<b>Enterprise Network Detection
Tools and Tactics</b>" and is described by <link type="text/html" href="http://taosecurity.blogspot.com">Richard Bejtlich</link>
(who has organized the whole conference) as a venue where "speakers with large-scale
experience will share their tools and tactics for identifying suspicious and malicious
activity".  The second, "<b>Detection Using Logs</b>", focuses on the usage of platform,
operating system, and application logs to detect intrusions, and Security Information
Management and log aggregation and search systems will be discussed.
<br/><br/>
If you are going to be at the conference, please say hello!

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Speaking at DojoCon</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/09/speaking-at-dojocon.html"/>
<id>http://www.cipherdyne.org/blog/2009/09/speaking-at-dojocon.html</id>

<published>2009-09-10T21:01:30-05:00</published>
<updated>2009-09-10T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://www.dojocon.org">
<img align="right" src="/images/dojocon_logo.png" title="speaking at DojoCon" alt="speaking at DojoCon" /></link>
<b>UDPATE</b>:  The talk slides can be downloaded
<link type="text/html" href="/talks/Michael_Rash_SPA_DojoCon_2009.pdf">here</link> and a video of the
talk is <link type="text/html" href="http://www.ustream.tv/recorded/2505225">available</link> too.
<br/><br/>
On Friday November 6th I will be giving a talk on Single Packet Authorization with
fwknop at the upcoming <link type="text/html" href="http://www.dojocon.org">DojoCon</link> conference at
Capitol College in Laurel, MD.  This talk will focus on some recent developments
in the world of fwknop development and the resulting enhancements to SPA capabilities.
Topics to be emphasized include:
<br/><br/>
<ul>
<li>
The new <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop-c">libfko</link> C implementation
and what it means for SPA deployments.</li>
<li>Interface monitoring for administrative control changes and increasing packet
counts.  This adds an extra dimension of reliability for fwknopd server operations.</li>
<li>HTTP proxy support, as well as the development of an SSL web gateway for
sending SPA packets on behalf of client systems that cannot construct SPA packets
themselves.</li>
<li>Development efforts for future fwknop features (such as additional client
integration, and deployments on embedded Linux distributions).</li>
</ul>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Software Release - fwknop-1.9.12</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/09/software-release-fwknop-1.9.12.html"/>
<id>http://www.cipherdyne.org/blog/2009/09/software-release-fwknop-1.9.12.html</id>

<published>2009-09-08T21:01:30-05:00</published>
<updated>2009-09-08T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="/fwknop">
<img align="right" src="/images/release.png" title="software release fwknop-1.9.12" alt="software release fwknop-1.9.12" /></link>
The 1.9.12 release of <link type="text/html" href="/fwknop">fwknop</link> is ready for <link type="text/html" href="/fwknop/download">download</link>.
This is a significant release that moves by default to the new
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop-c/browser/trunk/lib">libfko</link>
and the new FKO module for SPA encryption and decryption.  Other new features
include interface monitoring for the fwknopd daemon so it can survive
administrative changes due to things like a DHCP address changes, and the
ability to send SPA packets through HTTP proxies.
<br/><br/>
An excerpt from the
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.12/ChangeLog">1.9.12 ChangeLog</link>
appears below:
<br/><br/>
<ul>
<li>Fully integrated the FKO module that is part of the libfko library for
all SPA routines - encryption/decryption, digest calculation, replay
attack detection, etc.  The default is to always use the FKO module if
it has been installed, but the original perl code remains intact as well
just in case FKO does not exist on the local system.  The libfko code
can be viewed with Trac <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop-c">here</link>
</li>
<li>Added the ability to recover from interface error conditions, such as
when fwknopd sniffs a ppp interface (say, associated with a VPN) that
goes away and then is recreated.  In previous versions of fwknop, this
would result in the fwknopd daemon no longer able to receive SPA
packets.  This new functionality is controlled by five new configuration
variables in the fwknop.conf file: ENABLE_INTF_CHECKS,
INTF_CHECKS_INTERVAL, ENABLE_INTF_EXISTS_CHECK,
ENABLE_INTF_RUNNING_CHECK, and ENABLE_INTF_BYTES_CHECK.  By default, all
of these checks are enabled and are run every 20 seconds by the knoptm
daemon.  If any check fails, then knoptm stops the fwknopd daemon once
the error condition is corrected (such as when the interface comes back)
so that knopwatchd will then restart it.  The fwknopd daemon cannot
receive packet data until the error condition is cleared (most likely
except perhaps for the "RUNNING" check, but restarting the fwknopd
daemon is better than not being able to access a service).</li>
<li>Updated the fwknop client to include the SPA destination before DNS
resolution when sending an SPA packet over an HTTP request.  This allows
more flexible Apache configurations with virtual web hosts to function
properly with HTTP requests that contain SPA packet data.  Also updated
the fwknop client to include a leading "/" in SPA packets over HTTP, and
updated the fwknopd server to strip this out before attempting SPA
packet decryption.</li>
<li>Updated the fwknop client to resolve external IP addresses (with the -R
argument) <link type="text/html" href="http://www.whatismyip.com/automation/n09230945.asp">here</link>
by default.
</li>
<li>(Jonathan Bennett): Submitted patch to the fwknop client to add HTTP
proxy support when sending SPA packets over HTTP.  The result is a new
--HTTP-proxy option that expects the proxy host to be given as
"http://HOST", and it also supports the "http://HOST:PORT" notation as
well.</li>
</ul>


</p>
</div>
</content>
</entry>

<entry>
<title type="html">Google Indexing of Trac Repositories</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/09/google-indexing-of-trac-repositories.html"/>
<id>http://www.cipherdyne.org/blog/2009/09/google-indexing-of-trac-repositories.html</id>

<published>2009-09-06T21:01:30-05:00</published>
<updated>2009-09-06T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://trac.edgewall.org/">
<img align="right" src="/images/trac_logo.png" title="Google Trac Indexing" alt="Google Trac Indexing" /></link>
There has been a Trac repository available on <link type="text/html" href="http://trac.cipherdyne.org">trac.cipherdyne.org</link>
since 2006, and in that time I've collected quite a lot of Apache log data.  Today, the
average number of hits per day against the fwknop, psad, fwsnort, and gpgdir Trac
repositories combined is over 40,000.  These hits come mostly from search engine
crawlers such as <b>Googlebot/2.1</b>, <b>msnbot/2.0b</b>, <b>Baiduspider+</b>,
and <b>Yahoo! Slurp/3.0;</b>.  However, not all such crawlers are created equal.  It
turns out that Google is far and away the most dedicated indexer of the
cipherdyne.org Trac repositories, and to me this is somewhat surprising considering
the reputation Google has for efficiently crawling the web.  That is, I would have
expected that the non-Google crawlers would most likely hit the Trac repositories
on average more often than Google.  But perhaps Google is extremely interested in
getting the latest code made available via Trac indexed as quickly as possible, and
for svn repositories that are made accessible only via Trac (such as the
cipherdyne.org repositories), perhaps brute force indexing of all possible links in
Trac is better.  Or, perhaps the other search engines are simply not as interested
in code within Trac repositories so they don't bother to aggressively index it, or
maybe they are just not very thorough when compared to Google.
<br/><br/>
Let's see some examples.  The following graphs are produced with the
<link type="text/html" href="http://www.mrunix.net/webalizer/">webalizer</link> project.  This graph
shows the uptick in hits against Trac shortly after it was first made available
in 2006:
<img src="/images/webalizer2006.png" title="cipherdyne 2006 Trac usage" alt="cipherdyne 2006 Trac usage" />
So, the average number of hits goes from 803 starting out in May and jumps rapidly
to nearly 17,000 in December.  Here are the top five User-Agents and associated hit
counts:
<br/><br/>

<table class="ctable" cellspacing="1" cellpadding="1">
<tr><td>Hits</td><td>Percentage</td><td>User-Agent</td></tr>
<tr><td><b>5062</b></td><td>37.06%</td><td><b>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</b></td></tr>
<tr><td><b>5004</b></td><td>36.63%</td><td><b>noxtrumbot/1.0 (crawler@noxtrum.com)</b></td></tr>
<tr><td><b>1283</b></td><td>9.39%</td><td><b>msnbot/0.9 (+http://search.msn.com/msnbot.htm)</b></td></tr>
<tr><td><b>475</b></td><td>3.48%</td><td><b>Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060418...</b></td></tr>
<tr><td><b>457</b></td><td>3.35%</td><td><b>Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20051229...</b></td></tr>
</table>
<br/>

Right off the bat Google is the top crawler, but only just barely.  In December,
this changes to the following:
<br/><br/>
<table class="ctable" cellspacing="1" cellpadding="1">
<tr><td>Hits</td><td>Percentage</td><td>User-Agent</td></tr>
<tr><td><b>478063</b></td><td>90.94%</td><td><b>Mozilla/5.0 (compatible; Googlebot/2.1; ...</b></td></tr>
<tr><td><b>11299</b></td><td>2.15%</td><td><b>Mozilla/5.0 (compatible; BecomeBot/3.0; ...</b></td></tr>
<tr><td><b>8287</b></td><td>1.58%</td><td><b>msnbot-media/1.0 (+http://search.msn.com/msnbot.htm)</b></td></tr>
<tr><td><b>6423</b></td><td>1.22%</td><td><b>Mozilla/5.0 (compatible; Yahoo! Slurp; ...</b></td></tr>
<tr><td><b>4029</b></td><td>0.77%</td><td><b>Mozilla/2.0 (compatible; Ask Jeeves/Teoma; ...</b></td></tr>
</table>
<br/>

Now things are drastically different - Google's crawler now accounts for over 90%
of all hits against Trac, and has created over 42 times the number of hits from the
second place crawler "<b>BecomeBot/3.0</b>" (a shopping-related crawler - maybe
they like the price of "zero" for the cipherdyne.org projects).
<br/><br/>

Let's fast forward to 2009 and take a look at how things are shaping up (note that
data from 2008 is not included in this graph):
<img src="/images/webalizer2009.png" title="cipherdyne 2009 Trac usage" alt="cipherdyne 2009 Trac usage" />

The month of May was certainly an aberration with over 56,000 hits per day, and August
topped out at 42,000 hits per day.  In May, the top five crawlers were:

<br/><br/>
<table class="ctable" cellspacing="1" cellpadding="1">
<tr><td>Hits</td><td>Percentage</td><td>User-Agent</td></tr>
<tr><td><b>1510435</b></td><td>86.14%</td><td><b>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</b></td></tr>
<tr><td><b>73740</b></td><td>4.21%</td><td><b>Mozilla/5.0 (compatible; DotBot/1.1; http://www.dotnetdotcom.org/</b></td></tr>
<tr><td><b>33482</b></td><td>1.91%</td><td><b>Mozilla/5.0 (compatible; Charlotte/1.1; http://www.searchme.com/support/)</b></td></tr>
<tr><td><b>22699</b></td><td>1.29%</td><td><b>Mozilla/5.0 (compatible; Yahoo! Slurp/3.0; ...</b></td></tr>
<tr><td><b>20980</b></td><td>1.20%</td><td><b>Mozilla/5.0 (compatible; MJ12bot/v1.2.4; ...</b></td></tr>
</table>
<br/>

Google maintains a crawling rate of over 20 times as many hits as the second place
crawler "<b>DotBot/1.1</b>".  In August, 2009 (some of the most recent data), the
crawler hit counts were:

<br/><br/>
<table class="ctable" cellspacing="1" cellpadding="1">
<tr><td>Hits</td><td>Percentage</td><td>User-Agent</td></tr>
<tr><td><b>947703</b></td><td>86.02%</td><td><b>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</b></td></tr>
<tr><td><b>43876</b></td><td>3.98%</td><td><b>msnbot/2.0b (+http://search.msn.com/msnbot.htm)</b></td></tr>
<tr><td><b>30951</b></td><td>2.81%</td><td><b>Mozilla/5.0 (compatible; DotBot/1.1; http://www.dotnetdotcom.org/</b></td></tr>
<tr><td><b>11578</b></td><td>1.05%</td><td><b>Mozilla/5.0 (compatible; Yahoo! Slurp/3.0; ...)</b></td></tr>
<tr><td><b>10880</b></td><td>0.99%</td><td><b>msnbot/1.1 (+http://search.msn.com/msnbot.htm)</b></td></tr>
</table>
<br/>

This time "<b>msnbot/2.0b</b>" makes it to second place, but it is still far behind
Google in terms of hit counts.  So, what is Google looking at that needs so many hits?
One clue perhaps is that Google likes to re-index older data (probably to ensure that
a content update has not been missed).  Here is an example of all hits against a link
that contains the "diff" formated output for <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/changeset/353">changeset 353</link>
in the <link type="text/html" href="/fwknop">fwknop</link> project.  The output is organized by each year
since 2006, and the first command counts the number of hits from Google, and the second
command shows all of the non-Googlebot hits:
<br/><br/>
<code>
[trac.cipherdyne.org]$ for f in 200*; do echo $f; grep diff $f/trac_access* |grep "/trac/fwknop/changeset/353" | grep Googlebot |wc -l; done<br/>
2006<br/>
6<br/>
2007<br/>
4<br/>
2008<br/>
6<br/>
2009<br/>
2<br/>
<br/>
[trac.cipherdyne.org]$ for f in 200*; do echo $f; grep diff $f/trac_access* |grep "/trac/fwknop/changeset/353" | grep -v Googlebot ; done<br/>
2006<br/>
74.6.74.211 - - [10/Oct/2006:07:38:21 -0400] "GET /trac/fwknop/changeset/353?format=diff HTTP/1.0" 200 - "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)"<br/>
205.209.170.161 - - [19/Nov/2006:14:17:57 -0500] "GET /trac/fwknop/changeset/353?format=diff HTTP/1.1" 200 - "-" "MJ12bot/v1.0.8 (http://majestic12.co.uk/bot.php?+)"<br/>
2007<br/>
2008<br/>
38.99.44.102 - - [27/Dec/2008:17:51:34 -0500] "GET /trac/fwknop/changeset/353/?format=diff&amp;new=353 HTTP/1.0" 200 - "-" "Mozilla/5.0 (Twiceler-0.9 http://www.cuil.com/twiceler/robot.html)"<br/>
2009<br/>
208.115.111.250 - - [14/Jul/2009:20:42:32 -0400] "GET /trac/fwknop/changeset/353?format=diff&amp;new=353 HTTP/1.1" 200 - "-" "Mozilla/5.0 (compatible; DotBot/1.1; http://www.dotnetdotcom.org/, crawler@dotnetdotcom.org)"<br/>
208.115.111.250 - - [28/Jun/2009:10:00:32 -0400] "GET /trac/fwknop/changeset/353?format=diff&amp;new=353 HTTP/1.1" 200 - "-" "Mozilla/5.0 (compatible; DotBot/1.1; http://www.dotnetdotcom.org/, crawler@dotnetdotcom.org)"
</code>
<br/><br/>

So, Google keeps hitting the "changeset 353" link multiple times each year, whereas
the other crawlers (except for DotBot) each hit the link once and never came back.
Further, many crawlers have not hit the link at all, so perhaps they are not
nearly as thorough as Google.
<br/><br/>
A few questions come to mind to conclude this blog post.  Please
<link type="text/html" href="/contact.html">contact me</link> if you would like to discuss any of these:

<ul>
<li>For any other people out there who also run Trac, what crawlers have you seen
in your logs, and does Google stand out as a more dedicated indexer than the
other crawlers?</li>
<li>For anyone who runs Trac but also makes the svn repository directly accessible,
does Google continue to aggressively index Trac?  Does the svn access imply that
whatever code is versioned within is used as a more authoritative source than
Trac itself?</li>
<li>It would seem that any crawler could implement an optimization around the
Trac <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/timeline">timeline</link> feature
so that source code change links are indexed only when a timeline update is made.
But, perhaps this is too detailed for crawlers to worry about?  It would
require additional machinery to interpret the Trac application, so
search engines most likely try to avoid such customizations.</li>
<li>Why do the non-Google crawlers lag so far behind in terms of hit counts?
Are the differences in resources that Google can bring to bear on crawling the
web vs. the other search engines so great that the others just cannot keep up?
Or, maybe the others are just not so interested in code that is made available
in Trac?</li>
</ul>


</p>
</div>
</content>
</entry>

<entry>
<title type="html">Software Release - gpgdir-1.9.5</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/09/software-release-gpgdir-1.9.5.html"/>
<id>http://www.cipherdyne.org/blog/2009/09/software-release-gpgdir-1.9.5.html</id>

<published>2009-09-05T21:01:30-05:00</published>
<updated>2009-09-05T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="/gpgdir">
<img align="right" src="/images/release.png" title="software release gpgdir-1.9.5" alt="software release gpgdir-1.9.5" /></link>
The 1.9.5 release of <link type="text/html" href="/gpgdir">gpgdir</link> is ready for <link type="text/html" href="/gpgdir/download">download</link>.
This release adds support for decrypting files that have been encrypted with PGP
(so they have the <b>.pgp</b> file extension).  This feature was essentially
implemented for free in gpgdir because GnuPG along with the GnuPG::Interface
perl module can decrypt PGP-encrypted files.  Here is an example:
<br/><br/>
<code>
$ cd dir<br/>
$ find . -type f<br/>
./file0.pgp<br/>
./file5.pgp<br/>
./subdir2/file8.pgp<br/>
./subdir2/file7.pgp<br/>
./subdir1/file6.pgp<br/>
./file4.pgp<br/>
./file3.pgp<br/>
./file2.pgp<br/>
./file1.pgp<br/>
$ gpgdir -d .<br/>
[+] Executing: gpgdir -d .<br/>
    Using GnuPG key: ABCD1234<br/>
Password:<br/>
<br/>
[+] Decrypting files in directory: /home/mbr/tmp/dir<br/>
[+] Building file list...<br/>
[+] Decrypting:  /home/mbr/tmp/dir/file3.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/subdir2/file8.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/subdir2/file7.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/subdir1/file6.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/file1.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/file2.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/file5.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/file4.pgp<br/>
[+] Decrypting:  /home/mbr/tmp/dir/file0.pgp<br/>
<br/>
[+] Total number of files decrypted: 9<br/>
<br/>
$ !find<br/>
find . -type f<br/>
./file4<br/>
./file3<br/>
./file5<br/>
./subdir2/file8<br/>
./subdir2/file7<br/>
./subdir1/file6<br/>
./file1<br/>
./file2<br/>
./file0
</code>
<br/><br/>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Morpheus-fwknop Windows UI update</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/08/morpheus-fwknop-windows-ui-update.html"/>
<id>http://www.cipherdyne.org/blog/2009/08/morpheus-fwknop-windows-ui-update.html</id>

<published>2009-08-05T21:01:30-05:00</published>
<updated>2009-08-05T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>

The speed at which the open source software movement develops new code is
frequently quite impressive, and people crank out higher levels of production
when they do something they really like to work on.  This remains true for
the new Morpheus-fwknop Windows UI written by Daniel Lopez, and a new release
(0.7) of Morpheus is <link type="text/html" href="http://sourceforge.net/projects/morpheus-fwknop/">now
available</link> from Sourceforge.  The release notes for 0.7 read as follows:
<br/><br/>
<ul>
<li>Implement PGP Encryption.</li>
<li>Allow to Open multiple port on Forward/Nat Local mode.</li>
<li>New UI with a little more color.</li>
<li>Launch an Application after sending the SPA Packet.</li>
</ul>

Here are a couple of screenshots of Morpheus in action.  The look and feel
has changed quite a bit from the previous release.

<img src="/images/Morpheus_0.7_screenshot1.JPG" title="morpheus-fwknop 0.7" alt="morpheus-fwknop 0.7" />
<img src="/images/Morpheus_0.7_screenshot2.JPG" width="600" height="510" title="morpheus-fwknop 0.7" alt="morpheus-fwknop 0.7" />


</p>
</div>
</content>
</entry>

<entry>
<title type="html">Nmap-5.00, Zenmap, and ndiff</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/07/nmap-5.00-zenmap-and-ndiff.html"/>
<id>http://www.cipherdyne.org/blog/2009/07/nmap-5.00-zenmap-and-ndiff.html</id>

<published>2009-07-30T21:01:30-05:00</published>
<updated>2009-07-30T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>

<link type="text/html" href="http://www.insecure.org">
<img align="right" src="/images/nmap_logo.gif" title="Nmap-5.00" alt="Nmap-5.00" /></link>
Fyodor recently released
<link type="text/html" href="http://nmap.org/5/">Nmap-5.00</link>, and this release marks a major
milestone in Nmap development as it is now quite mature, has a large
following, and is feature rich.  With Nmap, service discovery and
interrogation has never been easier or more automated, and for me
Nmap provided much of the inspiration to develop psad (scan
detection via iptables log messages) and fwknop (hide services
from all types of scans behind a default-drop packet filter with
Single Packet Authorization).
<br/><br/>
Some of the more interesting Nmap features these days include the
Nmap Scripting Engine (NSE), the Zenmap user interface, and ndiff.  The NSE is
an Nmap extension that allows users to express networking tasks via
the <link type="text/html" href="http://www.lua.org">Lua embedded programming language</link>,
and the resulting scripts are executed via Nmap against targeted
systems.  As an example of some of the power that NSE provides, a
recent <link type="text/html" href="http://seclists.org/nmap-dev/2009/q1/0869.html">update</link> allows
Nmap to interrogate a system in order to see if it is infected with the Conficker worm.
<br/><br/>
Zenmap provides a nice graphical interface to point and click Nmap
scanning, complete with interactive editing of Nmap command line
arguments, scan results display with context sensitive text colors,
and even a network topology viewer to represent scan targets.  The
screenshot below illustrates the scan results view of a scan against
a Netgear router:
<link type="text/html" href="/images/zenmap_scan.png"><img src="/images/zenmap_scan.png" title="zenmap scan view" alt="zenmap scan view" height="450" width="600" /></link>
<br/><br/>
An excellent example of the topology view in Zenmap can be found
<link type="text/html" href="http://nmap.org/5/screenshots/zenmap-5-topology-885x793.png">here</link>.
<br/><br/>
With the new Nmap release, some questions the security community may
ask include:
<br/><br/>
<ul>
<li>Will scan activity significantly increase?  Most likely there will
be a burst of scanning over the next few weeks as people adopt and
experiment with the new release - especially after the
<link type="text/html" href="http://tech.slashdot.org/story/09/07/16/1924232">broad</link>
<link type="text/html" href="http://www.securityfocus.com/brief/988">news</link> coverage Nmap is getting.</li>
<li>By direct examination of network traffic Is it possible to differentiate
Nmap-5.00 scans from those that originate from older versions?  My guess
is most likely not, but a source code diff from older versions should
make this clear.</li>
<li>Does the new release imply that the Conficker worm will accelerate
its decline as more scans are made to find infected systems?  Note
that Conficker seems to already be on the decline
<link type="text/html" href="https://www.honeynet.org/node/461">by one measure</link>.</li>
</ul>
Finally, I wonder if ndiff will change how people use Nmap in the long run?
It is great to have accurate scan information about a target, but it is
even better to see how this information changes over time.  For example,
if a system is compromised and is forced to stand up a new backdoor service,
then this will cause a "blip" in ndiff results if this system is the target
of regular Nmap scans.  Or, if a broad policy change is made in a router
ACL or firewall rule set, then this can result in broad ndiff changes too.
Another example might be if a networked application is upgraded such that
it advertises itself differently from one scan to the next (say, via a banner
such as "<b>Apache/2.2.11 (Ubuntu) Server at localhost Port 80</b>"), ndiff
might alert you more effectively than other techniques (this assumes that
you have enabled version scanning).
<br/><br/>
On a technical note, it is possible to introduce false positives into
ndiff output if the Nmap command line is altered from one diff to the
next.  Suppose that scans for a particular UDP service seem to finish
fairly quickly and reliably because the target returns an ICMP
port unreachable message (indicating that the service is not filtered).
But, in the interest of speeding scans up further, suppose the
<b>--max-rtt-timeout</b> argument is used on the Nmap command line,
and suppose that timeout is reduced too far.  In this case, through no
fault of its own, Nmap would report the service as <b>filtered</b>
because the ICMP port unreachable message returned after the reduced
timer had already expired.  If the before and after Nmap scan results
are compared, ndiff would report the difference even though the user
is responsible for creating it.  Nmap is doing its job though, and
changing how Nmap is invoked for automated scans is probably not very
common.  At least, over time the way Nmap is invoked would average
out to the same.  The main goal of comparing scan results is wonderfully automated
by ndiff, and is a powerful mechanism for seeing how network service
availability changes over time.
<br/><br/>
Congratulations to Fyodor and the Nmap developers on a great release.

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Software Releases - libfko and morpheus-fwknop</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/07/software-releases-libfko-and-morpheus-fwknop.html"/>
<id>http://www.cipherdyne.org/blog/2009/07/software-releases-libfko-and-morpheus-fwknop.html</id>

<published>2009-07-29T21:01:30-05:00</published>
<updated>2009-07-29T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>

<link type="text/html" href="/fwknop/">
<img align="right" src="/images/release.png" title="libfko and morpheus-fwknop" alt="libfko and morpheus-fwknop" /></link>
This past week one a good one for Single Packet Authorization with two software
releases.  First, an initial version of <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop-c">libfko</link>, the
all C implementation of SPA developed by Damien Stuart can be
<link type="text/html" href="http://www.cipherdyne.org/fwknop/download/fwknop-c-0.62.tar.gz">downloaded</link>
along with <link type="text/html" href="http://www.cipherdyne.org/fwknop/download/libfko.pdf">documentation</link>.
The libfko library allows other programs to easily implement the SPA
protocol, and a new C client is bundled with fwknop-c-0.62 as well as a
new perl module "FKO" that implements a perl XS extension of libfko
functions.  Once the fwknopd server piece is also developed (a new
replacement fwknop C client is included, but not a replacement for
fwknopd yet), the libfko code will allow SPA to easily be extended to
systems where perl is either not installed or cannot be run (due to
hardware constraints such as small routers running OpenWRT).
<br/><br/>
fwknop-c follows the standard autoconf method of installing open source
software, so just:
<br/><br/>
<code>
$ ./configure --prefix=/usr &amp;&amp; make<br/>
$ su<br/>
# make install
</code>
<br/><br/>
The new fwknop-c client can be found at /usr/bin/fwknop once you have
installed per the above, and all important options are supported
similarly to the perl fwknop client.  So, the familiar commands like:
<br/><br/>
<code>
$ fwknop -A tcp/22 -R -D &lt;host_or_ip&gt;
</code>
<br/><br/>
should work just the same.  A few of the command line arguments have
been changed in the C version, and by default the output on stdout is
reduced (just use -v to change this).
<br/><br/>
Second, a new project called <link type="text/html" href="http://sourceforge.net/projects/morpheus-fwknop/">morpheus-fwknop</link>
was developed and released by Daniel Lopez.  This project is a Windows UI written in
.NET to send SPA packets that fwknopd can decrypt.  With <b>morpheus-fwknop</b>,
there is no need to install Cygwin in order to access services protected
by SPA from Windows.  This is the first viable UI to succeed Sean Greven's
UI developed in Delphi (which still works too!), and morpheus-fwknop is
released under the GPL.  Naturally, source code can be
<link type="text/html" href="http://sourceforge.net/projects/morpheus-fwknop/files/0.5.3494.26692/Morpheus%20-%200.5.3494.26692%20-%20Source.zip/download">downloaded</link>, and here are two screenshots
that show the look and feel:
<img src="/images/Morpheus_0.5_screenshot1.JPG" title="morpheus-fwknop in action" alt="morpheus-fwknop in action" />
<img src="/images/Morpheus_0.5_screenshot2.JPG" title="morpheus-fwknop in action" alt="morpheus-fwknop in action" />

It is excellent to see work going on in the world of user interfaces to fwknop
and SPA.  Without an effective UI on Windows, a large user base is effectively
cut off.


</p>
</div>
</content>
</entry>

<entry>
<title type="html">iptables Script Update - Logging and IPv6 Issues</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/07/iptables-script-update-logging-and-ipv6-issues.html"/>
<id>http://www.cipherdyne.org/blog/2009/07/iptables-script-update-logging-and-ipv6-issues.html</id>

<published>2009-07-29T21:01:30-05:00</published>
<updated>2009-07-29T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>

<link type="text/html" href="http://www.nostarch.org">
<img align="right" src="/images/nostarchpress.gif" title="ipv6 traffic vs. iptables" alt="ipv6 traffic vs. iptables" /></link>
Recently, Bobby Krupczak, a reader of "<link type="text/html" href="http://www.nostarch.com/firewalls_mr.htm">Linux Firewalls</link>"
pointed out to me that the <link type="text/html" href="/LinuxFirewalls/ch01/iptables.sh.tar.gz">iptables script</link> used in the book does
not log traffic over the loopback interface, and that such traffic is also blocked
because of the INPUT and OUTPUT policies of "DROP" (instead of having a separate DROP rule). This
should be made more clear in the book.  Quite right - all logging is excluded for traffic that
is sent or received over the loopback interface, and the iptables policy also
drops loopback traffic because no ACCEPT rule exists.  The lack of a logging rule
is mostly because logging traffic generated locally and restricted to the loopback interface
is usually a distraction from logging more important (and potentially malicious)
traffic from remote networks.  However, if a local process seems to have
connectivity issues, then making sure that loopback traffic flows unimpeded is
important.  The <b>iptables.sh</b> script has been updated to ACCEPT all loopback
traffic handled by the INPUT and OUTPUT chains.
<br/><br/>
On another note, I would also like to mention that the script has been updated
to block IPv6 traffic altogether.  With more networks routing IPv6 these days,
and with things like <link type="text/html" href="http://www.ipv6.com/articles/general/US_Government_IPv6.htm">
Federal mandates</link> for IPv6 compliance on Federal networks, IPv6 adoption
is... still slow.  However, Linux has had the ability to speak IPv6 for a long
time, and Nmap can scan for IPv6-enabled services.  Hence it is important to
apply iptables controls to IPv6 traffic via <b>ip6tables</b>.  The consequences
of not doing this could be a system compromise via a service that can
communicate over IPv6, but that is normally firewalled off in the IPv4 world.
<br/><br/>
Here is an example of scanning <b>::1</b> on an Ubuntu-9.04 system with Nmap
without any ip6tables controls applied.  Note that three important services are
available over IPv6:
<br/><br/>
<code>
[root@isengard ~]#  nmap -6 -P0 ::1<br/>
<br/>
Starting Nmap 5.00 ( http://nmap.org ) at 2009-07-28 21:10 EDT<br/>
Interesting ports on ip6-localhost (::1):<br/>
Not shown: 997 closed ports<br/>
PORT   STATE SERVICE<br/>
22/tcp open  ssh<br/>
53/tcp open  domain<br/>
80/tcp open  http<br/>
<br/>
Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds<br/>
<br/>
</code>
<br/><br/>
With the <link type="text/html" href="/LinuxFirewalls/ch01/iptables.sh.tar.gz">updated iptables script</link>
deployed, Nmap no longer sees these services.
<br/><br/>
Have you checked the output of <b>ip6tables -v -nL | grep DROP</b> lately on your
Linux system?  If you are running a different operating system, are you
confident that IPv6 traffic is being filtered appropriately?
<br/><br/>
<code>
[root@isengard ~]#  ip6tables -v -nL | grep DROP<br/>
Chain INPUT (policy DROP 0 packets, 0 bytes)<br/>
Chain FORWARD (policy DROP 0 packets, 0 bytes)<br/>
Chain OUTPUT (policy DROP 0 packets, 0 bytes)
</code>
<br/><br/>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">OpenSSH Vulnerability Rumor</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/07/openssh-vulnerability-rumor.html"/>
<id>http://www.cipherdyne.org/blog/2009/07/openssh-vulnerability-rumor.html</id>

<published>2009-07-08T21:01:30-05:00</published>
<updated>2009-07-08T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>

<link type="text/html" href="/fwknop/">
<img align="right" src="/images/chinesedoor.jpg" title="Protect OpenSSH with fwknop" alt="Protect OpenSSH with fwknop" height="200" width="133" /></link>
<b>UPDATE: 08/07/09</b> So, Defcon 17 has come and gone, and I have not heard anything credible
to indicate there is a new vulnerability in OpenSSH.  That said, I still run all of my SSH
daemons behind SPA/fwknop.  My original post appears below.
<br/><br/>
There are <link type="text/html" href="http://isc.sans.org/diary.html?storyid=6742">rumors</link> of a new vulnerability
in <link type="text/html" href="http://www.openssh.org/">OpenSSH</link> that may affect several versions previous to
the current OpenSSH-5.2 release.  <b>IF</b> these rumors are true - and there is a claim that details
will be provided in time for the upcoming Black Hat and Defcon conferences three weeks from now -
then it may be a good idea to deploy either a port knocking or <link type="text/html" href="/fwknop/docs/SPA.html">SPA</link>
solution to protect SSH daemons.  Although solid proof has yet to be released, it is a good bet
that if there really is a remotely exploitable vulnerability, then it will have nothing to do with
brute force password guessing.
<br/><br/>
Although log parsers that wrap thresholds around failed login attempts can be useful, what I worry
about are vulnerabilities where password guessing is completely unnecessary for successful
compromises.  This is where SPA comes in because it makes a service essentially impossible to
identify via scans, and so when an attacker (who may be armed with a 0-day exploit) goes looking
for SSH servers to attack, your server will not be listed.  There have been remote exploits against
OpenSSH <link type="text/html" href="http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2003-0693">before</link>
that <link type="text/html" href="http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2002-0639">allow arbitrary code execution</link>,
and password guessing was nowhere in sight.  It is only a matter of time before the next one
is found (hopefully by the whitehats first) in OpenSSH or any other SSH implementation that you
are running.
<br/><br/>
In the meantime, perhaps the <link type="text/html" href="http://www.metasploit.com/">Metasploit</link> framework will
come up with an exploit before Black Hat.  Or, perhaps this will always stay as just a rumor.
Either way, there is little harm in protecting your SSH daemon behind SPA and a default-drop
firewall policy.

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Disrupting Conficker Worm Traffic with iptables and fwsnort</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/07/disrupting-conficker-worm-traffic-with-iptables-and-fwsnort.html"/>
<id>http://www.cipherdyne.org/blog/2009/07/disrupting-conficker-worm-traffic-with-iptables-and-fwsnort.html</id>

<published>2009-07-04T21:01:30-05:00</published>
<updated>2009-07-04T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<img align="right" src="/images/malware.jpg" height="165" width="220" title="fwsnort vs. Conficker" alt="fwsnort vs. Conficker" />
Although the media blitz surrounding the <link type="text/html" href="http://en.wikipedia.org/wiki/Conficker">Conficker worm</link>
has died down, the worldwide computing infrastructure that the worm has cobbled
together still exists and remains under the control of its masters.  The resulting
botnet is an impressive demonstration of distributed computing control and
recoverability.  Many organizations - from companies to governments - would be
envious of such automation.  Most likely the botnet is being used as a money making
machine by renting out "botnet time" to criminals who then use it for their own purposes.
New Scientist has a <link type="text/html" href="http://www.newscientist.com/article/mg20227121.500-the-inside-story-of-the-conficker-worm.html?full=true">good summary</link> of the Conficker saga, and includes a discussion of
its switch from HTTP to a peer-to-peer module for communications and updates.  Even
though Conficker has perhaps not yet been used to issue DoS attacks against high
profile sites, it has had measurable impacts such as leaving Manchester
<link type="text/html" href="http://www.theregister.co.uk/2009/07/01/conficker_council_infection/">unable to
issue parking tickets</link> and Microsoft announcing a
<link type="text/html" href="http://www.networkworld.com/news/2009/021209-conflickr-bounty-microsoft.html">$250,000 bounty</link>
on the Conficker authors.  On the defense side, the <link type="text/html" href="http://www.confickerworkinggroup.org/wiki/">
Conficker Working Group</link> has produced some nice
<link type="text/html" href="http://www.confickerworkinggroup.org/wiki/pmwiki.php/ANY/InfectionDistribution">infection
distribution maps</link> and Nmap added <link type="text/html" href="http://insecure.org/">Conficker scan detection</link>
based on an excellent <link type="text/html" href="http://www.honeynet.org/files/KYE-Conficker.pdf">paper</link>
written by Tillmann Werner and Felix Leder.

<br/><br/>
In the context of iptables and fwsnort, the goal is to give Linux systems the ability
to detect and interfere network traffic associated with Conficker (at least as much
as possible), and this process starts with Snort rules from the
<link type="text/html" href="http://http://www.emergingthreats.net/">Emerging Threats</link>
rule set.  There are currently six active Snort rules designed to detect Conficker in
the Emerging Threats set, and an additional four that have been commented out.  The six
active rules so far detect the Conficker.A and Conficker.B variants, but hopefully more
rules will become available as better detection techniques are developed.

<br/><br/>
Now, how does fwsnort do with translating the six Emerging Threats rules?  Let's
find out with the command below.  This uses the <b>--include-regex</b> feature
to restrict fwsnort to just those rules that contain the string "conficker", and
we also add the new <b>--include-perl-trigger</b> argument (to be released in
fwsnort-1.0.7) that builds a perl command to mimic the application layer data
in each Snort rule.  By combining this perl command with netcat, it is possible
to test whether the iptables policy built by fwsnort properly detects attacks.
Finally, we also use the <b>--ipt-reject</b> argument to have iptables drop any
packet that matches the Conficker signatures and reset the connection at the
same time:
<br/><br/>
<code>
# fwsnort --include-regex conficker --include-re-caseless --snort-rfile /etc/fwsnort/snort_rules/emerging-all.rules --include-perl-triggers --ipt-reject | tail -n 4<br/>
[+] Generated iptables rules for 3 out of 6 signatures: 50.00%<br/>
<br/>
[+] Logfile: /var/log/fwsnort.log<br/>
[+] iptables script: /etc/fwsnort/fwsnort.sh<br/>
</code>
<br/><br/>
Ok, so three out of the six signatures (I'm using 'signature' and 'rule'
interchangeably in this blog post) converted properly to iptables rules.
Those that did not convert contain elements such as <b>pcre</b> and <b>threshold</b>
that are not currently supported by fwsnort.
<br/><br/>
Below is an example of one Snort signature that did convert correctly.  This is
rule ID <b>2009201</b>, and it detects shellcode directed at TCP/445 from Conficker.B:
<br/><br/>
<code>
alert tcp $EXTERNAL_NET any -&gt; $HOME_NET 445 (msg:"ET CURRENT_EVENTS Conficker.b Shellcode"; flow:established,to_server; content:"|e8 ff ff ff ff c2|_|8d|O|10 80|1|c4|Af|81|9MSu|f5|8|ae c6 9d a0|O|85 ea|O|84 c8|O|84 d8|O|c4|O|9c cc|Ise|c4 c4 c4|,|ed c4 c4 c4 94|&amp;&lt;O8|92|\;|d3|WG|02 c3|,|dc c4 c4 c4 f7 16 96 96|O|08 a2 03 c5 bc ea 95|\;|b3 c0 96 96 95 92 96|\;|f3|\;|24 |i|95 92|QO|8f f8|O|88 cf bc c7 0f f7|2I|d0|w|c7 95 e4|O|d6 c7 17 cb c4 04 cb|{|04 05 04 c3 f6 c6 86|D|fe c4 b1|1|ff 01 b0 c2 82 ff b5 dc b6 1f|O|95 e0 c7 17 cb|s|d0 b6|O|85 d8 c7 07|O|c0|T|c7 07 9a 9d 07 a4|fN|b2 e2|Dh|0c b1 b6 a8 a9 ab aa c4|]|e7 99 1d ac b0 b0 b4 fe eb eb|"; reference:url,www.honeynet.org/node/388; reference:url,doc.emergingthreats.net/2009201; reference:url,www.emergingthreats.net/cgi-bin/cvsweb.cgi/sigs/CURRENT_EVENTS/CURRENT_Conficker; classtype:trojan-activity; sid:2009201; rev:4;)
</code>
<br/><br/>
Here is the equivlent iptables command built by fwsnort and included in the
<b>/etc/fwsnort/fwsnort.sh</b> script.  Note the usage of the <b>FWSNORT_FORWARD_ESTAB</b>
chain which is reserved for packets that are part of established TCP connections:
<br/><br/>
<code>
$IPTABLES -A FWSNORT_FORWARD_ESTAB -p tcp --dport 445 -m string --hex-string "|e8ffffffffc2|_|8d|O|1080|1|c4|Af|81|9MSu|f5|8|aec69da0|O|85ea|O|84c8|O|84d8|O|c4|O|9ccc|Ise|c4c4c4|,|edc4c4c494|&amp;&lt;O8|923bd3|WG|02c3|,|dcc4c4c4f7169696|O|08a203c5bcea953bb3c096969592963bf33b24|i|9592|QO|8ff8|O|88cfbcc70ff7|2I|d0|w|c795e4|O|d6c717cbc404cb|{|040504c3f6c686|D|fec4b1|1|ff01b0c282ffb5dcb61f|O|95e0c717cb|s|d0b6|O|85d8c707|O|c0|T|c7079a9d07a4|fN|b2e2|Dh|0cb1b6a8a9abaac4|]|e7991dacb0b0b4feebeb|" --algo bm -m comment --comment "sid:2009201; msg:ET CURRENT_EVENTS Conficker.b Shellcode; classtype:trojan-activity; reference:url,www.honeynet.org/node/388; rev:4; FWS:1.0.6;" -j LOG --log-ip-options --log-tcp-options --log-prefix "[3] DRP SID2009201 ESTAB "
</code>
<br/><br/>

Because the pattern in the above signature is longer than 128 bytes, we'll increase
the value of the <b>MAX_STRING_LEN</b> variable to 256 in the /etc/fwsnort/fwsnort.conf
file.  With that done, let's execute the <b>/etc/fwsnort/fwsnort.sh</b> script now and
see how iptables handles such traffic on the wire:

<br/><br/>
<code>
#  /etc/fwsnort/fwsnort.sh<br/>
[+] Adding emerging-all rules:<br/>
iptables v1.4.1.1: STRING too long `|e8ffffffffc2|_|8d|O|1080|1|c4|Af|81|9MSu|f5|8|aec69da0|O|85ea|O|84c8|O|84d8|O|c4|O|9ccc|Ise|c4c4c4|,|edc4c4c494|&amp;&lt;O8|923bd3|WG|02c3|,|dcc4c4c4f7169696|O|08a203c5bcea953bb3c096969592963bf33b24|i|9592|QO|8ff8|O|88cfbcc70ff7|2I|d0|w|c795e4|O|d6c717cbc404cb|{|040504c3f6c686|D|fec4b1|1|ff01b0c282ffb5dcb61f|O|95e0c717cb|s|d0b6|O|85d8c707|O|c0|T|c7079a9d07a4|fN|b2e2|Dh|0cb1b6a8a9abaac4|]|e7991dacb0b0b4feebeb|'
Try `iptables -h' or 'iptables --help' for more information.
</code>
<br/><br/>

Ok, that is disappointing.  It turns out that iptables currently enforces a 128-byte
maximum on all strings supplied to the string match extension for inspecting payload
data.  Normally this is not a problem since the individual patterns in most Snort
rules are typically less than 128 bytes, but in this case we'd like to work around
this limitation.  To do so requires that we patch and recompile the <b>xt_string</b>
kernel module (assuming xt_string is configured as a module) with the following
patch:
<br/><br/>
<code>
# git diff<br/>
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h<br/>
index 8a6ba7b..afc60a2 100644<br/>
--- a/include/linux/netfilter/xt_string.h<br/>
+++ b/include/linux/netfilter/xt_string.h<br/>
@@ -1,7 +1,7 @@<br/>
 #ifndef _XT_STRING_H<br/>
 #define _XT_STRING_H<br/>
 <br/>
-#define XT_STRING_MAX_PATTERN_SIZE 128<br/>
+#define XT_STRING_MAX_PATTERN_SIZE 256<br/>
 #define XT_STRING_MAX_ALGO_NAME_SIZE 16<br/>
 <br/>
 enum {<br/>
@@ -15,7 +15,7 @@ struct xt_string_info<br/>
        u_int16_t to_offset;<br/>
        char      algo[XT_STRING_MAX_ALGO_NAME_SIZE];<br/>
        char      pattern[XT_STRING_MAX_PATTERN_SIZE];<br/>
-       u_int8_t  patlen;<br/>
+       u_int16_t  patlen;<br/>
        union {<br/>
                struct {<br/>
                        u_int8_t  invert;
</code>
<br/><br/>

With the new xt_string module loaded let's execute the fwsnort.sh script once
again:
<br/><br/>
<code>
#  /etc/fwsnort/fwsnort.sh<br/>
[+] Adding emerging-all rules:<br/>
    Rules added: 12<br/>
[+] Finished.
</code>
<br/><br/>
Ah, that's better.  The fwsnort iptables policy loaded properly in the running
kernel.  Now, let's use the perl trigger command along with netcat to send data
across the wire that should match the signature.  The trigger itself can be
found in the <b>/etc/fwsnort/fwsnort.sh</b> script.  First, we fire up a netcat
server on TCP port 445 on a target system which is protected by another system
running the fwsnort iptables policy, and then with the perl trigger we send
bytes that match the Conficker.B shell code signature across the wire to the
target.  The complete perl command is listed below even though it certainly is
obtuse looking.  You can see how the bytes it is printing match the content
strings in the original signature:
<br/><br/>
<code>
[target]# nc -l -p 445<br/>
[attacker]$ perl -e 'print "\xe8\xff\xff\xff\xff\xc2_\x8dO\x10\x801\xc4Af\x819MSu\xf58\xae\xc6\x9d\xa0O\x85\xeaO\x84\xc8O\x84\xd8O\xc4O\x9c\xccIse\xc4\xc4\xc4,\xed\xc4\xc4\xc4\x94&amp;&lt;O8\x92\x3b\xd3WG\x02\xc3,\xdc\xc4\xc4\xc4\xf7\x16\x96\x96O\x08\xa2\x03\xc5\xbc\xea\x95\x3b\xb3\xc0\x96\x96\x95\x92\x96\x3b\xf3\x3b\x24i\x95\x92QO\x8f\xf8O\x88\xcf\xbc\xc7\x0f\xf72I\xd0w\xc7\x95\xe4O\xd6\xc7\x17\xcb\xc4\x04\xcb{\x04\x05\x04\xc3\xf6\xc6\x86D\xfe\xc4\xb11\xff\x01\xb0\xc2\x82\xff\xb5\xdc\xb6\x1fO\x95\xe0\xc7\x17\xcbs\xd0\xb6O\x85\xd8\xc7\x07O\xc0T\xc7\x07\x9a\x9d\x07\xa4fN\xb2\xe2Dh\x0c\xb1\xb6\xa8\xa9\xab\xaa\xc4]\xe7\x99\x1d\xac\xb0\xb0\xb4\xfe\xeb\xeb"' |nc 10.1.1.1 445
</code>
<br/><br/>
The fwsnort iptables policy has reset the connection, and the following iptables
log message was also produced:
<br/><br/>
<code>
Jul  4 13:23:18 fwsnort kernel: [10966.350782] [2] REJ SID2009201 ESTAB IN=lo OUT= MAC=AB:00:00:AB:00:00:AB:00:00:AB:00:00:08:00 SRC=192.168.10.1 DST=10.1.1.1 LEN=244 TOS=0x00 PREC=0x00 TTL=64 ID=5976 DF PROTO=TCP SPT=49053 DPT=445 WINDOW=513 RES=0x00 ACK PSH URGP=0 OPT (0101080A0028B05B0028B058)
</code>
<br/><br/>
Of course, the best defense against Conficker is to patch Windows systems against
the MS08-067 vulnerability, and to use Nmap to scan for systems that are already
infected.  Those that are should be completely reimaged.

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Presentation on Single Packet Authorization at ENSOL</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/06/presentation-on-single-packet-authorization-at-ensol.html"/>
<id>http://www.cipherdyne.org/blog/2009/06/presentation-on-single-packet-authorization-at-ensol.html</id>

<published>2009-06-22T21:01:30-05:00</published>
<updated>2009-06-22T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://www.ensol.org.br/2009/programacao/sexta-feira/single-packet-authorization-aumentando-a-seguranca-no-ssh">
<img class="leftnofr" src="/images/ensol_logo.png" width="130" height="130" title="SPA at ENSOL" alt="SPA at ENSOL" /></link>On
June 19th <link type="text/html" href="http://leandro-cavalcanti.blogspot.com/2008/08/single-packet-authorization.html">Leandro Almeida</link>
gave a presentation entitled "<b>Single Packet Authorization - Increasing the security in SSH</b>" at the
<link type="text/html" href="http://www.ensol.org.br/2009/programacao/sexta-feira/single-packet-authorization-aumentando-a-seguranca-no-ssh">ENSOL</link>
conference in João Person, Brazil.  ENSOL is an open source conference that goes by
the title "Freedom in the Extreme", and given that Brazil is
<link type="text/html" href="http://duartes.org/gustavo/blog/post/why-brazil-loves-linux">highly supportive of Linux</link>,
I'm sure that it is a good conference.  Leandro has posted an English translation of
his slides <link type="text/html" href="http://www.slideshare.net/lcavalcanti.almeida/single-packet-authorization-slides-english">here</link>.
It is good to see some additional presentations on the SPA concept at open source conferences,
and Leandro emphasizes the usage of the fwknop SPA implementation to protect SSH.

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Software Release - fwsnort-1.0.6</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/05/software-release-fwsnort-1.0.6.html"/>
<id>http://www.cipherdyne.org/blog/2009/05/software-release-fwsnort-1.0.6.html</id>

<published>2009-05-30T21:01:30-05:00</published>
<updated>2009-05-30T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="/fwsnort">
<img align="right" src="/images/release.png" title="software release fwsnort-1.0.6" alt="software release fwsnort-1.0.6" /></link>
The 1.0.6 release of <link type="text/html" href="/fwsnort">fwsnort</link> is ready for <link type="text/html" href="/fwsnort/download">download</link>.
This release fixes a bug that caused some Snort rules to not be translated into
iptables rules due to improper handling of escaped semicolons.  Now that this
bug has been fixed, an additional 58 rules from the Emerging Threats rule set
are now properly supported.  Also made it easier to point fwsnort at a single
file with a Snort rule set to be converted (see the --fwsnort-rfile command line
argument).
<br/><br/>
Here is the complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwsnort/browser/fwsnort/tags/fwsnort-1.0.6/ChangeLog">ChangeLog</link>:
<br/><br/>
<ul>
<li>(Franck Joncourt) Updated fwsnort to use the "! &lt;option&gt; &lt;arg&gt; syntax
instead of the older "&lt;option&gt; ! &lt;arg&gt; for the iptables command line.</li>
<li>(Franck Joncourt) For the --hex-string and --string matches, if the
argument exceeds 128 bytes (iptables 1.4.2) then iptables fails with an
error "iptables v1.4.2: STRING too long".  Fixes this with a patch that
adds a new variable in fwsnort.conf "MAX_STRING_LEN", so that the size of
the content can be limited. If the content (null terminated string) is
more than MAX_STRING_LEN chars, fwsnort throws the rule away.</li>
<li>Bug fix to allow fwsnort to properly translate snort rules that have
"content" fields with embedded escaped semicolons (e.g. "\;").  This
allows fwsnort to translate about 58 additional rules from the Emerging
Threats rule set.</li>
<li>Bug fix to allow case insensitive matches to work properly with the
--include-re-caseless and --exclude-re-caseless arguments.</li>
<li>Bug fix to move the 'rawbytes' keyword to the list of keywords that are
ignored since iptables does a raw match anyway as it doesn't run any
preprocessors in the Snort sense.</li>
<li>Added the --snort-rfile argument so that a specific Snort rules file (or
list of files separated by commas) is parsed.</li>
<li>Added a small hack to choose the first port from a port list until the
iptables 'multiport' match is supported.</li>
<li>Updated to consolidate spaces in hex matches in the fwsnort.sh script
since the spaces are not part of patterns to be searched anyway.</li>
<li>Updated to the latest complete rule set from Emerging Threats (see
http://www.emergingthreats.net/).</li>
<li>Added the "fwsnort-nobuildreqs.spec" file for building fwsnort on
systems (such as Debian) that do not install/upgrade software via RPM.
This file omits the "BuildRequires: perl-ExtUtils-MakeMaker" directive,
and this fixes errors like the following on an Ubuntu system when
building fwsnort with rpmbuild:
<br/><br/>
<code>
rpm: To install rpm packages on Debian systems, use alien. See README.Debian.<br/>
error: cannot open Packages index using db3 - No such file or directory (2)<br/>
error: cannot open Packages database in /var/lib/rpm
</code>
<br/><br/>
</li>
</ul>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Handling Escaped Semicolons in Snort Rules with fwsnort</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/05/handling-escaped-semicolons-in-snort-rules-with-fwsnort.html"/>
<id>http://www.cipherdyne.org/blog/2009/05/handling-escaped-semicolons-in-snort-rules-with-fwsnort.html</id>

<published>2009-05-27T21:01:30-05:00</published>
<updated>2009-05-27T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwsnort/changeset/489">
<img align="right" src="/images/escape_key.jpg" height="115" width="127" title="fwsnort and escaped semicolons in Snort rules" alt="fwsnort and escaped semicolons in Snort rules" /></link>
Recently I ran into a situation in which several Snort rules from the
<link type="text/html" href="http://www.emergingthreats.org">Emerging Threats</link> rule sets were not
being properly translated into iptables rules by <link type="text/html" href="/fwsnort">fwsnort</link>.
It turned out that fwsnort did not correctly parse Snort <b>content</b> fields
that contained escaped semicolons (e.g. "<b>\;</b>").  In the Snort signature
language, the argument to every keyword in the body of a Snort rule such as
<b>content</b>, <b>pcre</b>, and <b>flowbits</b> is terminated with a semicolon,
and some keywords also use opening and closing double quotes.  But, Snort
supports escaping with a backslash so that these characters can easily be made
to be part of a keyword argument as opposed to the delimiting syntax.  Snort
does not allow the argument of a <b>content</b> keyword to contain an embedded
semicolon that is not escaped (e.g. <b>content:"distloc=;";</b>), and will generate
an error similar to the following if a rule does not conform to this:
<br/><br/>
<code>
Initializing rule chains...<br/>
ERROR: /etc/snort/rules/web-cgi.rules(3) =&amp; Content data needs to be enclosed in quotation marks (")!<br/>
Fatal Error, Quitting..
</code>
<br/><br/>
In this case, we change <b>content:"distloc=;";</b> to <b>content:"distloc=\;";</b>
and the error goes away.  However, in addition to the escaping mechanism, any
double quote or semicolon that is part of a <b>content</b> field can just be
specified in hex notation between pipe "|" characters instead.
<br/><br/>
So, what are the tradeoffs in using one convention vs. the other?
<br/><br/>
Using backslashes can complicate the way an argument looks (since backslashes
are not part of the content that is actually searched for in network traffic),
but they can also make the argument more intuitive to look at than the hex
syntax.  This can be important when looking at lots of packet traces.  For
example, in web traffic the semicolon is used in
<link type="text/html" href="http://www.faqs.org/rfcs/rfc2396.html">HTTP request headers</link> as a
separator and therefore has special significance in HTTP, and the semicolon is
also a separator for multiple commands launched from a command shell.  So, for
those that don't automatically know the hex equivalent of a semicolon (<b>0x3b</b>),
it might be better to look at <b>content:"distloc=\;";</b> instead of
<b>content:"distloc=|3B|";</b> when interpreting signature matches against
raw packet traces since it emphasizes the importance of the semicolon.
<br/><br/>
There are important examples of Snort rule sets that use each strategy for the
arguments to content fields (escaped semicolons vs. the hex equivalent).  The
complete Emerging Threats <link type="text/html" href="http://www.emergingthreats.net/rules/emerging-all.rules">rule set</link>
contains 58 signatures with escaped semicolons:
<br/><br/>
<code>
$ perl -lwne 'while (/content:"(.*?)"/g) { $tmp = $1; if ($tmp =~ /\x3b/) { print $tmp; }} ' emerging-all.rules |wc -l<br/>
58
</code>
<br/><br/>
Note that the '<b>while (/content:"(.*?)"/g)</b>' loop is necessary above in order to
parse all content fields from each Snort rule - using something like
'<b>if (/content:"(.*?)"/</b>' would just parse the very first content field in each
Snort rule.  Here is an example content field from the "ET MALWARE Vaccine-program.co.kr
Related Spyware Checkin" signature:
<br/><br/>
<code>
|0d 0a|User-Agent\: Mozilla/3.0 (compatible\; Indy Library)|0d 0a|
</code>
<br/><br/>
By contrast, I've seen a few Sourcefire VRT rule sets, and none of them appear to
use escaped semicolons in any of their signatures.  They always prefer to use the
"<b>|3B|</b>" hex notation.
<br/><br/>
Now, why is this important for fwsnort?  The reason is that the current version -
fwsnort-1.0.5 - does not properly parse content fields with escaped semicolons.
However, this will be corrected in the upcoming fwsnort-1.0.6 release, which will
be completed within the next two days or so.  In the meantime, here is a link to
<link type="text/html" href="http://www.cipherdyne.org/fwsnort/download/fwsnort-1.0.6-pre4.tar.gz">
fwsnort-1.0.6-pre4</link> that corrects this issue.
</p>
</div>
</content>
</entry>

<entry>
<title type="html">Joined Twitter</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/05/joined-twitter.html"/>
<id>http://www.cipherdyne.org/blog/2009/05/joined-twitter.html</id>

<published>2009-05-26T21:01:30-05:00</published>
<updated>2009-05-26T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://twitter.com/michaelrash">
<img align="right" src="/images/twitter_logo.png" title="Joined Twitter" alt="Joined Twitter" /></link>
<link type="text/html" href="http://www.aplura.com/">Sean Wilkerson</link> convinced me to
<link type="text/html" href="http://twitter.com/michaelrash">join Twitter</link> as a way to help increase
the exposure that the Cipherdyne projects have on the Internet, and also to
interact more with peers in the security community.  After having used Twitter now
for a couple of weeks, I can see some benefit in its ability to rapidly broadcast
updates (140 characters at a time) and to make it easy to see what others are
working on (subject to what they choose to reveal of course).  Further, it seems
plausible that Twitter's flexibility and speed would make it easier to acquire
answers to questions than trying to contact people directly via email.  Sean also
had mentioned that after a recent talk he gave at <link type="text/html" href="http://www.dojosec.com">
DojoSec</link> (hopefully video of it will be posted soon) he noticed that people are
using Twitter during security talks as a way to organize the audience around the
topic at hand.  This provides a way for the audience to converge on challenging
questions and bring participation to a higher level.  Finally, as a measure of its
success, it might be worth noting that Twitter has also been in the news recently
as a mechanism for organizing a <link type="text/html" href="http://www.wired.com/dangerroom/2009/04/inside-moldovas/">
revolution</link> in the former-Soviet republic of Moldova.
</p>
</div>
</content>
</entry>

<entry>
<title type="html">Software Release - fwknop-1.9.11</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/05/software-release-fwknop-1.9.11.html"/>
<id>http://www.cipherdyne.org/blog/2009/05/software-release-fwknop-1.9.11.html</id>

<published>2009-05-11T21:01:30-05:00</published>
<updated>2009-05-11T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="/fwknop">
<img align="right" src="/images/release.png" title="software release fwknop-1.9.11" alt="software release fwknop-1.9.11" /></link>
The 1.9.11 release of <link type="text/html" href="/fwknop">fwknop</link> is ready for <link type="text/html" href="/fwknop/download">download</link>.
The major feature addition in this release is the ability to utilize ipfw
'sets' to organize new rules added by the fwknopd daemon on Mac OS X or
FreeBSD systems after receiving a valid SPA packet.  A couple of other
features were added as well, such as user-defined type and code values
for SPA packets sent over ICMP, and support in the test suite for running
specific chains of related tests.
<br/><br/>
Here is the complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.11/ChangeLog">ChangeLog</link>:
<br/><br/>
<ul>
<li>(Julien Picalaus) Contributed patches to implement a proper interface to
use ipfw 'sets' on systems running ipfw firewalls.  This involved
changes to fwknopd, knoptm, and the fwknop.conf file like so:
Added a test to see if the local ipfw firewall policy is using dynamic
rules. Added ipfw_move_rule() so that rules can be moved from one set to
another. Added ipfw_disable() set subroutine and it is called at init for
IPFW_SET_NUM (except when ipfw isn't using dynamic rules).  Made sure
that rule finding includes disabled rules (ipfw list -S and changes to
regexp) and returning the set in addition to the rule number.  When
granting access, if a corresponding disabled rule already exists, enable
it instead of adding a new one (except when ipfw isn't using dynamic
rules). When adding rules, only use keep-state if there are already
dynamic rules.  Added IPFW_SET_NUM so that the set number for new ipfw
can be specified, and add IPFW_DYNAMIC_INTERVAL so that the interval
over which rules that have no associated dynamic rules are removed (the
default is 60 seconds).</li>
<li>(Franck Joncourt) Bug fix to add -O command line arg to knopwatchd to
specify an override config file if one is given on the fwknopd command
line.</li>
<li>Added --icmp-type and --icmp-code command line arguments for the fwknop
client in order to manually set the ICMP type/code values when using
"--Spoof-proto icmp" or "--Server-proto icmp".  Also restructured how
SPA packets are sent over the various protocols.  Here is an example of
sending an SPA packet over an ICMP packet with type "123" and code
"123" (not normal ICMP type/code values) with the pcap trace shown:
<br/>
<br/><br/>
<code>
# fwknop -A tcp/22 -s --Server-proto icmp --icmp-type 123 --icmp-code 123 -D 127.0.0.1<br/>
# tcpdump -i lo -l -nn icmp or udp -s 0 -X<br/>
tcpdump: verbose output suppressed, use -v or -vv for full protocol<br/>
decode listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes<br/>
  07:24:32.527221 IP 127.0.0.1 &gt; 127.0.0.1: ICMP type-#123, length 169<br/>
    0x0000:  4510 00bd 0000 4000 4001 3c2e 7f00 0001  E.....@.@.&lt;.....<br/>
    0x0010:  7f00 0001 7b7b e66f 0000 0000 2b63 6a6f  ....{{.o....+cjo<br/>
    0x0020:  5049 6138 7345 7a35 4864 7955 5176 624b  PIa8sEz5HdyUQvbK<br/>
    0x0030:  6637 6f51 5934 4e36 4c6c 3454 6931 4453  f7oQY4N6Ll4Ti1DS<br/>
    0x0040:  2b4f 3756 6636 4775 6234 756f 6738 4432  +O7Vf6Gub4uog8D2<br/>
    0x0050:  3155 4377 5259 6b52 2b30 354b 7043 6b33  1UCwRYkR+05KpCk3<br/>
    0x0060:  4f66 452f 4f32 6737 6d37 5064 4846 4842  OfE/O2g7m7PdHFHB<br/>
    0x0070:  7a32 4745 3766 7a31 4a4c 7652 764e 626c  z2GE7fz1JLvRvNbl<br/>
    0x0080:  7a4a 7250 5355 3665 5051 5375 7a54 394b  zJrPSU6ePQSuzT9K<br/>
    0x0090:  702b 4446 4a79 7a6b 3847 6c51 6a70 3564  p+DFJyzk8GlQjp5d<br/>
    0x00a0:  3957 3673 4f52 7945 3771 6f57 6b56 634e  9W6sORyE7qoWkVcN<br/>
    0x00b0:  4e41 6167 6231 5a79 6a63 4834 49         NAagb1ZyjcH4I
</code>
<br/><br/>
</li>
<li>Updated all unpack() calls for packet decoding in fwknopd to use the
"mN" format instead of "m[N]" format for proper operation on older
versions of perl.  On FreeBSD 7.0 with perl-5.6.2 the following error
is generated without this fix: "Invalid type in unpack: '['".</li>
<li>Bug fix to not require that gpg is installed in order to install fwknop.</li>
<li>(Franck Joncourt) Documentation updates for the knopwatchd.8 man page
to include the latest command line options.</li>
<li>(Martin Ferrari) Bug fix to provide a work around for fwknopd segfaults
on Debian systems when the version of Net::Pcap that is installed comes
from doing 'apt-get install fwknop-server'.  See the thread at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508432 for more info.</li>
<li>Bug fix to ensure that UDP rules in ipfw firewalls are timed out
correctly by knoptm (the problem was that 'keep-state' was required).</li>
<li>(Test suite): Added tests for multi-port access requests.  So, to gain
access to tcp/22,udp/1194 with one SPA packet, the test suite verifies
that the code support this.</li>
<li>(Test suite): Started on updates to handle the upcoming libfko C
implementation of Single Packet Authorization (the command line args
are somewhat different).</li>
<li>(Test suite): Added support for multiple include/exclude test
identifying strings (separated by commas).  For example, to run the
'Setup', 'Basic', and 'Replay' tests, just do:
<br/>
./fwknop_test.pl --include Setup,Basic,Replay
</li>
<li>(Test suite): Added the ability to test sending SPA packets over ICMP.</li>
<li>(Test suite): Added import_perl_modules() routine from fwknop itself to
enforce the usage of the same perl modules as those that fwknop
references.  The main application of this is for the Net::RawIP module
which is used by the test suite for the SPA over ICMP tests.</li>
</ul>

</p>
</div>
</content>
</entry>

<entry>
<title type="html">Building a Native Windows fwknop.exe Binary</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2009/05/building-a-native-windows-fwknop.exe-binary.html"/>
<id>http://www.cipherdyne.org/blog/2009/05/building-a-native-windows-fwknop.exe-binary.html</id>

<published>2009-05-02T21:01:30-05:00</published>
<updated>2009-05-02T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<link type="text/html" href="http://strawberryperl.com">
<img class="left" src="/images/strawberry_perl.jpg" height="120" width="120" title="Native Windows fwknop.exe" alt="Native Windows fwknop.exe" /></link>
Julien Picalaus recently posted a message to the fwknop mailing list in which he
explains how to use <link type="text/html" href="http://strawberryperl.com">Strawberry Perl</link>
(reportedly what Larry Wall uses for his perl distribution on Windows systems)
along with the <link type="text/html" href="http://search.cpan.org/~autrijus/PAR-0.85_01/script/pp">
Perl Packager</link> to create a native Windows binary for the fwknop client.  The
result is a functional <b>fwknop.exe</b> binary that can be used on Windows
systems to gain access to services protected by an fwknopd server running on
other systems with iptables or ipfw policies.
<br/><br/>
At some point, if fwknopd is modified to hook into a Windows firewalling API,
then this same technique could be used create stand alone fwknopd binaries for
Windows as well.  This would extend Single Packet Authorization (SPA) firmly
into the Windows world.  In the meantime, Julien's instructions for the fwknop
client are as follows:
<br/><br/>
<ul>
<li>Install strawberry perl.</li>
<li>Use CPAN to install Crypt::CBC and Crypt::Rijndael (required by fwknop).</li>
<li>Grab the fwknop sources and try to run perl fwknop -whatever options you
need, to make sure it works. Apparently, you need to provide the --Home
option since fwknop can't find home folders without it.</li>
<li>Use CPAN to install Module::ScanDeps, PAR::Dist, PAR, PAR::Packer.</li>
<li>Run pp -c -M Crypt::Rijndael -o fwknop.exe fwknop (at least this worked for
me, not sure why I had to specify the Rijndael module manually).</li>
<li>You have fwknop.exe.</li>
</ul>
</p>
</div>
</content>
</entry>

<!-- end_stories -->
</feed>
