<story><title>The silent CVE in the heart of Kubernetes apiserver</title><url>https://gravitational.com/blog/kubernetes-websocket-upgrade-security-vulnerability/</url></story><parent_chain></parent_chain><comment><author>darren0</author><text>The PoC is mostly correct, but basically is testing for a side effect of the fix, not the presence of the vulnerability.  Either which way it&amp;#x27;s probably still useful, but since we are all geeks here might as well talk about the minutia.&lt;p&gt;The PoC basically tests that if you create a websocket request that results in non-101 response the socket is closed by the server.  That is a side effect of the fix.  The way the proxy code works is that on presence of the Upgrade header it first hijacks the HTTP request and dials the target.  It then starts a copy loop but reads the first bytes into a http.Response.  If the response is not 101 it will exit.&lt;p&gt;The a side effect is that it just so happens to be that because the connection is hijacked the golang server will not reuse the TCP connection and will close it.  But according to the HTTP spec that TCP connection is still valid for reuse so the server does not have to actually close the connection (but it happens to).  Where this PoC could fall apart is if you are running kube-apiserver behind a particularly pedantic LB (ALB might apply here).  Most LBs will not reuse any TCP connection that had an Upgrade header in it, but if they are smart and read the response they can if it didn&amp;#x27;t result in a 101.  From that perspective a load balancer (or reverse proxy) is not obligated to close the TCP connection to the client.&lt;p&gt;To fully test the vulnerability you need to find a pod you can exec to and another pod on the same node you are not authorized to exec to.  First send a malformed pod exec and get the open socket.  Then send another request using the kubelet API to exec to a pod you are not authorized for.  Then see if you get a valid response (which I believe is a callback URL for the actually tty stream).&lt;p&gt;The PoC is still basically valid because it could just give you a false negative that you are vulnerable (not a false positive all is swell).</text></comment>
<story><title>The silent CVE in the heart of Kubernetes apiserver</title><url>https://gravitational.com/blog/kubernetes-websocket-upgrade-security-vulnerability/</url></story><parent_chain></parent_chain><comment><author>coder543</author><text>&amp;gt; K8s also allows upgrading apiserver connections to full, live, end-to-end HTTP&amp;#x2F;2 websockets.&lt;p&gt;There&amp;#x27;s no such thing as an HTTP&amp;#x2F;2 websocket.[0] Websockets are a purely HTTP&amp;#x2F;1.1 concept, and they&amp;#x27;re only HTTP&amp;#x2F;1.1 until the moment that the `Upgrade` happens, at which point the TCP socket gets hijacked.&lt;p&gt;I&amp;#x27;m confused as to why HTTP&amp;#x2F;2 is mentioned. I guess they just mean a normal websocket?&lt;p&gt;[0]: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;medium.com&amp;#x2F;axiomzenteam&amp;#x2F;websockets-http-2-and-sse-5c24ae4d9d96&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;medium.com&amp;#x2F;axiomzenteam&amp;#x2F;websockets-http-2-and-sse-5c...&lt;/a&gt;</text></comment>