Back to Checks
aws

Amazon SageMaker model has network isolation enabled

sagemaker_models_network_isolation_enabled
Service: sagemakerSeverity: high
OfficialBuilt-inVerified
Categories:trust-boundariescontainer-securitygen-aiinternet-exposed
Resource Type:Other

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 Cloud
Run
prowler aws --checks sagemaker_models_network_isolation_enabled

Recommendation

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 enabled

Other

1In the AWS console, go to SageMaker > Inference > Models
2Click Create model
3Enter a name and select the execution role; set the container Image
4Check Enable network isolation
5Click Create model
6If used by an endpoint, create a new endpoint configuration with this model and update the endpoint, then remove the old non-isolated model

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