A Guide To Cyber Threat Intelligence
A Guide To Cyber Threat Intelligence
A Guide To Cyber Threat Intelligence
BE ACONS
IN THE
DARK
A Guide to
Cyber Threat Intelligence
T.J. is a Principal Threat Researcher with the Threat Hunting & Intelligence team at BlackBerry. He holds
an MSc in Forensic Computing and Cybercrime Investigation and a BEng in Electronic Engineering. He
began his career in the military and has a background in system administration, networking, security op-
erations, malware analysis, and reverse engineering. In his spare time, he enjoys watching motorsport,
training martial arts and spending time with his wife and kids.
Tom has over two decades of experience in the cybersecurity/anti-malware industry. From reverse en-
gineering malware and developing detection technologies, to incident response, DFIR and threat intel-
ligence, he enjoys tackling complex R&D problems across the cybersecurity landscape. Tom resides in
the English countryside with his wife and two children.
Marta is a reverse engineering expert and enthusiast with more than 12 years of experience in cyber-
security, currently focused on tracking high profile threat actors and campaigns. Besides hunting for
sophisticated malware and dissecting it, Marta enjoys hiking, philosophy, and holds a master’s degree
in archaeology.
Dean is a Senior Threat Researcher within the Threat Hunting & Intelligence team at BlackBerry. He
holds a MSc in Cybersecurity and a BSc (Hons) in Computer Security & Digital Forensics. He has 7+
years of experience across various roles in cybersecurity and has a background in Security Operations,
Network Security, Malware Analysis and Reverse Engineering. In his spare time, he enjoys watching
sports, golfing, and is an avid movie fan.
Eoin holds a BSc (Hons) in Computer Systems from Cork Institute of Technology, graduating with
multiple academic awards including the IBM Prize. He finds both enjoyment and purpose in reverse
engineering malware, software engineering for analysis automation and anything to do with triathlon.
Eoin’s work specializes in Threat Hunting & Intelligence, helping to stay one step ahead of the bad guys
through a variety of creative and effective means.
Jim is the Director of Threat Intelligence at BlackBerry. He has over 15 years of experience working the
full gamut of security roles before joining Cylance and then BlackBerry, doing what he can to help his
team do what they do best, and snowboarding whenever he gets the chance.
3
About the Editors
Natasha Rohner – Senior Managing Editor
Natasha spent six years at the helm of ThreatVector, BlackBerry’s award-winning cybersecurity blog,
working closely with the Research & Intelligence team to produce threat research deep-dives and white
papers. An avid science fiction fan, she has also published eight novels for large media companies such
as Rebellion and New Line Cinema, including the official book adaptations of Hollywood movie block-
busters such as Blade, Final Destination, and Nightmare on Elm Street. Her original horror trilogy Dante’s
Girl was published by Solaris, a division of UK gaming giant Games Workshop.
Lysa began her cybersecurity career in a malware research lab in the weeks before the Melissa virus
outbreak in 1999. As the industry has evolved, she’s moved from threat research to security education.
As part of the BlackBerry Research & Intelligence Team, she uses her unique perspective to help make
threat research more accessible. She and her spouse live on a hobby farm in the Pacific Northwest, with
an assortment of miniature farm animals.
Steve Kovsky is responsible for BlackBerry’s global corporate communications content strategy, in-
cluding thought leadership publications, blogs, social media and customer advocacy. He spent more
than 20 years as a professional journalist, covering all aspects of information technology in print, radio,
television and online. In 2013, he went over to “The Dark Side” (aka marketing) as head of content for
Websense/ForcePoint, then Director of Digital Content and Executive Communications for CrowdStrike.
Mark has over two decades of industry experience with the last 13 dedicated to cybersecurity. He start-
ed his security career at JP Morgan Chase and has worked for several industry leaders including Mandi-
ant and IBM. Mark now leads the BlackBerry international incident response (IR) team.
Seagen has been working in cybersecurity from the time Y2K was considered a threat. He operated in
the endpoint and endpoint management space before moving to research, automated malware analy-
sis, and then joining Cylance as employee #20.
David Beveridge began his career in software development 23 years ago, and he switched to a cyber-
security focus in 2004. Armed with the audacious idea that handsets would soon begin to replace
computers, he started down the road of Artificial Intelligence development in the InfoSec world, which
eventually led him to join Cylance and then BlackBerry. He holds 13 patents in Computer Science, in-
cluding 11 in the field of AI.
4
Contents
Foreword 8
Introduction 11
So, You Want to Gather Cyber Threat Intelligence? 13
What will you find in this book? 13
Who is this book for? 13
How can you benefit? 14
Why are we writing about it now? 14
How is this book organized? 15
Chapter 1 – Beyond the Hype 16
Chapter 2 – All Your Beacons Are Belong to Us 16
Chapter 3 – We are Beacon 16
Chapter 4 – We Can’t Stop Here, this is Beacon Country 16
Chapter 5 – Beacon of Hope 16
Chapter 6 – Debrief 16
Disclaimer 16
1. Beyond the Hype 17
Cyber Threat Intelligence 17
Our CTI lifecycle for an XDR world 18
Planning & Direction 19
Collection 20
Processing 21
Analysis 22
Dissemination 22
Evaluation and Feedback 23
Aligning the Stars: The CTI Lifecycle 23
2. All Your Beacons Are Belong to Us 25
Data Collection 25
Defining the Scope 25
Crafting Some Queries 26
Data Validation 32
Pillaging Team Servers 33
Processing 34
Beacon Config Extraction 35
Automating the Hunt for Cobalt Strike 39
3. We are Beacon 40
Stager vs. Stageless 40
Malleable C2 41
Malleable PE 44
Example Extracted Beacon Configuration 47
Detecting the Beacon Configuration with YARA 53
4. We Can’t Stop Here, this is Beacon Country 54
Constellating 54
Networking 55
Netblocks 56
5
Ports 58
Certificates 59
Configuration 61
Watermark 64
SSL Public Keys 65
Beacon Type 67
C2SERVER 68
HTTP 70
Proxy 72
SMB 73
DNS 75
Injection 76
Compilation Timestamps 79
Rich headers 82
Import hashes 83
Export Names 85
PROCINJ_STUB 86
DEPRECATED_SPAWNTO 89
Miscellaneous 91
5. Beacon of Hope 92
Intelligence Correlation 92
APT41 94
APT41 Continued - Gh0st in the Machine 96
APAC Red Teams 98
DarkSide 100
FIN7 102
WizardSpider 103
Ryuk 103
BazarLoader 104
TrickBot 106
Conti 108
MAN1 110
Ursnif - Saigon Fork 111
TA505 113
IcedID 112
Salfram Phishing Campaign 113
TA505 113
TA575 114
An Initial Access Broker - Zebra2104 116
Enter MountLocker 117
Enter StrongPity 118
Enter Phobos 120
Hidden Dragon 121
Recap 122
6. Debrief 123
Planning & Direction 123
Collection 123
Processing 124
Analysis 124
Insights 124
Trends 125
Discoveries 125
6
Dissemination 125
Threat Intelligence 125
Threat Hunting 126
Incident Response 127
Forensics 127
Data Science 127
SOC 128
Red Team 128
Evaluation and Feedback 130
Beyond the Hype and Back Again 131
7
Foreword
There are probably hundreds of thousands of unique malware types. Analysts around the world have
different vernacular and may call malware different things depending on its role, type, or variety. Viewed
abstractly, many pro's like to refer to each unique strain of malware as an ecosystem, framework, or
family of related code.
Every type of malware ecosystem, malware framework, or malware code family could have many inter-
dependent parts. But each family is really its own genetic species, with its own DNA that tells it how to
act, how to communicate, and how to do malicious things at the behest of an adversary. Each malware
species has a population ranging from the single digits to the millions. Some species or families of
malware are designed to co-exist and cooperate in symbiosis with others.
The genetic analogy of malware falls apart when you consider that they do not form on their own in the
wild, but are designed, written, programmed and (mostly) operated by humans. But we are still left to
wonder, what causes turnover in malware? What is the average lifespan of a malware species? What
causes malware to rise and fall in popularity or efficacy? Why do some malware ecosystems fail in
months, and why do others live long, healthy lives? And more interestingly, what selective pressures
force a malware family to evolve, or to go extinct?
When I joined Mandiant in 2013, the threats that we faced at the time were no different from today,
except for the names. We worked interactive intrusion activity all night, every night, and the intelligence
team – like biologists, classifying and identifying new species in the field – could not give names to new
malware families fast enough.
Early in an intrusion operation, attacks often employ simple droppers, downloaders and reverse shells.
These early-stage malware families are light and fast, often with trivial persistence and simple commu-
nications methods, and they require minimal development time from a malware author.
Early-stage malware typically has a half-life of less than six months and is easy to abandon and replace
if it gets “burned” or detected. Simply put, these were cheap, throwaway code families that did not
survive long in the wild. They came and went quickly and many did not even last long enough to merit
a name.
But after initial access, our adversaries often deployed late-stage malware frameworks. Once the ad-
versary had a seemingly undetected foothold, they would switch out early malware for deeper mal-
ware frameworks referred to interchangeably as “post-exploitation tooling,” “command-and-control (C2)
frameworks,” or simply “late-stage” malware “backdoors.”
Late-stage malware frameworks often use stealthy C2 schemas and network protocols. They often
have a “core implant” with a modular plugin architecture and novel persistence mechanisms, and they
are designed to provide comprehensive command-line access to remote operators. Late-stage mal-
ware ecosystems require huge development investments and are expected to provide years of utility.
An example of an early-stage malware family may be a simple HTTP downloader that uses a common
Windows\CurrentVersion\Run registry key for persistence. An example of a late-stage malware could
be something like Cobalt Strike’s immensely versatile Beacon payload.
Early-stage malware gets replaced wholesale when it gets burned, whereas late-stage malware can last
for decades with tweaks, forks, improvements, and plugins. Late-stage malware has a longer lifespan
8
because attackers want to protect their development investments. To get extra life out of core implants
(such as TrickBot or SHADOWPAD/POISONPLUG), malware developers must introduce new plugins,
new functionality, and new obfuscations. And they must create increasingly elaborate packaging and
multi-layered delivery schemes to evade detection and subvert meaningful analysis.
You are likely familiar with some of the titans of late-stage malware, from the days of yore. For example,
Poison Ivy and PlugX, which may have been in use as far back as 2005. Or Gh0st RAT, which goes as far
back as 2008. And HiKit, which goes back to at least 2011, maybe earlier.
Poison Ivy and Gh0st dominated nearly a decade of intrusion operations, and they were for the most
part stomped out by public research and tooling to help improve global detection. These families sur-
vive in a miniscule footprint today, but evolutionary pressure pushed these species close to extinction.
HiKit and PlugX were detected, and while they were not snuffed out, they were both forced to evolve.
Over the years we have seen several modernizations, tweaks, forks, and derivatives. In the face of evolu-
tionary pressure, malware developers are working to get extra mileage out of their investments. Source
code from both of these families have been used to create new malware frameworks altogether. These
families aren’t dead yet, but I think the continued development effort shows that we have levied some
cost on the adversaries who wish to continue using these toolkits.
While watching the ascent and decline of Pirpi, CozyCar, Xagent, Zxshell, Derusbi, and countless oth-
er beloved malware families, I’ve learned that it takes years of community effort, intelligence sharing,
open-source tooling, and public detection research to apply pressure on the dominant late-stage mal-
ware frameworks. Versatile late-stage, post-exploitation malware ecosystems become even more com-
plicated because we need to study not only the malware itself, but also how the malware is configured,
deployed and operated by a variety of threat actors in a multitude of campaigns over a long period of
time. Rather than just deep analysis of single samples, we must approach doing bulk analysis of tens of
thousands of files at a time, all within the context of thousands of intrusion operations. That’s no small
feat, especially when it comes to the topic du jour, Cobalt Strike.
Cobalt Strike is a post-exploitation framework that was developed to emulate the greatest features of
late-stage malware ecosystems and allow its users to simulate adversary actions. The adoption of Co-
balt Strike by global threat actors, and the framework’s use in hundreds of genuine intrusions, ransoms,
and data breaches, shows that Beacon has fought its way to the top. It currently sits on the throne as
the reigning champ of all malware toolkits. If it works, it wins.
While Poison Ivy and Gh0st have gone out to pasture, Cobalt Strike and its core implant Beacon have
stepped into the limelight. This forces analysts and researchers around the world to renew their ap-
proaches to collecting, processing and sharing information about Cobalt Strike and its use in bulk.
Can you detect Cobalt Strike payloads before they execute? Or only after they execute? Can you detect
the network C2 traffic? And when you see Cobalt Strike detections, can you differentiate between a red
team engagement and a bona fide intrusion?
More proactively, can you develop intelligence on a Cobalt Strike wave before the first phishing email
is sent your way? Can you identify a C2 server before the adversary builds their first payload? Can you
extract additional intelligence directly from adversary-controlled infrastructure? These are questions
that each organization must ask itself, and the team at BlackBerry are offering different ways to say yes.
“Finding Beacons in the Dark” is a labor of love by practitioners for practitioners. What began as a
project to detect Cobalt Strike exploded into a full-blown automation platform for broad collection, pro-
cessing, and data harvesting from Cobalt Strike team servers with corresponding Beacon payloads and
their configuration details.
9
Through creating this system and analyzing the data en masse, the BlackBerry Research & Intelligence
Team observed trends and developed a holistic picture of Cobalt Strike across many phases of the
threat intelligence lifecycle. From static payload analysis to configs to server fingerprints to unique
toolmarks, the authors of this book provide a practical and detailed look at the Cobalt Strike framework
itself and then dive into examples that will help you understand how it gets used in the wild. There are
some handy detection rules and scripts, as well.
There’s more than meets the eye in these pages, and through the lens of Cobalt Strike you may gain a
better understanding of how threat actors tend to design, configure and operate malware of all types.
(Spoiler alert: ports 80, 443 and 8080 are malware config favorites for good reason -- they are almost
always “open” on network gear!)
If you’re like me, you’ll probably have fun spelunking through the details and operationalizing what you
learn. I hope that this inspires you to become a part of the evolutionary pressure, and more broadly, I
hope that this work serves as a model for how to build and share bulk intelligence analysis about prolific
malware families.
10
INTRODUCTION
Cobalt Strike provides adversary simulation and threat emulation software that is widely used by red teams
and heavily abused by malicious threat actors. It has become a highly prevalent threat, employed by a vast
number of Advanced Persistent Threat (APT) and cybercrime groups across the globe.
It is easy to see why this is the case, as it is fully featured and well-documented. From reconnaissance
and spear-phishing to post-exploitation and covert communications, Cobalt Strike is feature-rich, well
supported, and actively maintained by its developers. Beacon, Cobalt Strike’s primary payload, provides a
wealth of features for attackers, which facilitate:
For a lot of legitimate as well as criminal organizations, leveraging Cobalt Strike can be cheaper and faster
than developing their own tooling. At the time of writing, licensing starts at $3,500 per license per year. If you
are an unscrupulous bad actor who is using a cracked or leaked copy, the cost goes down to literally nothing.
From a threat intelligence or law enforcement perspective, Cobalt Strike’s widespread use can often make
the task of attribution more challenging, and the current upward trend in utilization is not showing any
sign of decline.
Proofpoint researchers recently reported a 161% year-over-year uptick in the use of Cobalt Strike by
cybercriminals. It has become a perennial problem for security practitioners, requiring robust solutions
that can aid in providing both defensive capabilities and enhanced threat intelligence.
Threat Post
Cobalt Strike Usage Explodes Among Cybercrooks
https://threatpost.com/cobalt-strike-cybercrooks/167368/
Proofpoint
Cobalt Strike: Favorite Tool from APT to Crimeware
https://www.proofpoint.com/us/blog/threat-insight/cobalt-strike-favorite-tool-apt-crimeware
On the defensive side of things, the best thing we can do to tackle the challenge of combating the rogue
use of Cobalt Strike is to have solid processes in place. These processes need to be not only well thought
out, but also driven by data.
11
the role of cyber threat intelligence in xdr
We have defined a robust Cyber Threat Intelligence (CTI) lifecycle that considers stakeholders for all prod-
ucts and services across the extended detection and response (XDR) solution space. Over the course of
this book, we’ll guide you through our lifecycle and use Cobalt Strike as a practical hands-on case study.
You may ask, what is XDR? XDR is a fairly new term and one that a lot of folks are not yet familiar with. This
is how IT consulting firm Gartner has defined it:
“XDR is a SaaS-based, vendor-specific, security threat detection and incident response tool that natively
integrates multiple security products into a cohesive security operations system that unifies all licensed
components.” - Gartner
At its core, XDR is a data ingestion and enrichment strategy. This means that it ingests telemetry from
cybersecurity products and services, as well as insights from threat intelligence teams and information
from third-party sources. This data is then stored in a data lake, which is essentially a storage solution
for raw data on any scale. The ingested data is then further processed to create additional context, which
then drives intelligence-based threat-detection and correlation of incidents and alerts for all XDR products
and services.
So why does XDR matter in the context of this book? Well, the automated ingestion and correlation of
intelligence data helps to decrease the burden of “alert fatigue” for Security Operations Center (SOC)
analysts and incident responders. By providing more contextual information concerning incidents and
alerts, incident responders are better informed to react swiftly and decisively. In addition, the data can
be used for the automation of Incident Response (IR) Playbooks, to help orchestrate workflows and
processes during incidents.
How then, do you produce, correlate, and consume CTI to empower XDR-enabled solutions and ser-
vices?
As prevention is always better than a cure, the ultimate solution needs to be more proactive than reac-
tive. The hunted must become the hunter, and for this pursuit, Cobalt Strike Team Servers, our quarry.
12
SO, YOU WANT TO GATHER CYBER THREAT INTELLIGENCE?
what will you find in this book?
In this book, the BlackBerry Research & Intelligence Team presents a system for hunting the Internet
for instances of Cobalt Strike Team Server, which is the C2 server for one of the most pervasive threats
deployed by modern threat groups: Cobalt Strike Beacon.
In addition, we present our Cyber Threat Intelligence (CTI) lifecycle, which outlines our multi-phase
approach to building intelligence-led protection for products and services underpinning most XDR prod-
ucts and services. The lifecycle outlines the following phases:
By following our CTI lifecycle to hunt for Team Servers, and extracting configurations from the Beacon
payloads they serve, we aim to demonstrate how you can leverage the resulting dataset to provide pow-
erful intelligence insights. These insights can help to reveal clusters of servers associated with known
threat groups and campaigns, as well as links between them that were previously unseen, empowering
you to expose correlations between seemingly disparate network infrastructure.
Finally, the resulting intelligence can also be leveraged to provide actionable Indicators of Compromise
(IOCs) to all XDR stakeholders, including defenders, hunters, analysts, and investigators alike. These
will help you to:
This book is for anyone with an interest in gathering Cyber Threat Intelligence, those who want to further
their understanding of Cobalt Strike, or those who simply enjoy a good technical read.
That said, the people who might derive the most reward from this book may include:
By defining a CTI lifecycle, we present a blueprint to help you with creating one that fits your own needs.
It can also be used to help build your own automation platform for harvesting and disseminating cyber
threat intelligence.
13
Walking you through our lifecycle, we begin the collection phase by hunting for active Cobalt Strike
Team Servers. Once the true cyber adversaries’ Team Server instances are identified, it gives us a
unique opportunity to reveal trends and patterns within the data. These insights can help to perform a
variety of useful things, such as:
While we use the example of Cobalt Strike in this book, we hope this exercise sparks your imagination
and inspires you to use this for other threat intelligence quests. This industry thrives because it is popu-
lated by so many individuals who are passionate about the sharing of information, including tools, tips
and techniques. By adding our contribution, we hope to keep this altruistic tradition alive.
All these things aside, we hope that in reading this book you may learn a thing or two, have a laugh along
way, or even gain insight into our processes for the purposes of competitive intelligence!
14
BleepingComputer
Translated Conti ransomware playbook gives insight into attacks
https://www.bleepingcomputer.com/news/security/translated-conti-ransomware-playbook-gives-
insight-into-attacks/
While not the only culprit, Cobalt Strike Beacon has been the common denominator in these attacks
time and again. Lesser-financed and lesser-resourced groups – as well as those just looking to blend in
with the crowd – need look no further than cracked, leaked or trial versions of Cobalt Strike. The low bar-
rier to entry this provides, with the ease of propagation through botnets and other distribution services,
has acted as a catalyst for the ransomware epidemic and expedited its rate of growth.
To improve our own intelligence-led protection and correlation of malicious instances of these compo-
nents, BlackBerry created an automated system to scan for Cobalt Strike Team Servers. It downloads
Beacons then extracts and stores their configurations for further processing, analysis, and dissemina-
tion.
The aim of this book is to aid the security community by sharing this knowledge, presenting the steps
we’ve taken to create this automated system, and most importantly, demonstrating how to derive
meaningful threat intelligence from the resulting dataset. This information can then be used to provide
insights, trends and intelligence on threat groups and campaigns.
We will then introduce Cobalt Strike Beacon and its configuration profiles, as well as a full table of
configuration options and common values for quick reference. We will use the resulting knowledge and
dataset to dig deeper into insights and identify trends, uncovering some unexpected revelations along
the way.
Finally, we will enrich our dataset with open-source intelligence (OSINT) using our Threat Intelligence
Platform (TIP), and look to uncover new correlations and groupings, before circling back to reassess our
CTI objectives and findings in a debrief.
15
chapter 1 – beyond the hype
In the first chapter, we’ll outline our CTI lifecycle. We’ll outline how the lifecycle is leveraged throughout
the following chapters to achieve our intelligence objective, which is an automated hunting system for
Cobalt Strike.
chapter 6 – debrief
In the final chapter, we will recap our CTI lifecycle and review each phase as it pertains to building a sys-
tem for hunting Cobalt Strike. We’ll also explore the intelligence insights uncovered along our journey.
disclaimer
It is worth mentioning that no Team Servers were harmed in the making of this book! All findings throughout
the book originate from Beacon analysis. We have not installed, remotely or locally operated, reverse
engineered nor debugged Team Server to arrive at any of our findings or conclusions.
16
chapter one
BEYOND THE HYPE
Recent advances in cybersecurity technology, such as XDR, certainly necessitate the need for more formal
and mature processes. CTI is now widely used to underpin XDR solutions. This means that intelligence
insights are leveraged to enhance protection and correlation, leading to an increased efficacy for security
products and a reduction in alert fatigue for SOCs. We call this intelligence-led protection and correlation.
The current CTI landscape draws from multiple sources, including the military, intelligence agencies, univer-
sities, and the private sector, to name a few. All these influences have offered significant improvements
to what was once simply termed “threat research”, and have helped to evolve CTI processes, workflows,
and paradigms in a short period of time. The speed of development in this area inevitably leads to some
confusion and a lack of consensus on the right way to approach CTI creation.
We’d love to say we have the silver-bullet solution for how to do it properly. In reality, this book aims to
highlight some of the common phases and most critical areas so that we are all on the same page (no
pun intended). When you get hooked on CTI and want to improve your organization’s program, there are
numerous resources, such as books, papers, talks, blogs, and training programs that can help you.
Understanding CTI as a lifecycle – where people, processes, and technology work in harmony – will lead
to the production of intelligence that can be used to assess risk, identify threats, and make informed deci-
sions. And if you insist, you can even give that intelligence product a cool name and a supervillain-esque
personification.
Now that we’ve introduced the concept of CTI, almost everyone will have a different interpretation of what
that means. To avoid any misunderstandings, here is our working definition of CTI that will help you to
understand what we are all trying to achieve...
“Cyber Threat Intelligence collects information to answer specific questions (such as who, what, where,
when, how, or why) about a person or thing that is likely to cause damage or danger to computers or
networked systems.”
That’s kind of wordy, so feel free to take the sentiment and create your own definition for your organization.
It’s important to have a well-understood definition that works for you.
Having both your team and management coalesce around a well-formed idea is hugely beneficial. It keeps
everyone focused on achieving their goals, while management is clear on the outcomes the team will deliver.
Having defined our deliverables, let’s put some thought into how to do it. While there is a great deal of creative
thinking involved in CTI, it should not be the sole requirement of the team. Without a defined framework,
creative thinking can spark inspiration, but it will have no way of following through on its promise.
17
By agreeing on a framework, and then developing the people, processes, and tooling to support its execution,
team members will be able to understand their responsibilities on a tactical and strategic level. The ideal
situation is to have well-trained people follow a repeatable process that is supported by the appropriate
tooling, which aligns with a scientific methodology. If you achieve this, it will enhance (rather than rely on)
the intuition of individuals.
This section is not meant to be the definitive CTI lifecycle. We hope that it will spawn ideas that you can
assess for your own organization and help inform the lifecycle you choose to follow. It also serves as
scaffolding for further information laid out in this book.
Each of the processes, scripts and analyses discussed in this book can be tied back to a distinct phase
of the lifecycle. Thinking of it in this way can provide order to what might seem to be chaos. (If not chaos,
then maybe Thanos, - chaos’ older, more-chaotic sibling.)
The lifecycle we describe in this section isn’t prescriptive in terms of the processes or technology required.
That’s all up to you to decide. The framework we’re providing allows you to decide the appropriate people,
processes and technology that work best, to accomplish the goals of each phase.
Likewise, there is no set number of processes to include in each of the phases. It all depends on what is
needed to achieve your intelligence requirements.
Speaking of intelligence requirements, this leads us nicely onto the first (seemingly most mundane, certainly
most overlooked, and yet critically important) phase.
18
planning & direction
During the planning and direction phase of the CTI lifecycle, we like to set up two key components:
That’s why this phase is often overlooked or poorly thought through. But the results of paying mere lip
service to planning and direction will haunt you.
Getting this phase right will lead to greater efficiency and focus for your team, as well as a better intelligence
product for your audience. This is the best chance to rid yourselves of ambiguity and assumptions about
what you are trying to achieve.
Thinking back to the description of CTI, the statement, “collects information to answer specific questions”
stands out. The planning and direction phase is where you define the question you are going to answer
throughout the rest of the lifecycle. Everything you do should be focused on answering the question
defined in this phase.
While we are talking about questions; not all questions are created equal when it comes to intelligence
requests. Questions that are generally narrow in scope and those which form a closed loop work better.
They help us by creating tailored knowledge to support specific decisions the individual or group is looking
to make.
Understanding the difference between broad and closed-loop questions can be a little tricky, so let’s look
at some example questions:
This question is too broad. Simply put, there are too many different ways to answer it. People can reasonably
have different interpretations of what is required. For example: How do you define “cyber threat?” How do
you define “biggest?” Who is the target that you’re most concerned with? As there is no focus around what
is required, the resulting product will not be useful in supporting any meaningful decision. This might feel
satisfying to explore, but for practical purposes, it will be wasted effort.
What public-facing vulnerabilities have been most commonly exploited in the last three months?
This question is very specific. It clearly delineates what threat we’re concerned with (public-facing vul-
nerabilities), what aspect of it is most relevant (most commonly exploited), and it gives a limited time-
frame (three months).
While you don’t necessarily need to have this much specificity, the more information you can include in
the question, the better your answer will be. This kind of question will result in the team understanding
what is required of them, which means less chance of researchers going off-track. The answer will lead
to actionable intelligence and may still be quite satisfying to explore.
19
Having this narrow focus when producing the intelligence product is key to keeping your team on track
to produce what is needed. This is where things can get a little nuanced; during the process of answer-
ing the question, the team is going to have to work with a lot of data. Some portion of this data may not
be relevant to the question being set. But if your team has taken the time to collect, process and analyze
this data, don’t waste that work (you might just get a book out of it!).
In the world of XDR, this data has its place and should not be discarded as waste. To illustrate the point;
while refining sugar cane into sugar, one byproduct of the process is molasses. Where sugar is the
sweet and shimmering answer to the question, the mineral-rich molasses is the analyzed data that is
irrelevant to the desired outcome.
Other teams will be able to make use of this gooey goodness, and they can make something truly valu-
able out of it. Spread the love and find the teams in your organization that can make the best use of the
results of your hard work.
In this phase you should also think about exactly who is going to consume the produced intelligence,
and what their requirements are. It is all too easy for a passionate researcher to get caught up in a cool
exploit or innovative obfuscation technique. But if the intended audience is a CISO looking to decide
what tooling to buy based on trends in attacker tactics, techniques, and procedures (TTPs), an intelli-
gence product that goes down a different rabbit hole is worthless for answering this question.
An audience might think differently than you, and they could require things that you would disregard.
One way to help define who needs which information is to describe three different types of intelligence:
Hopefully, you now understand the importance of this phase and can see how putting a little more time
and thought into it will pay off for the rest of your endeavors.
collection
Now that we know what facts we seek and who will be consuming those facts, we need some data to
work with. Before you get all excited and grab all the data from All-The-Things™, keep in mind the question
that we are trying to answer. We need data to answer that question. Specifically, we need relevant data.
Collection is where we gather that relevant data. This could be both internal and external data, including:
• File hashes
• IP addresses
• Domains
• Political news articles
• Historical information
• Logs
• IR reports
• Blogs
• Dark web
• Social media sources
• Code snippets from online repos
• Data dumps
20
From a very generic perspective, external data sources are usually easier to access and consume because
they come from products that are made to be used that way. External sources typically have a well-defined
interface for extracting data, such as via API, or export functionality within the user interface.
Internal data sources require more time and development effort to introduce because they usually aren’t
coming from products designed with that functionality in mind. Pulling that data out might require extra
processes from teams like IR or the SOC, which are busy with their other daily responsibilities. It might also
require further development of internal tools, diverting development resources away from improvements
to the primary function of the tool is a tricky balancing act
The trade-off to consider is that while internal sources contain information that is way more relevant to
your organization, an over-reliance on external sources might not give you the insight you require.
Regardless of where you get your data from, collection is the perfect place to introduce automation. As
you read through the rest of the book, look at the queries and processes used to automate the harvest of
Cobalt Strike Beacons. You should see that they can all be performed by either a human or in an automated
fashion. Where things can be automated, try to make that a reality. The biggest benefit of having humans
in the mix will become apparent soon.
processing
Now you have data, but it might not be ready yet for human consumption. Processing is where you manip-
ulate the data. You organize it, label it, translate it, deobfuscate it, decrypt it, and filter it. You make it ready
for the analyst to use.
As with the previous phase, automation is pretty much a prerequisite for the processing phase. The number
of manipulations you are likely to have to do, over the sheer volume of data you will inevitably gather, is
a huge waste of your most precious resource – your team. Not to mention, this sort of processing is
soul-destroying drudge work.
The final thing to think about as you’re processing data is how to provide a curated dataset somewhere
that your analysts can interrogate it. You can make this as complicated or simple as you like. Microsoft®
Excel® pivot tables can be a pretty powerful starting point. Maltego® and Jupyter® Notebook offer more
advanced visualizations. And for the truly adventurous, PyQt5 makes custom data visualizations very easy.
Figure 4 – The PyQt5 based visualization tool we developed for viewing our Beacon datasets
21
analysis
So now we have a question, we have an audience, and we have relevant data. This is the point at which
humans cannot be replaced. In a phase shrouded by the psychology of cognitive biases, competing hypoth-
eses, and a myriad of reasoning techniques, we attempt to answer the initial question we were assigned.
When conducting analysis, it is important to keep the two outputs from planning and direction clear in your
mind: What is the question, and who is it for?
If you are in the intelligence-creation space, you are (or at least should be) a curious person. While this is
a terrific quality for analysts, it has a significant downside. You always want to know more, so you might
struggle with where to stop analyzing.
On the surface, understanding more about any given subject is better, right? Creating a masterpiece of a
report that takes four months to write means the data you reference might be out of date and therefore not
actionable. Conversely, if you work quicker and get the data out sooner, you might not have the time you
need to assure the accuracy of the data. This balance between time and accuracy versus completeness
is something everyone in the field battles with.
To help with this balance, let us go back to planning and direction. Who is going to consume the intelligence,
and what do they need from it?
As a very rough, very generic guide, we can look back at the different types of intelligence:
• Strategic - Greater need for accuracy and completeness, less time sensitive.
• Tactical - The middle ground. As complete as it can be, while being delivered as quickly as possible.
• Operational - Needs information as close to real time as possible; some lack of accuracy is
tolerated.
Before we move on to the next phase, it is worth noting that entire careers have gone into understanding
how to analyze data. There is no way we can hope to do the science of research and intelligence analysis
any justice in this book. If you are wanting to understand the way people think and reason, Richard J.
Heuer’s book Psychology of Intelligence Analysis is a great place to start.
dissemination
Once you break away from the fun stuff, it is time to gently place your intelligence baby into the hands of
its new owner(s). Your creation needs to be released for consumption by vested stakeholders. In reality,
this will likely involve many teams and individuals who are involved in providing XDR services.
Referring to the initial phase of planning and development again, the medium for this publication will depend
on the audience and their requirements. As with everything contained in this section, there is no right or
wrong way, but there are factors to consider with the different types of intelligence products available.
SOC analysts and IR teams are going to want an intelligence product they can parse quickly, and perhaps
load into tooling. Executives are going to require something that is easily understood, preferably in report
format, or potentially as a briefing with slides and key findings.
Remember where we said that the planning and direction phase will haunt you, if it’s done sloppily? If you
give your IR team a 40-page PDF file, or your executives a list of contextualized IOCs, people aren’t going
to see the value in the intelligence you have lovingly crafted. Delivery of the information should not be an
afterthought.
22
There it is: we’ve planned, collected, processed, analyzed the data. And now we’ve delivered it to the stake-
holder. We’re done, finished, time for the next… But wait! We’re not quite there yet.
There’s one last, equally important, phase to consider before we can call our lifecycle complete.
We can’t possibly attempt to answer those questions without something to compare it to. This once again
highlights the importance of the planning and direction phase.
Aside from evaluating the product, we should highlight any deficits that were discovered in any phase of
the lifecycle so that improvements can be made. Because this is a cyclical process, if this step is missed,
it will mean a degradation of the service over time, and repeated failures in future projects.
Evaluating the lifecycle can help us with automation too. Full automation is not always immediately achiev-
able. It often requires an iterative approach over time, with cyclical analysis and development driven by
insights gleaned from repeated manual processing, as well as feedback from stakeholders.
An approach that we’ve implemented, which we’ve found helps us when analyzing the successes and failures
of each phase, is to look at each one through the lens of the three main components needed to deliver it:
• People
• Process
• Techology
For example, when considering the collection phase, ask the following questions:
• Do we have the skill set we needed within the team to identify the relevant data required?
• Does the process for gathering the data execute in a timely fashion?
• Do we have the right tools in place to ingest the data?
If you look at it from this perspective, you can then make recommendations and secure funding with spec-
ificity. And if you want to go the extra mile, you can quantify the improvements to make a business case.
Typically, when you use the CTI lifecycle within your organization, the points at which the requestor or
customer will interact with the lifecycle are limited. They will be involved in the planning and direction
phase, helping to define what they need and how they need it. The next point at which they will be involved
is when they receive the product, in the dissemination.
The majority of the work you do will be completed out of the spotlight. For the purposes of this book, we will
walk through those phases, to give inspiration in how you can approach the lifecycle within your organization.
Quick quiz: What is the first phase of the lifecycle? You got it, Planning & Direction!
So, for the purposes of this book – what was our question, and who was our initial audience?
23
Eric Milam, our Vice President of Research, tasked the BlackBerry Research & Intelligence Team with
providing intelligence to all XDR stakeholders to help them proactively protect and defend against Cobalt
Strike.
There is a lot in that question. If you look at it through the advice above, does it meet the requirements of
a narrow question?
Not really! It is broad, and it isn’t an intelligence question. But it has an intelligence component.
So, we worked on what was actually required from the intelligence side of the team. In order to answer the
bigger question, we have several teams who need to consume our intelligence, including SOC teams, product
engineering, data scientists and analysts, all contributing to products and services under the XDR umbrella.
That one question became several questions, with different audiences across the XDR solution space,
and therefore different deliverables.
Product engineering wants a better understanding of the operation of Cobalt Strike Beacon, posing the
question:
“How can we improve correlation and campaign tracking relating to Cobalt Strike?”
Throughout the remainder of this book, we’ll demonstrate our CTI lifecycle by building an automation
system to collect and process Cobalt Strike Beacon payloads, uncovering over 6,000 Team Servers along
the way. We’ll provide our insights and trends from analyzing over 48,000 Beacons served from those
6,000+ Team Servers, and we also exhibit how intelligence correlation can be performed to enhance our
knowledge of threat groups.
Finally, we will debrief, and assess how our results helped answer the questions posed by the various
stakeholders.
24
chapter two
ALL YOUR BEACONS
ARE BELONG TO US
Cobalt Strike works in an agent and server configuration. Each Beacon is deployed (usually surrepti-
tiously) as an agent on the endpoint and is configured to communicate with a Team Server that acts
as the C2.
One is rendered useless without the other, which gives us a couple of options in terms of hunting and
detection capabilities. We can choose to detect and respond to either the Beacon or the Team Server,
however, there are reasons why you may choose one over the other.
Detecting and responding to the Beacon likely means that a threat actor is already active on our net-
works, or that there has been a patient zero victim. This approach is therefore largely reactive. Detecting
the Team Server has no such requirement and means we do not have to wait for a device to be targeted
before taking action to defend ourselves.
To be proactive, which is the ideal scenario, we must be actively looking to locate and identify Cobalt
Strike Team Servers in the wild. Ideally this would happen as soon as possible once a new Team Server
is deployed. This would allow us to take preventative actions, thereby cutting the head off the snake
before it ever has a chance to get close enough to bite.
So, where can we look to find a source of Team Servers for our data collection purposes?
DATA COLLECTION
defining the scope
There are several data sources we can use to generate a list of Cobalt Strike servers that we will want
to defend against. These sources can include the following:
While they are still valuable, many of these sources are reactive in nature and place defenders on the back
foot. By the time something ends up in an intelligence report or has triggered alerts in your SIEM, something
bad has potentially already happened.
25
There are several public methodologies for identifying Cobalt Strike Team Servers or active Beacons.
RecordedFuture
A Multi-Method Approach to Identifying Rogue Cobalt Strike Servers
https://www.recordedfuture.com/cobalt-strike-servers/
As already stated, our aim is to stay one step ahead of the bad guys and detect Team Servers in the wild.
To this end, we have three main options:
• Scan the entire Internet using a custom-built scanner with the purpose of detecting and analyzing
Cobalt Strike Team Servers
• Leverage well-known and established scanning services already available on the Internet such
as Shodan, Rapid7, Censys or ZoomEye
• Build a hybrid system that leverages public services in conjunction with a private, more targeted
scanner
All options have their strengths and weaknesses. They require differing levels of investment and have
different barriers to entry for any organization looking to implement such a system.
Building and operating a bespoke Internet-wide scanner and analyzer is the best option in terms of the
potential quantity of results. It also offers the best ability to add customizations. But this is also the most
expensive option in terms of the time and skills required to implement it. It might be beyond many orga-
nizations’ capabilities or budget.
The use of public scanning services can be helpful for organizations that do not have an existing way
of discovering or tracking Cobalt Strike infrastructure. However, without an additional layer of human or
automated analysis for quality assurance, these services might not yield optimal results. You could not
achieve a high level of certainty that a server is indeed hosting a Cobalt Strike instance.
Building a hybrid system is a happy medium between these two approaches. This should provide results
that have a high level of certainty, but in a more cost-effective manner. Granted, you might not have the same
volume of results as from a bespoke system, but it would certainly still offer a good return on investment.
This is where services like Shodan can make life easier, as they have already done the legwork for you.
Other researchers have used similar services like Censys and ZoomEye. Or you can opt to use datasets
from Rapid7 instead for Cobalt Strike hunting.
26
For this paper we will focus on Shodan, but Rapid7 Open Data was also invaluable in our data collection
phase. You may decide to use one or even all the services mentioned.
Shodan
https://www.shodan.io/
Rapid7 Open Data
https://opendata.rapid7.com/
Censys
https://censys.io/
ZoomEye
https://www.zoomeye.org/
Identifying Cobalt Strike team servers in the wild by using ZoomEye
https://80vul.medium.com/identifying-cobalt-strike-team-servers-in-the-wild-by-using-zoomeye-
debf995b6798
The important part of this phase is getting relevant data to feed to the next stage of our analysis. Firstly,
we need to craft search queries to unlock the value in Shodan’s data. To limit false positives, these queries
need to be based on known Cobalt Strike Team Server characteristics. The results of these queries will still
need further scrutiny and processing to increase the level of certainty that a server is hosting Cobalt Strike.
It will take time, experimentation, and regular updates to craft a good set of queries that can account for
the different versions of Team Server. These queries should also include instances where the threat actor
has customized their deployment, causing it to go undetected by an existing query set.
Here, we have crafted a query that can be used to detect the “404 Not Found” HTTP response returned
from the NanoHTTPD server used in the backend of a Cobalt Strike Team Server.
Figure 5 - Shodan query to detect Cobalt Strike ‘404 NOT FOUND’ response
This query searches for a HTTP server returning a “404 Not Found” response that has a content length of
zero, a content type of “text/plain”, and which returns a “Date” header.
The number of results returned via this Shodan query is huge, with more than 322,000 in total. The majority
of these would likely be false positives. This is due to the way Shodan queries operate; they will trigger on
any systems that contain the values specified in our query, including systems that contain other headers
in addition to those specified.
27
Figure 7 – Shodan Query results for "404 NOT FOUND" response from Cobalt Strike Team Server
For those familiar with programming logic or string comparisons, it is best to think of Shodan queries as
a “contains” comparison, rather than “equals”. To work around this, we will require a tighter, more specific
query to filter some of these extraneous results out.
For example, if we wanted to remove results that contain a “Connection” header, we can append “AND
NOT “Connection”” to our existing query. This would significantly reduce the number of results and cut
down on false positives.
The alternative to filtering at the query level is to perform some additional processing of the results, using
automation or scripting.
Depending on your level of Shodan API access, you might be forced to refine the query quite a bit, or else
you risk exceeding your API keys limitations. You will definitely need more than one query to cover the
range of Cobalt Strike server configurations or customizations, so make sure you adjust your approach
to suit your API limits.
There needs to be a balance between having a query that is not so tight that it creates false negatives,
but also not so loose that you create false positives (which in effect are wasted API query results). API
limitations aside, in most scenarios a false positive is more favorable than a false negative. False positives
can be whittled down later, but false negatives are missed Team Servers, which are potentially active in
the wild and used to conduct attacks.
Another query that has provided valuable results for detecting Cobalt Strike Team Servers is based on
JARM fingerprinting. JARM is a Transport Layer Security (TLS) fingerprinting tool developed by Salesforce,
which they have leveraged to detect Cobalt Strike Team Servers and other malicious servers.
Salesforce
Easily Identify Malicious Servers on the Internet with JARM
https://engineering.salesforce.com/easily-identify-malicious-servers-on-the-internet-with-jarm-
e095edac525a
Shodan added JARM search functionality in November 2020, and it is proving to be a powerful tool in the
threat hunter’s arsenal. The Cobalt Strike Team Server is written in Java, and each Java TLS stack has a
very specific JARM fingerprint. As Java 11 is frequently used as the build version for a great number of
Cobalt Strike Team Servers, its JARM fingerprint has also become a JARM fingerprint for Cobalt Strike.
ssl.jarm:"07d14d16d21d2107c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1"
Figure 8 - Shodan Query for Cobalt Strike/Java 11 SSL JARM fingerprint
28
Cobalt Strike
A Red Teamer Plays with JARM
https://blog.cobaltstrike.com/2020/12/08/a-red-teamer-plays-with-jarm/
SANS
Threat Hunting with JARM
https://isc.sans.edu/forums/diary/Threat+Hunting+with+JARM/26832/
Searching a known Java 11 JARM associated with Cobalt Strike, we received a little over 6,000 results:
Figure 9 - Shodan Query Results for SSL JARM fingerprint for Cobalt Strike Team Server
These results contain Cobalt Strike Team Servers as well as legitimate servers running the Java 11 TLS
stack, so false positives will be present.
We also need to consider that spoofing JARM signatures is a possibility, whereby a server can be config-
ured to masquerade as a Cobalt Strike Team Server from a TLS/JARM perspective. These spoofed
servers might be configured to act as a honeypot that could be used to detect systems like ours, that are
attempting to discover Cobalt Strike Team Servers in the wild. These servers can then be blocked during
future deployments, potentially thwarting our scanning efforts.
Stefan Grimminck
Spoofing JARM signatures. I am the Cobalt Strike server now!
https://grimminck.medium.com/spoofing-jarm-signatures-i-am-the-cobalt-strike-server-now-
a27bd549fc6b
Additionally, threat actors with an awareness of JARM fingerprinting could also modify their TLS stack in
a way that alters their JARM fingerprint to evade detection. Looking at the top 10 JARM fingerprints for
Team Servers we have observed in the wild, we can confirm that this is the case. The top result by far is
the JARM fingerprint for the Java 11 TLS stack, but there are several notable deviations from this.
29
Figure 10 – Top 10 JARM fingerprints
Other queries can be based on criteria such as Cobalt Strike’s default, self-signed SSL certificate, which
we’ll take a closer look at later in the book.
ssl.cert.serial:146473198
Figure 11 - Shodan query to check for Default SSL Serial
This SSL certificate should ideally be changed from the default prior to a live operation or engagement, but
people often neglect to change it when they deploy a Team Server. This gives us an opportunity to discover
servers that still use this certificate, whether intentionally or not.
Figure 12 - Shodan Query Results for SSL certificate serial for Cobalt Strike Team Server
30
Lastly, we can also craft queries based on the numerous Malleable C2 profiles for additional coverage
(we’ll cover these profiles in more detail in Chapter 3).
One such example would be a query to detect Team Servers using the Microsoft Update Malleable C2
profile. This profile is configured to use a certificate common name of www[.]windowsupdate.com, to
masquerade as a legitimate Microsoft certificate.
When we query for servers using this certificate common name, we get far fewer results when compared
to the other queries. But this time we get a higher likelihood of true positives.
With some time and experimentation, and further knowledge of Malleable C2 profiles, common certificates,
and HTTP response headers, we can craft multiple queries that will return an abundance of data, which
we will need to further validate for potential Team Server activity.
31
data validation
Now that we have crafted some queries and started to gather data, how do we validate the results?
There are a few questions that we can ask of the data, which can increase our confidence of a valid detection:
1. Do any servers appear in multiple result sets? (i.e., are there detection overlaps?)
2. Have any of the collected servers been reported via OSINT channels, threat intelligence feeds,
or been observed attacking other organizations?
3. Can we coerce the Team Server to serve up a Beacon?
At a minimum, we need to interrogate the datasets and intelligence feeds for detection overlaps and
duplications and check if any of the servers have already been observed carrying out malicious activities.
Detection overlaps can be used to our advantage here; if we have two or more differing queries or datasets
that return data containing the same IP address, then it can increase the likelihood that the discovered IP
is in fact an operating Team Server.
The ideal scenario is one where we can force a server from our dataset to serve us a Beacon. If we can
do so, then we will know for certain that we have discovered a Team Server and can mark it for the next
stages of our CTI lifecycle.
This will not always be possible, as Team Servers can be protected behind redirectors that can limit
connections to the Team Server itself, thereby preventing us from retrieving a Beacon. In this instance,
there are further ways of detecting Cobalt Strike redirectors that can be added into our validation process
to further increase our detection confidence.
Sticking with the objective of retrieving a Beacon from a Team Server, we need to know how we can emulate
a valid stager check-in so that we are served a Beacon.
There is a bit of behavior that was implemented purposefully to allow interoperability between Cobalt Strike
and Metasploit Framework generated stagers that can help us here. Both Metasploit and Cobalt Strike
stage their payloads in such a way that a specially crafted HTTP request – where the Uniform Resource
Identifier (URI) matches a specific checksum8 value – will cause the Team Server to serve a Beacon.
Depending on the mode of operation and the architecture of the payload being staged, the URI may need to
be of a specific length and have a specific checksum8 value. The breakdown of how this works for Cobalt
Strike can be seen in the table below.
32
Armed with this knowledge, we can develop a simple Python script that can generate a URI string to satisfy
any checksum8 validation and URI length checks. This script ultimately could be used to spoof a stager
check-in.
Figure 15 – Python script to generate a URI of a specified length and Checksum8 value
This approach does have its limitations. If the adversary is using a stageless payload in their deployment,
or if they have disabled staging altogether, we would not be able to retrieve a payload. A stageless payload
is one that contains both the payload stage and its configuration in a self-contained package, so there
is no requirement for a check-in to the C2 to complete the infection process (for more details see Stager
vs. Stageless).
At this point, we have one or even several data sources that are providing us with targets for scanning.
We also have a means of generating the correct stager URI required for us to try and download a Beacon
from each of the suspected Team Servers. Combining these two pieces of information, we can begin to
automate the process of emulating a stager check-in to each of the potential targets, and thus save any
returned payloads to disk for subsequent processing and analysis.
33
Figure 16 - Python function to attempt to download a Cobalt Strike Beacon
processing
At this point, we should have some payloads ready for processing, although not all of them will be Cobalt
Strike Beacons. We may have inadvertently hit on legitimate content or have been served spoofed content
to mask the presence of an actual Team Server.
A valid Beacon payload stage is normally a Portable Executable (PE) file, most commonly a dynamic-link
library (DLL), or position-independent shellcode that will decode a PE. We can filter out false positives by
removing files that are not PE files or that are smaller data files (less than 200KB), as Cobalt Strike payloads
are generally larger than this size. What remains should be Cobalt Strike Beacons ready for configuration
extraction.
34
beacon config extraction
As already mentioned, the payload served by a Team Server takes one of two possible forms:
If we have been served the latter, then we will need to decode the encoded PE before we can attempt to
extract the configuration data. This can be achieved in several ways, but two of the most common and
easiest to scale are:
Using either option requires an understanding of how the shellcode decodes the payload within.
The first block of the served payload is the decoder routine, which is responsible for XOR decoding the
embedded PE. Immediately following the shellcode is a 32-bit XOR key that is used to decode both the
payload size and the payload. Immediately after the XOR key is a 32-bit XOR encoded payload size, which
is in turn followed by the variable-length, XOR encoded payload.
When observed in IDA Pro (a popular disassembler), we can see a call to the decoder function immediately
prior to the XOR key, with the encoded size and payload immediately following.
Figure 18 – IDA view of shellcode and other key components of the shellcode stager
This knowledge will prove useful later when we attempt to decode the payload.
Inspection of the decoder function reveals that it uses an output differential XOR routine to decode the
Beacon payload. The XOR key is initially used to decode the first DWORD of the payload, and then updated
to the value of the first decoded DWORD, which is then used to decode the second DWORD. This process
is repeated until the entire payload is fully decoded, which is determined by the decoded size DWORD.
35
Figure 19 - Output Differential XOR decode routine
Now we are aware of the structure of the shellcode payload served-up by the Team Server and how it
performs its decoding. We can develop some code to perform this statically, so that we can retrieve the
Beacon payload for further processing.
If a specified “call” pattern can be found, then we will have located the offset for the end of the decoder
routine. Once we know this offset, we can then determine the values for the XOR key and payload size
using their location relative to this offset. With the XOR key and payload size in hand, we can then perform
the output differential XOR decode process, thereby retrieving the encoded Beacon payload.
The final stage in processing is the extraction of the config from the Beacon itself. Locating the config
within a decoded Beacon can be performed quickly using known binary patterns commonly found in the
config. Cobalt Strike Beacon configs have a particular structure and are single-byte XOR encoded, which
causes the encoded config to have tell-tale patterns in its encoded form. The structure looks like this
(using Kaitai Struct):
Index is a WORD (2-byte) value starting at offset 0x0 and is effectively the Setting ID number. The fieldtype
is also a WORD, with three possible values:
The value of fieldtype informs us of how to parse the fieldvalue. The fieldlength is also a 2-byte value
indicating the length of the following data in the fieldvalue.
XOR encoding such a rigid collection of structures is highly susceptible to cryptanalysis, causing patterns
to emerge in the encoded data. This is especially clear when those structures are XOR encoded using a
non-null preserving XOR encoding scheme.
37
Depending on the version of Cobalt Strike Team Server that generated and served the Beacon in question,
this will determine the pattern we need to search for. The default XOR key value is 0x69 for versions prior
to version 4, and 0x2e from version 4 onwards.
It is rare to see Beacons that have strayed from these default XOR values, but it can and does happen. In
such cases, it would be necessary to brute force the XOR key value.
The first record in a Beacon’s config is the “Beacon Type” setting. The “Beacon Type” entry in the config has
an index of 0x1, fieldtype of 0x1, fieldlength of 0x2 and the fieldvalue varies depending on the Beacon Type.
This means that the first six bytes of the Beacon config remain static and have a hex value of \x00\x01\
x00\x01\x00\x02. When this is encoded using XOR with a key of 0x69 or 0x2e, we end up with two possible
output patterns to search for in order to locate the start of a config block. These are \x2e\x2f\x2e\x2f\
x2e\x2c and \x69\x68\x69\x68\x69\x6b.
If we find such a pattern, we will simultaneously know where the config starts as well as the value of the
XOR key used in its encoding. Incidentally, this is also a useful “quick ‘n dirty” means of distinguishing
between versions 3.x and 4.x of Cobalt Strike.
If neither pattern is discovered, then we might be looking at one of the rare Beacons using a non-default
XOR key. But we can still apply the same methodology in order to locate the encoded config by rotating
through all possible single-byte XOR key values until a matching pattern is found.
Now that we can find the config within a decoded Beacon and have awareness of the XOR key as well as
an understanding of the structure of each setting in the config, we can automate the final step of extracting
the configuration. Once the configuration is parsed and dumped, we can store the results in a database
for further analysis. SQLite is more than adequate for this purpose, but an ELK (Elasticsearch, Logstash,
and Kibana) stack works well, too. It all depends on what best serves your needs and fits with existing
services and solutions.
Several Beacon config parsers are available and in common use by the security community. Here’s a helpful
and informative blog post about building a parser using Kaitai Struct.
Justin Warner
Using Kaitai Struct to Parse Cobalt Strike Beacon Configs
https://sixdub.medium.com/using-kaitai-to-parse-cobalt-strike-beacon-configs-f5f0552d5a6e
38
automating the hunt for cobalt strike
Now that we have defined our data sources, pillaged some Team Servers for shellcode and Beacons, and
extracted their configs, we need to consolidate everything into an automated workflow.
This automation can serve the needs of key stakeholders across all XDR products and services.
Data collected from multiple sources will be passed through a validation process to provide a confidence
rating based on several criteria, such as:
Once evaluated and scored, the data can be stored, disseminated, and acted upon as required. If necessary,
this data could also be made accessible using an API so that it can be easily leveraged in future automa-
tion endeavors. When performed at scale, and over a long period of time, the resulting dataset can offer a
wealth of information that can be used to bolster defenses, prevent breaches, and enhance intelligence.
But before we delve into the dataset closely, it’s worth spending a moment familiarizing ourselves with
Beacon’s configuration and “Malleable C2 profiles”, so we can take stock of some of the data we have to
play with.
39
chapter three
WE ARE BEACON
As you’re gathering data, it’s important to understand one aspect of Cobalt Strike functionality, as it
makes a big difference in our ability to create clusters. Cobalt Strike Beacons are highly configurable
through their use of Malleable profiles, which offer an unusual opportunity for both defenders and threat
actors.
Malleable profiles specify how a Beacon acts and looks in the target environment. These profiles also
specify what parameters are to be used within their communication protocol, and even the method that
Beacon uses to inject into other processes.
Malleable profiles use their own “profile language” that allows the attacker to state individual Beacon
parameters. It also enables attackers to craft a bespoke binary so that they can remain undetected by
security solutions and blend in with existing activity on the endpoint.
Cobalt Strike uses the phrase “Malleable C2” as an umbrella term, but it describes more than just com-
munications settings. The highly configurable and malleable nature of Cobalt Strike can be broken down
into several sections:
• Malleable C2:
• General settings
• HTTP stager options
• HTTP GET/POST request metadata
• HTTPS certificates
• Malleable PE:
• Process injection
• Post exploitation
Before we delve into the nuts and bolts of Malleable profiles, it’s probably best to introduce some termi-
nology around “stagers” first.
A Cobalt Strike Beacon can be either served by a payload stager or deployed directly in the form of a
so-called “stageless package”.
A stager is a small executable that will download the Beacon payload DLL from a remote Team Server.
The executable consists of a simple routine that uses Windows® APIs to pull down the payload and run
it directly from memory.
The downloaded Beacon binary starts with a small shellcode stub that is placed at the beginning of its
DOS header. The shellcode executes the ReflectiveLoader (or renamed) export, which in turn loads the
Beacon DLL into memory and executes it.
40
There are several types of Cobalt Strike stagers working over different protocols, the most common
being:
• HTTP/HTTPS stagers that simply download a Beacon payload using the InternetReadFile API
• DNS stagers that use the DNSQuery_A API to read a Beacon payload from DNS TXT record
responses
• CP/Bind stagers that connect to the specified IP address using raw sockets and read a
Beacon payload directly over the socket
• SMB stagers that read a Beacon payload locally through a Windows named pipe
Conversely, stageless payloads do not rely on any network/inter-process communication to pull down a
Beacon payload. Instead, the Beacon DLL is obfuscated and embedded inside the initial shellcode. The
shellcode then decrypts the DLL and executes the code in its header, which in turn reflectively injects
the DLL into memory.
malleable c2
The Malleable C2 section of the profile refers specifically to the definition of the communication pro-
tocol used between the Beacon and the Team Server. In the Malleable C2 language, each section is
referred to as a “block,” which delineates the grouping of parameters to be set within each section.
The following examples of these blocks have been taken from the “jquery-c2.3.14.profile” Malleable C2
profile.
Cobalt Strike
Malleable Command and Control
https://www.cobaltstrike.com/help-malleable-c2
Threat Express
malleable-c2/jquery-c2.3.14.profile
https://github.com/threatexpress/malleable-c2/blob/master/jquery-c2.3.14.profile
General
These are general options that define operational settings for the Beacon’s C2 communication such as
useragent, tcp_port, pipename etc.
41
HTTP-Config
The http-config block is a server-side block that defines the served HTTP response headers, as well as
which user-agents are allowed or blocked when specified by clients in their HTTP request headers. If the
user-agent is blocked, the requestor will receive a 404 error.
If the server is behind an HTTP redirector, the trust_x_forwarder_for parameter can be set. However, both
this option and the user-agent permission modifier are not used within the following example.
HTTP-Stager
The http-stager block defines the parameters used within the HTTP staging process for the Beacon
binary itself. These are used to retrieve the Beacon binary from the Team Server. The http-get and http-
post blocks aren’t used until the Beacon has been loaded into memory on the victim machine. While not
shown here, a nested server block can also be specified for server-side configuration. We have chosen
to omit the server block from the subsequent examples, as they are not as relevant to the configuration
extraction as the client block.
HTTP-GET
The http-get block defines both server-side and client-side parameters such as the URI to be used in
facilitating GET requests. In the following example a nested client block then holds client-specific GET
request modifiers, such as header fields and encoding. This block and the subsequent http-post block in
the next example also have client/server agnostic parameters, as well as the nested blocks.
42
Figure 26 – Example HTTP GET options
HTTP-POST
Like the http-get block, the http-post block defines the parameters to be used in sending POST requests.
The id block specifies the parameter to be appended to the POST request URI and the output block
determines how the data is encoded.
43
HTTPS-Certificate
The https-certificate block enables the operator to fully customize the certificate that they use for Cobalt
Strike C2 communications. Three scenarios are possible when encrypting the communication:
• Use a trusted and signed certificate stored within a Java Keystore file
• Create your own self-signed certificate
• Specify values to be used with the default Cobalt Strike self-signed certificate
malleable pe
While the section on Malleable C2 deals with the communication between Team Server and Beacon, the
Malleable PE section defines the in-memory characteristics and non-network-related behaviors of the
Beacon payload on a victim’s machine.
Stage
The stage block is largely responsible for the physical attributes of a Beacon binary. Various parameters
can be toggled to enable different methods of detection evasion, such as the stomppe, obfuscate and
sleep_mask boolean operators.
Other values such as compile_time, and rich_header can help in further obfuscating the binary by alter-
ing attributes that researchers might use to identify or track the actor.
Of special note are the transform-x86 and transform-x64 blocks, which allow for further modification of
the Beacon’s injection stage using three operators: prepend, append and strrep, depending on the target
architecture of the Beacon.
As the name suggests, prepend is used to prepend bytes to this stage, append to append, and strrep to
replace or remove default strings (for example, null out the beacon.dll module name).
In the example below we can see several bytes being prepended. This is in fact a NOP sled.
44
Figure 29 – Example Beacon stager options
Cobalt Strike
PE and Memory Indicators
https://www.cobaltstrike.com/help-malleable-postex#memory
Process Injection
The process-inject block is responsible for the parameters used to facilitate process injection. This in-
cludes the technique to be used to allocate memory and the allocation size, among others. Like the
stage block, the transform-* blocks are used to pad and transform the injected data.
Lastly, an execute block is used to specify the methods by which the Beacon will inject into a process.
You can specify multiple values here and they will be tried if previous values fail. As the documentation
says, the execute options must cover all “corner-cases” such as self-injection, or cross-session remote
process injection. With this said, we will see these parameters when extracting the configuration from
the binary.
45
Figure 30 – Example Process injection options
Cobalt Strike
Process Injection
https://www.cobaltstrike.com/help-malleable-postex#processinject
Post Exploitation
The spawnto options are used by Beacon to control which process it will spawn and inject certain pay-
loads into. Several payloads, such as screenshots, keyloggers, and hash dumping are implemented as
Windows DLLs. Because of this, they require a target process to be injected into in order to execute.
The spawnto paths must be the full path to the target process, although environment variables are
accepted, and special keywords, syswow64 (x86) and sysnative (x64) are resolved by Beacon to their
respective paths, depending on architecture.
46
In addition, it is also possible to supply settings to configure output pipe names, perform “smart” injec-
tion, enable/disable AMSI (the Windows Antimalware Scan Interface), and obfuscate post-exploitation
payload DLLs.
Cobalt Strike
Post Exploitation Jobs
https://www.cobaltstrike.com/help-malleable-postex#postex
You can see an example of some of the settings that can be extracted from a Beacon below. Depending
on the configuration and version of Cobalt Strike, not all settings will be present or populated. We’ve
included the most popular values observed across our dataset for reference purposes:
47
7 PUBKEY_MD5 STRING MD5 hash of SSL e9ae865f5ce035176457188409f6020a,
public key used for …
metadata encryption
whenever a Beacon
checks-in.
48
17 DEPRECAT- INT Date after which Bea- 0
ED_KILLDATE_ con will refuse to run
MONTH – Month component.
49
30 SPAWNTO_ STRING The 64-bit program %windir%\sysnative\rundll32.exe
X64 that the Beacon will
inject DLL payloads
into.
35 PROXY_BE- SHORT Proxy behavior setting. Use IE settings, Use direct connection,
HAVIOR Use Proxy Server
50
44 PROCINJ_ SHORT Final permissions for PAGE_EXECUTE_READWRITE
PERMS injected content.
51
57 SMB_FRAME_ STRING Header to prepend to Prepend: b’\x04’
HEADER SMB messages. Prepend: b’\x05\x80’
Prepend: b’\x07\x80\x80\x80’
Table 2 – Cobalt Strike Beacon configuration structure showing common default values
52
detecting the beacon configuration with yara
The following YARA rule can be used to detect the XOR encoded configuration used by Cobalt Strike
Beacon stagers based on commonly observed values. The rule is optimized to first check for one of the
common XOR encoded configuration headers in the .data section, before checking the .data section for
various XOR encoded strings commonly found in Beacon profiles.
Figure 32 – YARA rule for detecting Cobalt Strike Beacon XOR encoded configurations in PE files
The rule will detect more than 99.9% of the Beacons DLL payloads we’ve encountered. It typically only
fails on payloads that have been manually reconfigured to use non-standard XOR keys or those that use
a very sparse configuration.
53
chapter four
WE CAN’T STOP HERE,
THIS IS BEACON COUNTRY
Armed with a dataset comprising information from over 6,000 Team Servers, as well as the configuration and
PE stager data from nearly 48,000 Beacons, we can begin to perform the analysis phase of the CTI lifecycle.
The initial analysis we performed on the dataset focused on clustering information based on several unique
indicators. This clustering can help us spot patterns regarding a variety of different features such as:
These insights can prove invaluable for fine-tuning the alerting capabilities of XDR products and services.
They can also help you to build profiles on new threat actors and correlate intelligence about known groups
and campaigns.
During the manual analysis phase, we also made several previously undocumented discoveries concerning
Beacon configuration settings that can be particularly useful for tracking and monitoring threat groups.
Let’s delve more closely into the Malleable C2, post exploitation, and stager settings to see what insights
we can glean from such a comprehensive dataset of Beacons.
constellating
Analyzing Beacon configuration data can give great insight into the various Cobalt Strike configuration
possibilities and the frequency with which each configuration value occurs. As mentioned, this data is
excellent for the tuning of security products. It can also be hugely beneficial in a SOC environment to
augment and improve upon existing incident alerting and detection mechanisms.
To further enhance our clustering capabilities, we can perform some deep visual analysis of the config-
uration data. This can help us see patterns that are only visible when we have access to a lot of data. For
example, simply by extracting and correlating the C2SERVER setting, we can see clusters of Cobalt Strike
networks emerge that would not ordinarily be apparent. We colloquially refer to these as “constellations”
due to their resemblance to stars in the night sky.
54
Figure 33 – Clustering Infrastructure based on the extracted C2SERVER setting
In the visualization above, each luminous speck (or star in a constellation!) is an IP or domain that has
either served a Beacon or is acting as a C2 server for a Beacon. To create the connections between
nodes, we track the IP or domain that has served a particular Beacon and then link it to the infrastruc-
ture dictated by the C2SERVER setting.
When we create connections within a larger dataset, we can start to see clear patterns emerge. Infra-
structure that seemed disparate begins to form relationships, or it will overlap with known infrastructure
from threat groups and active campaigns. This also aids attribution, as we only need to identify “a single
star in the night sky” (via an IP address or configuration setting) to map the entire constellation (that is
to say, a threat group).
Finally, it is worth noting that some of the largest clusters are likely due to custom Network Address
Translation (NAT) or routing configurations, rather than being a cluster of individual Cobalt Strike Team
Servers, making some of the constellations appear larger than they might be in reality.
networking
The information gained through scraping the Internet for Beacons helps to paint a clearer picture of the
Cobalt Strike topography. This includes a variety of features, from popular hosting netblocks and Auton-
omous System Numbers (ASNs), to common ports, domain fronting and default certificates.
Let’s dive in and take a look at some of the most common networking trends.
55
netblocks
Looking at the ASNs for the 6,000+ Team Server IP addresses in our dataset, we can easily determine
which netblocks are primarily responsible for Team Server deployments:
This reveals an interesting trend: Threat actors are increasingly likely to use legitimate cloud providers
for hosting. This allows the malware operators to conceal their traffic from monitoring systems, which
makes the task of automated blocking trickier. This is especially problematic because several large and
reputable companies are firmly in the top 20 list of providers:
ASN Country
AS-CHOOPA US
AMAZON-02 US
DIGITALOCEAN-ASN US
IT7NET CA
HOSTKEY-AS NL
56
BCPL-SG BGPNET Global ASN SG
GOOGLE US
PINDC-AS RU
ASN-QUADRANET-GLOBAL US
ITLDC-NL UA
AS-COLOCROSSING US
SELECTEL-MSK RU
The popularity of individual netblocks hosting Cobalt Strike Team Server is perhaps most helpful for
alerting and monitoring purposes. Often, Team Server is hosted on an IP range used solely for nefarious
purposes, and these ranges can be blocked directly by security software and appliances, as well as used
to conduct further hunting, monitoring and alert correlation:
57
We can see which countries have been responsible for hosting most of the Cobalt Strike servers over
the past eight months by performing an IP geolocation lookup for each of the Team Server IP addresses
in our dataset and correlating them with last seen date:
ports:
Cobalt Strike Beacons are typically served on standard HTTP/S ports. Over two-thirds of Team Servers
are configured to serve Beacons using ports 80, 443, and 8080:
58
This information can prove useful in the automation phase, especially when presented with a suspected
Team Server IP address with no port information (this is a fairly common occurrence when scraping
blogs and OSINT sources). In this instance, it is at least possible to try knocking on the top 25 common
ports to see if the Team Server can be pillaged for Beacons. Nearly 90% of the time this results in suc-
cess.
certificates
As mentioned, for Beacons served over HTTPS, the attackers will configure an SSL certificate that the
Team Server uses to perform encryption. SSL certificates are often reused across network infrastruc-
ture, and this can provide a reliable means of grouping Beacons for hunting, alerting, and investigative
purposes.
Although not frequently supplied, common certificate names from across our dataset include:
59
Delving deeper, one particular SSL certificate, with a serial number of 146473198, is especially wide-
spread and used to serve 11% of all Beacons in our dataset. Searching for the certificate serial number
on Shodan uncovers a further 677 IP addresses (not all active) using this “default”, Cobalt Strike-affili-
ated HTTPS certificate:
Based on historical IP analysis, this SSL certificate has been associated with at least 9,000 Cobalt Strike
Team Server deployments over time. Why anyone deploying Team Server – whether they’re a red-team-
er or threat actor – would use the default certificate is somewhat of a mystery. It is easy to detect and,
as we’ve already demonstrated, this can be a very powerful mechanism for discovering active Team
Servers on the Internet.
Finally, the top 10 certificates from our dataset were used to serve over 12% of all Beacons, but the
default is by far the most widespread:
60
Figure 40 - Top 10 certificate serials
configuration
The following sections will focus on the configuration data contained within Beacon payloads. We will
be honing in on many of the options that are specified by the attackers via Malleable C2 profiles, as
well as some of the lesser-known options (such as SSL public keys and stager options) that have been
recovered from Beacon PE files.
By performing further analysis of our Beacon dataset, it was possible to find the various profiles used
to configure Beacons. To do this, we first obtained as many Malleable C2 profiles as we could get our
hands on. Then we built an add-on for our automation system that checks for similarities with various
configuration values within Beacon payloads.
By using an algorithm called “hamming distance,” it is possible to compare two strings and determine
how many times someone would need to edit them (or make substitutions) to make the strings identi-
cal. The resulting number of edits or substitutions is called the “edit distance.”
Based on that computed edit distance, we can then decide how similar to known profiles the HTTP and
GET request metadata is, and whether the metadata has been modified from the base profile. This can
be yet another helpful approach for tracking threat actors.
In addition, values from the “stage” section of the Malleable C2 profile (such as the compile time and rich
header) are compared to those in the Beacon PE files we’ve obtained, to determine if a known stager
profile was used. This is worth checking closely, as it is entirely possible for threat actors to mix and
match config blocks. And again, this can be a useful indicator for campaign tracking purposes.
Across our dataset, we’ve observed the following profiles, based on HTTP GET/POST metadata and
stager compile times and rich headers:
61
Common Malleable Profile Configuration Values
62
Figure 43 - Profiles by HTTP POST request meta:
63
watermark
Each Cobalt Strike build is shipped with a watermark value that is unique per customer/license. In the-
ory, this should offer the perfect mechanism for tracking threat actors who deploy Cobalt Strike Team
Servers in the wild.
Unfortunately, the watermark value is easily spoofed, and there are many trial, cracked, and leaked cop-
ies of Cobalt Strike that are easy to acquire. This means that the watermark value can often be a poor
choice for performing attribution or classification of major threat groups.
On the other hand, this watermark can be useful for tracking red teams. Legitimate penetration testers
have less incentive to go to extra lengths to obfuscate their Beacon payloads or to perform advanced
network operational security (OPSEC) for their Team Server deployments. Therefore, watermark values
with a lower frequency tend to be more indicative of red team activity.
Below is the breakdown of the most common watermark values observed in our dataset:
We have tried our best, given the opportunities for spoofing and reuse, to map watermark values to
known threat actor groups. However, because so many of these groups use the same build (either
accidentally or on purpose), it highlights how ineffective it can be to cluster around watermarks alone:
0 0 Trial/Leaked/Spoofed Many
64
3 3 Spoofed Cobalt Group
1 1 Spoofed Finspy
Unlike watermarks, the SSL public key stored within a Beacon’s configuration offers a fantastic means
of clustering Beacons. We can virtually guarantee that the key is unique per Team Server installation,
but they often do get reused, for example via virtual machine redeployments. In other instances, threat
actors will use a single Team Server to configure payloads for deployment from other servers within
their control. This allows us to easily spot, then subsequently track and monitor their infrastructure.
Overall, 37% of Beacons are supplied with the top five SSL public keys. Several of the most popular keys
belong to notorious threat groups.
65
Figure 46 –Top 10 SSL public key MD5s since January 2021
When you’re presented with a Beacon IP that is gathered from an IR engagement, or harvested from
OSINT feeds, it is usually possible to locate several more Beacons sharing the same SSL public key. This
can yield further IP addresses and intelligence pertaining to infrastructure that might otherwise seem
to be unrelated.
We have found that leveraging this clustering technique has been very helpful for us in expanding our
intelligence of C2 infrastructure. It helped us find the connections between a wide range of actors and
campaigns, both active and historical. It can also help you to build a high level of confidence in your own
intelligence assessments.
Several popular SSL public keys used by known threat groups include:
b3e6b9dd84dae6be68cb40cda4366b77 23 APT41
66
Figure 47 –Top 10 SSL public key MD5s
The vast majority of SSL public keys extracted from configurations cluster with one or more Beacons
from our dataset. Again, this further highlights the great potential for clustering and tracking.
beacon type
If you look at the most common communications protocols employed by the Beacons we’ve seen host-
ed on the Internet – plus some others we’ve obtained through other channels such as IRs and hunting
– you’ll see no huge surprises:
67
As expected, HTTP is by far the most common protocol (93%). The next most common are HTTPS
(3.9%), and a hybrid mixture of HTTP and DNS (2.2%). This leaves SMB, TCP, and Bind TCP Beacons,
which combined account for less than 0.1% of all payloads.
SMB Beacons are almost certainly underrepresented in our dataset, as they tend to be more commonly
staged within local networks for further lateral movement, and not publicly hosted on the Internet.
As a result, the bulk of the SMB stagers in our dataset came from incident response investigations and
online malware repositories.
Type Description
windows/beacon_http/reverse_http HTTP
windows/beacon_https/reverse_https HTTPS
windows/beacon_dns/reverse_dns_txt DNS
windows/beacon_bind_pipe SMB
windows/beacon_bind_tcp TCP
windows/beacon_extc2 External C2
C2SERVER
A closer inspection of the C2SERVER configuration values is quite revealing. It shows us that attackers
increasingly prefer to use domain fronting. This is a technique that allows an attacker to route Beacon
C2 traffic via reputable third-party redirectors, in a way that typically makes use of highly trusted Con-
tent Delivery Networks (CDNs). The traffic is encrypted over HTTPS, and it is often indiscernible from
legitimate communications.
68
Figure 49 – Popular fronting domains since January 2021
Approximately 3.5% of all Beacons in our dataset were configured to use domain fronting. The bulk of
Beacons are configured to use either Softline or Tencent. AWS, CloudFront® and Microsoft® Azure®
are also popular reputable redirectors favored by threat actors, with Google services previously being
targeted, as reported by Domain Tools.
DomainTools
COVID-19 Phishing With a Side of Cobalt Strike
https://www.domaintools.com/resources/blog/covid-19-phishing-with-a-side-of-cobalt-strike
Beacons configured to operate using domain fronting may be considerably harder for SOC analysts and
incident responders to identify. Because the network traffic appears to be legitimate, these Beacons
tend to lack obvious network-based IOCs, making detection of Beacon traffic at the network perimeter
more challenging for defenders.
Cobalt Strike
High-reputation Redirectors and Domain Fronting
https://blog.cobaltstrike.com/2017/02/06/high-reputation-redirectors-and-domain-fronting/
69
http
For HTTP-based communications, each Beacon is configured with a user-agent string that is used to
form part of the HTTP request headers sent to the Team Server. The user-agent strings are nearly
always “spoofed,” with the default option used to specify a randomly selected Internet Explorer 11 us-
er-agent. It is important to note that it’s possible to specify alternatives via Malleable C2 profiles.
In many cases, the user-agent strings are not especially common. When combined with other indicators,
they can occasionally be useful in spotting suspicious activity via network monitoring tools. For exam-
ple, a macOS® X user-agent string originating from a Windows-based host, or Firefox® in a Chrome™
environment.
Looking at our dataset, we observed slightly more than 300 unique user-agent strings, with just over half
of them being used 10 or more times:
The SUBMITURI configuration option specifies the URI path to use when sending HTTP requests. De-
spite over 300 URIs being specified across our Beacon config dataset, the default path (/submit.php)
was by far the most popular.
GitHub
rsmudge - Malleable C2 Profiles
https://github.com/rsmudge/Malleable-C2-Profiles
Unsurprisingly, the default profile is the most prominent, with just shy of 80% of Beacons specifying
nothing more than “Cookie” in the HTTP GET request metadata. A further 3.2% of Beacons use an
unmodified amazon.profile. The remaining profiles each account for less than 1% of the total set of
Beacons.
The host header used in HTTP GET and POST requests is also configurable as part of the Malleable C2
profile. As with many settings, the values are often spoofed, and they differ from the actual hostname
that the Team Server IP will resolve to. This can be a semi-reliable method for detecting Beacon net-
work traffic, as well as for detecting domain fronting, where the host header is different from that of the
C2SERVER setting.
71
Figure 53 – “Common” HTTP hostnames
proxy
Cobalt Strike Beacon can be manually configured to operate via a proxy server, although it doesn’t seem
to be a particularly popular option. Less than 0.05% of the samples from our dataset were configured
to do so using a username/password. A further 0.3% of samples were configured to use a direct con-
nection to the Internet (without a proxy), while the remainder of the samples will use the default IE proxy
settings.
72
Figure 55 – Proxy behavior
It seems likely that most Beacons configured to use a proxy server are deployed by red teams. Threat
groups tend to use other proxying and tunnelling mechanisms for routing their C2 traffic, such as
SOCKS5 proxies and SSL port forwarding.
smb
SMB Beacons (windows/beacon_smb) use an SMB pipe name embedded within the Beacon configura-
tion in order to enable C2 communication with a named pipe server using the Windows SMB protocol.
Cobalt Strike
SMB Beacon
https://www.cobaltstrike.com/help-smb-beacon
73
The following list of SMB pipe names should be viewed with a soupçon of distrust, as most of them
have been harvested from Beacons that were served by Team Servers that were hosted on the Internet.
This is not typically how SMB Beacons are deployed. They are typically distributed via shellcode stagers
instead and are used to perform further lateral movement within a compromised network. Therefore,
the results from our dataset certainly do not convey the full picture, with only 2.7% of Beacons contain-
ing pipe names:
Other common pipe names frequently employed by Beacons that we’ve encountered elsewhere include
(where # represents a random base 10 digit):
\\.\pipe\MSSE-###-server Default
\\.\pipe\status_## Default
\\.\pipe\postex_#### Default
\\.\pipe\mypipe-h## havex.profile
\\.\pipe\mypipe-f## havex.profile
\\.\pipe\interprocess_## gmail.profile
\\.\pipe\ntsvcs Many
\\.\pipe\scerpc Many
\\.\pipe\DserNamePipe## Many
\\.\pipe\PGMessagePipe## Many
\\.\pipe\MsFteWds## Many
74
\\.\pipe\f4c3## zillow.profile
\\.\pipe\f53f## zillow.profile
\\.\pipe\windows.update.manager## windows-updates.profile
\\.\pipe\windows.update.manager### windows-updates.profile
\\.\pipe\Winsock2\CatalogChangeListener-###-0, jquery-c2.4.2.profile
\\.\pipe\browser_## malleable-c2-randomizer.py
\\.\pipe\comnode_## malleable-c2-randomizer.py
\\.\pipe\spoolss_## malleable-c2-randomizer.py
\\.\pipe\llsrpc_## malleable-c2-randomizer.py
\\.\pipe\comnap_## malleable-c2-randomizer.py
dns
In April 2021, F-Secure published research into Cobalt Strike DNS redirectors, where they presented
methods for fingerprinting Team Servers based on DNS responses.
F-Secure
Detecting Exposed Cobalt Strike DNS Redirectors
https://labs.f-secure.com/blog/detecting-exposed-cobalt-strike-dns-redirectors/
We can see from the configuration dataset that 68% of Beacons are configured to use 0.0.0.0 as the
DNS idle IP. As mentioned by F-Secure’s researchers, the 0.0.0.0 DNS idle value is the default, and should
not be used in production environments. As a result, we can probe DNS servers for 0.0.0.0 responses
in A records, which can be used as another reliable mechanism for identifying Team Severs in the wild.
With approximately 25% of Beacons specifying no DNS idle value at all, the remaining 7% of Beacons
are often configured to use DNS from major providers, including:
• 8.8.4.4 (Google)
• 8.8.8.8 (Google)
• 114.114.114.114 (China Telecom)
• 1.1.1.1 (CloudFlare)
75
Figure 57 – DNS idle IP addresses
This information can be helpful for monitoring DNS requests at network egress points for signs of
Beacon DNS activity, as well as during forensic investigations involving DNS C2 traffic from in-memory
payloads.
injection
The SPAWNTO option is used to configure the target process that Cobalt Strike will spawn and inject
post-exploitation DLL payloads into (in response to certain commands, such as screenshot, keylogger
and hashdump). Different target processes are specified depending on processor architecture (x86/
x64), although the default process, rundll32.exe, is by far the most popular:
76
The list of target injection processes for x64 is largely identical to x86, apart from the differences in the
fully qualified file paths:
Combining the file names used for both the x86 and x64 SPAWNTO values provides a full overview of the
processes most frequently targeted for injection. This helps us to narrow the focus for tuning security
software and forensic analysis:
rundll32.exe 94.53%
gpupdate.exe 2.11%
dllhost.exe 0.80%
wusa.exe 0.32%
mstsc.exe 0.28%
WerFault.exe 0.25%
mavinject.exe 0.13%
openfiles.exe 0.11%
explorer.exe 0.09%
iexplore.exe 0.09%
When allocating memory for the shellcode payload, the Windows API VirtualAllocEx is most commonly
used, although around 3% of Beacons will use NtMapViewOfSection with a file mapping instead.
However, roughly 5% of Beacons are configured to use transformations. These will append/prepend
additional code (typically a simple NOP sled, although sometimes it will be something more
78
adventurous) to the injection shellcode stub to prevent detection. It is also possible to remove the write
flag from the page protections, so it is important to note that in the end not all Beacon payloads will
necessarily reside in RWX memory (4%).
compilation timestamps
There is some advantage in knowing the compilation date/timestamps of Cobalt Strike Beacons, even
though they are often spoofed via the stager configuration, or simply zeroed out (which accounts for
nearly 3.5% of Beacons). When the value is left unmodified, it can provide a quick and simple way for
researchers to determine the version of Beacon/Team Server in operation:
79
Release Date Version Timestamps
As we can see from our dataset, of the beacons that have their timestamps unmodified, over 40% of
Beacons are version 4.0. Version 4.2 is gaining in popularity at 14%, which is just slightly above version
4.1 at 13%. Version 4.3 is slowly gaining traction at around 6% usage. The use of version 3.x Beacons
has tailed off quite dramatically in recent months.
80
Figure 64 – Top 10 compilation timestamps
When specified via the stager configuration, the compilation timestamp can be most revealing due to a
time zone conversion bug in Team Server.
The server appears to interpret the compile_time configuration value as a local time before converting
it to UTC for storing in the Beacon PE header. The result is that any Beacon built using a compile_time
value specified in the stager configuration will leak the time zone offset of the server. This gives us yet
more forensically sound evidence that we can use to correlate with incident events and IP geolocations
to try and pinpoint the location of attackers.
81
Figure 65 –Stager time zone offsets and their respective frequencies
rich headers
The rich header, or signature, is embedded within the DOS stub of a PE file. It contains information
pertaining to the executable linker, including the count of various sources and the version of the tools
used to compile them. For example, here is a typical rich header from a Beacon DLL viewed in PE Tree.
The header indicates that Visual Studio® 2012 was used to compile and link 53 object files and a single
exported function:
82
The top 12 rich headers observed in our set of Beacon PE files account for nearly 90% of all payloads:
The rich headers can be specified via the stager profile settings, or simply left unaltered in the original
Beacon PE files. For this reason, they can provide malware researchers with a semi-reliable mechanism
for hunting, clustering and classifying Beacon payloads within malware datasets. They can also provide
forensic investigators with helpful signatures for finding in-memory payloads.
GitHub
PE Tree
https://github.com/blackberry/pe_tree
import hashes
An import hash, commonly known as an “imphash,” is a checksum that is calculated from the DLL
and function names that are present in a PE file’s import descriptor. Often unique per malware family/
variant, imphashing can be an excellent technique for clustering malicious PE files based on similarity.
83
Figure 68 – Import descriptor showing wininet.dll imports from a Beacon PE file
From our Beacon dataset, we can see that the top 12 import hashes calculated from Beacon DLL files
belong to just over 90% of all payloads:
Again, much like the rich header, knowing Cobalt Strike’s associated imphashes can be a useful tool for
malware analysts and researchers with respect to hunting, clustering and classifying Beacons.
84
export names
The exported module and function name within a Beacon PE file are referenced by the export descriptor.
This contains either the default Beacon DLL name (beacon.dll or beacon_x64.dll) and exported function
name (ReflectiveLoader@1), or values specified by the attacker via a transform block in the “stage”
section of the Malleable profile.
Containing just a solitary exported function, the export descriptor for an x86 Beacon DLL typically looks
like this:
Note time TimeDateStamp in the IMAGE_EXPORT_DESCRIPTOR. This is often overlooked when adver-
saries perform time-stomping of the TimeDateStamp in the PE file header, especially in Beacon DLLs.
The net result is that the original compilation time is often still in the export descriptor, even if it has
been overwritten in the PE headers. In this instance the TimeDateStamp is known to belong to Cobalt
Strike version 4.0
In total, the top 13 exported module names from across our dataset account for nearly 97% of all Bea-
con PE files we’ve obtained:
85
Figure 71 – Top 10 exported module names
• pivot.dll
• pivot.x64.dll
• dnsb.dll
• dnsb.x64.dll
This knowledge can aid in the tuning of security solutions as well as assisting forensic investigators
when inspecting in-memory Beacon payloads.
procinj_stub
Surprisingly, it just so happens that the configuration setting PROCINJ_STUB is somewhat of a mis-
nomer. This setting has absolutely nothing to do with process injection or shellcode stubs. In fact, this
unintuitively named configuration value actually contains an MD5 hash of the Cobalt Strike Java archive
(cobaltstrike.jar). This archive contains the server-side component that provides the Team Server oper-
ators with a GUI to generate, operate, deploy, and control Beacon payloads.
When correlated with its corresponding Java archive commonly found in online malware repositories,
such as VirusTotal, the MD5 hash of the cobaltstrike.jar package allows us to determine not only the
exact version of the Team Server in use, but also whether the Team Server in operation is a leaked,
cracked, trial or even a private version. Even if the Java archive is unavailable to assist with version
identification, it is still an extremely valuable clustering mechanism, especially in the case of private and
customized builds.
As a comparison, the SSL public key allows us to cluster Beacons generated by a single Team Server
installation, while conversely, the “process injection stub” hash allows us to cluster Beacons generated
on any server running the same cobaltstrike.jar Java application. Even if the threat actor is aware of this
hash, they are extremely unlikely to modify the cobaltstrike.jar Team Server archive between generating
Beacons. This means that the hash is highly likely to remain constant.
Given that each cobaltstrike.jar is theoretically unique per version, per “customer” (accepting leaked
versions), this gives us the confidence to cluster Beacons not only from seemingly unrelated attacks
but also from seemingly disparate Team Servers. That is assuming that the operators reuse the same
cobaltstrike.jar application, which is a strong possibility within threat groups.
86
A point to note is that if a threat actor is aware of this secret hashing mechanism, then the value can be
spoofed without impairing the functionality of the Beacon. This is unlike SSL public keys, where it would
break C2 functionality if someone were to tamper with them.
In theory, these MD5s are not an entirely infallible pivot for performing clustering and attribution. How-
ever, in practice they are rarely tampered with, and they routinely yield invaluable information and intel-
ligence.
Eight out of the top 10 most popular Cobalt Strike hashes belong to leaked builds and can be found on
VirusTotal. The remaining two hash values are nulled out, with one known to convey a 0-byte string/file,
which suggests that there is either a bug in Team Server, or perhaps certain operators might have some
awareness of this secret hashing mechanism.
Currently, threat actors running leaked copies of Cobalt Strike appear to be favoring versions 4.0 to 4.3,
although a recent build of 4.4 from August 2021 seems to be gaining popularity among several distinct
groups.
1. Why add the hash of the Cobalt Strike Java package archive to the config of a Beacon at all?
2. Was this a purposeful choice by the developers?
3. What other Easter eggs, either accidental or deliberate, have the developers left lurking in
Team Server?
87
If this was done on purpose, then it might have been to track or differentiate between licensed custom-
ers and those using unlicensed or cracked copies of Cobalt Strike. But this is pure speculation. We’ll
leave you, dear reader, to draw your own conclusions.
The top PROCINJ_STUB hashes reveal just how prevalent leaked, cracked, and trial builds of Cobalt
Strike have become:
88
30aa21b939d29f3a2cf6a5c- 17a2ccec7b41b- 3.14
3038c328b 585d5a1239b12818d74d454b577db10b- (20190504)
2607d482311944e10e9 Licensed
deprecated_spawnto
Much like the PROCINJ_STUB setting, one could be forgiven for thinking that this setting contains the
target process name to inject to, and that it is now deprecated. After even a cursory glance at our data-
set, it appears as if this value contained a hex encoded executable name for the SPAWNTO setting at
some point in time. This is indicated by the value 72756e646c6c33322e657865, which is present in 76
of our Beacons:
89
In reality, this setting presents another mystery. Most of the values appear to be MD5s hashes, and not
the expected hex-encoded process names:
The plot thickens further, as two of the hashes appear on VirusTotal. They belong to a pair of text files
containing release notes for Cobalt Strike 3.12 and 3.13:
90
The DEPRECATED_SPAWNTO configuration value seems to have been misappropriated at some point
in time, much like the PROCINJ_STUB setting that we mentioned before, which was used to covertly
embed the hash of the Team Server Java archive into all Beacon configurations.
The DEPRECATED_SPAWNTO setting instead seems to surreptitiously embed the hash value of a file
located on the Team Server into the Beacon payload configuration. And like PROCINJ_STUB, the devel-
opers may well have intended it to be a crude tracking mechanism for monitoring Beacons deployed in
the wild. But, again, this is speculation.
miscellaneous
Finally, there are several Boolean options that can be specified to control the behavior of Cobalt Strike
Beacons. Although none of them are frequently set, it seems worth mentioning them for the sake of
completeness:
Now that we’ve looked at the various configuration values, cluster points and statistics, let’s take a look
at the data in practice.
91
chapter five
BEACON OF HOPE
intelligence correlation
We took a largely automated approach to performing intelligence correlation with OSINT, hunting for
many indicators from our Cobalt Strike dataset in our TIP. This was successful in linking clusters with
publicly documented threat actor infrastructure and uncovering further clusters for closer manual in-
spection.
We also spent (and continue to spend) many hours manually correlating OSINT with our dataset (e.g.,
searching IOCs on Twitter!) and pivoting on those findings to yield further indicators and intelligence.
In the end, we found correlations with dozens of major threat actors and campaigns, including some
familiar faces:
• DarkSide
• REvil/Sodin
• APT41
• CostaRicto/SombRAT
• KEGTAP & SINGLEMALT
• IcedID
• Ursnif
• WizardSpider
• Ryuk
• Conti
• TrickBot
• Nempty/Netfilim/Nephilim
• FIN7
• Maze
• DoppelPaymer
• MAN1/Moskal/TA505
• Nobelium/APT29
• Pyxie
• StrongPity
• MountLocker
• Phobos
92
Based on OSINT correlation, the following threat groups have been particularly prevalent in our dataset
over the past year or so:
Each Beacon tagged above is related to existing intelligence (whether private or OSINT) and offers us
the potential to perform further clustering on our dataset to uncover more intelligence insights and
correlations.
Given a wealth of superb OSINT, a vast dataset of Beacons, and strong clustering capabilities around all
the information harvested thus far, we aim to show the ease with which you can now unravel campaigns
from known threat actors.
The intelligence presented is by no means exhaustive. Several follow-up blogs and papers have been
published, or are already planned, based around some of the more intricate and elaborate discoveries.
It is worth mentioning how important an altruistic approach is, taken by many companies and individu-
als, in openly and freely sharing intelligence with the cybersecurity community. It would not have been
possible to compile such a comprehensive chapter on intelligence correlation without that, let alone
with so little effort.
Kudos to all the vendors and individuals mentioned herein. Your research has been invaluable and great-
ly appreciated!
93
apt41
APT41 (aka WINNTI, aka Barium) is a prolific Chinese state-sponsored cybercrime group. Active since
2012, and initially performing espionage and financially motivated attacks against prominent targets in
the computer game industry, they now reportedly focus on more state-aligned targets.
Where once the infamous PlugX malware was the remote access Trojan (RAT) of choice for APT41
operatives, Cobalt Strike is starting to gain in popularity in several recent campaigns, and we’ll explore
manual correlation techniques that you can use to elaborate on APT41’s Team Server infrastructure.
A blog post published by FireEye in March of 2020 explored APT41’s tactics, including their use of mali-
cious documents, exploits, and Cobalt Strike. The report indicated that the group was using a bespoke
Malleable C2 profile with at least one of its Cobalt Strike Beacons.
FireEye
This Is Not a Test: APT41 Initiates Global Intrusion Campaign Using Multiple Exploits
https://www.mandiant.com/resources/apt41-initiates-global-intrusion-campaign-using-multiple-
exploits
We uncovered a Malleable C2 profile on GitHub that is very similar to that of the one mentioned in the
FireEye blog. This one seems to have been authored by a Chinese security researcher with the pseud-
onym “1135.”
These profiles had several similarities: both used jQuery Malleable C2 profiles, and portions of the HTTP
GET profile block are almost identical. HTTP header fields such as accept, user-agent, host, and referrer,
as well as the set-uri field, were all exact matches to the profile data listed in the FireEye blog.
GitHub
Bootcss Malleable C2 Profile
https://github.com/1135/1135-CobaltStrike-ToolKit/blob/master/Malleable%20C2%20Files/jquery.
xxx.js_CN_cdn.bootcss.com_for_cs3.14_.txt
94
By extracting and correlating the HTTP headers used in the GET and POST requests defined in the
Beacon configs, we can generate revealing connections between previously disparate Cobalt Strike
infrastructure.
While we identified a relatively small number of Beacons using the bootcss[.]com domain as part of their
Malleable C2 configuration, there were also a few clusters with a unique SSL public key (b3e6b9dd84dae-
6be68cb40cda4366b77) that enabled us to identify additional beacons related to APT41.
95
The Beacons served by these new nodes are using different domain names to those from the original
cluster that attempt to make the Beacon traffic look like legitimate Microsoft traffic.
IP Domain
144.202.98[.]198 zalofilescdn[.]com
107.182.24[.]70 isbigfish[.]xyz
185.14.29[.]72 www[.]microsoftbooks.dns-dns[.]com
193.42.114[.]73 www[.]microsoftbooks.dns-dns[.]com
149.28.78[.]89 www[.]mlcrosoft[.]site
23.67.95[.]153 ns.mircosoftdoc[.]com
104.27.132[.]211 cdn.microsoftdocs.workers[.]dev
ccdn.microsoftdocs.workers[.]dev
The domains we found share similarities in their naming convention, which masquerade as a legitimate
Microsoft phishing domain www[.]mlcrosoft[.]site, both appear within a blog from Positive Technol-
ogies. Further hunting for the IP address 149.28.78[.]89 reveals links to a campaign referenced in a
Prevailion blog, “The Gh0st Remains the Same.”
The domain mlcrosoft[.]site also appears in a blog from Positive Technologies. That article has addition-
al overlapping IOCs and talks about the same campaign as mentioned in the Prevailion blog. However,
it makes a strong argument that the activity is from APT41, rather than Higaisa APT.
Prevalion
The Gh0st Remains the Same
https://www.prevailion.com/the-gh0st-remains-the-same-2/
Positive Technologies
Higaisa or Winnti? APT41 backdoors, old and new
https://www.ptsecurity.com/ww-en/analytics/pt-esc-threat-intelligence/higaisa-or-winnti-apt-41-
backdoors-old-and-new/
96
When we do a side-by-side comparison of the domains from the Positive Technologies blog and our
datasets, there is a strong similarity between naming conventions used:
www[.]microsoftbooks.dns-dns[.]com microsoftbooks.dynamic-dns[.]net
cdn.microsoftdocs.workers[.]dev microsoftdocs.dns05[.]com
ccdn.microsoftdocs.workers[.]dev ns.microsoftdocs.dns05[.]com
ns.mircosoftdoc[.]com ns1.microsoftsonline[.]net
We also discovered that mlcrosoft[.]site and mircosoftdoc[.]com both appear in the Azure-Sentinel de-
tection rule for known Barium phishing domains. The IP 144.202.98[.]198 has also been previously
associated with APT41/Barium by a Microsoft researcher.
GitHub
Azure-Sentinel – Detections – MultipleDataSources
https://github.com/Azure/Azure-Sentinel/blob/master/Detections/MultipleDataSources/
BariumDomainIOC112020.yaml
Ajeet Prakash
Hunting for Barium using Azure Sentinel
https://techcommunity.microsoft.com/t5/microsoft-sentinel-blog/hunting-for-barium-using-azure-
sentinel/ba-p/1875913
Another IP from this cluster, 185.14.29[.]72, was recently providing virtual hosting for several domain
names such as:
• chaindefend[.]bid
• defendchain[.]xyz
• assistcustody[.]xyz
• www[.]microsoftonlineupdate.dynamic-dns[.]net
Previously, this IP has been associated with DNS resolutions for schememicrosoft[.]com and www[.]
microsoftbooks.dns-dns[.]com. Several of the domains also have links to 209.99.40[.]222, an IP known
to perform malicious DNS/bulletproof hosting. As of Sept. 14, 2021, this IP resolved to a new domain
very briefly: Microsoftonlineupdate.dynamic-dns[.]net. This domain also conforms to a similar naming
convention to those we have seen previously in Table 13.
97
apac red teams
Aside from APT41, a handful of other threat groups and red teams from the APAC region are also using
the bootcss[.]com Malleable C2 profile, yielding further notable clusters.
The most popular SSL public key is shared by four IP addresses that are serving up 10 Beacons between
them:
IP Country
119.28.93[.]67 HK
119.28.42[.]138 HK
39.96.0[.]85 CN
172.93.43[.]32 US
Another cluster of two IPs and six Beacons is also significant; here the profile was subtly modified to
replace bootcss[.]com for the GET request metadata, but not for the POST request. For the GET request
metadata, the Beacon was instead configured to use static.aliyun[.]com (Alibaba Cloud Computing)
rather than bootcss[.]com as the domain, while the C2 server URI was changed from /jquery-3.3.1.min.
js to /require-jquery-v1.js.
Further pivoting on the C2 server configuration revealed four additional beacons from two new IPs
sharing the same domain.
IP Domain
40.73.6[.]221 www[.]aliyun.com[.]co
139.217.99[.]29 www[.]microport.com[.]cn
47.92.121[.]151 www[.]microport.com[.]cn
39.98.84[.]58 www[.]microport.com[.]cn
These beacons all appear to have been deployed against Chinese targets, possibly by red teams in
China.
Overall, 35 Beacons share a remarkably similar config (for one that is not widely in the public domain),
and they use 74.125.196[.]113 for the DNS_IDLE value, but without the default mojo.5688.8052.1838949
39787088877## named pipe. Watermark values vary between 305419896, 0 and 1873433027:
98
IP Count Country
45.77.13[.]213 7 JP
119.28.42[.]138 4 HK
93.115.21[.]242 4 NL
45.137.151[.]106 3 GB
119.28.93[.]67 2 HK
39.96.0[.]85 2 CN
47.101.177[.]45 2 CN
121.196.59[.]237 2 CN
96.45.182[.]23 2 US
157.245.169[.]236 2 US
118.25.108[.]240 2 CN
172.93.43[.]32 2 US
139.180.218[.]213 2 SG
Several of the above IPs have previously been associated with campaigns from Kinsing/SysupdataMin-
er, as well as being loosely affiliated with red teams based in China.
One of the Team Servers, 45.77.13[.]213, was unique in that it served up five different Beacons, all con-
figured with a user-agent string that is subtly modified from the base profile:
Compared to:
Finally, four of the Beacons specify null or 8.8.4.4 for the DNS_IDLE option, all of which are hosted on
39.101.199[.]31 (Alibaba).
Across all the Beacons using the bootcss jQuery profile, only four unique user-agent strings were ob-
served. Several of these should not be particularly common in recently updated Windows-based envi-
ronments, seeing as they normally originate from Mac® based browsers. These types of oddities can
be good indicators for defenders when crafting rules for hunting and alerting.
99
User-agent Browser/OS
darkside
DarkSide is a ransomware-as-a-service (RaaS) that first appeared in the wild in August 2020. With fre-
quent updates, version 2 surfaced around March 2021. The DarkSide threat group offers their malware
for download on the dark web, and like many other RaaS vendors, they allow their customers to down-
load malware and target victims to extort money, exfiltrate files, and then share in the proceeds with the
malware creators.
BlackBerry
BlackBerry Prevents DarkSide Ransomware — Years Before It Ever Existed
https://blogs.blackberry.com/en/2021/05/blackberry-prevents-darkside-ransomware-years-before-it-
ever-existed
When correlating intelligence against our TIP, we uncovered a report by Cybersecurity and Infrastructure
Security Agency (CISA) from July 2021 that attributes the IP 99.83.154[.]118 to DarkSide.
CISA
10337802.r1.v1
https://us-cert.cisa.gov/sites/default/files/publications/MAR-10337802-1.v1.WHITE.pdf
One of the most recent domains associated with that IP, tgbyhnedc[.]com, has historical resolutions for
103.140.186[.]35. This IP is present in our dataset, and is used by a pair of Beacons that are configured
to perform domain fronting via Google videos™:
100
Furthermore, five other Beacons also share the same PROCINJ_STUB hash, and all but one of these are
loosely based on the youtube_video.profile.
Overall, these overlaps reveal three new IPs and two new domains likely associated with attacks deploy-
ing DarkSide ransomware.
The IP 195.123.221[.]182 is hosted in the Netherlands, and it appears to be providing DNS for several
Russian top-level domains.
Interestingly, several DarkSide-related Beacons contain a unique PROCINJ_STUB value (the hash of the
Team Server JAR archive), which can be used to monitor for new Team Servers and Beacons deployed
by this particular DarkSide affiliate.
101
fin7
FIN7 is a Russian, financially motivated cybercrime group, notorious for deploying point-of-sale (PoS)
malware against U.S. retail and hospitality targets in the since 2015.
In late March of 2021, the ThreatConnect Research Team published a threat intelligence update that
identified possible FIN7 infrastructure. The hosting ISP, registrar, SSL certificate and naming convention
had strong consistencies with infrastructure that was previously attributed to FIN7. IPs and domains as-
sociated with their findings were correlated with our dataset and found to be serving Beacons between
July 2020 and July 2021.
ThreatConnect
ThreatConnect Research Roundup: Threat Intel Update 3/25/21
https://threatconnect.com/blog/threatconnect-research-roundup-threat-intel-update-3-25-21/
The correlations revealed five IP addresses associated with FIN7 that were doubling as Cobalt Strike
infrastructure, using three unique SSL certificates, and serving up over 20 Beacons between them. Four
out of those five IP addresses were using a modified version of the Gmail™ Malleable C2 profile.
Using this modified POST request as a clustering point reveals some additional infrastructure with links
to FIN7.
102
A total of four additional IPs and two additional domains were uncovered and are listed below as a
supplement to ThreatConnect’s original findings.
Table 19 – FIN7 C2
Occasionally, the FIN7 operators have been observed nulling out the PROCINJ_STUB hash in the Beacon
config. This is almost certainly good OPSEC, but about half of the Beacon configurations allude to a
leaked copy of Cobalt Strike 4.2 (20201106) being deployed.
wizardspider
WizardSpider (aka UNC1878) is a Russian cybercrime group. Since 2018, they have deployed a variety
of malware, including TrickBot, Ryuk and Conti, primarily attacking targets for financial gain.
Intelligence correlation has revealed several overlaps with WizardSpider campaigns in our dataset, al-
lowing us to shine a light on some of this group’s activities, and better monitor their future operations.
ryuk
In the latter half of October 2020, the ThreatConnect Research Team detected some newly registered
infrastructure that is potentially linked to the Threat Group WizardSpider and their Ryuk ransomware
family.
GitHub
ThreatConnect - IOCs
https://github.com/ThreatConnect-Inc/research-team/blob/master/IOCs/WizardSpider-UNC1878-
Ryuk.csv
103
The C2 domains from their report were registered via Openprovider. The domains use SSL certificates
containing similar string criteria compared to prior Ryuk infrastructure. Several IPs and domains asso-
ciated with their findings were also present in our dataset. These IPs and domains served Cobalt Strike
Beacons between July 2020 and July of 2021. One additional IP address, 108.62.141[.]5, was discov-
ered in our dataset, which shared C2 domains with an IP reported by ThreatConnect.
Table 20 – WizardSpider/Ryuk C2
Again, using the PROCINJ_STUB hash, it is possible to ascertain the version of Team Server deployed
on the server. In this instance, the hash belongs to the fourth most leaked build, 4.2 (from 2020-11-06).
bazarloader
An AlienVault Pulse from January 26, 2021 lists 88.119.171[.]105 as a possible IP associated with Wiz-
ardSpider/UNC1878:
AlienVault
Possible UNC1878 / Wizard Spider Domain servicessilverroomhotspot[.]com
https://otx.alienvault.io/pulse/600fe8f0617db5e51ad89f5b
104
A tweet from Joe Slowik a couple of days later hints at a further link to BazarLoader based on the servi-
cessilverroomhotspot[.]com domain:
Delving into our dataset, the IP address from the AlienVault Pulse is present, but specified as the
C2SERVER setting in the Beacon config. The actual Team Server hosting the Beacon is on another IP
entirely:
Table 21 – WizardSpider/BazarLoader C2
A Beacon payload (SHA256 of 5351…) was observed communicating with the above IP since 2021-01-
28. The Beacon is signed using a possibly stolen code signing certificate issued to “JJ ELECTRICAL
SERVICES LIMITED,” with a serial of bbd4dc3768a51aa2b3059c1bad569276. This certificate was used
to sign a further Cobalt Strike Beacon with a timestamp of 2021-02-02 17:25:31 (SHA256 of d67ba…),
which is attributed to TrickBot in a report from Intel 471 published in May 2021.
Intel 471
Look how many cybercriminals love Cobalt Strike
https://intel471.com/blog/Cobalt-strike-cybercriminals-trickbot-qbot-hancitor
105
The full hashes for both of the above samples are:
• 5351984d7eaf9464f27c202f94b6475ffb73904191c973d7c737a0f3cdfbde0e
• d67baca49193bd23451cca76ff7a08f79262bf17fb1d8eb7adaf7296dca77ad6
The Malleable C2 profile used by the WizardSpider/BazarLoader Beacons in our dataset differs from the
jQuery profile observed by Intel 471. The latest samples appear to be based on an Amazon® Malleable
C2 profile (using 0.0.0.0 for DNS idle), while another sample, signed with the stolen certificate, was using
a DNS idle value of 114.114.114.114 (China Telecom).
Beacons served from both IPs share the same PROCINJ_STUB hash, indicating they are both running a
leaked copy of Cobalt Strike 4.0.
trickbot
TrickBot was initially a banking Trojan, uncovered in 2016 and leveraged by its operators to facilitate
financial gain. Since its inception, TrickBot has grown in complexity. It is now a modular, multi-stage,
jack-of-all-trades, offering credential harvesting, crypto mining, exfiltration, reconnaissance and more.
BlackBerry
Threat Spotlight: TrickBot Infostealer Malware
https://blogs.blackberry.com/en/2019/09/blackberry-cylance-vs-trickbot-infostealer-malware
A blog published by The DFIR report in May 2021 identifies a TrickBot campaign that was used to first
deploy Cobalt Strike Beacon and then a credential-stealing tool called LaZagne.
106
The blog provides the following network IOCs for Cobalt Strike:
• 147.135.78[.]200:80
• 23.108.57[.]39:443
• wideri[.]com
• http[:]//172.82.179[.]170/w.dll
Further intelligence from RiskIQ published during September 2021 provides some additional context,
linking the IP 23.108.57[.]39 with a further ~650 IPs and attributing the overall campaign to WizardSpi-
der. RiskIQ also disclosed details of a new zero-day vulnerability in Microsoft® Word (CVE-2021-40444)
that was likely being exploited to deliver the Beacon payloads through malicious documents.
In this instance, clustering on SSL public keys associated with Team Server IPs revealed little further in
the way of additional infrastructure. This indicated that the operators of this particular botnet are em-
ploying some good OPSEC, installing Team Server afresh for each deployment. However, despite being
cautious, WizardSpider left a breadcrumb trail we could follow to correlate intelligence and uncover
further infrastructure.
The first part of the trail related to module names. Most of the module names employed by this threat
actor were manually specified and non-default:
• internsystem.dll
• commnicationsdebug.dll
• debugcomm.dll
• networkinternals.dll
• encryptfull.dll
• systemintern.dll
• networkcomm.dll
• cableplatform.dll
• debugcommunications.dll
In addition, many of the Beacons also used non-default process names for injection (SPAWNTO), such
as:
• %windir%\sysnative\wusa.exe
• %windir%\sysnative\mstsc.exe
• %windir%\system32\calc.exe
The final interesting portion of the breadcrumb trail concerns the use of a domain generation algorithm
(DGA), which is used to generate domains names for the beacon C2SERVER setting. In this instance,
the generated domain names tend to follow a simple nomenclature (6-12 characters, no prefix and a
.com suffix). For example:
107
• cloudstomes[.]com
• touchroof[.]com
• newiro[.]com
• derotin[.]com
• pipipub[.]com
• wideri[.]com
• hireja[.]com
• slicemia[.]com
• mebonux[.]com
• tucosu[.]com
• wuluxo[.]com
• dimuyum[.]com
• buremih[.]com
• nokuje[.]com
Armed with this knowledge, we can now produce a simple tool to label these samples in our dataset, as
well as to label incoming samples. This makes it easy to correlate emerging intelligence with Wizard-
Spider’s activities.
conti
In May 2021, WizardSpider deployed the Conti ransomware in an attack against the Health Service
Executive (HSE), the public health service of Ireland. As a result of the attack, the HSE was forced to
shut down its IT systems to regain control of the situation, resulting in appointment cancellations and
loss of services.
Security researcher Michael Koczwara revealed a further Conti ransomware campaign from July 2021
that employed a Beacon to deliver further payloads and stagers.
Michael Koczwara
Conti Ransomware Group Cobalt Strike C2 Analysis & Persistence (Anydesk, Atera, Splash)
https://michaelkoczwara.medium.com/conti-ransomware-group-cobalt-strike-c2-analysis-rdp-
persistence-cc535d35eaba
As noted by Koczwara in his report, the threat actors devoted little time and attention to protecting their
servers. Further clustering against our dataset using the user-agent string, submit URI, and the exis-
tence of azureedge[.]net in the HTTP host headers, reveals a further web of Conti-related Team Server
IPs, and over 65 Beacon payloads.
108
Figure 86 - Clustering of Conti infrastructure on user-agent, submit URI and Malleable C2 profile
All the Beacon’s payloads are configured using the jquery-c2.4.3.profile. And 16 of the samples are set
to perform domain fronting via Microsoft Azure, using either azureedge[.]net or workhub.microsoft[.]
com for the C2 server.
109
Most of the Beacons contain a PROCINJ_STUB value that corresponds to the MD5 hash value of Cobalt
Strike Team Server 4.3.
man1
MAN1 (aka Moskal, aka TA511) is another financially motivated cybercrime group, active since 2018.
They are renowned for deploying malware called Hancitor via malspam campaigns. Since late 2019,
Hancitor has been used to deploy Beacon, amongst other malware, such as Ursnif and EvilPony.
BlackBerry
Threat Spotlight: Dissecting the MAN1 Group’s Macro
https://blogs.blackberry.com/en/2017/03/threat-spotlight-dissecting-the-man1-groups-macro
We found evidence of MAN1 in our dataset in the form of two IPs, 31.44.184[.]47 and 192.99.250[.]2.
Both IPs were mentioned in a Unit 42 blog post from April 2021 examining traffic from Hancitor infec-
tions.
Unit 42
Wireshark Tutorial: Examining Traffic from Hancitor Infections
https://unit42.paloaltonetworks.com/wireshark-tutorial-hancitor-followup-malware/
The second IP, 192.99.250[.]2, was helpful for pivot searches. It resulted in the discovery of several fur-
ther Beacons in our dataset that were configured to use the IP as part of the C2SERVER configuration
value:
Table 22 – Hancitor C2
The 192.99.250[.]2 address tends to be the preferred IP/host in the C2SERVER setting when serving up
Beacons over port 8080, whereas the Team Server IP will be used in the C2SERVER value for Beacons
served over port 80. Aside from these distinctions, the Beacons all appear to employ a default configu-
ration with a watermark value of 0, leaving limited opportunity for further clustering. Nevertheless, we
now have more intelligence on MAN1’s Beacons, and the first/last seen datetimes help to broaden our
understanding of campaign timelines.
110
ursnif - saigon fork
Ursnif (aka Gozi) is a multifaceted malware family with an emphasis on information stealing that has
been leveraged to exfiltrate sensitive data from targets. It has been particularly pervasive from 2016
onwards. Since 2007, variants of the malware have been detected in Europe, Japan, and Australia, with
more recent outbreaks in the U.S. and U.K.
BlackBerry
Threat Spotlight: URSNIF Infostealer Malware
https://blogs.blackberry.com/en/2018/02/threat-spotlight-ursnif-infostealer-malware
Since 2020, Ursnif has often been distributed via malspam and used to facilitate deployment of multiple
malware payloads, including Cobalt Strike Beacon.
In January 2020 researchers at FireEye published a report on a malware dubbed Saigon, in which they
indicated what appeared to be a fork of the Ursnif aka Gozi banking malware.
FireEye
SAIGON, the Mysterious Ursnif Fork
https://www.mandiant.com/resources/saigon-mysterious-ursnif-fork
During that period, an IP (146.0.72[.]76) that was part of the Saigon C2 infrastructure was also present in
our dataset. The IP was seen to be serving a pair of Cobalt Strike Beacons based on the Stack Overflow
Malleable C2 profile between November 2020 and January of 2021.
Table 23 – Ursnif C2
The SSL certificate used by the server listed in the FireEye report has also been linked to a second IP
on the same CIDR, 146.0.72[.]76/24. This IP was also historically associated with Team Server deploy-
ments on an array of ports.
111
icedid
The IcedID malware family first appeared in the wild in September of 2017 and began life as a banking
Trojan. Since then, it has evolved through numerous functionality upgrades to have the means to carry
out wide array of malicious capabilities. After one recent campaign from early 2021, documented by
researchers at Checkpoint, it was discovered that some of their findings regarding the IcedID C2 in-
frastructure were also present in our dataset. Their infrastructure was seen to be serving Cobalt Strike
Beacons between September 2020 until as recently as May of 2021.
Further research from FireEye into IcedID reveals additional infrastructure and overlapping IOCs with
our dataset in the form of several C2 server IPs. FireEye specified that these were involved in an Ice-
dID-related infection chain that was part of a campaign from the threat actor UNC2198 in the latter half
of 2020.
FireEye
So Unchill: Melting UNC2198 ICEDID to Ransomware Operations
https://www.fireeye.com/blog/threat-research/2021/02/melting-unc2198-icedid-to-ransomware-
operations.html
When correlated with our dataset, we can start to unveil further IcedID connections, helping us further
map and monitor their infrastructure.
Table 24 – IcedID C2
112
salfram phishing campaign
Salfram is a malware packer/crypter that has primarily been used in the obfuscation and delivery of first
stage payloads during malspam campaigns. Such payloads include the ZLoader, AveMaria, Smoke-
Loader and Gozi malware families, as described in research published by Cisco Talos in September of
2020.
Cisco Talos
Salfram: Robbing the place without removing your name tag
https://blog.talosintelligence.com/2020/09/salfram-robbing-place-without-removing.html
It is notable that several of the IPs that were being used at that time for those campaigns are also pres-
ent in our dataset. They served Cobalt Strike Beacons between October and November of 2020.
While this information is not recent, it may be of benefit in historical investigations, and may yet help to
yield further intelligence correlations.
dridex
TA505
TA505 is a long-running, financially motivated threat actor that has been active since at least 2014.
TA505, named by Proofpoint, is best known for deploying banking Trojans such as Dridex and TrickBot
as well as ransomware such as Locky and Clop. Based on prior research from Intel471, a solitary IP
address mentioned in their report (176.121.14[.]175) was found to have shared a self-signed certificate
with two more IP addresses in our dataset.
Intel471
Flowspec – TA505’s bulletproof hoster of choice
https://intel471.com/blog/bulletproof-hoster-of-choice
113
These overlaps potentially reveal further historic TA505 related infrastructure:
Table 26 - TA505 C2
The 91.214.124[.]54 was loosely attributed to TA505 in a report by the French CERT published in Feb-
ruary 2021. The new IP, 45.67.229[.]188, is running a leaked copy of Cobalt Strike 4.0, according to the
PROCINJ_STUB hash.
French CERT
INFRASTRUCTURE D'ATTAQUE DU GROUPE CYBERCRIMINEL TA505
https://www.cert.ssi.gouv.fr/uploads/CERTFR-2021-CTI-002.pdf
ta575
TA575, another group identified by Proofpoint, is a notorious Russian cybercrime actor that is also re-
sponsible for deploying and operating the infamous Dridex banking Trojan.
Since February 2021, TA575 has deployed over 50 Cobalt Strike Team Servers, after shunning the
now-defunct PowerShell Empire post-exploitation framework.
BlackBerry
Threat Thursday: TA575/Dridex
https://blogs.blackberry.com/en/2021/08/threat-thursday-ta575-dridex
114
We’ve been tracking TA575’s Team Server deployments using the SSL public keys in their Beacon’s
configurations.
Despite being hosted on over 50 servers, the SSL public key in question (0ce7b-
6482c1f24e42f2935f5026d338d) remains constant across all payloads. This means that the operators
of this Cobalt Strike infrastructure have clearly used a single server to build all Beacons, before deploy-
ing them from multiple Team Servers. The Team Servers are all using a leaked build of version 4.3,
according to the PROCINJ_STUB value.
Further tracking of the SSL public key across Beacon configurations has allowed us to collate infrastruc-
ture belonging to the TA575 threat actor that had previously been disparate and unattributed.
Largely flying under the radar, portions of the infrastructure have been used by thousands of Beacons
and malicious document stagers across several distinct malspam campaigns. In more recent offen-
sives, such as the Fake Kaseya VSA phishing campaign first reported by Trustwave in early July, the
Team Server infrastructure was used for staging further Dridex payloads.
115
Figure 92 - TA575 Cobalt Strike Team Server deployments by country since February 2021
GitHub
BlackBerry IOCs
https://github.com/blackberry/threat-research-and-intelligence
A single domain led us down a path where we would uncover multiple ransomware attacks plus an
APT C2, and subsequently revealed what we believe to be the infrastructure of an Initial Access Broker
(IAB) that we have dubbed Zebra2104. IABs typically gain entry into a high-value victim network, then
sell access to the highest bidder on underground forums. Later, the winning bidders will typically deploy
ransomware and other financially motivated malware within the victim’s organization.
This presents a great opportunity to examine how performing attribution of IABs can often be a complex
undertaking, and how further intelligence correlation can help us to better observe constellations on a
cloudy night, so to speak.
116
enter mountlocker
We identified Cobalt Strike beacons being served from the domain trashborting[.]com in April of 2021.
We had identified multiple beacons with different configuration data that were reaching out to the do-
main during April and August of the same year.
A Beacon served from the IP 87.120.37[.]120 had trashborting[.]com as the specified C2SERVER in its
configuration:
The trashborting[.]com domain was registered with a ProtonMail email address (ivan.odencov1985[@]
protonmail[.]com) and contained Russian WHOIS registrant information:
Type ROC
Organization -
Street -
117
This email address was used to register two other sister domains on the same date - 2020-07-17:
• supercombinating[.]com
• ideanotsure[.]com
At this point, we performed some further OSINT correlation and discovered that Sophos had attribut-
ed the domain supercombinating[.]com to a MountLocker intrusion, based on IOCs they published on
GitHub:
We then discovered that all three of these domains had been observed serving Beacons.
enter strongpity
After investigating the supercombinating[.]com domain further, we noticed something peculiar; it had
previously resolved to the IP 91.92.109[.]174. This IP had another resolution within a similar timeframe:
mentiononecommon[.]com
The name mentiononecommon[.]com is of particular interest to us, as Cisco Talos intelligence reported
that the APT group “StrongPity,” also known as “Promethium,” used this domain to serve its namesake
malware.
Cisco Talos
PROMETHIUM extends global reach with StrongPity3 APT
https://blog.talosintelligence.com/2020/06/promethium-extends-with-strongpity3.html
Three files attributed to StrongPity were served from this domain in 2020, according to VirusTotal.
118
SHA256 Filename
c936e01333e3260547a8c319d9cfc1811ba5793e182d0688db679ec2b30644c5 Installer.exe
e843af007ac3f58e26d5427e537cdbddf33d118c79dfed831eee1ffcce474569 SecurityHost.exe
8844d234d9e18e29f01ff8f64db70274c02953276a2cd1a1a05d07e7e1feb55c SecurityHost.exe
Both supercombinating[.]com and mentiononecommon[.]com resolved to the following IP, which alter-
nated resolutions between the two domains at different overlapping time periods.
This is more evident when we look at VirusTotal’s display of Passive DNS Replication, where the resolu-
tion of 91.92.109[.]174 alternates between the two domains of interest.
Not only this, but the domain mentiononecommon was registered to a ProtonMail address with a similar
naming convention, which also has WHOIS registrant information pointing to Russia. The domain regis-
trant email address associated with the WHOIS record is timofei66[@]protonmail[.]com.
119
enter phobos
Initially we thought we had found a link between StrongPity and MountLocker through the entanglement
of supercombinating and mentiononecommon. Our working theory changed when we saw Phobos ran-
somware being deployed from the same C2 server as MountLocker, as shown in the following figure
and confirmed by the Any.Run sandbox report mentioned by The DFIR Report.
This presented a bit of a conundrum. Are these ransomware operators actually in cahoots?
If MountLocker owned the infrastructure, then the chance would be slim that another ransomware op-
erator was also working from it. Additionally, in several instances a delay was observed between initial
compromise using Cobalt Strike and further ransomware being deployed. Based on these factors, we
can infer that the infrastructure is not that of StrongPity, MountLocker, or Phobos, but of a fourth group;
one we believe is an IAB that we named and continue to track as Zebra2104.
This further demonstrates the power of intelligence correlation. From just one lead derived from the
Cobalt Strike scanner, combined with OSINT, we now have valuable intelligence on the actions of four
different threat actors. Not only this, but we can also provide a level of context into their operations to
SOC analysis and incident responders during related incidents.
120
hidden dragon
For clusters where there are no existing intelligence overlaps with available OSINT, there can be many
benefits in taking the time to dig more closely into IOC relationships. This can lead to the uncovering of
additional intelligence, even if it doesn’t always immediately lead to attribution.
Let’s explore one such cluster that we shall dub “Hidden Dragon” (awesome logo to follow!).
Delving into one of the larger C2SERVER clusters in our dataset, we can clearly spot several dubious
correlations after exploring the history behind the network operator.
The central node in this cluster is the 168.206.191[.]222 IP address. This IP appears to be connected to
240 unique Team Servers based on the C2SERVER values correlated from recovered Beacons.
The IP block 168.206.0[.]0/16, within which 99% of this Cobalt Strike network resides, is operated by
the Internet Service Provider (ISP) Clayer Limited (ASN 137951). It is based out of Hong Kong and is
currently assigned to the organization The Atomic Energy Board. The only other ISP owning infrastruc-
ture that forms a part of this network, IP 45.88.6[.]84, is ASLINE Limited (ASN 18013), also based out
of Hong Kong.
121
As reported by the South African news outlet, mybroadband.co.za, the IP block 168.206.0[.]0/16 – con-
taining a total of 65,536 individual addresses – was part of a large chunk of IP address space that
was stolen from AFRINIC, the regional Internet Registry for Africa. This theft was carried out by a ma-
licious insider, who subsequently sold the netblock on the grey market for somewhere in the region of
R20,512,768 (African Rands), which equates to approximately $1.4 million USD. The confirmed owner
of this IP block is “NECSA,” Nuclear Energy Corporation of South Africa, a name that is similar to the IP
block’s currently assigned organization: The Atomic Energy Board.
mybroadband.co.za
The Great African IP Address Heist – South African Internet resources worth R558 million usurped with
shady domains
https://mybroadband.co.za/news/security/367188-the-great-african-ip-address-heist-south-african-
internet-resources-worth-r558-million-usurped-with-shady-domains.html
At the time of publishing (November 2020), the MyBroadband blog reports that the very same IP block
was under active route squatting. Route squatting is where an unauthorized operator “squats” on a
block of IP addresses that do not belong to it. The ISPs Clayer and ASLINE are the reported route squat-
ters for this IP block. The latest report from AFRINIC still marks this IP block as “under dispute” as of
January 2021.
All the servers within this cluster are running the most popular leaked version of Cobalt Strike 4.0 and
they are configured to serve Beacon payloads on ports 9999 and 9998 (the WebSphere Application
Server Liberty Profile port).
All Beacons pillaged from the Team Servers are reverse HTTP payloads, each employing the default
Malleable C2 profile. They leave very little in the way of unique configuration values to distinguish them
from most other payloads. However, the SSL public key (81a3eeb8ceb74cf508f6bcfc408e0305) relates
to 2053 Beacon payloads across 240 Team Servers in our dataset, allowing us to group these IPs to-
gether with a high degree of confidence.
While we may not currently be able to attribute the “Hidden Dragon” infrastructure to a known threat
group, it will be only a matter of time before at least one IP is attributed by threat intelligence analysts.
At that point, the dominos will tumble. But in the meantime, we can at least provide limited intelligence
if these IPs are observed during incidents.
recap
Let's quickly recap all we’ve done so far. We've followed our CTI lifecycle, built an automation system
for hunting Team Servers, pillaged Beacons, and parsed configuration data. We've explored the config-
uration settings in-depth to uncover insights and trends, and we’ve discovered further clustering tech-
niques. Leveraging OSINT and the new clustering capabilities, we’ve correlated intelligence. This allows
us to differentiate the many APT groups, campaigns, access brokers and other nefarious cybercrimi-
nals, from the intended customer for Cobalt Strike, which is red teams and pentesters.
Now it's time to disseminate our findings and revaluate key stages of the lifecycle in a debrief.
122
chapter six
DEBRIEF
In this final chapter, we’ll reassess the CTI questions defined in the planning and direction phase, and the
steps undertaken during each subsequent phase to arrive at our solution. We’ll then recap the insights,
trends, observations, and discoveries uncovered throughout the CTI lifecycle as they pertain to each of
our key stakeholders, and how the data can be leveraged to enhance detection and correlation capabil-
ities across the XDR solution space.
We discussed how this question was too broad to allow for adequate concentration on the desired
outcome. So, it had to be broken into more focused, direct, closed-loop questions for various XDR stake-
holders:
“How can we improve incident correlation and reduce alert fatigue?” – SOC Team
“What features are helpful for training models to classify Cobalt Strike
Beacon payloads and configurations?” – Data Science
“How can we improve correlation and campaign tracking relating to Cobalt Strike?” – Incident Response
We also highlighted that the by-product of directed intelligence efforts still has a use, and that feeding
contextualized information into an XDR-capable platform has benefits to teams beyond the stakeholder
who requested the intelligence.
collection
Collection is the first phase of an intelligence-led, proactive defense posture.
In the collection phase, the aim was to generate a list of potential Cobalt Strike Team Servers while
keeping false positives to a minimum. This ensures that the data collected is relevant, accurate and
(most importantly) timely: That is to say, it’s collected before anyone is targeted.
While several options were possible, we opted to demonstrate how to build a system that leverages data
collected by public Internet scanning services in order to lower the barrier to entry for organizations.
123
In this regard, we demonstrated how to craft several queries based on some of Cobalt Strike’s known
characteristics that can be used to discover active Team Server Infrastructure, such as:
With queries crafted and data gathered, we discussed how a Team Server stages its Beacons and how
we might use this knowledge to our advantage to obtain said Beacons for further analysis.
As part of this, we provided some Python scripts that can be leveraged in your own systems, so you may
start to pillage and plunder Team Servers before they can do the same to you.
processing
With a bounty of Beacons in hand, we started the process of extracting the “configgy goodness” that will
provide the information from which we will extract our Intelligence.
The first step was to separate the wheat from the chaff, so to speak. We removed any invalid payloads
from our dataset based on size and data type.
Next, we discussed how to decode the shellcode-based payloads to make it possible for us to access
the embedded PE and its config. This involved extracting the XOR key and payload size from the shell-
code and performing the differential XOR decode process.
Once the PE was decoded, we discussed the Beacons’ config formatting, its structure and its XOR en-
coding. These are details which are essential for the config extraction process.
With our newfound understanding of the structure of each setting in the config, we touched on how
automation of this final step (config extraction) would be possible.
From here, the analysis and intelligence dissemination phases can take place.
analysis
The insights, trends and discoveries uncovered during the analysis phase have been leveraged to en-
hance detection and correlation capabilities for various products and services within our XDR solution
space, including anti-malware, EDR and SOC services.
insights
The insights uncovered during the analysis phase included a raft of host and network-based indicators.
From IPs, netblocks and certificates, to process names, injection techniques and pipe names, this infor-
mation is fed to blocklists to enhance detection. It is also correlated to provide intelligence insights for
various products and services.
For BlackBerry, these insights are used to inform and enhance our various commercial cybersecurity
products and service offerings. For you, the information can be similarly distributed across your internal
XDR framework to provide an additional layer of protection against Cobalt Strike vector attacks.
124
trends
The frequency of configuration settings, deployment of Team Servers and prevalence of Beacons helps
us to fine-tune EDR rules for alerting purposes. Knowing the most popular configuration values, such as
named pipes or target processes for injections, can help analysts and investigators to swiftly craft rules
to grab most low-hanging fruit with a high degree of confidence.
discoveries
Perhaps the biggest revelation during the analysis phase was the discovery of what can best be de-
scribed as hidden watermarks embedded in Beacon configurations.
After considerable analysis, it appears that the SSL public key embedded in configs can often be used
to cluster Beacons configured on the same server, while the misleadingly named PROCINJ_STUB can
be used to track which Team Server builds were used. The DEPRECATED_SPAWNTO configuration can
also be used to perform clustering in some instances.
These sparsely documented “hidden watermarks” have proved invaluable for enhancing intelligence
correlation (more so than the actual watermark setting!).
dissemination
After enriching our dataset during the human analysis phase, we were ready to disseminate our re-
search and findings to our various stakeholders.
Let’s look at how some of the data was consumed by various teams and XDR product and services
stakeholders.
threat intelligence
As demonstrated under the “Beacon of Hope” chapter, the main benefit to threat intelligence has been
increased correlation with known threat groups. This led to greater confidence when performing attribu-
tion and a broader understanding of active threat groups and campaigns.
The “watermark” values have allowed us to perform some powerful monitoring, by tracking values such
as the SSL public keys to cluster Beacons and Team Servers.
We can then use these values to further our knowledge and understanding of campaigns, as well as
produce some cool graphs and charts to keep our management team happy!
125
Figure 97 – Cobalt Strike detections by industry vertical
We can use this information to correlate against detections originating on endpoints we protect and
monitor. In instances where we have details of threat groups, we can immediately deploy our IR teams
to engage with the clients, providing them with full campaign details and indicators before they even
complete a compromise assessment.
With IABs increasingly establishing a foothold, then deploying Beacon and selling access to the high-
est bidder within a matter of days, this speedy response can present a brief window of opportunity to
disrupt campaigns before more (often financially motivated) threats are deployed. It also presents the
possibility of separately tracking threat actors who solely perform IAB services vs. those who deploy
ransomware and other threats, as in the case of StrongPity/MountLocker/Phobos.
threat hunting
Once equipped with the dataset, our internal threat hunting teams wasted no time in identifying Team
Server traffic and Beacons from a variety of sources, including private data feeds and online malware
repositories, such as VirusTotal.
Part of the reason for Cobalt Strike’s prominence is that, when it is configured carefully, it can operate
surreptitiously. When packaged and deployed with additional care, it can be used to evade detection in
many security solutions and services. While most security vendors fare perfectly well at detecting and
blocking Cobalt Strike Beacon payloads on disk, when it’s deployed in-memory via complex stagers,
things get a little more complicated due to transformations and injection techniques.
One such example our threat hunters uncovered was a strange process connecting to a known Team
Server IP. The process was odd, in that it was clearly a legitimate version of Java, used to invoke an
open-source web server application developed by Oracle, called GlassFish. After some research, it was
discovered that the threat group called WINNTI has been exploiting a remote code execution vulnerabil-
ity in GlassFish webservers to deploy Cobalt Strike Beacon payloads against selected targets.
Having the ability to hunt for and monitor Team Server IPs is invaluable. It helps to not only improve the
efficacy of cybersecurity products and services, which is far and away the main aim, but also to uncover
new and exciting intelligence findings. In this instance, we found an exploitable web server application
126
and further TTPs employed by the WINNTI group. Our customers benefit from enhanced protection and
monitoring, and we all get richer in shared intel!
NTT
The Operations of Winnti group
https://hello.global.ntt/-/media/ntt/global/insights/white-papers/the-operations-of-winnti-group.pdf
incident response
Unsurprisingly, our incident response team frequently encounters Cobalt Strike Beacon at the heart
of their investigations. To that end, correlating our dataset with public and private intelligence allows
incident responders to perform attribution with a higher degree of accuracy. They can also correlate
incident and campaign timelines, as well as uncover related IOCs to use for hunting during live investi-
gations and compromise assessments. This helps them perform further actor and campaign profiling,
and it offers the chance to gather further contextual information around Team Servers. This in turn
leads to better intelligence production, enhanced alerting capabilities and more publishable research
opportunities across the XDR solutions and services space.
forensics
On that face of it, the dataset might not seem overly beneficial to forensic analysts. However, mining the
data for common filenames, module and export names, profile strings, rich headers and import hashes
provides a wealth of generic indicators that can be leveraged to assist in cybersecurity forensics. As
mentioned, Cobalt Strike Beacon payloads often reside entirely in-memory, and sometimes under ex-
ploited processes. Being able to quickly and efficiently ascertain whether Beacon is active on a system
when looking at a memory dump can be highly beneficial to investigators.
To that end, keyword files can be crafted and used to grep memory for common strings, and YARA rules
can be written to detect fragments of Malleable C2 profiles. Additionally, automatically correlating IPs
found in-memory with Team Server infrastructure via your forensic framework of choice offers a pow-
erful mechanism to aid further forensic workflows, such as automatically extracting and processing
Beacon payloads and configurations from memory.
data science
Having a curated and labelled dataset comprised of Beacons, parsed configuration settings and in-
telligence correlations presents a couple of interesting opportunities for the application of machine
learning.
The first, perhaps most obvious application, is the identification of Beacon DLLs for classification pur-
poses. Using the corpus of Beacon payloads pillaged from Team Servers, we can train a variety of su-
pervised machine learning (ML) models using methods such as KNN and SVC to classify Cobalt Strike
Beacon payloads accurately and reliably based on PE file features.
The second, perhaps less obvious application, is the identification of clusters of infrastructure belonging
to individual threat groups. To do this, we first need to figure out how best to coerce Beacon configura-
tion settings into usable ML training features (for example, hashing strings and performing hamming
distance calculations against Malleable C2 profiles). Then we can train a classifier to not only spot rela-
tionships between configurations, but also to reveal what decisions led to those conclusions. This can
lead to the discovery of new intelligence and allow us to determine if previously unseen Beacons relate
to known groups and campaigns.
127
Figure 98 – Covariance ranking of features used to train a Cobalt Strike Beacon detection model
(feature labels redacted)
soc
SOC analysts can take the enriched dataset and begin to select common indicators with which to build
rules for alerting. The most obvious data to consume first is the IP and port listings, as well as URIs, cer-
tificate information and module names. These are typically indicators that most EDR platforms support
and that tend to yield high-confidence alerts.
In general, anything that benefits the SOC also benefits our XDR products and services. We can use
correlation techniques to improve the accuracy of alerts, thereby reducing alert fatigue. But we can also
begin to provide context and meaning beyond simply tagging traffic as originating from Cobalt Strike
Beacon.
These days, the most powerful opportunity for SOC analysts is in identifying threat groups from incident
alerts and providing actionable intelligence alongside contextual details. This will empower analysts
and responders alike in their decision-making and case-handling from the moment an incident occurs.
red team
Although red teams were not a direct stakeholder in any phase of our CTI lifecycle, it’s worth spending
some time considering the implications of some of the findings with respect to OPSEC when deploying
Cobalt Strike.
The first consideration is around the general hardening of Team Server infrastructure. We’ve observed
128
several threat groups deploying complex tunnelling mechanisms to obscure their C2 infrastructure in
the past, and we expect this to become more commonplace, especially as it helps to defeat automated
hunting systems. From SOCKS proxies to TOR fronting, SSH tunnelling and general IP hardening, we
expect red teamers and threat actors will likely step up their game with respect to network OPSEC.
The next major consideration concerns the new “watermarks”, and the possibilities that now exist for
tracking Team Server operators based on these hidden values. Whilst some of the values may be trivi-
ally spoofed without harming the functionality of Beacon, such as the PROCINJ_STUB and DEPRECAT-
ED_SPAWNTO, others, like the SSL public key, cannot be tampered with as easily without breaking the
C2 check-in process. This would leave operators with little choice but to rotate public/private keys often,
which would likely be a hassle to perform with any regularity.
It might seem like creating a highly customized Beacon would be an obvious choice for attackers. But
that’s the beauty of this method of correlation. While the intention of many bad actors was to use Cobalt
Strike to blend in with the crowd, it is now becoming apparent that there is sufficient “uniqueness” in
Beacon configurations to track and monitor users.
The main consideration for attackers when deploying Cobalt Strike these days is how best to strike a
balance when customizing Beacon. Use a default Malleable C2 profile and you risk being easily blocked
on the endpoint, while conversely, if you supply a highly customized profile, you risk being easily tracked.
Finally, a perhaps more drastic approach to evade detection would be to write your own customized
port of Beacon to interoperate with Team Server. This is exactly the method that researchers at Intezer
recently discovered, with a Linux port of Beacon build for RedHat distributions and leveraging OpenSSL
for cryptography. Interestingly, the new Beacon, dubbed Vermilion Strike, retains the configuration data
from Windows Beacons (simply ignoring irrelevant settings), meaning the possibility for clustering on
the SSL public key and other hidden watermarks still exists.
Intezer
Vermilion Strike: Linux and Windows Re-implementation of Cobalt Strike
https://www.intezer.com/blog/malware-analysis/vermilionstrike-reimplementation-cobaltstrike/
Defenders and attackers will continue to play the cat and mouse game. We wait for the inevitable ad-
vances in OPSEC with bated breath.
129
evaluation and feedback
The evaluation and feedback stage has led to continuous improvement throughout the CTI lifecycle, and
indeed, will most likely continue to yield improvements long after this book has been published.
During the early phase of the lifecycle, most feedback was focused on enhancing our automation plat-
form, with the primary focus on producing more intelligence data to allow us greater options for clus-
tering. Initially we started with a dataset mostly comprising parsed Beacon configuration data, but over
time, this has grown considerably to ultimately include:
Since disseminating the dataset to our various stakeholders, feedback is becoming more tailored to
each consumer’s specific circumstances. Some stakeholders require confidence ratings for IP block-
lists, others want real-time updates for new Team Servers and Beacons discovered in the wild, while
some want charts and graphs to plot the Cobalt landscape. Some of these tasks take minutes to com-
plete, while others are perhaps slightly more involved, and will feed back into our software development
lifecycle for planning and implementation.
Combining the holistic view of the security landscape offered by XDR with contextual intelligence and
deep insights offers many exciting new opportunities in the cybersecurity arena. One such avenue, ma-
chine-based decision-making in response to incidents, seems imminently achievable. By automatically
deriving playbooks from contextual intelligence correlated with alerts, we can potentially greatly aid
decision making and case management in response to incidents for SOC and IR teams alike.
130
beyond the hype and back again
A final word on CTI; we created this book as a case study highlighting the importance of the lifecycle,
and how to think about the processes that may be required. There are ideas on building a data-gathering
and intelligence-creation pipeline, using automation to collect and ingest data, correlating what you are
seeing, and linking to existing research.
We tried to frame this as a defined, structured approach; one that needs to be repeatable. In this way,
it’s more science, and less art. While all of this is true, working in this field is immensely rewarding and
at times, downright awesome.
Don’t take the seriousness with which we’ve talked about frameworks and proper procedures in this
book as meaning you will have less fun. The truth is quite the opposite: By ensuring you have the right
processes and technology in place, the people working with the data will have more time to focus on the
cool shi… stuff. It provides the base from which to let creativity flow.
Being involved in the work of threat intelligence often does not feel like a job. The rush when a hypoth-
esis is proven correct is addictive. So too is the personal challenge you can set for yourself when you
experience a moment of finding your hypothesis is wrong. Wanting, even needing, to understand the
data and why you were wrong is intoxicating.
Our lofty hope is that this book can be used to help teams understand the environment they operate in,
to make better decisions. We hope to get you to a point of taking proactive measures to stop or detect
malice sooner. And we want more people to experience the rush of doing this important work.
To all the analysts, researchers, IR, SOC and intelligence teams reading this, we hope you’re having as
much fun as we are in making the world a better, safer place.
131
Disclaimer
The information contained in this book is intended for educational purposes only. BlackBerry does
not guarantee or take responsibility for the accuracy, completeness and reliability of any third-party
statements or research referenced herein. The analysis expressed in this report reflects the current
understanding of available information by our research analysts and may be subject to change as
additional information is made known to us. Readers are responsible for exercising their own due
diligence when applying this information to their private and professional lives. BlackBerry does not
condone any malicious use or misuse of information presented in this report.
132