News for hackers. Stuff that matters.
Re:Glibc getaddrinfo stack-based buffer overflow by jimrandomh on Tuesday February 16, 2016 @10:04AM (#11110238)
> "The glibc DNS client side resolver is vulnerable to a stack-based buffer overflow when the getaddrinfo() library function is used. Software using this function may be exploited with attacker-controlled domain names, attacker-controlled DNS servers, or through a man-in-the-middle attack."

> "The vectors to trigger this buffer overflow are very common and can include ssh, sudo, and curl. We are confident that the exploitation vectors are diverse and widespread; we have not attempted to enumerate these vectors further."

> "Remote code execution is possible, but not straightforward. It requires bypassing the security mitigations present on the system, such as ASLR."

It is time for the bimonthly Internet security meltdown. Again. When they say that "exploitation vectors are diverse and widespread", they really mean it. Patch ASAP. This is a race; it is only a matter of time before criminals start automatically and systematically scanning every server on the internet for this, and you really really want to be patched before that happens.

Thinking a bit more long term, it's pretty clear at this point that we need to expunge all C language networking code from the world, replacing it with Rust or pretty much anything else. That's not sufficient by itself, but it is necessary, or else the periodic Internet security meltdowns won't ever stop.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @10:31AM (#11110456)
> Thinking a bit more long term, it's pretty clear at this point that we need to expunge all C language networking code from the world, replacing it with Rust or pretty much anything else. That's not sufficient by itself, but it is necessary, or else the periodic Internet security meltdowns won't ever stop.

It was already clear in 1961 when Burroughs used Algol and C wasn't even born.

It was clear when Hoare stated on his speech in 1980:

"Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to - they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980, language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law."

I can quote lots of other security research papers since computers exist.

But then UNIX workstations took over the computing world, bringing C with them.

Re:Glibc getaddrinfo stack-based buffer overflow by minimax on Tuesday February 16, 2016 @06:39PM (#11114001)
I think the other thing that changed is that branch predictors are roughly infinitely times better than they were in 1980. The is-this-subscript-ok check should be easily predictable and I wonder if these checks even cost anything in a hot loop on a modern CPU.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Wednesday February 17, 2016 @02:22AM (#11115974)
After Z80 and Sinclair Basic, my next languages were GW-Basic, Turbo Basic and Turbo Pascal, followed by many others.

The Borland languages like many other that allowed for system programming in those days, allowed for disabling bounds checking, as Borland customers weren't like Hoare ones.

I never felt the need to disable them.

Yes they did had a few ms to the program execution, but nothing that would impact the user experience of the application.

This is one of the biggest problem in our industry, specially among C and its derived languages (C++, Objective-C), to micro-optimize each code line without any sort of measurement how it impacts the final application.

Of course there are cases where it really matters, like HPC, games and such, but those are a tiny portion of the software that gets written every day.

Re:Glibc getaddrinfo stack-based buffer overflow by kevingadd on Tuesday February 16, 2016 @09:16PM (#11114722)
They have a measurable cost, and performance-obsessed developers/users hate the cost. But it's a lot smaller than it used to be, and modern compiler/JIT research is yielding ways to safely eliminate/hoist a lot of the checks.
Re:Glibc getaddrinfo stack-based buffer overflow by draw_down on Wednesday February 17, 2016 @02:12AM (#11115929)
Hoare shames us with that quote. Really, what else is there to say.
Re:Glibc getaddrinfo stack-based buffer overflow by djsumdog on Tuesday February 16, 2016 @02:00PM (#11112254)
All this "Let's replace everything with Rust" is extremely childish.

Be wary of making programming languages a religion. The Java zealots did it, and you can see the results where full Java projects are used in places where a 20 line Python script would have been easier.

If you're serious, one of your pet projects should be trying to implement BSD sockets with Rust. Then try compiling some C apps against your implementation. Then do some performance tests showing memory and time benchmarks of your Rust vs libc implementation. Do a blog post on it. Then we'll take you seriously.

Re:Glibc getaddrinfo stack-based buffer overflow by AsyncAwait on Tuesday February 16, 2016 @02:14PM (#11112348)
The parent actually said "Rust or pretty much anything else", which means any memory safe language. It just happens that Rust came to his/her mind as the first choice probably because it's been talked a lot about lately on HN and memory safety is its explicit focus.

I see no "programming languages a religion zealotry" in parents post, but I see a lot of bitterness in yours. Perhaps it's time to reflect.

Re:Glibc getaddrinfo stack-based buffer overflow by reality_czech on Tuesday February 16, 2016 @11:45PM (#11115376)
There are tons of vulnerabilities discovered every month. Most of the them are in Java, PHP, javascript, etc. software because that's what the majortiy fo new code is written in. And those languages have features that can lead to security holes, which C doesn't have. For example, PHP supports eval(), JS has cross-site scripting attacks, Java has classloaders, etc. etc. But somehow only the vulnerabilities in C language software get programming language zealots exited. So maybe you should reflect.
Re:Glibc getaddrinfo stack-based buffer overflow by dh997 on Wednesday February 17, 2016 @12:06AM (#11115465)
Oracle JVM/OpenJDK and .net CLR are deployed in production at basically every profitable company on Earth.

PHP... Is deployed because it's perceived to be easier and friendlier than other religions, and so wins with that popularity war (as MySQL did). Facebook HHVM is another approach. Folks know the likely warts and mitigate to shrink the attack surface by defending deeply from front layers down to backend services.

Postgres was harder to use in the 2000's despite having a clean codebase but got mucb easier to use, in large part due to MySQL, while leading on features inspired by Oracle DBMS and more recently NoSQLs with hstore.

Attacking popularity for what gets the job done is moot because defense is never ending vigilance for anything real.

Perhaps the focus should be on starting to formally-verifying core libs like zlib, OpenSSL, OpenSSH (portable), glibc, etc. for correctness and resilience against side-effects and ABI promises.

Re:Glibc getaddrinfo stack-based buffer overflow by Havvy on Wednesday February 17, 2016 @03:45AM (#11116303)
JavaScript doesn't have XSS. The DOM allows for XSS vulnerabilities, but that's an API, not the language.
Re:Glibc getaddrinfo stack-based buffer overflow by EdSharkey on Tuesday February 16, 2016 @02:58PM (#11112691)
Well you kindof sound like a performance zealot. Burn some cycles, stop running unmanaged code, just take the hit. It should be justifiable if a Rust implementation of a library is 5-10% slower than its C equivalent. How can choosing to build and deploy unsafe code in today's legal/political/financial environment be defensible? Is it going to take public shaming and frogmarching developers to jail for our industry to make a change?

We need to discredit performance zealots and gently herd them to a profitable careers in videogame development where they can't do much harm.

And, there's plenty to dog on Java about, but that language and VM very intentionally makes it an ordeal to load a 3rd party binary blob. Modern development systems/VM's seem to have waved off concerns about unmanaged code and security; Node.JS compiles and loads binary blobs from dependencies all willy-nilly. Java took and takes security seriously.

Re:Glibc getaddrinfo stack-based buffer overflow by steveklabnik on Tuesday February 16, 2016 @03:12PM (#11112797)
Depending on what you're doing, it might even be faster, not 5-10% slower. We're currently sometimes faster, sometimes slower, but we should never be slower by a huuuuuge magnitude, though of course, bugs do exist.

I've been excitedly watching this over time; I think in a few years Rust could just be straight-up faster than C the majority of the time, depending.

Re:Glibc getaddrinfo stack-based buffer overflow by EdSharkey on Tuesday February 16, 2016 @03:42PM (#11112982)
I think you're right with all the new opportunities for optimization in Rust.

I wanted to encourage developers to be open to compiled Rust being nowhere-near an order of magnitude slower than equivalent compiled C and still have it be an acceptable architecture choice for systems-programming.

Re:Glibc getaddrinfo stack-based buffer overflow by steveklabnik on Tuesday February 16, 2016 @03:46PM (#11113008)
Absolutely. I think trading a bit of speed for a bit of safety is the right choice 99.99% of the time. I've just been excited to watch the benchmarks improve :)
Re:Glibc getaddrinfo stack-based buffer overflow by alkonaut on Tuesday February 16, 2016 @02:26PM (#11112441)
It doesn't have to be a big rewrite of "everything" to Rust. It would at the very least be a slow successive rewrite whenever a major change is needed.

For this particular piece of code one would hope that the fix we'll see now would also include around 100 new lines of comments, splitting of hundred-line functions into a dozen smaller ones etc. I suspect that just by doing that someone would notice another flaw of this magnitude. Also, the updated code would be easier to maintain or rewrite in the future. The whole idea that all changes are kept as small as possible because of concerns that refactoring might break something says something about how brittle it is and how much of the testing is just battle hardening and not proper tests.

Re:Glibc getaddrinfo stack-based buffer overflow by dap on Tuesday February 16, 2016 @02:35PM (#11112509)
> It doesn't have to be a big rewrite of "everything" to Rust. It would at the very least be a slow successive rewrite whenever a major change is needed.

That's why the suggestion to implement BSD sockets first is an interesting one. It's a non-trivial interface (which is important to be a useful proof of concept), but it's widely used, relatively well-defined, and could potentially be plugged into applications without replacing other pieces (though that may turn out to be tricky). If it works, you could start implementing more native interfaces that way. If it doesn't, maybe we'll understand better why C remains so dominant for system libraries. (Personally, I don't think it's just inertia or the cost of rewriting all that software, but that's why I'd like to see a project like the one suggested.)

Re:Glibc getaddrinfo stack-based buffer overflow by scotchmi_st on Tuesday February 16, 2016 @03:40PM (#11112976)
I think you're misreading what he says. "...replacing it with Rust /or pretty much anything else/" (emphasis own). The point is we should be replacing C with /pretty much anything else/. Rust looks like the most obvious (but not necessary correct) candidate.

Also performance is not such a big deal as dictate security considerations. One's fancy medical web app is worthless if it leaves the potential for theft of medical data.

Re:Glibc getaddrinfo stack-based buffer overflow by draw_down on Wednesday February 17, 2016 @02:17AM (#11115953)
But why is it religion to look at all the problems caused by C code and say, let's try something that doesn't have these problems? Why isn't it religion to look at that history and say no, it's okay, let's keep using C?
Re:Glibc getaddrinfo stack-based buffer overflow by dh997 on Tuesday February 16, 2016 @11:50PM (#11115403)
The overall goal of reducing deployed LOC, complexity and low-level boilerplate is laudable and doable so by using a C isomorphic linking language (can call into and can call from) to gradually, experimenting by converting one module at a time and increasing tempo of semver API refactorings for also reducing code and features to the essentials. "The journey of a thousand miles begins..."

Also, we need more unit testing, fuzzing and formally proven correct libraries (a-la seL4). Most C development is really bad about unit testing and fuzzing because it's incredibly laborious and verbose, even when it's known to be a good idea.

Re:Glibc getaddrinfo stack-based buffer overflow by tkinom on Tuesday February 16, 2016 @11:40AM (#11111059)
Does rust use getaddrinfo()?

grep -irn getaddrinfo .

./src/libstd/sys/common/net.rs:123: try!(cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), ptr::null(),

./src/libstd/sys/windows/c.rs:1235: pub fn getaddrinfo(node: const c_char, service: const c_char,

./src/libstd/sys/windows/net.rs:69:/// Provides the functionality of `cvt` for the return values of `getaddrinfo`

How many places doesn't rust source code use C structures or call C APIs?

In the rust source tree, run this:

grep -irn '[^a-zA-Z0-9]c::' . |wc

    615    3143   56000
grep -irn 'extern "C"' . |wc

    279    1719   23448
Re:Glibc getaddrinfo stack-based buffer overflow by chc4 on Tuesday February 16, 2016 @12:22PM (#11111454)
You are missing the forest for the trees. Grandparent is saying "replace all C with Rust" and you replied with "but look, Rust programs rely on glibc! It's unsafe!"

Yes, Rust programs can be affected by this. But only because they call into C at a lower level, for the libc layer. If glibc was in Rust it would provide security to all application, including ssh or curl which aren't in Rust.

Also, extern "C" is for C FFI exports not calling C APIs. The world unanimously decided C FFI is the least common denominator, so its not like Rust can provide a different API with better safety hints.

Re:Glibc getaddrinfo stack-based buffer overflow by ploxiln on Tuesday February 16, 2016 @01:11PM (#11111844)
Or perhaps he made a more subtle point: you can't replace all C with Rust. Even if you rewrite the libc (you'll need some assembly), even if you rewrite the kernel (you'll need a lot of assembly and "unsafe"), there will still be lots of closed-source C running on undocumented components of your computer as firmware. C is just representative of computers as they really are today, for a bunch of reasons (mostly pragmatism) unrelated to the fact that some people still like C.

Just as an ironic aside - C enthusiasts may even have switched to musl-libc already, and are not affected by bugs in glibc, while rust-loving people are vulnerable!

Also interesting, Go has for a long time supported using its own dns resolver instead of libc, but only recently in go 1.5 uses the go dns resolver by default on unix systems.

Re:Glibc getaddrinfo stack-based buffer overflow by viraptor on Tuesday February 16, 2016 @11:19PM (#11115270)
Are you arguing that since we can't replace everything with safe code, we shouldn't replace most of it? Security is not a binary state. Even taking firmware into account, if you compare the number of CVEs affecting "normal code" and firmware, the choice is trivial.
Re:Glibc getaddrinfo stack-based buffer overflow by ptaipale on Wednesday February 17, 2016 @10:35AM (#11118489)
> Are you arguing that since we can't replace everything with safe code, we shouldn't replace most of it?

Well, yes, the effort to replace even a small part of current code base with something perceived as "safe code" is huge. The re-factoring effort is so great that there is no doubt a significant number of new seurity problems wouldn't be created.

They would of course be different kind of problems. Not indexing errors, perhaps, but something we don't even know about. And justifiying this very large cost is not so easy.

Re:Glibc getaddrinfo stack-based buffer overflow by steveklabnik on Tuesday February 16, 2016 @01:42PM (#11112104)
We also provide builds of a MUSL-enabled rustc, if that's your thing.
Re:Glibc getaddrinfo stack-based buffer overflow by tkinom on Tuesday February 16, 2016 @01:44PM (#11112114)
Agree.

"C" to OS, Kernel, Computer Language, applications is like oxygen is to life on earth.

Yes, O2 causes fire from time to time, but you can't live without it.

Re:Glibc getaddrinfo stack-based buffer overflow by dh997 on Wednesday February 17, 2016 @12:14AM (#11115493)
The analogy is wrong because most all languages are Turing complete, and therefore equivalent despite paradigm and feature differences. The main reason seL4 was written in Haskell and again in C was to cross-verify behavior. C might be legacy ubiquitous, however it doesn't have to be the last word in shared library development by any means.

Any language which has a toolchain which produce flat binaries or use link scripts to specify sections can potentially be used for kernel and os dev. Bonus points for a toolchain which can compile itself.

There are kernels written entirely in Rust with some assembly glue. Others are writing production embedded domain-specific OSes in Haskell, OCaml, etc. for real, mission-critical systems right now and have been doing so for the last 5-10 years.

C inherently or inadvertently leads to giant codebases and subtle bugs when used too liberally, as opposed to higher-level, statically-compiled languages like Haskell and others.

The main issue with legacy code is how we choose to either keep investing effort in putting fingers into the levees or try something new in an incremental fashion.

PS: I would like to see Go get with it and support non-usermode, self-hosted and embedded development without including a giant, hard-to-port runtime in everything.

Re:Glibc getaddrinfo stack-based buffer overflow by cyphar on Wednesday February 17, 2016 @12:35AM (#11115577)
> The main reason seL4 was written in Haskell and again in C was to cross-verify behavior.

seL4 was modeled in Haskell, then written in C. Then they used tools to verify that the Haskell models matched the C code.

Re:Glibc getaddrinfo stack-based buffer overflow by cbd1984 on Friday February 19, 2016 @03:58PM (#11136571)
Do you know of a language called "C", as opposed to C?
Re:Glibc getaddrinfo stack-based buffer overflow by cbd1984 on Tuesday February 16, 2016 @11:41PM (#11115356)
I say we should write it in "Rust", as opposed to Rust.
Re:Glibc getaddrinfo stack-based buffer overflow by cbd1984 on Tuesday February 16, 2016 @08:26PM (#11114493)
> "C" to OS

There's the solution! Replace C with "C", a garbage-collected version of C! The quotes mean it's safe!

/s

Re:Glibc getaddrinfo stack-based buffer overflow by mkj on Tuesday February 16, 2016 @11:03PM (#11115192)
musl isn't without resolver bugs either. http://www.openwall.com/lists/oss-security/2015/03/30/3
Re:Glibc getaddrinfo stack-based buffer overflow by agumonkey on Wednesday February 17, 2016 @06:48AM (#11117172)
Good point, we shouldn't be dogmatic but pragmatic. But there's a fallacy conveyed by seeing C idioms as the only low level ones.
Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Tuesday February 16, 2016 @01:21PM (#11111929)
Do some low level Rust programming and then do some low level C programming. It's hardly any safer, because it can't be safe at such a low level without a performance penalty. In the capitalist reality we live in, that is a cost no one will pay.

You're talking about the forrest - while we're talking about how making trees from scratch is difficult and messed up no matter how you go about it.

At some point, you have to talk to the computer directly (aka "unsafely"). Things like bounds checking, garbage collection, and other runtime utilities sound like great ideas until they translate to significant monetary costs each month.

Not everything is as trivial as writing GUI glue code in a nice comfy language with a magical framework. Although, most of it is.

Re:Glibc getaddrinfo stack-based buffer overflow by pcwalton on Tuesday February 16, 2016 @02:19PM (#11112388)
> Do some low level Rust programming and then do some low level C programming. It's hardly any safer, because it can't be safe at such a low level without a performance penalty. In the capitalist reality we live in, that is a cost no one will pay.

I do a lot of low-level Rust programming and a lot of low-level C programming. I don't know what the performance penalty you're claiming exists comes from. Can you elaborate as to the specific Rust features that you claim are slow?

(Incidentally, the project I'm working on right now in Rust beats all of the existing C competitors in performance by a lot.) :)

Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Tuesday February 16, 2016 @02:37PM (#11112528)
A little defensive, maybe? I never claimed Rust was slower than C or that it had a performance penalty (because you should use unsafe). Actually, I pretty much said the opposite. I said they were the same.

I was trying to highlight the fact that unsafe Rust and C are not that different when you're doing bitwise operations on bare metal.

I was wanted to drive the point that additional abstractions are undesirable at that low level unless they can be enforced at compile time. I'm concerned by some of the magical thinking being espoused in this thread about what's actually reasonable in terms of the trade offs you can make.

In other words I was talking about safety, not speed.

I'm glad to hear Rust is out performing C though. I just wish I had a better IDE than atom... Didn't you once mention Xcode support for Rust?

Re:Glibc getaddrinfo stack-based buffer overflow by kbenson on Tuesday February 16, 2016 @03:26PM (#11112882)
It's not defensive to ask for evidence of a claim. If your statements are too general to be backed up without narrowing the scope or clarifying your intent, it's hardly the other person's fault for requesting clarification or evidence.
Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Tuesday February 16, 2016 @03:37PM (#11112952)
Just Asking Questions is a technique that's often used to derail or humiliate a verbal opponent. Forgive me for being cautious.

Also, my statement was not that general or vague. Maybe it could have been clearer, but it appears to have also been misinterpreted by pcwalton.

Re:Glibc getaddrinfo stack-based buffer overflow by nightpool on Tuesday February 16, 2016 @03:20PM (#11112851)
pcwalton is talking about safe rust. Unsafe rust is not really any faster in a lot of cases, and even when it is the goal is to compartmentalize the unsafe code into very small, distinct, easily testable segments.
Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Tuesday February 16, 2016 @03:35PM (#11112940)
Again, I'm not talking about performance. I'm talking about low level safety and the difficulties in achieving that in any meaningful way. I wasn't talking about just Rust when I said abstractions cost you speed. It was a (perhaps unclear) general statement about programming. As an aside, unsafe rust is faster than safe rust for a lot of cases.

I re-read what I wrote and I fail to see where I attacked or even (God forbid) criticized Rust.

So far IME, the rust community is extremely defensive and antagonistic to anyone they perceive to have made the slightest criticism. It's immature and irritating. It's the only thing that really turns me off from fully embracing it.

I can't participate in a community that's fundamentally hostile to skepticism.

Re:Glibc getaddrinfo stack-based buffer overflow by kbenson on Tuesday February 16, 2016 @04:14PM (#11113175)
> Again, I'm not talking about performance.

But previously you said "because it can't be safe at such a low level without a performance penalty" which clearly implies performance is part of your argument. This is what I was talking about in my other reply, which mentioned "without narrowing the scope or clarifying your intent".

> I re-read what I wrote and I fail to see where I attacked or even (God forbid) criticized Rust.

This is more about backing up claims with concrete examples. pcwalton is a Rust developer, I'm sure he would be very happy to hear a specific shortcoming he wasn't aware of, or was undervaluing. That's how improvements are made.

> So far IME, the rust community is extremely defensive and antagonistic to anyone they perceive to have made the slightest criticism. It's immature and irritating. It's the only thing that really turns me off from fully embracing it.

There may be some of that, but I also see a lot of rust community members trying to explain where people's assumptions are wrong, and it being taken as being antagonistic. The fact that Rust has some compile time checking that could actually make some of the low-level code faster is what I think is being alluded to by pcwalton. Of course there will be things that rust won't catch, and will need to be done in both C and rust, and there's things that other languages may catch that rust doesn't and vice-versa.

> I can't participate in a community that's fundamentally hostile to skepticism.

That's an interesting way to put it. You've made assertions, and when asked for clarification or evidence, began your response by calling the other commentor's motives into question (is it a reasoned response, or was it overly emotional because they were "defensive"). Asking for evidence of assertions is skepticism, and to balk in face of requests to do so is actually what I would consider being defensive.

To be absolutely clear, I don't think you would have been downvoted if you didn't start your reply with "A little defensive, maybe?". I didn't downvote you, but my initial assumption was that the downvoting I saw was because of that.

Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Wednesday February 17, 2016 @03:16AM (#11116191)
I re-read this and I see where I went wrong. I thought I had made a general statement about the cost of memory safety abstractions in programming languages that was misinterpreted as a specific statement about Rust and safety in general. This was because I was not clear in my phrasing.

I guess I felt I was being attacked for a point that I wasn't even trying to make. That is, I was responding to you under the impression that I had clearly said something differently than what was interpreted. All without taking the time to read over my own post carefully. Then I got overly emotional which resulted in us talking past each other unproductively and rude remarks on my part.

So I'm sorry for being a melodramatic jerk yesterday. I am actively working on my self control and civility, but I definitely made a mistake here. Hope you have a good day.

Re:Glibc getaddrinfo stack-based buffer overflow by kbenson on Wednesday February 17, 2016 @12:57PM (#11119751)
Thanks, and sorry if the way I worded any replies contributed to that in any way, it wasn't my intention. I hope you have a good day too. :)
[deleted]
Re:Glibc getaddrinfo stack-based buffer overflow by kbenson on Tuesday February 16, 2016 @05:08PM (#11113505)
> Notice how you're defending criticisms I never made.

I'm not defending anything, You didn't supply clarification of your point. You were asked for clarification, and provided someone else's experience (anecdotal) counteracting claims (which weren't even anecdotal, they were unsupported assertions), and you started out as classifying that response as defensive.

> notice how you assume I don't know the difference between static analysis and compile-time safety.

I said "I also see a lot of rust community members trying to explain where people's assumptions are wrong" immediately prior to that. I thought it was obvious I was talking in the general sense. I don't know what you do and don't know, but I'm not sure why you think it's valid to be upset because someone assumes this one way or the other (which to be clear, didn't happen here) when you've shown little or no evidence yet as to what you do or don't know about it. It may be the rust community stereotyping others, but without stats as to whether the people the stereotype has been applied to have it applied correctly it's hard to know whether it's useful or harmful, regardless of how it applies to you in particular.

> Notice how you assume that I must be generally uninformed or less intelligent because complete faith in Rust's importance is a self-evident truth.

Not knowing something doesn't make someone less intelligent. If you are conversing under the assumption that everyone will assume you know at least the same amount as them about every topic that is brought up, else you have right to be offended, I'm not sure how we can continue. That's not an environment I want to have a discussion in.

> Well, now that's it's happening to me personally vs just reading it. Fuck this community. It's collectively a socially inept nightmare. I'm done with caring about Rust. I was really enjoying it. After today and Reddit, I can't take anymore of this smug bullshit.

All that's happened here is you made statements and refused to back them up while at the same time you called someone else's motives into question for asking for clarification. I think it's obvious what is going on, but I'm not in your shoes. I don't think people aren't trying to be assholes you you (at least I'm not, or not trying to be one), and while you may be upset, I hope you don't leave for good. however you've interpreted my comments, please be aware that not a single one was written with the intent to upset you, or call into question your character or intelligence in any way. I can only point towards my own experience, here and elsewhere, where my state of mind greatly influenced how I read a statement and any replies to me with regard to that conversation, and think that possibly the same thing is happening here with you. That itself may come across as a smug asshole-ish thing to say depending on how you interpret it, or even my assumption that my observations apply to you. All I can do is state that my desire to be helpful after your prior statement is sincere.

[deleted]
Re:Glibc getaddrinfo stack-based buffer overflow by kbenson on Tuesday February 16, 2016 @04:27PM (#11113249)
Well, I'm by no means part of the rust community, so don't let anything I say reflect upon them.

That said, how else do you correct someone in the case their statements are provably false?

Edit: Whoops, "probably" was supposed to be "provably" :/

Re:Glibc getaddrinfo stack-based buffer overflow by steveklabnik on Tuesday February 16, 2016 @01:53PM (#11112198)

  >  it can't be safe at that low level without a performance penalty.
Many of Rust's safety guarantees come from compile-time checks that then do not have any runtime penalty.

Yes, sometimes you still need unsafe, but even then, it's a superset, not a subset: a lot of safety checks still happen inside an unsafe block.

That said, I do think that building a libc in Rust would take a significant investment and I'm not sure who's going to even attempt it, if anyone.

Re:Glibc getaddrinfo stack-based buffer overflow by acconsta on Tuesday February 16, 2016 @02:42PM (#11112568)
>Many of Rust's safety guarantees come from compile-time checks that then do not have any runtime penalty.

But not bounds checks, which are unfortunately what you need with respect to buffer overflows.

Re:Glibc getaddrinfo stack-based buffer overflow by steveklabnik on Tuesday February 16, 2016 @02:53PM (#11112654)
Yes, absolutely.
Re:Glibc getaddrinfo stack-based buffer overflow by erickt on Tuesday February 16, 2016 @08:53PM (#11114611)
But only if you use the `slice.unchecked_get`[1] method, otherwise you still get bounds checking in an unsafe block.

[1]: http://doc.rust-lang.org/std/primitive.slice.html#method.get...

Re:Glibc getaddrinfo stack-based buffer overflow by nothrabannosir on Tuesday February 16, 2016 @03:17PM (#11112831)
> ...it can't be safe at such a low level without a performance penalty. In the capitalist reality we live in, that is a cost no one will pay.

A bit higher up:

It was clear when Hoare stated on his speech in 1980:

"Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to - they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980, language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law."

- https://news.ycombinator.com/item?id=11110456

... which directly contradicts the "no one" part.

Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Tuesday February 16, 2016 @03:25PM (#11112877)
A sample size of one makes for a worse rule of thumb then a trend based on hard reality.

Speed is all that matters, I actually learned that from Graydon's blog:

http://graydon2.dreamwidth.org/233585.html#cutid1

Rust sacrificed the majority of its runtime and adopted C's memory model late in development so people wouldn't have to pay a performance cost or depend on confusing heap allocation semantics. That's why it has a really good chance at disrupting the embedded space.

Re:Glibc getaddrinfo stack-based buffer overflow by twic on Tuesday February 16, 2016 @03:45PM (#11113004)
The enterprise software world didn't leap off C++ and onto Java because it was faster. They did it because it didn't segfault all the time. They then leapt to Perl and Python and Ruby because they didn't segfault all the time and seemed a lot faster to develop in.

To the vast majority of people and organisations writing software, performance of the software, to within an order of magnitude, just isn't a big deal.

Re:Glibc getaddrinfo stack-based buffer overflow by autoreleasepool on Tuesday February 16, 2016 @03:51PM (#11113034)
We aren't talking about enterprise software. It hasn't been mentioned once. You can't change the subject and then say I'm wrong. Obviously, higher level applications can and often should be implemented using garbage collected languages.
Re:Glibc getaddrinfo stack-based buffer overflow by andrewjl on Tuesday February 16, 2016 @01:43PM (#11112106)
I'd really like to see a good write up on a project that's trying to tackle this problem on the levels below C. (Assembly or even hardware level.)
Re:Glibc getaddrinfo stack-based buffer overflow by cbd1984 on Tuesday February 16, 2016 @08:27PM (#11114501)
The x86 ISA already has bounds-checking opcodes which can be used to ensure array accesses don't go off the deep end.
Re:Glibc getaddrinfo stack-based buffer overflow by avian on Tuesday February 16, 2016 @10:35AM (#11110488)
> It is time for the bimonthly Internet security meltdown.

Time for the bimonthly Hacker News hour of C and C++ hate.

Re:Glibc getaddrinfo stack-based buffer overflow by TazeTSchnitzel on Tuesday February 16, 2016 @04:22PM (#11113215)
Which is quite justified, as with more modern programming languages, these sorts of bugs are much less likely to happen.
Re:Glibc getaddrinfo stack-based buffer overflow by Mikushi on Wednesday February 17, 2016 @04:13AM (#11116441)
Are they? We have no way to know as no modern language has the reach and widespread usage of something like C.

As much as I'd like to think Rust is a nice option for the future, everything leads me to believe that if it ever gets as widespread as C you will have the same caveats, because the main issue is not the language but the programmers using it.

No amount of hand holding and safety will prevent bad practices from being used when they prove efficient in one way or another (laziness is a real killer).

Re:Glibc getaddrinfo stack-based buffer overflow by TazeTSchnitzel on Thursday February 18, 2016 @04:22AM (#11124603)
> Are they?

Yes, they are.

> We have no way to know as no modern language has the reach and widespread usage of something like C.

None needs to have that widespread usage for us to see this. Many bugs in C code causing big security issues are impossible to make in more modern programming languages. Sure, you can make other security issues, of course you can. But the net result is less security issues.

> the main issue is not the language but the programmers using it.

All bugs are caused by programmers making mistakes, but that doesn't mean the language isn't an issue. A language which requires more effort to write correct and secure programs is an inferior language. A language with a long list of situations where the compiler will silently invoke unpredictable behaviour, a list any programmer will sometimes fail to fully account for, is an inferior language.

[deleted]
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @11:31AM (#11110966)
Yes, UNIX was adopted by the corporations and brought C with it.

Some people don't get it that before it happened we were happily using other systems programming languages way safer than C.

Re:Glibc getaddrinfo stack-based buffer overflow by voidlogic on Tuesday February 16, 2016 @01:29PM (#11112009)
>Some people don't get it that before it happened we were happily using other systems programming languages way safer than C.

Maybe some people, but most systems programming was done is Assembly before C.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @01:49PM (#11112155)
If targeting home computers, the so called mini-computers and home micros, yes. C was just yet another "managed language".

If targeting real computers, what is nowadays left as mainframes, then no.

Extended Algol was already being used by Burroughs in 1961 for writing Assembly free OSes.

There are lots of other examples, which C advocates tend to ignore, so that they can sell the story that before C there was only Assembly to those that don't bother with history of computing.

Re:Glibc getaddrinfo stack-based buffer overflow by TeMPOraL on Tuesday February 16, 2016 @01:37PM (#11112067)
No, you're not getting it :). There was a whole world besides Assembly and C, now mostly lost to us. E.g. Lisp machines, which even had hardware support for Lisp-specific things like tagged pointers.
Re:Glibc getaddrinfo stack-based buffer overflow by bsder on Tuesday February 16, 2016 @08:21PM (#11114471)
Whose performance was so bad that porting the Lisp Machine software to a general purpose Alpha added multiple factors of performance increase.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Wednesday February 17, 2016 @02:14AM (#11115939)
C compiler performance in the 80's for home micros was so bad, that functions were basically naked entry points to full inline Assembly.

And here we are now discussing how good modern C compilers are.

If there isn't the willingness to spend the money to optimize performance, of course it won't improve.

Re:Glibc getaddrinfo stack-based buffer overflow by bsder on Wednesday February 17, 2016 @02:45AM (#11116067)
The initial port of Genera to an Alpha matched the performance of Symbolics fastest workstations:

http://pt.withy.org/publications/VLM.html "Version 1.0 of the emulator exceeded our initial performance goals, achieving nearly the performance of our high-end custom workstation."

An initial port to a foreign architecture (in-order execution, 64-bit memory space which is going to overload caches, inefficient 8-bit transactions) matched 15+ years of hardware development on the native architecture.

That wasn't lack of money or development. That was a stunning rebuke that Lisp Machines had an inferior architecture.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Wednesday February 17, 2016 @04:39AM (#11116582)
> That wasn't lack of money or development. That was a stunning rebuke that Lisp Machines had an inferior architecture.

No, it wasn't nothing more than lack of willingness and money to do it, instead they complained about the state of art and went home.

Re:Glibc getaddrinfo stack-based buffer overflow by bsder on Wednesday February 17, 2016 @03:23AM (#11116216)
> C compiler performance in the 80's for home micros was so bad, that functions were basically naked entry points to full inline Assembly.

For good reason: memory and disk were ferociously expensive until about 1996-1997.

Things like unchecked bounds make sense when you can barely get your computer to do what you want. Designing a VLSI chip through about most of the 1990's was HARD. Everything was an exercise in how to fit things on disk, fir things in RAM, run enough polygons, or run enough instructions on the emulator to actually boot.

Now: we can emulate a 6502 in Javascript while animating it. We can emulate entire PowerPC chips at real-time speed. So, yeah, NOW allocating a couple of cycles to bounds checking and garbage collection makes perfect sense.

We should have started the conversion away from C in 2000. The problem is that 1) sunk cost keeps design decisions made in vastly different environments around for far longer than is reasonable and 2) we didn't really have good replacement options for C until starting about 2005.

And then the cellular phone revolution hit and put us back to programming like its 1995. Finally, now that cell phones even have an overabundance of CPU, storage, and memory--we now can start to care about security.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Wednesday February 17, 2016 @04:40AM (#11116585)
> For good reason: memory and disk were ferociously expensive until about 1996-1997.

Yet Burroughs was able to use Extended Algol in 1961 in an architecture much more constrained than a PDP-11.

> we didn't really have good replacement options for C until starting about 2005.

Ada, Turbo Pascal, Extended Pascal, Modula-2, Modula-2+, Modula-3, Delphi, Oberon, Oberon-2, Component Pascal, Active Oberon, Cedar, Mesa, Algol 68, Extended Algol, CPL,...

Re:Glibc getaddrinfo stack-based buffer overflow by TeMPOraL on Tuesday February 16, 2016 @01:34PM (#11112047)
In general, adoption of UNIX has managed to convince a lot of smart people to believe something as absurdly sounding as "worse is better".

(I'm only half-sarcastic here.)

Re:Glibc getaddrinfo stack-based buffer overflow by cmrx64 on Tuesday February 16, 2016 @11:37AM (#11111026)
(For the record, grandparent originally ended with "Some people just don't get it")
Re:Glibc getaddrinfo stack-based buffer overflow by tosseraccount on Tuesday February 16, 2016 @03:17PM (#11112830)
What do you think?
Re:Glibc getaddrinfo stack-based buffer overflow by blt on Tuesday February 16, 2016 @09:15PM (#11114713)
Anyone who reads HN for long enough knows, thanks to your comments ;)
Re:Glibc getaddrinfo stack-based buffer overflow by ploxiln on Tuesday February 16, 2016 @12:20PM (#11111438)
You already have the freedom to run your webservers as mirageos unikernels (with a networking stack written in ocaml). You already have the freedom to write and run everything you want in such an environment.

But what you really want, is to force other people to write code for you, but in a language you prefer (and for it to be easy and convenient for you). Good luck with that.

Re:Glibc getaddrinfo stack-based buffer overflow by sangnoir on Tuesday February 16, 2016 @04:56PM (#11113423)
> it's pretty clear at this point that we need to expunge all C language networking code from the world

Will you bell the cat? I'd pay a lot of money to see Linus' reaction to your massive network-stack replacement kernel patch written in Rust.

More seriously though, who is prepared to fund this? Is the risk worth that much effort? Because I see a lot of people being vocal about it on HN, but no real attempt is made to come up with a safe Rust-based alternatives

Re:Glibc getaddrinfo stack-based buffer overflow by masterleep on Tuesday February 16, 2016 @10:40AM (#11110533)
An intermediate step is to run everything under AddressSanitizer, since it's fast enough for many cases. See, for example:

https://blog.hboeck.de/archives/879-Safer-use-of-C-code-runn...

Re:Glibc getaddrinfo stack-based buffer overflow by hannob on Tuesday February 16, 2016 @11:56AM (#11111218)
It likely won't help. I excluded glibc from using ASAN to let this work.

It is theoretically possible to use ASAN on glibc as well, but it's complicated and certainly not ready for any kind of production use.

Also although this is my work, it's far from clear to me whether using ASAN in production really is a useful thing. Practically I'd rather suggest looking at the safestack and CFI features of clang for production use instead.

Re:Glibc getaddrinfo stack-based buffer overflow by yugr on Saturday February 27, 2016 @02:50PM (#11188175)
BTW at least Clang's ASan is capable of detecting CVE-2015-7547 (in https://groups.google.com/forum/#!topic/address-sanitizer/tt...).
Re:Glibc getaddrinfo stack-based buffer overflow by dalore on Tuesday February 16, 2016 @10:22AM (#11110377)
But this is hard for them to 'scan' for. As they need to get vulnerable systems to query their dns server.

But it's not hard to get a system to do a dns query. Sometimes even connecting to it will cause your ip to appear in the logs which are then sometimes reversed ip. But one could easily just create a webpage with img.src pointing to the host.

DNS being distributed could halt the attack upstream by patching their servers to stop the queries so any vulnerable clients won't get compromised even if they make the query.

Re:Glibc getaddrinfo stack-based buffer overflow by Xylakant on Tuesday February 16, 2016 @11:23AM (#11110895)
> DNS being distributed could halt the attack upstream by patching their servers to stop the queries so any vulnerable clients won't get compromised even if they make the query.

Anybody connecting to a public network that pushes network settings may still be affected. For wifis with a capture portal (hotel wifi etc) you usually have to use the network-provided dns server.

Re:Glibc getaddrinfo stack-based buffer overflow by caf on Tuesday February 16, 2016 @08:22PM (#11114475)
I don't think a reverse query will tickle this bug, because this bug requires simultaneous A and AAAA lookups to be triggered whereas a reverse query uses a single PTR lookup.
Re:Glibc getaddrinfo stack-based buffer overflow by yyin on Tuesday February 16, 2016 @12:41PM (#11111617)
Is djbdns vulnerable? It does not use these routines.

I've never needed ENDS0, but maybe the need will arise someday. Meanwhile...

Short term, I'd prefer to expunge all "C networking code" originating from BIND authors, e.g., libresolv.

Re:Glibc getaddrinfo stack-based buffer overflow by cft on Tuesday February 16, 2016 @03:41PM (#11112979)
Relatedly, if I point dnscache in djbdns to Google's DNS server as a temp fix (8.8.8.8) in /etc/resolv.conf , will that mitigate the threat?
Re:Glibc getaddrinfo stack-based buffer overflow by JdeBP on Wednesday February 17, 2016 @07:44PM (#11122818)
The fact that djbdns doesn't use BIND code is not really relevant. The problem at hand is in the BIND DNS client library that is compiled and linked into applications. It's triggered by sending responses larger than 2048 bytes to those applications. The only way that djbdns factors into it is whether an attacker, running a content DNS server out on Internet, can manage to get such a DNS response through a DNS proxy server such as dnscache, to that BIND DNS client library code running in the application.

Now one might think that the discussion at https://news.ycombinator.com/item?id=11110646 already covers this. All that the content DNS server has to do is set the TC flag in the DNS/UDP response, and it can quite happily get the proxy DNS server to re-try via DNS/TCP. The interesting point is that in fact that discussion does not cover this.

This is because the idea that one can exploit this with a malicious content DNS server has as its unstated premise that DNS/UDP and DNS/TCP responses are passed straight through caching DNS proxies. This is the case for some DNS proxy softwares, where if the data have just come in from the back end and form a complete answer, they are passed through as the front-end answer. It isn't the case for dnscache. dnscache always answers from cache, even if the data have just arrived from a back-end transaction.

So those "crafted DNS responses" beginning with 2048 bytes of valid protocol, that the malicious content DNS server has to generate, have to survive being unpacked, stuffed into dnscache's cache, extracted back out of dnscache's cache, and turned into an answer response by dnscache's from-scratch answer construction code. And this without being able to use the authority or additional sections, without being able to use more than one (non-CNAME) RRset in the answer section, and without any guarantee of any given RRset ordering. This is ... somewhat difficult.

The devil in the details of this problem lies in one sentence of the analysis that accompanies the patch:

> Overflowing bytes are entirely under the control of the attacker and are the result of a crafted DNS response.

If you've done as the people at https://news.ycombinator.com/item?id=11112527 and https://www.reddit.com/r/netsec/comments/462xx0/glibc_getadd... did, you might have convinced yourself how simple it is to exploit this. Just set up a malicious content DNS server that does what this does, and Bob's Your Uncle. But in fact those demonstrations are not how DNS lookups work. People do not point the BIND DNS client library at (malicious) content DNS servers. The DNS client library is pointed at the front end of a proxy DNS server, which performs back-end lookups to the (malicious) content DNS servers.

* http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/dn...

So one has to take into account what the proxy DNS server does in between its back end and its front end. The response returned to the BIND DNS client library from the front end is not "entirely under the control of the attacker". As in the case of dnscache, where front end responses are constructed from cache and from scratch, it's actually quite difficult for the attacker to control it at all, let alone cause dnscache to send a valid-flawed-valid response sequence. It's not just dnscache where this is a difficulty for an attacker, either.

Which is why the analysis talks of man-in-the-middle attacks. To exploit this with far greater chance of success, one gets in between the BIND DNS client library and the proxy DNS server, or just plain supplants/subverts the proxy DNS server. Which is yet another reason why it's a good idea to run a proxy DNS server locally, on each machine or at least on the LAN, and make sure that "local" traffic is blocked at relevant machine/LAN borders. An attacker who can field DNS traffic to [::1]:53 or 127.0.0.1:53 in order to be that man in the middle has already had to overcome some quite tricky obstacles. (-:

* http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/dn...

It's worth noting that we've been here before. A lot.

* https://cr.yp.to/djbdns/res-disaster.html

* http://www.kb.cert.org/vuls/id/542971

* http://www.kb.cert.org/vuls/id/803539

* http://www.kb.cert.org/vuls/id/844360

... And so on.

Re:Glibc getaddrinfo stack-based buffer overflow by yyin on Saturday February 20, 2016 @12:37AM (#11139052)
"The fact that djbdns doesn't use BIND code is not really relevant."

It is to me.

It's true that in this case it's not what mitigates this vulnerability. Although it has certainly mitigated many others over the years and, sadly, probably will do so a few more times in the future. There's just no getting rid of the BIND legacy.

Correct me if I am wrong, but using a local dnscache and the fact that dnscache does not implement ENDS0 should be enough to mitigate this one.

I have been running a local tinydns root.zone and dnscache for many years. Really like the software.

Re:Glibc getaddrinfo stack-based buffer overflow by cft on Tuesday February 16, 2016 @12:02PM (#11111260)
>Patch ASAP

What exactly do you patch? Say you have a TCP server, written in Python or in Go. Do you have to update Python and Go ASAP then and recompile the Go server? Custom compiled Apache, Nginx? Recompile those? That's a lot of work..

Re:Glibc getaddrinfo stack-based buffer overflow by asveikau on Tuesday February 16, 2016 @12:17PM (#11111406)
Unless you are linking statically (and I don't really understand why you would) you update glibc and that's it.

This question had me feeling kind of old. Does nobody learn what shared libraries are anymore?

Re:Glibc getaddrinfo stack-based buffer overflow by rspeer on Tuesday February 16, 2016 @03:19PM (#11112843)
Well, now, a lot of people are making containers, which are static linking turned up to 11.

I bet this bug will live on forever in people's Docker stacks.

Re:Glibc getaddrinfo stack-based buffer overflow by peterwwillis on Tuesday February 16, 2016 @06:30PM (#11113951)
The past four years of modern development practices have run screaming from the concept. Learning why the systems used to work they way they did was, like, super hard, so they reinvented the wheel and are running into the same problems that caused us to make shared libraries/COW/etc in the first place.
Re:Glibc getaddrinfo stack-based buffer overflow by XorNot on Wednesday February 17, 2016 @03:20AM (#11116205)
You've pretty fundamentally misunderstood them if you think immutable practices in anyway damage the ability to deploy fixes. Years of shared library hell is what causes things like this to go unfixed.
Re:Glibc getaddrinfo stack-based buffer overflow by peterwwillis on Wednesday February 17, 2016 @06:25PM (#11122406)
Immutability in software development & deployment is, for the vast majority of use cases, completely unnecessary. The only reason people talk about it now is everyone has a fetish over using simple software rather than designing software that works well.

And 'immutable practices' don't damage anything - they simply make things take longer, duplicate effort, make inefficient use of resources, and make everything generally more inflexible. The only benefit seems to be high level abstraction at the cost of everything else.

Re:Glibc getaddrinfo stack-based buffer overflow by strictfp on Tuesday February 16, 2016 @03:40PM (#11112968)
Nope, the pendulum is at it's other extreme. Go is going all in on static builds, docker containers freeze ALL THE THINGS \@/ and "immutable" package managers like Nix which in effect is like static linking without the speed benefits.
Re:Glibc getaddrinfo stack-based buffer overflow by mentat on Tuesday February 16, 2016 @01:10PM (#11111843)
That isn't it, see siblings here. You have to restart all processes that load glibc and interact with the affected services.
Re:Glibc getaddrinfo stack-based buffer overflow by w8rbt on Tuesday February 16, 2016 @02:52PM (#11112650)
Debian does this automatically and alerts the user what services are being restarted.
Re:Glibc getaddrinfo stack-based buffer overflow by drummer32 on Tuesday February 16, 2016 @06:38PM (#11113994)
It doesnt't. There's the needsrestart package that does this though.
Re:Glibc getaddrinfo stack-based buffer overflow by muppetman on Tuesday February 16, 2016 @06:13PM (#11113882)
I updated this morning and nothing got restarted. Shouldn't pretty much every network service I have gotten a restart? sshd, postfix, apache, icecast2, dovecot

None of them restarted. So I restarted them all myself...

Re:Glibc getaddrinfo stack-based buffer overflow by yxhuvud on Tuesday February 16, 2016 @03:36PM (#11112950)
Does libc even support static linking?
Re:Glibc getaddrinfo stack-based buffer overflow by steveklabnik on Tuesday February 16, 2016 @03:40PM (#11112970)
glibc is generally not statically linked. MUSL libc generaly is.

You _can_ statically link glibc, but then you lose some stuff. https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked...

Re:Glibc getaddrinfo stack-based buffer overflow by cdelsolar on Tuesday February 16, 2016 @01:32PM (#11112034)
Go?
Re:Glibc getaddrinfo stack-based buffer overflow by kyrra on Tuesday February 16, 2016 @01:06PM (#11111822)
For Go, depending on your compile settings, you don't need to recompile. Go 1.5+ uses a pure Go DNS resolver [1], you have to force Go to use glibc. And even if you use glibc, it is not statically linked.

[0] https://golang.org/pkg/net/ (see "netdns" setting)

[1] https://go-review.googlesource.com/#/c/11584/

Re:Glibc getaddrinfo stack-based buffer overflow by nitrogen on Tuesday February 16, 2016 @12:17PM (#11111405)
If you have dynamically linked libc (which you should), you only need to upgrade libc and restart all network processes. [Does anyone know if systemd in pid1 calls getaddrinfo? If so, this is another good reason for a minimal pid1, as you will need to reboot]
Re:Glibc getaddrinfo stack-based buffer overflow by the_why_of_y on Tuesday February 16, 2016 @02:27PM (#11112456)
No reboot needed:

man systemctl

       daemon-reexec
           Reexecute the systemd manager. This will serialize the manager
           state, reexecute the process and deserialize the state again. This
           command is of little use except for debugging and package upgrades.
           Sometimes, it might be helpful as a heavy-weight daemon-reload.
           While the daemon is being reexecuted, all sockets systemd listening
           on behalf of user configuration will stay accessible.
Re:Glibc getaddrinfo stack-based buffer overflow by Xylakant on Tuesday February 16, 2016 @12:25PM (#11111482)
you need to restart all processes that might do a network address lookup. That's pretty much every daemon.
Re:Glibc getaddrinfo stack-based buffer overflow by noselasd on Tuesday February 16, 2016 @02:12PM (#11112342)
You don't need to reboot to restart systemd, you can run systemctl daemon-reexec
Re:Glibc getaddrinfo stack-based buffer overflow by peterwwillis on Tuesday February 16, 2016 @06:38PM (#11113991)
Here's how to find packages on your system with statically linked applications (that probably use glibc):

  [root@server ~]# find /bin/ /sbin/ /usr/bin/ /usr/sbin/ /usr/lib* /usr/local/bin/ /usr/local/sbin/ /usr/local/lib* -type f -perm /u+x -exec file {} \; | grep statically | cut -d : -f 1 | xargs rpm -qf | sort -u
  busybox-1.2.0-7.el5.x86_64
  cryptsetup-luks-1.0.3-5.el5.i386
  cryptsetup-luks-1.0.3-5.el5.x86_64
  device-mapper-1.02.39-1.el5.i386
  device-mapper-1.02.39-1.el5.x86_64
  device-mapper-multipath-0.4.7-34.el5_5.1.x86_64
  dmraid-1.0.0.rc13-63.el5.x86_64
  dump-0.4b41-4.el5.x86_64
  e2fsprogs-1.39-23.el5.x86_64
  glibc-2.5-123.el5_11.1.i686
  glibc-2.5-123.el5_11.1.x86_64
  glibc-common-2.5-123.el5_11.1.x86_64
  grub-0.97-13.5.x86_64
... etc. And yes, it can be a lot of work. It's easier to only use your distro's official packages and update the patched ones they release. Luckily most software devs are smart and compile dynamically.
Re:Glibc getaddrinfo stack-based buffer overflow by msbarnett on Tuesday February 16, 2016 @12:18PM (#11111420)
You patch glibc. Everything else is dynamically linking it.
Re:Glibc getaddrinfo stack-based buffer overflow by muraiki on Tuesday February 16, 2016 @12:26PM (#11111492)
I think it's possible to statically link glibc in Go, but I don't recall the particular compiler incantations offhand.
Re:Glibc getaddrinfo stack-based buffer overflow by saturn_vk on Wednesday February 17, 2016 @02:05AM (#11115903)
But go dynamically links against libc by default
Re:Glibc getaddrinfo stack-based buffer overflow by r1ch on Tuesday February 16, 2016 @12:17PM (#11111404)
Unless you statically link glibc, updating glibc is enough.
Re:Glibc getaddrinfo stack-based buffer overflow by latenightcoding on Tuesday February 16, 2016 @04:56PM (#11113428)
How did I know this would turn into a C vs Rust debate
Re:Glibc getaddrinfo stack-based buffer overflow by JdeBP on Wednesday February 17, 2016 @09:06AM (#11117891)
There are a few interesting points in this discussion that all of the C/Rust/C++/ObjectiveC/Go/Java discussion has swamped. For those who would like to find the discussion that is not argument about computer programming languages:

* Is Google Public DNS a potential mitigator? Sub-thread at https://news.ycombinator.com/item?id=11113113 .

* Is Google Public DNS a potential exploit vector? Sub-thread at https://news.ycombinator.com/item?id=11111300 .

* Are there any BIND settings that are potential mitigators? Sub-thread at https://news.ycombinator.com/item?id=11110646 .

* What happens if one's DNS proxy server doesn't itself support sending >2048 byte answer messages to the BIND DNS client library in the first place? Sub-thread at https://news.ycombinator.com/item?id=11111617 .

* How exploitable is this? What about Windows? Sub-thread at https://news.ycombinator.com/item?id=11110443 .

* What about MacOS 10? Sub-thread https://news.ycombinator.com/item?id=11113471, and a mention of BSD libc at https://news.ycombinator.com/item?id=11111702 .

Re:Glibc getaddrinfo stack-based buffer overflow by weinzierl on Tuesday February 16, 2016 @12:09PM (#11111324)

    > The vectors to trigger this buffer overflow are very common and can include ssh, sudo, and curl.
Why are browsers missing in the list? Don't they use getaddrinfo() as well?
Re:Glibc getaddrinfo stack-based buffer overflow by msbarnett on Tuesday February 16, 2016 @12:15PM (#11111384)
Literally the next sentence:

> We are confident that the exploitation vectors are diverse and widespread; we have not attempted to enumerate these vectors further.

Re:Glibc getaddrinfo stack-based buffer overflow by weinzierl on Tuesday February 16, 2016 @04:00PM (#11113095)
I read that, I just found the examples strange. Browsers are incredibly important for an incredible number of people while curl is not.
Re:Glibc getaddrinfo stack-based buffer overflow by vdfs on Tuesday February 16, 2016 @02:37PM (#11112527)
I tried the exploit server, Firefox crashed right after changing the DNS name server.
Re:Glibc getaddrinfo stack-based buffer overflow by muraiki on Tuesday February 16, 2016 @03:30PM (#11112910)
That is not awesome :(
Re:Glibc getaddrinfo stack-based buffer overflow by jimrandomh on Tuesday February 16, 2016 @12:33PM (#11111543)
I'm not sure, but I suspect that major browsers may have their own DNS client implementations, or be calling getaddrinfo from within sandboxed contexts.
Re:Glibc getaddrinfo stack-based buffer overflow by collinmanderson on Tuesday February 16, 2016 @01:57PM (#11112229)
Chrome uses a custom DNS client implementation.

https://plus.google.com/+WilliamChanPanda/posts/FKot8mghkok

"The problem is that Chromium is issuing too many DNS queries in a short period of time, which may overload upstream devices (typically cheap NAT routers) ... which will then ignore DNS queries for a period of time."