# CVE-2023-26158: mockjs vulnerable to Prototype Pollution via the Util.extend function

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.2
- **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:P`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 1.02% (percentile 62, 2026-11-26)
- **CWE:** CWE-1321
- **Aliases:** GHSA-mh8j-9jvh-gjf6
- **Published:** 2023-12-08T05:00:01.350Z
- **Modified:** 2026-06-17T05:42:48.550Z

## Who should check

- Projects that depend on npm package mockjs (\<= 1.1.0)
- Anyone running mockjs \< \*

## 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

- npm `mockjs`: affected \<= 1.1.0; fixed no fix listed yet (osv)
- mockjs: \< \* (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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.

## References

- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2023-26158>
- exploit: <https://security.snyk.io/vuln/SNYK-JS-MOCKJS-6051365>
- other: <https://github.com/nuysoft/Mock/blob/00ce04b92eb464e664a4438430903f2de96efb47/dist/mock.js%23L721-L755>
- other: <https://github.com/nuysoft/Mock>
- other: <https://github.com/nuysoft/Mock/blob/00ce04b92eb464e664a4438430903f2de96efb47/dist/mock.js#L721-L755>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-26158>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-mh8j-9jvh-gjf6> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2023-26158> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-26158>
