Conteúdo Programatico
Learn PowerShell Scripting for Security
PowerShell Is Dangerous (and Fun)
- The backbone of Windows and Azure automation
- Piping .NET and COM objects, not text
- Graphical admin tools wrapped around PowerShell
- Built-in remote script execution
Writing Your Own Scripts, Functions, and Modules
- Passing arguments into your scripts
- Cmdlets, functions, and aliases in your profile script
- Flow control: if-then, do-while, foreach, switch
- The .NET Framework class library: a vast playground
- How to pipe data in/out of your scripts
- How to create your own module script
Up and Running Quickly with PowerShell
- Capturing the output of commands
- Parsing text files and logs with regex patterns
- Mounting the registry as a drive
- Importing third-party modules and functions
- https://www.PowerShellGallery.com
Piping Objects Instead of Text
- Classes, objects, properties, and methods
- An array of objects is like a table of SQL records
- Extracting just the properties you want
- Exporting objects to CSV, HTML, XML, and JSON files
- Filtering, sorting, and grouping objects (not text)
You Don't Know THE POWER!
PowerShell Remoting
- Get a remote command shell with PowerShell
- Smart card and YubiKey authentication
- Using SSL/TLS or SSH to encrypt traffic
- Remote command execution in scheduled tasks
- File upload and download using the PowerShell Remoting protocol
- Graphical apps can use PowerShell remoting too
OpenSSH on Windows
- Windows can be an SSH server? Yes!
- OpenSSH support is now built into Windows
- PowerShell Core integration with SSH
- Hardening SSH for Internet use
- Kerberos and public key authentication for SSH
PowerShell Just Enough Admin (JEA)
- JEA is like setuid root on Linux
- Restricting PowerShell commands and arguments
- Verbose transcription logging of commands
- How to set up and configure JEA
- JEA for Privileged Access Workstations (PAWs)
PowerShell, Group Policy, and the Task Scheduler
- Deploying PowerShell startup and logon scripts
- Group Policy scheduled tasks to run PowerShell scripts
- The Task Scheduler service and admin credentials
- WMI item-level targeting of PowerShell scripts
PowerShell for WMI and Active Directory
PowerShell Baselines with WMI
- What is WMI and why do hackers abuse it so much?
- Remote command execution through WMI
- Using PowerShell to query WMI namespaces and classes
- WMI service authentication and traffic encryption
- Gathering Reconnaissance data from remote systems
- Microsoft Windows Admin Center (WAC) web application
- WMI logging for hacker and malware visibility
PowerShell for Active Directory
- Querying and managing Active Directory with PowerShell
- Enforcing desired Domain Admins group membership
- Disabling abandoned user accounts and resetting passwords
- Detecting password brute-force attacks
- Searching organizational units using filter criteria
- ADSI Edit and other helper tools for PowerShell
- Active Directory Administrative Center (ADAC)
Active Directory Permissions and Auditing
- Active Directory objects have permissions
- Active Directory objects have auditing
- Limit what PowerShell scripts can do in Active Directory
- Log what PowerShell scripts are doing in Active Directory
- Delegate authority at the OU level instead
- Designing Active Directory for the inevitable breach
Hardening Network Services with PowerShell
Server Hardening Automation for DevOps
- Replacing Server Manager with PowerShell
- Windows Admin Center (WAC) web application
- Adding and removing roles and features
- Remotely gathering an inventory of roles and features
- Why use Server Nano or Server Core?
- Running PowerShell automatically after service failure
- Service account identities, passwords, and risks
- Tools to reset service account passwords securely
Windows Firewall Scripting
- PowerShell management of Windows Firewall rules
- Blocking malware outbound connections
- Role-based access control for listening ports
- Deep IPsec integration for user authentication
- Firewall logging to the event logs, not to text logs
Share Permissions for TCP/UDP Listening Ports with IPsec
- PowerShell management of IPsec rules
- IPsec for blocking post-exploitation lateral movement
- Limiting access to ports based on global group membership
- IPsec-based encrypted VLANs
- IPsec is not just for VPNs!
Certificates and Multifactor Authentication
Certificate Authentication and TLS Encryption for PowerShell
- Certificates for smart card authentication of PowerShell remoting
- Certificates for TLS encryption of PowerShell remoting
- Certificates to sign PowerShell scripts for AppLocker
- Certificates for TLS encryption of WMI queries with PowerShell
- Certificates for web servers, domain controllers, and everything else
Install a Windows Certificate Server with PowerShell
- PowerShell installation script for Public Key Infrastructure (PKI)
- Managing digital certificates with PowerShell
- Custom certificate templates in Active Directory
- Controlling certificate auto-enrollment
- Setting up an Online Certificate Status Protocol (OCSP) responder web farm
- Configuring Certificate Revocation List (CRL) publication
Deploying Smart Cards, Smart Tokens, and TPM Virtual Smart Cards
- The gold standard for multi-factor authentication is a smart card/token
- YubiKey smart tokens for logon, PowerShell remoting, and much more
- Trusted Platform Module (TPM) virtual smart cards
- Safely enroll tokens and cards on behalf of other users
- How to revoke compromised certificates
- PowerShell script to audit trusted root CAs
- PowerShell script to delete hacker certificates
Security Best Practices
- Privilege escalation to Domain Admin through bad PKI
- Protect the private keys of your certificates from malware
- How to use PKI smart cards and smart tokens
- How to encrypt private keys on the hard drive
- Hardware Security Module (HSM) for CAs
- How to digitally sign PowerShell scripts
- SSL is dead, long live TLS
- TLS cipher suite optimization
Capstone: PowerShell Security, Ransomware & DevOps
PowerShell Ransomware
- We will write a PowerShell ransomware script in a lab
- What can be done to combat ransomware?
- Just having backups is not enough
Anti-Exploitation Defenses for PowerShell
- AppLocker for PowerShell
- Scripting AppLocker with PowerShell
- PowerShell execution policy
- PowerShell constrained language mode
- Anti-Malware Scan Interface (AMSI)
- Restricting network access to block pivoting
- Hashing scripts for change detection
- How to digitally sign our PowerShell scripts
- The Principle of (Endpoint) Least Privilege
- Prevent Domain Admin credential theft at all costs!
- Windows 10 Credential Guard
- User Account Control (UAC) instead of RUNAS.EXE
PowerShell Visibility and Detection
- PowerShell transcription logging
- WMI namespace auditing
- Windows Event Log audit policies
- Querying Windows Event Logs with PowerShell
DevOps Automation with PowerShell
- Putting it all together with PowerShell
- How to write an all-in-one build script with OS hardening
- PowerShell for roles, features, networking, policies, etc.
- The future of IT administration is automation
- We will all need to be "full stack engineers" soon