CVE-2023-23619: @asyncapi/modelina Improper Control Of Generation Of Vulnerability
CRITICALCVE-2023-23619 is a CRITICAL (CVSS 9.9) improper control of generation of vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting @asyncapi/modelina libraries in the npm ecosystem. The issue involves improper control of generation of code ('code injection') in @asyncapi/modelina. Remediation is available by upgrading affected packages to version 1.0.0.
CVE-2023-23619 at a Glance
Security Impact
CVSS: 9.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2023-23619
To remediate this vulnerability, upgrade all affected @asyncapi/modelina dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @asyncapi/modelina@1.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @asyncapi/modelina
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2023-23619, inspect your project dependencies using npm:
npm ls @asyncapi/modelina
Analyze the terminal output to locate any version of @asyncapi/modelina in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0), your application is affected.
Note: The npm ls @asyncapi/modelina command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In @asyncapi/modelina, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-23619 Affected @asyncapi/modelina Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@asyncapi/modelina
|
npm |
< 1.0.0
|
1.0.0
|
References
Frequently Asked Questions
What is CVE-2023-23619?
Which @asyncapi/modelina versions are affected?
What version fixes CVE-2023-23619?
Is @asyncapi/modelina affected?
What is the CVSS score of CVE-2023-23619?
What CWE is associated with CVE-2023-23619?
How can I check npm dependencies for CVE-2023-23619?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4jg2-84c2-pj95",
"modified" : "2023-01-26T21:57:36Z",
"published" : "2021-09-21T18:41:59Z",
"aliases" : [ "CVE-2023-23619" ],
"summary" : "Improper Control of Generation of Code ('Code Injection') in @asyncapi/modelina",
"details" : "### Impact\nAnyone who is using the default presets and/or does not handle the functionality themself.\n\n### Patches\nIt 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.\n\nFurther similar situations are NOT seen as a security issue, but intended behavior.\n\n### Workarounds\nFully custom presets that change the entire rendering process which can then escape the user input.\n\n### For more information\nEven though that I changed all the presets here, the vulnerability is still present throughout. I am using a JSON Schema here for simplicity.\n```ts\nconst jsonSchemaDoc = {\n $id: 'CustomClass',\n type: 'object',\n properties: {\n 'property: any; \\n constructor(){console.log(\"injected\")} \\n private _temp': { type: 'string' },\n }\n};\ngenerator = new TypeScriptGenerator(\n { \n presets: [\n {\n class: {\n property({ propertyName, content }) {\n return `private ${propertyName}: any;`;\n },\n ctor() {\n return '';\n },\n getter() {\n return '';\n },\n setter() {\n return '';\n }\n }\n }\n ]\n }\n);\nconst inputModel = await generator.process(jsonSchemaDoc);\n```\nThis would render\n```ts\nexport class CustomClass {\n private property: any; \n constructor(){console.log(\"injected\")} \n private _temp: any;\n private additionalProperties: any;\n}\n```",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@asyncapi/modelina"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/asyncapi/modelina/security/advisories/GHSA-4jg2-84c2-pj95"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-23619"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/asyncapi/modelina"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-09-21T16:14:04Z",
"nvd_published_at" : "2023-01-26T21:18:00Z"
}
}