News for hackers. Stuff that matters.
Re:Tanker: End-to-End Encryption SDK for JavaScript by the8472 on Wednesday May 22, 2019 @10:57AM (#19981880)
The issue with client-side, in-browser encryption is that you cannot audit or trust the software. Without fingerprinting/certification of the entire javascript-source the server could serve a manipulated source code that exfiltrates data, targeted only at specific users, i.e. not the auditors. Think NSLs or sufficiently crafty industrial espionage. CSPs do not save you here.

You can't TOFU in-browser JS, you can't trust audits and if any 3rd-party code is loaded into the environment you can't trust the entire origin.

The browser is the wrong tool for the job here.

Re:Tanker: End-to-End Encryption SDK for JavaScript by panarky on Wednesday May 22, 2019 @12:01PM (#19982582)
Innovator - To help me ride my bike on dangerous mountain trails, I made a sturdy frame and fat, knobby tires.

HN - The bike is the wrong tool for transportation in mountains. For absolute safety you must only use a cable car or funicular.

Innovator - But cable cars and funiculars are impractical for the mountain trails I want to ride, and my current road race bike with weak frame and skinny tires is dangerous off-road.

HN - A sturdy frame and fat, knobby tires only provide the illusion of safety, which is worse than no safety at all. Never go to the mountains unless you're in a cable car or funicular.

Re:Tanker: End-to-End Encryption SDK for JavaScript by eljimmy on Wednesday May 22, 2019 @12:09PM (#19982662)
Not a good analogy to compare tire sizes for mountain biking to information security in Javascript.

You should be comparing bicycle locks.

Re:Tanker: End-to-End Encryption SDK for JavaScript by penagwin on Wednesday May 22, 2019 @12:58PM (#19983103)
cough it doesn't really matter cough

Innovator - To help communicate with other HN readers, I created an analogy about mountain bikes and their tire size!

HN - Not a good analogy to compare tire sizes for mountain biking to information security in Javascript. You should be comparing bicycle locks.

Innovator - My analogy still makes sense though? Consider my physical safety to be roughly equivalent to information security. While bike locks could certainly work for the analogy as well they just weren't the choice we decided to go with.

HN - Your analogy falls apart with edge cases X, Y and Z', bike locks have been used for analogies since.....

Re:Tanker: End-to-End Encryption SDK for JavaScript by osrec on Wednesday May 22, 2019 @01:07PM (#19983175)
Reminds me of a recent discussion I had on HN! https://news.ycombinator.com/item?id=19873055

This particular response really made me chuckle: https://news.ycombinator.com/item?id=19873801

My analogy related to SQL, but we ended up talking about the complexities of physics...

Re:Tanker: End-to-End Encryption SDK for JavaScript by kevin_thibedeau on Wednesday May 22, 2019 @01:23PM (#19983316)
What color is the bike? I suggest camo for added security.
Re:Tanker: End-to-End Encryption SDK for JavaScript by zachrose on Wednesday May 22, 2019 @01:42PM (#19983518)
Forget the bike, what color of shed are you going to keep it in?
[dead]
Re:Tanker: End-to-End Encryption SDK for JavaScript by panarky on Wednesday May 22, 2019 @01:28PM (#19983384)
You're not a real pedant until you can spell it correctly.

(Who says we're not fun?)

Re:Tanker: End-to-End Encryption SDK for JavaScript by the8472 on Wednesday May 22, 2019 @03:10PM (#19984439)
Pendant is spelled correctly. After all we might be wearing charms against fun.
Re:Tanker: End-to-End Encryption SDK for JavaScript by e12e on Wednesday May 22, 2019 @11:31AM (#19982276)
Subresource integrity can help a bit. You still need to bootstrap from a trusted source though (eg a minimal index.html stored locally). And at that point, you really are back to figuring out a way to distribute a "known good" piece of software.

https://developer.mozilla.org/en-US/docs/Web/Security/Subres...

Ed: it might, for example be easier to email an attached minimal html file, than a 50mb electron app (multiply by 5 for working on the five major platforms; windows, Linux, Macos, Android and ios). That email might be internal, or signed however you usually sign mails (gpg, s/mime). Or you could host it on a minimal, secure webserver that only served static files over ssl etc

Re:Tanker: End-to-End Encryption SDK for JavaScript by cdata on Wednesday May 22, 2019 @11:48AM (#19982438)
A known good entry point could be delivered over a content-addressed medium like IPFS, and if you layer on SXG the consumer might still be able to validate the origin of the entry point.

https://docs.ipfs.io/guides/concepts/

https://github.com/ipfs/in-web-browsers/issues/121

Re:Tanker: End-to-End Encryption SDK for JavaScript by the8472 on Wednesday May 22, 2019 @11:48AM (#19982444)
You would still have to combine SRI with a fairly strong CSP to avoid any code execution except SRI-covered stuff.

It would be a good PoC I guess, but not practical yet for most people.

Re:Tanker: End-to-End Encryption SDK for JavaScript by e12e on Wednesday May 22, 2019 @04:30PM (#19985120)
We're talking about a html file that's basically:

  <html>
  <script
    src=example.cdn/app.js (SRI hash) />
  </html>
If your app.js go including unknown fonts and js etc... Then, yeah, you've got problems.
Re:Tanker: End-to-End Encryption SDK for JavaScript by AgentME on Wednesday May 22, 2019 @05:19PM (#19985636)
CSP would only be necessary if the SRI-covered stuff had bugs that let it accidentally load unverified resources. (To be clear, I think CSP is a necessary defense-in-depth measure for everyone, but this case doesn't uniquely require it.)
Re:Tanker: End-to-End Encryption SDK for JavaScript by angel_j on Wednesday May 22, 2019 @11:37AM (#19982320)
This is FUD. That's nothing you can't say about all info security practice. Fingerprints and certs you say? Been done since forever, it's called SSL and SHA-2.

There are risks, and there are procedures for mitigating risk. If you're building an app for privacy and security, you are going to take the appropriate measures, and let your users knows how to use. For instance, you are not going to load some random 3rd party adware into the app, obvi.

At the end of the day, people have to combine a care for their security with available best practices, and then move on with life. People can't thrive in the either/or of infosec's paranoid-hermit mentality (and tech's "people can't understand" paternalism).

Re:Tanker: End-to-End Encryption SDK for JavaScript by msy_ on Wednesday May 22, 2019 @11:05AM (#19981969)
Could it be done with a browser extension?
Re:Tanker: End-to-End Encryption SDK for JavaScript by CiPHPerCoder on Wednesday May 22, 2019 @11:08AM (#19981999)
You'd think, but everyone I know that explored this option ended up just implementing desktop software instead (e.g. with Electron).
Re:Tanker: End-to-End Encryption SDK for JavaScript by tptacek on Wednesday May 22, 2019 @11:48AM (#19982446)
Part of that is because by the time you're asking an ordinary user (not a super-opinionated "sophisticate" on HN) to install a Chrome extension, you're 95% of the way towards getting them to install a desktop application anyways, and that remaining 5% of effort is often worth the extra flexibility the Electron app gets you.
Re:Tanker: End-to-End Encryption SDK for JavaScript by _rlx_ on Wednesday May 22, 2019 @05:30PM (#19985741)
This is what the webext-signed-pages [1] extension does. This only works in a secure manner with Firefox though because Chrome extensions don't have access to the content of the HTTP responses [2].

[1] https://github.com/tasn/webext-signed-pages [2] https://bugs.chromium.org/p/chromium/issues/detail?id=487422

Re:Tanker: End-to-End Encryption SDK for JavaScript by pjc50 on Wednesday May 22, 2019 @11:22AM (#19982178)
You need the opposite of an extension, because in-browser crypto is incompatible with having any other "untrusted" extension. What you need is something with a reduced but secure feature set.
Re:Tanker: End-to-End Encryption SDK for JavaScript by michaelchisari on Wednesday May 22, 2019 @01:59PM (#19983691)
Ideally, it would be something the browser supported internally (without external js or plugins) with very minimal javascript entrypoints to decode/encode.
Re:Tanker: End-to-End Encryption SDK for JavaScript by _rlx_ on Wednesday May 22, 2019 @05:54PM (#19985967)
> Without fingerprinting/certification of the entire javascript-source the server > could serve a manipulated source code that exfiltrates data

This is actually one of the described use cases of the new webpackage specification: https://tools.ietf.org/html/draft-yasskin-webpackage-use-cas...

Here is the current draft: https://wicg.github.io/webpackage/draft-yasskin-dispatch-web...

Re:Tanker: End-to-End Encryption SDK for JavaScript by jopsen on Wednesday May 22, 2019 @11:18AM (#19982134)
Right now, sure.

That doesn't mean there are reasons to do client side crypto in the browser.

Finally, who is to say the web won't get TOFU someday.

I'm not even sure you can't do it today using service-workers.

Re:Tanker: End-to-End Encryption SDK for JavaScript by franky47 on Wednesday May 22, 2019 @11:16AM (#19982102)
> The issue with client-side, in-browser encryption is that you cannot audit or trust the software.

I agree. A few months ago I experimented on ways [1] to automate side-channel verification of JS bundles (and other built assets) while linking them to the sources.

It's based on trusting both the public CI/CD server (to reproducibly build the sources as they are obtained from the repository) and the public repository provider (to serve everyone the same sources), which in a FOSS environment is a given (if services like GitHub and Travis are in the threat model, there's not much to be done). It was a PoC/WIP, but it seems there might be a use case for side-channel verification.

The threat models for this kind of "mistrust" in built assets (assuming traceability and transparency) would be:

- Any kind of MitM (proxy/cache/load balancer) in the path of the assets

- Hosting provider being compromised (unlikely but still a probability)

- Malicious external content being injected at runtime (XSS, CDN)

I'm surely missing more, and I'd love to discuss at lengths about what others may have setup to do side-channel verification (ie: when even TLS and/or the CA chain of trust can't be trusted).

[1] https://github.com/47ng/revelio

Re:Tanker: End-to-End Encryption SDK for JavaScript by the8472 on Wednesday May 22, 2019 @11:31AM (#19982275)
Even doing it on a CLI doesn't help since the server might deliver something else to the browser.

And if you have dynamically generated HTML then you can't really authenticate it either.

To trust an application need in-browser fingerprinting of the whole page as it was served to the user and then pin that fingerprint. Combined with fairly strict CSPs.

Also, how do I trust the revelio.json? There's no signature.

Re:Tanker: End-to-End Encryption SDK for JavaScript by franky47 on Wednesday May 22, 2019 @11:46AM (#19982422)
> Even doing it on a CLI doesn't help since the server might deliver something else to the browser.

That is indeed one of the hurdles I encountered, ideally the browser itself should be in charge of verifying these claims (resource integrity helps in this case).

> And if you have dynamically generated HTML then you can't really authenticate it either.

In the case of SSR/PHP/other means of backend-generation of HTML, yes. I initially limited the PoC to SPAs and deterministic JS bundles.

> Also, how do I trust the revelio.json? There's no signature.

For now, as I said it's a work in progress, but indeed a way to authenticate the tamper-proof properties of the manifest is necessary. This however brings up the issue of a chain of trust, which is what apparently Tanker is trying to provide with their product. Yet, it raises the question: why should they be trusted ? The commercial viability argument (we don't screw up to stay in business) is not enough IMHO, trust should be based on mathematical proofs, not business rules.

Re:Tanker: End-to-End Encryption SDK for JavaScript by jakelazaroff on Wednesday May 22, 2019 @11:15AM (#19982082)
How is it any less trustworthy than a native app? It's perfectly possible to fingerprint any JavaScript that gets loaded.
Re:Tanker: End-to-End Encryption SDK for JavaScript by the8472 on Wednesday May 22, 2019 @11:40AM (#19982351)
In theory it's possible, sure. But in practice webapps are not set up for reproducible, auditable, signed builds with zero dynamic execution of 3rd-party code and making those signatures available in a standarized format. Plus browsers lack the tools to make this kind of fingerprinting effortless to verify for the user.
Re:Tanker: End-to-End Encryption SDK for JavaScript by jakelazaroff on Wednesday May 22, 2019 @12:09PM (#19982670)
Sure, but how often do users do this in practice for any apps? I know I don't check the fingerprints for Signal or WhatsApp or iMessage on my phone.

And even if the actual binary I'm running is secure, plenty of apps that claim to provide E2E encryption don't give me any way to verify the key of the other user. How do I know that iMessage or Facebook Messenger aren't inserting their own key pairs me and the people I'm messaging?