Pages

Monday, March 7, 2016

SWMO Tech Geeks March Madness tournament pool

Welcome to the second annual SWMO Tech Geeks March Madness tournament pool. There are some great prizes available this year. Stronghold Data has graciously donated a $25 Mythos gift card, an external USB battery pack, and car charger. I'm also providing a $5 Starbucks gift card. The prizes are:

1st place; $25 Mythos card + external battery pack
2nd place: $5 Starbucks card + car charger

There is no entry fee and one bracket per person. The pool is open to any Joplin area geeks so feel free to pass this on. Sign up now, brackets are available on March 13th.

Sport: Mayhem
League Abbreviation: swmo-tech
League Password: geeks

If you do not have a CBSSports.com account you will be prompted to create one.

Monday, September 23, 2013

Demystifying the Command Line

The command line can be a confusing place. There is lots of black space and no where to click. This post is my attempt to at least partially demystify the command line. I realize this can be an intimidating tool. Powerful tools will always seem more difficult when you first adopt them.
Let's start with a simple PowerShell example to create a user account.
New-ADUser clark.kent -surname "Kent" -givenname "Clark" -displayname "Clark Kent"
I want to break this command into components. The first component is "New-ADUser". This is the command to be executed. In PowerShell, this is referred to as a PowerShell Cmdlet (pronounced command-let). This is the program (or script) to be executed. A quick note about case. Windows is case-insensitive which means you can use new-aduser, NEW-ADUSER, or nEW-aduSER. All of these examples are valid.
The next component is "clark.kent". This is an argument or parameter. Arguments are either optional or required. A command may have no arguments, one argument, or multiple arguments. Whether a argument is required and the number of arguments to use is determined by the command (or cmdlet).
The final component in this example is an option. The options in the above example are "-surname", "-givenname", and "-displayname". An option is just what the name suggests, a way to provide additional information at the command line. Command line options are typically not required. Some options will require a corresponding value while others will work as a toggle (to enable or disable a certain behavior). The options above all have corresponding values. See the table below.
OptionValue
surnameKent
givennameClark
displaynameClark Kent
A side note about options. The specifier for options will vary based on the command, operating system, or environment. In PowerShell, the specifier is the dash symbol (-). In the Windows command line, it is typically the slash (/). In Linux, the dash or double dash is common (- or --).
When you are using PowerShell, you can always find help with the Get-Help cmdlet. To find help with the New-ADUser cmdlet, use "Get-Help New-ADUser". You may be able to find examples by using the -examples option (i.e. "Get-Help New-ADUser -examples").
Finally, consider the example below. Hopefully the information above allows you to better understand this more complex command.
New-ADUser –Name "Jimmy Olsen" –SamAccountName jimmy.olsen –DisplayName "Jimmy Olsen" –Title "Photojournalist" –Enabled $true –ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString "TheD@ilyPlan3t" -AsPlainText -force) -PassThru
Try to identify the components of this command.
This example uses PowerShell but the concepts apply to other systems. I hope this helps you to understand the command line a little better.

Tuesday, June 11, 2013

Review: Network Flow Analysis


Network Flow Analysis
Network Flow Analysis by Michael Lucas

My rating: 4 of 5 stars



This book is great if you are just getting started and not familiar with network flows. It walks you through all the steps you need from configuring your sensors and collectors to setting up a flow reporting system. I did give the book 4/5 stars because there are a few mistakes and shortcuts. It's nothing that an experienced network admin can't overcome but is a little frustrating. Like most technical books, some of the software and websites have changed. Just be prepared to do a little searching as you work through the book.

Overall, the content is spot on and I would recommend this to any network admin who is responsible for performance and maintenance.




View all my reviews

Review: The Lion, the Witch and the Wardrobe


The Lion, the Witch and the Wardrobe
The Lion, the Witch and the Wardrobe by Pauline Baynes

My rating: 0 of 5 stars



I'm trying to catch up on some books I started. I glad I came back to this one. It's great, I can't wait to read the rest of the series!



View all my reviews

Friday, March 8, 2013

Downgrade VMware Virtual Hardware Version

Note: According to VMware documentation, downgrading the hardware version of your vSphere virtual machine is unsupported

Recently, I found myself in a pinch and needing to quickly spin up a virtual guest on an ESXi 4.1 host. Unfortunately, the only template I had available for Windows Server 2008 R2 used virtual hardware 8 which is not compatible with ESXi 4.1. The notes below describe how I was able to downgrade the hardware version on a template from 8 to 7 and deploy a guest from that template.

There are three steps to downgrade the VMware hardware version on a template.
  1. Remove the template from vCenter or host inventory (be careful not to delete it from disk).
  2. Edit the .vmtx file and .vmdk pointer files.
  3. Add the template back to the inventory.

In order to downgrade a VM template, you need to edit two files; a vmtx file and the vmdk pointer file. The simplest way to make these changes is from an SSH session on your ESXi host (or the ESXi console). After removing the template from inventory, navigate to the directory containing the VM template and open the .vmtx file in your favorite editor (like vi). Look for this line

virtualHW.version = "8"
and change it to
virtualHW.version = "7"

Save the changes to the vmtx file and find the pointer file to the vmdk. Open it with your editor and look for this line

ddb.virtualHWVersion = "8"
and change it to
ddb.virtualHWVersion = "7"

Now save this file and exit your editor. Add the template back to the inventory and test it out by deploying a VM guest from the template.

If you found this useful or if it didn't work out, leave a comment below.

Thanks for visiting!

                     


Sunday, July 1, 2012

Review: The Wreckage: A Thriller


The Wreckage: A Thriller
The Wreckage: A Thriller by Michael Robotham

My rating: 0 of 5 stars



Michael Robotham is one of my favorite authors. These books engage you from the beginning and I find it difficult to put them down. The Wreckage is no different, filled with action and a complex story line. A late twist brings everything into focus.

With all that said, I found The Wreckage to lack the suspense from some of the earlier novels. This is still a great book and very enjoyable. I love it and can't wait for [b:Say You're Sorry|13521564|Say You're Sorry|Michael Robotham|http://photo.goodreads.com/books/1340805869s/13521564.jpg|19082240] to hit US shelves!



View all my reviews

Friday, May 25, 2012

Fake Antivirus and Firefox Cache Tools

Firefox has some pretty nifty features. One of those is the ability to view the cache contents without any extra tools. This post covers an incident with a fake antivirus popup and how I used the built in Firefox tools to confirm my suspicions.

The Story

This all started when I got a text message from my wife earlier today. This is the image she sent me:
The story goes, our daughter was using the computer and this appeared on the screen. My initial thought was this is a fake antivirus popup. However, we do have Microsoft Security Essentials (MSE) on that computer and the screen shot is convincing. Following the old saying of "you are better safe than sorry"; I told her to shut down the computer and I would look at it when I got home.

The Initial Review

Once at home, I looked more closely at this incident. First, I opened MSE to review the logs and found that nothing was detected in any previous scans (edit: MSE actually calls this History). This starts to confirm the suspicion of a fake antivirus popup.

The next step was to take the cache files from my daughter's profile and put them in a virtual machine. Since she uses Firefox, this is easy to do. If you are interested, explanations of the Firefox cache directories are here.

A quick peek at the history reveals this is definitely fake antivirus related.
The entries for detectionprotectorprocesses.in and "Viruses were found on your computer!" are dead giveaways. At this point you could stop but I will take a few more minutes to show you some of the Firefox cache exploration tools.

Firefox Cache Tools

I start the cache exploration by typing about:cache into the URL bar. This gives you the screen below which is not very useful.
Clicking on "List Cache Entries" starts to look more interesting.
This page can be searched by pressing Ctrl+F. I searched for "detectionprotectorprocesses.in".
The fifth detectionprotectorprocesses.in entry refers to a PNG image file. Clicking on that link takes us to another page, specific to the alert.PNG cache entry.
This page is filled with information. It includes HTTP server response headers and a full packet capture of the PNG image. In the center of the page is a line marked "file on disk". This gives the location on the disk where the cached image is located. I navigated to that location, copied the file to a temporary directory, and renamed it with a PNG extension.
Opening this file removes any remaining doubt about the fake antivirus popup. This recovered image perfectly matches the text message I received earlier today!


Conclusion

I suspect the popup came from the website directly prior in the browsing history, possibly from an advertisement. If that is true, it appears the problem has been remedied. I did look for some contact information on that website, but I did not locate any. I would have preferred to report this information, but I was unable to.

Firefox is a great browser. These cache tools are great for troubleshooting and fun to explore with as well. I am certain Firefox includes many more tools that I don't know about. Hopefully you found something useful in this post. Thanks for reading!

Thursday, May 24, 2012

Installing Nmap 6 on BackTrack 5 R2



It turns out, getting Nmap 6 to run on BackTrack 5 R2 is actually quite simple. Follow the steps below and prepare to bask in the newness of Nmap 6.


Linux Security Cookbook by Barrett, Daniel J./ Silverman, Richard E./ (Google Affiliate Ad)

First, you need to get rid of the included Nmap which is version 5.61. Simply run this command:
apt-get -y autoremove nmap

This command should only take a few seconds to complete. Next, grab the Nmap 6 source using this command:
wget http://nmap.org/dist/nmap-6.00.tgz

The source tarball is about 22 MB so it should (hopefully) download pretty quickly. After you have the source, you need to extract it. You can do that with this command:
tar zxvf nmap-6.00.tgz

Finally, these commands will compile and install Nmap 6. If you are unfamiliar with Linux, these are standard commands for installing software from source code.
cd nmap-6.00
./configure
make
make install

Depending on your hardware, these commands make need a few minutes to complete. To check that Nmap is installed, run:
nmap -V
This command should report version information similar to this:
Nmap version 6.00 ( http://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.1.3 nmap-libpcre-7.6 libpcap-1.0.0 nmap-libdnet-1.12 ipv6
Compiled without: openssl

Now, Nmap 6 is installed. Check out the announcement here, http://nmap.org/6. You may also want to check out my previous post on Nmap NSE scripts, http://www.marshalgraham.com/2012/05/getting-started-with-nse-nmap-scripting.html.

One thing to note regarding this installation method. During the first step, the BackTrack maintained Nmap package is removed. This means that apt-get will no longer be able to update Nmap. When a new Nmap version is released, you will need to repeat this procedure to upgrade to the current version.

Happy Nmaping!

Edit: If you want to restore the BackTrack maintained Nmap, you can. Go back to the nmap-6.00 directory and run make uninstall. Next run apt-get -y install nmap to reinstall the packaged version of Nmap.


Wednesday, May 23, 2012

Getting Started With NSE, The Nmap Scripting Engine

After talking with some friends last week, I realized that the Nmap Scripting Engine (NSE) is an unappreciated and underutilized Nmap component. That is unfortunate, since NSE has easily become my favorite Nmap feature. According to the Nmap 6 release notes, the number of available NSE scripts is nearly 350! This seems like a good time for a long overdue blog post. This post talks about using the built in Nmap 5 scripts. It's intended to introduce NSE and assumes at least some Nmap exposure.
If you are using Backtrack 5, the NSE scripts are located in /usr/local/share/nmap/scripts/. Each file ends with a .nse extension and is plain text. The scripts cover a variety of areas including vulnerabilities, information gathering, and exploitation. If you are uncertain of what a script does, simply open it in a text editor.

I'll walk you through a few examples of using NSE scripts. The first will show running the smb-enum-shares.nse script. This script connects to a Windows or Samba file server and enumerates the shares. The syntax is:
nmap -Pn --script=smb-enum-shares 192.168.1.136

You will obviously need to replace 192.168.1.136 with the IP address of your file server. Here is the output:

You can see there are four shares: ADMIN$, C$, IPC$, and "Documents and Settings". Another simple script is http-headers which does exactly what it says, retrieves HTTP headers. Here is the syntax:
nmap -Pn -p80 --script=http-headers slashdot.org

Again, replace "slashdot.org" with the server you wish to retrieve the HTTP headers from. And here is the output:

Those are some pretty simple examples. Here is a little more complex one using smb-check-vulns.
nmap -Pn -p445 --script=smb-check-vulns 192.168.1.136

While this command may not appear more complex than the previous examples, the checks performed are more powerful. This command checks for the MS08-067 vulnerability and if the host is infected with Conficker. Here is the output:

You can try running the unsafe checks with the command below. I have had limited luck with this, usually resulting in an SMB server crash (not good in a production environment!).
nmap -Pn -p445 --script=smb-check-vulns --script-args=unsafe=1 192.168.1.136

The previous commands all demonstrated running a single NSE script. Another method of invoking scripts is to use NSE script categories. This link lists all of the available categories, http://nmap.org/book/nse-usage.html#nse-categories. One of my favorites is the broadcast category. This is a very safe category that can be run on a production network with virtually no concerns. The syntax is very similar to the previous examples:
nmap -Pn --script=broadcast

Notice how this example does not specify a target host. These scripts find hosts and services that advertise themselves to the network broadcast address. The output format looks a little different than the previous examples. Each script name will be listed followed by the script output. Warning: these scripts can output a significant amount of data! Here is some sample output:

This scan produced output from these scripts: broadcast-wpad-discover, targets-ipv6-multicast-slaac (are you sure you aren't running IPv6?), broadcast-ping, and broadcast-netbios-master-browser. Broadcast-wpad-discover only returned that it could not discover a WPAD DNS or DHCP entry.

To get an idea of what broadcast checks are performed, check the broadcast scripts in /usr/local/share/nmap/scripts/ (ls /usr/local/share/nmap/scripts/broadcast*). Here's a sampling of things I have discovered using the broadcast category: Dropbox clients, shared iTunes libraries, TiVo beacons, mDNS/Avahi/Bonjour services, MS SQL servers, UPnP capable hosts, Netbios hosts, and proxy servers (via WPAD discovery). The TiVo actually discloses the TiVo Service Number (sort of like a serial number). It seems like each time I run this script, I find a new service. While writing this article, I learned from the broadcast-upnp-info script that the Roku runs an embedded web server on TCP port 8060! However, I think the real power of the broadcast scripts is the ability to enumerate network hosts and services in virtual silence, never requiring a direction connection to the discovered host or service.

I hope you enjoyed this intro to NSE scripts. Thanks for reading!


Sunday, January 29, 2012

Review: It's Not All about Me: The Top Ten Techniques for Building Quick Rapport with Anyone


It's Not All about Me: The Top Ten Techniques for Building Quick Rapport with Anyone
It's Not All about Me: The Top Ten Techniques for Building Quick Rapport with Anyone by Robin Dreeke

My rating: 5 of 5 stars



This is one of my favorite books and I'm certain that I will read it again and again. It offers some great advice for quickly building relationships. The material is presented in a concise and easy to understand format. Even the most shy or introverted individual can benefit from this book.

If you have problems starting conversations or have ever felt you have trouble finding the right words, this book will help.



View all my reviews

Saturday, January 7, 2012

Review: Freedom (TM)


Freedom (TM)
Freedom (TM) by Daniel Suarez

My rating: 4 of 5 stars



Freedom is a little too much science fiction for me. It is a good book; but the idea that large swaths of the population would be willing to supplant modern governments for what amounts to a real life MMORPG is a too far fetched for my tastes. I give it four stars because it is well written and has enough action and suspense to overcome the plot shortcomings.



View all my reviews

Wednesday, October 26, 2011

Install and Configure Snort IDS on Windows

I recently attended the BSidesMO conference in the Missouri Capitol building at Jefferson City, MO. I had the honor of doing a presentation on running Snort as a sysadmin. Even though I struggled through the presentation, it went pretty well. The audience was very responsive and had a lot of questions which I think is a good thing (at least I know they weren't sleeping). I probably forgot to mention it but if you were in the audience, thank you for attending. More importantly, thank you for not heckling me. Lucky for you, I'm better at writing blog posts than I am leading in person presentations.

Managing Security with Snort and IDS Tools by Cox, Kerry/ Gerg, Christ (Google Affiliate Ad)

This blog post is the missing manual from my presentation. My perspective is that good sysadmining is good security. While I may not be a security professional, that does not mean I do not care about doing my part to keep my organization secure. A copy of my BSidesMO presentation is available at http://bit.ly/u99bfm.

Setup
If you are interested in running Snort on Windows there are a few things you should know beforehand. I'll run through the steps to get Snort installed and configured on Windows.

The first thing you need is a Windows computer. Any modern version of Windows will work (XP/Vista/7/2003/2008). The same goes for hardware, most modern desktop or server systems will run Snort to monitor a small/medium sized network. A modern CPU with 2 GB+ RAM will be adequate. You will want multiple network cards, at least two. If you plan to monitor more than one location in your network then you will need a NIC for each.

Configure one network card as you normally would, assign an IP address and install clients as normal. This network card will be used for management. The other cards should be "silent" on the network. That means disable all the clients, services, and protocols. This will prevent your IDS from introducing any traffic on the interface it is supposed to be monitoring. See the screen shot to the right.

Installation
With that out of the way, the next step is to start installing Snort and it's prerequisites. Here's the list of things I would suggest you install. The order you install these does not particularly matter.
 Okay you caught me, these are not all required. I put an asterisk next to the optional ones. I suggest installing these just to make your life a little easier. Kiwi Syslog is not actually required either. I suggest using a dedicated syslog server but if that's not an option, Kiwi will do. One last suggestion, install Snort and Kiwi Syslog on a separate hard disk or partition from the Windows OS. This will prevent a run away log file from crashing your server.

One last prerequisite is a perl module, Sys::Syslog. This is necessary for using pulledpork and can be installed by opening a command prompt and entering the commands below.
perl -MCPAN -e shell
install Sys::Syslog

exit
pulledpork
Next, head over to https://code.google.com/p/pulledpork/ and get the latest version of pulledpork (0.6.1 as of this post). Pulledpork is a perl script for downloading and managing Snort rules. Since pulledpork is distributed as a tarball, you will need 7-Zip to extract it. I put it in a directory named D:\pulledpork-0.6.1. While you are there, go ahead and create a directory named D:\tmp to use as a temp folder for pulledpork.

You need to edit pulledpork.pl. This is necessary to get pulledpork to run on Windows. Open pulledpork.pl with gVim and go to line 528. Change line 528 from this:
open( DATA, "$path$file" ) || croak "Couldn't read $file - $!\n";

to this:

open( DATA, "$path$file" ); # || croak "Couldn't read $file - $!\n";

Next use gVim to open pulledpork.conf from the etc directory. You will need to make several changes to this file. This is a good time to mention the two main sources for free or premium rules. You can get rules from http://www.snort.org and http://www.emergingthreats.net. You can use either or both rulesets.

Back to editing pulledpork.conf. Start by enabling one or more of the rule_url lines. If you plan to use the snort.org or premium EmergingThreats rules, you will need to include your oink code. Make the rest of the changes below (appropriate to your installation location).
  • temp_path=D:\tmp
  • sid_msg=D:\Snort\etc\sid-msg.map
  • sid_changelog=D:\Snort\log\sid_changes.log
  • comment out entire so_rule section
  • snort_version=2.9.1.0
The last line is just a trick to get the latest version of the free rules from snort.org. Open a command prompt and change directories to your pulledpork installation. Run the command below to grab the rules from the URLs you selected in pulledpork.conf. This command is all on one line.

perl d:\pulledpork-0.6.1\pulledpork.pl -c d:\pulledpork-0.6.1\etc\pulledpork.conf -vTk -K D:\Snort\rules
After it completes, check your D:\Snort\rules folder for newly downloaded rules. If everything went right, you can use this command and create a scheduled task to automate rule downloads.

A quick note, pulledpork modifies the name of the .rule files that it downloads and extracts. It prepends VRT- to rules from snort.org and ET- for rules from EmergingThreats. This will be important in a later step.

emerging.conf
If you decided to use the EmergingThreats rules then you need to get a copy of emerging.conf. Go to http://rules.emergingthreats.net, browse to the ruleset and Snort version you are using, and get a copy of emerging.conf. Put this file in your D:\Snort\rules folder. Edit it with gVim and uncomment var SSH_PORTS 22.

Now, do a gVim substitute (:s) or find and replace. You need to modify the .rule file names. Replace all instances of $RULE_PATH/ with $RULE_PATH/ET-.

Before


After
Browse through the rules and uncomment the rules you would like to run. More on this in a minute.

snort.conf
You are getting closer and will be running snort in just a few more minutes. This will be the last file that needs to be edited. Using gVim, open snort.conf from D:\snort\etc. Do a find and replace replacing include $RULE_PATH/ with include $RULE_PATH/VRT-. Do another find and replace, this time changing ipvar to var. The rest of the changes to make are listed below.
  • modify var HOME_NET X.X.X.X/X (change to your network)
  • modify var RULE_PATH d:\snort\rule
  • modify dynamicpreprocessor directory d:\Snort\lib\snort_dynamicpreprocessor <- no trailing slash!
  • modify dynamicengine d:\Snort\lib\snort_dynamicengine\sf_engine.dll
  • comment out #dynamicdetection directory /usr/local/lib/snort_dynamicrules
  • comment out all preprocessor lines (preprocessors do not work in IDS mode)
  • add output alert_syslog: host=127.0.0.1:514, LOG_AUTH LOG_ALERT
  • uncomment or add output log_tcpdump: tcpdump.log
  • add include $RULE_PATH/emerging.conf
  • Choose a few VRT rules to run (optional)
Running Snort
Snort is now installed and configured. All that is left is starting and testing your Snort install and then you are ready to start monitoring. The first thing to do is identify the interface you want to monitor. This command will help you: snort.exe -W


You should get some output like this:


In my case, the interface I will be using is 1. I can tell because the IP address field is listed as disabled. Next, test the snort.conf configuration by running this command:
snort.exe -i1 -s -l D:\snort\log\ -c D:\Snort\etc\snort.conf -T

You may see a few warnings or other messages. Don't worry about those, as long as the last two lines appear as below then you have a valid configuration.
Snort successfully validated the configuration!
Snort exiting



Now you are ready to run Snort for real. To see all of the command line options, run snort.exe -h. To run Snort interactively, you can try this:
snort.exe -i1 -s -l D:\snort\log\ -c D:\Snort\etc\snort.conf

Again, don't worry too much about any warnings or errors. If Snort notifies you that it is: Commencing packet processing then everything should be up and running.


When you are satisfied with your command line configuration, install Snort as a service. This command will do that:
snort.exe /SERVICE /INSTALL -i1 -s -l D:\snort\log\ -c D:\Snort\etc\snort.conf

The last thing to do is set the service to start automatically at boot time and start it.








Now that you have snort running, this is a good place to make a couple of statements about what rules to enable. The first piece of advice is to start with very few rules, maybe just one .rule file. The reason for this is to help prevent you from getting overwhelmed with alerts. It also gives you an opportunity to fine tune the rule file. The second thing is to be smart about what rules you are enabling. If you are monitoring client traffic that is destined for the Internet, then it would not make sense to use rules for detecting IIS or SQL rules. Knowing what you are monitoring and what you expect to be alerted on will help you get better performance and results from your Snort installation.

Testing Snort
Testing Snort is actually quite easy. You can enable the VRT ICMP rules. This will alert you on any ping packets. Here's the rule file line to enable in snort.conf.
include $RULE_PATH/VRT-icmp-info.rules

Now just ping any host that will pass the IDS interface and you should get an alert in your syslog server. If you see something like the screenshot below then your IDS is working!


You can also browse to D:\Snort\log and look for some tcpdump.log.0000000000 files. These contain a packet capture of the alert traffic. If you want to see the packets that generated an alert, you can use Wireshark to open these files.

Conclusion
This blog post should be enough to help you get Snort up and running on Windows but it just scratches the surface of Snort. There are lots of other options and features that I did not even mention. As you become more comfortable and familiar with Snort you will want to look into things like shared object rules, thresholding, and maybe even writing your own rules (really it's not that hard). My true recommendation would be to run Snort on Linux. You will probably see better performance and some features only work on nix platforms. If Linux is not in your comfort level then Snort on Windows is a good compromise.

Hopefully you found this information useful. If you liked what you read or noticed an error, feel free to send me a message or leave a note in the comments below. Thanks!