Using WinDbg to Begin Reverse Engineering Unknown Malware from Memory

Advanced Threats, code, forensics, malware, Malware Analysis, Network Forensics, network forensics, PE EXE files, Reverse Engineering, trojan 4 Comments

Part Two in a multi-part series on holistic, multi-disciplinary analysis and reversing.

 

The last post, “Mutex Analysis: The Canary in the Coal Mine,” started off showing to use mutexes to discover malware that is difficult to locate using more traditional methods and tools. We used a live compromised system for the example and the post came to a relatively abrupt end when it seemed that we stumbled onto a new/unknown type of malware – or at least one that does not seem to have any public exposure or analysis. This post is “part 2″ of our analysis.
 
Update 6/21/2011:
 
This post has been moved to the “Forensics and Reversing” section of the website. I apologize for the inconvenience. Read the full article here.

 

Mutex Analysis: The Canary in the Coal Mine (and Discovering New Families of Malware?)

Advanced Threats, code, forensics, hacked, malware, Malware Analysis, Network Forensics, network forensics, Reverse Engineering, trojan 2 Comments

Part One in a multi-part series on holistic, multi-disciplinary analysis and reversing.

This post is based on a presentation I gave at the last Thotcon, but was really prompted by a case from a couple days ago. It’s an interesting example of how the same disciplined methodologies for finding malicious traffic on the network also applies to sophisticated situations on the host as well. We’ll examine those methodologies and logic on the host by examining a little app I wrote called LockPick, pictured  here and detailed later in this article. As we’ll see, mutex analysis is a VERY powerful way of analyzing systems during Incident Response. They can lead the direction of your analysis when other automated methods fail to do so.
 
Update 6/21/2011:
 
This post has been moved to the “Forensics and Reversing” section of the website. I apologize for the inconvenience. Read the full article here.

 

Identifying the country of origin for a malware PE executable

Advanced Threats, forensics, malware, Malware Analysis, PE EXE files, Reverse Engineering, trojan No Comments

Update 11/29/10: Added a short discussion about non-malware executables also.

Have you ever wondered how people writing reports about malware can say where the malware was likely developed?

Sometimes you get totally lucky and log files created by the malware will help answer the question. Given the following line from a log:

11/16/2009 6:41:48 PM –>  Hook instalate lsass.exe

 

We can use Google Translate’s “language detect” feature to help up determine the language used (click to enlarge):

Of course, it’s not often we get THAT lucky!

A more interesting method is the examination of certain structures known as the Resource Directory within the executable file itself. For the purpose of this post, I will not be describing the Resource Directory structure. It’s a complicated beast, making it a topic I will save for later posts that actually warrant and/or require a low-level understanding of it. Suffice it to say, the Resource Directory is where embedded resources like bitmaps (used in GUI graphics), file icons, etc. are stored. The structure is frequently compared to the layout of files on a file system, although I think it’s insulting to file systems to say such a thing. For those more graphically inclined, I took the following image from http://www.devsource.com/images/stories/PEFigure2.jpg. (Click to enlarge.)

 

For the sake of example, here’s some images showing you just a few of the resources embedded inside of notepad.exe: (using CFF Explorer from: http://www.ntcore.com/exsuite.php)

Now it’s important to note that an executable may have only a few or even zero resources – especially in the case of malware. Consider the following example showing a recent piece of malware with only a single resource called “BINARY.” (Click to enlarge.)

Moving on, let’s look at another piece of malware… Below, we see this piece of malware has five resource directories.

We could pick any of the five for this analysis, but I’ll pick RCData – mostly because it’s typically an interesting directory to examine when reverse engineering malware. (This is because RCData defines a raw data resource for an application. Raw data resources permit the inclusion of any binary data directly in the executable file.) Under RCData, we see three separate entries:

The first one to catch my eye is the one called IE_PLUGIN. I’ll show a screenshot of it below, but am saving the subject of executables embedded within executables for a MUCH more technical post in the near future (when it’s not 1:30 am and I actually feel like writing more!). ;-) (Click to enlarge.)

Going back to the entry structure itself, the IE_PLUGIN entry will have at least one Directory Entry underneath it to describe the size(s) and offset(s) to the data contained within that resource. I have expanded it as shown next:

And that’s where things get interesting – as it relates to answering the question at the start of this post anyways. Notice the ID: 1055. That’s our money shot for helping to determine what country this binary was compiled in. Or, more specifically, the default locale codepage of the computer used to compile this binary. Those ID’s have very legitimate uses, for example, you can have the same dialog in English, French and German localized forms. The system will choose the dialog to load based on the thread’s locale. However, when resources are added to the binary without explicitly setting them to different locale IDs, those resources will be assigned the default locale ID of the compiler’s computer.

So in the example above, what does 1055 mean?

It means this piece of malware likely was developed (or at least compiled in) Turkey.

How do we know that one resource wasn’t added with a custom ID? Because we see the same ID when looking at almost all the other resources in the file (anything with an ID of zero just means “use the default locale”):

In this case, we are also lucky enough to have other strings in the binary (once unpacked) to help solidify the assertion this binary is from Turkey. One such string is “Aktif Pencere,” which Google’s Translation detection engine shows as: (Click to enlarge.)

However, as you can see, this technique is very useful even when no strings are present – in logs or the binary itself.

So is this how the default binary locale identification works normally (eg: non-malware executable files)?

Not exactly. The above techniques are generally used with malware (if the malware even has exposed resources), but not generally with normal/legitimate binaries. Consider the following legitimate binary. What is the source locale for the following example?

As you see in the green box, we have some cursor resources with the ID for the United States. (I’m including a lookup table at the bottom of this post.) In the orange box, there are additional cursor resources with the ID for Germany. In the red box is RCData, like we examined before, but all of these resources have the ID specifying the default language of the computer executing the application.

As it turns out, the normal value to examine is the ID for the Version Information Table resource (in the blue box). In the case above, it’s the Czech Republic. The Version Information Table contains the “metadata” you normally see depicted in locations like this:

In the above screenshot, Windows is identifying the source/target local as English, and specifically, United States English (as opposed to UK English, Australian English, etc…). That information is not stored within the Version Information table, but rather is determined by the ID of the Version Information Table.

However, in malware, the Version Information table is almost always stripped or mangled, as is the case with our original example from earlier:

Because of that, the earlier techniques are more applicable to malware.

Below, I’m including a table to help you translate Resource Entry IDs to locales (sorted by decimal ID number).

-Gary Golomb

Locale Language LCID Decimal Codepage
         
Arabic – Saudi Arabia ar ar-sa 1025 1256
Bulgarian bg bg 1026 1251
Catalan ca ca 1027 1252
Chinese – Taiwan zh zh-tw 1028  
Czech cs cs 1029 1250
Danish da da 1030 1252
German – Germany de de-de 1031 1252
Greek el el 1032 1253
English – United States en en-us 1033 1252
Spanish – Spain (Traditional) es es-es 1034 1252
Finnish fi fi 1035 1252
French – France fr fr-fr 1036 1252
Hebrew he he 1037 1255
Hungarian hu hu 1038 1250
Icelandic is is 1039 1252
Italian – Italy it it-it 1040 1252
Japanese ja ja 1041  
Korean ko ko 1042  
Dutch – Netherlands nl nl-nl 1043 1252
Norwegian – Bokml nb no-no 1044 1252
Polish pl pl 1045 1250
Portuguese – Brazil pt pt-br 1046 1252
Raeto-Romance rm rm 1047  
Romanian – Romania ro ro 1048 1250
Russian ru ru 1049 1251
Croatian hr hr 1050 1250
Slovak sk sk 1051 1250
Albanian sq sq 1052 1250
Swedish – Sweden sv sv-se 1053 1252
Thai th th 1054  
Turkish tr tr 1055 1254
Urdu ur ur 1056 1256
Indonesian id id 1057 1252
Ukrainian uk uk 1058 1251
Belarusian be be 1059 1251
Slovenian sl sl 1060 1250
Estonian et et 1061 1257
Latvian lv lv 1062 1257
Lithuanian lt lt 1063 1257
Tajik tg tg 1064  
Farsi – Persian fa fa 1065 1256
Vietnamese vi vi 1066 1258
Armenian hy hy 1067  
Azeri – Latin az az-az 1068 1254
Basque eu eu 1069 1252
Sorbian sb sb 1070  
FYRO Macedonia mk mk 1071 1251
Sesotho (Sutu)     1072  
Tsonga ts ts 1073  
Setsuana tn tn 1074  
Venda     1075  
Xhosa xh xh 1076  
Zulu zu zu 1077  
Afrikaans af af 1078 1252
Georgian ka   1079  
Faroese fo fo 1080 1252
Hindi hi hi 1081  
Maltese mt mt 1082  
Sami Lappish     1083  
Gaelic – Scotland gd gd 1084  
Yiddish yi yi 1085  
Malay – Malaysia ms ms-my 1086 1252
Kazakh kk kk 1087 1251
Kyrgyz – Cyrillic     1088 1251
Swahili sw sw 1089 1252
Turkmen tk tk 1090  
Uzbek – Latin uz uz-uz 1091 1254
Tatar tt tt 1092 1251
Bengali – India bn bn 1093  
Punjabi pa pa 1094  
Gujarati gu gu 1095  
Oriya or or 1096  
Tamil ta ta 1097  
Telugu te te 1098  
Kannada kn kn 1099  
Malayalam ml ml 1100  
Assamese as as 1101  
Marathi mr mr 1102  
Sanskrit sa sa 1103  
Mongolian mn mn 1104 1251
Tibetan bo bo 1105  
Welsh cy cy 1106  
Khmer km km 1107  
Lao lo lo 1108  
Burmese my my 1109  
Galician gl   1110 1252
Konkani     1111  
Manipuri     1112  
Sindhi sd sd 1113  
Syriac     1114  
Sinhala; Sinhalese si si 1115  
Amharic am am 1118  
Kashmiri ks ks 1120  
Nepali ne ne 1121  
Frisian – Netherlands     1122  
Filipino     1124  
Divehi; Dhivehi; Maldivian dv dv 1125  
Edo     1126  
Igbo – Nigeria     1136  
Guarani – Paraguay gn gn 1140  
Latin la la 1142  
Somali so so 1143  
Maori mi mi 1153  
HID (Human Interface Device)     1279  
Arabic – Iraq ar ar-iq 2049 1256
Chinese – China zh zh-cn 2052  
German – Switzerland de de-ch 2055 1252
English – Great Britain en en-gb 2057 1252
Spanish – Mexico es es-mx 2058 1252
French – Belgium fr fr-be 2060 1252
Italian – Switzerland it it-ch 2064 1252
Dutch – Belgium nl nl-be 2067 1252
Norwegian – Nynorsk nn no-no 2068 1252
Portuguese – Portugal pt pt-pt 2070 1252
Romanian – Moldova ro ro-mo 2072  
Russian – Moldova ru ru-mo 2073  
Serbian – Latin sr sr-sp 2074 1250
Swedish – Finland sv sv-fi 2077 1252
Azeri – Cyrillic az az-az 2092 1251
Gaelic – Ireland gd gd-ie 2108  
Malay – Brunei ms ms-bn 2110 1252
Uzbek – Cyrillic uz uz-uz 2115 1251
Bengali – Bangladesh bn bn 2117  
Mongolian mn mn 2128  
Arabic – Egypt ar ar-eg 3073 1256
Chinese – Hong Kong SAR zh zh-hk 3076  
German – Austria de de-at 3079 1252
English – Australia en en-au 3081 1252
French – Canada fr fr-ca 3084 1252
Serbian – Cyrillic sr sr-sp 3098 1251
Arabic – Libya ar ar-ly 4097 1256
Chinese – Singapore zh zh-sg 4100  
German – Luxembourg de de-lu 4103 1252
English – Canada en en-ca 4105 1252
Spanish – Guatemala es es-gt 4106 1252
French – Switzerland fr fr-ch 4108 1252
Arabic – Algeria ar ar-dz 5121 1256
Chinese – Macau SAR zh zh-mo 5124  
German – Liechtenstein de de-li 5127 1252
English – New Zealand en en-nz 5129 1252
Spanish – Costa Rica es es-cr 5130 1252
French – Luxembourg fr fr-lu 5132 1252
Bosnian bs bs 5146  
Arabic – Morocco ar ar-ma 6145 1256
English – Ireland en en-ie 6153 1252
Spanish – Panama es es-pa 6154 1252
French – Monaco fr   6156 1252
Arabic – Tunisia ar ar-tn 7169 1256
English – Southern Africa en en-za 7177 1252
Spanish – Dominican Republic es es-do 7178 1252
French – West Indies fr   7180  
Arabic – Oman ar ar-om 8193 1256
English – Jamaica en en-jm 8201 1252
Spanish – Venezuela es es-ve 8202 1252
Arabic – Yemen ar ar-ye 9217 1256
English – Caribbean en en-cb 9225 1252
Spanish – Colombia es es-co 9226 1252
French – Congo fr   9228  
Arabic – Syria ar ar-sy 10241 1256
English – Belize en en-bz 10249 1252
Spanish – Peru es es-pe 10250 1252
French – Senegal fr   10252  
Arabic – Jordan ar ar-jo 11265 1256
English – Trinidad en en-tt 11273 1252
Spanish – Argentina es es-ar 11274 1252
French – Cameroon fr   11276  
Arabic – Lebanon ar ar-lb 12289 1256
English – Zimbabwe en   12297 1252
Spanish – Ecuador es es-ec 12298 1252
French – Cote d’Ivoire fr   12300  
Arabic – Kuwait ar ar-kw 13313 1256
English – Phillippines en en-ph 13321 1252
Spanish – Chile es es-cl 13322 1252
French – Mali fr   13324  
Arabic – United Arab Emirates ar ar-ae 14337 1256
Spanish – Uruguay es es-uy 14346 1252
French – Morocco fr   14348  
Arabic – Bahrain ar ar-bh 15361 1256
Spanish – Paraguay es es-py 15370 1252
Arabic – Qatar ar ar-qa 16385 1256
English – India en en-in 16393  
Spanish – Bolivia es es-bo 16394 1252
Spanish – El Salvador es es-sv 17418 1252
Spanish – Honduras es es-hn 18442 1252
Spanish – Nicaragua es es-ni 19466 1252
Spanish – Puerto Rico es es-pr 20490 1252

 

Gary Golomb

.

Network Forensics and Reversing Part 1 – gzip web content, java malware, and a little JavaScript

Breach, Decompile, Java malware, JavaScript, Malware Analysis, NetWitness Rules, Network Forensics, network forensics, Network Visbility, Obfuscated traffic, Reverse Engineering, trojan No Comments

Something I’ve found unsettling for some time now is the drastically increased usage of gzip as a Content-Encoding transfer type from web servers. By default now, Yahoo, Google, Facebook, Twitter, Wikipedia, and many other organizations compress the content they send to your users. From that list alone, you can infer that most of the HTTP traffic on any given network is not transferred in plaintext, but rather as compressed bytes.

That means web content you’d expect to look like this on the wire (making it easily searchable for policy violations and security threats):

In reality, looks like this:

As it turns out, the two screenshot above are for the exact same network session, the later screenshot being from wireshark and showing the data sent by the webserver really is compressed and not discernable.

By extension, you can likely say that most real-time network forensics/monitoring tools are [realistically] “blind” to [plausibly] a majority of the web the traffic flowing into your organization.

Combined with the fact that a vast majority of compromises are delivered to clients via HTTP (at this time, typically through the use of javascript), my use of the word “unsettling” should be an understatement. This includes everything from “APT” types of threats (or whatever soapbox you stand on to describe the same thing), down to drive-by’s and mass exploitations.

The good news: Current trends in exploitation have given us very powerful methods for generic detection (eg: without needing “signatures,” or more precisely – preexisting knowledge about the details of particular vulnerabilities or exploits) by examining traits of javascript, iframes, html, pdf’s, etc.

The bad news: Webservers are reducing the chance of network technologies from detecting those conditions by compression based transfer (obfuscation).

I find no fault with organizations choosing to use gzip as their transfer type. HTTP is a horribly repetitive and redundant language (read: bloated). Every opening <tag> has an identical closing </tag>. XML is even worse. For massive sites with massive traffic, the redundancy and bloat of protocols like HTTP and XML translate directly to lost revenue via extremely large amounts of wasted bandwidth.

Nonetheless, as forensic engineers, our challenge is to discover and compensate for all the things proactive security technologies like AV, firewalls, IPS, etc. continually fail to identify and stop. Recently, I added the following rule on a customer’s network in NetWitness:

If you’re not familiar with the NetWitness rule syntax, the rule above does the following:

If the server application/version (as extracted by the protocol parsing engine) contains the string: “nginx,”

AND

If the Content-Encoding used by the server is gzip

THEN

Create a tag labeled “http_gzip_from_nginx” in a key called “monitors.”

In the Investigator GUI, you would see something like this in the “monitors” key:

Why nginx? As it turns out, a lot of hackers tend to use nginx webservers, so this seemed like a good place to start experimenting. The question I was trying to answer is:

If the content body of a web response is gzip’ed (so we can’t examine traits of “suspiciousness” inside the body), then what can we see outside the body to indicate this gzip’ed traffic is worth examining further?

We’ll revisit this question in later blog posts, but for now, nginx as a webserver is an amazingly powerful place to start! We’ll examine one such example in this post, with an additional post using the gzip + nginx combination. As the small screenshot above shows, there were 33 sessions meeting the criteria of gzip + nginx (out of about 50,000 sessions). With only 33 sessions, it’s possible to examine them by drilling into the packets of all 33, examining them each one-by-one (eg: brute-force forensic examination), but that would be poor forensic technique and defeat the entire point of a technical and educational network forensics blog! The examples in these series of blog posts will employ good forensic practices using “correlative techniques,” allowing us to have a good idea of what is inside the packet contents before we ever drill that deeply into the network data (an indication you are using good network forensics practices).

The first pivot point we’ll examine are countries. Keep in mind, this is after we used the rule above to include only network sessions where the server returned gzip compressed content, and where the webserver was some type of nginx. We could have manually done the same by first pivoting on the content type of gzip:

Doing the first pivot reduces the number of sessions we’re examining from about 50,000 down to 2,878. Then we can do a custom filter to only include servers with the string “nginx” within those 2,878 session. Doing so gives us the same 33 sessions mentioned above.

In those 33 sessions, the countries communicated with are:

Not only do we tend to see a higher degree of malicious traffic from countries like Latvia, it immediately looks suspicious simply because it’s an outlier in the list. (Don’t worry Latvia, we’ll pick on our own country in the next post!) Additionally, there’s only a single session to examine here, meaning drilling into the packet-level detail is an ok decision at this point.

In the request, we see the client requested the file “/th/inyrktgsxtfwylf.php” from the host “ertyi.net,” as shown next:

As expected, based on the meta information NetWitness already extracted, we see the gzip’ed reply from a nginx server:

Fortunately, Investigator makes it easy for us to examine gzip’ed content by right-clicking in the session display and selecting decode as compressed data:

Doing so shows us a MUCH different story!

The traffic appears to be obfuscated javascript. We can extract it from NetWitness (a few different ways) to clean it up and examine. I’ll skip those steps and just show the cleaned-up and nicely formatted content the webserver returned.

There are a few things to notice in here. At the very bottom of the image above, we clearly see encoded javascript, a trait extremely common to client-side exploit delivery and malicious webpages. We’ll save full javascript reverse engineering for another blog post.

But the worst (or most interesting) part is the decoding and evaluation for this encoded data, while implemented in javascript, is stored inside a TextArea HTML object! This technique makes the real logic invisible and indiscernible to most automated javascript reverse engineering tools.

Indeed, if we upload this webpage to one of my favorite js reversing sites (jsunpack, located at: http://jsunpack.jeek.org/dec/go), we see the following results when the site attempts to automatically reverse engineer the javascript:

Without going further into the process of reverse engineering the javascript (for now – we have an endless supply of blog posts coming!), we can be quite sure we’re looking at something suspicious. At the very least, we know for a fact we’re looking at something that does not make it easy to discern what it’s doing!

The telltale signs of “badness” don’t stop there. At the top of the decoded body data we saw an embedded java applet, as follows:

While we don’t know (yet) what the applet does, there’s a pretty strong indication it’s a downloader or C&C (command and control) application of some type. How can we make such a guess without knowing anything about it?

Look closely at the embedded parameter passed into the applet:

We can make a guess that the string contained in the “value” parameter is encoded data using a simple substitution cypher where “S”[parm] = “T”[actual] and “T”[parm] = “/”[actual]. If we made such a guess, then it’s possible the decoded parameter value actually starts with the string “http://”.

Of course, because we have the download of the jar file within our full packet capture and storage database, we’ll just extract it from NetWitness to validate our hunch and possibly learn more. In the below screenshot, I already performed the following steps:

  1. Switched to the session with the jar file download. (Simply clicked on the next session between that same client and server.)
  2. Extracted the jar file by saving the raw data from the server using the “Extract Payload Side 2” option in NetWitness.
  3. Opened the jar file using the following java decompiler:

The first line of code in the java applet takes the parameter passed to it (the encoded value we identified above), and hands it to a function called “b.” The result of that function is stored in a string variable called str1.

Following the decompiled java code to function “b,” we see the following:

It turns out the applet actually is using a simple substitution cypher, replacing one given character with another. When the parameter “RSS=,TT!;LBIB@STSRTYG$I=R=” is decoded, we end up with the string “http://uijn.net/th/fs7.php?i=1.”

The java malware then continues with additional string functions as shown next:

First, we see the declaration of str2 through str5, with values assigned to each.

Then, str6 through srt8 is simply the reversal of str2 through str4, resulting in the following strings:

Str6 = .exe

Str7 = java.io.tmpdir

Str8 = os.name

Combining that with the last three lines of code shown above, we see the following:

Str10 is a filename ending in “.exe” where the actual filename is a randomly generated number.

Str11 is the path to temporary files for the current user.

Str12 is the name of the Operating System the java malware is currently running on.

The last part of this java malware (that we’ll examine here anyways) is shown next:

First, it tests to see if the string “Windows” is contained anywhere in the name of the Operating System. If so, then it goes through the process of opening a connection to the URL (the one we decoded above), downloads the file, saves it to the temporary directory, then executes the file.

This file appears to be malware as a first-stage downloader for other executables that are likely far more malicious.

Pre-Summary

Even though a large amount of web traffic is coming into your organization gzip compressed, making most inline/real-time security products totally “blind” to what’s inside, we can use standard forensic principals to identify which of those sessions are worth examination. In this case, we combined to following traits to reduce 50,000 network sessions to a single one:

  1. Gzip’ed web content
  2. Suspicious country
  3. Uncommon webserver application

Once we drilled into that single session, we saw how trivial it was to use NetWitness to automatically decompress and content, extract it, then validate it as “bad.”

Epilogue

Does the process stop there? Of course not! If you had to repeat this process every time, not only would it make your job boring as heck, but would call into question the value you and your tools are really providing the organization in the first place! There are many ways to maximize the intelligence gained from the process just shown. I’ll highlight one method here, while saving others for later blog posts.

There are several interesting “indicators” gathered from this traffic so far. The ones I’ll focus on here are host names. In the request made by the client, we saw the following tag in the HTTP Request header:

Host: ertyi.net

In the java malware we decompiled, after decoding the encoded parameter value, we saw the executable to be downloaded was from the host “uijn.net.”

At this point, network rules should be added to firewalls, proxies, NetWitness intelligence feeds, and any other technology you have that can alert to other hosts going to either of those servers – preferably blocking all traffic to those servers.

But, can we extend our security perimeter in relation to the hackers using those servers?

Interestingly, we find both those domains are hosted on the same IP block: 194.8.250.60 and 194.8.250.61.

That leads to the question, “What other domains are hosted on those server?”

Normally I use http://www.robtex.com to answer questions like that, but in this case, robtex does not provide a lot of information about that question. It’s possible the hackers are brining-up and tearing-down DNS records as needed for the domain names they manage.

Another source of helpful information can be found querying the “Passive DNS replication” database hosted at: http://www.bfk.de/bfk_dnslogger.html Here, we can find an audit trail of all historically observed DNS replies pointing to IPs you submit queries about. In this case, we do indeed find valuable information, including about 40 unique host names that have been hosted on those two IP’s. A shortened list is included below showing some of the names that have been hosted there.

aeriklin.com

aijkl.net

asdfiz.net

asuyr.net

campag.net

iifgn.net

jhgi.net

jugv.net

kobqq.com

krclear.com

lilif.net

nadwq.com

oiuhx.net

pokiz.net

uijn.net

As we can see, none of them look immediately legitimate, so we can infer this is a hacking group using a set of servers for domains they have registered simply to be “thrown away” if any of those domain names are discovered and end up on a blacklist somewhere.

The Real Summary

By combining a few pivot points and looking inside compressed web traffic most products ignore, from a single network session we proactively increased the security posture of your organization by creating an intelligence feed of nearly 40 hosts names and 2 IP’s. You could now audit DNS queries made by all hosts in your organization to see if other clients are compromised and doing look-ups when trying to communicate with those hosts.

For the truly paranoid (or safe, depending on how you look at it), you could also blackhole all traffic to those apparently malicious networks:

route: 194.8.250.0/23

origin: AS29557

Considering the Google Safe Browsing report for that AS, it’s probably not a bad idea!

Gary Golomb

Bredolab Takedown – Just the tip of the Iceberg

Advanced Threats, cybercrime, Malware Analysis, network forensics, trojan 1 Comment

Recent reports from various sources in the security industry show that a large takedown of servers associated with the “Bredolab” trojan occurred within the past few weeks. While most of the reports have focused around the idea that this infrastructure was solely related to the command and control of Bredolab, our research shows that these servers were used as an all-purpose hosting infrastructure for criminal activity.

This criminal system came to our attention in July 2010, when NetWitness analysts were asked to investigate a hacked wordpress blog.

We found that the following obfuscated script had been injected into all .html and php pages on the site:

When decoded, this script created a redirect to the following location:

hxxp://bakedonlion.ru:8080/google.com/pcpop.com/torrentdownloads.net.php

Further investigation revealed an injection of the script into victim webpages via FTP:

These IPs all connected to the victim website within a 20-minute period on May 8th, and when plotted on a map, it becomes obvious that this is likely a botnet.

Read the rest…

It’s Malware!

Breach, Competitor Hype, cybercrime, Malware Analysis, Network Forensics, network forensics, Network Visbility, trojan, zeus No Comments

Zeus is evolving. In regards to a new release, one Anti-Virus vendor recently noted:

“[the new exe] uses techniques designed to avoid automatic heuristics-based detection.”

The discussion then proceeds to examine how the exe is different from previous versions of the malware.

Should we be alarmed that Zeus is getting so sophisticated that it evades heuristics-based detection mechanisms?

I suppose if it actually evaded heuristics-based detection mechanisms, that would be alarming. I’m sure the version of Zeus in question evades the mechanisms of certain AV vendors. However, when looking at the exact sample in question (verified by MD5) using the techniques we use for malware identification here, we see the sample stands out like a sore thumb.

Using our own internally-developed heuristic malware identification methods (also used by components of NextGen), we see the exe has traits such as the following (not a complete list!):

  1. The binary contains packed sections, indicative of packed, obfuscated, and/or encrypted malware.
  2. The size of the binary is abnormally small considering the conditions and context in which it was found.
  3. The PE checksum fails to validate, something malware packers are notoriously bad about.
  4. The binary does not have any information normally found within the version info table in the resource section of the PE.

But… Why get overly wrapped around the minutia related to the abnormal facets of this particular sample of Zeus? There’s a more important note to be made here. That is, Zeus is malware, so it does the things that malware does! You can’t get more “heuristically obvious” than that!

From the same vendor as above:

“…common ZeuS 2.0 variants contain relatively few imported external APIs… By contrast, [this version] imports many external APIs. To a heuristic scanner, this changes the appearance of the file and lowers the possibility of detection.”

Finding a binary that has very few external imports is generally a sign that something is suspicious. Specifically, it’s generally a sign the file is packed, obfuscated, and/or encrypted and the real imports are likely hidden inside. Such is the case when finding binaries that only import between two and five specific API’s from kernel32.dll (in the more obvious cases).

However, when finding a binary with a lot of imports, that’s even better since you get to see the full range of imports needed by the binary/malware! Without even running the sample or doing deep low-level reverse engineering, you can start to make assumptions about the functionality of the binary based on the API’s it uses. Further, it’s a simple matter to separate malware from legitimate binaries by comparing the API’s it uses to the ones it doesn’t need/use.

As is the case with this sample of Zeus, we see it (like the thousands of different types of malware not related to Zeus) imports APIs related to hooking the Windows API, creating mutexes, and managing services – without importing the functions used by legitimate binaries that also use the same functions.

So, should we be alarmed some people say Zeus is getting so sophisticated that it evades heuristics-based detection mechanisms?

If your security vendor is looking for Zeus, then yes, you should be alarmed. However, if your security vendor is looking for general signs of malware, infection, and so on, then no… Fortunately Zeus is still malware, just like all the rest of it…

Gary Golomb

They are watching you…and your security vendors.

Advanced Threats, bluehost, cybercrime, godaddy, Gumblar, hacked, hostgator, Malware Analysis, Martuz, Network Forensics, network solutions, trojan, wordpress 4 Comments

If you’ve ever seen me, or any of the NetWitness crew, speak on malware, advanced threats or the current threat environment, you’ll generally hear more than one recurring theme, one of which is:

Your anti-virus solution isn’t working like you think it is.

This is occurring for a variety of reasons and is ultimately the result of a business-based exploitation cycle in the criminal underground.   This cycle includes software support, licensing, and ongoing quality assurance.  One of the best examples I’ve ever seen to illustrate this concept is in the case of “scan4u.biz”.

Brian Krebs posted about this particular cybercrime endeavor in his blog here a few months ago:

http://krebsonsecurity.com/tag/scan4u-biz/

However, recent intelligence gathering efforts have revealed that this particular business venture has been extended and improved using the same resilience concepts used in most large legitimate corporate infrastructures.

A brief overview of “scan4u.biz”

Scan4u.biz is essentially  a “criminal virustotal plus”.  That is, it is a service where a miscreant can submit a newly created malware binary to gauge the detection rate of various antivirus vendors.  While similar to virustotal in this regard, the key is that scanned binaries aren’t submitted to the antivirus vendors in question, as is done with virustotal.

Let’s surf the service for examples:


What we see here is a general overview of the service (translated from russian) with the following key points:

  • The service doesn’t submit to anti-virus vendors.
  • Antivirus clients are updated hourly to maintain a current definition set
  • Submitted binaries are rechecked on a schedule and customers are emailed about new detections

Digging deeper we see an example of the current signature state of included antivirus engines, which includes the vendor name, signature update version number and last update time:

And it’s even affordable and easy to pay for…$25 a month or 15 cents per scan, and a discount for referrals.  As well as flexible payment options and multiple contact points (I’ve blocked the specifics out):

How long has this service been running?

“News” updates indicate that this service has been running since at least October of 2009 and is being consistently upgrade and maintained:

News
2010-05-01 – 2010-05-10 – Our support will be online, less often
2010-04-23 – Add Domain/IP/Url check in NOD32 antivirus
2010-04-21 – Add Domain/IP/Url check in Kasperky Anti-Phishing database
2010-04-19 – Today we will do hardware upgrade, posible some down time.
2010-04-15 – The check of sheaves is finished, now we pull out all that is possible. The check goes only from one IP(our web IP). So do not forget to null stats before the check or to switch off blocking on IP.
2010-04-12 – We upgrade Dr Web to 6.0 version.
2010-03-31 – Today/Tomorow we will do hardware upgrade, posible some down time.
2010-03-22 – Add Trend Micro Internet Security Pro Antivirus.
2010-03-21 – Add eTrust-Vet Internet Security Antivirus.
2010-03-19 – Add VirusBuster Internet Security Antivirus.
2010-03-19 – Update API, now you can turn some AV off for check, add support for Exploits Pack check. Add ability to get execution result of find/pdfid/pefile/trid utility (“Save file on server” option must be on)
2010-03-18 – We upgrade Avast and NOD32 antiviruses to new version. Avast now have Avast5 version and NOD32 now 4.0437 version.
2010-03-11 – We second day under DOSS attack, we apologize for any interference. Our technical team is working on this.
2010-03-03 – Add New type of check, “Exploit Pack”.
2010-02-25 – Add Domain/IP/Url check in SpamCop.net and RFC-Ignorant.Org.
2010-02-23 – Today we make our 500K check.
2010-01-28 – Add new features: now reports can be send to Jabber and GTalk accounts.
2010-01-20 – Upgrade Notrton Antivirus to Norton Internet Security.
2010-01-19 – Update Internet Explorer 8, now found more “Unsafe Website”.
2009-12-08 – Add Webroot Internet Security Essentials Antivirus.
2009-12-08 – Add F-Secure Internet Security 2010 Antivirus.
2009-12-02 – Add COMODO Internet Security Antivirus.
2009-11-25 – Add Domain/IP/Url check in Firefox Phishing and Malware Protection
2009-11-17 – Add Domain/IP/Url check in Panda Antivirus 2010
2009-11-11 – Add Domain/IP/Url check in Norton Safe Web
2009-11-10 – new support ICQ 588-391-779. Old number temporarily not work.
2009-11-10 – Add Polish Antivirus ArcaVir.
2009-11-09 – Today we add chinese Antivirus Rising to our system.
2009-11-05 – Add Sophos Antivirus.
2009-11-02 – Add AntiVir (Avira) Antivirus.
2009-10-27 – Add Utility that help you makes checks on your own system (see Links page).
2009-10-23 – Add Norman Antivirus.
2009-10-21 – Add Domain/IP/Url check in SmartScreen (IE7/IE8 malware & phishing Web site defense).
2009-10-19 – Add ability to check Domain/IP/Url in blacklist and Filter databases. At now we support following checks: ZeuS domain block-list, ZeuS IP block-list, ZeuS Tracker, MalwareDomainList (MDL), Google Safe Browsing (FireFox), PhishTank (Opera, WOT, Yahoo! Mail), hpHosts, SPAMHAUS SBL, SPAMHAUS PBL, SPAMHAUS XBL, MalwareUrl.
2009-10-15 – Add Microsoft Security Essentials Antivirus.
2009-10-06 – Add IKARUS Antivirus.
2009-10-02 – Add 2 new antivirus Quick Heal and A-Squared.
2009-10-01 – At present at us 16 antivirus Solo, McAfee, BitDefender, Panda, F-Prot, Avast!, VirusBlokAda, ClamAV, Kaspersky, Vexira, Norton, DrWeb, AVG, A-Squared, ESET NOD32, G DATA.
2009-10-01 – Today we have started our service on check of files on presence of viruses and malware.

How do we kill it?

So to take this down, we’d just get the domain name suspended right?   Well..it appears that that has already been done as is evident with a quick dig:

Not found: scan4u.biz

>>>> Whois database was last updated on: Sun May 30 14:07:49 GMT 2010 <<<<


So how is it still accessible?

At this moment, this service is being hosted or proxied through a criminal infrastructure, known in the industry as Gumblar.  Gumblar was recently referenced in a large scale compromise of blogs at most major hosting companies and has been an ongoing presence in the malware world for the past few  years.   At last check, the infrastructure has at least 376 verified domains, mostly in the .ru tld, across at least 43 different IPs in geographically disperse locations.

This hosting model is, in effect, a content distribution network, as used by most major online presences.  In this case, it’s being used to both hide the miscreants actual operating location, as well as provide fault tolerance from ongoing takedown efforts by the security community.

Extending beyond antivirus checks

As well as antivirus checks, the miscreants running the service appear to have extended their checks into the online blacklist area:

“Domain check on presence in black list: ZeuS domain blocklist, ZeuS IP blocklist, ZeuS Tracker, MalwareDomainList (MDL), Google Safe Browsing (FireFox), PhishTank (Opera, WOT, Yahoo! Mail), hpHosts, SPAMHAUS SBL, SPAMHAUS PBL, SPAMHAUS XBL, MalwareUrl,SmartScreen (IE7/IE8 malware & phishing Web site),Norton Safe Web, Panda Antivirus 2010, (Firefox Phishing and Malware Protection), SpamCop.net and RFC-Ignorant.Org.”

This update indicates ongoing blacklist checks across a variety of services, including:

  • Security researcher and community published blacklists (zeustracker, malwaredomainlist,malwareurl,phishtank,spamhaus)
  • Browser-based anti-phishing technology (google safe browsing,smartscreen)
  • Vendor blacklists (Norton, Panda, etc)

So in essence, miscreants using this service have a one-stop shop for both the detection of malicious binaries as well as the existence of their delivery systems in disparate blacklists across the internet.

They also understand researcher and malware analysis activity:

Add ability to get execution result of find/pdfid/pefile/trid utility (“Save file on server” option must be on)”

  • PDFID is Didier Steven’s excellent PDF analysis tool.
  • PEFILE  is a python module used to assist in reverse engineering binaries to detect packing and other indicators of maliciousness.
  • TRID is a tool used to identify files from their binary signatures.

What all of this should tell you is that criminal miscreants continue to upgrade and enhance their services to assist in perpetuating their business model, penetrate your networks, and make money!

Watch your network, because they certainly are!

Alex Cox, Principal Research Analyst

Kneber Update

Advanced Threats, Competitor Hype, cybercrime, Situational Awareness, trojan 9 Comments

There was a significant amount of coverage yesterday on research performed by NetWitness into a large set of stolen information recovered from a ZeuS botnet.  Some of the information, analysis, and commentary was very beneficial to the broader discussion of threats such as these.  There is, however, some information that we feel we should address.

  • Kneber is a pseudonym for ZeuS:

Kneber is not a pseudonym for ZeuS. Kneber refers to one group of organized criminals, one group of Command and Control Systems, and 74,000+ infected victim systems for this particular ZeuS (primarily) botnet.   ZeuS is a tool, used by many groups to create command and control systems, and steal information.  There are hundreds of active ZeuS botnets, many of which are larger than this one. It is but one of many tools used in this particular botnet.  We have seen INTENTIONAL cross pollination of various trojans, including waledec, grum, and even tools such as packet sniffers.  When we discuss threat, we are referring to more than the tool used, but the organization behind them.

  • Kneber is “nothing new”:

We have been very clear that this is a medium sized infestation when compared with all the tracked ZeuS botnets on the Internet.   What does make this very valuable is the opportunity to analyze such a large sample of stolen information, and quantitatively add to the discussion of threats to corporate security.  The number of infected and active systems behind some of the largest, most technology savvy companies needs to be considered, and our approach to security needs to change given the broad failure to identify or remediate these infestations.   In addition, trivializing the damage done is simply disingenuous by anyone who has seen the types of data stolen from threats such as these.

  • Current protections and solutions can detect this type of activity:

This quote from Symantec, via the Guardian, KrebsOnSecurity, and others:

“Kneber, in reality, is not a new threat at all, but is simply a pseudonym for the infamous and well-known Zeus Trojan,” said the company. “The name Kneber simply refers to a particular group, or herd, of zombie computers, a.k.a. bots, being controlled by one owner. The actual Trojan itself is the same Trojan.Zbot, which also goes by the name Zeus, which has been being observed, analyzed and protected against for some time now.”

This quote is particularly troubling, as it seems to minimize the threat and is almost dismissive.   Moreover, when this particular variant was analyzed in late January (various services used), Symantec did NOT detect this as malicious.   To be fair, McAfee, Trend Micro, AVG, and most other mainstream anti-virus solutions also failed to recognize this as malicious.  In the past 3 weeks, Symantec has added signatures to detect this particular variant as a generic “Trojan Horse”.  However, if you were infected by this particular strain, your system has already processed an update that prevents you from contacting Symantec and others for updates.   In most cases, this will prevent future detection.   Worse, as part of normal operation of ZeuS, it attaches to running processes on victim systems in order to monitor them.   This data is logged along with other stolen information.   This set of data shows that ZeuS has actually attached to running versions of Symantec software on over a thousand victim systems.  Many other AV vendors are also present.

This example shows ZeuS monitoring a Symantec Live Update, and includes the ftp username and password used by the Symantec software during the update process.

  • Are the facts overstated?:

The facts are fairly succinct in the whitepaper that we released.   We do not believe the threat is over-stated, and we were very conservative on the analysis released.   There are likely thousands of additional corporate networks affected, and analysis of this much information takes time.   And this is simply one of many similar operations in existence.  The group behind this effort can be described as sophisticated, yet also shows signs of lax effort to hide their trails.   The botnet is very actively managed, and continues in operation today.   The fact that they have been in successful operation for over 18 months also has to be considered.   We have also received several additional data points from federal contacts with additional insight into related government focused attacks.

More to come.

Tim Belcher and Alex Cox