# CVE-2021-32773: Confused deputy attack in sandbox module resolution

> Attackers can hijack system module resolution in the Racket sandbox to execute arbitrary code and bypass security restrictions.

- **Severity:** Medium 6.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 19 Jul 2021
- **Updated:** 3 Aug 2024
- **Also known as:** DEBIAN-CVE-2021-32773, GHSA-cgrw-p7p7-937c, UBUNTU-CVE-2021-32773

## What is CVE-2021-32773?

CVE-2021-32773 is a medium-severity code injection vulnerability in racket, published on 19 Jul 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Racket is a general-purpose programming language and an ecosystem for language-oriented programming. In versions prior to 8.2, code evaluated using the Racket sandbox could cause system modules to incorrectly use attacker-created modules instead of their intended dependencies. This could allow system functions to be controlled by the attacker, giving access to facilities intended to be restricted. This problem is fixed in Racket version 8.2. A workaround is available, depending on system settings. For systems that provide arbitrary Racket evaluation, external sandboxing such as containers limit the impact of the problem. For multi-user evaluation systems, such as the `handin-server` system, it is not possible to work around this problem and upgrading is required.

Weakness: CWE-610 (Externally Controlled Reference to a Resource in Another Sphere), CWE-441 (Unintended Proxy or Intermediary)

## Which versions are affected by CVE-2021-32773?

It affects 1 product.


Products: Racket-Lang Racket.

## How do I fix CVE-2021-32773?

Upgrade to a fixed version.

## Is CVE-2021-32773 being exploited?

There is no known exploitation of CVE-2021-32773 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-32773 and fix it if it is affected.

What it is: CVE-2021-32773 is a medium-severity code injection vulnerability in racket, published on 19 Jul 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-32773 in the wild and no public exploit code.

Affected product: racket. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-32773/ (Markdown: https://insights.sbomify.com/CVE-2021-32773/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-32773
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-32773
- OSV: https://osv.dev/vulnerability/CVE-2021-32773

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-32773/
Summaries are generated and may contain mistakes; the official description above is the record.
