{"answers":{"affected":"6 open source packages ship an affected version, including derby.","exploited":"There is no known exploitation of GHSA-82jv-9wjw-pqh6 in the wild and no public exploit code.","fix":"Upgrade derby to a fixed version for your release line: 2.3.2, 3.0.2 or 4.0.0-beta.11.","what":"GHSA-82jv-9wjw-pqh6 is a vulnerability in derby, published on 17 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-82jv-9wjw-pqh6 and fix it if it is affected.\n\nWhat it is: GHSA-82jv-9wjw-pqh6 is a vulnerability in derby, published on 17 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-82jv-9wjw-pqh6 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- derby (npm): affected all versions; fixed in 2.3.2\n- derby (npm): affected all versions; fixed in 2.3.2\n- derby (npm): affected from 3.0.0; fixed in 3.0.2\n- derby (npm): affected from 3.0.0; fixed in 3.0.2\n- derby (npm): affected from 4.0.0-beta1; fixed in 4.0.0-beta.11\n- derby (npm): affected from 4.0.0-beta1; fixed in 4.0.0-beta.11\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-82jv-9wjw-pqh6/ (Markdown: https://insights.sbomify.com/GHSA-82jv-9wjw-pqh6/index.md)","id":"GHSA-82jv-9wjw-pqh6","markdown":"https://insights.sbomify.com/GHSA-82jv-9wjw-pqh6/index.md","name":"GHSA-82jv-9wjw-pqh6","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Derby JS framework","requires_auth":"none","summary":"Prototype pollution in Derby's emit function allows attackers to crash the application via crafted HTML template attributes.","user_interaction":"not_required","vuln_class":"other"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\nA prototype pollution in derby can crash the application, if the application author has atypical HTML templates that feed user input into an object key.\n\nAttribute keys are almost always developer-controlled, not end-user-controlled, so this shouldn't be an issue in practice for most applications.\n\n### Details\n```\nemit(context: Context, target: T) {\n  const node = traverseAndCreate(context.controller, this.segments);\n    node[this.lastSegment] = target;\n    this.addListeners(target, node, this.lastSegment);\n}\n```\nThe 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`).\n\n### PoC\nTo reproduce this vulnerability, you can adjust the test case `ignores DOM mutations in components\\' create()` in `test/dom/ComponentHarness.mocha.js`.\n\n```\nit('ignores DOM mutations in components\\' create()', function() {\n      function Box() {}\n      Box.view = {\n        is: 'box',\n-        source: '\u003cindex:\u003e\u003cdiv class=\"box\" as=\"boxElement\"\u003e\u003c/div\u003e'\n+        source: '\u003cindex:\u003e\u003cdiv class=\"box\" as=\"__proto__\"\u003e\u003c/div\u003e'\n      };\n      Box.prototype.create = function() {\n        this.boxElement.className = 'box-changed-in-create';\n      };\n      var harness = runner.createHarness('\u003cview is=\"box\" /\u003e', Box);\n      expect(harness).to.render('\u003cdiv class=\"box\"\u003e\u003c/div\u003e');\n});\n```\nWhen `as` attribute is controlled by attackers, the variable in `this.lastSegment` will exactly take value` __proto__` and prototype pollution happens.\n\n### Patch\nAdd a check on `this.lastSegment` can prevent this attack.\n```\nemit(context: Context, target: T) {\n  const node = traverseAndCreate(context.controller, this.segments);\n+  if (this.lastSegment.includes('__proto__') || this.lastSegment.includes('prototype')) {\n+    throw new Error('Unsafe code detected');\n+  }\n    node[this.lastSegment] = target;\n    this.addListeners(target, node, this.lastSegment);\n}\n```","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Prototype pollution in emit function","id":"GHSA-82jv-9wjw-pqh6","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"other","year":"2024"},"n_packages":6,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["2.3.2"],"introduced":["0"],"last_affected":[],"package":"derby","purl":null,"source":"GHSA-82jv-9wjw-pqh6"},{"ecosystem":"npm","fixed":["2.3.2"],"introduced":["0"],"last_affected":[],"package":"derby","purl":"pkg:npm/derby","source":"GHSA-82jv-9wjw-pqh6"},{"ecosystem":"npm","fixed":["3.0.2"],"introduced":["3.0.0"],"last_affected":[],"package":"derby","purl":null,"source":"GHSA-82jv-9wjw-pqh6"},{"ecosystem":"npm","fixed":["3.0.2"],"introduced":["3.0.0"],"last_affected":[],"package":"derby","purl":"pkg:npm/derby","source":"GHSA-82jv-9wjw-pqh6"},{"ecosystem":"npm","fixed":["4.0.0-beta.11"],"introduced":["4.0.0-beta1"],"last_affected":[],"package":"derby","purl":null,"source":"GHSA-82jv-9wjw-pqh6"},{"ecosystem":"npm","fixed":["4.0.0-beta.11"],"introduced":["4.0.0-beta1"],"last_affected":[],"package":"derby","purl":"pkg:npm/derby","source":"GHSA-82jv-9wjw-pqh6"}],"products":null,"published":"2024-04-17","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Prototype pollution in Derby's emit function allows attackers to crash the application via crafted HTML template attributes.","url":"https://insights.sbomify.com/GHSA-82jv-9wjw-pqh6/"}