Sunday, March 23, 2025

The New Face of PowerShell: Ransomware Powered by PowerShell-Based Attacks

 


Summary

 

The PowerShell for writing malicious code is a normal way, and in the past, usually PowerShell itself was played as a supporting role, like executing cmdlets or loaders, but the trend is now to be changed. To make a ransomware, totally with pure PowerShell, is never seen before, and recently many samples were discovered, which attracted me to learn from what happened.

 

Technique analysis

 

The PowerShell ransomware samples have the same abilities, such as deleting shadows, stopping interfering processes, disabling the defender, spreading to the network, and adding registry persistence, and so on; the whole thing is done by the only PowerShell.

 

Third party software encryption scheme

One of the PowerShell ransomware is to utilize third-party encrypt free software called VeraCrypt to help encrypt the data of the drive; it will download from the remote address https[:]//Launchpad[.]net/veracrypt/trunk/1.25.9/+download/VeraCrypt_Setup_x64_1.25.9[.]msi and install VeraCrypt when the PowerShell is executed.

The sample MD5 hash: 982433cb4f485fb6f3cd9fb32cce3bb2

Fig.1 Third party VeraCrypt scheme by PowerShell


The samples MD5 hashes:

f3b663ef29fd2f8b41cdcf17b4a4300d

ffef1e40446902adc8071354fd39c1c6

Fig.2 Third party VeraCrypt scheme by PowerShell

 

RSA and AES encryption scheme

One of the PowerShell ransomware's purposes is to encrypt the data of potential victims by combining both the RSA and AES algorithms, which is a common solution by other ransom groups. Here without talking about the detail of encryption, like how to save the AES key and IV and how to use the public key.

The samples MD5 hashes:

118bd1887d7a1f825826e3a00f06b98e

4e7fd80028d4d0b227d48da1843762ab

Fig.3 RSA+AES scheme by PowerShell

 

 

Conclusion

As you know, like another ransomware group, their source code was leaked, and then more threat actors will emerge. The PowerShell scripts will become more popular for writing more powerful malicious code. Obviously, it will be utilized more, and its previously subordinate role will also change as people see more cases. And on those samples without any obfuscation technique, it would be changing.

 

IOCs

Files:

982433cb4f485fb6f3cd9fb32cce3bb2

f3b663ef29fd2f8b41cdcf17b4a4300d

ffef1e40446902adc8071354fd39c1c6

118bd1887d7a1f825826e3a00f06b98e

4e7fd80028d4d0b227d48da1843762ab

 

End.


Ransom note graphic representations


──────────────────────
Seeker(李标明) · @clibm079    
China · Independent Malware Analyst & Researcher 

Labels: , , , , ,

Thursday, March 20, 2025

The Art of Evasion: How Attackers Use VBScript and PowerShell in the Obfuscation Game

 


Summary

 

As we know, using obfuscated VBScript to execute obfuscated PowerShell is a common technique in malware to evade detection and complicate analysis. This approach leverages the strengths of both scripting languages while making it harder for security tools and analysts to understand the malicious intent.

 

Recently I came across a malware that is very well-designed for these obfuscation techniques to use, which is so interesting and attracted my curiosity to learn more about what’s happened inside the malware, and it was also low detection rate until first discovered.

 

Below, I would like to share how the attackers use VBScript and PowerShell to evade detection, maybe it can help other malware researchers or analysts, and the common technique but new doing uncommon which being talked on both VBScript obfuscation and PowerShell obfuscation.

 

 

Technical analysis

 

Basic info

The sample hashs:

md5 0e513e80fc18e3db4f0eb6ecb558534b

Sha256
7444d08579781b3d7b233e9fd3e7f9b31a85837c29adf2f4ae7965a628078639

 

 

VBScript obfuscation and evasion technique

In order to execute the VBScript, the attacker uses a mix of obfuscation that combines irrelevant comments, time-based delay, string splitting and concatenation, and dynamic behavior. It is very thoughtful. In addition, the structure of the VBScript code seems to intentionally disrupt logical order to interfere with analysts.

 

 

Adding Irrelevant Comments

The first sight is that the malware was inserted by a large number of difficult-to-understand comments or annotations, which seem like the stream of consciousness in monologues or novels or random text; its aim is to have a mind to interfere with or confuse or mislead information with analysts and antivirus.

Fig.1 a large number of understandable annotations for interfering

 

Ok, in order to do an analysis for this kind of malware, it is a time-consuming thing to remove all the annotations manually. The first thought is to use regular expression; a text editor like Sublime can help us to handle them. To replace all the single-line comment content with regular expressions is '.*$, but it should be done carefully because the obfuscation PowerShell will be replaced and should be checked later one by one.

Fig.2 regular expressions

 

 

Time-Based Obfuscation

Using time delays or conditions to execute parts of the script only after a certain time. Malware often uses time delays to evade sandbox detection and avoid immediate detection. Here, the VBScript code snippet appears to be a time-delay loop, starting a loop that continues until the current time Now() exceeds Suspensorium (i.e., for 9 seconds), and then it will loop 50 times and pause the script for 100 milliseconds (0.1 seconds) during each iteration of the loop, and the real PowerShell scripts will be executed when it Suspensorium exceeds 50.

Fig.3 VBScript Time delay to execute PowerShell

 

Combining obfuscation technique

The below VBScript code snippet demonstrates a malware evasion technique that combines time-based delaysstring obfuscation, and dynamic behavior.

1.       String Obfuscation: pronegotiation= array(79+1,79,87,69,82,83,72,69,76,76), The array contains ASCII codes for the characters in the string "POWERSHELL"

2.       Time-Based Evasion: Checks if the current time (Now()) is less than the value of Suspensorium

3.       Dynamic Behavior: The script behaves differently depending on the current time

Fig.4 combining obfuscation technique

 

String splitting and Concatenation

 using ChrW(34) to concatenate strings that include double quotes, and using Chr(99) instead of the literal character 'c' makes the script harder to read and analyze; the command executes splitting to “Exe + chr(99) + “ute.”

Fig.5 VBScript String splitting and Concatenation

 

 

 

PowerShell obfuscation and evasion technique

In order to execute the PowerShell in VBScript, the attacker uses a user-defined algorithm and heavily obfuscates strings. It is different from other APT groups that use mature algorithms for obfuscation of strings; the attacker is very professional.

 

String splitting and Concatenation

The PowerShell code, the string splitting by well design in VBScript, and using the variable Hennafarvedes and character “&” for concatenation. And the variable in VBScript becomes a bridge in PowerShell scripts.

Fig.6 PowerShell String splitting and Concatenation

 

 

Specific Algorithm for Deobfuscated Script

The real intents in the well design strings, it extracts the characters by a specific algorithm with hardcode value It iterates over the array, starting at index 4 and incrementing by 5 each time. The function returns the concatenated string.

Fig.7 specific algorithm for deobfuscated script

 

 

String obfuscation with inserting invalid characters

The below strings obfuscation technique is also very special; the valid characters are only used as a small part of them and used by a user-defined algorithm to extract them, but the unused strings are like random characters to insert and confuse analysts, like pouring a pile of garbage into a real PowerShell to conceal the attacker's intentions. From the above specific algorithm and hardcoded value, we can get a glimpse of being proficient in the use of obfuscation techniques by the attackers.

Fig.8 strings obfuscation


The real intent
From the above analysis, do further research analysis; the PowerShell script can download the payload from the remote URL address hxxps[:]//aghayezayeat.ir/kids/tyrosines.lzh and finally execute the payload. Here it is not special, and the URL can’t be accessed until now.

Fig.9 PowerShell snippet

 

 

Conclusion

From the above process of analysis, it shows that the attacker is very professional on combining different type of obfuscation techniques to do evasion and being proficient in programming, the malware sample tells cybersecurity community, the attacker always look for breakthroughs in defense and are very proactive, a more hidden threat around the digital world; let’s pay close attention.

 

 

IOCs

Files:

SKMBT20783_ZM.vbs md5 0e513e80fc18e3db4f0eb6ecb558534b

Sha256
7444d08579781b3d7b233e9fd3e7f9b31a85837c29adf2f4ae7965a628078639

 

Network:

hxxps[:]//aghayezayeat[.]ir/kids/Tyrosines.lzh

hxxps://aghayezayeat[.]ir/529/eiRBgmsetYWnjJJIug45[.]bin ( from vmray Platform)

185[.]159.153.133

 

Host:

C:\Users\kEecfMwgj\AppData\Roaming\Hikes.Ove

End.


──────────────────────
Seeker(李标明) · @clibm079    
China · Independent Malware Analyst & Researcher 

Labels: , , , , ,

Wednesday, February 12, 2025

The North Korean nation-state APT43 Kimsuky used the PowerShell forceCopy to conduct spear-phishing analysis

 

Summary

From the AhnLab SEcurity intelligence Center (ASEC) I noted that Theft of Web Browser Information (forceCopy) which malware are PowerShell scripts, and I have collected three malwares, they have similar design, I choose one of them to analysis. The design of the PowerShell script used by obfuscation technology from Kimsuky is worthy of more attention, especially nowadays as AI is developing fast; it makes malware makers and analysts more easily able to do their jobs.

 

Technical analysis

This forceCopy is the PowerShell (executable).

The hash MD5: 1e9d94d88fdac3c4a0a47a3a1d07e329

 

The source code is difficult to read, so I did it manually and made it easy to read. These codes are a small part of them.

1. It defines a function (stored in the variable $mqtz60) that takes an array of strings ($vvv32) as input;

2. For each string in the array, it decodes the string from Base64, converts the resulting  byte array to a string and then executes the resulting string as PowerShell code.

3.The variable $xya0 and it long string and The range [88..2]
     means it takes characters from index 88 to index 2 in reverse order ,
     This is unusual and likely part of the obfuscation.
4. And the other variables $ipv1, $wxa2, $qwe3, $ycf4, $pvd5 are similar, 
   the variable $aegk6  connects with them. 

Figure1-source code Optimized in format


Just using “Write-Output” to print the decoded string instead of executing it, and finally we can get the decrypted source code. This PowerShell script snippet performs several operations, including interacting with Google Drive, executing a PowerShell script, and handling output and uploading it with an access token.

Figure2- decrypted strings


Of course, normally here to change the code to get tmps4.ps1, but I had not found it. Maybe it plans to run a keylogger or other malware to steal victim information. The access token is embedded inside PowerShell, including the other parameters like folderId, clientId, and secret.

Figure3-token paramers


IOCs

(Md5)

1e9d94d88fdac3c4a0a47a3a1d07e329


Conclusion
The Kimsuky threat group is continuously updating malware and launching spear phishing attacks against their targets. It is so hot for their campaign and also is a huge threat to the economic world.

End.


──────────────────────
Seeker(李标明) · @clibm079    
China · Independent Malware Analyst & Researcher 

Labels: , , ,