Skip to main content

Welcome to Mark Baggett - In Depth Defense



I am the course Author of SANS SEC573 Automating Information Security with Python. Check back frequently for updated tools and articles related to course material.

Senior SANS Instructor
GSE #15
Internet Storm Center Handler
Penetration Testing and Incident Response Consultant
Technical Advisor to DoD for The SANS Institute
Founding President of the Greater Augusta ISSA
Cofounder of BSidesAugusta Security Conference


Tools:
FREQ SERVER - Tool and technique for detecting Malware Command and Control domains
DOMAIN_STATES - Tool for detecting "Baby Domains" used for phishing and Malware distribution
SRUM_DUMP - Forensics tool for extracting System Resource Utilization Monitoring artifacts
LIAM_NEESON - Proof of Concept Linux Hash Protection
HONEY_HASHES - Certainly Honey Tokens have been around since 2003 but I created a cool technique for creating fake SATs in memory that was turned into Dell Secure Works DCEPT framework.
VSSOWN - Tool & Technique for Using Microsoft Volume Shadow Copies for hiding malware and extracting artifacts
SDB Hacking - Using Application Compatibility in unexpected ways.
SET-KBLED - Utility for Managing Clevo and Sager Laptop LED Backlit Keyboards
Reassembler.py - Scapy based fragement reassembly engine
eapmd5crack.py - A password cracker for the EAP protocol


and more. Most of these tools are available on my github page. Follow me on twitter @markbaggett





OWA - A GAPING HOLE IN YOUR FIREWALL

Blocking Personal Blackberrys storing corporate emails

O
ne of the many reason to have a BES (Blackberry Enterprise Server) to protect your corporate email is so you can wipe any blackberry device in the event that it is lost.    These devices often contain sensitive email so password protection, encryption, policy enforcement and remote wipe is well worth the investment in BES.      BES installed, problem solved!   Right?    Check the IIS logs on your Outlook Web Access server.  You may find unauthorized Blackberry and other smart phones are synchronizing email using WEBDAV.    Using OWA they can store corporate emails and you have no way to wipe the data when the devices lost.   This DOES NOT require RPC over HTTP be enabled on your OWA server and its not just blackberrys and smart phones.   Desktop clients such as Entourage can also use WEBDAV to sync email to a home computer.  
No firewall, No antivirus and all those sensitive email on their home machines.   Scared yet?   If this is a problem for you, the only REAL fix is to turn off OWA.  But, that is a tough pill to swallow. Here is a possible alternative.   

Check your IIS logs and you'll see entries like this..

008-04-22 16:48:25 W3SVC1 127.0.0.1 POST /exchange/username/##emailname##/ - 443 username 127.0.0.1 BWC/Worker/1.0 200 0 0

2008-04-21 13:35:22 W3SVC1 127.0.0.1 BMOVE /exchange/firstname.lastname/Inbox/ - 443 firstname.lastname 127.0.0.1 BWC+Engine+/2.0 207 0 0

Here you can see an unauthorized blackberry copying emails to the handhelds through the Outlook Interface.   The BWC+Engine is the User-Agent used by the Blackberry email client.  You may also have some of these...

2008-04-20 23:06:40 W3SVC1 127.0.0.1 POST /Microsoft-Server-ActiveSync Cmd=Get
ItemEstimate&User=jusername&DeviceId=PLMOx8xxxx0&DeviceType=PalmOneTreoAce&
Log=V4XXX:0AXXXX:0XXXXD0SP:1XXXXXXXH0P 443 username 127.0.0.1 PalmOne-TreoAce/2.01m01 200 0 0

2008-04-20 23:42:13 W3SVC1 127.0.0.1 OPTIONS /Microsoft-Server-ActiveSync User
=username&DeviceId=2F8xxxxxxxxxxx&DeviceType=SmartPhone&
Log=VNAXXX:0XXXXX:0A0XXXXX:0C0XXXXXXXH 443 username 127.0.0.1 MSFT-SPhone/5.2.203 200 0 0

If your goal is to keep personal device from synchronizing over Outlook Web Access you will want to block those also.

So how to you block specific User-Agent strings on IIS?  Pretty simple in Apache right?  Not so much on IIS.  You may think (as I did) that you can use URLSCAN.  It has this [DenyHeaders] section which allows you to specify a User-Agent.  That doesnt' work.   It will allow you to block any web request that has a User-Agent (Yeah.. All of them), but not a specific User-Agent.  Thank for nothing Microsoft!   So how then?  You can use a third party ISAPI filter that implements Apache Mod Rewrite functionality on IIS.   You can download ISAPI REWRITE from http://www.isapirewrite.com   There is a LITE and a FULL version available for download at the site.   The LITE version is free and it will work for many of the OWA implementations.  Here is the configuration file to use to block User-Agents for Blackberry, PalmTrio, Microsoft Smart Phones, and Avant Go.

RewriteEngine  on
#Block Blackberry and other smartphones
RewriteCond %{
HTTP:User-Agent}  (?:BWC.Worker.*|BWC.Engine.*|MSFT-SPhone.*|PalmOne-TreoAce.*|AvantGO.*) [NC]  
RewriteRule .? -  [F,L]
  


This takes care of all of the Microsoft Smart Phones, Palm Treo's and AvantGo users.   In my testing it also breaks the functionality on the Blackberries.  However, Blackberries which use BIS still make requests with IE user agents strings which are not blocked.   The BIS service uses multiple user agents including IE and the BWC agents.  You can block the BIS address ranges from reaching OWA at your firewall.  Those ranges are: 

  • 206.53.144.0 - 206.53.159.255
  • 216.9.240.0 - 216.9.255.255
  • 67.233.64.0 - 67.223.95.255

  • I found these on Bill Warnke's blog.   Here
    Blackberry posts their ranges in this article.

    Continue to review your IIS logs to watch for other User-Agents.   The following unix commands will show you all the User-Agents accessing your system.

    cat \windows\system32\logfiles\w3svc1\* | awk '{print $11}' | sort | uniq

    Popular posts from this blog

    SRUM-DUMP and SRUM_DUMP_CSV Ported to Python 3

    SRUM_DUMP and SRUM_DUMP_CSV have been ported to Python3 and are available for download from the PYTHON3 branch of my github page.

    https://github.com/MarkBaggett/srum-dump/tree/python3

    In moving to Python3 I also updated the modules that I depend upon to parse and create XLSX files and access the ESE database that contains the SRUM data.  I hope that this will fix the issue that some users have experienced with SRUDB.dat files that create very large spreadsheets.  If it does not please let me know and continue to use SRUM_DUMP_CSV.EXE to avoid the XLSX problem.

    In moving to Python3 you will find the process to be faster.

    If you would like to run the tools from source instructions for doing so are in the README on the github page.

    Use Python and Scapy to Easily Do Full Duplex Stream Reassembly!

    Check out this blog on how to get scapy to do full packet reassembly in just a few lines of Python code.

    https://pen-testing.sans.org/blog/2017/10/13/scapy-full-duplex-stream-reassembly


    Awesome Keyboard Tricks - Clevo/Sager Backlight control from Powershell

    I'm back on Windows.   After 8 years on a Macintosh I just couldn't go another day with ONLY 16GB of RAM.   I priced it out and for the cost of a top of the line MacBook I could get a tricked out PC with 32GB of ram and 2.5 TB or hard drive space (1.5 of it being SSD).   So I made the switch.  To get a top performing laptop I ended up buying a gaming machine from xoticpc.com.   The model is Sager NP9752 (Clevo P750ZM).    I have to say I like it quite a bit.    One of the features I was curious about was the "Programmable backlit keyboard".   With it you can set your keyboard backlight to various colors and light movement patterns.    Now, when I hear "programmable" I think APIs.   I was a little disappointed to find out there weren't any documented APIs that I could use to control the keyboard.    Your only choice is to use their built in tool to configure the lights on the keyboard.   That stinks.  I want to be able to change key colors automatically …