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

ERR997.ExceptionLoadingAnalysisTarget for .exe file #940

Closed
gitpushmain opened this issue Jul 7, 2023 · 5 comments
Closed

ERR997.ExceptionLoadingAnalysisTarget for .exe file #940

gitpushmain opened this issue Jul 7, 2023 · 5 comments

Comments

@gitpushmain
Copy link

I get the following error for an .exe file that I am scanning:

error ERR997.ExceptionLoadingAnalysisTarget : Could not load analysis target 'pr27708.exe'.

D:\a\r1\a\src\BinaryParsers\ElfBinary\ElfBinary.cs : error ERR999.UnhandledEngineException : System.NullReferenceException: Object reference not set to an instance of an object.
  at Microsoft.CodeAnalysis.BinaryParsers.ElfBinary.Dispose() in D:\a\r1\a\src\BinaryParsers\ElfBinary\ElfBinary.cs:line 232
  at Microsoft.CodeAnalysis.IL.Sdk.BinaryAnalyzerContext.Dispose(Boolean disposing) in D:\a\r1\a\src\BinSkim.Sdk\BinaryAnalyzerContext.cs:line 117
  at Microsoft.CodeAnalysis.Sarif.Driver.MultithreadedAnalyzeCommandBase .LogScanResultsAsync(TContext rootContext) in /_/src/Sarif.Driver/Sdk/MultithreadedAnalyzeCommandBase.cs:line 300
NullReferenceException: Object reference not set to an instance of an object.
  at Microsoft.CodeAnalysis.BinaryParsers.ElfBinary.Dispose() in D:\a\r1\a\src\BinaryParsers\ElfBinary\ElfBinary.cs:line 232
  at Microsoft.CodeAnalysis.IL.Sdk.BinaryAnalyzerContext.Dispose(Boolean disposing) in D:\a\r1\a\src\BinSkim.Sdk\BinaryAnalyzerContext.cs:line 117
  at Microsoft.CodeAnalysis.Sarif.Driver.MultithreadedAnalyzeCommandBase 2.LogScanResultsAsync(TContext rootContext)

Usually I am scanning large amount of files. In this case I was scanning "Mingw-w64". I can provide the exact file that caused the exception, if required.

Is there an Binskim option to ignore such exceptions, so that it continues with scanning of the rest of the files? Similar to "ignorePdbLoadError"? For me that would by very handy when I am scanning large amount of files at once, so that I not have to exclude certain "broken" files. Do you think such an option would make sense?

@shaopeng-gh
Copy link
Collaborator

Hi, the file in question 'pr27708.exe', is it a ELF file or PE file,

I can provide the exact file that caused the exception, if required. --- If this file is a public acquirable nonsensitive file, yes, I can debug it and check. If it comes with .pdb file please provide together.

@gitpushmain
Copy link
Author

Hi @shaopeng-gh,
I think it is an ELF file. The MIME type is "application/x-pie-executable".

You can download it here: https://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.xz
The file is in the following directory: "binutils-2.39/binutils/testsuite/binutils-all/x86-64/pr27708.exe.bz2"

Thanks a lot!

@shaopeng-gh
Copy link
Collaborator

Good news, I have reproduced the issue from the pr27708.exe inside that package you provided,
and also can confirm this issue is resolved in the latest version of BinSkim will not throw exception.
Please build a latest version of BinSkim from main branch.
For how to build: https://github.com/microsoft/binskim/blob/main/README.md#for-developers

image

Let me know if the issue can be closed.

@gitpushmain
Copy link
Author

Thanks a lot. It works for me now and the issue can be closed. But one short question: do you know when the next official release is planned for BinSkim on NuGet? I saw that it has been quite a while since the last release was published.

@shaopeng-gh
Copy link
Collaborator

Glad to hear!
Unfortunately we don't currently have plan to release a official release recently.
However we may release a newer version in NuGet in the future.

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

No branches or pull requests

2 participants