diff --git a/build-tools-internal/version.properties b/build-tools-internal/version.properties
index ee7ec6432ce5d..52d35373aaf82 100644
--- a/build-tools-internal/version.properties
+++ b/build-tools-internal/version.properties
@@ -14,7 +14,7 @@ log4j             = 2.19.0
 slf4j             = 2.0.6
 ecsLogging        = 1.2.0
 jna               = 5.12.1
-netty             = 4.1.118.Final
+netty             = 4.1.126.Final
 commons_lang3     = 3.9
 google_oauth_client = 1.34.1
 awsv2sdk            = 2.31.78
diff --git a/docs/changelog/134182.yaml b/docs/changelog/134182.yaml
new file mode 100644
index 0000000000000..4ec8a96a8ccc9
--- /dev/null
+++ b/docs/changelog/134182.yaml
@@ -0,0 +1,5 @@
+pr: 134182
+summary: Upgrade Netty to 4.1.126.Final
+area: Network
+type: upgrade
+issues: []
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 55f5012394667..a03e59c039bed 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -1594,74 +1594,74 @@
             
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
-      
-         
-            
+      
+         
+            
          
       
       
diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransportTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransportTests.java
index 46003934db545..9d262489ff108 100644
--- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransportTests.java
+++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransportTests.java
@@ -587,9 +587,8 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 {
                     EmbeddedChannel ch = new EmbeddedChannel(handler);
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("This is not a valid HTTP line"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("This is not a valid HTTP line", buf);
+                    appendCrLf(buf);
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     assertThat(dispatchThrowableReference.get().toString(), containsString("NOT A VALID HTTP LINE"));
@@ -600,9 +599,8 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 {
                     EmbeddedChannel ch = new EmbeddedChannel(handler);
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("GET /this/is/a/valid/but/too/long/initial/line HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("GET /this/is/a/valid/but/too/long/initial/line HTTP/1.1", buf);
+                    appendCrLf(buf);
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     assertThat(dispatchThrowableReference.get().toString(), containsString("HTTP line is larger than"));
@@ -613,11 +611,9 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 {
                     EmbeddedChannel ch = new EmbeddedChannel(handler);
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("GET /url HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    ByteBufUtil.copy(AsciiString.of("Host"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("GET /url HTTP/1.1", buf);
+                    appendAsciiLine("Host", buf);
+                    appendCrLf(buf);
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     assertThat(dispatchThrowableReference.get().toString(), containsString("No colon found"));
@@ -628,11 +624,9 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 {
                     EmbeddedChannel ch = new EmbeddedChannel(handler);
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("GET /url HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    ByteBufUtil.copy(AsciiString.of("Host: this.looks.like.a.good.url.but.is.longer.than.permitted"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("GET /url HTTP/1.1", buf);
+                    appendAsciiLine("Host: this.looks.like.a.good.url.but.is.longer.than.permitted", buf);
+                    appendCrLf(buf);
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     assertThat(dispatchThrowableReference.get().toString(), containsString("HTTP header is larger than"));
@@ -643,12 +637,11 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 {
                     EmbeddedChannel ch = new EmbeddedChannel(handler);
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("GET /url HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("GET /url HTTP/1.1", buf);
                     ByteBufUtil.copy(AsciiString.of("Host: invalid header value"), buf);
                     buf.writeByte(0x01);
-                    buf.writeByte(HttpConstants.LF);
-                    buf.writeByte(HttpConstants.LF);
+                    appendCrLf(buf);
+                    appendCrLf(buf);
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     assertThat(dispatchThrowableReference.get().toString(), containsString("Validation failed for header 'Host'"));
@@ -659,10 +652,8 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 {
                     EmbeddedChannel ch = new EmbeddedChannel(handler);
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("GET /url HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
-                    ByteBufUtil.copy(AsciiString.of("Host: localhost"), buf);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("GET /url HTTP/1.1", buf);
+                    appendAsciiLine("Host: localhost", buf);
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     safeGet(ch.close());
@@ -716,33 +707,24 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 // OPTIONS request with fixed length content written in one chunk
                 {
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("OPTIONS /url/whatever/fixed-length-single-chunk HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("OPTIONS /url/whatever/fixed-length-single-chunk HTTP/1.1", buf);
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Host: localhost"), buf);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Host: localhost", buf);
                     }
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Accept: */*"), buf);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Accept: */*", buf);
                     }
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Content-Encoding: gzip"), buf);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Content-Encoding: gzip", buf);
                     }
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(
-                            AsciiString.of("Content-Type: " + randomFrom("text/plain; charset=utf-8", "application/json; charset=utf-8")),
-                            buf
-                        );
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Content-Type: " + randomFrom("text/plain; charset=utf-8", "application/json; charset=utf-8"), buf);
                     }
                     String content = randomAlphaOfLengthBetween(4, 1024);
                     // having a "Content-Length" request header is what makes it "fixed length"
-                    ByteBufUtil.copy(AsciiString.of("Content-Length: " + content.length()), buf);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("Content-Length: " + content.length(), buf);
                     // end of headers
-                    buf.writeByte(HttpConstants.LF);
+                    appendCrLf(buf);
                     ByteBufUtil.copy(AsciiString.of(content), buf);
                     // write everything in one single chunk
                     ch.writeInbound(buf);
@@ -759,63 +741,44 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
                 }
                 {
                     ByteBuf buf = ch.alloc().buffer();
-                    ByteBufUtil.copy(AsciiString.of("OPTIONS /url/whatever/chunked-transfer?encoding HTTP/1.1"), buf);
-                    buf.writeByte(HttpConstants.LF);
+                    appendAsciiLine("OPTIONS /url/whatever/chunked-transfer?encoding HTTP/1.1", buf);
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Host: localhost"), buf);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Host: localhost", buf);
                     }
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Accept: */*"), buf);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Accept: */*", buf);
                     }
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Content-Encoding: gzip"), buf);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Content-Encoding: gzip", buf);
                     }
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(
-                            AsciiString.of("Content-Type: " + randomFrom("text/plain; charset=utf-8", "application/json; charset=utf-8")),
-                            buf
-                        );
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine("Content-Type: " + randomFrom("text/plain; charset=utf-8", "application/json; charset=utf-8"), buf);
                     }
                     // do not write a "Content-Length" header to make the request "variable length"
                     if (randomBoolean()) {
-                        ByteBufUtil.copy(AsciiString.of("Transfer-Encoding: " + randomFrom("chunked", "gzip, chunked")), buf);
+                        appendAsciiLine("Transfer-Encoding: " + randomFrom("chunked", "gzip, chunked"), buf);
                     } else {
-                        ByteBufUtil.copy(AsciiString.of("Transfer-Encoding: chunked"), buf);
+                        appendAsciiLine("Transfer-Encoding: chunked", buf);
                     }
-                    buf.writeByte(HttpConstants.LF);
-                    buf.writeByte(HttpConstants.LF);
+                    // End of headers
+                    appendCrLf(buf);
                     // maybe append some chunks as well
                     String[] contentParts = randomArray(0, 4, String[]::new, () -> randomAlphaOfLengthBetween(1, 64));
                     for (String content : contentParts) {
-                        ByteBufUtil.copy(AsciiString.of(Integer.toHexString(content.length())), buf);
-                        buf.writeByte(HttpConstants.CR);
-                        buf.writeByte(HttpConstants.LF);
-                        ByteBufUtil.copy(AsciiString.of(content), buf);
-                        buf.writeByte(HttpConstants.CR);
-                        buf.writeByte(HttpConstants.LF);
+                        appendAsciiLine(Integer.toHexString(content.length()), buf);
+                        appendAsciiLine(content, buf);
                     }
                     ch.writeInbound(buf);
                     ch.flushInbound();
                     ByteBuf buf2 = ch.alloc().buffer();
                     contentParts = randomArray(1, 4, String[]::new, () -> randomAlphaOfLengthBetween(1, 64));
                     for (String content : contentParts) {
-                        ByteBufUtil.copy(AsciiString.of(Integer.toHexString(content.length())), buf2);
-                        buf2.writeByte(HttpConstants.CR);
-                        buf2.writeByte(HttpConstants.LF);
-                        ByteBufUtil.copy(AsciiString.of(content), buf2);
-                        buf2.writeByte(HttpConstants.CR);
-                        buf2.writeByte(HttpConstants.LF);
+                        appendAsciiLine(Integer.toHexString(content.length()), buf2);
+                        appendAsciiLine(content, buf2);
                     }
                     // finish chunked request
-                    ByteBufUtil.copy(AsciiString.of("0"), buf2);
-                    buf2.writeByte(HttpConstants.CR);
-                    buf2.writeByte(HttpConstants.LF);
-                    buf2.writeByte(HttpConstants.CR);
-                    buf2.writeByte(HttpConstants.LF);
+                    appendAsciiLine("0", buf2);
+                    appendCrLf(buf2);
                     ch.writeInbound(buf2);
                     ch.flushInbound();
                     ch.runPendingTasks();
@@ -834,4 +797,24 @@ public void dispatchBadRequest(final RestChannel channel, final ThreadContext th
         }
     }
 
+    /**
+     * Append a string as ASCII terminated by a CR/LF newline
+     *
+     * @param string The string to append
+     * @param buf The buffer to append to
+     */
+    private static void appendAsciiLine(String string, ByteBuf buf) {
+        ByteBufUtil.copy(AsciiString.of(string), buf);
+        appendCrLf(buf);
+    }
+
+    /**
+     * Append a CR/LF newline
+     *
+     * @param buf The buffer to append to
+     */
+    private static void appendCrLf(ByteBuf buf) {
+        buf.writeByte(HttpConstants.CR);
+        buf.writeByte(HttpConstants.LF);
+    }
 }