Back to Labs
Security Advisory

CVE-2021-4236

About

Web Sockets do not execute any AuthenticateMethod methods which may be set, leading to a nil pointer dereference if the returned UserData pointer is assumed to be non-nil, or authentication bypass. This issue only affects WebSockets with an AuthenticateMethod hook. Request handlers that do not explicitly use WebSockets are not vulnerable.

Weakness (CWE):CWE-476

Rainforest analyst review

This is a logic flaw in a WebSocket authentication hook: when an AuthenticateMethod is configured, WebSocket connections don't actually invoke it, so the returned UserData pointer stays nil. Code that assumes that pointer is non-nil hits a nil-pointer dereference, and more seriously, the authentication check the developer intended simply doesn't run — an authentication bypass. Crucially, the description scopes it tightly: only WebSockets that use an AuthenticateMethod hook are affected, and non-WebSocket handlers are not vulnerable at all.

That scoping is the whole story for prioritization. The critical 9.8 assumes the worst case — unauthenticated remote bypass of an intended auth gate — but it only materializes in applications that both use this library's WebSockets and configured an AuthenticateMethod they believed was protecting them. Where it applies, the consequence is real: the auth control is silently absent, so an attacker reaches functionality the developer thought was gated, or crashes the service via the nil dereference. Where it doesn't apply, the CVE is simply inert.

Our approach is code-path inventory rather than blanket patching, and honest triage of applicability. The record names a generically titled "web" project, so the first job is identifying whether any of our services actually depend on the affected library and specifically use WebSockets with an AuthenticateMethod hook. That narrow condition is the true attack surface; services meeting it get treated as having no WebSocket auth at all until updated, while everything else is a non-issue we can dismiss with confidence rather than let a 9.8 label inflate.

References

Related CVEs

Frequently asked questions

What is CVE-2021-4236?

Web Sockets do not execute any AuthenticateMethod methods which may be set, leading to a nil pointer dereference if the returned UserData pointer is assumed to be non-nil, or authentication bypass. This issue only affects WebSockets with an AuthenticateMethod hook. Request handlers that do not explicitly use WebSockets are not vulnerable.

How severe is CVE-2021-4236?

CVE-2021-4236 carries a CVSS 3.1 base score of 9.8, rated critical. On the Rainforest Risk Index — which weighs the severity alongside how easy the flaw is to reach and how broad its impact is — it scores 99 out of 100, in the critical band.

How is CVE-2021-4236 exploited?

According to the CVSS vector (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H): attack vector Network, attack complexity Low, privileges required None, user interaction None. Impact on confidentiality High, integrity High and availability High.

Which products are affected by CVE-2021-4236?

Public advisories list the following as affected: web. Check the references on this page for the exact versions each vendor confirms.

How do I fix CVE-2021-4236?

Apply the fix the vendor published — the references on this page link to the primary advisories and patches. When patching can't happen right away, reduce the exposure of the affected component and watch it for exploitation attempts. Rainforest customers see this vulnerability correlated to their own assets and prioritized by real exposure, not by score alone.

Empower Your Security Strategy with Rainforest

Discover vulnerabilities early, prioritize critical threats, and protect what truly matters. Rainforest streamlines your security operations, saving you time and reducing costs, so you can focus on what drives your business forward.

Share this:LinkedInX Email