Day 2 of the course (Day one is here) on developing effective intrustion prevention and detection signatures was much more interesting for myself. We discussed ways to block SSL enabled sessions to specific sites. By creating a signature that checks for the OU in the certificate that the server passes to the client and blocking it if it matches a site you do not want people to visit, you can effectively block the certificate exchange, which disallows the key exchange, which effectively stops the SSL session from being established. Not rocket science. What was interesting was that their capture file of a Gmail login, had the OU in the certificate of ‘mail.google.com’. I pulled the current Gmail certificate and its OU is ‘www.google.com’. Smart move on Google to consolidate all SSL for applications under one SSL certificate. Given the number of businesses wanting to block external sites email sites such as Gmail, this technique would force a company to block all SSL communication to Google, which is probably not realistic. However, a lot of malware uses SSL and valid certificates for transmission now adays, so this technique would potentially yield some benefit in these conditions.
We took a long look at proxy services such as Hidemyass.com. Discussion around different ways to block proxy services, which are better to do and why. We then had to create a signature to block proxy requests from hidemyass.com.
Fuzzing was talked about, specifically in relationship to VoIP and SIP. Some attacks were shown using fuzzying, and we were required to create signatures to block these attacks. One interesting attack was a SIP attack that used both fuzzing as well as fragmentation.
Rob spoke in great detail about regular expression (regex) optimization. He spoke about C.A.R. Hoare, his rules of optimization and applied them to his examples and discussion on optimization. If you need to know about regex, Rob is definitely an expert in this area. Other optimization techniques were discussed such as blocking at the firewall first if possible. The firewall has to look at the 5-tuple of the IP header for every packet, so if you know you can use information here to create a successful block, then do it. It makes no sense to have a regex or other rule re-process the 5-tuple and block if it isn’t necessary. Other concepts such as where to use string matches, not analyzing traffic you don’t need to, and other helpful ideas based on common sense, his experiences and knowledge were discussed.
We did a entire section on complex signatures. This was the most interesting part of the course for myself. For the example, SMTP was used as the protocol and the goal was to block any attachment that had a reference to ‘.com’ in it. The main problem here as most network types will know, is that SMTP uses base64 encoding for data transfers. This means that a ‘.com’ won’t appear as a ‘.com’ on the wire. We dove into the weeds of base64, how it would transmit on the wire, and the result was to build a signature that had no known false positives. Base64 groups binary into 6 bit sections making transformation of data possible in 3 different blocks. All these had to be accounted for, along with upper and lower case.
Evasion techniques were discussed such as encryption and fragmentation. When writing detections one common mistake is that designers often write to the RFC assuming that applications all follow the RFC. Apache, the most popular webserver would follow the HTTP RFC obviously, right? Nothing could be further from the truth. The HTTP specification dictates that you should always use \x20 for a space, but Apache will accept tab \x09 as well. If you just follow the specification you create false positives, false negatives, potentially blocking valid sites, or missing legitimate attacks.
Finally we worked with Snort to create a signature that would block an SSL connection to gmail (the problem discussed at the beginning of the day).
Rohit and Rob put on an excellent course. Anyone interested in signature design and detection techniques for security, protocols, or behavior would benefit from the course. Although, they will cover concepts and techniques that people who have worked in these areas will already know, they apply their experiences into the course and the labes which make it well worth attending. As an example, they didn’t teach any regex concepts I didn’t already know, but they applied their experiences to it and the tricks they had learned on the way.