Sabtu, 04 Februari 2012

Impressions: Windows Sysinternals Administrator's Reference

Mark Russinovich and Aaron Margosis have written another awesome addition to the Microsoft Press catalog, Windows Sysinternals Administrator's Reference. Per my policy, because I did not read the whole book I am only posting "impressions" here and not a full Amazon.com review.

In brief this book will tell you more about the awesome Sysinternals tools than you might have thought possible. One topic that caught my attention was using Process Monitor to summarize network activity (p 139). This reminded me of Event Tracing for Windows and Network Tracing in Windows 7. I remain interested in this capability because it can be handy for incident responders to collect network traffic on endpoints without installing new software, relying instead on native OS capabilities.

I suggest keeping a copy of this book in your team library if you run a CIRT. Thorough knowledge of the Sysinternals tools is a great benefit to anyone trying to identify compromised Windows computers.

Impressions: The Tangled Web

Six years ago I reviewed Michal Zalewski's first book, Silence on the Wire. Michal is a security researcher who has consistently created high-quality content for a very long time, so I was pleased to receive a review copy of his newest book The Tangled Web.

I did not read the whole book, hence I'm posting only my "impressions" here. I recommend reading this book if you want to know a lot, and I mean a lot, about how screwed up Web browsers, protocols, and related technologies truly are. Because many points of the book are tied to specific browser versions, I suspect its shelf life to degrade a little more rapidly than some other technical titles. Still, I am shocked by the amount of research and documentation Michal performed to create The Tangled Web.

As always, Michal's content is highly readable, very detailed, and well-sourced. It's a great example for other technical authors. Great work Michal!

The Toughest Question in Digital Security

The toughest question in digital security is "who cares?"

The recent Tweet by hogfly (@4n6ir) made me ponder this question. He points to an Aviation Week story by David Fulghum, Bill Sweetman, and Amy Butler titled China's Role In JSF's Spiraling Costs. It says in part:

How much of the F-35 Joint Strike Fighter’s spiraling cost in recent years can be traced to China’s cybertheft of technology and the subsequent need to reduce the fifth-generation aircraft’s vulnerability to detection and electronic attack?

That is a central question that budget planners are asking, and their queries appear to have validity. Moreover, senior Pentagon and industry officials say other classified weapon programs are suffering from the same problem. Before the intrusions were discovered nearly three years ago, Chinese hackers actually sat in on what were supposed to have been secure, online program-progress conferences, the officials say.

The full extent of the connection is still being assessed, but there is consensus that escalating costs, reduced annual purchases and production stretch-outs are a reflection to some degree of the need for redesign of critical equipment. Examples include specialized communications and antenna arrays for stealth aircraft, as well as significant rewriting of software to protect systems vulnerable to hacking.

It is only recently that U.S. officials have started talking openly about how data losses are driving up the cost of military programs and creating operational vulnerabilities, although claims of a large impact on the Lockheed Martin JSF are drawing mixed responses from senior leaders. All the same, no one is saying there has been no impact.

While claiming ignorance of details about effects on the stealth strike aircraft program, James Clapper, director of national intelligence, says that Internet technology has “led to egregious pilfering of intellectual capital and property. The F-35 was clearly a target,” he confirms.

The point of this article is to question the impact, in business and operational terms, of the cyberwar China continues to prosecute against the West.

The toughest question in digital security is "who cares" because it is usually extremely difficult to determine the impact of an intrusion. Consider the steps required to define the business and operational impact of the theft of intellectual property (as one example -- there are many others).

  1. The victim must learn that an intrusion occurred.
  2. The victim must determine exactly what IP was stolen.
  3. The victim must understand the adversary's capability and intention to exploit the stolen IP.
  4. The victim must recognize when the adversary exploits the stolen IP by using it in an operational context.
  5. The victim must determine what countermeasures or changes in courses of actions are possible to mitigate the adversary's exploitation of the stolen IP.
  6. The victim must synthesize most or all of the previous points into an assessment of the business and operational cost of the IP theft.

Steps 1 and 2 are largely technical, but 3-6 are more business-focused. From what I have seen, everyone who is a victim in the ongoing cyberwar struggles to conduct "battle damage assessment" (BDA) for digital intrusions. Articles like the one I cited are examples showing how difficult it is to determine if anyone should care about China's exploitation of Western IP.

Jumat, 03 Februari 2012

Evtsys Part I


Eventlog-to-syslog  was a Purdue university project that has been taken up by Sherwin Faria for Google Code  and recently updated. The project is Windows 7 compliant and helps solve processing audit policies that produce large number of log entries like the commands:

auditpol /set /subcategory:"Filtering Platform Connection" /success:enable /failure:enable
auditpol /set /subcategory:"Filtering Platform Packet Drop" /success:enable /failure:enable

or the all inclusive:

auditpol /set /category:*


To use evtsys, I install Cygwin with syslog on my local Win 7 host, configure as needed /etc/syslog.conf, and start the syslog daemon ('net start syslogd'). Then I install Event-to-syslog, configure evtsys.cfg, start evtsys (-i to install as service or  -d debug mode) and invoke gawk/bash incantations on a messages file to handle queries.  These tools give me several advantages over other tool sets ('Get-winevent','psloglist', 'eventviewer') designed to query Windows events logs: fast, elegant, text based storage and filtering.   Through the  syslog facility, network message passing is possible. The default installation configures as such in the registry where these values can be changed [from Powershell], presumably after restarting the service:

PS C:\Windows\system32> gci registry::HKLM\Software\ECN\EvtSys\

    Hive: HKLM\Software\ECN\EvtSys

Name                           Property
----                           --------
3.0                            Facility       : 3
                               LogHost        : 127.0.0.1
                               LogHost2       :
                               LogHost3       :
                               LogHost4       :
                               Port           : 514
                               StatusInterval : 0
                               QueryDhcp      : 0
                               LogLevel       : 0
                               IncludeOnly    : 0
                               Tag            :
                               MaxMessageSize : 1024
                               EnableTcp      : 0

PS C:\Windows\system32> set-itemproperty -path HKLM:Software\ECN\EvtSys\3.0\ -name Facility -value 5
PS C:\Windows\system32> gci registry::HKLM\Software\ECN\EvtSys


    Hive: HKLM\Software\ECN\EvtSys


Name                           Property
----                           --------
3.0                            Facility       : 5
                               LogHost        : 127.0.0.1
                               LogHost2       :
....

They can also be configured by the command line installation:

PS C:\Windows\system32> evtsys /?
Version: 4.4 (64-bit)
Usage: C:\Windows\system32\evtsys.exe -i|-u|-d [-h host] [-b host] [-f facility] [-p port]
       [-t tag] [-s minutes] [-l level] [-n]
  -i           Install service
  -u           Uninstall service
  -d           Debug: run as console program
  -h host      Name of log host
  -b host      Name of secondary log host
  -f facility  Facility level of syslog message
  -l level     Minimum level to send to syslog.
               0=All/Verbose, 1=Critical, 2=Error, 3=Warning, 4=Info
  -n           Include only those events specified in the config file.
  -p port      Port number of syslogd
  -q bool      Query the Dhcp server to obtain the syslog/port to log to
               (0/1 = disable/enable)
  -t tag       Include tag as program field in syslog message.
  -s minutes   Optional interval between status messages. 0 = Disabled

Default port: 514
Default facility: daemon
Default status interval: 0
Host (-h) required if installing.

Check.c of the 4.0 code shows the conversion table for the facility levels:

/* Facility conversion table */
static struct {
        char * name;
        int id;
} FacilityTable[] = {
        { "auth", SYSLOG_AUTH },
        { "authpriv", SYSLOG_AUTHPRIV },
        { "cron", SYSLOG_CRON },
        { "daemon", SYSLOG_DAEMON },
        { "ftp", SYSLOG_FTP },
        { "kern", SYSLOG_KERN },
        { "local0", SYSLOG_LOCAL0 },
        { "local1", SYSLOG_LOCAL1 },
        { "local2", SYSLOG_LOCAL2 },
        { "local3", SYSLOG_LOCAL3 },
        { "local4", SYSLOG_LOCAL4 },
        { "local5", SYSLOG_LOCAL5 },
        { "local6", SYSLOG_LOCAL6 },
        { "local7", SYSLOG_LOCAL7 },
        { "lpr", SYSLOG_LPR },
        { "mail", SYSLOG_MAIL },
        { "news", SYSLOG_NEWS },
        { "ntp", SYSLOG_NTP },
        { "security", SYSLOG_SECURITY },
        { "user", SYSLOG_USER },
        { "uucp", SYSLOG_UUCP }
};

You can test them with the debug (console) option. However, the console will not return all messages.

evtsys -d -h RMFVPC -p 514
Checking ignore file...
Feb  3 10:13:26 RMFVPC Eventlog to Syslog Service Started: Version 4.4 (64-bit)
Feb  3 10:13:26 RMFVPC Flags: LogLevel=0, IncludeOnly=False, EnableTcp=False, IncludeTag=False, StatusInterval=0

To see all messages, you can tail /var/log/messages with or without text filtering:

rferrisx@rmfvpc /var/log

$ tail -f messages | gawk '{print $1,$2,$3,$4,$5,$6,$7}'
Feb 3 13:24:29 rmfvpc RMFVPC Security-Auditing: 5156:
Feb 3 13:24:29 rmfvpc RMFVPC Security-Auditing: 5152:
Feb 3 13:24:29 rmfvpc RMFVPC Security-Auditing: 5152:
...
Feb 3 13:24:37 rmfvpc RMFVPC Security-Auditing: 5156:
Feb 3 13:24:37 rmfvpc RMFVPC Security-Auditing: 5152:
Feb 3 13:24:38 rmfvpc RMFVPC Security-Auditing: 4688:

Searching the Messages file with  gawk is fast, most probably faster than with 'get-winevent', 'psloglist', or eventvwr filters:

gawk -F":" '{print $4}' Messages | sort -nr | uniq -c | sort -nr

145530  5156
137132  5447
 81992  5158
  9393  5154
  7397  5152
  5754  4688
  5475  4689
  2988  4957
  ...

gawk -F":" '$4 == 5156 {print $10,$11,$12,$13,$14,$15}' Messages

Outbound Source Address  192.168.0.11 Source Port  137 Destination Address  192.168.0.255 Destination Port  137 Protocol  17
Inbound Source Address  192.168.0.255 Source Port  137 Destination Address  192.168.0.11 Destination Port  137 Protocol  17
Inbound Source Address  192.168.0.255 Source Port  137 Destination Address  192.168.0.11 Destination Port  137 Protocol  17
Inbound Source Address  192.168.0.255 Source Port  137 Destination Address  192.168.0.11 Destination Port  137 Protocol  17
Inbound Source Address  239.255.255.250 Source Port  1900 Destination Address  192.168.0.1 Destination Port  1900 Protocol  17
Inbound Source Address  239.255.255.250 Source Port  1900 Destination Address  192.168.0.1 Destination Port  1900 Protocol  17
....

gawk -F":" '$4 == 5156 {print $13}' Messages | gawk '{print $1}' | sort -nr | uniq -c | sort -nr
  69562 192.168.0.1
   5992 192.168.0.11
   4020 127.0.0.1
   3765 6172
   3694 192.168.0.5
   2950 192.168.0.255
  ...

gawk -F":" '$4 == 5158 {print $11}' Messages | gawk '{print $1}' | sort -nr | uniq -c | sort -nr | more
   23
    7 514
    6 1434
    5 49154
    5 49153
    4 63982
    4 60711
    4 58924
  ....

gawk -F":" '$4 == 5447 {print $18,$19}' Messages | sort -nr | uniq -c | sort -nr
  29026  Media Center Extenders - WMDRM-ND/RTP/RTCP (UDP-In) Type  Not persistent Run-Time ID
  10186  File and Printer Sharing (Spooler Service - RPC-EPMAP) Type  Not persistent Run-Time ID
  10061  Media Center Extenders - RTSP (TCP-In) Type  Not persistent Run-Time ID
   5889  Boot Time Filter Type  Not persistent Run-Time ID
   2967  Port Scanning Prevention Filter Type  Not persistent Run-Time ID
   2201  Microsoft Visual Studio 11 Developer Preview Remote Debugger Discovery (devenv.exe) Type
   2111  Query User Type  Not persistent Run-Time ID
   1714  Network Discovery (SSDP-In) Type  Not persistent Run-Time ID
  ....

Senin, 09 Januari 2012

Best Book Bejtlich Read in 2011

It's time to name the winner of the Best Book Bejtlich Read award for 2011!

I've been reading and reviewing digital security books seriously since 2000. This is the 6th time I've formally announced a winner; see my bestbook label for previous winners.

Compared to 2010 (31 books), 2011 saw a decrease to 22 books. Remember all reading is neither equal nor fast. When I review a book, I am sure to read it and not just skim it. For 10 books last year, I chose not to read them but to instead post impressions. Posts called "impressions" provide my sense of the book but I do not publish them in my Amazon.com reviews.

My ratings for 2011 can be summarized as follows:

  • 5 stars: 10 books

  • 4 stars: 7 books

  • 3 stars: 4 books

  • 2 stars: 1 book

  • 1 stars: 0 books

Please remember that I try to avoid reading bad books. If I read a book and I give it a lower rating (generally 3 or less stars), it's because I had higher hopes.

Here's my overall ranking of the five star reviews; this means all of the following are excellent books. The links point to my reviews. And, the winner of the Best Book Bejtlich Read in 2011 award is...

  • Hacking: The Art of Exploitation, 2nd Ed by Jon Erickson; No Starch. My review said in part:

    Jon Erickson's Hacking, 2nd Ed (H2E) is one of the most remarkable books in the group I just read. H2E is in some senses amazing because the author takes the reader on a journey through programming, exploitation, shellcode, and so forth, yet helps the reader climb each mountain. While the material is sufficiently technical to scare some readers away, those that remain will definitely learn more about the craft.

Looking at publishers, for the first year I can remember no publisher won more than one title. No Starch breaks the string of 3 straight previous BBBR victories held by Syngress.

Thank you to all publishers who sent me books in 2011. I have plenty more to read in 2012.

Congratulations to all the authors who wrote great books in 2011, and who are publishing titles in 2012!

Minggu, 08 Januari 2012

Telling a Security Story with Charts

The image at left appeared in the 31 December 2011 edition of The Economist magazine in the article Economics focus -- How to get a date: The year when the Chinese economy will truly eclipse America’s is in sight. It depicts 15 measurements of the US and Chinese economies, with historical and projected data. There is a version available at this page with more statistics comparing the two nations.

The Economist presents these charts for the following reason:

In the spring of 2011 the Pew Global Attitudes Survey asked thousands of people worldwide which country they thought was the leading economic power. Half of the Chinese polled reckoned that America remains number one, twice as many as said “China”. Americans are no longer sure: 43% of US respondents answered “China”; only 38% thought America was still the top dog. The answer depends on which measure you pick. (emphasis added)

The reason I like these charts is that they remind me of how many security practitioners think about "being secure." Managers likely often ask security staff "Are we secure?" The truth is there is no single number, so anyone selling you a "risk" number is wasting your time (and probably your money). However, it would be much more useful to display a chart like that created by the Economist. The security staff could choose a dozen or more simple metrics to paint a picture, and let the viewer interpret the answer using his or her own emphasis and bias.

Another reason I like the Economist chart is that the magazine built it using specified assumptions of future activity, listed in the article. If you disagree with these assumptions you can visit the second link I posted to devise your own charts. Although not shown here, what would be even more useful is showing these charts as a time series, with snapshots for January, then February, and so on. This "small multiples" approach (promoted by Tufte) capitalizes on the skill of the human eye and brain to observe and observe differences in similar objects.

If you had to pick a dozen or so indicators of security for a chart, what would you depict? The two I consider non-negotiable are 1) incidents per unit time and 2) time to containment for incidents.

Happy 9th Birthday TaoSecurity Blog

Today, 8 January 2012, is the 9th birthday of TaoSecurity Blog. I wrote my first post on 8 January 2003 while working as an incident response consultant for Foundstone. 2843 posts later, I am still blogging. Looking at all 9 years of blogging, I averaged 315 per year, but in the age of Twitter (2009-2011) I averaged only 171 blog posts per year.

I plan to continue blogging, but I expect around the same number as last year -- somewhere in the 60 to 100 post range. I spend a lot more time expressing my views to the press and market researchers and analysts, so I'm often less inclined to do more of that in my free time through this blog. I plan to devote any decent chunks of free time to more traditional writing. I love to use Twitter for quick commentary. Thanks for joining me these 9 years -- I hope to have a 10 year post in 2013!

If you're a security blogger, and you like this blog, please consider voting for me via the 2012 Social Security Bloggers Awards. I'm nominated for "Most Educational Security Blog" and the Hall of Fame. Thank you again!

Don't forget -- today is Elvis Presley's birthday. Coincidence? You decide.

The image shows Elvis training with Ed Parker, founder of American Kenpo. As I like to tell my students, Elvis' stance is so wide it would take him a week to react to an attack. Then again, he's Elvis.

I studied Kenpo in San Antonio, TX but I'm going to try Tai Chi again, something I first practiced about 16 years ago in Billerica, MA during grad school.