{"id":"CVE-2023-32691","aliases":["CVE-2023-32691","GHSA-qjrq-hm79-49ww"],"related":[],"kind":"vulnerability","state":"published","title":"ginuerzh/gost vulnerable to Timing Attack","summary":"gost (GO Simple Tunnel) is a simple tunnel written in golang. Sensitive secrets such as passwords, token and API keys should be compared only using a constant-time comparison function. Untrusted input, sourced from a HTTP header, is compared directly with a secret. Since this comparison is not secure, an attacker can mount a side-channel timing attack to guess the password. As a workaround, this can be easily fixed using a constant time comparing function such as `crypto/subtle`'s `ConstantTimeCompare`.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"gost (GO Simple Tunnel) is a simple tunnel written in golang. Sensitive secrets such as passwords, token and API keys should be compared only using a constant-time comparison function. Untrusted input, sourced from a HTTP header, is compared directly with a secret. Since this comparison is not secure, an attacker can mount a side-channel timing attack to guess the password. As a workaround, this can be easily fixed using a constant time comparing function such as `crypto/subtle`'s `ConstantTimeCompare`.","source":"cvelist"},{"lang":"en","text":"[Timing attacks](https://en.wikipedia.org/wiki/Timing_attack) occur when an attacker can guess a secret by observing a difference in processing time for valid and invalid inputs. Sensitive secrets such as passwords, token and API keys should be compared only using a constant-time comparision function.\nMore information on this attack type can be found in [this blog post](https://verboselogging.com/2012/08/20/a-timing-attack-in-action). \n\n# Root Cause Analysis\n\nIn this case, the vulnerability occurs due to the following code.\n\nhttps://github.com/ginuerzh/gost/blob/1c62376e0880e4094bd3731e06bd4f7842638f6a/auth.go#L46-L46\n\nHere, a untrusted input, sourced from a HTTP header, is compared directly with a secret. \nSince, this comparision is not secure, an attacker can mount a side-channel timing attack to guess the password.\n\n# Remediation\n\nThis can be easily fixed using a constant time comparing function such as `crypto/subtle`'s `ConstantTimeCompare`. \nAn example fix can be found in https://github.com/runatlantis/atlantis/commit/48870911974adddaa4c99c8089e79b7d787fa820 Alternatively, one can apply the patch below\n\n```\nFrom d18cff85e1a565f688f717fd8f2cacea62ff9dbf Mon Sep 17 00:00:00 2001\nFrom: Porcupiney Hairs <porcupiney.hairs@protonmail.com>\nDate: Sun, 7 May 2023 01:03:33 +0530\nSubject: [PATCH] Fix : Timing attack\n\n---\n auth.go | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/auth.go b/auth.go\nindex 1be96e9..be13f23 100644\n--- a/auth.go\n+++ b/auth.go\n@@ -2,6 +2,7 @@ package gost\n \n import (\n \t\"bufio\"\n+\t\"crypto/subtle\"\n \t\"io\"\n \t\"strings\"\n \t\"sync\"\n@@ -43,7 +44,8 @@ func (au *LocalAuthenticator) Authenticate(user, password string) bool {\n \t}\n \n \tv, ok := au.kvs[user]\n-\treturn ok && (v == \"\" || password == v)\n+\tpassOk := subtle.ConstantTimeCompare([]byte(password), []byte(v)) == 0\n+\treturn ok && (v == \"\" || passOk)\n }\n \n // Add adds a key-value pair to the Authenticator.\n-- \n2.25.1\n\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Gost (GO Simple Tunnel) es un túnel simple escrito en golang. Secretos sensibles como contraseñas, tokens y claves API deben ser comparados sólo usando una función de comparación en tiempo constante. La entrada no fiable, procedente de una cabecera HTTP, se compara directamente con un secreto. Como esta comparación no es segura, un atacante puede montar un ataque de tiempo de canal lateral para adivinar la contraseña. Como solución, esto se puede arreglar fácilmente utilizando una función de comparación de tiempo constante como \"ConstantTimeCompare\" de \"crypto/subtle\"","source":"nvd"}],"published":"2023-05-22T19:47:15.000Z","modified":"2026-09-10T03:50:08.350Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"}],"cwes":["CWE-203"],"affected":[{"ranges":[{"version":"<= 2.11.5","status":"affected"}],"vendor":"ginuerzh","product":"gost","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"2.11.5"}],"ecosystem":"Go","package":"github.com/ginuerzh/gost","purl":"pkg:golang/github.com/ginuerzh/gost","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"2.11.5"}],"vendor":"go_simple_tunnel_project","product":"go_simple_tunnel","cpe":"cpe:2.3:a:go_simple_tunnel_project:go_simple_tunnel:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/ginuerzh/gost/security/advisories/GHSA-qjrq-hm79-49ww","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ginuerzh/gost/blob/1c62376e0880e4094bd3731e06bd4f7842638f6a/auth.go#L46","tags":["product","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-32691","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ginuerzh/gost","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-01-10T20:45:08.537Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-32691","url":"https://www.cve.org/CVERecord?id=CVE-2023-32691","licence":"CVE Terms of Use","modified":"2025-01-10T20:45:20.000Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qjrq-hm79-49ww","url":"https://github.com/advisories/GHSA-qjrq-hm79-49ww","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:08.350Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-32691","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-32691","licence":"Public domain","modified":"2026-06-17T05:59:24.010Z"}],"updatedAt":"2026-11-25T22:58:24.436Z","epss":{"score":0.00574,"percentile":0.48734,"date":"2026-12-01T12:00:22.000Z"}}