This rule detects the presence of MinGW-compiled binaries, which adversaries may use to create lightweight, native Windows executables that bypass standard .NET or PowerShell-based detection mechanisms. Proactively hunting for these artifacts helps the SOC identify potential custom tooling or implant components that could be used for initial access or lateral movement within the Azure environment.
rule MinGW_1
{
meta:
author = "_pusher_"
date = "2016-07"
strings:
$a0 = "msvcrt.dll" ascii nocase
$aa1 = "Mingw-w64 runtime failure:"
$aa2 = "-LIBGCCW32-EH-3-SJLJ-GTHR-MINGW32" wide ascii nocase
$aa3 = "_mingw32_init_mainargs"
//too wild ?
$aa4 = "mingw32"
$aa5 = "-LIBGCCW32-EH-2-SJLJ-GTHR-MINGW32" wide ascii nocase
$aa6 = "-GCCLIBCYGMING-EH-TDM1-SJLJ-GTHR-MINGW32" wide ascii nocase
$aa7 = "Mingw runtime failure:"
condition:
(
(pe.linker_version.major == 2) and (pe.linker_version.minor == 56 ) or
(pe.linker_version.major == 2) and ((pe.linker_version.minor >= 21) and (pe.linker_version.minor <= 25))
)
and
($a0 and (any of ($aa*) ))
}
This YARA rule can be deployed in the following contexts:
This rule contains 8 string patterns in its detection logic.
Scenario: A developer or build engineer uses the mingw32-make or make executable to compile C/C++ source code for a cross-platform application or open-source library integration. The YARA rule likely matches the specific byte patterns or string signatures within the make binary or the resulting compiled object files that resemble MinGW toolchain artifacts.
code.exe, devenv.exe, idea64.exe) or a build system daemon (e.g., msbuild.exe, gradle.exe, npm.exe). Alternatively, exclude files located in standard development directories like C:\dev\, C:\src\, or C:\builds\ if the rule targets file hashes or specific path patterns.Scenario: An automated scheduled task runs a legacy utility script that invokes a MinGW-compiled helper tool (e.g., curl.exe, wget.exe, or a custom checksum.exe) to perform routine network health checks or file integrity verification. These binaries are often distributed as standalone MinGW executables for their portability, triggering the signature match.
svchost.exe with Tasks argument) or specific known service accounts (e.g., DOMAIN\svc-monitoring). Add an exclusion for specific file paths where these utilities are stored, such as C:\Program Files\Monitoring\bin\ or C:\Tools\utils\.Scenario: A software installer or updater for a third-party application (e.g., Git for Windows, Python, or Node.js) extracts MinGW-based DLLs or executables to a temporary directory or the application’s installation folder. The YARA rule may match the embedded MinGW runtime libraries (e.g