APromptRiskDBThreat intelligence atlas
AI Case Study

Arbitrary Code Execution with Google Colab - AI Case Study

Google Colab is a Jupyter Notebook service that executes on virtual machines. Jupyter Notebooks are often used for ML and data science research and experimentation, containing executable snippets of Python code and common Unix command-line functionality. In addition to data manipulation and visualization, this code execution functionality can allow users to download arbitrary files from the internet, manipulate fi...

ExerciseGoogle ColabTony PiazzaInitial AccessImpactResource Development

Overview

Case steps8Steps described in the case record.
Techniques8Attack methods mentioned in the case steps.
Linked CVEs0Known vulnerabilities mentioned in the record.

Risk patterns

Patterns found in the case record and its linked vulnerabilities.

  • 1Dominant ATLAS tactic. Initial Access appears in 2 case steps.
  • 2Multiple attack methods. The case connects to 8 unique AI attack methods.

Procedure timeline

Search the case steps or filter them by attacker goal.

Initial Access2Impact2Resource Development1Execution1Collection1Exfiltration1
  1. Initial Access

    Jupyter notebooks are often used for ML and data science research and experimentation, containing executable snippets of Python code and common Unix command-line functionality. Users may come across a compromised notebook on public websites or through direct sharing.

  2. Initial Access

    A victim user may mount their Google Drive into the compromised Colab notebook. Typical reasons to connect machine learning notebooks to Google Drive include the ability to train on data stored there or to save model output files. Upon execution, a popup appears to confirm access and warn about potential data access: > This notebook is requesting access to your Google Drive files. Granting access to Google Drive will permit code executed in the notebook to modify files in your Google Drive. Make sure to review notebook code prior to allowing this access. A victim user may nonetheless accept the popup and allow the compromised Colab notebook access to the victim''s Drive. Permissions granted include: - Create, edit, and delete access for all Google Drive files - View Google Photos data - View Google contacts

    Defanged prompt excerptcollapsed by default
    Security note: content in this block is escaped, defanged and intended for analysis only.
    from google[.]colab import drive
    drive.mount(''/content/drive'')
  3. Execution

    A victim user may unwittingly execute malicious code provided as part of a compromised Colab notebook. Malicious code can be obfuscated or hidden in other files that the notebook downloads.

  4. Collection

    Adversary may search the victim system to find private and proprietary data, including ML model artifacts. Jupyter Notebooks allow execution of shell commands. This example searches the mounted Drive for PyTorch model checkpoint files: > /content/drive/MyDrive/models/checkpoint.pt

    Defanged prompt excerptcollapsed by default
    Security note: content in this block is escaped, defanged and intended for analysis only.
    !find /content/drive/MyDrive/ -type f -name *.pt
  5. Exfiltration

    As a result of Google Drive access, the adversary may open a server to exfiltrate private data or ML model artifacts. An example from the referenced article shows the download, installation, and usage of ngrok, a server application, to open an adversary-accessible URL to the victim's Google Drive and all its files.

  6. Impact

    Exfiltrated data may include sensitive or private data such as proprietary data stored in Google Drive, as well as user contacts and photos. As a result, the user may be harmed financially, reputationally, and more.

Mitigations

Defenses connected to the attack methods in this case.

Sources

Original public records and references for this case.