{"id":"CVE-2025-54799","aliases":["CVE-2025-54799","GHSA-q82r-2j7m-9rv4","GO-2025-3847"],"related":["CGA-rf2h-qpxv-88h9"],"kind":"vulnerability","state":"published","title":"Lego does not enforce HTTPS","summary":"Let's Encrypt client and ACME library written in Go (Lego). In versions 4.25.1 and below, the github.com/go-acme/lego/v4/acme/api package (thus the lego library and the lego cli as well) don't enforce HTTPS when talking to CAs as an ACME client. Unlike the http-01 challenge which solves an ACME challenge over unencrypted HTTP, the ACME protocol requires HTTPS when a client communicates with the CA to performs ACME functions. However, the library fails to enforce HTTPS both in the original discover URL (configured by the library user) and in the subsequent addresses returned by the CAs in the directory and order objects. If users input HTTP URLs or CAs misconfigure endpoints, protocol operations occur over HTTP instead of HTTPS. This compromises privacy by exposing request/response details like account and request identifiers to network attackers. This was fixed in version 4.25.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Let's Encrypt client and ACME library written in Go (Lego). In versions 4.25.1 and below, the github.com/go-acme/lego/v4/acme/api package (thus the lego library and the lego cli as well) don't enforce HTTPS when talking to CAs as an ACME client. Unlike the http-01 challenge which solves an ACME challenge over unencrypted HTTP, the ACME protocol requires HTTPS when a client communicates with the CA to performs ACME functions. However, the library fails to enforce HTTPS both in the original discover URL (configured by the library user) and in the subsequent addresses returned by the CAs in the directory and order objects. If users input HTTP URLs or CAs misconfigure endpoints, protocol operations occur over HTTP instead of HTTPS. This compromises privacy by exposing request/response details like account and request identifiers to network attackers. This was fixed in version 4.25.2.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nIt was discovered that the github.com/go-acme/lego/v4/acme/api package (thus the lego library and the lego cli as well) don't enforce HTTPS when talking to CAs as an ACME client.\n\n## Details\n\nUnlike the http-01 challenge which solves an ACME challenge over unencrypted HTTP, the ACME protocol requires HTTPS when a client communicates with the CA to performs ACME functions. This is stated in 6.1 of RFC 8555: [https://datatracker.ietf.org/doc/html/rfc8555#section-6.1](https://datatracker.ietf.org/doc/html/rfc8555#section-6.1)\n\n> Each ACME function is accomplished by the client sending a sequence\n> of HTTPS requests to the server [[RFC2818](https://datatracker.ietf.org/doc/html/rfc2818)], carrying JSON messages\n> [[RFC8259](https://datatracker.ietf.org/doc/html/rfc8259)].  Use of HTTPS is REQUIRED.  Each subsection of [Section 7](https://datatracker.ietf.org/doc/html/rfc8555#section-7)\n> below describes the message formats used by the function and the\n> order in which messages are sent.\n\nHowever, the library fails to enforce HTTPS both in the original discover URL (configured by the library user) and in the subsequent addresses returned by the CAs in the directory and order objects.\n\nIf the library user accidentally inputs an HTTP URL, or the CA similarly misconfigures its endpoints, this will cause the relevant parts of the protocol to be performed over HTTP. This can result, at the very least, in a lost of privacy of the request/response details, such as account and request identifiers (which could be intercepted by an attacker in a privileged network position). We did not investigate whether other more serious threats could result from the ability to impersonate a CA for some of the protocol requests, but enforcing HTTPS usage is definitely the safe choice.\n\n## Reproducing\n\nThis is illustrated in the attached http_acme_test.go. Since it uses private field Core.directory, this test must be placed inside the source directory of https://github.com/go-acme/lego/v4/acme/api to run.\n\nPlease note that this only checks getting the directory and creating a new account, but other ACME functions are likely impacted as well, such as creating orders, getting and checking order authorizations.\n\n<details>\n\n```go\npackage api\n\nimport (\n\t\"crypto/ecdsa\"\n\t\"crypto/elliptic\"\n\t\"crypto/rand\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/go-acme/lego/v4/acme\"\n)\n\nconst letsEncryptURLHTTP = \"http://acme-v02.api.letsencrypt.org/directory\"\nconst letsEncryptURLHTTPS = \"https://acme-v02.api.letsencrypt.org/directory\"\n\nfunc changeToHTTP(url *string) {\n\tif strings.HasPrefix(*url, \"https:\") {\n\t\t*url = \"http\" + (*url)[len(\"https\"):]\n\t}\n}\n\nfunc changeToHTTPS(url *string) {\n\tif strings.HasPrefix(*url, \"http:\") {\n\t\t*url = \"https\" + (*url)[len(\"http\"):]\n\t}\n}\n\nfunc TestHTTPURLs(t *testing.T) {\n\tprivateKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tif err != nil {\n\t\tt.Fatalf(\"error generating a private key: %v\", err)\n\t}\n\n\tfunc() {\n\t\tt.Log(\"testing that Discover enforces https\")\n\t\t_, err := New(&http.Client{\n\t\t\tTransport: &httpsOnlyRoundTripper{inner: http.DefaultTransport},\n\t\t\tTimeout:   20 * time.Second,\n\t\t}, \"\", letsEncryptURLHTTP, \"\", privateKey)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"New error: %v\", err)\n\t\t}\n\t}()\n\n\tcore, err := New(&http.Client{\n\t\tTransport: &httpsOnlyRoundTripper{inner: http.DefaultTransport},\n\t\tTimeout:   20 * time.Second,\n\t}, \"\", letsEncryptURLHTTPS, \"\", privateKey)\n\tif err != nil {\n\t\tt.Fatalf(\"New error: %v\", err)\n\t}\n\n\tfunc() {\n\t\tt.Log(\"testing that account creation enforces https\")\n\n\t\t// Simulate a misconfigured CA that gives out HTTP directory URLs and when\n\t\t// we're done change it back to HTTPS to test the rest.\n\t\tchangeToHTTP(&core.directory.NewAccountURL)\n\t\tdefer changeToHTTPS(&core.directory.NewAccountURL)\n\n\t\t_, err := core.Accounts.New(acme.Account{\n\t\t\tTermsOfServiceAgreed: true,\n\t\t\tContact:              []string{},\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Errorf(\"core.Accounts.New error: %v\", err)\n\t\t}\n\t}()\n\n\t_, err = core.Accounts.New(acme.Account{\n\t\tTermsOfServiceAgreed: true,\n\t\tContact:              []string{},\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"core.Accounts.New error: %v\", err)\n\t}\n}\n\ntype httpsOnlyRoundTripper struct {\n\tinner http.RoundTripper\n}\n\nfunc (r *httpsOnlyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {\n\tif req.URL.Scheme != \"https\" {\n\t\treturn nil, fmt.Errorf(\"non-https request is being sent\")\n\t}\n\treturn r.inner.RoundTrip(req)\n}\n```\n\n</details>\n\n_","format":"markdown","source":"ghsa"},{"lang":"en","text":"Github.com/go-acme/lego/v4/acme/api does not enforce HTTPS in github.com/go-acme/lego","format":"markdown","source":"go"},{"lang":"es","text":"Cliente Let's Encrypt y librería ACME escritos en Go (Lego). En las versiones 4.25.1 y anteriores, el paquete github.com/go-acme/lego/v4/acme/api (y, por lo tanto, la librería lego y la CLI de lego) no exigen HTTPS al comunicarse con las CA como cliente ACME. A diferencia del desafío http-01, que resuelve un desafío ACME mediante HTTP sin cifrar, el protocolo ACME requiere HTTPS cuando un cliente se comunica con la CA para realizar funciones ACME. Sin embargo, la librería no exige HTTPS ni en la URL de descubrimiento original (configurada por el usuario de la librería) ni en las direcciones posteriores devueltas por las CA en los objetos de directorio y pedido. Si los usuarios introducen URL HTTP o las CA configuran incorrectamente los endpoints, las operaciones del protocolo se realizan mediante HTTP en lugar de HTTPS. Esto compromete la privacidad al exponer detalles de solicitud/respuesta, como los identificadores de cuenta y solicitud, a atacantes de red. Esto se solucionó en la versión 4.25.2.","source":"nvd"}],"published":"2025-08-06T17:08:52.000Z","modified":"2026-09-10T03:50:27.302Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:U","score":2.3,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:U","score":2.3,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:U","rating":"LOW"}],"cwes":["CWE-319"],"affected":[{"ranges":[{"version":"< 4.25.2","status":"affected"}],"vendor":"go-acme","product":"lego","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"4.25.1"}],"ecosystem":"Go","package":"github.com/go-acme/lego","purl":"pkg:golang/github.com/go-acme/lego","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"4.25.1"}],"ecosystem":"Go","package":"github.com/go-acme/lego/v3","purl":"pkg:golang/github.com/go-acme/lego/v3","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.25.2"}],"ecosystem":"Go","package":"github.com/go-acme/lego/v4","purl":"pkg:golang/github.com/go-acme/lego/v4","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.25.2"}],"ecosystem":"Go","package":"github.com/go-acme/lego/v4","purl":"pkg:golang/github.com/go-acme/lego/v4","source":"go"}],"references":[{"url":"https://github.com/go-acme/lego/security/advisories/GHSA-q82r-2j7m-9rv4","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-acme/lego/commit/238454b5f74f3cfcbb244ff0d0dc914a4ad44b96","tags":["fix","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54799","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/go-acme/lego","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-08-07T14:07:23.435Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-54799","url":"https://www.cve.org/CVERecord?id=CVE-2025-54799","licence":"CVE Terms of Use","modified":"2025-08-07T14:07:32.104Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q82r-2j7m-9rv4","url":"https://github.com/advisories/GHSA-q82r-2j7m-9rv4","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:27.302Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2025-3847","url":"https://pkg.go.dev/vuln/GO-2025-3847","licence":"CC-BY-4.0","modified":"2026-02-04T04:28:55.836Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-54799","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54799","licence":"Public domain","modified":"2026-06-17T09:40:43.547Z"}],"updatedAt":"2026-11-25T22:59:02.174Z","epss":{"score":0.00256,"percentile":0.1837,"date":"2026-12-01T12:00:22.000Z"}}