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)

๊ถŒํ•œ ์ƒ์Šน

์ง€์†์„ฑ

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

HackTricks ์ง€์›ํ•˜๊ธฐ

Last updated