Alex Gleason's avatar
Alex Gleason 2 months ago
:POLICE: A critical security vuln was fixed in Ditto Android that would allow an attacker to steal your nsec by getting you to tap an evil URL. :wisp_sad: A new version has been released onto Zapstore and Google Play. UPDATE DITTO ANDROID IMMEDIATELY. :POLICE: :POLICE: :POLICE: Ditto on web and iOS are unaffected. The issue only affects Android because it was a problem in the Android link handler. People using Amber are unaffected by nsec theft but should upgrade anyway because the attack is still arbitrary code injection via evil URL. What does an evil URL look like? It contains JavaScript code inside of the URL. The path was not being escaped properly, so it could break out and run any script. The fixed version completely changes the way native code triggers UI navigation (event-driven) so we never inject JS code into the UI at all anymore. Huge shout out and thank you to @calle for connecting me to the team behind who discovered this vuln, and huge shout and and thank you to them for responsibly disclosing it to us. 🙏 They also discovered some other issues we patched in this release, but the evil URL is by far the worst.

Replies (18)

Ditto’s bug was arbitrary JavaScript in the app WebView (XSS), not RCE, from which they could drive the app. Including the session keys, but no stealing of the key.
Wisp wouldn't automatically have the same bug, but it also would need to be security audited to know if it has any before we know its truly safe. Ditto had the benefit here that someone tested it for security vulnerabilities so they had a proper chance to fix them.
If in theory it was tampered with you'd just have to revoke it in your signer. I don't think anyone exploited it in the wild.
I know nothing about android webview stuff, but I assume the nsec-based signing code was in the native side of the app not inside the JS vm and therefore the XSS shouldn't be able to escape it?
Okay, if so my original thoughts were, while they obv cant extract anything from amber, they could have taken any decrypted data and dms, if they took nip46 session keys, they could used them to Harvest now Decrypt later on any nip46 data. But if a user auto allowed any amber permissions for the app, it would then have be able to auto sign anything.
That's the concern for users that enabled auto-allow for amber specifically, the xss would have the ability sign arbitrary requests on behalf of the user. For nip46 aka bunker users, it would be a Harvest Now, Decrypt Later attack with exfiltrated session keys.
It's interesting how like half of nostr apps will compromise your nsec, and like most of them will leak all your metadata for anyone to see. You can check on here who people have sent private messages to, when they sent the messages etc. Etc. All these vulnerabilities really makes nostr feel like a psyop sometimes
Amber doesn't work with anything in my experience. I've seen a lot of people complain about it not working recently, for things that it used to work for.
I sure have felt the pain, especially with web-site based signing origin. But Fountain used to work there :(. Pocket Cast maxxing for a while, now.
↑