Skip to content
Misconfiguration Write-up Intermediate

Electron Js Asar Integrity Bypass

Electron's ASAR integrity check compares a SHA-256 hash stored in the main executable against a hash computed from the ASAR header. An attacker can modify the ASAR contents, recompute the header hash, and patch the stored hash in the executable to bypass the check.

Sourav Kalal Follow

Published on infosecwriteups.com

I recently created an Electron JS-based Windows and MacOS application. The newer version of Electron has Integrity detection which prevents tampering with the application code.

Sourav Kalal, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker who can modify the application's files can bypass the integrity check and run modified code, but this requires local access to the application files.

What the attacker needed

Local access to application files; ability to modify the executable

How it was found

  1. Extract the ASAR archive to a folder.
  2. Modify the JavaScript or other files inside the extracted folder.
  3. Repack the folder into a new ASAR file.
  4. Compute the new ASAR header hash using the provided script.
  5. Replace the old hash in the main executable with the new hash using sed or a binary editor.
  6. Run the application; the integrity check passes.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Electron apps store their code in an archive called an ASAR file. The app checks that this file hasn't been changed by comparing a fingerprint (hash) stored in the main program. The researcher showed that if you change the ASAR file, you can also change the stored fingerprint to match, so the check passes.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by Sourav Kalal

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.