Live data from Hacker News

Tor in a safer language: Network team update from Amsterdam

lists.torproject.org

221–230 of 254 posts

Re: Tor in a safer language: Network team update from Amsterdam

#221
post #21

Earlier quoted context omitted.

Founder of https://easyvpnrouter.com/ ask me anything or how to build one yourself if you want a project

I guess the main question about this product (which is the sort of thing I'd buy -- an hour of saved effort pays for it) is how can I trust you to be less evil than Comcast? I guess if you're open-source and a lot of people are paying attention, that would do it.

It is much more difficult than 1 hour to setup yourself, because of FCC regulations flashing new routers is much more difficult, you need a TFTP server, it's pretty annoying. In addition the edge cases of the internet going out, then when it comes back bringing the VPN back up automatically, being able to switch PIA accounts / countries easily, it's not a simple thing. I got into this because I wanted to build one myself, and I have a friggin master's degree in CS and it took me several weekends. So I figured a business could be formed :)

Re: Tor in a safer language: Network team update from Amsterdam

#222

Since bitexploder asked, I'll add what I wrote on this on other forums. If it's about secrets or anonymity, make sure you always use a safe language that supports careful control and reasoning about both memory and CPU time. The reason is that this enables covert, channel analysis for vulnerabilities that leak secrets through storage and timing. It's why I wanted Freenet to ditch Java aside from the obvious reasons.…

G'day Nick! Java is getting an AOT compiler in July (Graal, http://openjdk.java.net/jeps/295 ) that will let you AOT compile parts, or all, of your program, including the JVM modules themselves. This would seem to leave the GC as the main source of side channel vulnerabilities. The GC itself will become more pluggable as well, with a pure Java implementation. What requirements would you put on a GC for side channel s…

Good to see you, Ian! Yeah, there was a recent post on Lobsters with a pile of progress on tech you sent me a while back. Them getting an AOT can help so long as you can get a good, mental idea of what the assembly is going to be doing for a given piece of Java. Otherwise, you'll be doing a lot of rewriting that might make one reconsider Java in first place. Pluggable GC's is a good think as is ability to turn it off for unsafe native. You told me before they could do the latter, probably were for some of the platform.

Before answering the other question, it helps to understand what covert channels are fundamentally. First, know there's always two parts: Sender w/ access to secrets but inability to do I/O outside the system; Recipient w/ no access to secrets but ability to send its info out. These might be in separate processes, partitions/VM's, or even on a network w/ stuff happening due to protocol interactions. Idea is to find a way to communicate that wasn't intended for communication. Should help confirm the dark things I say about mainstream INFOSEC when I say I couldn't find almost any intros or blog articles on these for you in top results. I found one, though, that describes them well even if not having many examples:

https://arxiv.org/pdf/1306.2252.pdf

Now, back to the GC. The GC might kick in whenever secrets are being processed. This could mask information about them due to unpredictability or leak information about them. The simplest route to dealing with it is not allowing GC while performing any operation that processes secrets. Depending on the app, the impact on memory availability or performance can vary considerably. There's also at least three more channels to look for on even basic app. The keys might leak in memory that's released back out of the system. First needing overwritten is in Java app itself for anything GC releases. Gotta look at assembly since compilers sometimes get rid of that as a "useless" operation. Second, the OS itself might leak by swapping out privileged Java app (Sender) for a Recipient that simply reads the registers before doing anything. Secrets might still be in them. Orange Book & separation kernels required these overwritten every time a process change. Don't know if current OS's do that. The "swap" part of the filesystem itself is a risk and should always be disabled. Finally, a Recipient in another process can receive secrets through the cache activity of the Java app. That's an old one that's hard enough to [confidently] deal with that I just advised running trusted apps on one CPU and untrusted on another CPU. That's physical isolation with them communicating over a pipeline, SMP since caches are separate, or multicore with no shared cache between cores. There's CompSci work such as partitioning caches and potential with embedded CPU's w/ things like locking, real-time caches that might help. Who knows real practicality, though.

So, you prevent or overwrite any storage of secrets that another process could touch. You put a brick wall between two events where a recipient observing timing could possibly learn something. Eliminating non-determinism can go a long way. Reference counting might help since you at least know when you'll deallocate w/ similar checks happening constantly. The deallocation might even be masked. For protocols, the classic response by military systems was fixed-size, fixed-rate transmission with extra attention that error responses didn't leak anything. Every detail you can sealed instead of just data payload since any might be storage channel. So, there's you a start on it.

And this was just running an app + considerations of a GC running in the background. Leads to all those problems. See why high-assurance security invested so much effort into automatically or at least reliably getting these damned things out of our systems? Just imagine how many are in UNIX API's, common protocols, and clouds. The fix is hard and expensive if it's legacy so they're definitely still leaky. :)

Re: Tor in a safer language: Network team update from Amsterdam

#223

Since bitexploder asked, I'll add what I wrote on this on other forums. If it's about secrets or anonymity, make sure you always use a safe language that supports careful control and reasoning about both memory and CPU time. The reason is that this enables covert, channel analysis for vulnerabilities that leak secrets through storage and timing. It's why I wanted Freenet to ditch Java aside from the obvious reasons.…

What are good resources for learning Ada/SPARK and MISRA-C?

Those resource change quite a bit over time since it's both a small, legacy ecosystem and a constantly-changing, active ecosystem. I'd have to update my resources when my busy, busy schedules slow down. I plan to, though, on those two tech w/ guides & whatever FOSS tools I find. Just email me at address in my profile about it. I'll just save it in there so I can email it back to you once I'm up-to-date on the learning resources & tools available.

Re: Tor in a safer language: Network team update from Amsterdam

#224

Earlier quoted context omitted.

trying to get a ML pipeline optimized I wrote some machine learning tools in Go and the experience is quite bad. The lack of operator overloading and parametric polymorphism make most ML code ugly. It also does not help that Go's compiler backend does not optimize very strongly and calling out to C comes with a relatively large overhead. Sure, I could use something like Haskell, but then I'd have to worry about wheth…

Yeah, the ML parts aren't in Go. I'm working in TensorFlow, so it's C++ scripted by Python. But there's a lot of incidental stuff that needs to be done, most of which I don't want to spend cycles on thinking hard about, and Go does a good job there, in that narrow niche where I want something that runs on one machine but find python too slow. At a previous gig, I had done a lot of F#, and I think that's close to my p…

But there's a lot of incidental stuff that needs to be done, most of which I don't want to spend cycles on thinking hard about, and Go does a good job there, in that narrow niche where I want something that runs on one machine but find python too slow.

Definitely! I have continued to use Go for small utility every now and then as well. The standard library is extremely well-suited for that kind of work.

(Now using Rust more in that role as well, but mostly to get continued practice ;).)

Re: Tor in a safer language: Network team update from Amsterdam

#225
post #214

Earlier quoted context omitted.

It seems wrong to call Facebook and Microsoft "built on" Haskell, even if they are using it effectively for some important things. Galois, of course, is very much built on Haskell. And there are certainly other examples.

Still their money is certainly landing in some pockets relevant to those communities. A company doesn't need to be built on a single language.

For sure. My complaint was only wording choice (not yours) without clarification (which would have been yours).

Re: Tor in a safer language: Network team update from Amsterdam

#226

Earlier quoted context omitted.

Did you try coding in it for more than a week? I have found that using a properly indenting editor (Emacs, drracket) the parents just fade away. And then you discover paredit and you start wishing every other language would let you treat your source code like that.

Yes. I was required to use Lisp for intro comp sci in College, followed by all the AI courses in Lisp, then a few jobs. It's just never been a go to language for me.

Sounds fair. Most of the time people say "i don't like the parens" the closest they came to actually using a lisp was JavaScript.

Re: Tor in a safer language: Network team update from Amsterdam

#227
post #187

Earlier quoted context omitted.

Kind of, but with more `strings.hasSuffix(...)` and less `new StringComparatorFactory(new StringSubsetComparison(), StringComparisonPositions.END_POSITION, ...`

In Java it is string.endsWith(...) , not much different.

Ok bad example but you get the idea.

Re: Tor in a safer language: Network team update from Amsterdam

#228
post #188

Earlier quoted context omitted.

Erlang, sure. Maybe a few. But Haskell? I doubt there are many. I bet Go's use in industry is easily 100 times that of Haskell's already and it is much younger.

Galois, Facebook and Microsoft are some examples, and all ML derived languages tend to be used for data modelling in the financial sector. https://wiki.haskell.org/Haskell_in_industry https://ocaml.org/learn/companies.html

Erm Facebook is built on PHP, Microsoft on C++ (or C#) and I've never heard of Galois.

I mean the fact that there is even an exhaustive "Haskell in industry" page at all shows you how rare it is. There isn't a "C++ in industry" page! I did actually find a Go one here:

https://github.com/golang/go/wiki/GoUsers

But it's both hilariously long and also obviously not exhaustive.

Re: Tor in a safer language: Network team update from Amsterdam

#229
post #188

Earlier quoted context omitted.

Galois, Facebook and Microsoft are some examples, and all ML derived languages tend to be used for data modelling in the financial sector. https://wiki.haskell.org/Haskell_in_industry https://ocaml.org/learn/companies.html

Erm Facebook is built on PHP, Microsoft on C++ (or C#) and I've never heard of Galois. I mean the fact that there is even an exhaustive "Haskell in industry" page at all shows you how rare it is. There isn't a "C++ in industry" page! I did actually find a Go one here: https://github.com/golang/go/wiki/GoUsers But it's both hilariously long and also obviously not exhaustive.

While you disdain Haskell's use in the industry, there are researchers much relevant to the IT industry than any of us, that happen to be on payroll from Facebook and Microsoft.

Maybe you should spend some time learning how FB and Microsoft use Haskell, you might be surprised with what you find.

As a clue, try to find out how C# and VB got LINQ, maybe you will find the right MSR paper by a certain Erik Meijer.

Re: Tor in a safer language: Network team update from Amsterdam

#230
post #203
post #72

Earlier quoted context omitted.

Golang is simpler java, and that is it's target. It even has the same perf profile as java. Erlang does have a worse perf profile.

Golang performance profile is very different from Java. It's speed is closer to C++, garbage collection optimized for latency, not bandwidth, very low startup time comparable with typical native code.

Just because a language is compiled doesn't mean it will approach C++ speeds. The GC itself is a hard limit on perf. What I've seen in practice:

1x time: C

1.5x time: C++ (with smart pointers)

~2x time: Objective-C (almost everything is a heap smart pointer)

3x time: Java, Golang (optimized GC languages)

Post reply on HN