The vulnerability exists in the dynamic component creation process within Angular Core. The createComponent function allows developers to create and mount components at runtime. This function internally calls locateHostElement to resolve the DOM element that will host the new component.
The root cause of the vulnerability is in the locateHostElement function (located in packages/core/src/render3/instructions/shared.ts). Before the patch, this function did not check if the resolved host element was a <script> tag. An attacker able to control the input to createComponent (specifically the hostElement or a selector that resolves to a script tag) could force an Angular component to be mounted inside a <script> or <svg:script> element. This would cause the browser to interpret the component's template or content as executable JavaScript, leading to a Cross-Site Scripting (XSS) vulnerability.
The fix, applied in commit 3cd005ec2d19b187fdb686b424fffe2c89214338, introduces a check within locateHostElement to explicitly throw an error if the host element is a <script> tag, thus preventing the component from being mounted and mitigating the XSS risk. While createComponent is the user-facing API, the vulnerable logic resided within locateHostElement.