🛡️ GHSA-82jv-9wjw-pqh6 — derby

🟢 CVSS 2.0 — Low ✅ No Known Exploit CWE-1321 OSV
2.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

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 ``` emit(context: Context, target: T) { const node = traverseAndCreate(context.controller, this.segments); node[this.lastSegment] = target; this.addListeners(target, node, this.lastSegment); } ``` 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`. ``` it('ignores DOM mutations in components\' create()', function() { function Box() {} Box.view = { is: 'box', - source: '
' + source: '
' }; Box.prototype.create = function() { this.boxElement.className = 'box-changed-in-create'; }; var harness = runner.createHarness('', Box); expect(harness).to.render('
'); }); ``` 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. ``` emit(context: Context, target: T) { const node = traverseAndCreate(context.controller, this.segments); + if (this.lastSegment.includes('__proto__') || this.lastSegment.includes('prototype')) { + throw new Error('Unsafe code detected'); + } node[this.lastSegment] = target; this.addListeners(target, node, this.lastSegment); } ```

Weakness class

GHSA-82jv-9wjw-pqh6 is classified as CWE-1321: Prototype Pollution. Attacker input can modify an object prototype, changing behaviour for objects across the application.

Affected software

GHSA-82jv-9wjw-pqh6 is recorded against 1 package.

  • derby

Timeline and source

Published on 17 April 2024. No public exploit is currently recorded for this entry. Record sourced from OSV.

References

github.com (Web)
github.com (Web)
github.com (Web)
github.com (Package)

Details

Severity LOW
CVSS Score 2.0
CVSS Vector N/A
CWE CWE-1321
Public Exploit ✅ No
Source OSV
Published 2024-04-17
Updated 2026-08-20
Modified 2024-04-17
Fix URL N/A

Affected Packages

Software From version Fixed in
derby

Similar Threats

Free Vulnerability Check

Is your site affected by GHSA-82jv-9wjw-pqh6?

BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against GHSA-82jv-9wjw-pqh6 and other known CVE records.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesGitHub AdvisoryGitHub Advisory Undated