AWS Amplify Studio Codegen Package Vulnerable to Arbitrary JavaScript Execution via Unvalidated Component Properties
AWS has disclosed a security advisory for amplify-codegen-ui, the package that generates front-end code from AWS Amplify Studio UI Builder entities (components, forms, views, and themes). The package is used both in Amplify Studio for component previews and in the AWS CLI when generating component files in customers' local applications. Versions <=2.20.2 are affected and the issue is tracked as CVE-2025-4318 (GHSA-hf3j-86p7-mfw8).
According to AWS, the flaw lies in the property binding process: the expression-binding function does not validate component schema properties before converting them into expressions. When a schema is imported via the create-component AWS CLI command, Amplify Studio generates the component on the user's behalf using that unvalidated input. As a result, an authenticated user who can create or modify components could run arbitrary JavaScript during the component rendering and build process. AWS has partially addressed this in 2.20.3, with additional fixes landing in 2.20.4.
Why It Matters
This is a code-execution primitive triggered through a normally trusted workflow — component schema import — rather than an obvious injection point. Organizations using Amplify Studio for low-code/UI-builder front-end generation, or teams that consume @aws-amplify/codegen-ui-react in their own build pipelines, are affected. Because the execution happens during rendering/build, exploitation could lead to compromise of the build environment or supply-chain-style impact on generated application code, not just a runtime app-level issue. AWS notes there are no workarounds short of upgrading.
What Defenders Should Do
- Inventory usage of
amplify-codegen-ui/@aws-amplify/codegen-ui-reactacross Amplify Studio projects, CLI tooling, and any forked or derivative codegen logic; upgrade to 2.20.4 or later. - Review who has permission to create or modify UI Builder components, since exploitation requires an authenticated user with that access.
- Audit CI/CD and local build pipelines that invoke
create-componentfor unexpected script execution, unfamiliar child processes, or unauthorized network/file activity during Amplify component generation. - Treat imported component schemas as untrusted input pending patch confirmation, and review recent component imports for anomalous or unfamiliar expression bindings.
This is fresh, developing intel from a same-day GHSA advisory with a public PoC status noted; details may evolve as AWS and the community publish further analysis. For the full technical writeup and patch links, see the original advisory: GHSA-hf3j-86p7-mfw8.