Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal-dotnet-file-limitation.yml: make it valid for static scope too #990

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

williballenthin
Copy link
Collaborator

@williballenthin williballenthin requested a review from a team February 4, 2025 12:17
@williballenthin williballenthin mentioned this pull request Feb 4, 2025
27 tasks
Copy link
Collaborator

@mike-hunhoff mike-hunhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, capa will print the description and force users to run capa with >= -v option for every .NET file that it analyzes statically:

      This dynamic analysis trace describes a .NET file.

      capa rules are not yet tuned for the .NET runtime, 
      so its analysis may be incomplete or misleading.

This is confusing on two fronts:

  • This dynamic analysis trace describes a .NET file. could confuse users attempting to analyze a .NET file statically
  • capa rules are not yet tuned for the .NET runtime isn't true for static analysis as capa has a robust set of .NET rules and we don't want to turn users away from using capa to process .NET files statically.

@williballenthin I agree with your comments in mandiant/capa#2591 (comment) that a proper fix likely requires many changes. Unfortunately, I think our best option at this time is to exclude this rule until we have time to implement these changes.

@williballenthin

This comment was marked as duplicate.

@williballenthin
Copy link
Collaborator Author

With this change, capa will print the description and force users to run capa with >= -v option for every .NET file that it analyzes statically:

Thanks for calling this out. That wasn't my intention for the logic of capa and the dynamic limitations. These dynamic limitations should only be used to warn users during dynamic analysis.

@v1bh475u would you reproduce this behavior on your side and open a new PR to ensure these rules aren't used to warn for samples in the wrong analysis mode.

@mike-hunhoff agree that in the short term we can remove the dynamic .NET rule

@williballenthin
Copy link
Collaborator Author

@mike-hunhoff are you sure about this? when i run locally in static mode, there's not a warning about .NET files:

image

@mike-hunhoff
Copy link
Collaborator

@mike-hunhoff are you sure about this? when i run locally in static mode, there's not a warning about .NET files:

image

Ah, I guess you're correct that the limitation isn't highlighted because of these checks: https://github.com/mandiant/capa/blob/5467fac1a57c094b6dd466e1c361bcb7f12dd340/capa/main.py#L1001-L1005. However, the rule is matched and displayed in my local instance, which isn't great but not show stopping:

┌───────────┬──────────────────────────────────────────────────────────────────────────────────────┐
│ md5       │ dd9098ff91717f4906afe9dafdfa2f52                                                     │
│ sha1      │ 4201c1e724536dfb937e03d101d565e031f7037d                                             │
│ sha256    │ ba47b6f560171cda711b43248685582166ef72521f8808ddc6cd1d9d146f9b86                     │
│ analysis  │ static                                                                               │
│ os        │ any                                                                                  │
│ format    │ dotnet                                                                               │
│ arch      │ any                                                                                  │
│ path      │ /home/spring/Documents/capa/tests/data/dotnet/dd9098ff91717f4906afe9dafdfa2f52.exe_  │
└───────────┴──────────────────────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ MBC Objective                                         ┃ MBC Behavior                             ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ OPERATING SYSTEM                                      │ Console [C0033]                          │
└───────────────────────────────────────────────────────┴──────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Capability                                             ┃ Namespace                               ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ manipulate console buffer (7 matches)                  │ host-interaction/console                │
│ (internal) .NET file limitation                        │ internal/limitation/dynamic             │
│ compiled to the .NET platform                          │ runtime/dotnet                          │
└────────────────────────────────────────────────────────┴─────────────────────────────────────────┘

@v1bh475u
Copy link
Contributor

v1bh475u commented Feb 4, 2025

Sure. Will start working on it!

@v1bh475u
Copy link
Contributor

v1bh475u commented Feb 4, 2025

The issue is there are rigid matches for static file limitations, but for dynamic dotnet limitations, I couldn't find any firm constraints. Do you have any suggestions? @mike-hunhoff @williballenthin

@williballenthin
Copy link
Collaborator Author

@mike-hunhoff

However, the rule is matched and displayed in my local instance, which isn't great but not show stopping

This is fixed in the pending #2592, where we now hide any internal rule from the default output (but will show it during vverbose, which isn't great but probably fine enough).

@v1bh475u we cleared up the confusion and i don't think is any action needed by you right now, sorry!

@williballenthin williballenthin merged commit 8d5e7e2 into master Feb 4, 2025
3 checks passed
@williballenthin williballenthin deleted the williballenthin-patch-1 branch February 4, 2025 20:48
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.

3 participants