AWS - Directory Services / WorkDocs Enum

Support HackTricks

Directory Services

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

Options

Directory Services는 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 Services는 기존의 온프레미스 Microsoft AD와 동기화하거나, AWS에서 자신의 디렉토리를 실행하거나, 다른 디렉토리 유형과 동기화할 수 있습니다.

Lab

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

Enumeration

# 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>

로그인

디렉토리의 description 필드에 domain이 **AccessUrl**에 포함되어 있다면, 이는 사용자가 일부 AWS 서비스에서 AD 자격 증명으로 로그인할 수 있음을 의미합니다:

  • <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)

권한 상승

AWS - 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 서비스 및 타사 도구와의 통합과 같은 기능을 제공합니다.

열거

# 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>

Privesc

AWS - WorkDocs Privesc
HackTricks 지원하기

Last updated