npm package report

Is defu safe?

1 known vulnerability, worst severity HIGH.

// reach

0 direct dependencies

none carry a known advisory

    128 packages depend on it

    an advisory here reaches each of them

    Create a free accountfor every dependency path, dependent and what to upgrade
    // ai model usage

    Tracked for PyPI packages. HuggingFace models declare Python dependencies, so npm packages are not covered.


    cvss
    7.5
    high

    CVSS v3.1 base score out of 10

    epss
    0.40%
    medium

    chance of exploitation in 30 days, 35th percentile of all CVEs

    xyz score
    4.5
    medium

    CyberXYZ composite out of 10

    fig. 01 — GHSA-737v-mqg7-c878, the advisory selected below

    // 1 advisories

    GHSA-737v-mqg7-c878

    HIGHOSV ratingCVE-2026-35209
    // impact

    Applications that pass unsanitized user input (e.g. parsed JSON request bodies, database records, or config files from untrusted sources) as the first argument to defu() are vulnerable to prototype pollution.

    A crafted payload containing a __proto__ key can override intended default values in the merged result:

    import { defu } from 'defu'
    
    const userInput = JSON.parse('{"__proto__":{"isAdmin":true}}')
    const config = defu(userInput, { isAdmin: false })
    
    config.isAdmin // true — attacker overrides the server default
    // root cause

    The internal _defu function used Object.assign({}, defaults) to copy the defaults object. Object.assign invokes the __proto__ setter, which replaces the resulting object's [[Prototype]] with attacker-controlled values. Properties inherited from the polluted prototype then bypass the existing __proto__ key guard in the for...in loop and land in the final result.

    // fix

    Replace Object.assign({}, defaults) with object spread ({ ...defaults }), which uses [[DefineOwnProperty]] and does not invoke the __proto__ setter.

    // affected versions

    <= 6.1.4

    // credits

    Reported by @BlackHatExploitation

    // cvss v3.1 vector

    CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

    Attack vector
    Network
    Attack complexity
    Low
    Privileges required
    None
    User interaction
    None
    Scope
    Unchanged
    Confidentiality
    None
    Integrity
    High
    Availability
    None

    Checked 2026-11-07 at 08:38 UTC. The most recent advisory here was published 2026-04-04. Updated continuously from NVD, GHSA, OSV and CNA feeds.

    Think a verdict here is wrong? Tell us — we respond within 2 business days.