The pre-patch gate had two paths for oversized bodies. Both set body to nil.
Moby's AuthZ middleware lives in pkg/authorization/authz.go. The function the Docker engine calls before forwarding any request to the daemon is (*Ctx).AuthZRequest. Pre-patch, it opened with this:
const maxBodySize = 1048576 // 1MB
func (ctx *Ctx) AuthZRequest(w http.ResponseWriter, r *http.Request) error {
var body []byte
if sendBody(ctx.requestURI, r.Header) && (r.ContentLength > 0 || isChunked(r)) && r.ContentLength < maxBodySize {
var err error
body, r.Body, err = drainBody(r.Body)
if err != nil {
return err
}
}
// ... assemble Request and call plugin with body
}
Three conditions, ANDed. Look at the third: r.ContentLength < maxBodySize. When the caller sends Content-Length: 1048577, the third condition is false. The entire if-block is skipped. body keeps its zero value, which is nil.
If the caller uses chunked transfer encoding and omits Content-Length entirely, the third condition (-1 < 1048576) is true and the function reaches drainBody:
// drainBody dump the body (if its length is less than 1MB) without modifying the request state
func drainBody(body io.ReadCloser) ([]byte, io.ReadCloser, error) {
bufReader := bufio.NewReaderSize(body, maxBodySize)
newBody := ioutils.NewReadCloserWrapper(bufReader, func() error { return body.Close() })
data, err := bufReader.Peek(maxBodySize)
// Body size exceeds max body size
if err == nil {
log.G(context.TODO()).Warnf("Request body is larger than: '%d' skipping body", maxBodySize)
return nil, newBody, nil
}
// Body size is less than maximum size
if err == io.EOF {
return data, newBody, nil
}
return nil, newBody, err
}
bufio.Reader.Peek(n) returns err == nil precisely when at least n bytes are buffered. For the AuthZ caller, that condition means the request body is at least one megabyte. The function logs the line, then returns nil for the data, newBody for the wrapped reader, and nil for the error.
Two paths into AuthZRequest, same outcome: body is nil before the function reaches the plugin call.
The daemon was reading r.Body, not body.
The AuthZ context's plugin call uses body for the RequestBody field it sends to the plugin:
ctx.authReq = &Request{
User: ctx.user,
UserAuthNMethod: ctx.userAuthNMethod,
RequestMethod: ctx.requestMethod,
RequestURI: ctx.requestURI,
RequestBody: body,
RequestHeaders: headers(r.Header),
}
body is nil. The plugin receives a Request whose RequestBody is empty. From the plugin's perspective, the caller has POSTed to /v1.51/containers/create with no body. There is nothing in the body to refuse. The plugin reads what it has, method, URI, headers, and returns allow.
r.Body, the original request stream, is on the other side of the function. In the early-skip branch it was never touched. In the drainBody branch it has been wrapped in newBody, which is itself a buffered reader around the same underlying stream, and reassigned to r.Body. In both cases the bytes are still on the wire. The daemon's /containers/create handler reads them and JSON-decodes them.
What the daemon decodes is what the PoC sends:
{
"Image": "alpine",
"Cmd": ["sleep", "infinity"],
"HostConfig": {
"Privileged": true,
"Binds": ["/:/host"]
},
"Labels": {
"poc": "cve-2026-34040-full-lab",
"lab_only": "true",
"padding": "AAAAAAAA...AAAA"
}
}
Labels.padding is one megabyte plus one byte of the letter A. The daemon discards it as an arbitrary user label; the field is harmless after JSON parsing. Its only job was to push the encoded request past maxBodySize so the AuthZ check would skip it. The fields the daemon actually acts on, Privileged: true and Binds: ["/:/host"], are intact.
The plugin saw a POST to /containers/create with no body. The daemon saw a POST to /containers/create with Privileged: true and Binds: ["/:/host"]. The same TCP connection. The same JSON object. The two readers disagreed about how much of it to read.
The Docker API call a Docker AuthZ plugin exists to refuse.
The Moby maintainers ship the AuthZ plugin interface because there are container-create payloads a multi-tenant operator cannot allow from semi-trusted callers. A container with Privileged: true shares the host's device namespace and capability set. A container with Binds: ["/:/host"] mounts the host root filesystem inside the container. The two fields together, privileged plus host-root bind, are not a feature an administrator would expose to anyone they did not already trust with sudo.
After the AuthZ bypass, the PoC creates exactly that combination and starts the container. The chain to a host root shell is one chroot:
$ sudo docker exec -it $cid /bin/sh
/ # chroot /host /bin/bash
host# id
uid=0(root) gid=0(root) groups=0(root)
host# hostname
docker-host-vm # the host's hostname, not the container's
The PoC's mode_rce_proof does the equivalent non-interactively, writing /tmp/cve_2026_34040_rce_proof on the host and reading it back through cat /host/tmp/cve_2026_34040_rce_proof. The marker file is host-side because /host was the host's /. The container is the chroot; the host is the actual filesystem.
The PoC's README is explicit about what the CVE itself is: "이 취약점 자체가 직접 /etc/shadow를 읽거나 RCE를 실행하는 것은 아닙니다." The vulnerability itself does not read /etc/shadow or execute RCE; it bypasses the gate that would have refused the request that does. The post-bypass steps are stock Docker primitives that the gate existed to refuse.
The patch fixed two ways to fail open and shipped the budget bump that fail-closed required.
The fix is two consecutive commits to pkg/authorization/authz.go by Paweł Gronowski of Docker, in a private security fork that landed on main in late March 2026 as a single "Merge commit from fork." The first commit's full message:
pkg/authz: Reject requests exceeding body size limit
Previously, the authorization system would silently skip body inspection when request bodies exceeded the maximum size limit (1MiB).
The authorization plugins would receive an empty body for inspection while the actual large payload would still be processed by the Docker daemon, allowing malicious requests to circumvent plugin-based security controls.
The author's description of the bug is the description of the bug. The fix replaces both fail-open paths with a single inline rejection:
-func isChunked(r *http.Request) bool { ... }
-
func (ctx *Ctx) AuthZRequest(w http.ResponseWriter, r *http.Request) error {
var body []byte
- if sendBody(ctx.requestURI, r.Header) && (r.ContentLength > 0 || isChunked(r)) && r.ContentLength < maxBodySize {
- var err error
- body, r.Body, err = drainBody(r.Body)
- if err != nil {
+ if sendBody(ctx.requestURI, r.Header) {
+ bufBody := bufio.NewReaderSize(r.Body, maxBodySize+1)
+ r.Body = ioutils.NewReadCloserWrapper(bufBody, r.Body.Close)
+
+ peeked, err := bufBody.Peek(maxBodySize + 1)
+ if err == nil {
+ return fmt.Errorf("request body too large for authorization plugin: size exceeds %d bytes", maxBodySize)
+ } else if err != io.EOF {
return err
}
+ body = peeked
}
The Peek(maxBodySize + 1) is the same buffered-reader idiom drainBody used. The change is what the function does with the peek result. Pre-patch: log and return nil. Post-patch: return an error. The error path back at the HTTP layer turns the request into HTTP 500 and the plugin never sees it. No fail-open path remains.
git log puts the timestamp on that commit at Mon Feb 16 14:15:24 2026 +0100. The next commit, by the same author, is timestamped Mon Feb 16 14:16:06 2026 +0100. Forty-two seconds. The message:
pkg/authz: Increase body limit to 4 MiB
Some endpoint could potentially use a body request than 1 MiB without malicious intent.
One-line diff: const maxBodySize = 4 * 1024 * 1024, up from 1048576.
The two commits taken together are the architecture's confession. The first made the gate reject what it could not inspect. The second tripled the inspection budget because rejection at one megabyte would have broken legitimate clients sending fat container-create payloads. The original code, the code Gronowski was patching, had picked the same tradeoff the other direction: keep the legitimate clients working, accept the silent skip. The bug was not that an early Moby maintainer failed to imagine an attacker padding Labels. The bug was that the gate's designer treated body-too-large as an operational concern, and the gate's user treated body-too-large as a request to bypass the gate.
The author shipped the security fix and the budget bump that the security fix made necessary in the same forty-two seconds. The second commit is the first commit's apology to legitimate users.
The Warnf called it 'skipping body.' The daemon did not skip it.
This is the fail-open-intercept pattern in its purest dialect: a security gate that cannot enforce the property it was deployed to enforce, choosing to forward the request anyway with a log line for the operator. Prior exhibits include Tomcat's EncryptInterceptor, which catches GeneralSecurityException and calls super.messageReceived(msg) outside the try block; DataEase's CommunityTokenFilter, which writes a 401 inside a catch and calls filterChain.doFilter() after it; and gitsign, which catches a panic in a generic wrapper and exits zero on an unsigned commit.
Moby's variant differs from those in one detail. In Tomcat, DataEase, gitsign, and Admidio, the fail-open lives in a catch block. The gate's designer added the catch to keep the pipeline running through an exception they thought was rare. The catch is the apology.
In Moby, the fail-open is not a catch block. It is a budget. The pre-patch gate's author wrote Warnf("Request body is larger than: '%d' skipping body", maxBodySize) followed by return nil, newBody, nil. There is no exception. There is no catch. There is an if err == nil branch that explicitly handles the success case of Peek(maxBodySize), meaning, the case where the body is at least that big, and chooses to log it and continue.
The gate's designer did not fail open by accident. They wrote the fail-open path explicitly and gave it a log line. The choice was operational: a gate that rejects every request whose body exceeds the inspection budget will reject some legitimate requests, and the original developer chose to let those requests through rather than break Docker clients with fat payloads. The decision was internally consistent and produced the CVE.
Two paths through AuthZRequest. Both set body to nil for oversized requests. Neither path also set r.Body to nil. The daemon was on the other side of r.Body, and the daemon was the one creating the container.
PoC: m0nk3ygod/CVE-2026-34040-PoC
The patch made the ceiling fail closed. The ceiling remains.