This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Accept
Reject

NetWitness Community

  • Home
  • Products
    • NetWitness Platform
      • Advisories
      • Documentation
        • Platform Documentation
        • Known Issues
        • Security Fixes
        • Hardware Documentation
        • Threat Content
        • Unified Data Model
        • Videos
      • Downloads
      • Integrations
      • Knowledge Base
    • NetWitness Cloud SIEM
      • Advisories
      • Documentation
      • Knowledge Base
    • NetWitness Detect AI
      • Advisories
      • Documentation
      • Knowledge Base
    • NetWitness Investigator
    • NetWitness Orchestrator
      • Advisories
      • Documentation
      • Knowledge Base
      • Legacy NetWitness Orchestrator
        • Advisories
        • Documentation
  • Community
    • Blog
    • Discussions
    • Events
    • Idea Exchange
  • Support
    • Case Portal
      • Create New Case
      • View My Cases
      • View My Team's Cases
    • Community Support
      • Getting Started
      • News & Announcements
      • Community Support Forum
      • Community Support Articles
    • Product Life Cycle
    • Support Information
    • General Security Advisories
  • Training
    • Blog
    • Certification Program
    • Course Catalog
      • Netwitness XDR
      • EC-Council Training
    • New Product Readiness
    • On-Demand Subscriptions
    • Student Resources
    • Upcoming Events
    • Role-Based Training
  • Technology Partners
  • Trust Center
Sign InRegister Now
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Search instead for 
Did you mean: 
NetWitness Community Blog
Subscribe to the official NetWitness Community blog for information about new product features, industry insights, best practices, and more.
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Search instead for 
Did you mean: 
  • NetWitness Community
  • Blog
  • Detecting C&C Malleable Profiles

Detecting C&C Malleable Profiles

LeeKirkpatrick
Valued Contributor LeeKirkpatrick Valued Contributor
Valued Contributor
Options
  • Subscribe to RSS Feed
  • Mark as New
  • Mark as Read
  • Bookmark
  • Subscribe
  • Printer Friendly Page
  • Report Inappropriate Content
‎2021-05-12 10:50 AM

Introduction

When a C2 platform is hardcoded to beacon in a particular fashion, its detection from a defender’s perspective is trivial. Namely, we merely need to create a single signature based on the hardcoded characteristics, which would then be capable of detecting that C2 across multiple deployments. In order to help prevent this, malware authors introduced malleable profiles (quite some time ago now), which give the C2 operator the ability to quickly and easily alter the communication characteristics of the beacons. These profiles allow the C2 traffic to blend in by mimicking everyday traffic from common applications, making it difficult for defenders to distinguish between legitimate and malicious communication. One of the first well known C2 platforms to introduce malleable profiles was Cobalt Strike, but other platforms such as Empire also offer this capability.

In this blog post, we will go through a concept of how to help identify these malleable profiles by parsing them and turning them into content for NetWitness Packets.

 
This post differs from our typical behavioural approach to hunting and relies perdominantly on signatures instead. This approach is an attempt to capture the lazy C2 operator and help free time to perform behavioural based threat hunting to find the more advanced attackers.

 

The Concept

Looking into the malleable profiles, a number of which can be found here: https://github.com/rsmudge/Malleable-C2-Profiles, we can see how they will alter the traffic based on the parameters supplied. A small snippet of the http-get section from the jquery-c2.4.2.profile can be seen below:

 

 

 

http-get {

    set uri "/jquery-3.3.1.min.js";
    set verb "GET";

    client {

        header "Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
        #header "Host" "code.jquery.com";
        header "Referer" "http://code.jquery.com/";
        header "Accept-Encoding" "gzip, deflate";

        metadata {
            base64url;
            prepend "__cfduid=";
            header "Cookie";
        }
    }

    server {

        header "Server" "NetDNA-cache/2.2";
        header "Cache-Control" "max-age=0, no-cache";
        header "Pragma" "no-cache";
        header "Connection" "keep-alive";
        header "Content-Type" "application/javascript; charset=utf-8";

...
...
...

 

 

 

The section shown above defines the HTTP GET for the beacon, which is typically used for checking in. We can see the URI that will be requested, the headers and associated values that will be sent by the client and server, as well as some other options that will specify where and how data will be sent. All of the profiles follow this format, which means that we could create a utility to extract this content from them, and in turn generate NetWitness content for their detection in the form of application rules. The utility would simply identify each section and parse the relevant parameters in order to create the content.

The screenshot below shows the utility being executed against a directory of malleable profiles that were freely available online, 82 in total:

LeeKirkpatrick_0-1620830267859.png

The parser generated a total of 210 application rules from the 82 profiles. This is because the tool creates content for the HTTP GET, HTTP POST, HTTP stager sections, and any variants there are of each. The tool outputs the content as an .nwr file, which can be directly imported into the Packet Decoders, the following link has instructions on how to import the rules under the heading, Import Rules from a File and Export Rules:

  • https://community.rsa.com/t5/rsa-netwitness-platform-online/configure-decoder-rules/ta-p/586148

The logic for all of the rules can then be seen and edited if need be:

LeeKirkpatrick_0-1620820540929.png

Some of the application rules may generate false positives in your environment. However, these rules are intended to be used as an initial pivot point to help hone in on sessions that could potentially be a C2 using malleable profiles. Therefore, some level of whitelisting would most likely be required to reduce any noisy hits. Application rules are also named according to the section the content was created from, so if you have more than one match for single profile, such as the GET and POST, then the fidelity of the matches rises:

LeeKirkpatrick_1-1620820572799.png

 
The HTTP POST is typically used to send data back to the C2 from the agent.

 

Some of the profiles will not contain a user agent string, such as the default.profile. In the instance of Cobalt Strike, if this is the case, it will randomly pick a user agent string from a default list; we therefore need to make sure we also create content for that list so it can be used as a pivot point to help with hunting through the hits. Attached to this blog post is a CSV file for all of the default user agent strings that Cobalt Strike may use. This CSV file will need to be turned into a Feed so you can use it as an additonal pivot point: https://community.rsa.com/t5/rsa-netwitness-platform-online/create-a-custom-feed/ta-p/586192:

LeeKirkpatrick_1-1620636954533.png

 

Also attached to this post is a ZIP containing two files:
  • MalleableProfiles.nwr - This set of rules works with the product by default. It uses meta keys that are available out of the box, but does however mean that the rules are looser in their conditions and may trigger more often
  • MalleableProfilesForAdvancedNetWitnessOptions.nwr - This set of rules requires that all headers are extracted from the HTTP traffic, this is done by enabling an option on the Decoder as previously described in one of our blog posts (https://community.rsa.com/t5/rsa-netwitness-platform-blog/detecting-command-and-control-in-rsa-netwitness-cobalt-strike/ba-p/521072). This option can cause performance issues with the Decoder, so do monitor closely if enabling
 
 
This post also assumes that the traffic is over HTTP and not SSL. If the traffic is over SSL, these application rules will not work. You would need to have a solution in place that would send the decrypted SSL to a NetWitness Decoder.

 

Testing

In order to test this concept. We uploaded the rules to our Packet Decoder in the lab and executed a large number of Cobalt Strike executables we found on VirusTotal in our sandbox, this way we could capture the traffic from a large array of different in-the-wild Cobalt Strike C2's. We got a good amount of hits for a number of different malleable profiles during the testing, particularly the default.profile. So, it appears there are a number of C2 operators opting to use these freely available malleable profiles, if not just the default:

LeeKirkpatrick_0-1620818889942.png

 

Pivoting on the default.profile hits and opening the Hostname Alias (alias.host) meta key, we can see that we have successfully hit on a large number of Cobalt Strike C2's that are using the default.profile:

LeeKirkpatrick_1-1620819033458.png

 

As previously stated, the profiles are designed to mimic common traffic, so it is possible to get lots of hits for legitimate communication. So, coupling this signature style detection with hunting techniques is usually necessary. Some hunting paths include:

  1. Looking at the Service Analysis (analysis.service) meta key for values such as http invalid cookie or http response status ends with space
  2. Looking for the Content Type (content) meta value, application/octet-stream
  3. Analysing the Destination Orgnization (org.dst) meta value for suspect hosting providers

Some of the meta values mentioned above are in one of our previous blogs and go into more depth to why they are useful for hunting Cobalt Strike: https://community.rsa.com/t5/rsa-netwitness-platform-blog/detecting-command-and-control-in-rsa-netwitness-cobalt-strike/ba-p/521072:

LeeKirkpatrick_0-1620819413605.png

 

As these application rules are signature based, simply editing the profile will evade detection. We can see example of this from our testing whereby one of the C2's had a slightly modified version of the jquery-c2.4.2 profile. This profile specified that the beacon should have the referer set to "http://code.jquery[.]com/ ", but the C2 operator slightly altered this profile so that the referer would be "http://cdn.bootcss[.]com/ ", so in this instance, we did not get a match due to this one simple change:

LeeKirkpatrick_1-1620819983406.png

 

Conclusion

The detection concept presented here is not about how to detect Cobalt Strike with 100% accuracy from the network perspective. It is however, another technique that can help with identifying the C2 operators that opt for configuring their Cobalt Strike C2 with default and freely available malleable profiles. While an attacker may choose to use non-standard profiles in their C2 configuration, the technique and the app rules outlined in this blog will help you to identify all the Cobalt Strike variants with default malleable profiles that that may find their way into your network.

Rules.zip
MalleableProfilesYARA.zip
Rules-v2.zip
  • c&c
  • c2
  • cobalt strike
  • detection
  • hunting
  • malleable profile
  • NWP
  • packets
  • use cases
Rules.zip
16 KB
MalleableProfilesYARA.zip
Rules-v2.zip
3 Likes
3 Comments

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

  • Comment
Latest Articles
  • Advanced HTTP and TLS Concepts (Video)
  • Using NetWitness to Detect Command and Control: SILENTTRINITY C2
  • FirstWatch Threat Spotlight – Remcos RAT
  • FirstWatch Threat Spotlight: The LockBit Conundrum - A Glimpse into Ransomware Warfare
  • Content Hygiene – Application Rule Alert Mapping Updates
  • Microsoft Azure Log Analytics workspace integration with Netwitness
  • FirstWatch Threat Spotlight: Cryptonite Ransomware
  • Deployment Inventory (Serial Numbers)
  • The History of APT10
  • Integration of Symantec Endpoint Security with Netwitness Platform
Labels
  • Announcements 63
  • Events 8
  • Features 11
  • Integrations 12
  • Resources 66
  • Tutorials 31
  • Use Cases 27
  • Videos 118
Powered by Khoros
  • Blog
  • Events
  • Discussions
  • Idea Exchange
  • Knowledge Base
  • Case Portal
  • Community Support
  • Product Life Cycle
  • Support Information
  • About the Community
  • Terms & Conditions
  • Privacy Statement
  • Acceptable Use Policy
  • Employee Login
© 2022 RSA Security LLC or its affiliates. All rights reserved.