Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions content/exchange/artifacts/Windows.System.ModifyACL
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Windows.System.ModifyACL
description: |
This artifact modifies ACLs on files in the specified directory
using the icacls command to grant full control to SYSTEM and deny access to Users and Everyone.
This artifact can be very crucial given the case that velociraptor is deployed on a critical network/infrastructure,
consequently, reducing cyber risk.

author: Abed al Rahman Sidani

parameters:
- name: TargetPath
default: C:\Path\To\Your\Folder
description: Path where permissions will be modified

sources:
- query: |
// Check if path is specified
LET _ <= if(condition=NOT TargetPath,
then=throw(message="TargetPath must be specified"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw() is not valid VQL


// Construct PowerShell command
LET ps_cmd <= "icacls '" + TargetPath + "*.*' /grant 'NT AUTHORITY\\SYSTEM:(F)' /deny 'Users:(F)' /deny 'Everyone:(F)' /inheritance:r"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will lead to shell injection - please use execve() properly


// Execute PowerShell command
LET acl_result <= SELECT * FROM execve(
argv=["powershell", "-Command", ps_cmd],
length=10000)

// Final result with detailed information
SELECT
TargetPath AS Path,
ps_cmd AS ExecutedCommand,
acl_result.Stdout AS CommandOutput,
acl_result.Stderr AS CommandErrors,
if(condition=acl_result.ReturnCode = 0,
then="Success",
else="Failed") AS Status
FROM scope()
Loading