OpenZeppelin Contracts Wizard — это веб-приложение для интерактивного создания контракта из компонентов OpenZeppelin Contracts. Версии до 0.10.9 создают тестовый файл Hardhat (test/test.ts) путем интерполяции предоставленных пользователем opts.name (ERC20/ERC721) и opts.uri (ERC1155) непосредственно в строковые литералы TypeScript в zip-hardhat.ts:48 и :50 без экранирования строк JavaScript. Аутентификация не требуется: злоумышленник создает URL-адрес, например `https[:]//wizard[.]openzeppelin[.]com/#/erc20?name=");require("child_process").execSync("...");("` и делится им с разработчиком.
Когда жертва загружает полученный zip-архив и запускает `npx hardhat test`, внедренный код Node.js выполняется с привилегиями локальной ОС разработчика. Версия Версия 0.10.9 исправляет проблему.
Показать оригинальное описание (EN)
OpenZeppelin Contracts Wizardis a web application to interactively build a contract out of components from OpenZeppelin Contracts. Versions prior to 0.10.9 generate a Hardhat test file (`test/test.ts`) by interpolating user-supplied `opts.name` (ERC20/ERC721) and `opts.uri` (ERC1155) directly into TypeScript string literals at `zip-hardhat.ts:48` and `:50` without any JavaScript string escaping. No authentication is required: an attacker crafts a URL such as `https[:]//wizard[.]openzeppelin[.]com/#/erc20?name=");require("child_process").execSync("...");("` and shares it with a developer. When the victim downloads the resulting zip archive and runs `npx hardhat test`, the injected Node.js code executes with the developer's local OS privileges. Version 0.10.9 fixes the issue.
Характеристики атаки
Последствия
Строка CVSS v3.1