CVE-2023-26158
mockjs vulnerable to Prototype Pollution via the Util.extend function
Also known as GHSA-mh8j-9jvh-gjf6
Mitigation
- No fix listed yet: follow the vendor advisory.
Who should check
- Projects that depend on npm package mockjs (<= 1.1.0)
- Anyone running mockjs < *
Vulnerability facts
- Affected
- mockjs <= 1.1.0
- Fixed in
- No fix listed yet
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- Yes: see the exploit references below
- Remote exploitation
- Remote, no login needed
- CVSS
- 8.2 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H/E:POpen in CVSS calculator
Show all 9 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: None
- Integrity impact: Low
- Availability impact: High
- E: P
- EPSS
- 1.02% chance of exploitation in 30 days (percentile 62, 2026-11-26)
- CWE
- CWE-1321
- Modified
Description
All versions of the package mockjs are vulnerable to Prototype Pollution via the Util.extend function due to missing check if the attribute resolves to the object prototype. By adding or modifying attributes of an object prototype, it is possible to create attributes that exist on every object, or replace critical attributes with malicious ones. This can be problematic if the software depends on existence or non-existence of certain attributes, or uses pre-defined attributes of object prototype (such as hasOwnProperty, toString or valueOf). User controlled inputs inside the extend() method of the Mock.Handler, Mock.Random, Mock.RE.Handler or Mock.Util, will allow an attacker to exploit this vulnerability. Workaround By using a denylist of dangerous attributes, this weakness can be eliminated. Add the following line in the Util.extend function: js js if (["__proto__", "constructor", "prototype"].includes(name)) continue js // src/mock/handler.js Util.extend = function extend() { var target = arguments[0] || {}, i = 1, length = arguments.length, options, name, src, copy, clone if (length === 1) { target = this i = 0 } for (; i < length; i++) { options = arguments[i] if (!options) continue for (name in options) { if (["__proto__", "constructor", "prototype"].includes(name)) continue src = target[name] copy = options[name] if (target === copy) continue if (copy === undefined) continue if (Util.isArray(copy) || Util.isObject(copy)) { if (Util.isArray(copy)) clone = src && Util.isArray(src) ? src : [] if (Util.isObject(copy)) clone = src && Util.isObject(src) ? src : {} target[name] = Util.extend(clone, copy) } else { target[name] = copy } } } return target }
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| npm mockjs | <= 1.1.0 | — | osv |
| mockjs | < * | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2023-26158. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2023-26158.md Affected: mockjs <= 1.1.0 Fixed in: no fixed version listed yet Steps: 1. Search this machine and project for mockjs (npm), mockjs: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Exploits and PoCs
FAQ
Is CVE-2023-26158 being exploited?
There is no confirmed exploitation: CVE-2023-26158 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 1.02% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2023-26158?
High: CVSS 8.2 (v3.1, scored by CNA). Remote, no login needed.
Which versions are affected by CVE-2023-26158?
mockjs <= 1.1.0.
Is there a fix for CVE-2023-26158?
No fixed version is listed in the sources yet. No fix listed yet: follow the vendor advisory.
How do I check if I'm affected by CVE-2023-26158?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.