Skip to content

Importing a session or model package can run arbitrary code #1065

Backlog

Description

@Irozuku

Summary

Importing a session, generative session or model package unpickles files taken from the uploaded archive. A crafted package runs arbitrary code on the user's machine during import, and the import endpoints need no authentication.

Where

Found at 44d4e5a, still present on develop (f5b2c3e).

Zip extraction itself is safe (safe_extract blocks zip slip). The problem is deserializing the extracted content. A harmless test payload confirmed that code runs at pickle.load inside the real loader, before any validation of the result.

Impact

Code execution as the user running DashAI, from a single upload. The upload is a multipart/form-data POST, which browsers send cross site without a CORS preflight, so a web page the user visits can submit it to the local API. The CORS allowlist in #1063 only stops that page from reading the response, not the import itself.

Suggested fix

  • Write plots and artifacts as JSON. For legacy pickled files, use a restricted Unpickler with an explicit allowlist, or skip them with a warning.
  • Use torch.load(..., weights_only=True) everywhere a stored or imported model is loaded.
  • For artifacts that must stay pickled (for example scikit learn estimators saved with joblib), make importing them an explicit user decision: a warning in the import dialog that only trusted packages should be imported, and a confirmation flag the endpoint requires.

Activity

  1. added
    bug
    back
    priority: high
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backbugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions