As promised in the previous blog, I will share my understanding on the dotNet header and how to parse it.

dotNet CLI header is found in .text section of the PE file. We only need to focused on this section to make things work ✌.

Thanks for the help of CFF Explorer and dnSpyto make this happen 🙌.

Calculate dotNet MetaData Directory Starting Offset

Basically this is the formula from RVA2OffSet.

  1. Check is VA of .text is larger or equal to VA of dotNet MetaData Directory

Hey guys! Just released a tool named ✨ pydotNetCLI ✨ that make my life easier when extract the resource file from dotNet malware samples as we know dotNet resource file stored inside dotNet CLI header which is not from the .rsrc section of the PE file. In this initial version, I will just focusing on the resource extraction and hopefully will add more header information or functions if time allows.

The initial intention of this tool just to improve my understanding on the dotNet CLI header structure, but it ends up as a resource extractor 🤣.

Screenshot

Output from pydotNetCLI 😉

Will make a explanation on how I parse it in the next blog post!

Next blog post over HERE!!

Link to the GitHub

https://github.com/ghoulgy/pydotNetCLI


What is the capability of icalcs 🤔 and how does the malware 😈 abuse it during their operation.

Based on ss64.com, it is capable of:

Change file and folder permissions — display or modify Access Control Lists (ACLs) for files and folders.
iCACLS resolves various issues that occur when using the older CACLS & XCACLS

Some of the common icacls parameter that malware used are /deny and /grant. Sometimes, malware abuses takeown (Used to take ownership of a file) and icacls /reset execution combo to get access of certain service.

As what I found, malware will execute icalcs to
- Prevent…


Using Qiling to automate WinApi hash finding tasks and also did a lazy quick win against stack string obfuscation.

Before working on that, make sure download the requirement dlls and registries into your work folder (e.g. ~/qiling/examples/rootfs/x86_windows)

You can get the collector script 📜 here :
https://github.com/qilingframework/qiling/tree/master/examples/scripts

Basically, in order to work with the emulation, it is better to identify:
✔ Desired section of the code that will be execute by the tool (e.g. hashing algorithm)
✔ Getting its start and end address which then will put them into ql.run for execution later
✔ Identify any arguments/registry (eax/ql.reg.eax, ebp/ql.reg.ebx etc.)/stacks that needs…


Normally in order to disable some windows related service (e.g. Windows Defender, or certain registry key or files) always required higher/another level of privilege to do it. For example, SolarWinds escalated its privilege to disable windows defender service by abusing privileges constant such as SeDebugPrivilege. Therefore, in this story, it will show how Snake malware perform an escalated action via AdvanceRun.exe on its removal script via a service account TrustedInstaller to disable Windows related services.

It is not a priv. escalation as it still requires admin privilege to run AdvanceRun.exe

Even if your are in an admin account, there are…


Most of the Android Malware will request for Android’s Accessibility Services (AAS) before it execute any malicious activities.

Good read regarding to AAS -> HERE

App Source

https://twitter.com/ThreatFabric/status/1346807891152560131

Initial Phase, Gate to Open the AAS

Usually it can be find in the app’s “entry point” since it is the gate for the malicious play 👹 👺

Action & Category to look for:

<action android:name=”android.intent.action.MAIN”/>
<category android:name=”android.intent.category.LAUNCHER”/>

Android Manifest.xml

In the class MainActivity, the app will pop out a alert dialog for user to enable the AAS.

Request Accessibility Access


Most of the C# malware will load the decrypted loader module in memory to avoid signature based detection. The In-Memory file loader can be done by using [System.Reflection] Assembly Class which will load the file (.dll etc.) bytes into it and invoke/call any function that found inside the loaded file.

Some good reading on C# .Net Assembly.

Overview for C# Assembly Loader in action of a certain malware

Here is my analysis of the Darkside ransomware.
Will attach more screenshot regarding of my analysis this time 😏

Didn’t connect to the C2 during the analysis

Dynamically Resolve Windows API

Elevate Privilege (If running in Non-Admin privilege)

Utilizing COM bypass UAC privilege (When Access Token Method Failed)

Elevation:Administrator!new:%s

Get access token from admin process (e.g. Explorer.exe)


Most of the malware nowadays are using custom string decoding algorithm to hide the juicy strings that provide key information of sample. It will be great if we are able to decode all the string and add them in the code comment so that we can analyze is side-by-side and understand the malware better. As for this, I had wrote a Ghidra decoding script in Python for Qakbot.

Find the decryption algorithm

Based on the experience, malware will always declare certain function many times for its decoding routine.

After poking around with it, function FUN_10010eff seems have something juicy since it loads some hex…


This is a Windows C++ reversing challenge created by me for the University CTF challenge. Will using Ghidra, xdbg64 and brainz to solve it.

This challenge is inspired by the malware which perform code injection in its own child process and malware which create mutex to control the execution flow. Don’t Sum Ting Wrong here and there plz 😋

Overview

The sample will duplicate self process and pipe out the to read to file’s text stream from parent to child process.

Later it will check does the text.txt exist in the same directory.

If yes, then it will continue to read…

GhouLSec

Typical memes addict🐒 GitHub: https://github.com/ghoulgy 🍕Support my work: https://www.buymeacoffee.com/GhoulSec

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store