{"answers":{"affected":"2 open source packages ship an affected version, including mockjs. It affects 1 product.","exploited":"There is no known exploitation of CVE-2023-26158 in the wild and no public exploit code.","fix":"No fix has been published for CVE-2023-26158 yet. Limit exposure of the affected software until one is available.","what":"CVE-2023-26158 is a high-severity vulnerability in mockjs, published on 8 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2023-26158 and fix it if it is affected.\n\nWhat it is: CVE-2023-26158 is a high-severity vulnerability in mockjs, published on 8 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2023-26158 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- mockjs (npm): affected all versions up to 1.1.0; no fix listed\n- mockjs (npm): affected all versions up to 1.1.0; no fix listed\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/CVE-2023-26158/ (Markdown: https://insights.sbomify.com/CVE-2023-26158/index.md)","id":"CVE-2023-26158","markdown":"https://insights.sbomify.com/CVE-2023-26158/index.md","name":"CVE-2023-26158","record":{"aliases":["GHSA-mh8j-9jvh-gjf6"],"analysis":{"component_type":"library","fix_type":"patch","impacts":["code_execution","security_bypass"],"network_reachable":"yes","non_default_config":false,"product_category":"JavaScript mock library","requires_auth":"none","summary":"Prototype pollution in mockjs allows attackers to modify object prototypes via user-controlled inputs, potentially leading to code execution or logic bypasses.","user_interaction":"not_required","vuln_class":"other"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"snyk","cpe":[{"product":"mock.js","vendor":"mockjs"}],"cvss":{"score":8.2,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H/E:P","version":"3.1"},"cwes":[{"id":"CWE-1321","name":"Improperly Controlled Modification of Object Prototype Attributes"}],"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).\r\rUser 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.\r\r Workaround\r\rBy using a denylist of dangerous attributes, this weakness can be eliminated.\r\rAdd the following line in the Util.extend function:\r\rjs\rjs if ([\"__proto__\", \"constructor\", \"prototype\"].includes(name)) continue\r\r\rjs\r// src/mock/handler.js\rUtil.extend = function extend() {\r        var target = arguments[0] || {},\r            i = 1,\r            length = arguments.length,\r            options, name, src, copy, clone\r\r        if (length === 1) {\r            target = this\r            i = 0\r        }\r\r        for (; i \u003c length; i++) {\r            options = arguments[i]\r            if (!options) continue\r\r            for (name in options) {\r            if ([\"__proto__\", \"constructor\", \"prototype\"].includes(name)) continue\r                src = target[name]\r                copy = options[name]\r\r                if (target === copy) continue\r                if (copy === undefined) continue\r\r                if (Util.isArray(copy) || Util.isObject(copy)) {\r                    if (Util.isArray(copy)) clone = src \u0026\u0026 Util.isArray(src) ? src : []\r                    if (Util.isObject(copy)) clone = src \u0026\u0026 Util.isObject(src) ? src : {}\r\r                    target[name] = Util.extend(clone, copy)\r                } else {\r                    target[name] = copy\r                }\r            }\r        }\r\r        return target\r    }","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":false,"headline":"mockjs vulnerable to Prototype Pollution via the Util.extend function","id":"CVE-2023-26158","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"other","year":"2023"},"n_packages":2,"n_references":2,"next":{"headline":"Follow Redirects improperly handles URLs in the url.parse() function","id":"CVE-2023-26159"},"packages":[{"ecosystem":"npm","fixed":[],"introduced":["0"],"last_affected":["1.1.0"],"package":"mockjs","purl":null,"source":"GHSA-mh8j-9jvh-gjf6"},{"ecosystem":"npm","fixed":[],"introduced":["0"],"last_affected":["1.1.0"],"package":"mockjs","purl":"pkg:npm/mockjs","source":"GHSA-mh8j-9jvh-gjf6"}],"prev":{"headline":"Denial of service in libredwg","id":"CVE-2023-26157"},"products":["mockjs"],"published":"2023-12-08","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":"PUBLISHED","updated":"2024-08-02","vendors":["n/a"]},"summary":"Prototype pollution in mockjs allows attackers to modify object prototypes via user-controlled inputs, potentially leading to code execution or logic bypasses.","url":"https://insights.sbomify.com/CVE-2023-26158/"}