<?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-08-22T21:51:52-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">How to avoid ClamAV matches on bundled Snort rules</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/08/how-to-avoid-clamav-matches-on-bundled-snort-rules.html"/>
<id>http://www.cipherdyne.org/blog/2010/08/how-to-avoid-clamav-matches-on-bundled-snort-rules.html</id>

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

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<img align="right" src="/images/clamav.png" title="ClamAV matches on Snort rules" alt="ClamAV matches on Snort rules" />
Recently a <link type="text/html" href="/psad">psad</link> user notified me via email that the psad-2.1.7.tar.gz tarball
was flagged by <link type="text/html" href="http://www.clamav.net">ClamAV</link> as being infected with <b>Exploit.HTML.MHTRedir-8</b>.
After checking a few things, it turns out that ClamAV is triggering on a Snort rule in the
<link type="text/html" href="http://www.emergingthreats.net/">Emerging Threats</link> rule set which is bundled in both
<link type="text/html" href="/psad">psad</link> and <link type="text/html" href="/fwsnort">fwsnort</link>.  The following analysis shows
exactly what ClamAV is detecting and why, and also provides some guidance for how to avoid
this for any software projects that distribute Snort rules.  Similar logic would apply to
other software engineering efforts - including commercial intrusion detection systems - that
are (by their nature) looking for malicious artifacts on the filesystem or within network
traffic.
<br/><br/>
First, let's download psad-2.1.7.tar.gz and check the gpg signature (just to make sure we're
talking about exactly the same file):
<br/><br/>
<code>
$ wget --quiet http://www.cipherdyne.org/psad/download/psad-2.1.7.tar.gz<br/>
$ wget --quiet http://www.cipherdyne.org/psad/download/psad-2.1.7.tar.gz.asc<br/>
$ gpg --verify psad-2.1.7.tar.gz.asc<br/>
gpg: Signature made Wed 14 Jul 2010 06:01:42 PM EDT using DSA key ID 0D3E7410<br/>
gpg: Good signature from "Michael Rash (Signing key for cipherdyne.org projects) &lt;mbr@cipherdyne.org&gt;"
</code>
<br/><br/>
Ok, now here is what <b>clamscan</b> says about the psad-2.1.7.tar.gz tarball:
<br/><br/>
<code>
$ clamscan psad-2.1.7.tar.gz<br/>
psad-2.1.7.tar.gz: Exploit.HTML.MHTRedir-8 FOUND<br/>
<br/>
----------- SCAN SUMMARY -----------<br/>
Known viruses: 816934<br/>
Engine version: 0.96.1<br/>
Scanned directories: 0<br/>
Scanned files: 1<br/>
Infected files: 1<br/>
Data scanned: 6.42 MB<br/>
Data read: 1.16 MB (ratio 5.55:1)<br/>
Time: 7.169 sec (0 m 7 s)
</code>
<br/><br/>
Let's see which file within the psad-2.1.7 tarball matches the <b>Exploit.HTML.MHTRedir-8</b>
signature:
<br/><br/>
<code>
$ tar xfz psad-2.1.7.tar.gz<br/>
$ clamscan -r -i psad-2.1.7<br/>
psad-2.1.7/deps/snort_rules/emerging-all.rules: Exploit.HTML.MHTRedir-8 FOUND<br/>
<br/>
----------- SCAN SUMMARY -----------<br/>
Known viruses: 816934<br/>
Engine version: 0.96.1<br/>
Scanned directories: 41<br/>
Scanned files: 405<br/>
Infected files: 1<br/>
Data scanned: 12.55 MB<br/>
Data read: 6.41 MB (ratio 1.96:1)<br/>
Time: 8.446 sec (0 m 8 s)
</code>
<br/><br/>
Intuitively, this makes sense.  That is, given that ClamAV is out to identify nasty things
within files, and given that Snort rules are designed to identify nasty things as they
communicate over the network, it stands to reason that there might be some overlap.  This
overlap is <i>not</i> an indication of something wrong in either the Snort rules or in ClamAV.
Now, let's find out specifically which Snort rule within the <b>emerging-all.rules</b>
file is triggering the ClamAV match.  We first take a look at the <b>Exploit.HTML.MHTRedir-8</b>
signature:
<br/><br/>
<code>
$ cp /var/lib/clamav/main.cvd .<br/>
$ sigtool --unpack main.cvd<br/>
$ grep Exploit.HTML.MHTRedir-8 main.ndb<br/>
Exploit.HTML.MHTRedir-8:3:*:6d68746d6c3a66696c653a2f2f{1-20}2168
</code>
<br/><br/>
The last line above is the entire ClamAV signature, and the pattern <b>6d68746d6c3a66696c653a2f2f</b>
is the key.  The ":3:" part identifies the signature as type "normalized HTML", so ClamAV
matches the pattern <b>6d68746d6c3a66696c653a2f2f</b> against the "normalized HTML" representation
of each processed file.  We can decode the pattern as follows:
<br/><br/>
<code>
echo 6d68746d6c3a66696c653a2f2f | xxd -r -p<br/>
mhtml:file://
</code>
<br/><br/>
So, within the <b>emerging-all.rules</b> file, we are interested in any Snort rule that
contains the string <b>mhtml:file://</b>.  There is also the "<b>{1-20}2168</b>" criteria
which says to match the hex bytes 2168 anywhere from 1 to 20 bytes after the first
pattern match.
<br/><br/>
<code>
$ grep mhtml psad-2.1.7/deps/snort_rules/emerging-all.rules<br/>
alert tcp $HOME_NET any -&gt; $EXTERNAL_NET $HTTP_PORTS (msg:"ET MALWARE Bundleware Spyware CHM Download"; flow: to_server,established; content:"Referer\: ms-its\:mhtml\:file\://C\:counter.mht!http\://"; nocase; content:"/counter/HELP3.CHM\:\:/help.htm"; nocase; classtype: trojan-activity; sid: 2001452; rev:4;)<br/>
</code>
<br/><br/>
Sure enough, sid:2001452 "<b>ET MALWARE Bundleware Spyware CHM Download</b>" has the
keyword <b>content:"Referer\: ms-its\:mhtml\:file\://C\:counter.mht!http\://"</b>.  Even
though there are escaping backslashes, the normalized HTML processing in ClamAV takes
this into account and matches the pattern anyway from the ClamAV signature.
<br/><br/>
So, how can we keep the original Snort rule, but change it so that ClamAV not longer
flags it?
<br/><br/>
Fortunately, ClamAV does not interpret the Snort rules convention of specifying non-printable
bytes between "|" characters within content fields, so we simply need to change one of
characters to hex notation.  Snort will still offer the same detection if network traffic
matches the rule, and ClamAV won't flag it.  So, let's just change the "m" in "<b>mhtml\:file\://</b>"
to its hex equivalent, like so: "<b>|6d|html\:file\://</b>".  Once we make this change and save the
psad-2.1.7/deps/snort_rules/emerging-all.rules file, we rerun clamscan:
<br/><br/>
<code>
$ clamscan -r -i psad-2.1.7<br/>
<br/>
----------- SCAN SUMMARY -----------<br/>
Known viruses: 816934<br/>
Engine version: 0.96.1<br/>
Scanned directories: 41<br/>
Scanned files: 405<br/>
Infected files: 0<br/>
Data scanned: 17.23 MB<br/>
Data read: 6.41 MB (ratio 2.69:1)<br/>
Time: 10.024 sec (0 m 10 s)
</code>
<br/><br/>
That's better.  Over the next few days I'll re-release all affected versions of psad and
fwsnort with the above change to ensure that there aren't any additional ClamAV matches.
<br/><br/>
In conclusion, if you are involved in any software engineering effort that distributes
or makes use of Snort rules, it is probably a good idea to run distribution packages
through ClamAV and see if there are any matches.  If so, it may be possible to take
advantage of Snort rule syntax options to still achieve the same signature coverage while
not having ClamAV flag anything.


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

<entry>
<title type="html">A new SSH password guessing botnet: dd_ssh</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/08/a-new-ssh-password-guessing-botnet-dd_ssh.html"/>
<id>http://www.cipherdyne.org/blog/2010/08/a-new-ssh-password-guessing-botnet-dd_ssh.html</id>

<published>2010-08-20T21:01:30-05:00</published>
<updated>2010-08-20T21: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="dd_ssh botnet" alt="dd_ssh botnet" />
Every few months it seems that there is a new variation of a password guessing botnet.
This time around, as reported by the <link type="text/html" href="http://isc.sans.edu/diary.html?storyid=9370">SANS ISC</link>
and also by <link type="text/html" href="http://www.malwarecity.com/community/index.php?showtopic=1177">malwarecity.com</link>,
a botnet called "<b>dd_ssh</b>" has been built up around a vulnerability in phpMyAdmin.
(Here is the <link type="text/html" href="http://lists.debian.org/debian-security-announce/2010/msg00074.html">vulnerability announcement</link>
from the Debian security list.)  Once a vulnerable webserver has been compromised, the
botnet starts scanning random IP addresses for SSH servers and attempts to brute force
passwords for those systems that accept an SSH connection.  Although software like
<b>Fail2ban</b> and <b>DenyHosts</b> can offer detection and mitigation by applying thresholds to
the number of failed login attempts in the SSH log and communicate offending source IP's
to a set of interested users, a fundamental problem is that the targeted SSH daemons
are reachable in the first place from arbitrary source IP's.  A more powerful
solution is to hide your SSH daemon behind a default-drop firewall policy and only
grant access through <link type="text/html" href="/fwknop">Single Packet Authorization</link>.
Any botnet that is scanning for SSH servers will not be able to guess any
passwords or even exploit a zero-day vulnerability in an SSH daemon that is protected
in this way.
<br/><br/>
Further, SSH brute forcing botnets have shown some
<link type="text/html" href="http://bsdly.blogspot.com/2008/12/low-intensity-distributed-bruteforce.html">innovative techniques</link>
where password guessing attempts are spread out over a long period of time and failed
passwords are distributed across the botnet.  The end result is that each botnet
node knows the population of passwords that other nodes have already tried on
each targeted SSH daemon, and so new passwords can be tried while still slipping
beneath common detection thresholds.  The same password never has to be tried twice
botnet-wide.  It is not clear yet whether the dd_ssh botnet uses a similar password
distribution strategy, but either way I intend to stop such guessing games at the
earliest stage possible and block all SSH connections by default.

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

<entry>
<title type="html">HTTP Response Times for cipherdyne.org</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/08/http-response-times-for-cipherdyne.org.html"/>
<id>http://www.cipherdyne.org/blog/2010/08/http-response-times-for-cipherdyne.org.html</id>

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

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

<link type="text/html" href="http://oss.oetiker.ch/smokeping/index.en.html">
<img align="right" src="/images/smokeping.png" title="smokeping" alt="smokeping" /></link>
I'm a big fan of the <link type="text/html" href="http://oss.oetiker.ch/smokeping/index.en.html">Smokeping</link>
project developed by Tobi Oetiker, and I use it to graph ICMP, DNS, and HTTP round trip
times for my local internet connections and also for cipherdyne.org.  Since the beginning
of 2010, I've switched around where cipherdyne.org was hosted from a system at a hosting
provider in Canada to a system running on my home network (serviced by a Verizon FiOS
connection).  The drop in RTT's in mid-February was expected and quite large - going
from an average of around 200ms down to about 20ms.  Then, in June, I switched to a
different Verizon DSL connection and moved the cipherdyne.org webserver system to a
newer Verizon FiOS connection at a different location, and the RTT's went up a bit to
about 50ms.  Here is the graph:

<img src="/images/cipherdyne_400_days.png" title="cipherdyne.org 400 days" alt="cipherdyne.org 400 days" />


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

<entry>
<title type="html">fwsnort Available in Fedora Repositories</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/08/fwsnort-available-in-fedora-repositories.html"/>
<id>http://www.cipherdyne.org/blog/2010/08/fwsnort-available-in-fedora-repositories.html</id>

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

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

<link type="text/html" href="http://fedoraproject.org/">
<img align="right" src="/images/fedora_logo.png" title="fwsnort on Fedora" alt="fwsnort on Fedora" /></link>
The <link type="text/html" href="/fwsnort/">fwsnort</link> project is now available directly through the
<link type="text/html" href="https://admin.fedoraproject.org/pkgdb/acls/name/fwsnort?_csrf_token=a9cbb9cbe99f8d2953b015db95f4f30a2bfd7395">Fedora RPM repositories</link>
(for Fedora 12 and 13) thanks to
<link type="text/html" href="http://koji.fedoraproject.org/koji/userinfo?userID=1466">Guillermo Gomez</link>.
The version that is currently bundled is fwsnort-1.0.6.  Once fwsnort-1.2 is
released, the implementation of large iptables rule sets that are derived from
Snort rules will become a lot faster.  This is because fwsnort is going to
support the <b>iptables-save</b> format by integrating the complex rules built by
fwsnort with any existing iptables policy that is instantiated in the kernel.
This is made possible by interpreting the local policy and splicing in all
of the fwsnort rules in the right places - each iptables chain is built from
scratch upon an <b>iptables-restore</b> (including the built-in chains), so
integrating with a running policy is not as easy as just adding each fwsnort
rule into a set of custom chains.  Compatibility with the iptables-save format
has largely been completed with <link type="text/html" href="http://trac.cipherdyne.org/trac/fwsnort/changeset/528">this patch</link>
in the fwsnort-1.2 development effort.
<br/><br/>
If you are running a Fedora 12 or 13 system, you can install fwsnort like so:
<br/><br/>
<code>
# yum install fwsnort
</code>
<br/><br/>

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

<entry>
<title type="html">Pure C Implementation of Single Packet Authorization</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2010/07/pure-c-implementation-of-single-packet-authorization.html"/>
<id>http://www.cipherdyne.org/blog/2010/07/pure-c-implementation-of-single-packet-authorization.html</id>

<published>2010-07-25T21:01:30-05:00</published>
<updated>2010-07-25T21: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="Pure C Implementation of Single Packet Authorization" alt="Pure C Implementation of Single Packet Authorization" /></link>
For the past several months, the pure-C implementation of Single Packet Authorization
with fwknop has been in development, and the first release candidate of
<link type="text/html" href="/fwknop/download/">fwknop-2.0.0</link> is ready for <link type="text/html" href="/fwknop/download/">download</link>.
Damien Stuart is the primary developer of this code, and I wish to thank him for
all of his efforts in making this release possible.  The original perl version of
fwknop will continue to receive bug fixes as they are found, but the primary
development effort is now on the lightweight and portable C code.  The Trac
interface for the perl code has moved to
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop-perl">fwknop-perl</link>.  Any release
that is at fwknop-2.0.0 or above will be the C implementation, and any release in
the 1.9 series or before are in perl (and will remain available
<link type="text/html" href="/fwknop/download/">here</link>).  The perl and C versions are compatible with
each other, so SPA packets created by the fwknop perl client can be properly
decrypted and decoded by the new fwknopd C server, and similarly SPA packets
built with the fwknop C client can be interpreted by the fwknopd perl server.
<br/><br/>
The heart of the new C code is the
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/trunk/lib">libfko library</link>,
which is used by both the fwknop client and the fwknopd server for SPA packet
encryption/decryption and interpretation.  The libfko library is portable to
several platforms including Linux and Windows, and the standard
<link type="text/html" href="http://www.gnu.org/software/autoconf/">GNU autoconf</link>
project is used for building fwknop from sources.
<br/><br/>
Given the compact nature of the C code, the fwknop-2.0.0rc1 release candidate
is already known to function on <link type="text/html" href="http://openwrt.org/">OpenWRT</link>, and
Damien Stuart (the primary developer of the fwknop C code) has built packages
for the OpenWRT Kamikaze and Backfire releases.  This brings SPA functionality
to embedded systems, and has been tested on a Linksys WRT54GS V2.0 router.  The
OpenWRT packages are available <link type="text/html" href="/fwknop/download/">here</link>.
<br/><br/>
There will be a few release candidates of <b>fwknop-2.0.0</b> to ensure proper
operation on a variety of platforms, and the emphasis will be on stability and
ironing out any bugs.  Also, fwknop-2.0.0 will initially support iptables
firewalls on the servers side, with <b>ipfw</b> support coming soon after.  There
is one nice feature in fwknop-2.0.0rc1 that deserves a mention - the fwknop client
now supports the notion of a <b>~/.fwknoprc</b> file that allows a set of
stanzas to be defined for remote SPA servers and customize the command line
arguments used to access each one.  Here is an example stanza:

<br/><br/>
<code>
# Example for a destination server of 192.168.1.20 to open access to<br/>
# SSH for an IP that is resolved externally<br/>
#<br/>
[myssh]<br/>
SPA_SERVER          192.168.1.20<br/>
ACCESS              tcp/22<br/>
ALLOW_IP            resolve<br/>
SPA_SERVER_PORT     50023<br/>
</code>
<br/><br/>

Now, with the fwknop client, we reference this stanza with the <b>-n</b> command
line argument like so:

<br/><br/>
<code>
$ fwknop -n myssh -vvv<br/>
Resolved external IP (via http://www.cipherdyne.org/cgi-bin/myip) as: 123.1.2.3<br/>
Enter encryption password:<br/>
<br/>
FKO Field Values:<br/>
=================<br/>
<br/>
   Random Value: 8308719569638051<br/>
       Username: mbr<br/>
      Timestamp: 1280030806<br/>
    FKO Version: 1.9.12<br/>
   Message Type: 1<br/>
 Message String: 123.1.2.3,tcp/22<br/>
     Nat Access: &lt;NULL&gt;<br/>
    Server Auth: &lt;NULL&gt;<br/>
 Client Timeout: 0<br/>
    Digest Type: 3<br/>
<br/>
   Encoded Data: 8308719569638051:bWJy:1280030806:1.9.12:1:OTYuMjQ0LjE3MS4yNTMsdGNwLzIy<br/>
<br/>
SPA Data Digest: WcUEVesZDIY+CKRKYTck8zMW7HG0S7RcqmXVIMC4L58<br/>
<br/>
Final Packed/Encrypted/Encoded Data:<br/>
<br/>
87wQ3s171if9x8628P6k1oBrQEJEmS5c/+ECed5cfDmu8hGhC5esUCEVcI8IH5TdjWva44efebX+cfXUVPBU9c/6tJpOLwC8k/8sN87SgYkBK+m64aD4FnnndaeqsrIcO/oHcpXHk9S/8rqqypcumNtlXVZD/isS3Q729LMTa+2uI6TsGX9OQ3<br/>
<br/>
Generating SPA packet:<br/>
    protocol: udp<br/>
    port: 50023<br/>
send_spa_packet: bytes sent: 182
</code>
<br/><br/>

On the fwknopd server side, we see the following printed to the terminal in
<b>--foreground</b> mode as the SPA packet is received and an iptables ACCEPT
rule is added for SSH access and then removed after 30 seconds.

<br/><br/>
<code>
Using Digest Cache: '/usr/var/run/fwknop/digest.cache' (entry count = 93)<br/>
PCAP filter is: udp port 50023<br/>
Starting fwknopd main event loop.<br/>
<br/>
<br/>
SPA Packet from IP: 123.1.2.3 received.<br/>
SPA Packet: '87wQ3s171if9x8628P6k1oBrQEJEmS5c/+ECed5cfDmu8hGhC5esUCEVcI8IH5TdjWva44efebX+cfXUVPBU9c/6tJpOLwC8k/8sN87SgYkBK+m64aD4FnnndaeqsrIcO/oHcpXHk9S/8rqqypcumNtlXVZD/isS3Q729LMTa+2uI6TsGX9OQ3'<br/>
<br/>
SPA Decode (res=0):<br/>
SPA Field Values:<br/>
=================<br/>
   Random Value: 8308719569638051<br/>
       Username: mbr<br/>
      Timestamp: 1280030806<br/>
    FKO Version: 1.9.12<br/>
   Message Type: 1<br/>
 Message String: 123.1.2.3,tcp/22<br/>
     Nat Access: &lt;NULL&gt;<br/>
    Server Auth: &lt;NULL&gt;<br/>
 Client Timeout: 0<br/>
    Digest Type: 3<br/>
   Encoded Data: 8308719569638051:bWJy:1280030806:1.9.12:1:OTYuMjQ0LjE3MS4yNTMsdGNwLzIy<br/>
SPA Data Digest: WcUEVesZDIY+CKRKYTck8zMW7HG0S7RcqmXVIMC4L58<br/>
<br/>
Added Rule to FWKNOP_INPUT for 123.1.2.3, tcp/22 expires at 1280030886<br/>
RES=0, CMD_BUF: /sbin/iptables -t filter -L FWKNOP_INPUT --line-numbers -n 2&gt;&amp;1<br/>
RULES LIST: Chain FWKNOP_INPUT (1 references)<br/>
num  target     prot opt source               destination<br/>
1    ACCEPT     tcp  --  123.1.2.3       0.0.0.0/0           tcp dpt:22 /* _exp_1280030886 */<br/>
<br/>
Removed rule 1 from FWKNOP_INPUT with expire time of 1280030886.<br/>
</code>
<br/><br/>


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

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

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

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

<link type="text/html" href="/psad/download/">
<img align="right" src="/images/release.png" title="psad-2.1.7" alt="psad-2.1.7 released" /></link>
The 2.1.7 release of <link type="text/html" href="/psad"><b>psad</b></link> is available for
<link type="text/html" href="/psad/download/"><b>download</b></link>.  This release adds some
relatively minor functionality to switch whois lookups to the destination IP
whenever the source IP is part of a directly connected subnet.  This change gives
better reporting data in normal psad email alerts.  The complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/psad/browser/psad/tags/psad-2.1.7/ChangeLog">
ChangeLog</link> entries are displayed below.  The psad-2.1.6 release was also made
a few days ago, and fixes a bug that caused psad to die on some Ubuntu systems
when using the Date::Calc Decode_Month() function, and it also added the
<b>--Override-config</b> feature so that alternate configuration variables can
be specified via config files besides psad.conf (implemented by Franck Joncourt).
<br/><br/>
<ul>
<li>(Dan A. Dickey) Added the ability to use the "ip" command from the
iproute2 tools to acquire IP addresses from local interfaces.  Dan's
description is as follows: "...A main reason for doing this is in the
case of multi-homed hosts. ifconfig sets these up on an interface using
aliases, iproute2 does not.  So, for a multi-homed interface (eth0 with
multiple addresses), ifconfig -a only shows the first one configured and
not the rest.  ip addr shows all of the configured addresses...".</li>
<li>Added ENABLE_WHOIS_FORCE_ASCII to replace any non-ascii characters in
whois data (which is common with whois lookups against Chinese IP
addresses for example) with the string "NA".  This option is disabled by
default, but can be useful if errors like the following are seen upon
receiving an email alert from psad:
<br/><br/>
        &lt;&lt;&lt; 554 5.6.1 Eight bit data not allowed<br/>
        554 5.0.0 Service unavailable
<br/><br/></li>
<li>Updated psad to issue whois lookups against IP addresses that are not
directly connected to the local system.  This is useful for example when
an internal system is scanning an external destination system, and the
scan is logged in the FORWARD chain.  Issuing whois lookups on the
internal system (frequently on RFC 1918 address space) is not usually
very useful, but issuing the whois lookup against the destination system
gives much more interesting data.  This feature can be disabled with the
new ENABLE_WHOIS_FORCE_SRC_IP variable.</li>
</ul>


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

<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>

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