Understanding Powershell Security Flashcards
What three purposes do Powershell execution policies serve?
1, safety feature to control conditions a script can run
2. Prevent execution of malicious scripts
3. Scope execution of scripts to specific sessions
What are Powershell execution policies?
Local Computer and Current user are stored in the registry
Is not a security system to restrict user actions, just certain types of execution
Can be set for Workstation, Current user, or particular session
Default exec policy on non’Windows is unrestricted and cannot be changed
What Execution Policies are available?
All signed - execute scripts with an SSL cert
Bypass - ignores all policies
Remote signed - like all signed
Restricted - block and potentially not allow scripts to execute
Unrestricted - can run scripts with no questions
Describe the All signed policy
Scripts can execute. Requires all scripts and config files be signed by a trusted published
Prompts you before running scripts not yet classified
Risk running signed malicious scripts
Bypass policy
Nothing is blocked, no warning or prompts
Designed for config where ps script is what it is, and the foundation for a program that has its own security model. Adminless, no need to touch.
Remote signed policy
Scripts can execute
Requires digital sig from trusted publisher
Doesn’t required digital signs on scripts that are written locally
Run scripts that are not signed, if the scripts are unblocked
Risk running unsigned and signed scripts that could be malicious
restricted policy
Default exec policy for Win clients
Permits inidividual commands but does not allow scripts
Prevents running of all script files
Unrestricted policy
Default policy for non’Win computers
Unsigned scripts can execute
Risk of running Mali scripts
Warns user before running scripts
Powershell scopes
Process - Powershell session
Current user
Local machine
What are the two Group policy based scopes?
Machine policy - set by a group policy for all users of the pc
User policy - set for current user of computer
Review exec policy precedence
- Process
- Current User
- Machine
- Restricted (default policy)
what is the ps command to get the execution policy precedence?
Get-ExecutionPolicy -List
Setting execution policies
Can be assigned to the default scope or a specific scope
The default scope is LocalMachine, which affects everyone who uses the PC
Exec policies can be used for a single ps session
How to set default exec policy?
Set-ExecutionPolicy
Set an exec policy for the local machine scope
Set-ExecutionPolicy
- ExectionPolicy RemoteSigned
- Scope LocalMachine