<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="html">CipherDyne</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>2008-07-05T11:29:35-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">Analyzing a Trac SPAM Attempt</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/07/analyzing-a-trac-spam-attempt.html"/>
<id>http://www.cipherdyne.org/blog/2008/07/analyzing-a-trac-spam-attempt.html</id>

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

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

<!-- category: system-administration.html -->
<link type="text/html" href="http://trac.edgewall.org/">
<img align="right" src="/images/trac_logo.png" title="Spam Attempts Through Trac" alt="Spam Attempts Through Trac" /></link>
One of the best web interfaces for visualizing Subversion repositories (as well as providing
integrated project management and ticketing functionality) is the
<link type="text/html" href="http://trac.edgewall.org/">Trac Project</link>, and all Cipherdyne software projects
<link type="text/html" href="http://trac.cipherdyne.org/trac">use it</link>.  With Trac's success, it also becomes
a target for those that would try to subvert it for purposes such as creating spam.  Because
I deploy Trac with the Roadmap, Tickets, and Wiki features
<link type="text/html" href="/blog/2008/02/deploying-the-trac-timeline-and-browse-source-features.html">disabled</link>,
my deployment essentially does not accept user-generated content (like comments in tickets
for example) for display.  This minimizes my exposure to Trac spam, which has become a
problem significant enough for various spam-fighting strategies to be developed such as
<link type="text/html" href="http://madwifi.org/wiki/FightingTracSpam">configuring mod-security</link> and
<link type="text/html" href="http://trac.edgewall.org/wiki/SpamFilter">plugin</link> from the Trac project itself.
<br/><br/>
Even though my Trac deployment does not display user-generated content, there are still
places where Trac accepts query strings from users, and spammers seem to try and use these
fields for their own ends.  Let's see if we can find a few examples.  Trac web
logs are informative, but sifting through huge logfiles can be tedious.  Fortunately,
simply sorting the logfiles by line length (and therefore by web request length) allows many
suspicious web requests to bubble up to the top.  Below is a simple perl script
<b>line_len.pl</b> that sorts
any ascii text file by line length, and precedes each printed line with the line length
followed by the number of lines equal to that length.  That is, not all lines are printed
since the script is designed to handle large files - we want the unusually long lines to
be printed but the many shorter lines (which represent the vast majority of legitimate
web requests) to be summarized.  This is an important feature considering that at this
point there is over 2.5GB of log data specifically from my Trac server.
<br/><br/>
<pre>
$ cat line_len.pl
#!/usr/bin/perl -w
#
# prints out a file sorted by longest lines
#
# $Id: line_len.pl 1739 2008-07-05 13:44:31Z mbr $
#

use strict;

my %url       = ();
my %len_stats = ();
my $mlen = 0;
my $mnum = 0;

open F, "&lt; $ARGV[0]" or die $!;
while (&lt;F&gt;) {
    my $len = length $_;
    $url{$len} = $_;
    $len_stats{$len}++;
    $mlen = $len if $mlen &lt; $len;
    $mnum = $len_stats{$len}
        if $mnum &lt; $len_stats{$len};
}
close F;

$mlen = length $mlen;
$mnum = length $mnum;

for my $len (sort {$b &lt;=&gt; $a} keys %url) {
    printf "[len: %${mlen}d, tot: %${mnum}d] %s",
            $len, $len_stats{$len}, $url{$len};
}

exit 0;
</pre>

To illustrate how it works, below is the output of the line_len.pl script used against
itself.  Note that at the top of the output the more interesting code appears whereas
the most uninteresting code (such as blank lines and lines that contain closing "}"
characters) are summarized away at the bottom:

<pre>
$ ./line_len.pl line_len.pl
[len: 51, tot: 1] # $Id: line_len.pl 1739 2008-07-05 13:44:31Z mbr $
[len: 50, tot: 1]     printf "[len: %${mlen}d, tot: %${mnum}d] %s",
[len: 48, tot: 1]             $len, $len_stats{$len}, $url{$len};
[len: 44, tot: 1] # prints out a file sorted by longest lines
[len: 43, tot: 1] for my $len (sort {$b &lt;=&gt; $a} keys %url) {
[len: 37, tot: 1]         if $mnum &lt; $len_stats{$len};
[len: 34, tot: 1]     $mlen = $len if $mlen &lt; $len;
[len: 32, tot: 1] open F, "&lt; $ARGV[0]" or die $!;
[len: 29, tot: 1]     $mnum = $len_stats{$len}
[len: 25, tot: 1]     my $len = length $_;
[len: 24, tot: 1]     $len_stats{$len}++;
[len: 22, tot: 2] $mnum = length $mnum;
[len: 21, tot: 1]     $url{$len} = $_;
[len: 20, tot: 2] my %len_stats = ();
[len: 19, tot: 1] #!/usr/bin/perl -w
[len: 14, tot: 3] while (&lt;F&gt;) {
[len: 12, tot: 1] use strict;
[len:  9, tot: 1] close F;
[len:  8, tot: 1] exit 0;
[len:  2, tot: 5] }
[len:  1, tot: 6] 
</pre>

Now, let's execute the line_len.pl script against the trac_access_log file and look
at one of the longest web requests.  (The line_len.pl script was able to reduce
the 12,000,000 web requests in my Trac logs to a total of 610 interesting lines.)  This
particular request is 888 characters long, but there were some other similar suspicious
requests that had over 4,000 characters that are not displayed for brevity:

<pre>
[len: 888, tot: 1] 195.250.160.37 - - [02/Mar/2008:00:30:17 \
-0500] "GET /trac/fwsnort/anydiff?new_path=%2Ffwsnort%2Ftags%2Ffwsnort\
-1.0.3%2Fsnort_rules%2Fweb-cgi.rules&amp;old_path=%2Ffwsnort%2Ftags%2F\
fwsnort-1.0.3%2Fsnort_rules%2Fweb-cgi.rules&amp;new_rev=http%3A%2F%2Ff\
1234.info%2Fnew5%2Findex.html%0Ahttp%3A%2F%2Fa1234.info%2Fnew4%2F\
map.html%0Ahttp%3A%2F%2Ff1234.info%2Fnew2%2Findex.html%0Ahttp%3A%2F\
%2Fs1234.info%2Fnew9%2Findex.html%0Ahttp%3A%2F%2Ff1234.info%2Fnew6%2F\
map.html%0A&amp;old_rev=http%3A%2F%2Ff1234.info%2Fnew5%2Findex.html%0Ahttp\
%3A%2F%2Fa1234.info%2Fnew4%2Fmap.html%0Ahttp%3A%2F%2Ff1234.info%2Fnew2\
%2Findex.html%0Ahttp%3A%2F%2Fs1234.info%2Fnew9%2Findex.html%0Ahttp%3A\
%2F%2Ff1234.info%2Fnew6%2Fmap.html%0A HTTP/1.1" 200 3683 "-" \
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; \
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR \
1.1.4322; .NET CLR 2.0.50727; InfoPath.2)"
</pre>

My guess is that the above request is a bot that is trying to do one two
things: <b>1)</b> force Trac to accept the content in the request (which contains
a bunch of links to pages like "http://f1234.info/new/index.html" - note that
I altered the domain so as to not legitimize the original content) and
display it for other Trac users or to search engines, or <b>2)</b> force Trac
itself to generate web requests to the provided links (perhaps as a way to increase
hit or referrer counts from domains - like mine - that are not affiliated with the
spammer).  Either way, the strategy is flawed because the request is against the
Trac "anydiff" interface which doesn't accept user content other than svn revision
numbers, and (at least in Trac-0.10.4) such requests do not cause Trac to issue any
external DNS or web requests - I verified this with tcpdump on my Trac server after
generating similar requests against it.
<br/><br/>
Still, in all of my Trac web logs, the most suspicious web requests are against
the "anydiff" interface, and specifically against the "web-cgi.rules" file
bundled within the <link type="text/html" href="/fwsnort">fwsnort</link> project.  But, the requests
never come from the same IP address, the "anydiff" spam attempts never hit any
other link besides the web-cgi.rules page, and they started with regularity
in March, 2008.  This makes a stronger case for the activity coming from bot
that is unable to infer that its activities are not actually working (no
surprise there).  Finally, I left the original IP address <b>195.250.160.37</b>
of the web request above intact so that you can look for it in your own web
logs.  Although 195.250.160.37 is
<link type="text/html" href="http://www.spamhaus.org/query/bl?ip=195.250.160.37">not listed</link>
in the <link type="text/html" href="http://www.spamhaus.org">Spamhaus</link> DNSBL service, a rudimentary
<link type="text/html" href="http://www.google.com/search?q=195.250.160.37&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=com.ubuntu:en-US:unofficial&amp;client=firefox-a">
Google search</link> indicates that 195.250.160.37 has been noticed before by
other sites as a comment spammer.
<br/><br/>

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

<entry>
<title type="html">SPA Talk at the Last HOPE Computer Security Conference</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/06/spa-talk-at-the-last-hope-computer-security-conference.html"/>
<id>http://www.cipherdyne.org/blog/2008/06/spa-talk-at-the-last-hope-computer-security-conference.html</id>

<published>2008-06-28T21:01:30-05:00</published>
<updated>2008-06-28T21:01:30-05:00</updated>

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

<!-- category: passive-authorization.html -->
<!-- category: fwknop.html -->
<link type="text/html" href="http://www.thelasthope.org/">
<img class="leftnofr" src="/images/last_hope_logo.png" title="SPA talk at the Last HOPE conference" alt="SPA talk at the Last HOPE conference" /></link>
Next month in NYC the final <link type="text/html" href="http://www.thelasthope.org/">Hackers On Planet Earth (HOPE)</link>
conference will take place from July 18th through the 20th.  I will be giving a
<link type="text/html" href="http://www.thelasthope.org/talks.php">talk</link> there entitled
"<b>Port Knocking and Single Packet Authorization: Practical Deployments</b>", and here is
the abstract:
<br/><br/>
<img class="left" src="/images/dq.gif" title="" alt="" /> <i>Port Knocking and
its big brother, Single Packet Authorization (SPA), can provide a robust additional layer
of protection for services such as SSH, but there are many competing Port Knocking and SPA
implementations. This talk will present practical usages of fwknop in Port Knocking and SPA
modes, and discuss what works and what doesn't from a protocol perspective. Integration
points for both iptables and ipfw firewalls on Linux and FreeBSD systems will be highlighted,
and client-side support on Windows will be demonstrated. Finally, advanced functionality
such as inbound NAT support for authenticated connections, sending SPA packets over the
Tor anonymity network, and covert channel usages will be discussed. With SPA deployed,
anyone scanning for a service with Nmap cannot even tell that it is listening; let alone
target it with an exploit (zero-day or not).</i>
<br/><br/>
A goal for the talk will be to start with the most basic port knocking deployment
(a shared sequence of only one port) and build from there into encrypted port knocking
sequences, and then move into the SPA realm with SPA packets encrypted with Rijndael
and finally with GnuPG.  Along the way security tradeoffs will be discussed.  For example,
a shared sequence of a single port allows an extremely simplistic port knocking
implementation (so there is less risk of a vulnerability in the port knocking software
itself), but then any casual port scan or stray packet that hits the shared port also
qualifies as a valid port knock sequence.  At the high end, SPA packets encrypted with
GnuPG solve all sorts of difficulties with simple port knocking from a protocol
perspective, but there is the slight expense of a more complicated implementation
(although it is still a lot harder to target an SPA implementation with an exploit
than a complicated TCP-based service that advertises its existence to the world under
any basic port scan).
<br/><br/>
At the talk I will also release the next version (1.9.6) of <link type="text/html" href="/fwknop">fwknop</link>.
<br/><br/>If you are going to be at the HOPE conference, please stop by and say
'hello'.  <link type="text/html" href="http://www.nostarch.com">No Starch Press</link> will also be at the
conference so I'm sure I will hang out at their booth much of the time as well.

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

<entry>
<title type="html">Software Release - gootrude-0.2</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/06/software-release-gootrude-0.2.html"/>
<id>http://www.cipherdyne.org/blog/2008/06/software-release-gootrude-0.2.html</id>

<published>2008-06-19T21:01:30-05:00</published>
<updated>2008-06-19T21:01:30-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<!-- category: gootrude.html -->
<!-- category: software-releases.html -->
<link type="text/html" href="/gootrude">
<img class="leftnofr" src="http://l.yimg.com/a/i/ww/beta/y3.gif" title="Gootrude queries Yahoo" alt="Gootrude queries Yahoo" /></link>
<link type="text/html" href="/gootrude"><b>Gootrude-0.2</b></link> is available for
<link type="text/html" href="/gootrude/download"><b>download</b></link>. This release changes the
default search engine from Google to Yahoo because it appears that Yahoo's Terms of Service do not
prohibit automated queries (although I'm not a lawyer).  Gootrude retains the ability to query Google
at your own risk if you so desire.  As long as you use Gootrude as designed to collect search engine
results only once per day with a limited number of search terms (say, 20 or less), it is unlikely to
provoke a negative reaction from search engines.  Over time, support for many additional search engines
will be added to Gootrude so that search results can be trended from all sorts of different data
sources.
<br/><br/>
Also, <link type="text/html" href="/blog/2008/06/trending-low-volume-google-searches-introducing-gootrude.html">this post</link>
should really have announced Gootrude as a "search results trender" instead of a "search trender".
The goal of the project is made clear in the
<link type="text/html" href="http://trac.cipherdyne.org/trac/gootrude/browser/gootrude/trunk/README">README</link>, and here
is the complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/psad/browser/psad/tags/gootrude-0.2/ChangeLog">ChangeLog</link>,
for the Gootrude-0.2 release:
<br/><br/>
<ul>
<li>Added support for querying Yahoo for search results and made this the
default because Google's TOS does not technially allow automated
queries.  However, Gootrude continues to support querying Google for
search results, and responsible use of Gootrude once per day with a
limited set of search terms should most likely not be a cause for
concern for Google.  A new syntax of the searchterms.conf file allows
search terms to express which search engine should be queried on an
individual basis according to the following syntax (note the middle
element):

[Linux "highspeed firewalls"] [yahoo:count] [Linux_highspeed_firewalls.dat]
</li>
<li>Changed the default USER_AGENT variable to "Gootrude &lt;version&gt;".</li>
<li>Added a percentage-based offset for the plot minimum and maximum ranges
on the y-axis (with a default of 10% controlled by two new variables
MIN_PERCENT_DIFF and MAX_PERCENT_DIFF).  This value can also be set by
the search terms themselves via an additional config element as follows
(for a 20% offset instead for example):

[yrange:20%/20%]
</li>
<li>Increased SEARCH_TERM_DELAY to two seconds to be nicer to search engines.</li>
</ul>


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

<entry>
<title type="html">Trending Low-Volume Google Searches - Introducing Gootrude</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/06/trending-low-volume-google-searches-introducing-gootrude.html"/>
<id>http://www.cipherdyne.org/blog/2008/06/trending-low-volume-google-searches-introducing-gootrude.html</id>

<published>2008-06-15T21:01:30-05:00</published>
<updated>2008-06-15T21:01:30-05:00</updated>

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

<!-- category: gootrude.html -->
<!-- category: software-releases.html -->
<link type="text/html" href="/gootrude/download/">
<img class="leftnofr" src="http://www.google.com/intl/en/trends/logo.gif" title="Introducing Gootrude" alt="Introducing Gootrude" /></link>
<b>UPDATE 06/16/08: 1)</b> After <link type="text/html" href="http://tech.slashdot.org/article.pl?sid=08/06/16/1312249">making Slashdot</link>
today and reading the comments, I feel I should clarify a few things regarding this post.
First, it was pointed out (quite rightly) that
<link type="text/html" href="/gootrude">Gootrude</link> trends the number of documents in
Google's index that contain each search term, whereas Google Trends tracks the search volume
associated with a search term.  These are not the same thing.  However, I would wager that
they are related, though certainly not in some nice 1:1 correspondence.  That is, if a
relatively unique word - say, "myspace" - is mentioned within 100,000 web sites, then the
number of times this word is used as a search term in Google will be higher than if "myspace"
were mentioned in only 10 web sites just because it is exposed to many more people who would
then be interested in all things "myspace".  I would also wager that the reverse is true.
So, if "myspace" is an extremely popular search term, then it will probably also appear in
many more web sites around the Internet.  Gootrude attempts to trend the number of hits a
given search term returns in Google, and by the above reasoning, there is a loose correspondence
between this and the number of times the term is searched for in Google.  Perhaps this is
not useful, but only time will tell after Gootrude is used by a lot of people.  If you will
allow the above interpretation, then the remainder of the post below makes sense.
<br/><br/>
<b>2)</b> It was pointed out that Gootrude violates the Google
<link type="text/html" href="http://www.google.com/accounts/TOS">Terms of Service</link>.  After actually reading this
document for the first time today, I think this is a correct interpretation, and if Google were
to ask me to stop making Gootrude able to make web queries then I would comply with their request
(and switch Gootrude to query Yahoo instead).  However, let me just say that Gootrude is designed
to be run once per day with a limited set of search terms (say, about 10).  I personally make
many more manual queries to Google every day than this with my web browser, and my usage of
Gootrude cannot even remotely be interpreted as interfering with their server operations.  I'm
just interested in how Google (being the best search engine) views my open source projects.  As
a precautionary measure, I may switch Gootrude to query Yahoo by default anyway since their TOS
does not seeem to prohibit this.  Also, I would like to mention that other projects seem to make
use of Google services in ways that may be questionable in view of the Google TOS (see the
<link type="text/html" href="http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html">
Gmail Filesystem</link> for example) but Google seems to allow it.  Google probably derives more
benefits from open discussions that such projects foster than would justify shutting them down.
<br/><br/>
Now for the original post:
<br/><br/>
The <link type="text/html" href="http://www.google.com/trends"><b>Google Trends</b></link> project allows you to
input search terms like "Myspace", "2008 election", or "Linux", and see how Google tracks how
popular these search terms are over time.  The resulting graphs can be quite interesting - spikes
in search volume can sometimes be correlated against particular news articles and world events,
and the Google Trends interface points these out.
<br/><br/>
This is a handy tool, but there are many search terms that Google Trends does not display any
results for.  Such terms (such as "Linux Firewalls" - with the quotes) have insufficient search
volumes to display graphs according to the error message that Google Trends generates.  Fair
enough.  I suppose that Google sets an internal threshold on search volume, and this threshold
could be set for reasons that range anywhere from Google Trends is still experimental to Google
not wanting to provide data on how it builds its massive search index for emerging search terms.
Either way, I would like a way to see search term trends that Google doesn't currently make
available to me.
<br/><br/>
Although I'm an open source developer and author, search terms related to my projects are not
popular enough yet to be displayed by Google Trends.  So, I had to roll my own trending mechanism,
and this blog post announces the release of a new open source tool <link type="text/html" href="/gootrude"><b>Gootrude</b></link>
(see the <link type="text/html" href="/gootrude/docs/index.html">quick start</link>, <link type="text/html" href="http://trac.cipherdyne.org/trac/gootrude">
source code</link>, and <link type="text/html" href="/gootrude/download/index.html">download</link> links) that I wrote to do just this.
The basic strategy is to take a collection of search
terms defined by the user, automatically query Google for the number of results associated with each of
these search terms (this is displayed by Google when doing a web search), and graph these numbers over
time with <link type="text/html" href="http://www.gnuplot.info/">Gnuplot</link>.  At this point let me state up front
that Gootrude only makes use of data that Google freely provides to everyone with normal web
searches, and is meant to be run once per day (so as to not be a pest in terms of the numbers
of queries it makes).  As an example, if you type in the word "security" into the Google web
interface, it will return a string like "<b>Results 1 - 10 of about 1,010,000,000</b>".  The
"1,010,000,000" number is collected by Gootrude and stored in a file along with the current time.
<br/><br/>
For the past year, I have sent a set of search terms through Google once per day with Gootrude
and the results are displayed below.  Visible within the data returned from Google are strange
oscillations that vary quite a bit more than I would have expected, and also evidence for what
happens when a large site (like linux.com) posts an article about a Cipherdyne project.
<br/><br/>
First, below is the graph of the fairly unique word "cipherdyne" since late June 2007.  The
filled-in red curve is the absolute number of search results (taken each day around 1am), and
the green line is the 10-day moving average.
<img src="/images/gootrude/cipherdyne.png" title="Gootrude plot of cipherdyne search term" alt="Gootrude plot of cipherdyne search term" />
As you can see, at the beginning of the graph around July 1st Google steadily shows
about 28,000 results for "cipherdyne", but towards the end of July this dips to well below 20,000 only to
rebound in August to about 30,000.  Then, beginning around March 1st, 2008 the results shoot
up to over 100,000 briefly and then back to around 70,000 in May.  How does one interpret this
data?  It seems unlikely that these fluctuations can be entirely explained by "actual"
day-by-day changes in how external sites reference the term "cipherdyne" - there must be some
index updating component that is internal to Google at work here, and we'll see a better example
of this below.
<br/><br/>
Now, here is the graph of the search term "gpgdir":
<img src="/images/gootrude/gpgdir_annotated.png" title="Gootrude plot of gpgdir search term" alt="Gootrude plot of gpgdir search term" />
The most obvious feature of the gpgdir graph above is the large spike to around 60,000 results
around May 1st.  It turns out that an <link type="text/html" href="http://www.linux.com/feature/132999">article</link>
was posted to <link type="text/html" href="http://www.linux.com">linux.com</link> on the 24th of April, so given that
"gpgdir" is not a common word, the spike seems nicely correlated with the posting of the article
as it got bounced around the Internet and blogosphere.  A more interesting feature perhaps is
the sharp cyclic oscillation between July and December 2007.  During this time, search results for
gpgdir bounced from 1,000 to around 10,000 and back again several times, and the transition
each time was fast - making the jump to 10,000 over the course of two days and then stabilizing
for about 10 days or so and then back down to 1,000.  It is almost as though Google was trying to
establish the proper order of magnitude for "gpgdir" search results during this time via a sort
of step function.
<br/><br/>
Finally here is the graph of "single packet authorization":
<img src="/images/gootrude/single_packet_authorization.png" title="Gootrude plot of single packet authorization" alt="Gootrude plot of single packet authorization" />
Again, we see a dramatic spike in search results - from around 5,000 to well over 50,000 and
settling down to about 10,000 around the beginning of June.  Although there has been some
activity related to SPA in the <link type="text/html" href="http://ubuntuforums.org/showthread.php?t=812573">Ubuntu forums</link>
and also in the <link type="text/html" href="http://forums.gentoo.org/viewtopic-t-687956.html?sid=c174bcd01005451b4d701f76cfc20dd3">Gentoo forums</link>, if this caused Google to report the search results as over 50,000 why did
this number return so precipitously back to around 10,000?  The links have not gone away, but
they were probably mentioned on other referencing sites and then moved to less important pages
over time on those sites.  Perhaps Google is trying to find the appropriate steady state for
its search results, and there are many factors that Google takes into account that are not
available to the public.
<br/><br/>
There are lots of unanswered questions this sort of data brings to mind:
<br/><br/>
<ul>
<li>All of the data for the above graphs was collected from a single Linux system.  How
different would the results be if several systems in different geographic locations
collected the data and the average for each data point was used instead?</li>
<li>Each data point was collected around 1am every morning.  If the data collection time
were, say, 1pm, would the results have been significantly different?</li>
<li>What is the "optimal" time scale for the moving average?  Given that Google's own
Trends interface seems to show search results on the macro level, would a much longer
moving average than 10 days - perhaps on the order of several weeks - be a more
accurate reflection of search popularity?</li>
</ul>
One thing is clear - getting search results that are meaningful is much easier with unusual
search terms.  With the posting of this blog entry, the term "Gootrude" should evolve nicely
within Google results, and the graph of these results will be updated daily on the
<link type="text/html" href="/gootrude">main Gootrude page</link> so you can see this evolution as it
unfolds.
<br/><br/>
In closing, I would like to mention that Gootrude is just getting started, so there are
lots of enhancements that need to be made.  Some of the most important features to develop
are:
<br/><br/>
<ul>
<li>Integration with the <link type="text/html" href="http://code.google.com/apis/chart/">Google Charts API</link>.</li>
<li>Development of an online web portal for Gootrude so that users don't have to have their
own infrastructure to run Gootrude.</li>
<li>Ability to import search data from different Gootrude collection systems.</li>
<li>Add support for data collected from additional search engines.</li>
</ul>
If you are an open source developer and would like to contribute, see the
<link type="text/html" href="http://trac.cipherdyne.org/trac/gootrude/browser/gootrude/trunk/TODO">TODO</link> file
for an updated list of development tasks, or send me an email (mbr[at]cipherdyne[dot]org).  Also,
if you have any ideas or feedback on why some of the graphs above look the way they do in the
context of how Google builds its index, please email me.
<br/><br/>
Finally, here are a few additional graphs of search terms over the past year:
<img src="/images/gootrude/fwsnort.png" title="Gootrude plot of fwsnort" alt="Gootrude plot of fwsnort" />
<img src="/images/gootrude/michael_rash.png" title="Gootrude plot of michael rash" alt="Gootrude plot of michael rash" />
<img src="/images/gootrude/Linux_Firewalls_Attack_Detection.png" title="Gootrude plot of Linux Firewalls Attack Detection" alt="Gootrude plot of Linux Firewalls Attack Detection" />
<img src="/images/gootrude/single_packet_authentication.png" title="Gootrude plot of single packet authentication" alt="Gootrude plot of single packet authentication" />
<img src="/images/gootrude/iptables_attack_visualization.png" title="Gootrude plot of iptables attack visualization" alt="Gootrude plot of iptables attack visualization" />


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

<entry>
<title type="html">Three software releases - psad, fwknop, gpgdir</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/06/three-software-releases-psad-fwknop-gpgdir.html"/>
<id>http://www.cipherdyne.org/blog/2008/06/three-software-releases-psad-fwknop-gpgdir.html</id>

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

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>
<!-- category: psad.html -->
<!-- category: fwknop.html -->
<!-- category: gpgdir.html -->
<!-- category: software-releases.html -->
<link type="text/html" href="/about.html">
<img align="right" src="/images/release.png" title="Three software releases" alt="Three software releases" /></link>
The following releases of the Cipherdyne security projects are now available:
<link type="text/html" href="/psad/download">psad-2.1.3</link>, <link type="text/html" href="/fwknop/download">fwknop-1.9.5</link>,
and <link type="text/html" href="/gpgdir/download">gpgdir-1.9.1</link>.  The motivation for a group release
stems from the need to make similar changes to the fwknop and gpgdir projects to
update to version 2.11 of the
<link type="text/html" href="http://search.cpan.org/~schwigon/Class-MethodMaker-2.11/lib/Class/MethodMaker.pm">Class::MethodMaker</link>
perl module from CPAN - a dependency of GnuPG::Interface.  This version fixes a
build error under recent versions of perl (such as perl-5.10.0) which are distributed
on systems like <link type="text/html" href="http://fedoraproject.org/wiki/Releases/9">Fedora 9</link>.
Also, for both fwknop and gpgdir, thanks to a suggestion made by
<link type="text/html" href="http://www.sysnux.pf">Jean-Denis Girard</link> on the fwknop mailing list, the
default locale has been set to "C" via the LC_ALL environmental variable so that
GnuPG output can be properly interpreted even on systems where a different locale is
used.  The locale can be manually set or not used at all with two new command line
arguments --locale &lt;str&gt; and --no-locale respectively.  On another note,
Kevin Hilton has <link type="text/html" href="http://ubuntuforums.org/showthread.php?t=812573">written</link>
an excellent how-to for fwknop on Ubuntu systems.
<br/><br/>
For psad, it was time to make a new release after it became necessary to update the whois client so
that IP addresses such as 116.125.35.98 (which was scanning a psad user) could be
properly identified with whois records.  In addition, psad was updated to parse syslog
files directly for iptables log messages instead of requiring reconfiguration of the
syslog daemon to write kern.info messages to the /var/lib/psad/psadfifo named pipe.
This simplifies the proper installation of psad, and is now a default setting.
Although there is a slight performance penalty since psad now parses all messages
that are written to the /var/log/messages file (this is the default path), it should
not be noticeable on most systems.  Further, the old behavior of using the named
pipe can be restored via the ENABLE_SYSLOG_FILE variable in the /etc/psad/psad.conf
file.
<br/><br/>
Finally, <link type="text/html" href="http://smhteam.info/wiki/">Franck Joncourt</link> has made excellent
progress in developing Debian packages for the IPTables::ChainMgr and IPTables::Parse
<link type="text/html" href="/modules">modules</link>, and he is also close to a Debian package for the
fwknop project.
<br/><br/>
The complete change logs for these new releases can be found as follows:
<link type="text/html" href="http://trac.cipherdyne.org/trac/psad/browser/psad/tags/psad-2.1.3/ChangeLog">psad-2.1.3</link>,
<link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.5/ChangeLog">fwknop-1.9.5</link>, and
<link type="text/html" href="http://trac.cipherdyne.org/trac/gpgdir/browser/gpgdir/tags/gpgdir-1.9.1/ChangeLog">gpgdir-1.9.1</link>


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

<entry>
<title type="html">Single Packet Authorization with Port Randomization</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/06/single-packet-authorization-with-port-randomization.html"/>
<id>http://www.cipherdyne.org/blog/2008/06/single-packet-authorization-with-port-randomization.html</id>

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

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

<!-- category: passive-authorization.html -->
<!-- category: software-releases.html -->
<!-- category: fwknop.html -->
<link type="text/html" href="/fwknop/download/">
<img align="right" src="/images/chinesedoor4.jpg" title="fwknop-1.9.4 release with port randomization" alt="Single Packet Authorization with Port Randomization" height="300" width="199" /></link>
After two months of development, the 1.9.4 release of <link type="text/html" href="/fwknop"><b>fwknop</b></link>
is available for <link type="text/html" href="/fwknop/download"><b>download</b></link>.  This release introduces
new functionality that has implications for hardening both fwknop SPA communications
and the follow-on connections that client programs make (such as SSH).  Specifically,
the 1.9.4 release adds two port randomization options to 1) send the SPA packet over
a random port between 10,000 and 65,535 (requires updating the default PCAP_FILTER
variable on the fwknopd server side), and 2) select a random port that is used as
the destination port in a NAT operation on the fwknopd server system.  These two
options can be used individually or together, and are enabled with two new command
line options, --rand-port and --NAT-rand-port respectively, to the fwknop client
(see examples below).
<br/><br/>
The inspiration for adding this functionality came from a
<link type="text/html" href="http://forums.gentoo.org/viewtopic-t-687956.html?sid=b94683d3747fef4b74d101ccd897008f"><b>post</b></link>
to the "<link type="text/html" href="http://forums.gentoo.org/viewforum-f-12.html?sid=b94e0817ffad5018762afbdcee992f77">Documentation, Tips &amp; Tricks</link>".
Gentoo forum, and I have <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.4/CREDITS#L184">credited</link>
John Brendler with the idea.  In response to John's post, I would like to
mention however that <b>all</b> Port Knocking / Single Packet Authorization implementations
suffer from "piggy-back exploits", including those that select random ports for
SPA communications or for NAT operations against follow-on sessions.  A "piggy-back
exploit" is where an attacker takes advantage of the fact that a firewall rule inserted
by a PK/SPA system accepts a connection from an IP address to a destination port
specified by the SPA packet(s).  So, if the attacker can spoof packets from this
source IP, or if the attacker happens to be on the same internal network as the
SPA client (and hence sends connections out through the same NAT device), then the
firewall rule will accept these packets just as though they originated from the
legitimate SPA client system.  If an attacker is in a privileged position and
can sniff the legitimate session as it is initiated, then one can envision an
automated attack that spoofs packets from the same source IP and directs them at the
same service.  Further, such an "attack" can be made just by watching outgoing
connections without paying any attention whatsoever to whether or not a set of SPA
packets are sent first - it doesn't matter if the real connection is made to a random
translated port on the SPA system; the attacker can see this port in the real
connection itself.
<br/><br/>
Now, should you be concerned about such a piggy-back attack?  Not really.  First,
if the attacker is not going through the same NAT device as the real connection, then
any response to a spoofed packet will go back to the spoofed source - not back to the
attacker.  So, for TCP connections, unless the attacker can effectively perform a
sequence prediction attack an existing connection (and even then that is of little
use against an encrypted application layer protocol such as SSH), this is not very
effective.  Second, even if an attacker is behind the same NAT device as the SPA
client, just being able to access the targeted service over TCP/IP does not imply
an automatic vulnerability; SPA is an additive measure to whatever existing
security mechanisms are already in place (barring a vulnerability in libpcap itself
in the SPA server for example).  Third, there are an awful lot of networks out there
to which an attacker will not have such privileged access, and therefore not be in
a position able to sniff anything useful.  Forth, fwknop minimizes the opportunity
for an attacker to conduct a piggy-back attack by maintaining a small window of time
(30 seconds by default) for any new firewall rules after receiving a valid SPA
packet.  By using a connection tracking mechanism built into iptables or ipfw, any
connection established during the accept window is allowed to remain open but all
attempts to create a new connection must first preceeded with a new SPA packet in
order to gain access.
<br/><br/>
Finally, although port randomization is an enhancement, fwknop has had the ability
for a long time to allow the user to select the destination port for SPA packets with
the --Server-port argument as well as the destination port for a NAT'd connection to
an internal system.  Hence, fwknop SPA packets are not always sent over udp/62201.
But, I agree that it is useful to add the port randomization features that John Brendler
suggested, and this is why I've implemented them in fwknop.  Randomizing the SPA
destination port along with the destination port of the follow-on connection makes
traffic analysis more difficult.
<br/><br/>
Now, let us see the new --rand-port and --NAT-rand-port options in a practical
example.  We'll assume that the fwknopd server is at hostname <b>spaserver</b>
with IP 11.1.1.1, and the fwknop client runs on the <b>spaclient</b> system
with IP 12.2.2.2.  We ultimately want to gain access to SSHD on the spaserver
system, and we assume that iptables is configured in a default-drop stance for
all attempts to communicate with SSHD.  Also, there is no requirement to necessarily
attempt to gain access only to an SSHD instance running on an internal server via a
forwarded port - the iptables PREROUTING chain can forward a port to a local socket
as well (based on a routing calculation for the destination IP), and on the fwknop
client command line we use the --NAT-local argument for this.
<br/><br/>
Because the --rand-port option sends the SPA packet over a
random destination port, we first need to set the PCAP_FILTER variable as follows
in the /etc/fwknop/fwknop.conf file:
<pre class="prelarge">
[spaserver]# vi /etc/fwknop/fwknop.conf
PCAP_FILTER                 udp dst portrange 10000-65535;

[spaserver]# /etc/init.d/fwknop restart
[+] knopwatchd is running (pid: 17584), stopping daemon
[+] knoptm is running (pid: 17582), stopping daemon
[+] fwknopd is running (pid: 17580), stopping daemon
Starting the fwknop daemons.
</pre>
With the fwknopd server up and running, we now use the fwknop client to gain access
to SSHD on the spaserver system via a randomly selected NAT'd port (and we show
that SSHD is never accessible over the standard TCP port 22 even from the spaclient
system):
<pre class="prelarge">
[spaclient]$ nmap -sT -n -P0 -p 22 11.1.1.1

Starting Nmap 4.20 ( http://insecure.org ) at 2008-06-02 01:48 EDT
Interesting ports on 11.1.1.1:
PORT   STATE    SERVICE
22/tcp filtered ssh

Nmap finished: 1 IP address (1 host up) scanned in 12.017 seconds

[spaclient]$  fwknop -A tcp/22 --NAT-local --NAT-rand-port \
--rand-port -R -D 11.1.1.1

[+] Starting fwknop client (SPA mode)...
[+] Requesting NAT access for randomized port: 16791
    Resolving external IP via: http://www.whatismyip.org/
    Got external address: 12.2.2.2

[+] Enter an encryption key. This key must match a key in the file
    /etc/fwknop/access.conf on the remote system.

Encryption Key:

[+] Building encrypted Single Packet Authorization (SPA) message...
[+] Packet fields:

        Random data:    4846125760033285
        Username:       mbr
        Timestamp:      1212386108
        Version:        1.9.4
        Type:           5 (Local NAT access mode)
        Access:         12.2.2.2,tcp/22
        NAT access:     11.1.1.1,16791
        SHA256 digest:  ZyWG+nRGYMfWFssJuOy7bhGmJHpHia6T1igaNnVVhqI

[+] Sending 206 byte message to 11.1.1.1 over udp/52949...
    Requesting NAT access to tcp/22 on 11.1.1.1 via port 16791

[spaclient]$  ssh -p 16791 mbr@11.1.1.1
mbr@11.1.1.1's password:
[spaserver]$
</pre>
The above output shows that the client system indeed has access to the spaserver system
via TCP port 16791, which is forwarded to the local SSH daemon.  In the /var/log/messages
file, fwknopd has written the following messages to syslog:
<pre class="prelarge">
[spaserver]# tail /var/log/messages
Jun  2 01:54:16 spaserver fwknopd: received valid Rijndael encrypted \
packet from: 12.2.2.2, remote user: mbr, client version: 1.9.4 (SOURCE \
line num: 151)
Jun  2 01:54:17 spaserver fwknopd: add FWKNOP_PREROUTING 12.2.2.2 \
-&gt; 11.1.1.1(tcp/16791 to 22) DNAT rule 30 sec
Jun  2 01:54:17 spaserver fwknopd: add FWKNOP_INPUT 12.2.2.2 -&gt; \
0.0.0.0/0(tcp/22) ACCEPT rule 30 sec
Jun  2 01:54:58 spaserver fwknop(knoptm): removed iptables \
FWKNOP_PREROUTING DNAT rule for 12.2.2.2 -&gt; 11.1.1.1(tcp/22), 30 \
sec timeout exceeded
Jun  2 01:55:11 spaserver fwknop(knoptm): removed iptables \
FWKNOP_INPUT ACCEPT rule for 12.2.2.2 -&gt; 0.0.0.0/0(tcp/22), 30 sec \
timeout exceeded
</pre>
In closing, here is an abbreviated version (the randomization options are not
duplicated here) of the fwknop-1.9.4 <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.4/ChangeLog">
ChangeLog:</link>
<br/><br/>
<ul>
<li>Added the ability to specify the port that SPA packets are sent over
with the fwknop client by using the syntax "&lt;host|IP&gt;:&lt;port&gt;".  So, for
example, to have the client send an SPA packet to 11.1.1.1 over UDP port
12345 (instead of the default of 62201), one could use the following
command:
<br/><br/>
      $ fwknop -A tcp/22 -R -D 11.1.1.1:12345
<br/><br/>
</li>
<li>Bugfix to add a check for "keep-state" in ipfw policies in addition to
the existing "check-state" check (noticed by Sebastien Jeanquier).</li>
<li>Updated the install.pl script to try to determine the OS type as early
as possible during the install process.</li>
<li>Added the MIN_SPA_PKT_LEN variable with 160 (bytes) as the default.
This allows fwknopd to ignore packets that are not at least this many
bytes (including packet headers) before any decryption attempt is made.</li>
<li>Added --time-offset-plus and --time-offset-minus args to the fwknop
client command line.  This allows the time stamp within an SPA packet to
be influenced without setting the system clock (which normal users
cannot usually do).  This is useful for when the client and server
systems have clocks that are out of sync.</li>
<li>Bugfix on Ubuntu systems to make sure that the fwknop init script is
installed with a priority of 99 instead of 20 - this puts fwknop as late
as possible within the boot sequence so that the system is ready to run
fwknop.</li>
<li>Bugfix to not open ports that are not specifically requested in an SPA
packet even if those ports are listed in the OPEN_PORTS variable in the
access.conf file.</li>
<li>Updated to version 5.47 of the Digest::SHA module.</li>
<li>Updated to version 0.7 of the IPTables::ChainMgr module (includes
perldoc documentation).</li>
<li>Updated to version 0.6 of the IPTables::Parse module (includes perldoc
documentation).</li>
<li>Added NAT, port randomization, and and time offset option discussions to
fwknop(8) man page.</li>
</ul>


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

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

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

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

<!-- category: gpgdir.html -->
<!-- category: software-releases.html -->
<link type="text/html" href="/gpgdir/download/">
<img align="right" src="/images/release.png" title="gpgdir-1.9" alt="gpgdir-1.9 released" /></link>
The 1.9 release of <link type="text/html" href="/gpgdir">gpgdir</link> is ready for
<link type="text/html" href="/gpgdir/download/">download</link>.  This release
introduces minor fixes to change the --Obfuscate file format and adds
process locking against multiple instances of gpgdir from operating
against the same directory.
<br/><br/>
On a side note, <link type="text/html" href="http://monkeyiq.blogspot.com/">Ben Martin</link> wrote
an article on gpgdir entitled
"<link type="text/html" href="http://www.linux.com/articles/132999">Protecting directory trees with gpgdir</link>"
for <link type="text/html" href="http://www.linux.com">linux.com</link>.
Ben emphasizes using the gpgdir
--Wipe option to securely delete files from the filesystem after they are
encrypted with GnuPG, and I agree with this.  In addition, there is nothing
that prevents gpgdir from being used in conjunction with an encrypted
filesystem such as <link type="text/html" href="http://cryptmount.sourceforge.net/">Cryptmount</link>
to achieve additional protections for directory structures (which gpgdir
does not alter).
<br/><br/>
Here is the complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/gpgdir/browser/gpgdir/tags/gpgdir-1.9/ChangeLog">
ChangeLog:</link> for the 1.9 release:
<ul>
<li>Changed --Obfuscate-filenames format to not include the gpgdir PID.
This allows directories to be encrypted/decrypted under -O multiple
times without creating new filenames (which would pollute encrypted
directories under rsync to other systems).  The new -O encrypted
filename format is just "gpgdir_&lt;num&gt;.gpg".</li>
<li>Added PID locking against directories so that multiple gpgdir processes
cannot operate against the same top-level directory simultaneously.
This is useful for users that typically operate with multiple shells
and might launch gpgdir from any of them.</li>
</ul>
</p>
</div>
</content>
</entry>

<entry>
<title type="html">linux.com Article on fwknop</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/05/linux.com-article-on-fwknop.html"/>
<id>http://www.cipherdyne.org/blog/2008/05/linux.com-article-on-fwknop.html</id>

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

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

<!-- category: publications.html -->
At <link type="text/html" href="http://www.linux.com">linux.com</link> Bob Currier has written a featured
<link type="text/html" href="http://www.linux.com/feature/135100">article</link> on fwknop.  He gives a
good overview of how Single Packet Authorization (SPA) is different from port knocking,
and illustrates how to use fwknop to harden SSH communications.  Here is a quote from
the article:
<br/><br/>
<img class="left" src="/images/dq.gif" title="" alt="" /> <i>
Single packet authorization distills the essence of the port knocking concept down to
a single packet. Rather than sending a series of packets to predefined ports, single
packet authorization encodes the "knock" within the payload of one packet. Once a
proper key has been received, SPA applications modify firewall rules to allow access
to the authenticated host. We'll examine how this is accomplished by installing and
testing the Firewall KNock Operator, better known as fwknop.</i>
<br/><br/>
There are several comments attached to the article from interested users, and
additional discussion of both port knocking and SPA topics can be found at Sebastien
Jeanquier's <link type="text/html" href="http://www.securethoughts.net/spa/">online forum</link>.

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

<entry>
<title type="html">Site Update - WordPress Theme without Running WordPress</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/05/site-update-wordpress-theme-without-running-wordpress.html"/>
<id>http://www.cipherdyne.org/blog/2008/05/site-update-wordpress-theme-without-running-wordpress.html</id>

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

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

<!-- category: site-news.html -->
<link type="text/html" href="http://www.wordpress.org/">
<img align="right" src="/images/wordpress_logo.gif" title="WordPress" alt="WordPress site" /></link>
<link type="text/html" href="http://www.wordpress.org">WordPress</link> has a loyal following in the blogosphere and
is used to power thousands of websites and blogs, and several books have been written about it.
A compelling measure of WordPress popularity is the number of
<link type="text/html" href="http://themes.wordpress.net/">downloadable themes</link> that can provide an easily deployed
and consistent look and feel to WordPress sites.  So, when I was looking to update the presentation
of the cipherdyne.org site, it seemed a natural step to consider a WordPress theme.
<br/>
I've updated cipherdyne.org to use a slightly modified version of the
<link type="text/html" href="http://themes.wordpress.net/columns/3-columns/3588/daleri-selection-10/">Daleri Selection (v1.0) Theme</link>
by <link type="text/html" href="http://www.andreasviklund.com">Andreas Viklund</link>, but
with a twist: I don't run actually Word Press.  All of that PHP code and MySQL database backend
is throwing a lot of complex code (and associated potential security vulnerabilities) at a problem
that (in my case) can be solved in a simpler way.  That is, I just want to provide an outlet for my
<link type="text/html" href="/about.html">software</link> and <link type="text/html" href="/author.html">publications</link>,
and maintain a <link type="text/html" href="/">blog</link> for my corner of the security technology landscape.
For this, I just need a themed website in plain HTML and CSS along with
<link type="text/html" href="/rss.xml">RSS</link> and <link type="text/html" href="/atom.xml">Atom</link> feeds, and I need an effective
way to manage all of the pages and create new blog posts.  This is where perl, rsync, and
subversion comes in.
<br/>
The cipherdyne.org website and blog is managed by a set of custom perl scripts that
perform each the following tasks:
<ul>
<li>Provide a way to create new blog posts and link them into the cipherdyne.org blog hierarchy.  For
example, the forward and backward links at the end of each post (such as
<link type="text/html" href="/blog/2008/04/port-forwarding-via-single-packet-authorization.html">this one</link>)
are auto-generated based on the posting date, and the permanent blog links
are created from each post by the blog post title.  The number of blog posts is summarized by
date and organized into categories that can be browsed via the
<link type="text/html" href="/archives">blog archives</link>, and updates to the RSS and Atom feeds are automatically
generated.</li>
<li>Validate HTML and XML page structure.  This is exceeding easy through the use of the
perl XML::Simple module.  But, using the W3C <link type="text/html" href="http://validator.w3.org/">HTML validator</link>
is more thorough, so I periodically use it as well to spot check various pages on cipherdyne.org.</li>
<li>Validate software release MD5 digests and GnuPG signatures (see the fwknop
<link type="text/html" href="/fwknop/download">download</link> page for example), and automatically correct if any
digest is invalid.</li>
<li>Search through the entire cipherdyne.org website and flag any broken links (parsing the
output of a recursive wget against the cipherdyne.org staging server make this easy).</li>
<li>Send blog pings out via the XMLRPC::Lite module to various blog aggregation services
such as FeedBurner and Technorati.</li>
<li>Drive the entire cipherdyne.org site via Subversion for source control, and deploy
with rsync to separate staging and production servers. When it comes to deploying a more
complex piece of software for visualizing changes to the source code for any of the
cipherdyne.org projects, my first choice is <link type="text/html" href="http://trac.edgewall.org/">Trac</link>, but
when it comes to the main cipherdyne.org site, a set of HTML pages maintained by a consistent
WordPress theme is sufficient.</li>
</ul>


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

<entry>
<title type="html">Hakin9 March 2008 Issue</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/04/hakin9-march-2008-issue.html"/>
<id>http://www.cipherdyne.org/blog/2008/04/hakin9-march-2008-issue.html</id>

<published>2008-04-19T21:01:30-05:00</published>
<updated>2008-04-19T21:01:30-05:00</updated>

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

<!-- category: publications.html -->
<link type="text/html" href="http://www.en.hakin9.org/">
<img align="right" src="/images/hakin9_mar08.jpg" title="Hakin9 March 08" alt="Hakin9 March 2008 Issue" /></link>
The <link type="text/html" href="http://hakin9.org/prt/view/about-the-mag/issue/807.html">March issue</link> of
<link type="text/html" href="http://hakin9.org/">Hakin9 Magazine</link> contains some noteworthy articles
and interviews.  First is an article written by Ryan Maple entitled "Best Practices for
Secure Shell" which discusses various security measures that an administrator can use
to heighten the security of SSH.  These measures include (among others) forcing the usage
of SSH protocol version 2, restricting the address (via the ListenAddress variable) that
SSHD binds to from the default of 0.0.0.0, using tcpwrappers, and configuring SSHD to
listen on a port other than tcp/22.  Covering <link type="text/html" href="/fwknop/docs/SPA.html">Single
Packet Authorization</link> would have been difficult to include in the same article, but a
reference is made to another online article <link type="text/html" href="http://www.linuxsecurity.com/content/view/131846/171/">
Knock, Knock, Knockin' on EnGarde's Door (with FWKNOP)</link> that does discuss protecting
SSH with SPA.  Next, is Matt Jonkman's fifth part in his series "Writing IPS Rules".
This article covers the byte_test keyword in the Snort rules language and how to use it
to write signatures against length encoded protocols.  In particular, Matt illustrates
using byte_test to look for specific byte values at particular offsets derived from data
within the DHCP protocol.  The offsets themselves are determined by the data on the wire
and therefore cannot simply be hard coded within a signature beforehand. For those who are
interested in the latest IDS signatures from Matt, he has updated the online home of the
Bleeding Edge Snort ruleset to <link type="text/html" href="http://www.emergingthreats.net">Emerging Threats</link>.
Finally, both <link type="text/html" href="http://www.ranum.com/">Marcus Ranum</link> and <link type="text/html" href="http://taosecurity.blogspot.com/">
Richard Bejtlich</link> were interviewed for the March issue.  I would like to see Hakin9
do a more in-depth interview of Bejtlich though since he always has an
insightful perspective on computer security - particularly as demonstrated in his book
<link type="text/html" href="http://www.amazon.com/Tao-Network-Security-Monitoring-Intrusion/dp/0321246772/ref=sr_1_2?ie=UTF8&amp;s=books&amp;qid=1208634194&amp;sr=1-2">
The Tao of Network Security Monitoring</link>.


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

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

<published>2008-04-17T21:01:30-05:00</published>
<updated>2008-04-17T21:01:30-05:00</updated>

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

<!-- category: passive-authorization.html -->
<!-- category: software-releases.html -->
<!-- category: fwknop.html -->
Sean Greven has released the next version of his fwknop UI for Windows systems.  This
release is compatible with all fwknop daemons that are configured to accept SPA packets
that have been encrypted with the Rijndael symmetric cipher.  The executable can be
downloaded <link type="text/html" href="/fwknop/download/fwknop-client-1.8.3.zip">here</link>, and the source
code is also available <link type="text/html" href="/fwknop/download/fwknop-client-1.8.3-src.zip">here</link>.
Finally, here is a screenshot to illustrate generating an SPA packet from Windows 2000
running under VMware on an Ubuntu 7.10 system.  The fwknopd daemon is running in --debug
mode in the terminal on the right, and you can see the addition of an iptables ACCEPT
rule to allow access to SSHD:
<br/><br/>
<link type="text/html" href="/images/fwknop_UI2.png">
<img src="/images/fwknop_UI2.png" title="fwknop Windows UI" alt="fwknop Window UI update" height="420" width="660" />
</link>


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

<entry>
<title type="html">Port Forwarding via Single Packet Authorization</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/04/port-forwarding-via-single-packet-authorization.html"/>
<id>http://www.cipherdyne.org/blog/2008/04/port-forwarding-via-single-packet-authorization.html</id>

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

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

<link type="text/html" href="http://digg.com/security/How_to_Safely_Connect_to_Your_Closed_Internal_Systems">
<img align="left" src="/images/digg_it.gif" title="Digg SPA NAT access" alt="Digg How to Safely Connect to Your Closed Internal Systems via SPA and NAT" /></link><br/>
<!-- category: passive-authorization.html -->
<!-- category: software-releases.html -->
<!-- category: fwknop.html -->
<link type="text/html" href="/fwknop/download/">
<img align="right" src="/images/chinesedoor.jpg" title="fwknop-1.9.3" alt="Port Forwarding via Single Packet Authorization" height="270" width="180" /></link>
Most port knocking or <link type="text/html" href="/fwknop/docs/SPA.html">Single Packet Authorization</link>
implementations offer the ability to passively authenticate clients for access only
to a locally running server (such as SSHD).  That is, the daemon that monitors a
firewall log or that sniffs the wire for port knock sequences or SPA
packets can only reconfigure a local firewall to allow the client to access a local
socket.  This is usually accomplished by allowing the client to connect to the
server port by putting an <b>ACCEPT</b> rule in the <b>INPUT</b> chain for
<b>iptables</b> firewalls, or adding a <b>pass</b> rule for <b>ipfw</b> firewalls
for the client source IP address.  For local servers, this works well enough, but
suppose that you ultimately want to access an SSH daemon that is running on an
internal system?  If the SPA software is deployed on a Linux gateway that is
protecting a non-routable internal network and has a routable external IP address,
it is inconvenient to first have to login to the gateway and then login to the
internal system.<br/>

Since the 1.9.2 release, <link type="text/html" href="/fwknop">fwknop</link> has supported the creation
of inbound port forwarding rules for iptables firewalls via the <b>DNAT</b>
target in the <b>PREROUTING</b> chain after receiving a valid SPA packet.  This
allows direct access to internal systems on non-routable address space from the
open Internet.  Here is an example - suppose that you are running
fwknop on Linux gateway system that is protecting an internal network
<b>192.168.10.0/24</b> and has an external routable address of <b>11.1.1.1</b>.
Now, suppose that you are on travel somewhere (so your source IP address is not
predictable), and you would like to access an SSH server that is running on the
internal system <b>192.168.10.23</b>.  Finally, because fwknop is deployed, iptables
is configured in a default-DROP stance against all attempts to connect with any SSH
daemon; <b>nmap</b> cannot even tell that there is any SSH server listening.  Access is
granted only after a valid SPA packet is passively sniffed by the fwknopd daemon.
<br/><br/>
With inbound NAT support configured in fwknop (the config is mentioned below), here
is an illustration of fwknop usage in order to gain direct access to SSHD on the
<b>192.168.10.23</b> from an external network (note that the -R argument instructs
the fwknop client to automatically resolve the current IP address - 12.2.2.2 in
this case):
<pre class="prelarge">
[externalhost]$ fwknop -A tcp/22 --Forward-access 192.168.10.23,5001 \
-R -D 11.1.1.1

[+] Starting fwknop client (SPA mode)...
    Resolving external IP via: http://www.whatismyip.org/
    Got external address: 12.2.2.2

[+] Enter an encryption key. This key must match a key in the file
    /etc/fwknop/access.conf on the remote system.

Encryption Key:

[+] Building encrypted Single Packet Authorization (SPA) message...
[+] Packet fields:

        Random data:    6862733471944039
        Username:       root
        Timestamp:      1207404612
        Version:        1.9.3
        Type:           2 (FORWARD access mode)
        Access:         12.2.2.2,tcp/22
        Forward access: 192.168.10.23,5001
        SHA256 digest:  hE4zGafLtQiQiFrep+cSq/wVO7SQhwh65hmLr+ehtrw

[+] Sending 206 byte message to 11.1.1.1 over udp/62201...
</pre>
Now, port 5001 on the external IP address is forwarded through to the SSH server
on the internal 192.168.10.23 system, but only for the client IP 12.2.2.2:
<pre class="prelarge">
[externalhost]$ ssh -p 5001 mbr@11.1.1.1
Password:
[internalhost]$
</pre>
Graphically, this scenario is illustrated by the following picture.  The dotted
lines represent the SPA packet from the fwknop client (which only needs to be
sniffed by the fwknopd daemon running on the Linux gateway), and the solid
arrows represent the SSH connection from the external client through to the
internal SSH server.
<br/><br/>
<img src="/images/SPA_forwarding2.jpg" title="DNAT SPA access to internal SSH server" alt="DNAT SPA access to internal SPA server" />
<br/>
On the Linux gateway system that is running the fwknop daemon, executing the
following command illustrates the additions to the iptables policy to allow the
SSH connection to be forwarded to the internal system.  These firewall rules
are automatically deleted after a 30 second timeout (this is tunable), but any
existing SSH connection remains open through the use of the iptables connection
tracking capability.
<pre class="prelarge">
[gateway]# fwknopd --fw-list
[+] Listing rules in fwknop chains...
Chain FWKNOP_INPUT (1 references)
 pkts bytes target prot opt in out source   destination

Chain FWKNOP_FORWARD (1 references)
 pkts bytes target prot opt in out source     destination
   19  2740 ACCEPT tcp  --  *  *   12.2.2.2   0.0.0.0/0    tcp dpt:22

Chain FWKNOP_PREROUTING (1 references)
 pkts bytes target prot opt in out source     destination
    1    60 DNAT   tcp  --  *  *   12.2.2.2   0.0.0.0/0    tcp \
dpt:5001 to:192.168.10.23:22
</pre>
Finally, the <b>/etc/fwknop/access.conf</b> is configured like so to facilitate
this example, and the ENABLE_IPT_FORWARDING variable is also enabled in the
<b>/etc/fwknop/fwknop.conf</b> file:
<pre class="prelarge">
SOURCE: ANY;
OPEN_PORTS: tcp/22;
PERMIT_CLIENT_PORTS: N;
ENABLE_FORWARD_ACCESS: Y;
FW_ACCESS_TIMEOUT: 30;
KEY: aesdemokey;
</pre>
In addition to explaining the inbound NAT support offered by fwknop, this blog
post also announces the <link type="text/html" href="/fwknop/download/">1.9.3 release</link>
of fwknop.  Here is the complete <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.3/ChangeLog">
ChangeLog:</link>
<br/>
<ul>
<li>Added MASQUERADE and SNAT support to complement inbound DNAT connections
for SPA packets that request --Forward-access to internal systems.  This
functionality is only enabled when both ENABLE_IPT_FORWARDING and
ENABLE_IPT_SNAT are set, and is configured by two new variables
IPT_MASQUERADE_ACCESS and IPT_SNAT_ACCESS which define the iptables
interface to creating SNAT rules.  The SNAT supplements of DNAT rules
are not usually necessary because internal systems usually have a route
back out to the Internet, but this feature accommodates those systems
that do not have such a route.  By default, the MASQUERADE target is
used if ENABLE_IPT_SNAT is enabled because this means that the external
IP does not have to be manually defined.  However, the external IP can
be defined by the SNAT_TRANSLATE_IP variable.</li>
<li>Added hex_dump() feature for fwknop client so that raw encrypted SPA
packet data can be displayed in --verbose mode.</li>
<li>When ENABLE_IPT_FORWARDING is set, added a check for the value of the
/proc/sys/net/ipv4/ip_forward file to ensure that the local system
allows packets to be forwarded.  Unless ENABLE_PROC_IP_FORWARD is
disabled, then fwknopd will automatically set the ip_forward file to "1"
if it is set to "0" (again, only if ENABLE_IPT_FORWARDING is enabled).</li>
<li>Minor bugfix to remove sys_log() call in legacy port knocking mode.</li>
<li>Minor bugfix to expand both the Id and Revision tags via the
svn:keywords directive.</li>
</ul>


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

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

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

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

<!-- category: software-releases.html -->
<!-- category: gpgdir.html -->
<link type="text/html" href="/gpgdir/download/">
<img align="right" src="/images/release.png" title="gpgdir-1.8" alt="Software Release - gpgdir-1.8" /></link>
The 1.8 release of <link type="text/html" href="/gpgdir"><b>gpgdir</b></link> is ready for
<link type="text/html" href="/gpgdir/download/"><b>download</b></link>.  This is a minor
feature enhancement release, and here is the
Here is the complete <link type="text/html" href="http://trac.cipherdyne.org/trac/gpgdir/browser/gpgdir/tags/gpgdir-1.8/ChangeLog">
ChangeLog:</link>
<br/>
<ul>
<li>Updated the test suite to validate the gpgdir --Obfuscate-filenames
mode to ensure that files are encrypted as "gpgdir_&lt;pid&gt;_&lt;num&gt;.gpg".</li>
<li>Minor bug fix to remove the .gpgdir_map_file in --Obfuscate-filenames
mode after a successful decryption cycle.</li>
<li>Updated to version 0.36 of CPAN GnuPG::Interface module.</li>
</ul>


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

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

<published>2008-04-03T21:01:30-05:00</published>
<updated>2008-04-03T21:01:30-05:00</updated>

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

<!-- category: software-releases.html -->
<!-- category: psad.html -->
<link type="text/html" href="/psad/download/">
<img align="right" src="/images/release.png" title="psad-2.1.2" alt="Software Release - psad-2.1.2" /></link>
The 2.1.2 release of <link type="text/html" href="/psad"><b>psad</b></link> is ready for
<link type="text/html" href="/psad/download/"><b>download</b></link>.  This is a minor
bugfix release to improve support for Linux distributions that report a timestamp
in syslog messages just before any iptables log prefix.  Here is an example of
such syslog messages reported in "<b>psad --Status</b> output (sent to the
<link type="text/html" href="http://lists.sourceforge.net/lists/listinfo/psad-discuss">
psad mailing list</link> by <link type="text/html" href="http://offtopic.artofinfosec.com/">Erik Heidt)</link>:
<br class="clear" />
<pre>
[+] iptables log prefix counters:
      "[ 5370.901768] Default_Drop________": 1
      "[ 9411.899552] Default_Drop________": 1
      "[ 7560.529042] Default_Drop________": 1
      "[ 6454.263813] Default_Drop________": 1
      "[ 7038.635371] Default_Drop________": 1
      "[ 5648.026038] Default_Drop________": 1
      "[ 1207.663709] Default_Drop________": 1
      "[  394.423573] Default_Drop________": 1
      "[  186.740237] Default_Drop________": 1
      "[ 9405.138521] Default_Drop________": 1
      "[ 5364.208693] Default_Drop________": 1
      "[ 7297.121141] Default_Drop________": 1
</pre>
The bug caused the timestamp portion of the syslog messages to be included within
the iptables log prefix strings, and because timestamps are nearly unique, this
forced even the same iptables log prefix to also be treated as unique.
<br/>
Here is the complete <link type="text/html" href="http://trac.cipherdyne.org/trac/psad/browser/psad/tags/psad-2.1.2/ChangeLog">
ChangeLog:</link>
<br/>
<ul>
<li>Bugfix to not include kernel timestamps in iptables log prefixes that
contain spaces like "[   65.026008] DROP" (bug reported by Erik Heidt).</li>
<li>Bugfix to skip non-resolved IP addresses (bug reported by Albert Whale)</li>
<li>Better p0f output in --debug mode to display when a passive OS
fingerprint cannot be calculated based on iptables log messages that
include tcp options (i.e., with --log-tcp-options when building a LOG
rule on the iptables command line).</li>
</ul>


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

<entry>
<title type="html">IDS signature matching with iptables, psad, and fwsnort</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/03/ids-signature-matching-with-iptables-psad-and-fwsnort.html"/>
<id>http://www.cipherdyne.org/blog/2008/03/ids-signature-matching-with-iptables-psad-and-fwsnort.html</id>

<published>2008-03-20T21:01:30-05:00</published>
<updated>2008-03-20T21:01:30-05:00</updated>

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

<!-- category: intrusion-detection-and-iptables.html -->
<!-- category: psad.html -->
<!-- category: fwsnort.html -->
<link type="text/html" href="http://www.ukuug.org/newsletter/17.1/#ids_s_mike_">
<img align="right" src="/images/ukuug_logo.png" title="IDS + iptables" alt="IDS signature matching with iptables, psad, and fwsnort" /></link>
The <link type="text/html" href="http://www.ukuug.org/">UK's Unix &amp; Open Systems User Group</link> has re-printed
an article I wrote originally for the December, 2007 security issue of
<link type="text/html" href="http://www.usenix.org/publications/login/2007-12/index.html">USENIX ;login: Magazine</link>
The article is entitled
"<link type="text/html" href="http://www.ukuug.org/newsletter/17.1/#ids_s_mike_">IDS signature matching with iptables, psad, and fwsnort</link>"
and concentrates on how to use the iptables infrastructure in the Linux kernel as a source of
intrusion detection data.  That is, iptables offers many features (such as application layer
string matching) that allow a significant fraction of Snort rules to be converted into
iptables rules, and <link type="text/html" href="/fwsnort">fwsnort</link> automates the conversion process. The
end result is an iptables policy that is looking for evidence of malicious traffic.  Also
covered in the article is the concept of log analysis with an emphasis on passive OS
fingerprinting.  The completeness of the iptables logging format - which even includes
the options portion of the TCP header when the --log-tcp-options argument is given on the
iptables command line when building a LOG rule - allows <link type="text/html" href="/psad">psad</link> to run
the same algorithm that <link type="text/html" href="http://lcamtuf.coredump.cx/p0f.shtml">p0f</link> uses to
passively fingerprint remote operating systems.
<br/><br/>
In other news, Carla Schroder has written an
<link type="text/html" href="http://www.enterprisenetworkingplanet.com/netsecur/article.php/3734771">article</link>
on psad for <link type="text/html" href="http://www.enterprisenetworkingplanet.com">Enterprise Networking Planet</link>.
She recommends running psad alongside Snort, which falls nicely within the principle of
defense-in-depth in order to maintain a strong defensive stance.  Also, Noah Schiffman
has written an <link type="text/html" href="http://www.networkworld.com/community/node/25907">article</link> on port
knocking for <link type="text/html" href="http://www.networkworld.com">Network World</link>.  He mentions the usage
of port knocking within some malware applications as an authentication mechanism, and he also
touches on <link type="text/html" href="/fwknop/docs/SPA.html">Single Packet Authorization</link>.


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

<entry>
<title type="html">SOURCE Boston Advanced Linux Firewalls Talk Slides</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/03/source-boston-advanced-linux-firewalls-talk-slides.html"/>
<id>http://www.cipherdyne.org/blog/2008/03/source-boston-advanced-linux-firewalls-talk-slides.html</id>

<published>2008-03-17T21:01:30-05:00</published>
<updated>2008-03-17T21:01:30-05:00</updated>

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

<!-- category: conference-talks.html -->
<!-- category: fwknop.html -->
<link type="text/html" href="http://www.sourceboston.com">
<img align="right" src="/images/sourceboston_logo.gif" title="Advanced Linux Firewalls Talk Slides" alt="SOURCE Boston Advanced Linux Firewalls Talk Slides" /></link>
At the <link type="text/html" href="http://www.sourceboston.com">SOURCE Boston</link> conference in Boston
last week I gave talk entitled "Advanced Linux Firewalls"
(<link type="text/html" href="/talks/Advanced_Linux_Firewalls.pdf">slides</link>).  The conference
attendance was good considering that this is the first year the conference was
offered, and I look forward to next year.

I managed to see a few talks, and two that stood out from the crowd were
<link type="text/html" href="http://www.torproject.org/">Roger Dingledine's</link> talk "<b>How To Make
Tor Play Well With The Rest Of The Internet</b>",
and <link type="text/html" href="http://www.securitymetics.org">Andrew Jaquith's</link> talk
"<b>Not Dead But Twitching: Anti-Virus Succumbs to the
Scourge of Modern Malware</b>".  Roger highlighted several technology research
and development areas for the <link type="text/html" href="http://www.torproject.org/">Tor</link> project,
including the ability to use <b>UDP</b> instead of TCP for Tor virtual circuits.
This is of particular interest to me, since it would mean that <link type="text/html" href="/fwknop/docs/SPA.html">
SPA</link> packets could be routed over the Tor network without having to resort to
the establishment of full TCP connections (which breaks the "single packet" part
of "SPA").  Andrew gave some interesting perspectives on malware trends, including
the fact that malware over time is becoming more targeted while at the same time
exhibiting high variability.  The end result is that malware authors are able to
attack the weakest link in the creation of signatures for malware detection - the
people that reverse engineer malware.  Because human resources are scarce and slow
when it comes to reverse engineering (there is no fully automated mechanism for
this yet), malware authors are able to essentially perpetrate a DoS against
vendors that offer malware detection.


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

<entry>
<title type="html">fwknop-1.9.2 Release at SOURCE Boston</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/03/fwknop-1.9.2-release-at-source-boston.html"/>
<id>http://www.cipherdyne.org/blog/2008/03/fwknop-1.9.2-release-at-source-boston.html</id>

<published>2008-03-12T21:01:30-05:00</published>
<updated>2008-03-12T21:01:30-05:00</updated>

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

<!-- category: conference-talks.html -->
<!-- category: fwknop.html -->
<!-- category: software-releases.html -->
<link type="text/html" href="http://www.sourceboston.com">
<img align="right" src="/images/sourceboston_logo.gif" title="fwknop-1.9.2 released at SOURCE Boston" alt="fwknop-1.9.2 Release at SOURCE Boston" /></link>
Today at the <link type="text/html" href="http://www.sourceboston.com">SOURCE Boston</link> computer
security conference I will give a talk entitled "<b>Advanced Linux Firewalls</b>"
in which I will present many of the themes I discuss in my
<link type="text/html" href="http://www.cipherdyne.org/LinuxFirewalls/">book</link> published late last
year by <link type="text/html" href="http://www.nostarch.com">No Starch Press</link>.  This talk will
also launch the <b>1.9.2</b> release of <link type="text/html" href="/fwknop"><b>fwknop</b></link>,
and present several new features such as client-derived access timeouts, the
ability to select any of several digest algorithms (SHA-256, SHA-1, or MD5) for
replay attack detection, the removal of the Salted__ prefix in SPA packets
encrypted with Rijndael, and blacklist IP exclusions for incoming SPA packets.
Many of these features were implemented by the
<link type="text/html" href="http://tech.groups.yahoo.com/group/spapict/">SPAPICT team</link>
as well as several other contributors, and I wish to thank all who participated
in the fwknop development process.
<br/><br/>
You can download fwknop-1.9.2
<link type="text/html" href="/fwknop/download">here</link>, and for those interested in the changes in the
fwknop-1.9.2 release, here is the complete <link type="text/html" href="http://trac.cipherdyne.org/trac/fwknop/browser/fwknop/tags/fwknop-1.9.2/ChangeLog">
ChangeLog:</link>
<br/>
<ul>
<li>Crypt::CBC adds the string "Salted__" to the beginning of the encrypted
text (at least for how fwknop interfaces with Crypt::CBC), so the fwknop
client was updated to delete the encoded version of this string
"U2FsdGVkX1" before sending a Rijndael-encrypted SPA packet on the wire.
The fwknopd server will add this string back in before decrypting.  This
makes it harder to write an IDS signature that looks for fwknop traffic;
e.g. look for the default prefix string "U2FsdGVkX1" over UDP port 62201,
which would work for fwknop clients &lt; 1.9.2 (as long as the port number
is not changed with --Server-port).</li>
<li>Added more granular source IP and allowed IP tests so that access to
particular internal IP addresses can be excluded in --Forward-access
mode.  A new keyword "INTERNAL_NET_ACCESS" is now parsed from the
access.conf file in order to implemented these restrictions.</li>
<li>(SPAPICT Group) Added BLACKLIST functionality to allow source IP
addresses to easily be excluded from the authentication process.</li>
<li>(Grant Ferley) Submitted patch to handle SIGCHLD in IPTables::ChainMgr.</li>
<li>(Grant Ferley) Submitted patch to handle Linux "cooked" interfaces for
packet capture (e.g. PPPoE interfaces).</li>
<li>(SPAPICT Group) Applied modified version of the client-defined access
timeout patches submitted by the PICT SPA Group.  There are two new
message types to facilitate client timeouts; one for normal access mode,
and the other for the FORWARD access mode.  In the access.conf file,
there is also a new variable "PERMIT_CLIENT_TIMEOUT" to allow each
SOURCE stanza to allow client-defined timeouts or not.</li>
<li>(SPAPICT Group) Submitted patches to include support for the SHA1 digest
algorithm for SPA packet replay attack detection.  I modified these
patches for maximum configurability (see the --digest-alg argument on
the fwknop command line), and the ability to use the SHA256 algorithm as
well.  The default path to the /var/log/fwknop/md5sums file has been
changed to /var/log/fwknop/digest.cache, and the default digest
algorithm is now SHA256 (but this is tunable via the DIGEST_TYPE
variable in the fwknop.conf file).</li>
<li>Added the Digest::SHA perl module in support of the SHA1 and SHA256
digest algorithms for replay attack detection and SPA message integrity.</li>
<li>Added full packet hex dumps (including packet headers) to fwknopd in
--debug --verbose mode.  This is to help diagnose packet sniffing issues
over the loopback interface on Mac OS X (first reported by Sebastien
Jeanquier).</li>
<li>(Test suite) Bugfix to ensure that the FWKNOP_DIR variable is set to the
local output/ directory in several of the test config files in the
test/conf/ directory.</li>
<li>(Test suite) Added several tests for configurable digest algorithms in
support for the SHA256, SHA1, and MD5 digest changes made by the SPAPICT
Group.</li>
<li>Updated the fwknop client to always call encode_base64() with the string
to encode along with a second null-string argument to force all encoded
data to not include line breaks.</li>
<li>Bugfix in install.pl to not test for the iptable command on non-Linux
systems, and to not test for the ipfw command on systems that are Linux.</li>
<li>(Test suite) Updated to include the /proc/config.gz file so that the
kernel config can be reviewed (not all Netfilter hooks are necessarily
compiled in).</li>
</ul>


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

<entry>
<title type="html">Thwarting Distributed SSH Brute Force Attempts</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/03/thwarting-distributed-ssh-brute-force-attempts.html"/>
<id>http://www.cipherdyne.org/blog/2008/03/thwarting-distributed-ssh-brute-force-attempts.html</id>

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

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

<!-- category: intrusion-detection-and-iptables.html -->
<!-- category: psad.html -->
<link type="text/html" href="http://isc.sans.org/diary.html?storyid=4045">
<img align="right" src="http://isc.sans.org/images/isc/logo_header.gif" title="SSH Brute Force Attempts" alt="Thwarting Distributed SSH Brute Force Attempts" /></link>
The <link type="text/html" href="http://isc.sans.org/">SANS Internet Storm Center</link> has an interesting
<link type="text/html" href="http://isc.sans.org/diary.html?storyid=4045">diary entry</link> that discusses a set
of distributed brute force attempts against SSHD originating from a specific Class C subnet
<b>58.147.10.0/24</b>.  According to the diary entry, a random selection of IP addresses
within this subnet (which is owned by an organization in Thailand) are probing for
listening SSH daemons on the open Internet, but each IP address is limiting the number of
probes to two.  Presumably this is to fly beneath the radar of any threshold-based
detection mechanisms that might automatically block the attempts to communicate with SSHD.<br/>
 After rummaging around in my iptables logfiles, I noticed the
following two log entries that show exactly two SYN packets from the IP <b>58.147.10.209</b>
and destined for one of my systems:
<pre>
Jun  3 14:55:06 minastirith kernel: DROP IN=eth0 OUT= \
MAC=00:13:d3:38:b6:e4:00:90:1a:a0:1c:ec:08:00 SRC=58.147.10.209 \
DST=71.N.N.N LEN=60 TOS=0x00 PREC=0x00 TTL=44 ID=11651 DF PROTO=TCP \
SPT=57473 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0 \
OPT (020405780402080A7CCF5BC50000000001030302)
Jun  3 14:55:09 minastirith kernel: DROP IN=eth0 OUT= \
MAC=00:13:d3:38:b6:e4:00:90:1a:a0:1c:ec:08:00 SRC=58.147.10.209 \
DST=71.N.N.N LEN=60 TOS=0x00 PREC=0x00 TTL=44 ID=11653 DF PROTO=TCP \
SPT=57473 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0 \
OPT (020405780402080A7CCF677D0000000001030302)
</pre>
These two packets date back to June of last year, so the 58.147.10.0/24 network has
apparently been active for quite some time.  So, beyond the <b>whois</b> information
mentioned in the ISC diary entry, can we tell anything more about our friend at
58.147.10.209?  Because I always use the <b>--log-tcp-options</b> command line argument
when building my iptables LOG rules, we have nice hex dumps included in the log messages
above that represent the options portion of the TCP header.  Having this information is
necessary in order to passively fingerprint the remote TCP stack with
<link type="text/html" href="http://lcamtuf.coredump.cx/p0f.shtml">p0f</link>.  The <link type="text/html" href="/psad">psad</link>
project re-implements the p0f algorithm over iptables log messages - p0f requires raw
packet data acquired via libpcap - so what does psad have to say about the remote TCP
stack?
<pre>
[minastirith]# psad -A -m /var/log/messages --restrict-ip 58.147.10.209
[+] p0f(): 58.147.10.209 len: 60, frag_bit: 1, ttl: 44, win: 5840
[+] MSS: 1400, SACK, Timestamp: 2093964229, NOP, Win Scale: 2,
    Could not match 58.147.10.209 against any p0f signature.
</pre>
Oh well, that is unfortunate.  So, p0f does not seem to have a fingerprint that can
characterize the remote TCP stack.  I also looked through the passive OS fingerprinting
database included with the <link type="text/html" href="http://ettercap.sourceforge.net/">ettercap project</link>,
but no luck there either.  This was a manual process though because psad does not yet
support the format of the fingerprints in ettercap, but this will be supported in the
next release.<br/>
 In the meantime, the discussion in the
<link type="text/html" href="http://isc.sans.org/diary.html?storyid=4045">diary entry</link> advocates limiting
the set of IP addresses that are allowed to talk to the SSH daemon, but ends with a
comment stating that this is not always possible.  I agree with this comment, and this is
highlighted whenever you administer a system and you need access to SSHD from
unpredictable source addresses (such as when travel is involved).  A robust solution
is to deploy <link type="text/html" href="/fwknop/docs/SPA.html">Single Packet Authorization</link> with a
default-drop packet filter.  Why let arbitrary source IP addresses communicate with
your SSH daemon?


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

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

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

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

<!-- category: gpgdir.html -->
<!-- category: software-releases.html -->
<link type="text/html" href="/gpgdir/download/">
<img align="right" src="/images/release.png" title="gpgdir-1.7" alt="gpgdir-1.7 released" /></link>
The 1.7 release of <link type="text/html" href="/gpgdir">gpgdir</link> is ready for
<link type="text/html" href="/gpgdir/download/">download</link>.  This release fixes
a bug that was introduced in <b>gpgdir-1.6</b> that caused previously
encrypted directories to not be decrypted in <b>--decrypt</b> mode.  This
bug was reported by Per Ronny Westin, and the result is the addition of
a new test suite so that bugs of this type don't creep back into the gpgdir
development process.  Here is some sample output of the new test suite in
action:
<pre>

[+] ==&gt; Running gpgdir test suite &lt;==

(Setup) gpgdir program compilation..................................pass (0)
(Setup) Command line argument processing............................pass (1)
(Test mode) gpgdir basic test mode..................................pass (2)
(Encrypt dir) gpgdir directory encryption...........................pass (3)
(Encrypt dir) Files recursively encrypted...........................pass (4)
(Encrypt dir) Excluded hidden files/dirs............................pass (5)
(Decrypt dir) gpgdir directory decryption...........................pass (6)
(Decrypt dir) Files recursively decrypted...........................pass (7)
(MD5 digest) match across encrypt/decrypt cycle.....................pass (8)
(Ascii-armor dir) gpgdir directory encryption.......................pass (9)
(Ascii-armor dir) Files recursively encrypted.......................pass (10)
(Ascii-armor dir) Excluded hidden files/dirs........................pass (11)
(Decrypt dir) gpgdir directory decryption...........................pass (12)
(Decrypt dir) Files recursively decrypted...........................pass (13)
(MD5 digest) match across encrypt/decrypt cycle.....................pass (14)

[+] ==&gt; Passed 15/15 tests against gpgdir. &lt;==
[+] This console output has been stored in: test.log

</pre>
Here is the complete
<link type="text/html" href="http://trac.cipherdyne.org/trac/gpgdir/browser/gpgdir/tags/gpgdir-1.7/ChangeLog">
ChangeLog:</link> for the 1.7 release:
<ul>
<li>Bugfix to ensure that encrypted directories can actually be decrypted.
This bug was reported by Per Ronny Westin.</li>
<li>Updated to use the ".asc" extension for encrypted files in --Plain-ascii
mode.</li>
<li>Added gpgdir test suite.  All future gpgdir releases (and including this
1.7 release) require that all gpgdir tests pass on the systems where
gpgdir is developed.</li>
</ul>


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

<entry>
<title type="html">Interfacing VIM with GnuPG Encrypted Files</title>
<author>
<name>Michael Rash</name>
</author>
<link rel="alternate" type="text/html" href="http://www.cipherdyne.org/blog/2008/02/interfacing-vim-with-gnupg-encrypted-files.html"/>
<id>http://www.cipherdyne.org/blog/2008/02/interfacing-vim-with-gnupg-encrypted-files.html</id>

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

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

<!-- category: system-administration.html -->
<!-- category: software-releases.html -->
<!-- category: gpgdir.html -->
<link type="text/html" href="http://digg.com/linux_unix/Interfacing_VIM_with_GnuPG_Encrypted_Files">
<img align="left" src="/images/digg_it.gif" title="Digg VIM + GnuPG" alt="Digg VIM + GnuPG" /></link><br/>
<link type="text/html" href="http://www.vim.org">
<img align="right" src="/images/vimlogo.gif" title="Vim Editor" alt="Interfacing VIM with GnuPG Encrypted Files" /></link>
Over the years the editor I have become the most familiar with is
<link type="text/html" href="http://www.vim.org">vim</link>.  It provides features that allow the software
development process to go smoothly, such as split screens, syntax highlighting,
integration with <link type="text/html" href="http://cscope.sourceforge.net">cscope</link> tags, function
folding, and more.  By applying configuration
directives to your <b>~/.vimrc</b> file, you can instruct vim to perform some
nice preprocessing functions against files.  This blog post illustrates a
<b>~/.vimrc</b> tweak (originally from Wouter Hanegraaff) that allows vim to leverage
<link type="text/html" href="http://www.gnupg.org">GnuPG</link> to decrypt a previously encrypted file,
allow edits to be made, and then re-encrypted before it is written back to disk.
Here is the section of the .vimrc file to allow such transparent encryption and
editing:
<pre>
" Transparent editing of gpg encrypted files.
" By Wouter Hanegraaff &lt;wouter@blub.net&gt;
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
" Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.gpg set bin
autocmd BufReadPre,FileReadPre *.gpg let ch_save = &amp;ch|set ch=2
autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2&gt; \
/dev/null
" Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.gpg set nobin
autocmd BufReadPost,FileReadPost *.gpg let &amp;ch = ch_save|unlet \
ch_save
autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd \
BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg \
--default-recipient-self -ae 2&gt;/dev/null
" Undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg u
</pre>
You can combine this vim tweak with <link type="text/html" href="/gpgdir">gpgdir</link> to
maintain recursively encrypted directories, and just edit the files directly.  For
example, the following sequence of commands shows the creation of an encrypted
file and how vim then interfaces with GnuPG to allow transparent editing:
<pre>
$ cat &gt; somefile
private data
more private data
$ gpg -e somefile
$ wipe somefile
Okay to WIPE 1 regular file ? (Yes/No) yes
Operation finished.
1 file wiped and 0 special files ignored in 0 directories, 0 symlinks \
removed but not followed, 0 errors occured.
$ ls -l somefile.gpg
-rw-r--r-- 1 mbr mbr 618 2008-02-17 01:52 somefile.gpg
$ vim somefile.gpg
"somefile.gpg" [noeol] 3L, 618C

You need a passphrase to unlock the secret key for
user: "Michael Rash &lt;mbr@cipherdyne.org&gt;"
2048-bit ELG-E key, ID 1234ABCD, created 2007-05-01 (main key ID \
ABCD1234)

Enter passphrase:

&lt;apply edits now, and hit :wq &gt;

$ ls -l somefile.gpg
-rw-r--r-- 1 mbr mbr 932 2008-02-17 01:55 somefile.gpg
</pre>
As you can see from the output above, the file was modified (and the original
file <b>somefile</b> was deleted using <b>wipe</b>).
<br/><br/>
Finally, the 1.6 (UPDATE: actually, the 1.7 release is available as of 02/18/2008)
release of <link type="text/html" href="/gpgdir">gpgdir</link> is ready for
<link type="text/html" href="/gpgdir/download/">download</link>.  This is a bugfix release
that restores the exclusion of previously encrypted files from the file selection
process, and includes a few minor install.pl enhancements as well. Here is the
<link type="text/html" href="http://trac.cipherdyne.org/trac/gpgdir/browser/gpgdir/tags/gpgdir-1.6/ChangeLog">
ChangeLog:</link>
<ul>
<li>Bugfix to not include previously encrypted files (i.e. those with a .gpg
extension) in the encryption/decryption file list.  This bug was
introduced in gpgdir-1.5 when a change was made to ignore ascii-armored
files.</li>
<li>Added added LC_ALL=C locale setting for the install.pl script (this
should help to ensure gpgdir is properly installed on most systems). Two
new command line arguments --LC_ALL and --no-LC_ALL also allow the
locale setting to be changed or not used at all.</li>
<li>Added --Exclude-mod-regex option to the install.pl script so that it is
possible to force the exclusion of perl modules that gpgdir would
normally install. This is useful for ensuring that gpgdir references
perl modules that are already installed in the system perl library tree
instead of using those that are installed in /usr/lib/gpgdir.</li>
<li>Updated to display command line usage warnings without automatically
displaying the entire usage() page (which is quite long).</li>
</ul>


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

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