Vulnerabilities in pkg:golang/github.com/ecnepsnai/web

PACKAGE
Advisory Identifier: GHSA-5gjg-jgh4-gppm
Advisory Summary

CVE-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.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/ecnepsnai/web

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/ecnepsnai/web. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-5gjg-jgh4-gppm CVE-2021-4236 CRITICAL Websocket requests did not call AuthenticateMethod
GHSA-jpgg-cp2x-qrw3 - CRITICAL Duplicate Advisory: ecnepsnai/web vulnerable to Uncontrolled Resource Consumption

CVE-2021-4236 at a Glance

CVE Identifier CVE-2021-4236
GHSA Identifier GHSA-5gjg-jgh4-gppm
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Github.com/ecnepsnai/web
Package Ecosystem Go
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (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.

github.com/ecnepsnai/web fixed: 1.5.2
Upgrade github.com/ecnepsnai/web to 1.5.2
Verify Direct and Transitive Dependencies

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

### Impact Depending 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. The `AuthenticateMethod` is not called, and `UserData` will be nil in request methods. Attempts to read the `UserData` may result in a panic. This 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. #### Example In the example below, one would expect that the `AuthenticateMethod` function would be called for each request to `/example` ```go handleOptions := web.HandleOptions{ AuthenticateMethod: func(request *http.Request) interface{} { // Assume there is logic here to check for an active sessions, look at cookies or headers, etc... var session Session{} // Example return session }, } server.Socket("/example", handle, handleOptions) ``` However, 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. ### Patches Release v1.5.2 fixes this vulnerability. The authenticate method is now called for websocket requests. All users of the web package should update to v1.5.2 or later. ### Workarounds You 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.

CVE-2021-4236 Affected Github.com/ecnepsnai/web Versions

1 component(s)
Fixed Versions:
1.5.2
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?
CVE-2021-4236 is a security vulnerability in Github.com/ecnepsnai/web involving Websocket requests did not call AuthenticateMethod under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/ecnepsnai/web versions are affected?
Affected versions include releases prior to 1.5.2 across affected packages: github.com/ecnepsnai/web.
What version fixes CVE-2021-4236?
Upgrading to 1.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ecnepsnai/web affected?
Yes, github.com/ecnepsnai/web is affected in releases prior to 1.5.2. Upgrade your dependency to 1.5.2 or later.
What is the CVSS score of CVE-2021-4236?
CVE-2021-4236 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-4236?
CVE-2021-4236 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Go dependencies for CVE-2021-4236?
Run the dependency tree command: 'inspect dependencies for github.com/ecnepsnai/web'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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
  }
}