0.15.3 Lateral movement – expanding privileges and access

2025.10.06.
AI Security Blog

Gaining a foothold is like picking the lock on a side door to a vast corporate campus. You’re inside, but you’re standing in an empty mailroom with no access to the labs, the server rooms, or the executive offices. Lateral movement is the art of navigating that campus: finding unattended keycards, exploiting internal trust relationships, and moving from that mailroom to the control center. In the context of AI systems, this means moving from a compromised component to the core of the ML pipeline.

From a Single Node to the Entire System

An attacker rarely lands exactly where they want to be. The initial point of compromise—often a public-facing API endpoint or a data ingestion service—is usually a low-privilege environment. The real damage is done after the attacker successfully pivots from this beachhead to more critical systems.

Kapcsolati űrlap - EN

Do you have a question about AI Security? Reach out to us here:

The goal of lateral movement is twofold:

  • Expand Access: Move from a single compromised machine or container to other systems within the network or cloud environment.
  • Escalate Privileges: Transition from a low-privilege user (like www-data on a web server) to a user with administrative rights, a service account with broad permissions, or even root.

In an AI ecosystem, this isn’t just about network hops. It’s about traversing the logical connections of the MLOps lifecycle. An attacker might move from an inference server to a model registry, then to the CI/CD pipeline that builds the models, and finally to the cloud storage buckets containing proprietary training data.

AI System Lateral Movement Pathway Foothold (e.g., Inference API) Pivot Point (e.g., Cloud Metadata) High-Value Targets Model Training Environment Proprietary Data Lake Scan & Harvest Escalate & Access

Common Vectors for Lateral Movement in AI Environments

While traditional techniques apply, the interconnected nature of modern ML pipelines creates unique opportunities for attackers.

1. Credential and Configuration Harvesting

The first step after gaining a foothold is to look for keys to other doors. Developers often leave sensitive information in configuration files, environment variables, or unsecured code repositories. In an AI context, you’re not just looking for database passwords; you’re hunting for credentials specific to the ML lifecycle.

# Simple Python script an attacker might run on a compromised host
import os

# List of keywords for sensitive AI/Cloud credentials
SENSITIVE_KEYS = [
    "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY",
    "MLFLOW_TRACKING_PASSWORD", "GOOGLE_APPLICATION_CREDENTIALS",
    "DATABRICKS_TOKEN", "HUGGING_FACE_HUB_TOKEN", "API_KEY"
]

print("[*] Searching for sensitive environment variables...")
for key, value in os.environ.items():
    for sensitive_key in SENSITIVE_KEYS:
        if sensitive_key in key.upper():
            print(f"[+] Found potential credential: {key}={value[:4]}...{value[-4:]}")

Finding a single cloud service account token can be enough to pivot from a single container to having control over entire storage, compute, or database services.

2. Abusing MLOps and CI/CD Pipeline Trust

MLOps platforms (like Kubeflow, MLflow, Airflow) and the underlying CI/CD systems (like Jenkins, GitLab CI) are powerful automation engines. They are built on trust—a training job is trusted to access data, a deployment script is trusted to configure infrastructure. An attacker who can influence any part of this pipeline can inherit its permissions.

For example, if an attacker can modify a requirements.txt file in a source repository that a CI/CD pipeline uses to build a model training container, they can inject a malicious package. When the pipeline runs, their code executes with the full permissions of the pipeline’s service account, potentially giving them access to the entire model training cluster.

3. Exploiting Cloud Infrastructure Misconfigurations

AI systems are rarely monolithic; they are distributed across cloud services. A common lateral movement technique in cloud environments is abusing the instance metadata service. On platforms like AWS, a compromised EC2 instance can query a local endpoint to retrieve credentials for its assigned IAM role. If that role is overly permissive, the game is over.

# Attacker on a compromised EC2 instance queries the metadata service
$ curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<ROLE_NAME>

# The service returns temporary credentials (AccessKeyId, SecretAccessKey, Token)
{
  "Code" : "Success",
  "LastUpdated" : "2023-11-21T18:30:00Z",
  "Type" : "AWS-HMAC",
  "AccessKeyId" : "ASIA...",
  "SecretAccessKey" : "wJalrX...",
  "Token" : "IQoJb3JpZ2luX2Vj...",
  "Expiration" : "2023-11-22T00:45:00Z"
}

# Attacker now uses these credentials to access other AWS services
$ aws s3 ls --profile <STOLEN_CREDS_PROFILE>

This allows an attacker to pivot from the limited context of one virtual machine to the broader context of the cloud account itself, potentially accessing S3 buckets with training data, SageMaker instances, or managed databases.

Key Targets for Lateral Movement

When moving laterally, an attacker prioritizes targets that offer the greatest strategic advantage. Here are some of the most valuable assets in an AI system.

Target System/Asset Attacker’s Goal Common Credentials/Access Method
Data Storage (e.g., S3, GCS, Data Lake) Steal or poison training data, exfiltrate sensitive user data. IAM Roles, Service Account Keys, Storage Access Tokens.
Model Registry (e.g., MLflow, SageMaker Registry) Steal proprietary models, substitute malicious models for deployment. API Keys, Username/Password, Kerberos Tickets.
Compute Cluster (e.g., Kubernetes, Spark Cluster) Hijack expensive GPU resources for other tasks (e.g., crypto mining), sabotage training jobs. SSH Keys, Kubeconfig files, Service Account Tokens.
CI/CD & Orchestration (e.g., Jenkins, Airflow) Gain persistent access and control over the entire ML lifecycle. The “keys to the kingdom”. CI/CD secrets, Service-to-service auth tokens, compromised developer credentials.

Successfully moving from a compromised web server to the CI/CD orchestrator is the difference between a minor security incident and a catastrophic breach. It is the critical phase where an attacker solidifies their control, preparing for the final stage: exploitation.