Skip to main content

icacls.exe windows file and directory permissions modification

https://attack.mitre.org/techniques/T1222/001/

 

Image: C:\Windows\system32\icacls.exe

cmdline: ICACLS . /GRANT EVERYONE:F /T /C /Q

 

icacls C:\Windows\System32\config\sam  

 

C:\Users\Avi\Desktop>cacls TestCACLS /p Users:n (n for no control)

now on the  TestCACLS folder, no one can access. 

C:\Users\Avi\Desktop>cacls TestCACLS /p Users:f (f for full control)

now can access.  

 

https://ss64.com/nt/cacls.html

 

 

 

Check Permissions
Force Remove
THen add Read + Execute
Validate Permissions

icacls putty.exe
icacls putty.exe /deny tsa_admin:(F)
icacls putty.exe /grant:r tsa_admin:(RX)
icacls putty.exe 

 

 

icacls "%WINDIR%\system32\msimg64.dll" /grant administrators:F 

 

Detection:

windows security log events (event id 4670) are created when DACLs are modified. 

 

 

Inheritance rights are represented by the following abbreviations:

OI object inherit 

CI container inherit

IO inherit only

NP do not propagate inherit

NTFS permissions are represented by one of the following forms:

N no access

F full access

M modify access

R read only access

RX read and execute access

W write access

D delete access


attacker can interact with the DACLs using built-in windows commands such as, icacls, cacls, takedown, attrib which allow adversaries higher permissions on

 

icacls <file_name> /reset        replace acls with default inherited acls. (reset permission)

 

 

Comments

Popular posts from this blog

Install Nessus from docker

The below two commands you need to run first one by one:  docker run -itd --name=ramisec_nessus -p 8834:8834 ramisec/nessus docker exec -it ramisec_nessus /bin/bash /nessus/update.sh Username: admin And you need to change the password: #Enter the command line of the docker container docker exec -it ramisec_nessus bash #Execute the following commands in sequence # Enter this directory cd /opt/nessus/sbin # List logged in users ./nessuscli lsuser # Modify the password of the specified user (take admin as an example) ./nessuscli chpasswd admin After access to the nessus, make sure you turn off the automatic updates otherwise crack will not work after some time. Before any scan you need to run the update.sh command (shown above) to have the latest plugins. Now everytime your system reboots, your docker instance will be shutdown. You need to up it again manually. Here are the commands.  1. docker ps -a    Now note down the container id. 2. docker start <container id> C

net command cheat sheet

  To see what users present in the system: net user To see local groups in the system: net localgroup To see domain groups. This should be run on a domain controller: net group To see the details of a user along with his/her group membership: net user mahim To see who are the members of a particular group (local machine): net localgroup "administrators"    (These are not case sensitive. You can use administrators or Administrators. Both will give you same result. To see who are the members of a particular group (domain machine): net group "domain admins" Create a local user: net user localuser1 MyP@ssw0rd /add Create a domain user: net user domainuser1 MyP@ssw0rd /add /domain Add the local user to local admin group: net localgroup Administrators localuser1 /add Add the user to domain admin group: net group "Domain Admins" domainuser1 /add /domain Avi