Skip to content

Commit ca65d8c

Browse files
zweilosecgitbook-bot
authored andcommitted
GitBook: [#334] No subject
1 parent bb8aded commit ca65d8c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

windows-1/windows-redteam/privilege-escalation.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Always ensure you have **explicit** permission to access any computer system **b
1414
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1515
| `Set-Executionpolicy Bypass` | Administrator rights are required. |
1616
| `Set-ExecutionPolicy -Scope CurrentUser Bypass` | Only works in the context of the current user but requires no Administrator rights. |
17+
| `Set-ExecutionPolicy Bypass -Scope Process` | Works without Administrator rights and lasts for the duration of the current session. |
1718
| <ol><li>Open .ps1 file in text editor.</li><li>Copy all text in the file</li><li>Paste into PowerShell</li></ol> | PowerShell will run each line of the script one at a time, essentially the same as running the script. |
1819
| `Echo <script_code> \| PowerShell.exe -noprofile -` | Similar to simply pasting the code. |
1920
| `cat $script.ps1 \| PowerShell.exe -noprofile -` | Effectively the same as the previous example, but the code is read from a script file instead of being pasted. `cat` is an alias for `Get-Content`. |
@@ -119,6 +120,12 @@ function Disable-ExecutionPolicy
119120
Disable-ExecutionPolicy
120121
```
121122
123+
#### Change Execution Policy in the Registry
124+
125+
```powershell
126+
Set-ItemProperty HKCU:\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell -Name ExecutionPolicy -Value Unrestricted
127+
```
128+
122129
### Sudo for Windows
123130
124131
There may be times when you know the credentials for another user, but can't spawn other windows. The `sudo` equivalent in PowerShell on Windows machines is the verb `RunAs`. It is not as simple to use as `sudo`, however.

0 commit comments

Comments
 (0)