Improper Control of Generation of Code ('Code Injection') in @asyncapi/modelina
Description
Modelina is a library for generating data models based on inputs such as AsyncAPI, OpenAPI, or JSON Schema documents. Versions prior to 1.0.0 are vulnerable to Code injection. This issue affects anyone who is using the default presets and/or does not handle the functionality themself. This issue has been partially mitigated in version 1.0.0, with the maintainer's GitHub Security Advisory (GHSA) noting "It is impossible to fully guard against this, because users have access to the original raw information. However, as of version 1, if you only access the constrained models, you will not encounter this issue. Further similar situations are NOT seen as a security issue, but intended behavior." The suggested workaround from the maintainers is "Fully custom presets that change the entire rendering process which can then escape the user input."
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Modelina <1.0.0 allows code injection via crafted input properties when using default presets.
Vulnerability
Modelina, a library for generating data models from AsyncAPI, OpenAPI, or JSON Schema documents, is vulnerable to code injection in versions prior to 1.0.0. The bug occurs because the library does not sufficiently sanitize or escape user-provided property names or content when using default presets, allowing an attacker to inject arbitrary code into the generated output. As noted in the advisory, users have access to the original raw information, making total prevention difficult [2][3].
Exploitation
An attacker can craft malicious input, such as a JSON Schema with a property name containing injected code, as shown in the maintainer's example: 'property: any; \n constructor(){console.log("injected")} \n private _temp'. When processed with default presets, the generated code (e.g., TypeScript) includes the injected payload verbatim. No authentication is required beyond the ability to provide the schema input [3].
Impact
Successful exploitation allows an attacker to inject and execute arbitrary code within the language output (e.g., JavaScript/TypeScript) generated by Modelina. This can lead to arbitrary code execution in downstream systems or applications that consume the generated models. The impact is severe as it affects any user relying on default presets without custom sanitization [1][2].
Mitigation
The issue is partially mitigated in Modelina version 1.0.0, where using only constrained models prevents the vulnerability. The maintainers recommend fully custom presets that escape user input, as similar injection scenarios are considered intended behavior beyond version 1. There is no complete patch; users must adopt workarounds to stay secure [2][3].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
@asyncapi/modelinanpm | < 1.0.0 | 1.0.0 |
Affected products
3- asyncapi/modelinav5Range: < 1.0.0
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
3- github.com/advisories/GHSA-4jg2-84c2-pj95ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-23619ghsaADVISORY
- github.com/asyncapi/modelina/security/advisories/GHSA-4jg2-84c2-pj95ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.