Share
Embed
HTTP Header Heuristics
This is a presentation based on the paper "HTTP Header Heuristics for Malware Detection", by Tobias Lewis. The paper is in the SANS Institute InfoSec Reading Room.
Clay Wells
February 18, 2014
Transcript
44 slides
-
HTTP Header Heuristics for Malware Detection SANS Institute InfoSec Reading
Room Author: Tobias Lewis link to paper ! Presented by: Clay Wells (Sr. Systems Programmer) Department of Biostatistics & Epidemiology University of Pennsylvania -
HTTP Header Heuristics for Malware Detection Overview Introduction Analysis of
HTTP heuristics Recommendations Conclusion Resources -
HTTP Header Heuristics for Malware Detection Introduction Methods for malware
detection - Signature based “known knowns” - Heuristics, rules and patterns “unknown” -
HTTP Header Heuristics for Malware Detection Introduction Basic assumptions !
- Malware will “phone-home” (C&C) - Malware masquerades as legitimate web traffic - Uses Hypertext Transfer Protocol, HTTP -
HTTP Header Heuristics for Malware Detection Introduction HTTP ! -
Application layer protocol (client-server) - Transfers information using headers ! “allows the client to pass additional information about the request, and about the client itself, to the server”! - RFC2616! -
HTTP Header Heuristics for Malware Detection Introduction HTTP request-header fields
! - User-Agent: - Host: *required - Referer: -
HTTP Header Heuristics for Malware Detection Introduction User-Agent ! "User-Agent"
":" 1*( product | comment )! ! User-Agent: CERN-LineMode/2.15 libwww/2.17b3! -
HTTP Header Heuristics for Malware Detection Introduction Host ! Host
= "Host" ":" host [ ":" port ]! ! Host: www.w3.org! -
HTTP Header Heuristics for Malware Detection Introduction Referer ! Referer
= "Referer" ":" ( absoluteURI | relativeURI )! ! https://encrypted.google.com/#q=w3c -
HTTP Header Heuristics for Malware Detection Overview Introduction Analysis of
HTTP heuristics Recommendations Conclusion Resources -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
General heuristics ! - User-Agents - Typographic errors - URL complexity ! Using p0f for generic malware detection ! - Introduction - Demonstration - Deployment options - Considerations -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
User-Agents ! Proxy log example ! ! ! -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
User-Agents ! - fairly static, but.. - a large number exist with BYOD, etc - works best when fine-tuned -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
User-Agents, SNORT based signatures ! - doesn’t present User-Agent of a possible standard build - doesn’t contain the correct OS -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
Typographic errors ! - Explicitly hardcoded header fields MEDIANA PROTUX QUARIAN -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
Typographic errors, MEDIANA ! Surplus white space (ACSII 0x20) -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
Typographic errors, MEDIANA ! SNORT rule -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
Typographic errors, PROTUX ! Surplus white space in URL -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
Typographic errors, QUARIAN ! Other incorrect header fields -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity ! - Some complexity will exist (valid Referer) - Servers shouldn’t rely on > 255 characters -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity, IXESHE ! Absent Referer field -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity, TAIDOOR ! Absent Referer field -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity, MONGALL ! More extreme example -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity, NETTRAVELER ! More extreme example -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity ! Long & complex URLs do exist in legitimate traffic ! - Microsoft-CryptoAPI service - Banner ads -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity ! - Fine tune for your environment - Use with other heuristics -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
URL complexity ! Snort rule using “urilen” -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
General heuristics ! - User-Agents - Typographic errors - URL complexity ! Using p0f for generic malware detection ! - Introduction - Demonstration - Deployment options - Considerations -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
p0f: Introduction ! - Passive fingerprinting tool - Assuming malware uses TCP library of the host OS - Uses structure of OSI model ! TTL, Window Size, Sequence numbers ! References a fingerprint library -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
p0f: Demonstration ! - Generated traffic using wget and Firefox (header plug-in) - Conducted from a Windows 7 machine - Used a fixed User-Agent claiming to be IE6 on XP - Captured data using Fakenet -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
Legitimate traffic -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
p0f: Deployment options ! - gateway devices - part of a larger suite of network monitoring tools (using API) -
HTTP Header Heuristics for Malware Detection Analysis of HTTP heuristics
p0f: Considerations ! - Examines at the application and transport layers - Struggles to reliably detect the host OS - Relies on the spoof-ability of the malware author - Identifies malicious behavior fairly well - No tool or tool set will ever be 100% accurate! -
HTTP Header Heuristics for Malware Detection Overview Introduction Analysis of
HTTP heuristics Recommendations Conclusion Resources -
HTTP Header Heuristics for Malware Detection Recommendations - Baseline your
network - Lower the noise floor where possible - Heuristics work best when fine-tuned to the environment - Don’t rely on a single method for detection -
HTTP Header Heuristics for Malware Detection Overview Introduction Analysis of
HTTP heuristics Recommendations Conclusion Resources -
HTTP Header Heuristics for Malware Detection Conclusion - Heuristics can
be a useful tool in your arsenal - Compliments signature based IDS or host based -
HTTP Header Heuristics for Malware Detection Resources Link to paper
RFC2616, HTTP/1.1 http://practicalmalwareanalysis.com/fakenet/ p0f www.snort.org -
HTTP Header Heuristics for Malware Detection 2014-02-06: User-Agent strings! !
Fedora release 19! -----------------! ! Firefox: "Mozilla/5.0 (X11; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0"! ! Chrome: "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"! ! Seamonkey: "Mozilla/5.0 (X11; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0 SeaMonkey/2.23"! ! Midori: "Mozilla/5.0 (X11; Linux) AppleWebKit/537.32 (KHTML, like Gecko) Chrome/18.0.1025.133 Safari/537.32 Midori/ 0.5"! ! ! OS X 10.9.1! -----------! ! Firefox: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0"! ! Chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"! ! Safari: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11"! ! ! Windows XP! ----------! ! Firefox: "Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0"! ! IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)"! ! Chrome: "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"! ! Safari: "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"