Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

devalue

Latest version: v6.0.4

Overview

Last scanned
24 Nov 2026
Published
24 Nov 2026
npm package Publisher: rich_harris, svelte-admin
2,816 Stars
110 Forks
7 Versions
114.7M Downloads
JavaScript Repo language

Scan summary

devalue was last scanned on 24 Nov 2026 at version 6.0.4. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 7 versions; the latest was published on 24 Nov 2026.
  • Findings: No rules fired in version 6.0.4.
  • Downloads: 114,677,098 downloads.

Versions

7 versions published
Versions and the rules that fired in each
VersionPublishedStatus
6.0.4 LATEST 24 Nov 2026 No rules fired
6.0.3 13 Oct 2026 No rules fired
6.0.2 22 Sep 2026 No rules fired
6.0.0 19 Sep 2026 Not shown
5.9.4 18 Sep 2026 Not shown

No rules fired in 6.0.4

Findings

Findings for v6.0.4. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 6.0.4; other versions have their own rules, not their own score.

Known vulnerabilities

16 CVEs · last 1 Oct 2026

0 CRITICAL 8 HIGH 4 MEDIUM 4 LOW

Versions

  • ≥ 5.9.3
  • ≥ 5.9.2, < 5.9.3 4 HIGH 2 MEDIUM 1 LOW
  • ≥ 5.8.1, < 5.9.2 4 HIGH 3 MEDIUM 1 LOW
  • ≥ 5.8.0, < 5.8.1 5 HIGH 3 MEDIUM 1 LOW
  • ≥ 5.6.4, < 5.8.0 4 HIGH 3 MEDIUM 1 LOW
  • ≥ 5.6.3, < 5.6.4 4 HIGH 4 MEDIUM 2 LOW
  • ≥ 5.6.2, < 5.6.3 3 HIGH 4 MEDIUM 4 LOW
  • ≥ 5.3.2, < 5.6.2 5 HIGH 4 MEDIUM 4 LOW
  • ≥ 5.3.0, < 5.3.2 6 HIGH 4 MEDIUM 4 LOW
  • ≥ 5.1.0, < 5.3.0 5 HIGH 4 MEDIUM 4 LOW
Show all 13 version ranges
  • ≥ 4.0.0, < 5.1.0 3 HIGH 4 MEDIUM 4 LOW
  • ≥ 1.0.0, < 4.0.0 3 HIGH 4 MEDIUM 3 LOW
  • < 1.0.0 3 HIGH 4 MEDIUM 2 LOW

Vulnerabilities

  • GHSA-HX4R-W6WJ-J8FG Medium 1 Oct 2026 devalue: Residual sparse-array CPU amplification in uneval Fixed in 5.9.3
  • GHSA-MCM9-63F2-9J32 High 1 Oct 2026 devalue: Repeated primitive strings cause quadratic expansion in uneval Fixed in 5.9.3
  • GHSA-WF3X-273G-MVXV Low 1 Oct 2026 devalue: Sparse arrays emitted by uneval cause eager allocation when evaluated Fixed in 5.9.3
  • GHSA-R9W8-H9R3-54W4 High 1 Oct 2026 devalue: Custom ArrayBuffer revivers can bypass typed-array allocation validation Fixed in 5.9.3
  • GHSA-X5RW-Q4PP-HG5G High 1 Oct 2026 devalue: stringifyAsync can cause an unhandled rejection despite a caught returned promise Fixed in 5.9.3
  • GHSA-4Q55-J62X-FR9H Medium 1 Oct 2026 devalue: Malformed null-prototype object keys bypass __proto__ rejection via property-key coercion Fixed in 5.9.3
  • CVE-2026-92708 High 18 Sep 2026 devalue: devalue: Cross-request process memory disclosure Fixed in 5.9.3
  • CVE-2026-81176 Medium 16 Sep 2026 devalue: Devalue: Denial of Service via malformed input parsing Fixed in 5.9.2
  • CVE-2026-42570 High 9 Jun 2026 devalue: devalue: Excessive memory consumption via deserialization of sparse arrays Fixed in 5.8.1
  • GHSA-MWV9-GP5H-FRR4 Low 12 Mar 2026 Sveltejs devalue's `devalue.parse` and `devalue.unflatten` emit objects with `__proto__` own properties Fixed in 5.6.4
  • CVE-2026-30226 Medium 11 Mar 2026 devalue: Devalue: Denial of Service or type confusion via prototype pollution Fixed in 5.6.4
  • GHSA-33HQ-FVWR-56PM Low 19 Feb 2026 devalue affected by CPU and memory amplification from sparse arrays Fixed in 5.6.3
  • GHSA-8QM3-746X-R74R Low 19 Feb 2026 devalue `uneval`ed code can create objects with polluted prototypes when `eval`ed Fixed in 5.6.3
  • CVE-2026-22775 High 15 Jan 2026 devalue: devalue: Denial of Service due to improper input validation Fixed in 5.6.2
  • CVE-2026-22774 High 15 Jan 2026 devalue: devalue: Denial of Service due to excessive resource consumption from untrusted input Fixed in 5.6.2
  • CVE-2025-57820 High 26 Aug 2025 devalue prototype pollution vulnerability Fixed in 5.3.2

Seal Security (npm)

Seal Security ships a patched build of this package. Its fixed versions:

  • CVE-2026-123564: 2.0.1-sp2
  • CVE-2026-123565: 2.0.1-sp2
  • CVE-2026-123566: 2.0.1-sp3

README

The publisher’s own README, as collected from the registry.

devalue

Like JSON.stringify, but handles

  • cyclical references (obj.self = obj)
  • repeated references ([value, value])
  • undefined, Infinity, NaN, -0
  • regular expressions
  • dates
  • Map and Set
  • BigInt
  • ArrayBuffer and Typed Arrays
  • URL and URLSearchParams
  • Temporal
  • custom types via replacers, reducers and revivers
  • promises (via stringifyAsync)

Try it out here.

Goals:

  • Performance
  • Security (see XSS mitigation)
  • Compact output

Non-goals:

  • Human-readable output
  • Stringifying functions
  • Stability of serialization mechanisms between versions (i.e. if you devalue.stringify with one version and devalue.parse with another, things may break)

Usage

There are two ways to use devalue:

uneval

This function takes a JavaScript value and returns the JavaScript code to create an equivalent value — sort of like eval in reverse:

import * as devalue from 'devalue';

let obj = { message: 'hello' };
devalue.uneval(obj); // '{message:"hello"}'

obj.self = obj;
devalue.uneval(obj); // '(function(){let a={};a.message="hello";a.self=a;return a}())'

Use uneval when you want the most compact possible output and don't want to include any code for parsing the serialized value. The result is suitable for embedding in a <script> element or a generated JavaScript module, for example.

stringify and parse

These two functions are analogous to JSON.stringify and JSON.parse:

import * as devalue from 'devalue';

let obj = { message: 'hello' };

let stringified = devalue.stringify(obj); // '[{"message":1},"hello"]'
devalue.parse(stringified); // { message: 'hello' }

obj.self = obj;

stringified = devalue.stringify(obj); // '[{"message":1,"self":0},"hello"]'
devalue.parse(stringified); // { message: 'hello', self: [Circular] }

Use stringify and parse when evaluating JavaScript isn't an option (such as when sending untrusted data from client to server).

stringifyAsync

stringifyAsync is an async version of stringify that can handle promises:

import * as devalue from 'devalue';

let obj = {
  quick: 'data',
  slow: fetch('/api/slow').then((r) => r.json())
};

let stringified = await devalue.stringifyAsync(obj);
devalue.parse(stringified); // { quick: 'data', slow: { ... } }

Promises are awaited and their resolved values are serialized. The output format is identical to stringify, so parse and unflatten work unchanged.

unflatten

In the case where devalued data is one part of a larger JSON string, unflatten allows you to revive just the bit you need:

import * as devalue from 'devalue';

const input = { message: 'hello' };
const json = `{
  "type": "data",
  "data": ${devalue.stringify(input)}
}`;

const data = devalue.unflatten(JSON.parse(json).data); // { message: 'hello' }
Binary data

Node.js Buffer values are serialized as Uint8Arrays containing only the Buffer's visible bytes. Their backing stores are copied, since small Buffers can share an allocation pool containing unrelated, sensitive data. Repeated references to the same Buffer are preserved, but distinct Buffers are given separate backing stores.

For ordinary typed arrays and DataViews, devalue serializes the entire backing ArrayBuffer, preserving shared views and byte offsets. This includes bytes outside a subarray or subview. Only serialize these views if their entire backing store is safe to disclose, or copy the intended bytes first:

const copy = new Uint8Array(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));
const serialized = devalue.stringify(copy);

This also applies if you explicitly pass buf.buffer, or create an ordinary typed array or DataView over a Node Buffer's backing store — these values cannot be identified as Node Buffers. To copy a Buffer's contents into an independent typed array, use new Uint8Array(buf).

Custom types

You can serialize and deserialize custom types by passing a second argument to stringify containing an object of types and their reducers, and a second argument to parse or unflatten containing an object of types and their revivers:

class Vector {
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }

  magnitude() {
    return Math.sqrt(this.x * this.x + this.y * this.y);
  }
}

const stringified = devalue.stringify(new Vector(30, 40), {
  Vector: (value) => value instanceof Vector && [value.x, value.y]
});

console.log(stringified); // [["Vector",1],[2,3],30,40]

const vector = devalue.parse(stringified, {
  Vector: ([x, y]) => new Vector(x, y)
});

console.log(vector.magnitude()); // 50

If a function passed to stringify returns a truthy value, it's treated as a match.

You can also use custom types with uneval by specifying a custom replacer:

devalue.uneval(vector, (value, js) => {
  if (value instanceof Vector) {
    return js`new Vector(${value.x},${value.y})`;
  }
}); // `new Vector(30,40)`

The replacer must return a source created with the supplied js tag, or undefined, null or false to serialize the value normally. Each value "hole" is recursively serialized. Identifier-like words in the literal template strings (including nested templates) are reserved, so generated variables cannot shadow your constructors, helpers or local bindings.

Note that any variables referenced in the resulting JavaScript (like Vector in the example above) must be in scope when it runs.

Custom operations

Every introspection stringify performs on the value being serialized — property reads, prototype method calls, iteration, type classification — goes through an operations interface that you can override via the operations option. Omitted members fall back to the defaults (exported as defaultStringifyOperations), which behave exactly as devalue always has.

This is useful in two situations:

Side-effect-free serialization. By default, serializing a value can execute user code: getters and proxy traps fire during property reads, Object.prototype.toString consults (potentially getter-defined) Symbol.toStringTag, and patched prototype methods like Date.prototype.toISOString or Map.prototype[Symbol.iterator] are invoked. Deterministic or sandboxed runtimes can replace these operations with implementations based on captured intrinsics and property descriptors:

const originalToISOString = Date.prototype.toISOString;

const stringified = devalue.stringify(value, undefined, {
  operations: {
    // use a captured intrinsic instead of a (possibly patched) prototype method
    toISOString: (date) => originalToISOString.call(date),

    // read through descriptors so getters are never invoked
    get: (object, key) => {
      const descriptor = Object.getOwnPropertyDescriptor(object, key);
      if (descriptor?.get) throw new Error(`refusing to invoke getter for "${key}"`);
      return descriptor?.value;
    }
  }
});

Foreign-runtime serialization. The stringify algorithm never touches the value directly, so "value" can be an opaque handle to something living in another JavaScript runtime — a node:vm context, a WASM-hosted engine, a remote process — as long as the operations know how to inspect it. Implement typeOf/tagOf for classification, toPrimitive/get/entriesOf/etc. for extraction, and identify to key deduplication and cycle detection on the underlying value's identity rather than the handle's:

const stringified = devalue.stringify(rootHandle, undefined, {
  operations: {
    identify: (handle) => handle.pointer,
    typeOf: (handle) => handle.typeOf(),
    get: (handle, key) => handle.getProperty(key)
    // ... see StringifyOperations for the full interface
  }
});

Some operations have a non-obvious contract that is easy to get subtly wrong. Where the work is not specific to your values, devalue exports the pieces so you don't have to reimplement them — filterArrayIndices does the array-index filtering that indicesOf needs, given keys you already have:

indicesOf: (handle) => devalue.filterArrayIndices(handle.ownEnumerableStringKeys());

Reducers compose with custom operations: they receive the raw value/handle, and whatever they return is serialized through the same operations.

Customizing parse

The mirror image: parse and unflatten build every value through construction operations (ParseOperations, defaults exported as defaultParseOperations), so you can control what gets created. The members mirror StringifyOperations with the host/value-space boundary running the other way: each fromXxx inverts the corresponding toXxx, fromXxxInfo inverts xxxInfo, and the bare-verb mutators invert the bare-verb accessors (set/get, addValue/valuesOf, addEntry/entriesOf, box/unbox).

Cross-realm revival. By default the revived value is built from the intrinsics of whichever realm devalue is running in, so instanceof checks fail elsewhere. Constructing from a target realm's intrinsics fixes that:

const revived = devalue.parse(serialized, undefined, {
  operations: {
    fromISOString: (iso) => new sandbox.Date(iso),
    createMap: () => new sandbox.Map(),
    createObject: () => sandbox.makeObject()
  }
});

Foreign-runtime revival. parse never inspects the values it creates — it only passes them back into other operations — so the operations can build values inside another runtime and return opaque handles:

const rootHandle = devalue.parse(serialized, undefined, {
  operations: {
    fromPrimitive: (primitive) => vm.toHandle(primitive),
    createObject: () => vm.newObject(),
    set: (handle, key, value) => handle.setProp(key, value)
    // ... see ParseOperations for the full interface
  }
});

Containers are created empty and populated afterwards (createMap then addEntry, createObject then set, and so on) — that ordering is what allows cyclic values to be revived, since the empty container is cached before its contents are built.

Revivers compose the same way reducers do: they receive whatever the operations built, and their return value is used as-is.

Error handling

If uneval or stringify encounters a function or a non-POJO that isn't handled by a custom replacer/reducer, it will throw an error. You can find where in the input data the offending value lives by inspecting error.path:

try {
  const map = new Map();
  map.set('key', function invalid() {});

  uneval({
    object: {
      array: [map]
    }
  });
} catch (e) {
  console.log(e.path); // '.object.array[0].get("key")'
}

XSS mitigation

Say you're server-rendering a page and want to serialize some state, which could include user input. JSON.stringify doesn't protect against XSS attacks:

const state = {
  userinput: `</script><script src='https://evil.com/mwahaha.js'>`
};

const template = `
<script>
  // NEVER DO THIS
  var preloaded = ${JSON.stringify(state)};
</script>`;

Which would result in this:

<script>
  // NEVER DO THIS
  var preloaded = {"userinput":"
</script>
<script src="https://evil.com/mwahaha.js">
  "};
</script>

Using uneval or stringify, we're protected against that attack:

const template = `
<script>
  var preloaded = ${uneval(state)};
</script>`;
<script>
  var preloaded = {
    userinput:
      "\\u003C\\u002Fscript\\u003E\\u003Cscript src='https:\\u002F\\u002Fevil.com\\u002Fmwahaha.js'\\u003E"
  };
</script>

This, along with the fact that uneval and stringify bail on functions and non-POJOs, stops attackers from executing arbitrary code. Strings generated by uneval can be safely deserialized with eval or new Function:

const value = (0, eval)('(' + str + ')');

Other security considerations

While uneval prevents the XSS vulnerability shown above, meaning you can use it to send data from server to client, you should not send user data from client to server using the same method. Since it has to be evaluated, an attacker that successfully submitted data that bypassed uneval would have access to your system.

When using eval, ensure that you call it indirectly so that the evaluated code doesn't have access to the surrounding scope:

{
  const sensitiveData = 'Setec Astronomy';
  eval('sendToEvilServer(sensitiveData)'); // pwned :(
  (0, eval)('sendToEvilServer(sensitiveData)'); // nice try, evildoer!
}

Using new Function(code) is akin to using indirect eval.

See also

License

MIT

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm devalue

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Frame 2085668439 (1)
Group 1261154229