(W/C) Script Debugging

Readers will recall that in my “Man In The Proxy” blog post, a malicious JScript file (Flash-2017.js) was used to download and execute a banking malware targeting the system. In that article, I mentioned that this obfuscated (encoded) JScript file could not be easily analyzed through a web browser, as outlined in my “Malicious JavaScript Analysis” post. The reason for this was that the JScript file required ActiveX and WScript to function. (“WScript is not defined”, “ActiveXObject is not defined”). In cases where the JScript file cannot be analyzed with a browser, you can use both Visual Studio and the free version, Visual Studio Express, for analysis.

Wscript Debugging
Wscript Debugging

According to Wikipedia, Microsoft Windows Script Host (WSH) (formerly known as Windows Scripting Host) is a scripting automation technology for the Microsoft Windows operating system that offers far more features than BATCH files. One of its key advantages is its support for multiple scripting languages (JScript, VBScript). As a side note, for debugging VBScript, you can also use a tool called VbsEdit, which is worth mentioning

In such cases, to quickly analyze a JScript file, you should first define the debugging parameters specified by Microsoft under the Tools -> External Tools menu in Visual Studio. Afterward, open the JScript file you want to analyze in Visual Studio, and then select the WScript you defined earlier from the Tools menu to easily begin analyzing the JScript file.

Wscript Debugging
Wscript Debugging

When we begin step-by-step debugging and analyzing the JScript file named Flash-2017.js, we can observe that the code removes the characters /* and */ that mark the beginning and end of comment lines.

Wscript Debugging
Wscript Debugging
Wscript Debugging

Next, the functions ddfddfdcccbcaf() and acfabbfabdd(), which sequentially decode the hidden data within the script, will immediately catch our attention. If our goal is to quickly reach the decoded version of the hidden data, we can place a breakpoint at the return statement at the end of the acfabbfabdd() function. This allows us to easily and quickly access the decoded data.

Wscript Debugging
Wscript Debugging

For those who don’t want to deal with Visual Studio and debugging, they can write a simple JScript code to quickly decode the hidden data by utilizing the relevant functions, as shown in the screenshot below.

Wscript Debugging
Wscript Debugging

As we approach the end of the analysis, we can see that the JScript file sends a request to the address http://highetave.xyz/gete14.php?ff1, and each time, the response from the web server is different (Server-side polymorphism). After learning that the numeric value before the ||| delimiter is also used to decode the hidden data, we observe that the data decoded by the functions mentioned earlier is saved to disk under the name 0c03.exe (md5: dcfb9cab318417d3c71bc25e717221c2), and then executed. As a result, in situations where web browsers are insufficient for analysis, malicious JScript and VBScript code can be quickly analyzed using Visual Studio debugging, helping you find answers to the questions you have in mind.

Cyber Criminals

Introduction In recent years, high-profile cybersecurity incidents involving major entities such as Uber, Airbus, Grand [...]

Scammers Using Deepfake Technology

Introduction As of May 2024, the revolution and advancement of generative artificial intelligence continues to [...]

Troll Hunting

IntroductionIn recent times, the significance of cyber threat intelligence for organizations has grown substantially. Consequently, [...]

Mini Tehdit İstihbaratı

In today’s world, where detecting and preventing targeted cyberattacks against organizations is crucial, a low-interaction [...]

My House, My House, My Safe Place

Towards the end of 2022, when my spouse and I made the decision to settle [...]

Matryoshka

As a security researcher who trusts my instincts, I’ve been feeling the need to monitor [...]

How I Gained Control Over My Smart Grill

The Russian Military Intelligence Department (GRU) targeted Emin Baylarov, a high-ranking bureaucrat, by deploying the [...]

Pineapple, Reality: GL-AR150

As someone who has spent years using ADSL modems provided by internet service providers and [...]