Exception lors de l'appel de « GetDelegateForFunctionPointer » avec « 2 » argument(s) : « La valeur ne peut pas être null.
Nom du paramètre : ptr »
Au caractère obfuscated.ps1:489 : 9
+ $VirtualAlloc = [System.Runtime.InteropServices.Marshal]::Get ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
Exception lors de l'appel de « GetDelegateForFunctionPointer » avec « 2 » argument(s) : « La valeur ne peut pas être null.
Nom du paramètre : ptr »
Au caractère obfuscated.ps1:494 : 9
+ $VirtualAllocEx = [System.Runtime.InteropServices.Marshal]::G ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
Exception lors de l'appel de « GetDelegateForFunctionPointer » avec « 2 » argument(s) : « La valeur ne peut pas être null.
Nom du paramètre : ptr »
Au caractère obfuscated.ps1:499 : 9
+ $memcpy = [System.Runtime.InteropServices.Marshal]::GetDelega ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
(...)
Also, an error sometimes happens with TOKEN\STRING\1 or TOKEN\STRING\2.
That's the same with any AST\*\1 (but here, the code can't be ofuscated)
Can't find process 0
Au caractère obfuscated.ps1:2540 : 17
+ Throw "Can't find process $ProcName"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Can't find process 0:String) [], RuntimeException
+ FullyQualifiedErrorId : Can't find process 0
Or AST\HashtableAst\1
Exception lors de l'appel de « Substring » avec « 2 » argument(s) : « La longueur ne peut pas être inférieure à zéro.
Nom du paramètre : length »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5738 : 17
+ ... $ObfuscatedExtent = [String] $ObfuscatedExtent.Substring( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception lors de l'appel de « Substring » avec « 1 » argument(s) : « StartIndex ne peut pas être inférieur à zéro.
Nom du paramètre : startIndex »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5745 : 17
+ ... $ObfuscatedExtent += [String] $AbstractSyntaxTree.Extent. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception lors de l'appel de « Substring » avec « 2 » argument(s) : « La longueur ne peut pas être inférieure à zéro.
Nom du paramètre : length »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5738 : 17
+ ... $ObfuscatedExtent = [String] $ObfuscatedExtent.Substring( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception lors de l'appel de « Substring » avec « 1 » argument(s) : « StartIndex ne peut pas être inférieur à zéro.
Nom du paramètre : startIndex »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5745 : 17
+ ... $ObfuscatedExtent += [String] $AbstractSyntaxTree.Extent. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Or AST\CommandAst\1 :
Exception lors de l'appel de « Substring » avec « 2 » argument(s) : « La longueur ne peut pas être inférieure à zéro.
Nom du paramètre : length »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5738 : 17
+ ... $ObfuscatedExtent = [String] $ObfuscatedExtent.Substring( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception lors de l'appel de « Substring » avec « 1 » argument(s) : « StartIndex ne peut pas être inférieur à zéro.
Nom du paramètre : startIndex »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5745 : 17
+ ... $ObfuscatedExtent += [String] $AbstractSyntaxTree.Extent. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception lors de l'appel de « Substring » avec « 2 » argument(s) : « La longueur ne peut pas être inférieure à zéro.
Nom du paramètre : length »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5738 : 17
+ ... $ObfuscatedExtent = [String] $ObfuscatedExtent.Substring( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception lors de l'appel de « Substring » avec « 1 » argument(s) : « StartIndex ne peut pas être inférieur à zéro.
Nom du paramètre : startIndex »
Au caractère Invoke-Obfuscation\Out-ObfuscatedAst.ps1:5745 : 17
+ ... $ObfuscatedExtent += [String] $AbstractSyntaxTree.Extent. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Therefore, I suppose AST is not supported by this version of Invoke-Mimikatz.ps1. But do you have any idea why TOKEN\STRING\1 and TOKEN\STRING\2 may sometimes break Invoke-Mimikatz.ps1, while TOKEN\ARGUMENT\1 breaks it everytime ?
Is there any table referencing these incompatibilities, or is it specific to the script we try to obfuscate ?
Here is a PowerShell version of Invoke-Mimikatz: https://raw.githubusercontent.com/BC-SECURITY/Empire/master/empire/server/data/module_source/credentials/Invoke-Mimikatz.ps1
Launching it normally is OK (as admin and without antiviruses):
But when I try to obfuscate it using TOKEN\ARGUMENT\1 :
I always have the following error
Also, an error sometimes happens with TOKEN\STRING\1 or TOKEN\STRING\2.
That's the same with any AST\*\1 (but here, the code can't be ofuscated)
For example, when chosing AST\ALL\1 :
Or AST\HashtableAst\1
Or AST\CommandAst\1 :
Therefore, I suppose AST is not supported by this version of Invoke-Mimikatz.ps1. But do you have any idea why TOKEN\STRING\1 and TOKEN\STRING\2 may sometimes break Invoke-Mimikatz.ps1, while TOKEN\ARGUMENT\1 breaks it everytime ?
Is there any table referencing these incompatibilities, or is it specific to the script we try to obfuscate ?