Anti-AIClone

Log date · Wed

Electron 45: can an ASAR file descriptor be passed on?

Published on · Updated

Packed ASAR files can be read through fs, but their descriptors cannot be passed directly to raw consumers. Test the actual handoff.

The answer: reading and handing off are different

In Electron 45, a descriptor for a packed ASAR entry is for Electron’s fs layer; passing it directly to a raw descriptor consumer such as a native addon or child process fails with EBADF. [1][2] In our ASAR tool comparison, the packed entry and explicitly unpacked file each contained 19 bytes with the same digest; a child reading a descriptor for the ordinary file also received those 19 bytes.

Our results and the documented boundary
QuestionFinding
Can the packed entry be read?The ASAR tool read 19 bytes.
Can a real file be handed off?The child read 19 bytes from the unpacked file.
Raw FD for a packed entry in Electron 45?Documentation says unsupported, with EBADF.

The release and our scope

Electron v45.0.0 was published as a non-prerelease on October 21, 2026 at 05:22:39 UTC, or 13:22:39 in Beijing; PR #52833 was merged on August 22. [1][3] The release is the occasion for this behavior change, not the discovery of a new vulnerability that day.

We used Node.js 20.19.5 and @electron/asar 3.4.1 with a non-sensitive fixture we wrote. One archive packs it normally; the other uses --unpack to leave the same file beside the archive. This is an illustration using another tool, not a compatibility test of Electron 45.

Create and list the two variants.
asar pack sample packed.asar
asar pack sample unpacked.asar --unpack 'fixture.txt'
asar list packed.asar
asar list unpacked.asar

Same bytes, different consumers

Both archive lists show /fixture.txt, but a listing does not establish whether a consumer can use an operating-system descriptor. We read the packed entry with the ASAR API. For the unpacked file, we read through fs and then opened a fresh descriptor for the child’s standard input. Reopening matters because the first read advances the file position.

Output copied verbatim from the experiment.
packed via asar API: bytes=19 sha256=cfb51e7aec5fe9f970be23b6eabda77c815546f992ffcfc9040b7c419fa72221
unpacked via fs: bytes=19 sha256=cfb51e7aec5fe9f970be23b6eabda77c815546f992ffcfc9040b7c419fa72221
unpacked via child fd: bytes=19 sha256=cfb51e7aec5fe9f970be23b6eabda77c815546f992ffcfc9040b7c419fa72221

The matching digests show that these three reads obtained the same content; they do not establish that a real plugin accepts the same path or lifetime. ASAR is an archive which Electron’s fs presents as a virtual directory. [4] Even when the app can read a resource, trace whether the final consumer is a parser, native library or another process.

The Electron 45 contract

The official change says fs.open, fs.openSync and fs.promises.open no longer extract a temporary copy before returning a descriptor for a packed entry. Electron’s fs.read, fs.fstat and fs.readFile(fd), among other fs operations, can use it. Native addons, child_process stdio and FileHandles transferred to workers are examples of unsupported raw consumers. [2]

Write-capable open flags return EACCES instead of silently writing a temporary copy. Record which stage failed: open, read or handoff. EBADF points toward a descriptor handoff problem, while EACCES calls for checking write intent. An observer’s compatibility failure is not evidence of encryption or resistance to replication.

Recommendations by consumer

These are engineering recommendations, not effects measured in our experiment. First establish the interface the consumer actually needs, then decide whether the resource must be a real file on disk.

Choose by consumer
CaseRecommendation
JavaScript parses configurationRead through fs and validate content and size.
Native component accepts a bufferEvaluate bounded bytes and test memory and lifetime.
Consumer requires a real path or FDConsider unpacking only the required resource and test the handoff.
A temporary copy is necessaryUse an app-private directory, constrain origin, size and permissions, and clean up after all consumers finish.

Do not disable the sandbox, widen an IPC bridge or allow arbitrary renderer-selected paths to obtain compatibility. Electron’s security guidance emphasizes isolation for untrusted content; a copy also needs an ownership and cleanup plan for concurrent readers and failed operations. [5]

Run an acceptance check on your app

Start with a fixture you own and a pinned digest, and build both the old and candidate versions. List the delivered archive, check the resource that needs unpacking, then exercise the actual native, subprocess or worker handoff in the app. These commands inspect the list and real file; they do not replace the in-app handoff test.

Replace the paths with your release build and fixture.
npx @electron/asar list path/to/app.asar
shasum -a 256 path/to/app.asar.unpacked/fixture.txt

For the development directory, final ASAR and any required unpacked path, record length, digest, consumer, result and failure stage separately. Pin Electron and packaging configuration, repeat after upgrades, and verify both bytes and application behavior. This article does not announce completion or availability of our registration, billing, cloud hardening or customer-device acceptance.

Your checklist

  • Pin Electron, the release package and fixture digest.
  • Inventory fs, native, subprocess and worker handoffs.
  • Compare development, packed and necessary unpacked paths.
  • Record byte count, digest, failure stage and consumer result.
  • Constrain real copies and their lifetime; retain the sandbox.

Primary sources

All sources and reproduction status ↗