In Windows, file and folder permissions are managed through Access Control Lists (ACLs). Using PowerShell, attackers with the necessary privileges can retrieve the current ACL of a file, create a new access rule, and grant full control to a chosen user or group.
Command Reference:
Target File: C:\Users\Administrator\Desktop\flag.txt
Granted To: Everyone
Permission: FullControl / Modify / ReadAndExecute / Read / Write
Get-Acl "C:\Users\Administrator\Desktop\flag.txt"
$acl = Get-Acl "C:\Users\Administrator\Desktop\flag.txt"
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "FullControl", "Allow")
$acl.SetAccessRule($rule)
Set-Acl "C:\Users\Administrator\Desktop\flag.txt" $acl