> For the complete documentation index, see [llms.txt](https://venator17.gitbook.io/bibliotheque/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://venator17.gitbook.io/bibliotheque/windows/privilege-escalation/privilege-abuse/setakeownershipprivilege.md).

# SeTakeOwnershipPrivilege

## <mark style="color:yellow;">ABOUT</mark>

<mark style="color:red;">**SeTakeOwnershipPrivilege**</mark> allows a user to <mark style="color:purple;">**assume ownership of any "securable object"**</mark>, including Active Directory objects, NTFS files and folders, printers, registry keys, services, and processes. This privilege grants <mark style="color:green;">`WRITE_OWNER`</mark> permissions on an object, enabling the user to modify its ownership within the security descriptor. By default, administrators possess this privilege. While it is uncommon for a standard user account to have this privilege, it may be assigned to service accounts responsible for tasks such as running backup jobs and managing VSS snapshots.

## <mark style="color:yellow;">Enable Privilege</mark>

For this we would use this script: [**\[LINK\]**](https://raw.githubusercontent.com/fashionproof/EnableAllTokenPrivs/master/EnableAllTokenPrivs.ps1)

```powershell
PS C:\> Import-Module .\Enable-Privilege.ps1
PS C:\> .\EnableAllTokenPrivs.ps1
```

## <mark style="color:yellow;">Accessing sensible file</mark>

#### Checking directory ownership

```powershell
PS C:\> cmd /c dir /q 'C:\Share'
```

#### Taking ownership

```powershell
PS C:\> takeown /f 'C:\Shares\file.txt'
```

#### **Confirming Ownership Changed**

```powershell
PS C:\> Get-ChildItem -Path 'C:\Share\file.txt' | select name,directory, @{Name="Owner";Expression={(Get-ACL $_.Fullname).Owner}}
```

#### Modifying File's ACL

```powershell
PS C:\> icacls 'C:\Share\file.txt' /grant venator17:F
```


---

# 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:

```
GET https://venator17.gitbook.io/bibliotheque/windows/privilege-escalation/privilege-abuse/setakeownershipprivilege.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.
