Stephan Berger Profile picture
Aug 6 25 tweets 11 min read
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

Aug 1
1/ @ZephrFish and @myexploit2600 presented "Paving The Way To DA" at this year's @Steel_Con.

A few thoughts on the topics mentioned in the talk 🧵:

1⃣MFA, Password Spraying, Common Passwords
2⃣RDP Shadowing
3⃣MFA spamming
4⃣Password in Shares
5⃣GPP
6⃣Sam the admin
2/ 1⃣ A popular initial vector they often use is Citrix without MFA.

This is also a classic from our IR cases, where either the password was found out with password spraying (the user used a weak password), or the user was phished beforehand.
3/ MFA is a MUST for any remote access.

If Azure AD is used, Azure Active Directory Password Protection could be used, which checks the password from the user against a global blocklist or a configurable blocklist [2] (this is done when the user changes the password).
Read 15 tweets
Jul 27
1/ We analyzed a breached server and found the IP address and domain from which the TA downloaded additional tools onto the server.

The initial breach happened a few months ago, but the TA uses the same server till today. 🧵
2/ Because of an open-dir, we can see various tools and scripts placed (and replaced over time) on the server by the TA.

Following are some takeaways from the analysis of the arsenal of the TA:
3/ One hosted tool on the server is KrbRelayUp.exe (717fccf1e6081d012f06d24872563529), a compiled version from the GitHub repo of the same name. [1]

The binary is quite well known at VT with 38 AV detections [2], but that doesn't seem to bother the TA as there are also various
Read 18 tweets
Jul 25
1/ In one ransomware case, the attackers started an EXE file that dropped the vulnerable GIGABYTE driver to C:\Windows\System\gdrv.sys.

The TA used the vulnerable driver to load a malicious driver as a kernel driver, who hunted and killed Symantec processes. 🧵

#CyberSecurity
2/ The same procedure was described in detail by @SophosLabs before [1]:
3/ "64-bit Windows computers have a mechanism called driver signature enforcement which means that Windows only allows drivers to be loaded that has been properly signed by both the manufacturer and Microsoft.
Read 20 tweets
Jul 22
1/ "PDQ Deploy is a software deployment tool that allows system administrators to silently install almost any application or patch to multiple Windows computers simultaneously." [1]

We have investigated a ransomware case where the TA used PDQ to carry out the encryption. 🧵
2/ I guess we are late to the party 😂

@SecurityAura has already handled various cases involving PDQ Deploy in November 2021:
3/ PDQ Deploy comes with different license models, but with the free license, simple packages can be deployed, and the attacker can conveniently select the targets for deployment, including the entire AD.
Read 15 tweets
Jul 22
1/ Although Windows logs the creation of new services in the SYSTEM event log (Event ID 7045 - New Service was installed), attackers often delete these logs.

But we can use the Windows Firewall event logs for #ThreatHunting new installations (of backdoors) 🧵

#CyberSecurity
2/ The screenshot above shows the 2004 Event ID (the creation of a new firewall rule).

The screenshot is from an actual case where the attacker installed Splashtop as a backdoor (among others) to get back into the network.
3/ Using @velocidex Velociraptor and the EvtxHunter Hunt, we can conveniently collect these event logs on all clients and servers in the network.
Read 6 tweets
Jul 17
1/ IR tip: During the first conversation with the affected customer, ask for their public IP range(s).

Next, check this IP range on @shodanhq (filter: "net:<ip>/<subnet>"). This has two advantages: 🧵

#CyberSecurity
2/ We might find vulnerable systems within the perimeter which may have been exploited and employed to enter the network.
3/ Secondly, Shodan may also show us the (various) VPN endpoints of the customer.

Especially in the case of active attackers who entered the network via VPN (with valid credentials obtained via phishing or an exploit),
Read 9 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 on Twitter!

:(