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

Certain binaries cannot be scanned #18

Open
ESIC-DA opened this issue Jan 26, 2019 · 3 comments
Open

Certain binaries cannot be scanned #18

ESIC-DA opened this issue Jan 26, 2019 · 3 comments
Assignees
Labels

Comments

@ESIC-DA
Copy link

ESIC-DA commented Jan 26, 2019

Hi

Get-PESecurity is a great tool, and it works well to scan a wide variety of EXEs and DLLs...I have one EXE that fails to scan (hasplms.exe sentinel security license manger) with the error at line 592:

"Cannot find type [PE.IMAGE_SECTION_HEADER, Win32, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]: make sure the assembly containing this type is loaded."

Is there anything that can be done about that? I can send the EXE to someone for analysis if that's helpful.

Thanks in advance :)

-Dave

Edit: this is on a Server 2008R2 Standard 64bit machine with PowerShell 2.0 in case that makes any difference.

@ESIC-DA
Copy link
Author

ESIC-DA commented Jan 26, 2019

Although, if trying it in powershell directly after importing the module like this:

Get-PESecurity -File C:\Windows\system32\hasplms.exe -EA SilentlyContinue

I get output to the console:

FileName         : C:\Windows\system32\hasplms.exe
ARCH             : I386
DotNET           : False
ASLR             : False
DEP              : False
Authenticode     : True
StrongNaming     : N/A
SafeSEH          : False
ControlFlowGuard : False
HighentropyVA    : False

but if I call it from within a script like so

Import-Module .\Get-PESecurity.psm1    

$temporaryTestVar =$null
try 
{ 
    $temporaryTestVar=Get-PESecurity -File 'C:\Windows\system32\hasplms.exe' -EA SilentlyContinue
} 
catch { Write-Host ('Unable to scan file Error: {0}' -f @($Error[0])) }
if (!$temporayrTestVar) { write-host 'its null' }

which outputs this when run in ps2.0 on 2008r2:

>powershell.exe -file .\test.ps1
Unable to scan file Error: Cannot find type [PE.IMAGE_SECTION_HEADER, Win32, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]: make sure the assembly containing this type is loaded.
its null

I get an exception thrown and end up in my catch with the $tmp set to $null ...but perhaps there's some facet of powershell exception handling I've missed. It wouldn't do me any good to remove it from this trycatch, as we're multiple levels of try deep while working on this line already.

@egru
Copy link
Member

egru commented Jan 26, 2019

I'll take a look at it. I really haven't tried using it inside of another PowerShell script before.

@egru egru self-assigned this Jan 26, 2019
@egru egru added the bug label Jan 26, 2019
@ESIC-DA
Copy link
Author

ESIC-DA commented Jan 26, 2019

Thanks so much! :)

-Dave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants