4 ms·
Hi all, I made this. The reason it is described as "the world's most secure" is because both the code and the data are served from IPFS. IPFS is a content-addr
by jstanley 9y ago
Hi all, I made this.
The reason it is described as "the world's most secure" is because both the code and the data are served from IPFS. IPFS is a content-addressable storage system, so as long as you access it over an IPFS gateway you trust (running one locally is the best way), you know the code and data haven't been meddled with.
It degrades to the same security model as ordinary encrypted pastebins when accessed over a gateway you don't trust (e.g. the hardbin.com public gateway).
This article (was on HN a couple of weeks ago) gives a good overview of IPFS: https://ipfs.io/blog/24-uncensorable-wikipedia/ https://ipfs.io/blog/24-uncensorable-wikipedia/
And you can learn how to set up a local IPFS node here (it's super duper easy - copy binary into /usr/local/bin, ???, profit): https://ipfs.io/docs/getting-started/ https://ipfs.io/docs/getting-started/
So, please, don't knock it before you understand it :)
EDIT: Although I did try to explain it thoroughly in the About section, I do take responsibility for not making it easy enough to understand.
IPFS is pretty new technology, and presents a very different set of assumptions compared to traditional web apps.
If you didn't understand it at first but you do understand it now, please let me know what the key piece of information was that made it "click" so that I can put more emphasis on that next time.
- dsmithatx 9y agoIf you add a check box to make it a "one time secret" this would be very useful for sharing passwords.
- dangerface 9y agoIf your security can be degraded to the same security model as everyone else then you have the same security model as everyone else. Your paste bin is cool and unique no need to lie about it.
- jstanley 9y agoIt can't "be degraded" by others. You decide whether you want to degrade it or not.
- garrettr_ 9y agoA quick look at the source code shows the generate_key() function [0] to be insecure. It generates 32 random bytes (good, that's what you need for an AES-256 key), but then it uses those random bytes to sample from a distribution which only has 62 characters. This significantly reduces the security of the key, from 256 bits of entropy to ~190 bits (log2(62^32)). And that would be in the best case, if it were sampling uniformly from the distribution - it is not. I recommend reading Section 9.7 of Cryptography Engineering [1] to understand why choosing random elements from a set is harder than it seems. A good example of a similar bug is the nasty bug in Cryptocat's PRNG from 2013 [2]. I assume this step was done so the AES key could be included in the URL fragment, since a set of random bytes may not be url safe. I recommend feeding the random bytes of the key directly into the underlying cryptographic functions, and using a urlsafe encoding at a higher level when necessary. Also, it appears you are using AES [3], a block cipher, but I cannot figure out what block cipher mode you are using. I'll have to dig into the CryptoJS code a little more to see what it defaults to, but I have a sinking feeling that it's ECB, which is completely insecure. Dan Boneh's Crypto I course on Coursera is a good way to learn the basics of block cipher modes. [0]: https://github.com/jes/hardbin/blob/c77c2d7eb93586e0e009ea4b390b75fa3d7c750f/js/hardbin.js#L13-L25 https://github.com/jes/hardbin/blob/c77c2d7eb93586e0e009ea4b... [1]: https://www.amazon.com/Cryptography-Engineering-Principles-Practical-Applications/dp/0470474246 https://www.amazon.com/Cryptography-Engineering-Principles-P... [2]: https://nakedsecurity.sophos.com/2013/07/09/anatomy-of-a-pseudorandom-number-generator-visualising-cryptocats-buggy-prng/ https://nakedsecurity.sophos.com/2013/07/09/anatomy-of-a-pse... [3]: https://github.com/jes/hardbin/blob/c77c2d7eb93586e0e009ea4b390b75fa3d7c750f/js/hardbin.js#L5-L7 https://github.com/jes/hardbin/blob/c77c2d7eb93586e0e009ea4b...
- jstanley 9y agoI'm aware it's only 190 bits of keyspace. I mentioned this in my blog post[0], and would in fact be more likely to decrease it than increase it, in order to make the URLs shorter. I don't think it's a problem, but am interested in being proven wrong. It's using CBC mode. [0] http://incoherency.co.uk/blog/stories/hardbin.html http://incoherency.co.uk/blog/stories/hardbin.html EDIT: > And that would be in the best case, if it were sampling uniformly from the distribution - it is not. Can you please point out how it's not? It's intended to sample uniformly. It would be non-uniform if it were "randombytes[i] % alphabet.length". EDIT2: I see now how it's non-uniform. 256 values in randombytes doesn't map 1:1 onto 62 values in alphabet. I will fix this tonight, thanks for pointing it out.
- deleted 9y ago[deleted]
- greggh 9y agoI would like to point out one thing. There are 3 or 4 people in cryptography that are respected for their amazing talents in the field AND actually take the time to comment around here on articles. For some reason you got lucky, and all of them are in this thread talking to you, attempting to give advice. Advice that some people pay a LOT of money for, to these specific people. Most of your responses to them have read very defensively and argumentative. Out of everything said so far, this is the thing that scares me about possibly using this system.
- jstanley 9y agoDelivering applications over IPFS presents a different set of assumptions compared to traditional applications. It's frustrating when people act like I haven't thought through those assumptions and are handing out cargo-cult advice that is not applicable in this application. The non-uniform key generation is a bug, and I'm glad somebody noticed it.
- lucideer 9y agoYou've made a very large, arrogant, and bombastic claim: "The world's most secure X.... guaranteed". While this is followed by a "* not guaranteed", implying it is some kind of joke heading, the tone remains, and given that, you must reasonably expect to get a hard time from HN / security experts. You might be able to back up this claim, but you really shouldn't feel frustrated by the response here given its tone. Had you come on with something reasonable and descriptive like "Hardbin: a security-focused IPFS based pastebin", you might have received a more tempered response (though still, I'm sure, skeptical - as with all things security-oriented).