ASAR Integrity bypass via filetype confusion
A crafted directory mimicking an ASAR archive could trick apps with ASAR integrity enabled into loading non-validated code, if the attacker can write to the app bundle.
Originally disclosed on HackerOne
- Disclosed after 47 days
Summary by the program
ASAR Integrity bypass via filetype confusion Severity: Medium
Full GHSA: https://github.com/electron/electron/security/advisories/GHSA-7m48-wc93-9g85
The report
Maliciously crafted directories mirroring an ASAR file structure could be used to trick apps with ASAR integrity enabled into loading non-validated code.
Impact
This only impacts apps that have the embeddedAsarIntegrityValidation and onlyLoadAppFromAsar fuses enabled. Apps without these fuses enabled are not impacted. This issue is specific to macOS as these fuses are only currently supported on macOS.
Specifically this issue can only be exploited if your app is launched from a filesystem the attacker has write access too. i.e. the ability to edit files inside the .app bundle on macOS which these fuses are supposed to protect against.
There are no app side workarounds, you must update to a patched version of Electron.
Fixed Versions
27.0.0-alpha.726.2.125.8.124.8.322.3.24
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker with write access to the app bundle on macOS could bypass ASAR integrity validation and load unvalidated code, but only if the app has both the embeddedAsarIntegrityValidation and onlyLoadAppFromAsar fuses enabled.
What the attacker needed
MacOS; app has both ASAR integrity fuses enabled; attacker can write to the .app bundle
The fix
The issue was fixed in Electron versions 27.0.0-alpha.7, 26.2.1, 25.8.1, 24.8.3, and 22.3.24; there are no app-side workarounds.
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 report has not been written yet. The Original tab links to the source.
Electron apps package their code in a special archive called ASAR. A security feature checks that this archive hasn't been tampered with. The bug let an attacker who can write files inside the app's folder create a fake folder structure that looked like the archive, so the app loaded malicious code without the check noticing.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.