persistence: restrict registry-based service detection to service-specific values (fix #1100)#1126
Open
reyyanxahmed wants to merge 1 commit intomandiant:masterfrom
Open
Conversation
…fic values Fixes mandiant#1100 — false positive in persist via Windows service rule. The registry-based detection branch previously matched ANY registry write under Services\*, which caused false positives for benign operations like modifying NetBT network parameters (NetbiosOptions under Services\NetBT\Parameters\*). Added a requirement for service-specific registry value names: - ImagePath: the service binary path (primary persistence vector) - ServiceDll: svchost-hosted service DLL path - FailureCommand: command executed on service failure (abuse vector) This eliminates false positives from registry writes to service parameter subkeys that don't control service execution behavior, while preserving detection of all three main registry-based service persistence techniques.
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.
Fixes #1100 - false positive in persist via Windows service rule.
Problem
The registry-based detection branch (third
orbranch) matches ANY registry write underServices\*, causing false positives for benign operations. The sample in #1100 modifiesNetbiosOptionsunderServices\NetBT\Parameters\Interfaces\Tcpip_*- a legitimate network configuration change unrelated to service persistence.Fix
Added a requirement that the registry value name must be one of three values that actually control service execution:
ImagePath- the service binary path (primary persistence vector)ServiceDll- svchost-hosted service DLL pathFailureCommand- command executed on service failure (abuse vector)This eliminates false positives from writes to service parameter subkeys (like
NetbiosOptions,Parameters,Security) that don't control service execution, while preserving detection of all three main registry-based service persistence techniques.Validation
capafmtoutput matches (no reformatting needed)lint.pypasses (only warnings are missing local sample files)