<div dir="ltr">I&#39;m sorry I was looking at wrong build before.<div><br></div><div>It doesn&#39;t happen in zeus and master. Only with warrior where this was backported as well in:</div><div>&quot;[OE-core] [warrior 18/19] go: fix CVE-2019-16276&quot;</div><div><br></div><div>Probably because warrior is using older minor version of 1.12 go:</div><div>-GO_MINOR = &quot;.1&quot;<br>+GO_MINOR = &quot;.9&quot;<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 31, 2019 at 12:49 PM Martin Jansa &lt;<a href="mailto:martin.jansa@gmail.com">martin.jansa@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">This seems to cause:<div><br></div><div>ERROR: go-native-1.12.1-r0 do_patch: Fuzz detected:<br><br>Applying patch 0001-release-branch.go1.12-security-net-textproto-don-t-n.patch<br>patching file src/net/http/serve_test.go<br>patching file src/net/http/transport_test.go<br>Hunk #1 succeeded at 5059 with fuzz 2 (offset -74 lines).<br>patching file src/net/textproto/reader.go<br>patching file src/net/textproto/reader_test.go<br><br>The context lines in the patches can be updated with devtool:<br><br>    devtool modify go-native<br>    devtool finish --force-patch-refresh go-native &lt;layer_path&gt;<br><br>Don&#39;t forget to review changes done by devtool!<br><br>ERROR: go-native-1.12.1-r0 do_patch: QA Issue: Patch log indicates that patches do not apply cleanly. [patch-fuzz]<br></div><div><br></div><div>and the same for go-cross and go-runtime.</div><div><br></div><div>The version currently in master is the same, so I guess both are showing this QA issue.</div><div><br></div><div>Regards,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Oct 26, 2019 at 8:54 AM Armin Kuster &lt;<a href="mailto:akuster808@gmail.com" target="_blank">akuster808@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Chen Qi &lt;<a href="mailto:Qi.Chen@windriver.com" target="_blank">Qi.Chen@windriver.com</a>&gt;<br>
<br>
Signed-off-by: Chen Qi &lt;<a href="mailto:Qi.Chen@windriver.com" target="_blank">Qi.Chen@windriver.com</a>&gt;<br>
Signed-off-by: Richard Purdie &lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;<br>
(cherry picked from commit e31f87e289dfd3bbca961e927447a9c7ba816d3f)<br>
Signed-off-by: Armin Kuster &lt;<a href="mailto:akuster808@gmail.com" target="_blank">akuster808@gmail.com</a>&gt;<br>
---<br>
 meta/recipes-devtools/go/go-1.12.inc               |   1 +<br>
 ...nch.go1.12-security-net-textproto-don-t-n.patch | 163 +++++++++++++++++++++<br>
 2 files changed, 164 insertions(+)<br>
 create mode 100644 meta/recipes-devtools/go/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch<br>
<br>
diff --git a/meta/recipes-devtools/go/go-1.12.inc b/meta/recipes-devtools/go/go-1.12.inc<br>
index 39157ff..ed14b17 100644<br>
--- a/meta/recipes-devtools/go/go-1.12.inc<br>
+++ b/meta/recipes-devtools/go/go-1.12.inc<br>
@@ -16,6 +16,7 @@ SRC_URI += &quot;\<br>
     file://0006-cmd-dist-separate-host-and-target-builds.patch \<br>
     file://0007-cmd-go-make-GOROOT-precious-by-default.patch \<br>
     file://0008-use-GOBUILDMODE-to-set-buildmode.patch \<br>
+    file://0001-release-branch.go1.12-security-net-textproto-don-t-n.patch \<br>
 &quot;<br>
 SRC_URI_append_libc-musl = &quot; file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch&quot;<br>
<br>
diff --git a/meta/recipes-devtools/go/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch b/meta/recipes-devtools/go/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch<br>
new file mode 100644<br>
index 0000000..7b39dbd<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/go/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch<br>
@@ -0,0 +1,163 @@<br>
+From 265b691ac440bfb711d8de323346f7d72e620efe Mon Sep 17 00:00:00 2001<br>
+From: Filippo Valsorda &lt;<a href="mailto:filippo@golang.org" target="_blank">filippo@golang.org</a>&gt;<br>
+Date: Thu, 12 Sep 2019 12:37:36 -0400<br>
+Subject: [PATCH] [release-branch.go1.12-security] net/textproto: don&#39;t<br>
+ normalize headers with spaces before the colon<br>
+<br>
+RFC 7230 is clear about headers with a space before the colon, like<br>
+<br>
+X-Answer : 42<br>
+<br>
+being invalid, but we&#39;ve been accepting and normalizing them for compatibility<br>
+purposes since CL 5690059 in 2012.<br>
+<br>
+On the client side, this is harmless and indeed most browsers behave the same<br>
+to this day. On the server side, this becomes a security issue when the<br>
+behavior doesn&#39;t match that of a reverse proxy sitting in front of the server.<br>
+<br>
+For example, if a WAF accepts them without normalizing them, it might be<br>
+possible to bypass its filters, because the Go server would interpret the<br>
+header differently. Worse, if the reverse proxy coalesces requests onto a<br>
+single HTTP/1.1 connection to a Go server, the understanding of the request<br>
+boundaries can get out of sync between them, allowing an attacker to tack an<br>
+arbitrary method and path onto a request by other clients, including<br>
+authentication headers unknown to the attacker.<br>
+<br>
+This was recently presented at multiple security conferences:<br>
+<a href="https://portswigger.net/blog/http-desync-attacks-request-smuggling-reborn" rel="noreferrer" target="_blank">https://portswigger.net/blog/http-desync-attacks-request-smuggling-reborn</a><br>
+<br>
+net/http servers already reject header keys with invalid characters.<br>
+Simply stop normalizing extra spaces in net/textproto, let it return them<br>
+unchanged like it does for other invalid headers, and let net/http enforce<br>
+RFC 7230, which is HTTP specific. This loses us normalization on the client<br>
+side, but there&#39;s no right answer on the client side anyway, and hiding the<br>
+issue sounds worse than letting the application decide.<br>
+<br>
+Fixes CVE-2019-16276<br>
+<br>
+Change-Id: I6d272de827e0870da85d93df770d6a0e161bbcf1<br>
+Reviewed-on: <a href="https://team-review.git.corp.google.com/c/golang/go-private/+/549719+Reviewed-by" rel="noreferrer" target="_blank">https://team-review.git.corp.google.com/c/golang/go-private/+/549719<br>
+Reviewed-by</a>: Brad Fitzpatrick &lt;<a href="mailto:bradfitz@google.com" target="_blank">bradfitz@google.com</a>&gt;<br>
+(cherry picked from commit 1280b868e82bf173ea3e988be3092d160ee66082)<br>
+Reviewed-on: <a href="https://team-review.git.corp.google.com/c/golang/go-private/+/558776+Reviewed-by" rel="noreferrer" target="_blank">https://team-review.git.corp.google.com/c/golang/go-private/+/558776<br>
+Reviewed-by</a>: Dmitri Shuralyov &lt;<a href="mailto:dmitshur@google.com" target="_blank">dmitshur@google.com</a>&gt;<br>
+<br>
+CVE: CVE-2019-16276<br>
+<br>
+Upstream-Status: Backport [<a href="https://github.com/golang/go/commit/6e6f4aaf70c8b1cc81e65a26332aa9409de03ad8" rel="noreferrer" target="_blank">https://github.com/golang/go/commit/6e6f4aaf70c8b1cc81e65a26332aa9409de03ad8</a>]<br>
+<br>
+Signed-off-by: Chen Qi &lt;<a href="mailto:Qi.Chen@windriver.com" target="_blank">Qi.Chen@windriver.com</a>&gt;<br>
+---<br>
+ src/net/http/serve_test.go       |  4 ++++<br>
+ src/net/http/transport_test.go   | 27 +++++++++++++++++++++++++++<br>
+ src/net/textproto/reader.go      | 10 ++--------<br>
+ src/net/textproto/reader_test.go | 13 ++++++-------<br>
+ 4 files changed, 39 insertions(+), 15 deletions(-)<br>
+<br>
+diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go<br>
+index 6eb0088a96..89bfdfbb82 100644<br>
+--- a/src/net/http/serve_test.go<br>
++++ b/src/net/http/serve_test.go<br>
+@@ -4748,6 +4748,10 @@ func TestServerValidatesHeaders(t *testing.T) {<br>
+               {&quot;foo\xffbar: foo\r\n&quot;, 400},                         // binary in header<br>
+               {&quot;foo\x00bar: foo\r\n&quot;, 400},                         // binary in header<br>
+               {&quot;Foo: &quot; + strings.Repeat(&quot;x&quot;, 1&lt;&lt;21) + &quot;\r\n&quot;, 431}, // header too large<br>
++              // Spaces between the header key and colon are not allowed.<br>
++              // See RFC 7230, Section 3.2.4.<br>
++              {&quot;Foo : bar\r\n&quot;, 400},<br>
++              {&quot;Foo\t: bar\r\n&quot;, 400},<br>
+ <br>
+               {&quot;foo: foo foo\r\n&quot;, 200},    // LWS space is okay<br>
+               {&quot;foo: foo\tfoo\r\n&quot;, 200},   // LWS tab is okay<br>
+diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go<br>
+index 5c329543e2..5e5438a708 100644<br>
+--- a/src/net/http/transport_test.go<br>
++++ b/src/net/http/transport_test.go<br>
+@@ -5133,3 +5133,30 @@ func TestTransportIgnores408(t *testing.T) {<br>
+       }<br>
+       t.Fatalf(&quot;timeout after %v waiting for Transport connections to die off&quot;, time.Since(t0))<br>
+ }<br>
++<br>
++func TestInvalidHeaderResponse(t *testing.T) {<br>
++      setParallel(t)<br>
++      defer afterTest(t)<br>
++      cst := newClientServerTest(t, h1Mode, HandlerFunc(func(w ResponseWriter, r *Request) {<br>
++              conn, buf, _ := w.(Hijacker).Hijack()<br>
++              buf.Write([]byte(&quot;HTTP/1.1 200 OK\r\n&quot; +<br>
++                      &quot;Date: Wed, 30 Aug 2017 19:09:27 GMT\r\n&quot; +<br>
++                      &quot;Content-Type: text/html; charset=utf-8\r\n&quot; +<br>
++                      &quot;Content-Length: 0\r\n&quot; +<br>
++                      &quot;Foo : bar\r\n\r\n&quot;))<br>
++              buf.Flush()<br>
++              conn.Close()<br>
++      }))<br>
++      defer cst.close()<br>
++      res, err := cst.c.Get(cst.ts.URL)<br>
++      if err != nil {<br>
++              t.Fatal(err)<br>
++      }<br>
++      defer res.Body.Close()<br>
++      if v := res.Header.Get(&quot;Foo&quot;); v != &quot;&quot; {<br>
++              t.Errorf(`unexpected &quot;Foo&quot; header: %q`, v)<br>
++      }<br>
++      if v := res.Header.Get(&quot;Foo &quot;); v != &quot;bar&quot; {<br>
++              t.Errorf(`bad &quot;Foo &quot; header value: %q, want %q`, v, &quot;bar&quot;)<br>
++      }<br>
++}<br>
+diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go<br>
+index 2c4f25d5ae..1a5e364cf7 100644<br>
+--- a/src/net/textproto/reader.go<br>
++++ b/src/net/textproto/reader.go<br>
+@@ -493,18 +493,12 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {<br>
+                       return m, err<br>
+               }<br>
+ <br>
+-              // Key ends at first colon; should not have trailing spaces<br>
+-              // but they appear in the wild, violating specs, so we remove<br>
+-              // them if present.<br>
++              // Key ends at first colon.<br>
+               i := bytes.IndexByte(kv, &#39;:&#39;)<br>
+               if i &lt; 0 {<br>
+                       return m, ProtocolError(&quot;malformed MIME header line: &quot; + string(kv))<br>
+               }<br>
+-              endKey := i<br>
+-              for endKey &gt; 0 &amp;&amp; kv[endKey-1] == &#39; &#39; {<br>
+-                      endKey--<br>
+-              }<br>
+-              key := canonicalMIMEHeaderKey(kv[:endKey])<br>
++              key := canonicalMIMEHeaderKey(kv[:i])<br>
+ <br>
+               // As per RFC 7230 field-name is a token, tokens consist of one or more chars.<br>
+               // We could return a ProtocolError here, but better to be liberal in what we<br>
+diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go<br>
+index f85fbdc36d..b92fdcd3c7 100644<br>
+--- a/src/net/textproto/reader_test.go<br>
++++ b/src/net/textproto/reader_test.go<br>
+@@ -188,11 +188,10 @@ func TestLargeReadMIMEHeader(t *testing.T) {<br>
+       }<br>
+ }<br>
+ <br>
+-// Test that we read slightly-bogus MIME headers seen in the wild,<br>
+-// with spaces before colons, and spaces in keys.<br>
++// TestReadMIMEHeaderNonCompliant checks that we don&#39;t normalize headers<br>
++// with spaces before colons, and accept spaces in keys.<br>
+ func TestReadMIMEHeaderNonCompliant(t *testing.T) {<br>
+-      // Invalid HTTP response header as sent by an Axis security<br>
+-      // camera: (this is handled by IE, Firefox, Chrome, curl, etc.)<br>
++      // These invalid headers will be rejected by net/http according to RFC 7230.<br>
+       r := reader(&quot;Foo: bar\r\n&quot; +<br>
+               &quot;Content-Language: en\r\n&quot; +<br>
+               &quot;SID : 0\r\n&quot; +<br>
+@@ -202,9 +201,9 @@ func TestReadMIMEHeaderNonCompliant(t *testing.T) {<br>
+       want := MIMEHeader{<br>
+               &quot;Foo&quot;:              {&quot;bar&quot;},<br>
+               &quot;Content-Language&quot;: {&quot;en&quot;},<br>
+-              &quot;Sid&quot;:              {&quot;0&quot;},<br>
+-              &quot;Audio Mode&quot;:       {&quot;None&quot;},<br>
+-              &quot;Privilege&quot;:        {&quot;127&quot;},<br>
++              &quot;SID &quot;:             {&quot;0&quot;},<br>
++              &quot;Audio Mode &quot;:      {&quot;None&quot;},<br>
++              &quot;Privilege &quot;:       {&quot;127&quot;},<br>
+       }<br>
+       if !reflect.DeepEqual(m, want) || err != nil {<br>
+               t.Fatalf(&quot;ReadMIMEHeader =\n%v, %v; want:\n%v&quot;, m, err, want)<br>
-- <br>
2.7.4<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>
</blockquote></div>