Описание
Prototype pollution in emit function
Summary
A prototype pollution in derby can crash the application, if the application author has atypical HTML templates that feed user input into an object key.
Attribute keys are almost always developer-controlled, not end-user-controlled, so this shouldn't be an issue in practice for most applications.
Details
The emit() function in src/templates/templates.ts is called without sanitizing the variable this.lastSegment . The variable this.lastSegment can be set to __proto__, and this will pollute the prototype of Javascipt Object (node['__proto__'] = target).
PoC
To reproduce this vulnerability, you can adjust the test case ignores DOM mutations in components\' create() in test/dom/ComponentHarness.mocha.js.
When as attribute is controlled by attackers, the variable in this.lastSegment will exactly take value __proto__ and prototype pollution happens.
Patch
Add a check on this.lastSegment can prevent this attack.
Пакеты
derby
<= 2.3.1
2.3.2
derby
>= 3.0.0, <= 3.0.1
3.0.2
derby
>= 4.0.0-beta1, <= 4.0.0-beta.10
4.0.0-beta.11