13 ms·
MEGA: Malleable Encryption Goes Awry
- nyanpasu64 4y ago> An adversary could push an update to MEGA’s clients such that they transparently re-negotiate a new session ID (SID) on every new access. They could also push an update which leaks the client-side keys directly?
- Shank 4y ago> MEGA can recover a user's RSA private key by maliciously tampering with 512 login attempts. I think this attack is really interesting and novel, but 512 login attempts is pretty high. I have a Mega account and I think I've logged in less than 50 times in the entire lifetime of my account, including when it was still controlled by Kim Dotcom. If you're an interesting enough target to use this on, I don't see why the Mega server that delivers the javascript for encryption can't be compromised instead, and just harvest the passphrase when it's submitted to login the first time? I don't know what you'd have to do to convince someone to login 512 times via social engineering, either. Presumably, a user who is dedicated and uses the service on a daily basis might hit this through normal usage in a year and a half? That's definitely plausible, but how many users are initiating new logins each time? How many will just stay logged into the app and never login? I guess for some percentage of people (e.g., people who are logging in each time via Tails, and do it twice a day) this attack is acutely viable, but it surely can't be all users.
- sp332 4y agoMega controls the client side too, right? So when you put your password into the app, they can make 512 logins right then.
- meibo 4y agoThey could also just upload the password and the key material, so in the end this is about them being able to do it in a way that isn't obvious to everyone looking at the network tab, which is the real issue being pointed out.
- albatruss 4y agoTheir MEGAsync client is open source at least.
- projektfu 4y agoAre the binaries reproducibly built?
- megous 4y agoNo they don't, unless you use their website.
- tptacek 4y ago512 login attempts is nothing. The Bleichenbacher'98 padding oracle attack is sometimes called "the million message attack", and it's one of the more practical crypto attacks --- I've been on projects that deployed that attack adversarially to accomplish things.
- herendin 4y agoThese are apparently login attempts visible to the user. To conceal them might be possible in some cases, but requires tampering suspiciously with public source client-side apps
- tptacek 4y agoThe server can just accept the SID the client "decrypted" with the malicious RSA key, and run the attack over time. This is right there in the paper. This isn't a cryptosystem, it's a CTF level.
- herendin 4y agoPut simply: this attack required the user to enter the password 512 times[0] [0] https://mega-awry.io/#questions https://mega-awry.io/#questions
- tptacek 4y agoPut simply: this attack required the user to log in 512 times, ever. You don't have to take my word for it; that's how Mega summarizes the attack in their response.
- herendin 4y agoThe point is this exploit, according to the researchers, required massive and unusual manual intervention by the user, so it's very different from the other exploit you mentioned that involves millions of auth attempts From the link I just posted, written by the researchers: 'Nevertheless, on the clients that we analyzed, all attacks would have required a substantial number of manual login attempts (i.e., the user entering the password). Since clients usually cache the credentials, users often stay logged in, minimizing the number of logins performed and thereby increasing the difficulty of the attacks.'
- rootw0rm 4y agoI've used corporate systems which made u login every visit (multiple times a day for me, 5 days a week), I've seen government systems do it, there might be a surprising number of targets where 512 attempts is effective
- ASalazarMX 4y ago> I have a Mega account and I think I've logged in less than 50 times in the entire lifetime of my account, including when it was still controlled by Kim Dotcom. Same experience here. I've logged in maybe once per year, if it suddenly started asking me to login every time I used it, it would be a huge red flag.
- aborsy 4y agoI better appreciate the importance of the authenticated encryption with this attack! The data of 0.25 billion users could quite easily be decrypted by whoever had access to MEGA’s systems (including governments and MEGA). It also shows the importance of open source code. I suspect there are far more vulnerabilities and backdoors in closed source proprietary software.
- deleted 4y ago[deleted]
- collegeburner 4y agoLmao imagine that. However mega brands itself its still mostly a cyberlocker for shady content and of leaks. Nobody uses it for security. Still interesting research tho.
- naniwaduni 4y agoYeah the "attack" is a bit out there when it's broadly assumed that the point of MEGA's encryption isn't to protect users' data, it's to protect MEGA from the insinuation that it might know what data its service is being used to store, much of which is, of course, content that no right-thinking company could store in good conscience. Good thing MEGA can't know what the users are doing. Just, I guess, take it under advisement for what designs don't work if you actually care about protecting user data.
- azalemeth 4y agoI know doctors who have (legally) shared medical images with it, because it offers much more storage than other providers and works everywhere in a browser. It is also far, far better than the "proper" channels. Similarly, I've received work-related files on it from "official big dog" people in "big companies". It's got a following beyond piracy (but because they don't post links online, you probably haven't heard about it as much).
- closewith 4y agoIt would presumably be a fairly lax data protection jurisdiction where storing medical data on Mega is lawful. They don’t seem to be HIPAA compliant, anyway.
- bee_rider 4y agoI've always sort of assumed (although I should be clear that this is 100% speculation), that given his widely reported legal trouble, the fact that he isn't in jail, and the fact that MEGA is basically branded as "wink not wink for doing crimes," that MEGA was pretty likely to be a law enforcement honeypot.
- deleted 4y ago
- winterdeaf 4y agoThis speaks volumes about the need of standardized encrypted cloud storage protocols. It always surprises me how fragmented the entire space is: Syncthing "untrusted devices" support is still experimental, Nextcloud does support encryption, but it's hard to judge how trustworthy it is. Gocryptfs and ecryptfs should be solid, but they are hard to use in a browser or on mobile. Resilio, Borg, Tarsnap, EteSync -- yet more protocols, and without clear security analyses. Same holds for commercial cloud operators: support for client-side encryption is starting to appear (Google Drive), but without an open, standardized client you still need to trust software from the cloud provider, which mostly defies the point of encrypting in the first place.
- jjcon 4y ago>This speaks volumes about the need of standardized encrypted cloud storage protocols I worry this then just means government actors only will need to find 1 vulnerability to have open access to a standardized web and those vulnerabilities will exist, nothing is perfect. I genuinely believe a non-standardized approach is more effective even if they are each more vulnerable individually. Android presents a decent corollary here vs iOS. Finding an iOS device exploit may cost more money but you get access to such a massive amount of devices it is worth it.
- er4hn 4y agoI'd argue the opposite actually. Device owners pay a much higher cost in maintaining multiple, incompatible, devices that each require their own procedure to upgrade, means of notification, etc. In addition a lot of security when things are fragmented tends to become "security through obscurity". Something that is a small player in a market can still have all sorts of issues that a state-funded actor can find via analysis and exploit. It's also much less likely to have a public actor find and disclose the issue due to the small install base.
- tptacek 4y agoThis isn't how cryptography engineers think about cryptography. It isn't like a PHP program, where there's inevitably going to be some bug found somewhere, and you do what you can to find as many as you can and react responsibly when more are found later; cryptography engineers use formal methods (among other things) to foreclose on vulnerabilities. The vulnerabilities documented in this paper are "own goals", not cryptographic inevitabilities. For instance, the weird authentication scheme that gives rise to the RSA key recovery attack --- that problem is what PAKEs are for.
- tatersolid 4y agoReminds me of Telegram’s ad-hoc design with so many primitives lashed together without any engineering or analysis. “More crypto” in your implementation is rarely better for security. This is a great teaching example for the “don’t roll your own crypto” proponents.
- winterdeaf 4y agoThe same research group working on the Telegram MTProto security analysis is behind these attacks on MEGA! (I should add: disclosure, I work there too.)
- taneq 4y agoInteresting! While you're here, is there anything you can add to the general debate about Telegram's crypto design? I see a lot of people here disparaging it, but nothing really from Telegram to explain what choices were made or why.
- winterdeaf 4y agoTo put it in Igor's words, it is like "somebody baked a cake following a recipe, but without ever having tasted or seen a real cake". The crypto design is brittle, but the practical attacks are somewhat limited. The reason why it's so disparaged by cryptographers it because it ignores several decades of cryptographic advances -- the whole saga of attacks on SSL / TLS<=1.2 taught us that key separation and clear protocol composition boundaries are important, but Telegram fails disastrously at these. Security proofs should be made before a protocol is used, not as an afterthought. The real reason why I would not recommend Telegram is that chats (by default) and group chats (by necessity) are not encrypted. Telegram's servers will be eventually breached by someone. A malicious actor will be hired as a software engineer, or as an intern. When this happens, all you ever wrote in Telegram will be a plaintext at their disposal -- unacceptable in 2022, and post-Snowden.
- mappu 4y agoI think this level of key management is relatively simple for a production application. There are not really too many pieces and certainly no unnecessary steps (the mitigation recommendation was to add more keys, not fewer). The interesting part is really just the first step - starting with a user's password, to statically derive a service-authentication key and a data-encryption key that the service provider ostensibly never sees. At $DAYJOB we independently came up with this same zero-knowledge solution too, using slightly different primitives. Ideally there'd be some well-reviewed zero-footgun nacl.SecretBox()-style thing for this use case, but there simply isn't.
- fomine3 4y agoMEGA's response looks good. https://blog.mega.io/mega-security-update/ https://blog.mega.io/mega-security-update/
- tptacek 4y agoDoes it? Here's what they say: Who could have exploited the vulnerability? Very few: An attacker would have had to first gain control over the heart of MEGA’s server infrastructure or achieve a successful man-in-the-middle attack on the user’s TLS connection to MEGA. Here's what they probably should be saying: Who could have exploited the vulnerability? We could have.
- tptacek 4y agoYou all really need to read this paper, because it is hilarious. It's honestly hard to believe Mega could have come up with this bizarre jungle gym of a cryptanalyst puzzle. You're the client, and you have a bucket of keys: keys for files, keys for chat, more keys for chat, &c. You encrypt them all with AES-ECB† under a "master key" which is in turn encrypted under a key derived from PBKDF2, so you can upload them to a server without revealing them to the server. So the server has all these keys that you encrypted. You've got your password. Now you want to log in. So what you do is you send an identifier (PKBDF2-derived from your password) to the server†. They look you up and they send you back one of those keys you uploaded before, the encrypted RSA key, along with a session ID encrypted under that RSA key. The idea is, you have the password and so you can decrypt the RSA key (by deriving the master key), and then decrypt the session ID and post it back to them so they know you're you. The problem is these encrypted key blobs aren't authenticated; they're just the ECB ciphertext of the keys. And they do, like, no checking at all on them. So when they send you this RSA key blob (ostensibly the blob you sent them before, but of course, the server is malicious and so they tamper with it), they're just sending ECB(mk, [p, q, d, qInv, pad]) --- with that 4-tuple being length-delimited. The client just ECB-decrypts the blob and then makes sure it got 4 values. So the first half of this paper is just 3 cryptographers doing stunt cryptography by randomizing qInv, the RSA CRT coefficient. The client obliviously uses whatever ECB decrypts here, and better yet, it uses it to perform an RSA operation on another ciphertext the server gets to choose, and better still, it then posts back the partial result of that encryption, so the server can see what happened and guess what to do next. And better yet, that RSA decryption is done with no meaningful padding: they just stick the session ID into a blob of zeroes; they don't even verify the padding, they just assume the session ID is the 43 bytes starting at offset 2 of the RSA plaintext, and ignore everything else. They start by recovering the RSA key itself. They do this by recovering q, the first factor of the key. They can do this because by corrupting qInv and strategicially choosing RSA-encrypted session IDs, they can get back a session ID that is 0 if their current guess if below q, and nonzero if it's above q. A 1023-step binary search gets you q; you can get it down to 512 guesses using a lattice search that, as someone pointed out, is definitely going to be in a CTF level next year, now that scenarios like this can't be dunked on as entirely, ridiculously contrived. (From q you can quickly recover the rest of the key). But this isn't even the craziest part. The craziest part is that all these other keys, a key per file or directory, are also encrypted under the same master key as that RSA key is. So when the server sends you the encrypted RSA key and blob encrypted under that RSA key, you can ECB-swap in blocks of other keys with carefully chosen session IDs to set up oracles to recover the other keys, based on how the client's RSA behaves with fucky qInv values. "We believe it to be an entirely novel kind of attack", they say. And to that I say, no shit it's novel, it's so novel Mega probably should have gotten an authorship credit on this paper: Backendal, Haller, Paterson, and Mega. They couldn't have done it --- or even thought of it --- without Mega. Truly wonderful stuff. † I know, I know, ECB, you can see penguins through it, but they're encrypting keys, which are fully random --- I mean, you assume they're fully random but just keep reading --- so it's not like completely unprecedented to see ECB here. †† This is already terrible! All your security is that password, and they can attack it from this value!
- yalogin 4y agoIs this a European service? I have never heard about this.
- kevingadd 4y agoMegaupload was formally a hong kong-based company originally, then its successor company Mega was started in... New Zealand, I think? Hence the .nz It's a service for pirates and other people who want to share content that would get pulled from services that can (trivially) view users' files
- Jiocus 4y agoIt's a cloud storage service, –like Dropbox, Google Drive etc– for regular people and businesses. Their value proposition, is providing client-side encryption to their customers so they can protect their data in-transit and at rest. MEGA's job is to make it as unlikely as possible, and as expensive as possible for a threat actor to successfully thwart their value proposition. Vulnerabilities will always be discovered. Blessed practices will be superseded. This is normal. In the consumer/end-user space, their storage to price ratio is great. Not counting plain mass storage filesystems for enterprise/development, I still hasn't found something better.
- tptacek 4y agoNo. Cryptographic design vulnerabilities like this are not normal.
- godmode2019 4y agoI built a CLI to encrypt files and sync them with MEGA, so only encrypt data is stored on the server, which I control the key locally. The filenames are stored as uuid in a local sqlite dB. This runs on the mega.nz api They are the cheapest storage service.
- drak0n1c 4y agoKim Dotcom (the estranged founder of MEGA) has confirmed this and claims the backdoors were added purposefully due to the new owner's plea deal with CCP authorities. https://twitter.com/KimDotcom/status/1539426607978680321 https://twitter.com/KimDotcom/status/1539426607978680321
- tptacek 4y agoYeah, he's making that up.
- sharmin123 4y ago
- nix23 4y agoWell: https://yro.slashdot.org/story/15/07/27/200204/interviews-kim-dotcom-answers-your-questions https://yro.slashdot.org/story/15/07/27/200204/interviews-ki... >>The company has suffered from a hostile takeover by a Chinese investor who is wanted in China for fraud. He used a number of straw-men and businesses to accumulate more and more Mega shares. Recently his shares have been seized by the NZ government. Which means the NZ government is in control. In addition Hollywood has seized all the Megashares in the family trust that was setup for my children.
- godmode2019 4y agoInteresting point. Using the python client I can rack up 50+ logins in a day. Because each time I update a file the watchdog updates the cloud version, logging in then logging off after.
- lobocinza 4y agoYou don't have to worry about it if you use Gocryptfs.