Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Invoke-NinjaCopy: Errors on Windows 10 x64 #152

Closed
okazymyrov opened this issue Jun 12, 2016 · 5 comments
Closed

Invoke-NinjaCopy: Errors on Windows 10 x64 #152

okazymyrov opened this issue Jun 12, 2016 · 5 comments
Assignees

Comments

@okazymyrov
Copy link

When I'm running

Invoke-NinjaCopy -Path "C:\Windows\System32\config\SAM" -LocalDestination "$Env:TEMP\SAM"

as evaluated user on Windows 10 x64 the following errors occur

Specified cast is not valid.
At line:2208 char:7
+         if (($PEInfo.DllCharacteristics -band $Win32Constants.IMAGE_D ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], InvalidCastException
    + FullyQualifiedErrorId : System.InvalidCastException

Specified cast is not valid.
At line:2266 char:7
+         if (($PEInfo.DllCharacteristics -band $Win32Constants.IMAGE_D ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], InvalidCastException
    + FullyQualifiedErrorId : System.InvalidCastException

In spite of the error, the file is copied.

@HarmJ0y
Copy link
Contributor

HarmJ0y commented Jul 15, 2016

Thanks for the information. We will be doing a refactor of a chunk of PowerSploit code at some point after BlackHat and we will dive into this cast issue then.

@leechristensen
Copy link
Contributor

Until/if this module is refactored, consider using PowerForensics to pull the file as it uses the same technique (https://github.com/Invoke-IR/PowerForensics)

FuzzySecurity added a commit that referenced this issue Feb 13, 2017
Fix for System.InvalidCastException:
#152
@FuzzySecurity
Copy link
Contributor

@okazymyrov can you please have a look at the change I pushed to the dev branch:
bd6fe64

This should resolve the issue!

@FuzzySecurity FuzzySecurity self-assigned this Feb 13, 2017
@okazymyrov
Copy link
Author

@FuzzySecurity the changes work on Windows 10.0.14393.

@FuzzySecurity
Copy link
Contributor

@okazymyrov ok cool! For now it's in Dev but in a week or two the change should have been pushed to master.

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

No branches or pull requests

4 participants