Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 74% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 30% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 98% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 3% | 0% |
> Sub-technique of: T1546
Adversaries may gain persistence and elevate privileges by executing malicious content triggered by PowerShell profiles. A PowerShell profile (<code>profile.ps1</code>) is a script that runs when PowerShell starts and can be used as a logon script to customize user environments.
PowerShell supports several profiles depending on the user or host program. For example, there can be different profiles for PowerShell host programs such as the PowerShell console, PowerShell ISE or Visual Studio Code. An administrator can also configure a profile that applies to all users and host programs on the local computer.
Adversaries may modify these profiles to include arbitrary commands, functions, modules, and/or PowerShell drives to gain persistence. Every time a user opens a PowerShell session the modified script will be executed unless the <code>-NoProfile</code> flag is used when it is launched.
An adversary may also be able to escalate privileges if a script in a PowerShell profile is loaded and executed by an account with higher privileges, such as a domain administrator.
Platforms: Windows
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Appends a start process cmdlet to the current user's powershell profile pofile that points to a malicious executable. Upon execution, calc.exe will be launched.
Supported Platforms: windows
powershellAdd-Content #{ps_profile} -Value "" Add-Content #{ps_profile} -Value "Start-Process #{exe_path}" powershell -Command exit
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
Enforce execution of only signed PowerShell scripts. Sign profiles to avoid them from being modified.
Making PowerShell profiles immutable and only changeable by certain administrators will limit the ability for adversaries to easily create user level persistence.
Avoid PowerShell profiles if not needed. Use the -No Profile flag with when executing PowerShell scripts remotely to prevent local profiles and scripts from being executed.
| Finding | Severity | Impact | | --------------------------------------- | -------- | -------------------- | | PowerShell Profile technique applicable | High | Privilege Escalation |
| CWE ID | Title | | ------- | ----------------------------- | | CWE-269 | Improper Privilege Management |
Other measured skills in the registry, with their headline benchmark lift.