CVE-2025-5321: Aim Remote Code Execution Vulnerability

LOW
Advisory Identifier: GHSA-gp5h-f9c5-8355
CVSS 6.3
CWE-94
Published
Advisory Summary

CVE-2025-5321 is a LOW (CVSS 6.3) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Aim libraries in the PyPI ecosystem. The issue involves aim vulnerable to sandbox escape leading to remote code execution. Remediation is available in the latest vendor maintenance releases.

CVE-2025-5321 at a Glance

CVE Identifier CVE-2025-5321
GHSA Identifier GHSA-gp5h-f9c5-8355
Severity LOW
CVSS v3.1 Base Score 6.3
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Aim
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2025-5321

To remediate this vulnerability, upgrade all affected Aim dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

aim fixed: Latest secure release
pip install aim>=Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show aim

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-5321, inspect your installed packages using pip:

pip show aim

Analyze the terminal output to locate any version of Aim in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The pip show aim command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Aim, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A vulnerability classified as critical was found in aimhubio aim up to 3.29.1. This vulnerability affects the function RestrictedPythonQuery of the file /aim/storage/query.py of the component run_view Object Handler. The manipulation of the argument Query leads to sandbox issue. The attack can be initiated remotely. The exploit has been disclosed to the public and may be used. The vendor was contacted early about this disclosure but did not respond in any way.

CVE-2025-5321 Affected Aim Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
aim
PyPI
≤ 3.29.1

References

Frequently Asked Questions

What is CVE-2025-5321?
CVE-2025-5321 is a security vulnerability in Aim involving Aim Vulnerable to Sandbox Escape Leading to Remote Code Execution under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Aim versions are affected?
Affected versions include releases prior to current release patches across affected packages: aim.
What version fixes CVE-2025-5321?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is aim affected?
Yes, aim is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-5321?
CVE-2025-5321 has a CVSS v3.1 base score of 6.3 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2025-5321?
CVE-2025-5321 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2025-5321?
Run the dependency tree command: 'pip show aim'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gp5h-f9c5-8355",
  "modified" : "2025-06-05T00:34:03Z",
  "published" : "2025-05-29T15:31:09Z",
  "aliases" : [ "CVE-2025-5321" ],
  "summary" : "Aim Vulnerable to Sandbox Escape Leading to Remote Code Execution",
  "details" : "A vulnerability classified as critical was found in aimhubio aim up to 3.29.1. This vulnerability affects the function RestrictedPythonQuery of the file /aim/storage/query.py of the component run_view Object Handler. The manipulation of the argument Query leads to sandbox issue. The attack can be initiated remotely. The exploit has been disclosed to the public and may be used. The vendor was contacted early about this disclosure but did not respond in any way.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "aim"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "3.29.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-5321"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/superboy-zjc/1fc4747a0ac77a1edc8c32e1d4edc54c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aimhubio/aim"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?ctiid.310492"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.310492"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?submit.580253"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-06-05T00:34:03Z",
    "nvd_published_at" : "2025-05-29T15:15:34Z"
  }
}