Open kubota83895398 opened 2 weeks ago
Oddly enough, when I manually run msix.ps1, it runs just fine.
Steps:
import subprocess
and hit entersubprocess.run(r'C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy bypass C:\tmp___\data\msix.ps1 path/to/sample.msix')
and hit enter(The reason I'm using python here is to imitate how CAPE runs msix.ps1.)
I wonder how CAPE's way of running powershell is different from this.
https://github.com/kevoreilly/CAPEv2/blob/master/analyzer/windows/modules/packages/msix.py
hello, well is something to do with permissions more than other thing, at least looks like
C:\tmpmb9dnw8c\data\msix.ps1 : Access to the path 'C:\tmpmb9dnw8c\data\msix.ps1' is denied.
<-
i just tested on my side, it runs fine, so i would suggest review the permission, maybe your agent.py doesn't have system right, you can restore snapshot and run curl <vm_ip>:8000
and it will return if is admin or not
@doomedraven
Thanks for the reply.
you can restore snapshot and run curl
:8000 and it will return if is admin or not
Here's the response. It seems to be running as admin.
{"message": "CAPE Agent!", "version": "0.18", "features": ["execpy", "execute", "pinning", "logs", "largefile", "unicodepath", "mutex", "browser_extension"], "is_user_admin": true}
Here's the permissions of the folders/file if it helps.
PS C:\Windows\system32> (Get-Acl C:\tmpcq_2dtwl\).Access
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : OWNER RIGHTS
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
PS C:\Windows\system32> (Get-Acl C:\tmpcq_2dtwl\data\).Access
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : OWNER RIGHTS
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
PS C:\Windows\system32> (Get-Acl C:\tmpcq_2dtwl\data\msix.ps1).Access
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : True
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited : True
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : OWNER RIGHTS
IsInherited : True
InheritanceFlags : None
PropagationFlags : None
Is there anything else I should check?
hm no, it looks correct, sorry i have no clue why you getting access denied
It's fine, thank you.
If anyone else has any ideas, I'd really appreciate it if you could let me know.
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
CAPE analyzes a MSIX file without an error.
Current Behavior
When I submit a MSIX file (without
startScript
(whose presence changes how the file is detonated, as I see in msix.py)), agent.py on the guest VM tries to run msix.ps1 (which is responsible for installing and running the msix file being analyzed), but it fails without actually running msix.ps1.Failure Information (for bugs)
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions. Operating system version, bitness, installed software versions, test sample details/hash/binary (if applicable).
Failure Logs
error (source: Powershell transcript file collected by CAPE as "dropped file")
I made sure agent.py was running as admin. As you can see in the screenshot below, the CAPE processes are elevated. The powershell process is the one running msix.ps1.
Related?
I'm not sure if this is related but when the windows VM's OS language was set to Japanese, the powershell process running msix.ps1 crashed due to heap corruption (before actually running the script). I'm not sure why but changing the language to en-US fixed this.
I would really appreciate help. Thank you.