CVE-2021-43811: Sockeye Code Injection Vulnerability

HIGH
Advisory Identifier: GHSA-ggmr-44cv-24pm
CVSS 7.8
CWE-94
Published
Advisory Summary

CVE-2021-43811 is a HIGH (CVSS 7.8) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Sockeye libraries in the PyPI ecosystem. The issue involves code injection via unsafe yaml loading. Remediation is available by upgrading affected packages to version 2.3.24.

CVE-2021-43811 at a Glance

CVE Identifier CVE-2021-43811
GHSA Identifier GHSA-ggmr-44cv-24pm
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Sockeye
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

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

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

How to Fix CVE-2021-43811

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

sockeye fixed: 2.3.24
pip install sockeye>=2.3.24
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 sockeye

How to Check if You Are Affected

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

pip show sockeye

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

Note: The pip show sockeye 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 Sockeye, 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

### Impact Sockeye uses YAML to store model and data configurations on disk. Versions below 2.3.24 use unsafe YAML loading, which can be made to execute arbitrary code embedded in config files. An attacker can add malicious code to the config file of a trained model and attempt to convince users to download and run it. If users run the model, the embedded code will run locally. ### Patches The issue is fixed in version 2.3.24 and above by #964. ### For more information If you have any questions or comments about this advisory: * Open an issue in [awslabs/sockeye](https://github.com/awslabs/sockeye) * Email us at [sockeye-dev](mailto:sockeye-dev@amazon.com) ### Attribution This vulnerability was reported by Masatoshi Yoshizawa of yamory Security Team.

CVE-2021-43811 Affected Sockeye Versions

1 component(s)
Fixed Versions:
2.3.24
Product / Package Ecosystem Affected Versions Fixed Version
sockeye
PyPI
< 2.3.24
2.3.24

References

Frequently Asked Questions

What is CVE-2021-43811?
CVE-2021-43811 is a security vulnerability in Sockeye involving Code injection via unsafe YAML loading under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Sockeye versions are affected?
Affected versions include releases prior to 2.3.24 across affected packages: sockeye.
What version fixes CVE-2021-43811?
Upgrading to 2.3.24 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sockeye affected?
Yes, sockeye is affected in releases prior to 2.3.24. Upgrade your dependency to 2.3.24 or later.
What is the CVSS score of CVE-2021-43811?
CVE-2021-43811 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-43811?
CVE-2021-43811 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-2021-43811?
Run the dependency tree command: 'pip show sockeye'. 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-ggmr-44cv-24pm",
  "modified" : "2024-10-25T14:50:22Z",
  "published" : "2021-12-09T18:35:22Z",
  "aliases" : [ "CVE-2021-43811" ],
  "summary" : "Code injection via unsafe YAML loading",
  "details" : "### Impact\nSockeye uses YAML to store model and data configurations on disk.  Versions below 2.3.24 use unsafe YAML loading, which can be made to execute arbitrary code embedded in config files.\n\nAn attacker can add malicious code to the config file of a trained model and attempt to convince users to download and run it.  If users run the model, the embedded code will run locally.\n\n### Patches\nThe issue is fixed in version 2.3.24 and above by #964.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [awslabs/sockeye](https://github.com/awslabs/sockeye)\n* Email us at [sockeye-dev](mailto:sockeye-dev@amazon.com)\n\n### Attribution\nThis vulnerability was reported by Masatoshi Yoshizawa of yamory Security Team.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "sockeye"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.3.24"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/awslabs/sockeye/security/advisories/GHSA-ggmr-44cv-24pm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43811"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/awslabs/sockeye/pull/964"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/awslabs/sockeye"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/awslabs/sockeye/releases/tag/2.3.24"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/sockeye/PYSEC-2021-848.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-08T23:14:41Z",
    "nvd_published_at" : "2021-12-08T23:15:00Z"
  }
}