CVE-2021-4236: Github.com/ecnepsnai/web Websocket Requests Did Not Call Vulnerability
CRITICALCVE-2021-4236 is a CRITICAL (CVSS 9.8) websocket requests did not call vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/ecnepsnai/web libraries in the Go ecosystem. The issue involves websocket requests did not call authenticatemethod. Remediation is available by upgrading affected packages to version 1.5.2.
CVE-2021-4236 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-4236
To remediate this vulnerability, upgrade all affected Github.com/ecnepsnai/web dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/ecnepsnai/web to 1.5.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/ecnepsnai/web
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-4236, inspect your project dependencies for Github.com/ecnepsnai/web:
inspect dependencies for github.com/ecnepsnai/web
Analyze the terminal output to locate any version of Github.com/ecnepsnai/web in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Github.com/ecnepsnai/web, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-4236 Affected Github.com/ecnepsnai/web Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/ecnepsnai/web
|
Go |
≥ 1.4.0
< 1.5.2
|
1.5.2
|
References
Frequently Asked Questions
What is CVE-2021-4236?
Which Github.com/ecnepsnai/web versions are affected?
What version fixes CVE-2021-4236?
Is github.com/ecnepsnai/web affected?
What is the CVSS score of CVE-2021-4236?
What CWE is associated with CVE-2021-4236?
How can I check Go dependencies for CVE-2021-4236?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5gjg-jgh4-gppm",
"modified" : "2026-01-23T22:35:54Z",
"published" : "2021-06-23T17:26:30Z",
"aliases" : [ "CVE-2021-4236" ],
"summary" : "Websocket requests did not call AuthenticateMethod",
"details" : "### Impact\n\nDepending on implementation, a denial-of-service or privilege escalation vulnerability may occur in software that uses the `github.com/ecnepsnai/web` package with Web Sockets that have an AuthenticateMethod.\n\nThe `AuthenticateMethod` is not called, and `UserData` will be nil in request methods. Attempts to read the `UserData` may result in a panic.\n\nThis issue only affects web sockets where an `AuthenticateMethod` is supplied to the handle options. Users who do not use web sockets, or users who do not require authentication are not at risk.\n\n#### Example\n\nIn the example below, one would expect that the `AuthenticateMethod` function would be called for each request to `/example`\n\n```go\nhandleOptions := web.HandleOptions{\n\tAuthenticateMethod: func(request *http.Request) interface{} {\n\t\t// Assume there is logic here to check for an active sessions, look at cookies or headers, etc...\n\t\tvar session Session{} // Example\n\n\t\treturn session\n\t},\n}\n\nserver.Socket(\"/example\", handle, handleOptions)\n```\n\nHowever, the method is not called, and therefor the `UserData` parameter of the request object in the handle will be nil, when it would have been expected to be the `session` object we returned.\n\n### Patches\n\nRelease v1.5.2 fixes this vulnerability. The authenticate method is now called for websocket requests.\n\nAll users of the web package should update to v1.5.2 or later.\n\n### Workarounds\n\nYou may work around this issue by making the authenticate method a named function, then calling that function at the start of the handle method for the websocket. Reject connections when the return value of the method is nil.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/ecnepsnai/web"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.4.0"
}, {
"fixed" : "1.5.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ecnepsnai/web/security/advisories/GHSA-5gjg-jgh4-gppm"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4236"
}, {
"type" : "WEB",
"url" : "https://github.com/ecnepsnai/web/commit/5a78f8d5c41ce60dcf9f61aaf47a7a8dc3e0002f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ecnepsnai/web"
}, {
"type" : "WEB",
"url" : "https://pkg.go.dev/vuln/GO-2021-0107"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-304", "CWE-400", "CWE-476" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-21T17:41:20Z",
"nvd_published_at" : null
}
}