# CVE-2018-15685: Electron webPreferences vulnerability can be used to perform remote code execution

> Attackers can achieve remote code execution in Electron apps using IFRAMEs when nativeWindowOpen or sandbox options are enabled.

- **Severity:** High 8.1 (`CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 23 Aug 2018
- **Updated:** 5 Aug 2024
- **Also known as:** GHSA-hv9c-qwqg-qj3v

## What is CVE-2018-15685?

CVE-2018-15685 is a high-severity code injection vulnerability in Electronjs Electron, published on 23 Aug 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

GitHub Electron 1.7.15, 1.8.7, 2.0.7, and 3.0.0-beta.6, in certain scenarios involving IFRAME elements and "nativeWindowOpen: true" or "sandbox: true" options, is affected by a WebPreferences vulnerability that can be leveraged to perform remote code execution.

Weakness: CWE-1188 (Initialization of a Resource with an Insecure Default)

## Which versions are affected by CVE-2018-15685?

8 open source packages ship an affected version, including electron. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `electron` | npm | From 1.7.0 | 1.7.16 |
| `electron` | npm | From 1.7.0 | 1.7.16 |
| `electron` | npm | From 1.8.0 | 1.8.8 |
| `electron` | npm | From 1.8.0 | 1.8.8 |
| `electron` | npm | From 2.0.0 | 2.0.8 |
| `electron` | npm | From 2.0.0 | 2.0.8 |
| `electron` | npm | From 3.0.0-beta.1 | 3.0.0-beta.7 |
| `electron` | npm | From 3.0.0-beta.1 | 3.0.0-beta.7 |

Products: Electronjs Electron.

## How do I fix CVE-2018-15685?

Upgrade electron to a fixed version for your release line: 1.7.16, 1.8.8, 2.0.8 or 3.0.0-beta.7.

## Is CVE-2018-15685 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2018-15685 exists.

Public exploit code:

- Electron WebPreferences - Remote Code Execution (exploitdb)

## Other vulnerabilities in Electronjs Electron

- [CVE-2017-16151](https://insights.sbomify.com/CVE-2017-16151/): Chromium Remote Code Execution in electron (critical 9.8)
- [CVE-2018-1000118](https://insights.sbomify.com/CVE-2018-1000118/): Electron protocol handler browser vulnerable to Command Injection (high 8.8)
- [CVE-2026-34780](https://insights.sbomify.com/CVE-2026-34780/): Electron: Context Isolation bypass via contextBridge VideoFrame transfer (high 8.4)
- [CVE-2026-102676](https://insights.sbomify.com/CVE-2026-102676/): Electron: <webview> can enable Node.js integration in Web Workers despite embedder restrictions (high 8.3)
- [CVE-2026-102673](https://insights.sbomify.com/CVE-2026-102673/): Electron drops inherited HTML sandbox restrictions for popups opened through OpenURLFromTab (high 8.2)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2018-15685 and fix it if it is affected.

What it is: CVE-2018-15685 is a high-severity code injection vulnerability in Electronjs Electron, published on 23 Aug 2018. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2018-15685 exists.

Affected packages and fixed versions:
- electron (npm): affected from 1.7.0; fixed in 1.7.16
- electron (npm): affected from 1.7.0; fixed in 1.7.16
- electron (npm): affected from 1.8.0; fixed in 1.8.8
- electron (npm): affected from 1.8.0; fixed in 1.8.8
- electron (npm): affected from 2.0.0; fixed in 2.0.8
- electron (npm): affected from 2.0.0; fixed in 2.0.8
- electron (npm): affected from 3.0.0-beta.1; fixed in 3.0.0-beta.7
- electron (npm): affected from 3.0.0-beta.1; fixed in 3.0.0-beta.7

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2018-15685/ (Markdown: https://insights.sbomify.com/CVE-2018-15685/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2018-15685
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2018-15685
- OSV: https://osv.dev/vulnerability/CVE-2018-15685

---
From sbomify Insights: https://insights.sbomify.com/CVE-2018-15685/
Summaries are generated and may contain mistakes; the official description above is the record.
