-
Notifications
You must be signed in to change notification settings - Fork 570
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
dynamic: warn user for .NET samples #1864
Comments
Hello, I am totally new here. I wanted to work on this issue. Can you please give more insights? |
Welcome! For dynamic analysis we should look into "file limitations" like e.g. .NET samples. The first step here would be to identify a .NET sample from the sandbox files (for VMRay and CAPE first), example files can be found in https://github.com/mandiant/capa-testfiles/tree/master/dynamic. Then we could handle it analogous to static file limitations (e.g. here Line 746 in 32d6181
|
So currently, is it unable to detect .NET samples? |
Yes, that's the first idea here. |
Can you please explain the issue in more detail? I am still unable to understand where the problem is ( this is my first time seeing the internals of capa).
Hence, we need to make capa identify .NET sample(no idea how it's done) and warn users if it is .NET and that's all. Is this correct? |
Yes, sounds like you got it. For static analysis we already handle cases where the analysis may be confusing or wrong (so I provided that as an example). For dynamic analysis there is probably multiple ways to identify .NET from the analysis archives. For CAPE and VMRay e.g. from the static analysis results (pefile, etc.). |
How do I know which ones inside the |
you could use |
the files in |
ah, sorry, i misread the file path! |
i don't know off the top of my head. it may require a little novel research. for example, you could compare the either the module load or API calls (probably the first few) of .NET vs not .NET in the VMRay dataset, to figure out what a good charactistic/pattern is, and then see if it applies to CAPE too. again, i think loading mscoree.dll is probably a good indicator, but im not totally sure. |
The problem that I am seeing is I don't know a perfect way of knowing if it's a .NET by looking at the json from cape. If there is, then please tell. After that, I can try to find a pattern of how to identify if it is .NET. |
What I feel is checking if |
I'd start by obtaining a CAPE report for a .NET sample and inspecting the static fields, i.e. the mentioned |
Okay. Will start implementing this. |
can I use the check that if |
I think it's important that we find a test case for CAPE before going too far along. I'll be back working again tomorrow (sorry been off for two weeks) and can help collect the test file. |
Also, we would need some more samples in vmray too as currently there is only 1 .NET pe in the testfiles. |
@doomedraven can you suggest a source of public CAPE sandbox results? VT doesn't share the raw report archive. |
i will provide you one tomorrow from TCR, today is last holiday here |
Great |
@mr-tz @williballenthin shall I continue with approach of finding imports and iterating through them to find if it has imported |
Also, please tell what the warning message should be. |
Yes let's move forward with the import strategy. You can use the existing capa rule format and logic to specify "import: mscoree" (or perhaps the function from that DLL) and make it only used for dynamic analysis ("scope: dynamic: file, static: unsupported"). please see how the existing static analysis file limitation rules and warnings are emitted for an example. |
Shall I create a new rule under rule:
meta:
name: .NET dynamic sample
namespace: internal/limitation/file
authors:
- "@v1bh475u"
scopes:
static: unsupported
dynamic: file
examples: # yet to be tested and found
features:
- or:
- format: dotnet
- import: mscoree._CorExeMain
- import: mscoree._corexemain
- import: mscoree._CorDllMain
- import: mscoree._cordllmain The above rule is almost same the rule |
@williballenthin what is the password for the cape sample zip that you have shared? I have implemented some code and want to test it against it but capa does not support |
try "infected" |
@williballenthin It worked! Now, I need to make PRs on |
Working here on Github works well for me, as long as it does for you, too. Nice job on the updates! Let's get PRs created for these changes. Have you done this before? If not, you can use the button here to create a PR: and in the PR text you can reference this issue, like "closes #1864". Once that is open, we can review and address any further recommendations, and merge when its ready. Thank you! |
@williballenthin I have made the PRs. Please review them whenever you are free. |
@williballenthin, I have also made the PR on |
warn for .NET samples because runtime API trace and called .NET APIs differ
results may be confusing / misleading
The text was updated successfully, but these errors were encountered: