Skip to content

add .NET TickCount anti-debug sample#304

Open
aryanyk wants to merge 2 commits intomandiant:masterfrom
aryanyk:add-dotnet-tickcount-sample
Open

add .NET TickCount anti-debug sample#304
aryanyk wants to merge 2 commits intomandiant:masterfrom
aryanyk:add-dotnet-tickcount-sample

Conversation

@aryanyk
Copy link
Copy Markdown

@aryanyk aryanyk commented Mar 21, 2026

This PR adds a minimal .NET sample demonstrating timing-based anti-debug behavior using Environment.TickCount and Thread.Sleep.

The sample was created to support capa rule development for detecting timing-based debugger checks, as discussed in capa-rules issue #596.

The binary triggers detection for repeated reads of Environment.TickCount combined with Thread.Sleep.

@mike-hunhoff
Copy link
Copy Markdown
Collaborator

@aryanyk lints are failing - please ensure all lints pass locally before requesting another review.

ERROR:capa.tests.data:invalid file extension: TickCountAntiDebug.dll

@aryanyk aryanyk force-pushed the add-dotnet-tickcount-sample branch from 612a919 to 0d740bc Compare March 28, 2026 10:21
@aryanyk
Copy link
Copy Markdown
Author

aryanyk commented Mar 28, 2026

Hi @mike-hunhoff

Can you please run the CI . I have fixed the linting Issue

@mike-hunhoff
Copy link
Copy Markdown
Collaborator

@aryanyk lints are failing - please ensure all lints pass locally before requesting another review.

@aryanyk
Copy link
Copy Markdown
Author

aryanyk commented Mar 31, 2026

@mike-hunhoff

Thanks for the feedback!

I tracked down the lint failure to the sample filename and updated it to follow the capa-testfiles convention (MD5-based filename with the appropriate .dll_ extension). I verified locally by running .github/check_sample_filenames.py on the sample, which now passes.

The PR has been updated accordingly. Please let me know if any further changes are needed.

image

@mike-hunhoff
Copy link
Copy Markdown
Collaborator

@aryanyk there are now two files. Please fix.

@aryanyk aryanyk force-pushed the add-dotnet-tickcount-sample branch from ba3f5ff to 440af12 Compare April 3, 2026 12:26
@aryanyk
Copy link
Copy Markdown
Author

aryanyk commented Apr 3, 2026

Thanks for pointing that out! @mike-hunhoff

I’ve removed the extra file and updated the PR so that only the correctly named sample is included. The diff now contains just the intended file.

Please let me know if everything looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants