CVE-2018-17847: Golang.org/x/net Golang.org/x/net/html Has Improper Restriction Of Vulnerability

HIGH
Advisory Identifier: GHSA-4r78-hx75-jjj2
CVSS 7.5
CWE-119
Published
Advisory Summary

CVE-2018-17847 is a HIGH (CVSS 7.5) golang.org/x/net/html has improper restriction of vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Golang.org/x/net libraries in the Go ecosystem. The issue involves golang.org/x/net/html has improper restriction of operations within the bounds of a memory buffer. Remediation is available by upgrading affected packages to version 0.0.0-20190125002852-4b62a64f59f7.

CVE-2018-17847 at a Glance

CVE Identifier CVE-2018-17847
GHSA Identifier GHSA-4r78-hx75-jjj2
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Golang.org/x/net
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

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:N/I:N/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 None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2018-17847

To remediate this vulnerability, upgrade all affected Golang.org/x/net dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

golang.org/x/net fixed: 0.0.0-20190125002852-4b62a64f59f7
Upgrade golang.org/x/net to 0.0.0-20190125002852-4b62a64f59f7
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 golang.org/x/net

How to Check if You Are Affected

To determine whether your application is affected by CVE-2018-17847, inspect your project dependencies for Golang.org/x/net:

inspect dependencies for golang.org/x/net

Analyze the terminal output to locate any version of Golang.org/x/net in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20190125002852-4b62a64f59f7), 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-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In Golang.org/x/net, 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

The html package (aka `x/net/html`) through 2018-09-25 in Go mishandles `<svg><template><desc><t><svg></template>`, leading to a `panic: runtime error` (index out of range) in `(*nodeStack).pop` in node.go, called from `(*parser).clearActiveFormattingElements`, during an `html.Parse` call.

CVE-2018-17847 Affected Golang.org/x/net Versions

1 component(s)
Fixed Versions:
0.0.0-20190125002852-4b62a64f59f7
Product / Package Ecosystem Affected Versions Fixed Version
golang.org/x/net
Go
< 0.0.0-20190125002852-4b62a64f59f7
0.0.0-20190125002852-4b62a64f59f7

References

Frequently Asked Questions

What is CVE-2018-17847?
CVE-2018-17847 is a security vulnerability in Golang.org/x/net involving golang.org/x/net/html has Improper Restriction of Operations within the Bounds of a Memory Buffer under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Golang.org/x/net versions are affected?
Affected versions include releases prior to 0.0.0-20190125002852-4b62a64f59f7 across affected packages: golang.org/x/net.
What version fixes CVE-2018-17847?
Upgrading to 0.0.0-20190125002852-4b62a64f59f7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is golang.org/x/net affected?
Yes, golang.org/x/net is affected in releases prior to 0.0.0-20190125002852-4b62a64f59f7. Upgrade your dependency to 0.0.0-20190125002852-4b62a64f59f7 or later.
What is the CVSS score of CVE-2018-17847?
CVE-2018-17847 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2018-17847?
CVE-2018-17847 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check Go dependencies for CVE-2018-17847?
Run the dependency tree command: 'inspect dependencies for golang.org/x/net'. 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-4r78-hx75-jjj2",
  "modified" : "2024-05-20T21:13:53Z",
  "published" : "2022-05-13T01:19:29Z",
  "aliases" : [ "CVE-2018-17847" ],
  "summary" : "golang.org/x/net/html has Improper Restriction of Operations within the Bounds of a Memory Buffer",
  "details" : "The html package (aka `x/net/html`) through 2018-09-25 in Go mishandles `<svg><template><desc><t><svg></template>`, leading to a `panic: runtime error` (index out of range) in `(*nodeStack).pop` in node.go, called from `(*parser).clearActiveFormattingElements`, during an `html.Parse` call.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "golang.org/x/net"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20190125002852-4b62a64f59f7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-17847"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/golang/go/issues/27846"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/golang/go"
  }, {
    "type" : "WEB",
    "url" : "https://go.dev/cl/159397"
  }, {
    "type" : "WEB",
    "url" : "https://go.dev/issue/27846"
  }, {
    "type" : "WEB",
    "url" : "https://go.googlesource.com/net/+/4b62a64f59f73840b9ab79204c94fee61cd1ba2c"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LREEWY6KNLHRWFZ7OT4HVLMVVCGGUHON"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UKRCI7WIOCOCD3H7NXWRGIRABTQOZOBK"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-0197"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-02-07T22:44:43Z",
    "nvd_published_at" : "2018-10-01T08:29:00Z"
  }
}