{"answers":{"affected":"2 open source packages ship an affected version, including io.swagger:swagger-codegen. It affects 1 product.","exploited":"There is no known exploitation of CVE-2021-21363 in the wild and no public exploit code.","fix":"Upgrade io.swagger:swagger-codegen to 2.4.19 or later.","what":"CVE-2021-21363 is a medium-severity vulnerability in swagger-api swagger-codegen, published on 11 Mar 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2021-21363 and fix it if it is affected.\n\nWhat it is: CVE-2021-21363 is a medium-severity vulnerability in swagger-api swagger-codegen, published on 11 Mar 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2021-21363 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- io.swagger:swagger-codegen (Maven): affected all versions; fixed in 2.4.19\n- io.swagger:swagger-codegen (Maven): affected all versions; fixed in 2.4.19\n\nTask:\n1. 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.\n2. 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.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2021-21363/ (Markdown: https://insights.sbomify.com/CVE-2021-21363/index.md)","id":"CVE-2021-21363","markdown":"https://insights.sbomify.com/CVE-2021-21363/index.md","name":"CVE-2021-21363","record":{"aliases":["GHSA-pc22-3g76-gm6j"],"analysis":{"component_type":"developer_tool","fix_type":"upgrade","impacts":["code_execution","privilege_escalation"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"Java code generator","requires_auth":"low_privilege","summary":"Local attackers can exploit a race condition in temporary directory creation to inject malicious code into generated files, leading to privilege escalation.","user_interaction":"required","vuln_class":"race_condition"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"swagger-codegen","vendor":"smartbear"}],"cvss":{"score":5.3,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:N/I:H/A:N","version":"3.1"},"cwes":[{"id":"CWE-379","name":"Creation of Temporary File in Directory with Insecure Permissions"},{"id":"CWE-378","name":"Creation of Temporary File With Insecure Permissions"}],"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.","ecosystems":["Maven"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Generator Web Application: Local Privilege Escalation Vulnerability via System Temp Directory","id":"CVE-2021-21363","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Maven","product":null,"products":[],"type":"race_condition","year":"2021"},"n_packages":2,"n_references":2,"next":{"headline":"Generated Code Contains Local Information Disclosure Vulnerability","id":"CVE-2021-21364"},"packages":[{"ecosystem":"Maven","fixed":["2.4.19"],"introduced":["0"],"last_affected":[],"package":"io.swagger:swagger-codegen","purl":null,"source":"GHSA-pc22-3g76-gm6j"},{"ecosystem":"Maven","fixed":["2.4.19"],"introduced":["0"],"last_affected":[],"package":"io.swagger:swagger-codegen","purl":"pkg:maven/io.swagger/swagger-codegen","source":"GHSA-pc22-3g76-gm6j"}],"prev":{"headline":"Bypassing readOnly policy by creating a temporary 'mc share upload' URL","id":"CVE-2021-21362"},"products":["swagger-codegen"],"published":"2021-03-11","related":[{"cvss_score":5.3,"headline":"Generated Code Contains Local Information Disclosure Vulnerability","id":"CVE-2021-21364","kev_date_added":null,"published":"2021-03-11"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":"PUBLISHED","updated":"2024-08-03","vendors":["swagger-api"]},"summary":"Local attackers can exploit a race condition in temporary directory creation to inject malicious code into generated files, leading to privilege escalation.","url":"https://insights.sbomify.com/CVE-2021-21363/"}