feat: new malware sourcecode detection for anti-analysis behaviour#1388
Merged
Conversation
behnazh-w
reviewed
May 6, 2026
added 4 commits
May 7, 2026 11:30
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
8556a40 to
db42f12
Compare
behnazh-w
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new type of source code detection rule called anti-analysis, which focuses on malware that performs operations to check if it is being analysed to inform behavioural decisions.
Description of changes
The anti-analysis rules developed for this PR are informed from analysis of multiple malware samples. The general behaviour observed in these malware included blacklisting known analysis and virtualization tools (e.g. processes, MAC addresses, users, IP addresses) and system characteristics, and actively looking for ways to disable them (e.g. disable Antivirus or remove your signature, elevate privileges to do so). Included in this PR are behaviours that could be generalised into rules that were highly unlikely to appear in a benign python package:
anti_analysis-known-ouis: some malware samples included a blacklist of MAC addresses that would prevent it from running, evidently targeted at detecting MAC addresses often assigned to virtual machines. This rules includes the OUIs of some well-known services (VMware, Virtualbox, Hyper-V) and looks for hard-coded instances of MAC addresses with those OUIs, which likely form such a blacklist.anti_analysis-defender-evasion: some malware samples used Microsoft tools (PowerShell, Registry editing, WMI, CIM classes) to disable part or all of Windows Defender capabilities to evade detection, or remove evidence of detection. Included in this rule are some common patterns used in these code snippets that play a key role in their execution.anti_analysis-ip-checkers: some malware samples would use public, benign IP information services to extract information about the machine they were running on, and evade detection based on this. This sample includes some of the commonly observed domains used for this purpose. This rule is currently disabled in Macaron, however, since matching on the existence of the string domain in a file alone is too broad and prone to false positives (e.g. this would fail when run against theazure-clipackage). At this stage, no useful pattern from the malware samples was observed that could be generalised into a Semgrep rule.defaults.iniis updated to, by default, exclude this rule.Appropriate unit tests have been added to ensure the accuracy of these rules and demonstrate examples of what they are looking for.
Checklist
verifiedlabel should appear next to all of your commits on GitHub.