Stephan Berger Profile picture
Aug 6, 2022 25 tweets 11 min read Read on X
1/ #ThreatHunting for #AsyncRAT

We have various ways to find infected hosts with AsyncRAT:

1⃣ Usage of standard C2 ports
2⃣Hunting for persistence
3⃣Mutexes FTW
4⃣Last but not least, hunting for dropped DLLs

Let's go 🤠🧵

#CyberSecurity
2/ AsyncRAT is a popular Trojan executed at the end of an infection chain on target computers.

@hpsecurity ([2],[3]) and @Trellix ([4]) have both reported in recent reports that TAs have been deploying AsyncRAT.
3/ Since the source code of AsyncRAT is publicly available [1], we can obtain a copy to investigate and build detection capabilities for this RAT.
4/ Three default ports are already populated within the builder, where we can assemble a client (6606, 7707, 8808).

Additionally, the C2 address can be stated, which the client should connect to after a successful infection. It's possible to store the C2 address on Pastebin.
5/ In the analysis of almost 500 AsyncRAT samples from MalwareBazaar (@abuse_ch), the top three ports for the C2 were indeed 6606, 7707, and 8808!

That means that many TAs didn't bother to change the default port within the builder ☝️

Screenshot from [5].
6/ Also, all samples available on Bazaar used a C2 port higher than 1024.

This Information is helpful for targeted hunts within the firewall logs (connections to IP addresses to the Internet on high-ports - beware: may return many hits).
7/ In the builder, you can specify if a persistence should be set up or not.

If the field is checked, we can choose a filename and select the directory where the payload will be saved (per default, only two directories are available).
8/ AsyncRAT uses a mutex to detect already infected systems.

The prefix of the mutex "AsyncMutex_" was also mentioned in @hpsecurity's tweet[6], which again indicates that attackers accept the defaults (which is good for us defenders!).
9/ Interestingly, we can "clone" the information about the binary from another binary for blending in.

In the example, I took the information from the legitimate PingCastleCloud binary - the builder then uses the same information for the malicious binary.
10/ We can also force an obfuscation of the .NET code to slower down reverse engineering.
11/ Our sample built this way comes straight to a VT score of 48 - anything but unknown, which is also shown by the various YARA hits.
12/ After running this newly built sample (in the various reports and tweets referenced so far, AsyncRAT is run at the end of an entire infection chain) on our lab machine, we see that our infected machine has reported back to the controller.
13/ AsyncRAT now has various functions built-in that can be used to further extend the initial access, for example, "Password Recovery".

If the function "Password Recovery" is selected, we see in the logs that a DLL (Recovery.dll) was sent to the client.
14/ Also, when using other plugins, AsyncRAT sends specific files (dll's) to the client.
15/ Time for @velocidex Velociraptor 😍

With the MTF-Hunt, we search for the plugin-names on our infected client and find the plugins directly placed under C:\.

All other plugins are stored in this directory (we see the filenames visible in the log (RemoteDesktop.dll, etc.)).
16/ To get a list of all plugins available within AsyncRAT, browse to the public GitHub repo.
17/ The LimeLogger plugin for recording keyboard strokes works fine, recording all keystrokes on our test machine.
18/ Using Velociraptor's Mutants-Hunt and the string "AsyncMutex_", we can also find AsyncRAT infected machines.
19/ AsyncRAT distinguishes between two types of persistence ([7]).

Either the installer is run with admin privileges, in which case a Scheduled Task is created, or a new entry in the Run Key as an unprivileged user. Below is the relevant code.
20/ In the first example, the sample was installed as an unprivileged user, resulting in a new run key.
21/ The THOR APT scanner matches the AsyncRAT samples based on the Rule "Reversed String" - the run key within the code used for persistence ([7]).

Probably noisier than stealthier 🤔
22/ Below is the newly created Scheduled Task (installation with admin rights) - the executable is again placed in AppData\Roaming (one of the two options in the builder).
23/ By the way, AsyncRAT also can show a UAC prompt to the user to get admin rights.

In my tests, this feature worked well. After confirming the UAC prompt, AsyncRAT had admin rights on the machine.
24/ Sifting through the code, there would be more detection possibilities and keywords to hunt and create alarms.

But with the few indicators presented in this thread, we can hunt for AsyncRAT infections pretty effectively.

Good luck 🍀

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Stephan Berger

Stephan Berger Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @malmoeb

Jun 16, 2023
1/ We recently had an interesting #Azure case where the TA, instead of creating a new Inbox Rule, added email addresses of interest to the list of blocked senders and domains.

The incoming emails will get flagged as spam and moved to the Junk email folder. 📂

🧵
2/ Here is a screenshot from Outlook web access

(the view might differ, as, for example, here on the screenshot from the theitbros [1]) Image
3/ And here from an Outlook client: Image
Read 11 tweets
Apr 18, 2023
1/ Customer receives an email from a network monitoring device that a host is supposedly infected with a #CoinMiner. The Task Manager on the said system shows the following screenshot 🤕.

A story of an unpatched system, incorrect scoping, and 🍀. 🧵

#CyberSecurity Image
2/ The affected (and remotely accessible) server have had Confluence installed.

One of my first questions I asked the customer was if the system was up to date (Spoiler: it wasn't).

Confluence 6.0.4 was installed at the time of the incident.
3/ Confluence 6.0.4 was released in January 2017 🤯 Image
Read 14 tweets
Apr 17, 2023
1/ I used #AutoRuns v14.09 (GUI) in my lab setup but noticed that it failed to find (or display) the malware in the Startup folder, although the file is there (screenshot below).

I checked back and forth, searched manually for the file, and restarted the OS and AutoRuns.

🧵 Image
2/ With #Velociraptor, I ran the hunt Sysinternals.Autoruns, and with the CLI version of AutoRuns, the malware is found in the Startup folder. Image
3/ The same for the #Velociraptor hunt Sys.StartupItems. Image
Read 4 tweets
Mar 21, 2023
1/ The content below is from a file named install.bat and stems from a recent investigation where a TA launched this batch file. 👀

What's going on?

Well, VboxUpdate.exe is, in fact, tor.exe, and a new service is created, launching tor with a config file.

🧵 #CyberSecurity Image
2/ Below is an excerpt from the content of config.txt; the configuration file passed as an argument to the tor service.

If you think this looks a lot like RDP Tunneling, you are absolutely right. 🥇 Image
3/ Head over to the allthingsdfir blog to read a more profound write-up about the techniques used here and how they work together.

allthingsdfir.com/rdp-over-tor/
Read 5 tweets
Mar 20, 2023
1/ Real-World #PingCastle Finding #13: Allow log on locally

➡️ Domain Users are eligible to log into DC's 🤯🙈

"When you grant an account the Allow logon locally right, you are allowing that account to log on locally to all domain controllers in the domain." [1]

#CyberSecurity Image
2/ Why is this a bad idea?

"If you do not restrict this user right to legitimate users who must log on to the console of the computer, unauthorized users could download and run malicious software to elevate their privileges." [1]
3/ I encountered this finding several times in our AD assessments, so you better check your settings in your domain right now (better safe than sorry 🔒).

Good luck 🍀
Read 4 tweets
Mar 18, 2023
1/ Do you monitor newly created services within your environment, and would you notice when a (vulnerable) driver is loaded?

The screenshot below (#Velociraptor 🤩) is from a recent #XMRig CoinMiner investigation ⤵️

🧵 #CyberSecurity
2/ We talked about vulnerable drivers before:

Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(