Back to Checks
Amazon SageMaker training job has network isolation enabled
sagemaker_training_jobs_network_isolation_enabled
Service: sagemakerSeverity: high
OfficialBuilt-inVerified
Categories:trust-boundariesgen-aiinternet-exposed
Resource Type:Other
SageMaker training jobs have network isolation enabled, preventing the training container from making any inbound or outbound network calls during execution
Risk
Without network isolation, training code can reach the internet or internal services, enabling:
- Data exfiltration of datasets and model artifacts
- Supply-chain compromise via untrusted downloads
- C2 beacons and resource abuse This harms confidentiality and integrity, and may impact availability.
Run this check with Prowler
Run in Prowler CloudRun
prowler aws --checks sagemaker_training_jobs_network_isolation_enabledRecommendation
Enable network isolation for training jobs by default. If network access is required, enforce least privilege and defense in depth:
- Use private networking and
VPC endpoints - Restrict egress and narrow IAM permissions
- Prepackage dependencies to avoid external downloads
Remediation
Terraform
# SageMaker Training Job with network isolation enabled
resource "aws_sagemaker_training_job" "<example_resource_name>" {
name = "<example_resource_name>"
role_arn = "<example_resource_id>"
algorithm_specification {
training_image = "<example_resource_id>"
training_input_mode = "File"
}
output_data_config {
s3_output_path = "s3://<example_resource_name>/"
}
resource_config {
instance_type = "ml.m5.large"
instance_count = 1
volume_size_gb = 10
}
stopping_condition {
max_runtime_in_seconds = 3600
}
input_data_config {
channel_name = "training"
data_source {
s3_data_source {
s3_data_type = "S3Prefix"
s3_uri = "s3://<example_resource_name>/input/"
}
}
}
enable_network_isolation = true # Critical: blocks all network access from the training container
}NativeIaC
# CloudFormation: SageMaker Training Job with network isolation enabled
Resources:
<example_resource_name>:
Type: AWS::SageMaker::TrainingJob
Properties:
TrainingJobName: <example_resource_name>
RoleArn: <example_resource_id>
AlgorithmSpecification:
TrainingImage: <example_resource_id>
TrainingInputMode: File
OutputDataConfig:
S3OutputPath: s3://<example_resource_name>/
ResourceConfig:
InstanceType: ml.m5.large
InstanceCount: 1
VolumeSizeInGB: 10
StoppingCondition:
MaxRuntimeInSeconds: 3600
InputDataConfig:
- ChannelName: training
DataSource:
S3DataSource:
S3DataType: S3Prefix
S3Uri: s3://<example_resource_name>/input/
EnableNetworkIsolation: true # Critical: blocks all network access from the training containerOther
1In the AWS Console, open SageMaker > Training jobs
2Click Create training job
3Fill required fields (role, image, input/output, resources)
4Enable the setting: Enable network isolation
5Create the job
6Note: You cannot edit an existing training job to enable this; create a new job with network isolation and retire non-compliant jobs.
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.sagemaker.sagemaker_client import sagemaker_client
class sagemaker_training_jobs_network_isolation_enabled(Check):
def execute(self):
findings = []
for training_job in sagemaker_client.sagemaker_training_jobs:
report = Check_Report_AWS(metadata=self.metadata(), resource=training_job)
report.status = "PASS"
report.status_extended = f"Sagemaker training job {training_job.name} has network isolation enabled."
if not training_job.network_isolation:
report.status = "FAIL"
report.status_extended = f"Sagemaker training job {training_job.name} has network isolation disabled."
findings.append(report)
return findings