This repository provides a collection of PowerShell functions that assist administrators and security auditors in evaluating network share permissions, Discretionary Access Control Lists (DACLs), and ownership details.
The idea to this came after finding file permission issues on SYSVOL and NETLOGON shares multiple times during security assessments.
Get-FileShareCriticalPermissions
: Recursively retrieves the ACE´s for a specified network share path, listing the users/groups and their associated rights.Get-CriticalPermissionOverview
: Get an overview which users have critical permissions on the shareGet-CriticalPermissionsByUser
: Get file and folder objects a user/group has critical permissions toGet-FileDACL
: Fetches the DACL of a specified file, returning each Access Control Entry (ACE) as an individual object.Get-FileShareOwnershipAndCreator
: Recursively fetches the owner and creator (if available) of files and folders from a given network share path.
iex (New-Object Net.Webclient).downloadstring('https://raw.githubusercontent.com/michiiii/Get-FileShareAccessRights/main/Get-FileShareAccessRights.ps1')
Retrieve the ACE´s for a specified network share path.
$permissions = Get-FileShareCriticalPermissions -NetworkSharePath "\\pwnyfarm.local\netlogon"
Following that I want to create an overview of which users have how many write permissions
# See users that have potential critical rights
Get-CriticalPermissionOverview -SharePermissions $permissions
Finally, you can filter for intersting user/groups:
Get-CriticalPermissionsByUser -SharePermissions $permissions -UserName "Authenticated Users"
Retrieves the DACL for a specified file.
Get-FileDACL -FilePath "\\pwnyfarm.local\netlogon\LAPS.msi"
Retrieve the owner and creator information from a network share path.
Get-FileShareOwnershipAndCreator -NetworkSharePath "\\pwnyfarm.local\netlogon"
Feel free to submit pull requests or issues if you identify any bugs or have suggestions for improvements.
Contributors:
- @skelsec: Supporting me to do this as accurate as possible :D
- Consider Deny rules in the ACL´s