Add .NET Environment.TickCount timing anti-debug rule#1137
Add .NET Environment.TickCount timing anti-debug rule#1137aryanyk wants to merge 3 commits intomandiant:masterfrom
Conversation
mike-hunhoff
left a comment
There was a problem hiding this comment.
@aryanyk there appears to be unrelated rules included in this pull request. Please remove these unrelated rules. Also, please build the referenced anti-debug .NET project and open a pull request to https://github.com/mandiant/capa-testfiles for the resulting binary so we can ground all related rules, thank you.
3c0d9f8 to
783cb04
Compare
|
Thanks for the feedback @mike-hunhoff I've removed the unrelated rules from this PR. I have also created a minimal .NET sample implementing the timing-based anti-debug technique and opened a PR to capa-testfiles to include this sample: mandiant/capa-testfiles#304 . Please let me know if any further adjustments are needed. |
nursery/check-for-time-delay-via-environmenttickcount-in-dotnet.yml
Outdated
Show resolved
Hide resolved
nursery/check-for-time-delay-via-environmenttickcount-in-dotnet.yml
Outdated
Show resolved
Hide resolved
nursery/check-for-time-delay-via-environmenttickcount-in-dotnet.yml
Outdated
Show resolved
Hide resolved
nursery/check-for-time-delay-via-environmenttickcount-in-dotnet.yml
Outdated
Show resolved
Hide resolved
|
Thanks for the detailed feedback @mike-hunhoff I've addressed the requested changes:
Additionally, I’ve updated the capa-testfiles PR to fix the filename lint issue. Please let me know if any further adjustments are needed. |
|
@aryanyk lints are failing - please ensure all lints pass locally before submitting another review. |
|
@aryanyk lints for the rule are failing now. Please ensure all tests pass locally before requesting another review. Due to limited resources on the maintainers side, if lints fail again we'll need to close this issue without merging. |

This PR adds a rule to detect timing-based anti-debug checks in .NET binaries that rely on repeated reads of
Environment.TickCountaroundThread.Sleep.Issue #596
The technique appears in the
.NET-Anti-Debugproject. A minimal sample implementing the behavior was compiled, features were inspected usingscripts/show-features.py, and the rule was verified to trigger correctly with capa.Example detection:
Additional rules for other techniques in the same project (e.g., WMI-based VM detection and process enumeration) will be submitted in follow-up PRs after validating samples.