//nefariousplan

CVE-2026-35037: Ech0's Patch Switched One of Two Callers of SendRequest

vendor

pattern

cve

proof of concept

The fix for CVE-2026-35037 changes one word in Ech0's GetWebsiteTitle service. SendRequest becomes SendSafeRequest. The same commit adds a new function next to the old one, validates URLs against fourteen reserved CIDR ranges, restores TLS certificate verification that was turned off, and moves the endpoint behind authentication. Thirty-two days later, GHSA-8mc6-xjpr-h98x lands on the other caller of that same unsafe function.

The endpoint took any URL and fetched it

Ech0 is an open-source self-hosted publishing platform for personal idea sharing. The maintainer is lin-snow. The typical operator runs Ech0 on a VPS or homelab and exposes it to the public internet so they can publish their notes from any device. In versions 4.2.1 through 4.2.7, one of the routes that VPS exposes is registered like this:

// internal/router/common.go (v4.2.1)
appRouterGroup.PublicRouterGroup.GET("/website/title", h.CommonHandler.GetWebsiteTitle())

PublicRouterGroup means no session cookie, no API key, no authentication of any kind. The handler binds a single website_url query parameter, hands it to the service, and returns whatever <title> tag the server finds in the response body:

// internal/handler/common/common.go
func (commonHandler *CommonHandler) GetWebsiteTitle() gin.HandlerFunc {
    return res.Execute(func(ctx *gin.Context) res.Response {
        var dto commonModel.GetWebsiteTitleDto
        if err := ctx.ShouldBindQuery(&dto); err != nil {
            return res.Response{Msg: commonModel.INVALID_QUERY_PARAMS, Err: err}
        }
        title, err := commonHandler.commonService.GetWebsiteTitle(dto.WebSiteURL)
        ...
    })
}

The PoC by fineman999 reduces the exploit primitive to three lines:

curl -G \
  --data-urlencode "website_url=http://169.254.169.254/" \
  "http://target:6277/api/website/title"

Anything the Ech0 server can reach by IP or hostname is in scope. The <title> extraction is the exfiltration primitive: small, but enough to confirm which internal services are reachable, and enough to read the title element of any internal HTML response that has one. On vulnerable Ech0, the lab's controlled HTML returns the exfiltrated title verbatim:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{"code":1,"msg":"获取网站标题成功","data":"ECH0-SSRF-CVE-2026-35037"}

获取网站标题成功 translates to "successfully obtained website title." Ech0 has done what the attacker asked.

The function the handler reached for

The service in v4.2.1 hands the URL directly to httpUtil.SendRequest:

// internal/service/common/common.go (v4.2.1)
func (s *CommonService) GetWebsiteTitle(websiteURL string) (string, error) {
    websiteURL = httpUtil.TrimURL(websiteURL)

    body, err := httpUtil.SendRequest(websiteURL, "GET", httpUtil.Header{}, 10*time.Second)
    ...
}

TrimURL strips whitespace and slashes. It does not parse the URL or look at the host. Whatever string the caller sent is what SendRequest will fetch.

SendRequest itself, in v4.2.1, looks like this:

// internal/util/http/http.go (v4.2.1)
func SendRequest(url, method string, customHeader Header, timeout ...time.Duration) ([]byte, error) {
    clientTimeout := 2 * time.Second
    if len(timeout) > 0 {
        clientTimeout = timeout[0]
    }

    // 自定义 HTTP 客户端,忽略 TLS 证书验证
    client := &http.Client{
        Timeout: clientTimeout,
        Transport: &http.Transport{
            TLSClientConfig: &tls.Config{
                InsecureSkipVerify: true, // 忽略证书验证
            },
        },
    }
    ...
}

The Chinese comment on the client translates to "custom HTTP client, ignore TLS certificate verification." The inline comment on the field translates to the same thing. Outbound HTTPS from Ech0's server in v4.2.1 trusted any TLS peer, valid certificate or not. The two comments are testimony: the developer was aware enough of the choice to label it twice.

What "Safe" adds

The April 1, 2026 commit titled feat(router, http): implement SSRF protection and route adjustment adds 178 lines to http.go. None of them rewrite SendRequest. They define SendSafeRequest next to it:

// internal/util/http/http.go (v4.2.8)
func SendSafeRequest(url, method string, customHeader Header, timeout ...time.Duration) ([]byte, error) {
    if err := ValidatePublicHTTPURL(url); err != nil {
        return nil, err
    }
    ...
    client := &http.Client{
        Timeout: clientTimeout,
        Transport: &http.Transport{
            TLSClientConfig: &tls.Config{
                MinVersion: tls.VersionTLS12,
            },
            DialContext: SecureDialContext(clientTimeout),
        },
        CheckRedirect: func(req *http.Request, via []*http.Request) error {
            if len(via) >= maxSafeRedirects {
                return errors.New("重定向次数过多")
            }
            return ValidatePublicHTTPURL(req.URL.String())
        },
    }
    ...
}

ValidatePublicHTTPURL rejects anything that is not http or https, rejects URLs with embedded user-info, rejects localhost and its docker aliases (host.docker.internal, gateway.docker.internal, *.localhost), and rejects any parsed-IP host inside fourteen reserved CIDR ranges:

0.0.0.0/8       10.0.0.0/8       100.64.0.0/10
127.0.0.0/8     169.254.0.0/16   172.16.0.0/12
192.168.0.0/16  198.18.0.0/15    224.0.0.0/4
240.0.0.0/4     ::/128           ::1/128
fe80::/10       fc00::/7         ff00::/8

SecureDialContext is the second layer. It connects with a normal dialer, then re-inspects the *net.TCPAddr of the resolved peer and closes the connection if its IP falls in the same blocked set. This is the defense against DNS rebinding, where a hostname resolves to a public IP at validation time and a private IP at dial time. The IP check runs after the kernel completes the socket, not just after url.Parse.

The response body is also bounded: readBodyWithLimit caps it at 1 MiB. Redirects are capped at three, and the CheckRedirect callback re-runs ValidatePublicHTTPURL on each target so a https://attacker/redirect-to-169.254.169.254 cannot smuggle the metadata IP through.

The same commit also rewrites the body of the original SendRequest:

-		// 自定义 HTTP 客户端,忽略 TLS 证书验证
+		// 自定义 HTTP 客户端
 		client := &http.Client{
 			Timeout: clientTimeout,
 			Transport: &http.Transport{
 				TLSClientConfig: &tls.Config{
-					InsecureSkipVerify: true, // 忽略证书验证
+					MinVersion: tls.VersionTLS12,
 				},
 			},
 		}

SendRequest keeps its name and signature. Its body is now strictly safer than it was. It still does no URL validation.

The tests name the threat model the developer knew

The same commit adds internal/util/http/http_security_test.go. The cases are exhaustive about what ValidatePublicHTTPURL is supposed to refuse:

{name: "reject_loopback_ipv4",       rawURL: "http://127.0.0.1",          wantErr: true},
{name: "reject_loopback_ipv6",       rawURL: "http://[::1]",              wantErr: true},
{name: "reject_localhost",           rawURL: "http://localhost",          wantErr: true},
{name: "reject_private_ipv4",        rawURL: "http://10.0.0.1",           wantErr: true},
{name: "reject_link_local_metadata", rawURL: "http://169.254.169.254",    wantErr: true},
{name: "reject_docker_host_alias",   rawURL: "http://host.docker.internal", wantErr: true},
{name: "reject_url_with_userinfo",   rawURL: "http://admin:[email protected]", wantErr: true},
{name: "reject_ipv6_link_local",     rawURL: "http://[fe80::1]",          wantErr: true},

A separate test, TestSecureDialContext_blocks_loopback, starts a real httptest.NewServer on 127.0.0.1, dials it through SecureDialContext, and asserts the dial returns an error rather than a connection. The DNS-rebinding defense is exercised as code, not as a comment.

The test names enumerate the threat model the developer brought to the safer function. reject_link_local_metadata is AWS IMDS, GCP, Azure metadata, all the same 169.254.169.254 address. reject_docker_host_alias is the case where the Ech0 container is on a docker network and the attacker tries to reach the host through the magic aliases. Each test is documentation of an attack the developer was thinking about. None of them apply to SendRequest, because SendRequest does not call ValidatePublicHTTPURL.

The patch is three substitutions across three files

The visible behavior change in v4.2.8 is three lines:

  1. internal/router/common.go: PublicRouterGroup becomes AuthRouterGroup. The endpoint requires authentication.
  2. internal/service/common/common.go: SendRequest becomes SendSafeRequest. The service uses the validated client.
  3. internal/util/http/http.go: InsecureSkipVerify: true becomes MinVersion: tls.VersionTLS12. The unsafe primitive stops trusting any certificate.

The other 178 lines added to http.go are additive. They define the new validation function, the new dial context, the body-limit helper, and the safer SendSafeRequest client. None of them replace SendRequest. None of them gate it. Anyone who calls SendRequest after April 1 gets a TLS-verifying outbound HTTP client with no URL validation and no DNS-rebinding defense.

The patch is correct for the call site it addresses. The component is not.

The advisory is wrong about which versions are fixed

The GHSA published April 1 lists "Affected versions: <= 4.2.1" and "Patched version: 4.2.8". The two ranges are not consistent. If the patch landed in 4.2.8, then 4.2.2, 4.2.3, 4.2.4, 4.2.5, and 4.2.7 contain the bug. They do; the diff above applies cleanly across the six intermediate tags. NVD's record is correct: "Prior to 4.2.8."

Operators reading the GHSA and concluding they were patched at 4.2.5 were not. The PoC author noticed the inconsistency and recorded it in the lab README. The advisory has not been corrected.

Thirty-two days later, the other caller

SendRequest had two call sites in v4.2.1. The April 1 commit switched one. The other was fetchPeerConnectInfo in internal/service/connect/connect.go, which polls peer Ech0 instances to populate the public /api/connects/info endpoint. Peer URLs are stored at admin time via POST /addConnect. The public endpoint reads them and triggers outbound requests on every fetch. The store-now, fetch-later split means the admin trust boundary on the write is divorced from the public trigger on the read.

On May 3, 2026, commit 091d26d2 fix(connect): block SSRF in peer info fetch + AddConnect URL validation lands. The commit message:

GHSA-8mc6-xjpr-h98x: fetchPeerConnectInfo used SendRequest with no URL validation, allowing admin-added peer URLs to target private networks and cloud metadata (169.254.169.254, kubernetes.default.svc, etc.). Once stored, the public /api/connects/info endpoint would trigger the outbound request.

The fix is one line: switch the call from SendRequest to SendSafeRequest. The same one line that fixed CVE-2026-35037, on a different file, thirty-two days later. The GHSA-8mc6 advisory summary describes the substrate directly: "by leveraging an unsafe HTTP utility function instead of the safer alternative with URL validation."

This is the Design Debt Driver pattern. The component (internal/util/http/http.go) is the substrate. It exports SendRequest and SendSafeRequest side by side, with no mechanism that forces callers to pick the safer one. The first SSRF was a one-line fix at one call site. The second SSRF was a one-line fix at the call site the first fix missed. The substrate did not move between them.

The April patch added the safer sibling. The May patch picked it the second time. Whether the next outbound-HTTP feature picks it on the first try depends on whoever next writes one of these lines reading the function name carefully enough to notice that there are two.

PoC: fineman999/POC_CVE-2026-35037

SendRequest and SendSafeRequest are both still in Ech0's httpUtil. The contract is the word in the middle of the name.