Your Electron App is Already Exploitable: AI-Guided Discovery with Real-Time Harnessing
Danila Sashchenko (TikTok)
[un]prompted.au 2026 · Day 2 · Main Hall
Overview
In this insightful talk, Danila Sashchenko from TikTok unveils a sophisticated AI-guided system designed to autonomously discover and exploit vulnerabilities in ElectronJS applications. Addressing the unique challenges posed by Electron's architecture, which blends web technologies (Chromium) with desktop capabilities (NodeJS), Sashchenko demonstrates how even "not great" Large Language Models (LLMs) can be effectively harnessed to identify complex source-to-sink vulnerability chains and generate functional exploits. The system, developed and used internally at TikTok, represents a significant leap in automating offensive security, moving beyond traditional static analysis to intelligent, context-aware vulnerability research.

Key moments
- 0:00 Introduction to ElectronJS security and AI application
- 4:00 Understanding Electron's sandbox, nodeIntegration, and preload scripts
- 7:45 AI's advantage: Analyzing ASAR (JavaScript bundles) over binaries
- 11:45 AI pipeline: Taint analysis and dynamic runtime harnessing explained
- 16:30 Graph-based optimization for efficient vulnerability chain discovery
- 18:00 Vulnerability case study: PostMessage origin check bypass
- 23:00 Funny vulnerability: Third-party shell command injection via Warp
- 25:30 Q&A: Practical insights on graph updates and analysis duration
Your Electron App is Already Exploitable: AI-Guided Discovery with Real-Time Harnessing
Speakers: Danila Sashchenko, Staff Security Engineer, TikTok
Conference: [un]prompted.au
YouTube: https://www.youtube.com/watch?v=83zYnMB-lcE
Overview
In this insightful talk, Danila Sashchenko from TikTok unveils a sophisticated AI-guided system designed to autonomously discover and exploit vulnerabilities in ElectronJS applications. Addressing the unique challenges posed by Electron's architecture, which blends web technologies (Chromium) with desktop capabilities (NodeJS), Sashchenko demonstrates how even "not great" Large Language Models (LLMs) can be effectively harnessed to identify complex source-to-sink vulnerability chains and generate functional exploits. The system, developed and used internally at TikTok, represents a significant leap in automating offensive security, moving beyond traditional static analysis to intelligent, context-aware vulnerability research.
The presentation highlights the often-overlooked attack surface of Electron applications, which, despite widespread adoption in popular tools like VS Code, Notion, and Discord, frequently harbor critical security flaws. By leveraging AI to analyze bundled, often minified JavaScript code within ASAR archives, the system bypasses many limitations of manual review and conventional tooling. This talk is crucial for security professionals, developers, and anyone interested in the practical application of AI in cybersecurity, offering a glimpse into the future of automated vulnerability discovery and the defensive strategies required to counter such advanced techniques.
Sashchenko's work underscores a critical paradigm shift: LLMs, when properly guided and integrated into a robust pipeline, can become powerful allies in the ongoing battle against software vulnerabilities. The discussion extends beyond mere theoretical concepts, providing concrete examples of real-world vulnerabilities discovered and exploited by the AI, showcasing its efficacy in uncovering complex issues that traditional methods might miss.
Background
▶ Watch: Introduction to ElectronJS security and AI application (0:00)
ElectronJS is a popular framework for building cross-platform desktop applications using web technologies. It essentially bundles Chromium (for rendering the UI) and NodeJS (for operating system interactions) along with application-specific dependencies into a single package, typically an app.asar archive. This architecture allows developers familiar with web development to create native-feeling desktop applications with relative ease.
A key aspect of Electron's design is its ability to extend Chromium's capabilities. Electron achieves this by creating custom bindings, effectively forking Chromium to integrate NodeJS APIs directly into the rendering engine. These custom integrations are referred to as Electron hooks, which provide JavaScript within the Chromium rendering context access to powerful NodeJS and operating system APIs.
The internal structure of an Electron application involves a main process (typically process ID 0) responsible for managing the application lifecycle and interacting with native UI elements. This main process spawns multiple renderer processes, each akin to a browser tab, which handle the UI rendering. Critically, these renderer processes can potentially access both V8 APIs (standard browser JavaScript) and the more powerful Electron hooks. However, in well-secured or large applications, access to Electron hooks is often restricted to mitigate risk.
The security posture of an Electron application heavily depends on how these capabilities are configured. A "naive" Electron application might directly expose NodeJS APIs in the renderer process, leading to trivial Remote Code Execution (RCE) vulnerabilities if untrusted content is loaded. More mature applications employ security flags such as:
- Sandbox: A JavaScript execution sandbox for renderer processes, similar to V8's sandbox but with its own process memory isolation.
- nodeIntegration: A crucial flag that, when set to
false, prevents NodeJS APIs from being exposed in the renderer process. - Preload scripts: Scripts executed before the DOM tree is rendered, allowing developers to selectively expose specific, sanitized objects or APIs to the global window object in a controlled manner, even when
nodeIntegrationis disabled.
The primary attack surface for Electron applications typically involves several entry points:
- Loading Untrusted URLs: If an application loads user-controlled or untrusted URLs into a renderer process, the loaded web content can interact with any accessible Electron hooks or exposed APIs, potentially leading to RCE.
- Schema Handlers: When users click links registered as valid schema handlers (e.g.,
http://,ftp://,file://, or custom application-specific schemas), these can be exploited if not properly validated, allowing attackers to trigger specific application logic. - File System Issues: Less severe but still relevant are vulnerabilities related to file system interactions, such as symlink hijacking, though this was not the focus of the talk.
A significant challenge for security analysis of Electron apps lies in their packaging format: ASAR (Atom Shell Archive). Unlike traditional compiled binaries (C, C++), which involve compilation, optimization, and linking into static binaries that AI might analyze via assembly, ASAR files are essentially archives containing bundled, often minified, JavaScript code. While this JavaScript is "open source" in the sense that it can be unpacked and viewed, its minified nature and sheer volume make manual analysis arduous. This is where AI, particularly Large Language Models (LLMs), shines. LLMs are adept at understanding language patterns and structures, making them surprisingly effective at analyzing minified JavaScript code, much like they would analyze human-readable code or assembly, by recognizing patterns and rules. This inherent capability makes LLMs a powerful tool for dissecting the complex logic within Electron's ASAR bundles.
Key Findings
▶ Watch: AI's advantage: Analyzing ASAR (JavaScript bundles) over binaries (7:45)
The central finding presented by Danila Sashchenko is the successful development and deployment of an AI-guided vulnerability discovery and exploitation pipeline specifically tailored for ElectronJS applications. This system is capable of autonomously identifying intricate security flaws and even crafting functional exploits, demonstrating the profound potential of AI in offensive security.
Key contributions and findings include:
- Effective AI Application for Electron Security: The system proves that LLMs, even those not considered "state-of-the-art" (like Doubao initially), can be effectively trained and guided to analyze complex, minified JavaScript code within ASAR archives. This overcomes a significant hurdle in Electron security analysis, where traditional tools often struggle with the dynamic, web-centric nature of the code.
- Automated Source-to-Sink Taint Analysis: The pipeline automates the entire process of identifying vulnerability patterns, tracing data flow from untrusted sources to sensitive sinks, and validating the potential for exploitation. This significantly reduces the manual effort and expertise required for in-depth security audits.
- Multi-Context Chunking Process (MCCP): A novel, custom-developed sub-agent-like system designed to manage the context window of LLMs. MCCP generalizes context, saves vector representations of previous interactions, and allows the model to "remember" past findings. This prevents hallucination (when LLMs generate nonsensical or incorrect information) and improves the quality and efficiency of scans, especially over large codebases.
- Dynamic, Runtime-Generated Harnessing: The system intercepts and scrutinizes every AI request and response, applying internal rules and dynamically generating additional context or "harnesses." This real-time guidance ensures the AI stays focused, avoids irrelevant or invalid exploit suggestions (e.g., trying to call NodeJS APIs in a sandboxed renderer), and iteratively refines its understanding of the target application's security posture.
- Graph-Based Caching for Efficiency: To address the performance overhead of repeated scans on the same codebase, the system implements a graph database. Previously identified source-to-sink chains are cached as graphs. If a new finding connects to an existing chain, the system can retrieve the full chain instantly, drastically reducing token consumption and scan time. This makes the system scalable for continuous integration/continuous deployment (CI/CD) environments.
- Demonstrated Real-World Efficacy: The talk presents three distinct, complex vulnerabilities discovered and exploited by the AI system in real-world applications (including TikTok and a third-party shell), ranging from
postMessageorigin bypasses leading to XSS and response spoofing, toloadURL-based RCE, and even a vulnerability in a popular third-party shell (Warp). These examples validate the system's ability to uncover critical and subtle flaws.
In essence, the key finding is the successful blueprint for building an intelligent, self-correcting AI agent capable of performing sophisticated vulnerability research and exploit development in a highly automated fashion, setting a new benchmark for advanced security tooling.
Technical Deep Dive
▶ Watch: Graph-based optimization for efficient vulnerability chain discovery (16:30)
The core of Danila Sashchenko's presentation lies in the intricate, multi-stage pipeline designed for AI-guided vulnerability discovery and exploitation in Electron applications. This pipeline orchestrates various AI models and custom-built components to achieve its objectives.
The process begins with Vulnerability Finding, utilizing Codex models (though the initial success was with Doubao). This stage focuses on identifying possible patterns and their variants. To handle the vast amount of code, especially across different repositories and within ASAR archives, a technique called MCP (Model Context Protocol) is employed. MCP chunks files into manageable segments for the LLM. This stage also generates skill-based harnesses, which are essentially pre-defined rules or prompts tailored for specific vulnerability types. For instance, if the AI detects an exposed WebSocket server, RPC/XPC endpoint, or a suspicious schema handler, these are often considered high-confidence findings and directly reported, sometimes even triggering immediate exploit generation. These skill-based harnesses reduce the token count and scanning time for known patterns.
For cases that are not immediately classified as "special cases" by the skill-based harnesses, the pipeline proceeds to Taint Analysis. This crucial step aims to identify the source of untrusted input and the sink where this input could lead to a vulnerability. This involves a deep understanding of data flow within the application.
A foundational component supporting these stages is the custom-developed MCCP (Multi-Context Chunking Process). Developed before the widespread adoption of "sub-agents," MCCP acts as an intelligent context manager for the LLM. It addresses the inherent limitation of LLM context windows, where increasing context length often degrades output quality and can lead to hallucination. MCCP works by:
- Determining Max Context Length: It identifies the point at which a model typically starts hallucinating, establishing a practical maximum context size.
- Calculating Information Load: It measures the amount of information being fed into the context window.
- Generalizing Context: Once the context window approaches its limit, MCCP generalizes the information.
- Vector Representation Storage: The generalized context is then saved as vector representations for future model calls. This allows the LLM to "remember" previous runs and findings, enabling it to continue scanning efficiently even if it gets "stuck" or needs to recall past information, much like a persistent memory for the AI.
Back to the main pipeline, after initial pattern matching and source/sink identification, several validation steps occur:
- Vulnerability Pattern Match Validation: The system verifies if the AI's reported vulnerability description accurately matches the underlying code. For example, if the AI claims an XSS vulnerability but the TypeScript code indicates an integer
IDparameter, it's flagged as a mismatch. - Source Identification (with Runtime Harnessing): This step confirms if the identified code is indeed the source of the taint chain. A critical innovation here is the runtime-generated harnessing. Every AI answer is intercepted by a backend system. This backend checks the AI's response against internal rules and, if necessary, provides more context or adjusts the prompt to guide the AI more effectively. This dynamic feedback loop prevents the AI from going off-topic or generating invalid assumptions. MCCP is also applied here to leverage past knowledge.
- Sink Identification: Similar to source identification, this step confirms if the identified code represents a valid sink for the vulnerability, again utilizing runtime harnessing and MCCP.
- Renderer-Based Vulnerability Check: This is a vital sanity check. The system explicitly instructs the AI to consider Chromium's sandboxing rules. Without this, the AI might suggest exploits like directly calling
requirefor NodeJS APIs in a sandboxed renderer, which would not work. This step ensures the generated exploits are technically feasible within the Electron environment. - Judge: This final validation component synthesizes information about the identified source, sink, and the generated exploit. If, in the "judge's mind," all pieces logically connect and make sense, the finding is reported as a valid vulnerability.
Finally, to optimize performance on repeated scans, the system builds and utilizes graphs. Instead of re-scanning entire codebases for every new finding, previously discovered source-to-sink chains are stored as nodes and edges in a graph. If a new risk is identified that connects to an existing chain, the system simply retrieves the complete chain from the graph, saving significant processing time and token costs. This "caching" mechanism allows for rapid re-evaluation and continuous monitoring of large codebases.
Throughout this entire process, key Electron concepts like Electron hooks (NodeJS APIs integrated into V8), sandbox (JavaScript execution isolation), nodeIntegration (flag for NodeJS API exposure), preload scripts (scripts running before DOM rendering), and IPC (Inter-Process Communication) are central to the AI's understanding and exploitation strategies. The system's ability to reason about these specific Electron mechanisms is what makes it so effective.
Demo / Proof of Concept
▶ Watch: Vulnerability case study: PostMessage origin check bypass (18:00)
The talk presented three compelling real-world case studies where the AI-guided system successfully identified and exploited vulnerabilities, demonstrating its practical efficacy.
1. PostMessage Origin Bypass & XHR Hook Redefinition leading to XSS / Response Spoofing
This vulnerability chain was fully discovered and exploited by the AI. It involved a specific application where:
- A first-party page had a
postMessagehandler that lacked an origin check. This is a critical flaw, allowing any origin to send messages to the page. - The handler parsed incoming messages, specifically looking for a
package_idkey in a local queue. If theIDexisted, responses frompostMessagewere directly placed into this queue. TheIDwas only 5 characters long, making it easily predictable. - Crucially, XHR (XMLHttpRequest) and
fetchfunctions were redefined at a native level. When a request was made, a 5-characterIDwas generated, put into a queue, and the system waited for a response. Upon receiving a response, it was sent back to the emitter that initiated the request.
The AI crafted a straightforward exploit:
- An attacker would spawn an iframe on a malicious page.
- Using
postMessage, the iframe would send messages to the vulnerable parent, effectively spraying the predictable 5-characterID. - The attacker would then spoof responses.
- When a real response arrived for a legitimate request, the interesting thing happened: it would be broadcasted to all iframes on the page.
This allowed the attacker to:
- Read the real response of legitimate requests, potentially extracting sensitive data.
- Trigger Cross-Site Scripting (XSS) by injecting malicious payloads into the spoofed responses.
The impact was severe, as the ability to spoof responses effectively allowed an attacker to take over the entire application by manipulating its perceived data.
2. loadURL Function to Remote Code Execution (RCE)
This full RCE chain was also entirely discovered and exploited by the AI. It leveraged a specific configuration of Electron's loadURL function:
- The application used the
loadURLElectron function, which loads a URL into a renderer process. However, specific security checks were in place: loadURLhad to be called from an iframe.- The iframe's URL path had to start with a particular, predefined HTTP path.
- The iframe had to have a specific, predefined name.
- The iframe had to be loaded from a specific domain name.
- Even with these checks bypassed, direct RCE was not immediately granted. Instead, the attacker gained access to IPC (Inter-Process Communication), a mechanism for processes to communicate. The renderer process was sandboxed with no NodeJS access.
- The IPC exposed a method to execute
webContent(the renderer's content) plus any method within a particularrenderer ID.
The exploitation strategy developed by the AI involved:
- Opening a very specific, legitimate domain name.
- Mutating the DOM tree to create an iframe.
- Loading a URL into this iframe that contained the attacker's own JavaScript code.
- This iframe's JavaScript would then call the exposed IPC method.
- The main process, receiving the IPC call, would initiate a new
webContentobject inside a specificrenderer ID. Sincerenderer IDs are integers (e.g., 1 to 9999), the attacker would need to spray these IDs to hit the correct target. - Finally, by calling
context.executeJavaScripton thewebContentobject associated with the targetrenderer ID, the attacker could execute arbitrary JavaScript code in a non-sandboxed context, thereby escalating permissions from a sandboxed renderer to achieve full Remote Code Execution (RCE).
3. Third-Party Shell Vulnerability (Warp)
This case presented a vulnerability in a third-party component, highlighting that the AI's scope extends beyond the primary application code.
- The desktop application allowed users to choose their preferred shell (e.g., Ghostty, PowerShell, or Warp).
- Upon clicking to open a repository, the application used
childProcess.execto execute the chosen shell. The command included the full path to the shell executable plus some arguments from the shell's documentation. - The AI discovered a payload that, when provided within the path argument, was unexpectedly executed by the Warp shell itself. This indicated a vulnerability not just in the Electron application but also in the third-party shell's parsing or execution logic.
The payload, which didn't outwardly appear executable, was nonetheless triggered on the backend of Warp, leading to arbitrary code execution. Interestingly, the vendor of the Warp shell rejected the vulnerability report, citing that it required "one or two clicks" from the user, which they deemed insufficient risk. This case underscores the AI's ability to find subtle vulnerabilities even in external dependencies and the differing perspectives on what constitutes an "acceptable risk."
These examples vividly illustrate the AI system's capability to understand complex application logic, identify intricate vulnerability chains, and generate precise exploits, showcasing a significant advancement in automated security research.
Defensive Implications
▶ Watch: Q&A: Practical insights on graph updates and analysis duration (25:30)
The capabilities demonstrated by TikTok's AI-guided vulnerability discovery system have profound implications for defenders. As offensive AI tools become more sophisticated, security teams must adapt their strategies to counter these advanced threats.
Here are key defensive implications and recommended actions:
- Strict Electron Security Configurations:
- Disable
nodeIntegrationby default: Always setnodeIntegration: falsefor all renderer processes, especially those loading untrusted content. This is the most fundamental step to prevent direct NodeJS API access from potentially malicious web content. - Enable
sandbox: Ensuresandbox: trueis enabled for renderer processes. This provides a crucial layer of isolation, similar to a browser sandbox, limiting the impact of renderer-based exploits. - Secure
preloadscripts: If NodeJS functionality is required in a sandboxed renderer, usepreloadscripts to expose only specific, tightly controlled, and sanitized APIs to the global window object. Never exposerequireor other broad NodeJS capabilities. - Implement Context Isolation: Utilize Electron's
contextIsolationfeature to ensure that yourpreloadscripts run in an isolated JavaScript context, preventing them from being tampered with by content loaded in the main renderer context.
- Robust Input Validation and Sanitization:
- Validate all URLs: Any function that loads URLs (e.g.,
loadURL) must rigorously validate and sanitize inputs. Implement strict allow-lists for schemes, domains, and paths. Never load arbitrary untrusted URLs. - Sanitize all IPC Communications: All data exchanged between renderer and main processes via IPC must be thoroughly validated and sanitized on both ends. Treat IPC messages as untrusted input. Avoid passing raw objects or unvalidated data that could be exploited.
- Command Injection Prevention: When using
childProcess.execor similar functions, ensure that all arguments derived from user input are properly escaped and sanitized to prevent command injection vulnerabilities, as seen in the Warp shell example. Use argument arrays (childProcess.spawn(command, args)) instead of string concatenation to prevent shell interpretation.
- Implement Origin Checks for
postMessage:
- Always include
event.originchecks when usingwindow.postMessageto ensure that messages are only accepted from trusted origins. The absence of an origin check was a critical flaw in one of the demonstrated vulnerabilities.
- Comprehensive Third-Party Dependency Management:
- Audit Dependencies: Regularly audit all third-party libraries, frameworks, and even external tools (like shells) used by your Electron application. Vulnerabilities can reside deep within these components, as demonstrated by the Warp shell exploit.
- Stay Updated: Keep all dependencies, including Electron itself, updated to the latest secure versions to patch known vulnerabilities.
- Threat Modeling for Electron Applications:
- Developers and security teams should perform specific threat modeling for Electron applications, understanding the unique attack surface that combines web vulnerabilities (XSS, CSRF, origin bypasses) with desktop-specific risks (NodeJS RCE, file system access, IPC manipulation).
- Adopt Advanced Security Tooling:
- While building an AI-guided system like TikTok's may be beyond the scope for many organizations, the existence of such tools necessitates the adoption of more advanced static application security testing (SAST), dynamic application security testing (DAST), and software composition analysis (SCA) solutions. These tools should ideally be integrated into CI/CD pipelines to catch vulnerabilities early.
- Consider implementing internal "linting" or security checks that mimic some of the AI's validation steps, especially for common Electron anti-patterns.
- Focus on Secure Coding Practices:
- Educate developers on secure coding practices specific to Electron, emphasizing the dangers of exposing NodeJS, the importance of context isolation, and secure handling of inter-process communication.
By proactively addressing these defensive implications, organizations can significantly harden their Electron applications against sophisticated AI-driven attacks and reduce their overall risk posture.
Key Takeaways
- AI/LLMs are potent tools for offensive security: Large Language Models, even those not considered "state-of-the-art," can be effectively guided to discover and exploit complex vulnerabilities in applications like Electron, including analyzing minified JavaScript within ASAR archives.
- Context management is crucial for AI accuracy: Techniques like MCCP (Multi-Context Chunking Process) and dynamic, runtime-generated harnessing are essential for managing LLM context, preventing hallucinations, and ensuring the AI's output is relevant and technically sound.
- Graph-based caching boosts efficiency: Storing discovered vulnerability chains as graphs significantly accelerates subsequent scans on similar codebases, reducing token consumption and processing time, making continuous security analysis practical.
- Electron's unique architecture demands specific security focus: The blend of Chromium and NodeJS, coupled with IPC and custom schema handlers, creates a distinct attack surface that requires specialized defensive strategies beyond typical web or native application security.
- Common Electron vulnerabilities persist: Issues like insecure
postMessagehandlers, untrustedloadURLusage, and command injection viachildProcess.execremain prevalent and can lead to critical RCE or data exfiltration. - Defenders must prioritize layered security: Implementing strict sandboxing, disabling
nodeIntegration, employing robust input validation and sanitization for all inter-process communication, and vigilant third-party dependency management are non-negotiable for securing Electron applications.
About the Speaker(s)
Danila Sashchenko is a Staff Security Engineer at TikTok. In his role, he focuses on advanced security research and the development of innovative security solutions. His work, as demonstrated in this talk, involves leveraging cutting-edge technologies like Artificial Intelligence and Large Language Models to automate complex tasks in offensive security, specifically targeting challenging areas like ElectronJS application vulnerability discovery and exploitation. His expertise lies in building sophisticated systems that enhance the efficiency and effectiveness of security analysis within large-scale product environments.
Reviews
Dr. Zero (Offensive Security Researcher) — SOLID
Nine times out of ten, 'AI-powered vulnerability discovery' talks are just glorified API wrappers that output hallucinated garbage. Sashchenko actually built a pipeline that understands Electron's execution context, manages token limits without losing the taint chain, and drops real RCEs. This is how you engineer LLMs for offensive security without the marketing bullshit.
Heather Calloway (CISO) — SOLID
TikTok just proved that the economics of desktop vulnerability research are collapsing. Their security team built an autonomous, AI-guided pipeline that finds and exploits complex source-to-sink chains in Electron apps—working directly against minified JavaScript. This isn't a theoretical AI warning; it is a structural shift in how quickly thick clients will be compromised.