AWS - SageMaker Enum
{{#include ../../../../banners/hacktricks-training.md}}
Przegląd usługi
Amazon SageMaker is AWS' managed machine-learning platform that glues together notebooks, training infrastructure, orchestration, registries, and managed endpoints. A compromise of SageMaker resources typically provides:
- Long-lived IAM execution roles with broad S3, ECR, Secrets Manager, or KMS access.
- Access to sensitive datasets stored in S3, EFS, or inside feature stores.
- Network footholds inside VPCs (Studio apps, training jobs, endpoints).
- High-privilege presigned URLs that bypass console authentication.
Understanding how SageMaker is assembled is key before you pivot, persist, or exfiltrate data.
Główne elementy składowe
- Studio Domains & Spaces: Web IDE (JupyterLab, Code Editor, RStudio). Each domain has a shared EFS file system and default execution role.
- Notebook Instances: Managed EC2 instances for standalone notebooks; use separate execution roles.
- Training / Processing / Transform Jobs: Ephemeral containers that pull code from ECR and data from S3.
- Pipelines & Experiments: Orchestrated workflows that describe all steps, inputs, and outputs.
- Models & Endpoints: Packaged artefacts deployed for inference via HTTPS endpoints.
- Feature Store & Data Wrangler: Managed services for data preparation and feature management.
- Autopilot & JumpStart: Automated ML and curated model catalogue.
- MLflow Tracking Servers: Managed MLflow UI/API with presigned access tokens.
Every resource references an execution role, S3 locations, container images, and optional VPC/KMS configuration—capture all of them during enumeration.
Konto i metadane globalne
REGION=us-east-1
# Portfolio status, used when provisioning Studio resources
aws sagemaker get-sagemaker-servicecatalog-portfolio-status --region $REGION
# List execution roles used by models (extend to other resources as needed)
aws sagemaker list-models --region $REGION --query 'Models[].ExecutionRoleArn' --output text | tr ' ' '
' | sort -u
# Generic tag sweep across any SageMaker ARN you know
aws sagemaker list-tags --resource-arn <sagemaker-arn> --region $REGION
Zanotuj wszelkie cross-account trust (execution roles lub S3 buckets z zewnętrznymi principalami) oraz podstawowe ograniczenia, takie jak service control policies (SCPs).
Studio Domains, Apps & Shared Spaces
aws sagemaker list-domains --region $REGION
aws sagemaker describe-domain --domain-id <domain-id> --region $REGION
aws sagemaker list-user-profiles --domain-id-equals <domain-id> --region $REGION
aws sagemaker describe-user-profile --domain-id <domain-id> --user-profile-name <profile> --region $REGION
# Enumerate apps (JupyterServer, KernelGateway, RStudioServerPro, CodeEditor, Canvas, etc.)
aws sagemaker list-apps --domain-id-equals <domain-id> --region $REGION
aws sagemaker describe-app --domain-id <domain-id> --user-profile-name <profile> --app-type JupyterServer --app-name default --region $REGION
# Shared collaborative spaces
aws sagemaker list-spaces --domain-id-equals <domain-id> --region $REGION
aws sagemaker describe-space --domain-id <domain-id> --space-name <space> --region $REGION
# Studio lifecycle configurations (shell scripts at start/stop)
aws sagemaker list-studio-lifecycle-configs --region $REGION
aws sagemaker describe-studio-lifecycle-config --studio-lifecycle-config-name <name> --region $REGION
Co zapisać:
DomainArn,AppSecurityGroupIds,SubnetIds,DefaultUserSettings.ExecutionRole.- Zamontowany EFS (
HomeEfsFileSystemId) oraz katalogi domowe w S3. - Skrypty lifecycle (często zawierają poświadczenia bootstrap lub dodatkowy kod do push/pull).
Tip
Presigned Studio URLs mogą ominąć uwierzytelnianie, jeśli są szeroko udostępnione.
Notebook Instances & Lifecycle Configs
aws sagemaker list-notebook-instances --region $REGION
aws sagemaker describe-notebook-instance --notebook-instance-name <name> --region $REGION
aws sagemaker list-notebook-instance-lifecycle-configs --region $REGION
aws sagemaker describe-notebook-instance-lifecycle-config --notebook-instance-lifecycle-config-name <cfg> --region $REGION
Metadane notebooka ujawniają:
- Rola wykonawcza (
RoleArn), bezpośredni dostęp do internetu vs. tryb tylko VPC. - Lokalizacje S3 w
DefaultCodeRepository,DirectInternetAccess,RootAccess. - Skrypty cyklu życia zawierające poświadczenia lub mechanizmy utrwalania.
Training, Processing, Transform & Batch Jobs
aws sagemaker list-training-jobs --region $REGION
aws sagemaker describe-training-job --training-job-name <job> --region $REGION
aws sagemaker list-processing-jobs --region $REGION
aws sagemaker describe-processing-job --processing-job-name <job> --region $REGION
aws sagemaker list-transform-jobs --region $REGION
aws sagemaker describe-transform-job --transform-job-name <job> --region $REGION
Sprawdź:
AlgorithmSpecification.TrainingImage/AppSpecification.ImageUri– które obrazy ECR są wdrożone.InputDataConfig&OutputDataConfig– bucketów S3, prefiksów i kluczy KMS.ResourceConfig.VolumeKmsKeyId,VpcConfig,EnableNetworkIsolation– określają konfigurację sieciową lub szyfrowania.HyperParametersmogą leak sekretów środowiskowych lub ciągów połączeń.
Potoki, eksperymenty i próby
aws sagemaker list-pipelines --region $REGION
aws sagemaker list-pipeline-executions --pipeline-name <pipeline> --region $REGION
aws sagemaker describe-pipeline --pipeline-name <pipeline> --region $REGION
aws sagemaker list-experiments --region $REGION
aws sagemaker list-trials --experiment-name <experiment> --region $REGION
aws sagemaker list-trial-components --trial-name <trial> --region $REGION
Definicje pipeline'ów zawierają szczegóły każdego kroku, powiązanych ról, obrazów kontenerów oraz zmiennych środowiskowych. Komponenty Trial często zawierają URI artefaktów treningowych, logi S3 oraz metryki sugerujące przepływ wrażliwych danych.
Modele, konfiguracje endpointów & wdrożone endpointy
aws sagemaker list-models --region $REGION
aws sagemaker describe-model --model-name <name> --region $REGION
aws sagemaker list-endpoint-configs --region $REGION
aws sagemaker describe-endpoint-config --endpoint-config-name <cfg> --region $REGION
aws sagemaker list-endpoints --region $REGION
aws sagemaker describe-endpoint --endpoint-name <endpoint> --region $REGION
Główne obszary:
- URI artefaktów modelu w S3 (
PrimaryContainer.ModelDataUrl) oraz obrazy kontenerów do inferencji. - Konfiguracja przechwytywania danych endpointu (S3 bucket, KMS) pod kątem możliwego wycieku logów.
- Wielomodelowe endpointy używające
S3DataSourcelubModelPackage(sprawdź cross-account packaging). - Konfiguracje sieciowe i grupy bezpieczeństwa przypisane do endpointów.
Feature Store, Data Wrangler & Clarify
aws sagemaker list-feature-groups --region $REGION
aws sagemaker describe-feature-group --feature-group-name <feature-group> --region $REGION
aws sagemaker list-data-wrangler-flows --region $REGION
aws sagemaker describe-data-wrangler-flow --flow-name <flow> --region $REGION
aws sagemaker list-model-quality-job-definitions --region $REGION
aws sagemaker list-model-monitoring-schedule --region $REGION
Wnioski bezpieczeństwa:
- Online feature stores replikują dane do Kinesis; sprawdź
OnlineStoreConfig.SecurityConfig.KmsKeyIdi VPC. - Flows w Data Wrangler często zawierają poświadczenia JDBC/Redshift lub prywatne punkty końcowe.
- Zadania Clarify/Model Monitor eksportują dane do S3, które mogą być dostępne publicznie (world-readable) lub dostępne dla innych kont (cross-account).
MLflow Tracking Servers, Autopilot & JumpStart
aws sagemaker list-mlflow-tracking-servers --region $REGION
aws sagemaker describe-mlflow-tracking-server --tracking-server-name <name> --region $REGION
aws sagemaker list-auto-ml-jobs --region $REGION
aws sagemaker describe-auto-ml-job --auto-ml-job-name <name> --region $REGION
aws sagemaker list-jumpstart-models --region $REGION
aws sagemaker list-jumpstart-script-resources --region $REGION
- Serwery śledzenia MLflow przechowują eksperymenty i artefakty; presigned URLs mogą ujawnić wszystko.
- Autopilot jobs spin multiple training jobs — enumerate outputs for hidden data.
- JumpStart reference architectures mogą wdrożyć privileged roles do konta.
IAM & kwestie sieciowe
- Wypisz polityki IAM przypisane do wszystkich execution roles (Studio, notebooks, training jobs, pipelines, endpoints).
- Sprawdź kontekst sieciowy: subnets, security groups, VPC endpoints. Wiele organizacji izoluje training jobs, ale zapomina ograniczyć ruch wychodzący.
- Przejrzyj polityki bucketów S3 odwoływane w
ModelDataUrl,DataCaptureConfig,InputDataConfigpod kątem dostępu zewnętrznego.
Privilege Escalation
{{#ref}} ../../aws-privilege-escalation/aws-sagemaker-privesc/README.md {{#endref}}
Persistence
{{#ref}} ../../aws-persistence/aws-sagemaker-persistence/README.md {{#endref}}
Post-Exploitation
{{#ref}} ../../aws-post-exploitation/aws-sagemaker-post-exploitation/README.md {{#endref}}
Unauthorized Access
{{#ref}} ../aws-sagemaker-unauthenticated-enum/README.md {{#endref}}
Referencje
- AWS SageMaker Documentation
- AWS CLI SageMaker Reference
- SageMaker Studio Architecture
- SageMaker Security Best Practices
{{#include ../../../../banners/hacktricks-training.md}}