Amazon SageMaker model has network isolation enabled
SageMaker models are evaluated for network isolation status, indicating whether model containers are blocked from initiating network connections during hosting/inference, aside from required service control traffic.
Risk
Disabled network isolation allows model containers to reach external networks, enabling exfiltration of inputs, outputs, or credentials, retrieval of untrusted code, and covert callbacks. This compromises confidentiality and integrity and can facilitate lateral movement from the hosting environment.
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks sagemaker_models_network_isolation_enabledRecommendation
Enable network isolation for all hosted models. Run endpoints in a private VPC, restrict egress with tight security groups and VPC endpoints, and enforce least privilege IAM. Adopt defense in depth: avoid public routes, allow-list destinations, and monitor outbound traffic.
Remediation
Terraform
# SageMaker Model with network isolation enabled
resource "aws_sagemaker_model" "<example_resource_name>" {
name = "<example_resource_name>"
execution_role_arn = "<example_resource_arn>"
primary_container {
image = "<example_image>"
}
enable_network_isolation = true # Critical: enables network isolation to pass the check
}NativeIaC
# CloudFormation: SageMaker Model with network isolation enabled
Resources:
<example_resource_name>:
Type: AWS::SageMaker::Model
Properties:
ExecutionRoleArn: <example_resource_arn>
PrimaryContainer:
Image: <example_image>
EnableNetworkIsolation: true # Critical: ensures the model container has network isolation enabledOther
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_models_network_isolation_enabled(Check):
def execute(self):
findings = []
for model in sagemaker_client.sagemaker_models:
report = Check_Report_AWS(metadata=self.metadata(), resource=model)
report.status = "PASS"
report.status_extended = f"Sagemaker notebook instance {model.name} has network isolation enabled."
if not model.network_isolation:
report.status = "FAIL"
report.status_extended = f"Sagemaker notebook instance {model.name} has network isolation disabled."
findings.append(report)
return findings