10.0critical
Improper Control of Generation of Code ('Code Injection') in @asyncapi/modelina
- Severity
- 10.0critical CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.08% (higher than 65% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-4jg2-84c2-pj95
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."
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| asyncapi modelina | < 1.0.0 | CVE List |
| @asyncapi/modelina (npm) | before 1.0.0 | GitHub Advisory Database |
| lfprojects modelina | before 1.0.0 | NVD |
All scores
| GitHub_M | 10.0critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H |
| GitHub | 9.9critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
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."
GitHub Advisory Database
Impact
Anyone who is using the default presets and/or does not handle the functionality themself.
Patches
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.
Workarounds
Fully custom presets that change the entire rendering process which can then escape the user input.
For more information
Even though that I changed all the presets here, the vulnerability is still present throughout. I am using a JSON Schema here for simplicity.
const jsonSchemaDoc = {
$id: 'CustomClass',
type: 'object',
properties: {
'property: any; \n constructor(){console.log("injected")} \n private _temp': { type: 'string' },
}
};
generator = new TypeScriptGenerator(
{
presets: [
{
class: {
property({ propertyName, content }) {
return `private ${propertyName}: any;`;
},
ctor() {
return '';
},
getter() {
return '';
},
setter() {
return '';
}
}
}
]
}
);
const inputModel = await generator.process(jsonSchemaDoc);
This would render
export class CustomClass {
private property: any;
constructor(){console.log("injected")}
private _temp: any;
private additionalProperties: any;
}
NVD (es)
Modelina es una librería para generar modelos de datos basados en entradas como documentos AsyncAPI, OpenAPI o JSON Schema. Las versiones anteriores a la 1.0.0 son vulnerables a la inyección de código. Este problema afecta a cualquiera que utilice los ajustes preestablecidos predeterminados y/o no maneje la funcionalidad por sí mismo. Este problema se ha mitigado parcialmente en la versión 1.0.0, y el GitHub Security Advisory (GHSA) del fabricante señala: "Es imposible protegerse completamente contra esto, porque los usuarios tienen acceso a la información sin procesar original. Sin embargo, a partir de la versión 1, si solo accede a los modelos restringidos, no encontrará este problema. Otras situaciones similares NO se consideran un problema de seguridad, sino un comportamiento previsto". La solución sugerida por los fabricantees es "Preajustes totalmente personalizados que cambian todo el proceso de renderizado y luego pueden escapar de la entrada del usuario".
References
| https://github.com/asyncapi/modelina/security/advisories/GHSA-4jg2-84c2-pj95 | exploit, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2023-23619 | advisory | |
| https://github.com/asyncapi/modelina | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-23619 changed 2025-03-10 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-4jg2-84c2-pj95 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2023-23619 changed 2026-06-17 | Public domain |