{"id":"GHSA-4jg2-84c2-pj95","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```","aliases":["CVE-2023-23619"],"modified":"2026-09-10T03:49:27.247012150Z","published":"2021-09-21T18:41:59Z","database_specific":{"github_reviewed_at":"2021-09-21T16:14:04Z","nvd_published_at":"2023-01-26T21:18:00Z","cwe_ids":["CWE-94"],"severity":"CRITICAL","github_reviewed":true},"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"}],"affected":[{"package":{"name":"@asyncapi/modelina","ecosystem":"npm","purl":"pkg:npm/%40asyncapi/modelina"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.0.0"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/09/GHSA-4jg2-84c2-pj95/GHSA-4jg2-84c2-pj95.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"}]}