Zinkelburger's Windows Hardening and Initial Protection Scripts
Need to run the scripts asynchronously, they can finish faster if they don't block.
Dump logs to get an initial state so we can restore to it later. For example: DNS records, static IPs.
- Dump static IP / default IP of the machine (score checks may be looking for this)
- Dump DNS records on the DC
- Dump DNS servers it uses
- Dump AD domain information
- Dump the firewall information
- Delete all files on the desktops of all users, move them to a folder in the admin's Documents directory
- Delete all files that are not signed by Microsoft, move them to a folder in the admin's Documents directory. (it is possible to restore these, we log the location they are removed from)
- Delete all registry keys in the run and runOnce. Log these
- Set other registry keys, such as disabling the WDigest authentication's feature of storing credentials in memory in plaintext
- Note: possible to delete all task scheduler things with minimal impact over the 2 day competition
- Identify all task scheduler items not in a predetermined list
- Give the user the option to delete those task scheduler items not in the predetermined list
- Identify all services not in a predeterminted list of services and suspend them, take a closer look. Also look into hidden services?
- Disable all AD accounts besides yourself and the black team (can only be run on the DC)
- Disable all local accounts (besides the administrator user on the DC, as this is also a domain account)
- Change the password of the kerberos account to mitigate Gold Tickets
- Change the password of the services accounts to mitigate Silver Tickets
- Kick all users off of RDP sessions
- Kick all users off of SSH sessions
- Kick all users off of WinRM sessions / restart WinRM
- Removing the openssh server
- Disabling WinRM
- Disabling RPC
- Removes all file shares to prevent the entire C drive from being shared on the network (a Justin Marwad classic)
- Disables/unlinks all GPO
- Puts the default GPO policy
- Docs on how to manually enable powershell if it is disabled from GPO
- Note all ports open by the firewall, the processes using them, and if any of them look suspicious