AWS - Directory Services / WorkDocs Enum

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 제로부터 전문가까지 배우세요!

HackTricks를 지원하는 다른 방법:

디렉터리 서비스

AWS Directory Service for Microsoft Active Directory는 AWS 클라우드에서 디렉터리를 설정, 운영 및 확장하기 쉽게 하는 관리형 서비스입니다. 실제 Microsoft Active Directory에 기반하며 다른 AWS 서비스와 밀접하게 통합되어 있어 디렉터리 관련 워크로드 및 AWS 리소스를 쉽게 관리할 수 있습니다. AWS Managed Microsoft AD를 사용하면 기존의 Active Directory 사용자, 그룹 및 정책을 활용하여 AWS 리소스에 대한 액세스를 관리할 수 있습니다. 이를 통해 ID 관리를 간소화하고 추가 ID 솔루션 필요성을 줄일 수 있습니다. AWS Managed Microsoft AD는 자동 백업 및 재해 복구 기능도 제공하여 디렉터리의 가용성과 내구성을 보장하는 데 도움을 줍니다. 전반적으로 AWS Directory Service for Microsoft Active Directory는 AWS 클라우드에서 관리되는, 고가용성 및 확장 가능한 Active Directory 서비스를 제공하여 시간과 리소스를 절약할 수 있습니다.

옵션

디렉터리 서비스를 통해 5 종류의 디렉터리를 생성할 수 있습니다:

  • AWS Managed Microsoft AD: AWS에서 새로운 Microsoft AD를 실행합니다. 관리자 암호를 설정하고 VPC에서 DC에 액세스할 수 있습니다.

  • Simple AD: Linux-Samba Active Directory 호환 서버가 됩니다. 관리자 암호를 설정하고 VPC에서 DC에 액세스할 수 있습니다.

  • AD Connector: 클라우드에 정보를 캐싱하지 않고 기존 Microsoft Active Directory로 디렉터리 요청을 리디렉션하는 프록시입니다. VPC에서 수신 대기하며 기존 AD에 액세스하기 위한 자격 증명을 제공해야 합니다.

  • Amazon Cognito User Pools: Cognito User Pools와 동일합니다.

  • Cloud Directory: 가장 간단한 디렉터리입니다. 사용할 스키마를 지정하고 사용량에 따라 청구됩니다.

AWS Directory 서비스를 사용하면 기존의 온프레미스 Microsoft AD와 동기화하거나 AWS에서 자체 디렉터리를 실행하거나 다른 디렉터리 유형과 동기화할 수 있습니다.

실습

여기에서 AWS에서 자체 Microsoft AD를 생성하는 좋은 튜토리얼을 찾을 수 있습니다: https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_tutorial_test_lab_base.html

열거

# Get directories and DCs
aws ds describe-directories
aws ds describe-domain-controllers --directory-id <id>
# Get directory settings
aws ds describe-trusts
aws ds describe-ldaps-settings --directory-id <id>
aws ds describe-shared-directories --owner-directory-id <id>
aws ds get-directory-limits
aws ds list-certificates --directory-id <id>
aws ds describe-certificate --directory-id <id> --certificate-id <id>

로그인

만약 디렉토리의 설명AccessUrl 필드에 도메인이 포함되어 있다면, 사용자는 아마도 AD 자격 증명으로 몇몇 AWS 서비스에 로그인할 수 있습니다:

  • <name>.awsapps.com/connect (Amazon Connect)

  • <name>.awsapps.com/workdocs (Amazon WorkDocs)

  • <name>.awsapps.com/workmail (Amazon WorkMail)

  • <name>.awsapps.com/console (Amazon Management Console)

  • <name>.awsapps.com/start (IAM Identity Center)

권한 상승

pageAWS - Directory Services Privesc

지속성

AD 사용자 활용

AD 사용자는 가정할 역할을 통해 AWS 관리 콘솔에 액세스할 수 있습니다. 기본 사용자 이름은 Admin이며 AWS 콘솔에서 비밀번호를 변경할 수 있습니다.

따라서, Admin의 비밀번호를 변경, 새 사용자를 생성하거나 사용자의 비밀번호를 변경하고 해당 사용자에게 액세스를 유지할 수 있는 역할을 부여할 수 있습니다. 또한 AD 내의 그룹에 사용자를 추가하고 해당 AD 그룹에 역할 액세스를 부여할 수도 있습니다 (이를 더 은밀하게 유지하기 위해).

AD 공유 (피해자에서 공격자로)

피해자로부터 공격자에게 AD 환경을 공유하는 것이 가능합니다. 이렇게 하면 공격자가 AD 환경에 계속 액세스할 수 있게 됩니다. 그러나 이는 관리되는 AD를 공유하고 VPC 피어링 연결을 생성하는 것을 의미합니다.

가이드는 여기에서 찾을 수 있습니다: https://docs.aws.amazon.com/directoryservice/latest/admin-guide/step1_setup_networking.html

AD 공유 (공격자에서 피해자로)

다른 AD 환경의 사용자에게 AWS 액세스 권한을 부여하여 한 AWS 계정에 액세스하는 것은 불가능해 보입니다.

WorkDocs

Amazon Web Services (AWS) WorkDocs는 클라우드 기반 파일 저장 및 공유 서비스입니다. AWS 클라우드 컴퓨팅 서비스 스위트의 일부이며 조직이 파일과 문서를 저장, 공유 및 협업할 수 있는 안전하고 확장 가능한 솔루션을 제공하기 위해 설계되었습니다.

AWS WorkDocs는 사용자가 파일과 문서를 업로드, 액세스 및 관리할 수 있는 웹 기반 인터페이스를 제공합니다. 또한 버전 관리, 실시간 협업 및 다른 AWS 서비스 및 제3자 도구와의 통합과 같은 기능을 제공합니다.

열거

# Get AD users (Admin not included)
aws workdocs describe-users --organization-id <directory-id>
# Get AD groups (containing "a")
aws workdocs describe-groups --organization-id d-9067a0285c --search-query a

# Create user (created inside the AD)
aws workdocs create-user --username testingasd --given-name testingasd --surname testingasd --password <password> --email-address name@directory.domain --organization-id <directory-id>

# Get what each user has created
aws workdocs describe-activities --user-id "S-1-5-21-377..."

# Get what was created in the directory
aws workdocs describe-activities --organization-id <directory-id>

# Get folder content
aws workdocs describe-folder-contents --folder-id <fold-id>

# Get file (a url to access with the content will be retreived)
aws workdocs get-document --document-id <doc-id>

# Get resource permissions if any
aws workdocs describe-resource-permissions --resource-id <value>

# Add permission so anyway can see the file
aws workdocs add-resource-permissions --resource-id <id> --principals Id=anonymous,Type=ANONYMOUS,Role=VIEWER
## This will give an id, the file will be acesible in: https://<name>.awsapps.com/workdocs/index.html#/share/document/<id>

권한 상승

pageAWS - WorkDocs Privesc
제로부터 영웅이 될 때까지 AWS 해킹을 배우세요 htARTE (HackTricks AWS Red Team Expert)!

HackTricks를 지원하는 다른 방법:

最終更新