CVE-2024-49048: Torchgeo Remote Code Execution Vulnerability
HIGHCVE-2024-49048 is a HIGH (CVSS 8.1) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Torchgeo libraries in the PyPI ecosystem. The issue involves torchgeo remote code execution vulnerability. Remediation is available by upgrading affected packages to version 0.6.1.
CVE-2024-49048 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-49048
To remediate this vulnerability, upgrade all affected Torchgeo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install torchgeo>=0.6.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show torchgeo
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-49048, inspect your installed packages using pip:
pip show torchgeo
Analyze the terminal output to locate any version of Torchgeo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.1), your application is affected.
Note: The pip show torchgeo 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 Torchgeo, 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
CVE-2024-49048 Affected Torchgeo Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
torchgeo
|
PyPI |
≥ 0.4
< 0.6.1
|
0.6.1
|
References
Frequently Asked Questions
What is CVE-2024-49048?
Which Torchgeo versions are affected?
What version fixes CVE-2024-49048?
Is torchgeo affected?
What is the CVSS score of CVE-2024-49048?
What CWE is associated with CVE-2024-49048?
How can I check PyPI dependencies for CVE-2024-49048?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-ghq9-vc6f-8qjf",
"modified" : "2026-04-01T00:03:56Z",
"published" : "2026-04-01T00:03:56Z",
"aliases" : [ "CVE-2024-49048" ],
"summary" : "TorchGeo Remote Code Execution Vulnerability",
"details" : "### Impact\n\nTorchGeo 0.4–0.6.0 used an [`eval`](https://docs.python.org/3/library/functions.html#eval) statement in its model weight API that could allow an unauthenticated, remote attacker to execute arbitrary commands. All platforms that expose [`torchgeo.models.get_weight()`](https://torchgeo.readthedocs.io/en/v0.6.0/api/models.html#torchgeo.models.get_weight) or [`torchgeo.trainers`](https://torchgeo.readthedocs.io/en/v0.6.0/api/trainers.html) as an external API could be affected.\n\n### Patches\n\nThe `eval` statement was replaced with a fixed enum lookup, preventing arbitrary code injection. All users are encouraged to upgrade to TorchGeo 0.6.1 or newer.\n\n### Workarounds\n\nIn unpatched versions, input validation and sanitization can be used to avoid this vulnerability.\n\n### References\n\n#### Bug history\n\n* Introduced: https://github.com/torchgeo/torchgeo/pull/917\n* Patched: https://github.com/torchgeo/torchgeo/pull/2323\n* Released: [v0.6.1](https://github.com/microsoft/torchgeo/releases/tag/v0.6.1)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "torchgeo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.4"
}, {
"fixed" : "0.6.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.6.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/torchgeo/torchgeo/security/advisories/GHSA-ghq9-vc6f-8qjf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-49048"
}, {
"type" : "WEB",
"url" : "https://github.com/torchgeo/torchgeo/pull/2323"
}, {
"type" : "WEB",
"url" : "https://github.com/torchgeo/torchgeo/pull/917"
}, {
"type" : "WEB",
"url" : "https://github.com/torchgeo/torchgeo/commit/1a980788cb7089a1115f3b786c7daa9dd47d7d7a"
}, {
"type" : "WEB",
"url" : "https://github.com/microsoft/torchgeo/releases/tag/v0.6.1"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/torchgeo/PYSEC-2024-204.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/torchgeo/torchgeo"
}, {
"type" : "WEB",
"url" : "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-49048"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94", "CWE-95" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-01T00:03:56Z",
"nvd_published_at" : null
}
}