2. Sharing Restrictions
• All the content on the slides can be considered
TLP:GREEN.
• Anything that I say that’s more restrictive, I will
tell you.
• Slides will eventually be posted to SlideShare.
• Questions to
john.bambenek@fidelissecurity.com
3. Introduction
• Sr. Threat Researcher with Fidelis Cybersecurity
• Faculty at the University of Illinois at Urbana-
Champaign
• Producer of open-source intelligence feeds
• Run several takedown-oriented groups for
various malware families
4. Problem Statement
• We are on the losing end of an
arms race
• The adversaries produce more malware than we can
possible analyze.
• We have to operate in the open while they operate in
secret.
• Their core business is exploitation, security for us is a
cost center.
• We operate in a global economy without an effective
means of global law enforcement.
7. Another way to look at it…
• How long does it take to reverse engineer a
malware sample?
• How long does it take to create a
signature/rule/defense?
• How long does it take to create all the IOCs?
• Now… how long does it take that actor to
change?
8. Is it really that many?
• Even though hundreds of thousands of unique files are
seen daily, the number of malware families is much
lower.
• Key is to develop the tooling to take a sample and rip
out the pieces we need that are interesting.
• Single stage malware is easy, the entire configuration is
in one place.
• What about multi-stage malware?
• Still has some place it calls to for the next stage.
9. The problem of “sufficiency”
• Once we “detect” a threat work occurs until some
“defense” is developed.
• Once a threat is “blocked”, the work tends to
stop.
• Many times there are multiple actor sets that may
use a specific piece of malware but detection can
be generic to the tool level.
10. The missing pieces…
• What about ongoing surveillance?
• What about tracking and identifying all the unique
endpoints used by a specific piece of malware?
• i.e. If you could know every C2 that ever was an
njRat server, would that be of interest to you?
• What about the unique attributes (mutex,
campaign ID) that may be used?
11. Making RE more efficient
• Full RE most expensive but most thorough.
• Dynamic analysis is good, but bin may not run correctly.
• Static analysis can be very fast… if you know how to pull
the information out.
• Key is to automate such that you can do as much static
analysis as possible, dynamic for much of the rest and
RE only for the items where there is no other alternative.
13. Why RATs?
• Single stage malware will generally always have
full configuration in the binary itself.
• Used not just by skiddies but by advanced
attackers also.
• Large sample set to deal with as proof of
concept.
• Dozens of RAT types all well-known to deal with.
• Gotta walk before you can run.
15. Maybe I’m being a little too harsh
• RAT operators tend to be the black hat farm team.
• It may be “simple” but the fact we haven’t
eradicated it suggests its not so simple.
• Takedowns are an art form in progress, this
provides lower stakes targets to develop the
tradecraft.
• Lack of enforcement breeds the feeling of
invulnerability of cyber criminals.
• Don’t forget, “APT” use RATs too.
16. Also, there is this magic sauce…
• https://github.com/kevthehermit/RATDecoders
• Python scripts that will statically rip configurations
out of 32 different flavors of RATs.
• Actively developed and you can see in action at
malwareconfig.com
• Disclaimer: I had nothing to do with the
development of these tools; they just fit my need
and Kevin Breen deserves mad props.
17. The next piece of the puzzle
• In order to determine which decoder to use, you need
to know which RAT it is.
• Yara used for this piece using configs from:
• https://github.com/kevthehermit/YaraRules
• Yara Exchange
• In-House Rules
• Yara results used as “authoritative” for purposes of
selecting the decoder.
18. Malware Sources
• VirusTotal
• MSFT VIA Program
• Others I haven’t had chance to see if they want
recognition
• RAT Traps
• In total, upwards of .25 TB a day (not all RATs)
• In short, every piece of malware I can find.
19. RAT Traps
• Some RAT operators tend to have some
targeting information in mind when they are
seeking infections…
• Celebrities
• Corporate executives
• Young girls
• Create faux persona that mimic some of these
characteristics with an available email address
and let nature take its course.
• Or leak them to pastebin if you’re in a hurry.
21. Process
• Intake of Malware
• Normalize into one directory with MD5 as filename
• Process and Unpack Samples
• Scan all samples with Yara
• Use yara output to run selected samples with
correct decoder
• Normalize output
• Process into CSV feed for daily summary of
configuration info
• Profit
22. First Bottleneck… Bandwidth
• Running a hi 1.4 xlarge all this could run in about
90 minutes
• It also costs $1000/mo for on-demand
• Oh, and there is no capacity for spot instances
• Running in corporate datacenter it took about 9-
10 hours which is still acceptable for current data.
• Insufficient to do this retroactively.
• There was one issue with running it in corporate
datacenter though…
23. When datacenter gangsters attack…
• Apparently they get mad when you take up the
whole pipe during business hours…
24. Next bottleneck… Disk
• All of this is disk I/O intensive:
• Writing to disk
• Processing file magic
• Yara scanning
• Python scripts pulling configurations out of
files.
• SSD or Bust…
• Discard binaries when done processing
• But keep source information
25. Last bottleneck… time
• Downloading files one at a time (I don’t control
packaging)
• Yara scanning one file at a time
• Lots of wasted CPU cycles sitting in idle.
• Solution: parallel
find . -type f -exec basename {} ; | parallel --max-lines 1 -j
160 yara ~/yara/all_trojans.yar 2> /dev/null >>
../yarascan.$prettystamp
26. Malware Configs
• Every RAT has different configurable items.
• Not every configuration item is necessarily
valuable for intelligence purposes.
• Some items may have default values.
• Free-form text fields provide interesting data that
may be useful for correlation.
• Mutex can be useful for correlating binaries to
the same actor.
28. Sample njRat config
Key: Campaign ID Value: 1111111111111111111
Key: Domain Value: apolo47.ddns.net
Key: Install Dir Value: UserProfile
Key: Install Flag Value: False
Key: Install Name Value: svchost.exe
Key: Network Separator Value: |'|'|
Key: Port Value: 1177
Key: Registry Value Value:
5d5e3c1b562e3a75dc95740a35744ad0
Key: version Value: 0.6.4
29. Processing DNS/IP Info
• Config takes FQDN or IP in free-form field.
• The only configuration item any processing is
done on is here.
• If RFC 1918 IP, then drop config.
• If FQDN resolves to RFC1918 IP, keep it.
• If it doesn’t resolve, keep it.
31. Pump it all into a database… profit
• CSV is all fine and good, but not great for
historical searching…
• Main table with Hash, C2 info, description,
source and date.
• Also pumped into CIF
• RAT-specific table with Hash and RAT specific
config info.
32. Artifact Mining
• Often (but not always) the operators of a given piece of
malware are distinct and separate from the author of the
malware.
• Correlating related pieces of code may not be worthwhile.
• Cryptolocker example
• At least for RATs, the interesting artifacts are the
configuration, not the code.
• Malware actors may change tools but may continue to
use some of the configuration elements.
33. Why in the world would you ever do this?
1524 Guest16
145 Guest16_min
50 Anonymous
43
29 Hacked
28 Victim
28 HF
27 TestGuest
27 Test1
26 Guest162
25 Slave
23 B--L--A--Y
22 Guest1
20 Test
17 Guest
17 1
16 DOS
15 Eb0la
14 Kurban
13
12 HACKIADO MUAHAHAHAHA
11 test
11 Bot
10 VoltandoAHackear
10 Hack
10 AVA
34. More examples
2652 HacKed
119
109
72
50 Hacked
37 hacked
18
14 google
13 Victim
11 isLam
10 victim
10 system
9 test
9
8 xXxVICTIMxXx
8 vitima
8 4kurdistan.no-ip.biz
…
7 HacKed By Amr Nasr
6 HacKed By Mohamed Ashraf
5 HacKed_by_Hammouda-Hacker
4 Ahmed Najar
4 ahMed-haKerS
35. RAT Creed
This is my RAT. There are many like it, but this one is mine.
My RAT is my best friend. It is my life. I must master it as I
must master my life.
My RAT, without me, is useless. Without my RAT, I am
useless. I must fire my RAT true. I must shoot straighter
than my enemy who is trying to kill me. I must shoot him
before he shoots me. I will...
36. Top Global ASNs for RAT C2s
294 36947 DZ ALGTEL-AS,DZ
131 8452 EG TE-AS TE-AS,EG
115 42708 SE PORTLANE Portlane Networks AB,SE
113 36903 MA MT-MPLS,MA
98 50710 IQ EARTHLINK-AS EarthLink Ltd. Communications&Internet
Services,IQ
69 9121 TR TTNET Turk Telekomunikasyon Anonim Sirketi,TR
69 25019 SA SAUDINETSTC-AS Saudi Telecom Company JSC,SA
52 NA NA
39 47869 SE NETROUTING-AS Netrouting,NL
35 37705 TN TOPNET,TN
31 24863 EG LINKdotNET-AS,EG
30 45595 PK PKTELECOM-AS-PK Pakistan Telecom Company Limited,PK
25 7738 BR Telemar Norte Leste S.A.,BR
25 3215 FR AS3215 Orange S.A.,FR
25 2609 TN TN-BB-AS Tunisia BackBone AS,TN
24 8376 JO Jordan Data Communications Company LLC,JO
23 4565 MEGAPATH2-US - MegaPath Networks Inc.,US
22 8075 US MICROSOFT-CORP-MSN-AS-BLOCK - Microsoft Corporation,US
37. Top Countries for RAT C2s
294 DZ
261 US
225 RU
186 EG
168 SE
152 IQ
145 MA
114 BR
103 SA
99 TR
99 TN
89 FR
81 UA
38. Top US Cities for RAT C2s
22 Redmond, Washington
12 Dallas, Texas
7 Phoenix, Arizona
6 Providence, Utah
6 New York, New York
6 Los Angeles, California
3 Wilmington, Delaware
3 San Antonio, Texas
3 Philadelphia, Pennsylvania
3 Houston, Texas
2 Willoughby, Ohio
39. Eventually fully-retroactive
• All that malware in Virustotal? You can still use that.
• Think of the intelligence possibilities of having a “master”
database of RAT configurations for “all time”…
• If nothing else, Amazon’s stock price will go up from the
AWS fees
• Why?
• Because often we don’t know what is important until
after-the-fact and the ability to go back and have
information readily available can shorten the response
time.
41. What to do with this data?
• Give to LE for action is obvious
• Give to CERTs for them to take action
• Or you can burn all the RATs #OpTrollHackforums
• Creating alerts on this data is probably ok.
• Taking automated blocking action based on this data is
probably not.
42. #OpSoapbox
• This is a wealth of very useful information… but it
is just information.
• Intelligence is the process of thinking critically
about the information you have…
• What is it telling you
• What are all the possible conclusions
• Where can the adversary deceive you
• What harm could be caused if you acted on it
43. Don’t be that guy
Adapted from Brandon Levene* (I think)
44. Counterintelligence
• DNS resolution is under the control of the
adversary.
• The adversary has motive to deceive.
• The adversary has motive to cause harm.
• DGA feeds anecdote
• Shameless plug:
http://osint.bambenekconsulting.com/feeds
45. What’s the worst that can happen…
• If I were evil and knew you were taking automated
blocking action based on something I controlled resolution
for, here is what I would use for IPs:
198.41.0.4
192.228.79.201
192.33.4.12
199.7.91.13
192.203.230.10
192.5.5.241
192.112.36.4
128.63.2.53
192.36.148.17
192.58.128.30
193.0.14.129
199.7.83.42
202.12.27.33
46. Analyzing data at scale
• How can you possibly analyze thousands of
configurations to determine confidence in each
individual record?
• You can’t.
• Ultimately need something to correlate it with.
• Wiretap if LE
• Correlation with other malicious activity at
same IP
47. But the data changes…
• If the adversary uses DNS, they can change information
at-will.
• Long-term goal is to feed “live” data into another
application that handles surveillance called PSS –
Permanent Surveillance System.
• Maybe I’ll open-source it, don’t know yet.
• Beyond that, there are some interesting fields to pivot off
of to correlate campaigns
• Campaign ID
• Mutex
• Registry Keys
48. Long-Term
• Identifying a threat point-in-time has value.
• Surveilling a threat as it moves and changes
proactively reduces the the window of
opportunity for an adversary.
• RATs are just the start
• They are relatively easy
• Still useful to improve the tradecraft
• And they are still used by adversaries
So, rather than tell you the normal “about us” stuff, I thought I’d start off by talking to you about the problem that we’re focused on, which is really the biggest problem in the security business today: the systematic theft of information by advanced threat actors.
As you can see from these quotes, it’s happening on a massive scale. And the people who are doing it are well organized, well funded, and very persistent. They’re often sponsored by large criminal organizations or nation-states.
If they’re cyber criminals they’re normally looking for information that they can turn into cash. If they are nation-state sponsored their motivations are normally geopolitical.
And, in the vast majority of cases their objective is to steal data – typically financial information, personal identity information, or intellectual property.
So, rather than tell you the normal “about us” stuff, I thought I’d start off by talking to you about the problem that we’re focused on, which is really the biggest problem in the security business today: the systematic theft of information by advanced threat actors.
As you can see from these quotes, it’s happening on a massive scale. And the people who are doing it are well organized, well funded, and very persistent. They’re often sponsored by large criminal organizations or nation-states.
If they’re cyber criminals they’re normally looking for information that they can turn into cash. If they are nation-state sponsored their motivations are normally geopolitical.
And, in the vast majority of cases their objective is to steal data – typically financial information, personal identity information, or intellectual property.
So that’s a quick look at our products. Let’s talk about services.