TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Golang SSH Security

426 pointsby transitorykrisabout 8 years ago

19 comments

eroppleabout 8 years ago
I am...not a fan of Golang, as I have made pretty clear around here on occasion. But I&#x27;ll give credit where credit&#x27;s due, and this is a good decision on the part of the people maintaining x&#x2F;crypto&#x2F;ssh. Not the tooling vendor&#x27;s awful response--I&#x27;m pretty sure I know who it is, and if not there&#x27;s two of &#x27;em because I&#x27;ve had these conversations before--but the maintainers are doing the right thing. This probably shouldn&#x27;t have gotten out the door without host key verification in the <i>first</i> place (and that ties back into the reasons why I do not like or trust Golang or its community when it comes to tools that I have to consume), but it&#x27;s better to bite the bullet and fix this <i>now</i> instead of letting it fester.<p>(The &quot;PGP is too hard for discussing security issues&quot; thing, though, is total nonsense. Can&#x27;t be doing that.)
评论 #14122481 未加载
avarabout 8 years ago
Oh man:<p><pre><code> &gt; I am bemused by an approach to accepting &gt; security reports which is to go through the &gt; motions of having PGP public keys available &gt; for people to use to report issues but upon &gt; receiving such a request ask for it to be &gt; submitted without PGP because digging out &gt; the keys is too much of a hassle.</code></pre>
评论 #14123388 未加载
评论 #14122745 未加载
评论 #14123127 未加载
3pt14159about 8 years ago
I love Digital Ocean, but they do the same thing with their API. I wrote to them about it years ago, even talked to some developers there, and the general explanation is the same: Screw around with cloud-init to get the public key.<p>If you use the DO API to provision servers my feature request is here:<p><a href="https:&#x2F;&#x2F;digitalocean.uservoice.com&#x2F;forums&#x2F;136585-digitalocean&#x2F;suggestions&#x2F;9307569-return-the-droplet-s-ssh-public-key-as-part-of-api" rel="nofollow">https:&#x2F;&#x2F;digitalocean.uservoice.com&#x2F;forums&#x2F;136585-digitalocea...</a><p>Please upvote it or at the very least copy the cloud-init script to help provision your servers.
评论 #14124858 未加载
mbertschlerabout 8 years ago
While I really love the stable nature of Go and its standard library, I am happy that this breaking change was put out there in the interest of security.<p>This issue hit me while building a tool for internal use at my employer. I am using the glide vendoring manager for this project, added another dependency which triggered an update of all other dependencies. At that point my tool broke and forced me to actually think about host key verification.
评论 #14122485 未加载
adtacabout 8 years ago
I&#x27;m really impressed with the quick response from the golang team. The fact that they didn&#x27;t mind introducing breaking changes shows that their priorities are right.
YZFabout 8 years ago
It&#x27;s amazing how many people out there consider MITM as something they don&#x27;t have to defend against. If you&#x27;re a developer you have to assume your system will be MITMed. It doesn&#x27;t matter if you&#x27;re on the Internet or behind a firewall. Trust on first use is not a good solution because someone can tailor their attack against that first use.
评论 #14123215 未加载
评论 #14122765 未加载
评论 #14129046 未加载
niftichabout 8 years ago
Golang seems to follow the 80&#x2F;20 rule from the outset (or perhaps an even smaller proportion), which is perfectly fine. Some other languages&#x27; standardlibs try to offer a complete treatment of a particular problemspace from the start which is tricky to get right on first attempt. Those are the instances where developers complain about complex APIs, uneven abstractions, or the like.<p>However, one of the artifacts of a popular language having a lean-and-mean standard library is that custom code proliferates, and the Go community&#x27;s distaste for frameworks (as opposed to libraries) means that the it&#x27;s not just the business-specific edges of the code that&#x27;s unique in each implementation (as you&#x27;d expect), but also a good amount of the plumbing and domain-specific control code and their immediate callers. In some other languages, where there&#x27;s more of a culture for using a dependency to intentionally simplify your problem space in exchange for ceding control, this style would be derided as NIH.<p>The vendor&#x27;s response here is a function of not only the vendor&#x27;s own rationale and priorities, but also of the above developer philosophy. This is surprising to me, given that Go is an opinionated language, and yet opinionated third-party code driving your logic is frequently discouraged by its community.<p>On the other hand, the language maintainers&#x27; response was measured, proper, and commendable. They made a breaking change to an experimental API, and improved their product in the process.
评论 #14122539 未加载
评论 #14123155 未加载
mitchellhabout 8 years ago
Hello! As the blog post clearly states, the vendor is HashiCorp. As the founder of HashiCorp and someone who participated in the initial report we received on this topic, I&#x27;d like to state our point of view from my own mouth.<p>I&#x27;d first like to be up front about exactly which of our software doesn&#x27;t perform host key verification, since we have a lot of software and this CVE doesn&#x27;t apply to most. There are three places that were identified as affected: Packer and Terraform with SSH provisioners, which both create a machine resource and can perform SSH connections to setup the machine; and Vault’s SSH backend in Dynamic Key mode performs SSH connections from the Vault server to hosts (other modes do not).<p>Any other usage of our software is unaffected.<p>We’ll discuss each of these cases in detail, since the details matter to understand our thought process and response.<p>Vault:<p>The SSH secret backend has three modes that can be used for generating SSH credentials: certificates, one-time passwords, and dynamic keys. Only the dynamic key mode ever actually makes connections to other machines, but more importantly, our documentation has <i>always</i> recommended that the dynamic key mode only be used as a last resort because of its various (documented) drawbacks compared to the other modes. With the addition of the ability to generate SSH certificates (which was on our roadmap for a long time and added in 0.7, prior to both the original report and the blog post), we did not explicitly mark the dynamic key mode as deprecated in our documentation, but we probably should do so.<p>Given that it is not recommended for usage (but maintained for backwards compatibility), we chose to warn users of this additional drawback of the dynamic key method, and documented the lack of host key verification (<a href="https:&#x2F;&#x2F;github.com&#x2F;hashicorp&#x2F;vault&#x2F;commit&#x2F;251da1bcdc27678feaa477f087c8d010223d7e8c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hashicorp&#x2F;vault&#x2F;commit&#x2F;251da1bcdc27678fea...</a>). As we stated in our response to the reporter, &quot;It isn’t something we want to hide (and we’re not trying to) and we will document this.&quot;<p>Terraform&#x2F;Packer:<p>Terraform and Packer support the ability to use &quot;provisioners&quot; to bootstrap a machine. In both, the provisioner is run very shortly after the machine is initially created, representing an extremely small window of attack. Neither support connecting to a pre-existing machine via SSH under normal use cases (you can make it happen through some advanced configuration trickery with Terraform, but it&#x27;s abnormal). Because of this, we didn&#x27;t register this as a high-priority issue.<p>However, we admit that this can be improved and we likely should&#x27;ve been more reactionary in our response. I apologize for that. We have added plans to improve this to our roadmap, covered in a couple paragraphs.<p>As the blog post states, the reporter suggested parsing console logs to determine the host key. And, as the blog post correctly says, we don&#x27;t want to do this. There is a combinatorial explosion of complexity in supporting this, we have experience with this (due to Vagrant supporting this type of behavior), and we&#x27;ve found maintenance of this sort of functionality to be difficult to support over time. We came to this conclusion though only because there is a viable alternative: SSH certificate authentication. If a viable alternative didn&#x27;t exist, we may have been forced to take the more complex route.<p>SSH certificate authentication was introduced many years ago and is broadly supported. This type of auth also provides authenticity to a first-use connection. We mentioned in our response email that this is something we&#x27;re open to doing instead. I admit that in our response to the reporter, we explicitly said this &quot;is not a priority&quot; but shortly after decided to schedule this work for the next major TF release. We should&#x27;ve followed up again, but didn&#x27;t.<p>And that&#x27;s where we&#x27;re at currently! I hope this helps make our response to the report and our future roadmap around this issue more clear.
评论 #14123570 未加载
评论 #14123736 未加载
评论 #14126561 未加载
评论 #14124672 未加载
评论 #14123158 未加载
评论 #14125655 未加载
risyasinabout 8 years ago
Well. I haven&#x27;t really started to learn golang yet. But sure that this breaking change indeed convinced me to do it. I have implemented an automated ssh session in another language there was absolutely no host key checking or tofu implementation even worse that they designed the api not to allow that manually. That was frustrating. But obviously the golang language designers and the entry owner and myself sharing the same concerns obviously. Thanks for writing about this
aceperryabout 8 years ago
Really wonderful and thorough report. I&#x27;m not at all a security expert but manage to learn quite a lot from reading this post. Kudos to the author for giving context and background on the issues. If more security reports are written like this, the whole industry would benefit greatly.
jonehollandabout 8 years ago
Why do people keep saying &quot;the vendor&quot;? It&#x27;s hashicorp.
评论 #14122670 未加载
babyabout 8 years ago
A few things:<p>1. how can an experimental library (x&#x2F;) get a CVE?<p>2. what is &quot;hostkey verification&quot;? Probably the fingerprint check you usually get when you ssh into a machine + the blocking warning you get when the fingerprint of the machine suddenly changes.<p>3. if this is what &quot;hostkey verification&quot; is. How is it so hard to implement? create some sort of fingerprint out of the server&#x27;s public key; prompt the user for input; cache the result.
评论 #14122774 未加载
评论 #14123961 未加载
评论 #14122579 未加载
评论 #14123246 未加载
评论 #14123490 未加载
评论 #14123176 未加载
DanielDentabout 8 years ago
I wrote about this a while back, and also proposed a solution which doesn&#x27;t involve parsing console output: <a href="https:&#x2F;&#x2F;www.danieldent.com&#x2F;blog&#x2F;ssh-requires-a-chain-of-trust&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.danieldent.com&#x2F;blog&#x2F;ssh-requires-a-chain-of-trus...</a>
ak217about 8 years ago
FYI, you can also instruct cloud-init to use a particular key pair by supplying it in instance metadata&#x2F;user-data. This avoids the need for hacky scripts extracting public keys from console output (which may also be delayed by a few minutes after the instance starts).
bradknowlesabout 8 years ago
Phil may be grumpy, but he is not a troll.
jakewinsabout 8 years ago
When we built the new set of drivers for Neo4j, we decided to allow three modes: No encryption, Trust on First Use and Trusted Signature - there&#x27;s no way to establish an connection without trust.<p>This was a terrifying decision, because of ease of use concerns. Having done so and shipped it, TL;DR: It worked awesome, outside of some early kinks in TOFU that we worked out - and now everyone can sleep well knowing there&#x27;s not a single install that thinks they are running an encrypted setup when they really aren&#x27;t.<p>Anyone that came back asking for a flag to disable host key verification seemed happy with our argument for why that&#x27;s not really much different from just disabling encryption.<p>See &quot;Trust&quot; here: <a href="https:&#x2F;&#x2F;neo4j.com&#x2F;docs&#x2F;developer-manual&#x2F;current&#x2F;drivers&#x2F;configure-connect&#x2F;" rel="nofollow">https:&#x2F;&#x2F;neo4j.com&#x2F;docs&#x2F;developer-manual&#x2F;current&#x2F;drivers&#x2F;conf...</a><p>If you&#x27;re interested in doing this as well, we wrote code to do it in Python, JS, Java and C#, it&#x27;s all Apache licensed:<p>JS: <a href="https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-javascript-driver&#x2F;blob&#x2F;1.2&#x2F;src&#x2F;v1&#x2F;internal&#x2F;ch-node.js#L106" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-javascript-driver&#x2F;blob&#x2F;1.2&#x2F;sr...</a><p>Python: <a href="https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-python-driver&#x2F;blob&#x2F;1.2&#x2F;neo4j&#x2F;bolt&#x2F;connection.py#L463" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-python-driver&#x2F;blob&#x2F;1.2&#x2F;neo4j&#x2F;...</a><p>Java: <a href="https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-java-driver&#x2F;blob&#x2F;1.3&#x2F;driver&#x2F;src&#x2F;main&#x2F;java&#x2F;org&#x2F;neo4j&#x2F;driver&#x2F;internal&#x2F;security&#x2F;TLSSocketChannel.java#L68" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-java-driver&#x2F;blob&#x2F;1.3&#x2F;driver&#x2F;s...</a><p>C#: <a href="https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-dotnet-driver&#x2F;blob&#x2F;1.3&#x2F;Neo4j.Driver&#x2F;Neo4j.Driver&#x2F;Internal&#x2F;Connector&#x2F;ITrustStrategy.cs#L28" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;neo4j&#x2F;neo4j-dotnet-driver&#x2F;blob&#x2F;1.3&#x2F;Neo4j....</a>
asveikauabout 8 years ago
Good thing they didn&#x27;t write this in C, or their library would have real security trouble. &#x2F;s
bogomipzabout 8 years ago
Could SSHFP records not have been an option here? Especially combined with something like DNSSEC?
评论 #14122810 未加载
chrisperabout 8 years ago
I wonder if the devops company was this one:<p><a href="https:&#x2F;&#x2F;gravitational.com&#x2F;teleport&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;gravitational.com&#x2F;teleport&#x2F;index.html</a><p>EDIT: Actually, it looks like it&#x27;s Hashicorp.