Saturday, March 3, 2018

PowerShell Constrained Language

PowerShell Constrained Language is a language mode of PowerShell designed to restrict access to sensitive language elements that can be used to invoke arbitrary Windows APIs.

To view current parameter level, use the command:

$ExecutionContext.SessionState.LanguageMode

image

To set Constrained Language, use the command:

$ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage"

image

To set the parameter for future sessions, use the following command within an elevated prompt:

[Environment]::SetEnvironmentVariable('__PSLockdownPolicy', '4', 'Machine')

image

https://blogs.msdn.microsoft.com/powershell/2017/11/02/powershell-constrained-language-mode/

https://itfordummies.net/2015/06/01/powershell-constrained-mode/

https://adsecurity.org/?p=2921

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.