Skip to content
Heist/ feed
Back to feed
High

Security advisory

Type: advisorySources: OSVCVE: CVE-2018-16873

In Go before 1.10.6 and 1.11.x before 1.11.3, the "go get" command is vulnerable to remote code execution when executed with the -u flag and the import path of a malicious Go package, or a package that imports it directly or indirectly. Specifically, it is only vulnerable in GOPATH mode, but not in module mode (the distinction is documented at https://golang.org/cmd/go/#hdr-Module_aware_go_get). Using custom domains, it's possible to arrange things so that a Git repository is cloned to a folder named ".git" by using a vanity import path that ends with "/.git". If the Git repository root contains a "HEAD" file, a "config" file, an "objects" directory, a "refs" directory, with some work to ensure the proper ordering of operations, "go get -u" can be tricked into considering the parent directory as a repository root, and running Git commands on it. That will use the "config" file in the original Git repository root for its configuration, and if that config file contains malicious commands, they will execute on the system running "go get -u".

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2018-16873
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 07:27 UTC · Revision 1

Source evidence

CVE-2018-16873

core-osv · Original source

Published 14 Dec 2018, 14:29 UTC

In Go before 1.10.6 and 1.11.x before 1.11.3, the "go get" command is vulnerable to remote code execution when executed with the -u flag and the import path of a malicious Go package, or a package that imports it directly or indirectly. Specifically, it is only vulnerable in GOPATH mode, but not in module mode (the distinction is documented at https://golang.org/cmd/go/#hdr-Module_aware_go_get). Using custom domains, it's possible to arrange things so that a Git repository is cloned to a folder named ".git" by using a vanity import path that ends with "/.git". If the Git repository root contains a "HEAD" file, a "config" file, an "objects" directory, a "refs" directory, with some work to ensure the proper ordering of operations, "go get -u" can be tricked into considering the parent directory as a repository root, and running Git commands on it. That will use the "config" file in the original Git repository root for its configuration, and if that config file contains malicious commands, they will execute on the system running "go get -u".

osv:CVE-2018-16873
Complete source record
{
  "id": "e993b40c6dd56e554fda6301c005c33bac2a86e0786f9c5a6c26bc78f5ff81fa",
  "url": "https://osv.dev/vulnerability/CVE-2018-16873",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2018-16873",
    "summary": "In Go before 1.10.6 and 1.11.x before 1.11.3, the \"go get\" command is vulnerable to remote code execution when executed with the -u flag and the import path of a malicious Go package, or a package that imports it directly or indirectly. Specifically, it is only vulnerable in GOPATH mode, but not in module mode (the distinction is documented at https://golang.org/cmd/go/#hdr-Module_aware_go_get). Using custom domains, it's possible to arrange things so that a Git repository is cloned to a folder named \".git\" by using a vanity import path that ends with \"/.git\". If the Git repository root contains a \"HEAD\" file, a \"config\" file, an \"objects\" directory, a \"refs\" directory, with some work to ensure the proper ordering of operations, \"go get -u\" can be tricked into considering the parent directory as a repository root, and running Git commands on it. That will use the \"config\" file in the original Git repository root for its configuration, and if that config file contains malicious commands, they will execute on the system running \"go get -u\".",
    "evidence": "osv:CVE-2018-16873",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2018-16873",
      "aliases": [
        "CVE-2018-16873",
        "GO-2022-0189"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/golang/go",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "25ca8f49c3fc4a68daff7a23ab613e3453be5cda"
                },
                {
                  "fixed": "90c896448691b5edb0ab11110f37234f63cd28ed"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:golang:go:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "1.10.6"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:golang:go:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "1.11.0"
                      },
                      {
                        "fixed": "1.11.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "go1.10.5",
            "go1.11.2",
            "go1.11.1",
            "go1.10.4",
            "go1.11",
            "go1.11rc2",
            "go1.11rc1",
            "go1.11beta3",
            "go1.11beta2",
            "go1.10.3",
            "go1.11beta1",
            "go1.10.2",
            "go1.10.1",
            "go1.10",
            "go1.10rc2",
            "go1.10rc1",
            "go1.10beta2",
            "go1.10beta1",
            "go1.9beta2",
            "go1.9beta1",
            "go1.8beta2",
            "go1.8beta1",
            "go1.7rc4",
            "go1.7rc3",
            "go1.7rc2",
            "go1.7rc1",
            "go1.7beta2",
            "go1.7beta1",
            "go1.6beta2",
            "go1.6beta1",
            "go1.5beta3",
            "go1.5beta2",
            "go1.5beta1",
            "go1.4beta1",
            "go1.3beta2",
            "go1.3beta1",
            "weekly.2012-03-27",
            "weekly",
            "weekly.2012-03-22",
            "weekly.2012-03-13",
            "weekly.2012-03-04",
            "weekly.2012-02-22",
            "weekly.2012-02-14",
            "weekly.2012-02-07",
            "weekly.2012-01-27",
            "weekly.2012-01-20",
            "weekly.2012-01-15",
            "weekly.2011-12-22",
            "weekly.2011-12-14",
            "weekly.2011-12-06",
            "weekly.2011-12-02",
            "weekly.2011-12-01",
            "weekly.2011-11-18",
            "weekly.2011-11-09",
            "weekly.2011-11-08",
            "weekly.2011-11-02",
            "weekly.2011-11-01",
            "weekly.2011-10-26",
            "weekly.2011-10-25",
            "weekly.2011-10-18",
            "weekly.2011-10-06",
            "weekly.2011-09-21",
            "weekly.2011-09-16",
            "weekly.2011-08-17",
            "weekly.2011-09-07",
            "weekly.2011-09-01",
            "weekly.2011-08-10",
            "weekly.2011-07-07",
            "weekly.2011-07-29",
            "weekly.2011-07-19",
            "weekly.2011-06-09",
            "weekly.2011-06-23",
            "weekly.2011-06-16",
            "weekly.2011-06-02",
            "weekly.2011-05-22",
            "weekly.2011-04-27",
            "weekly.2011-04-13",
            "weekly.2011-04-04",
            "weekly.2011-03-28",
            "weekly.2011-03-15",
            "weekly.2011-03-07.1",
            "release.r56",
            "weekly.2011-03-07",
            "weekly.2011-02-24",
            "weekly.2011-02-15",
            "weekly.2011-02-01.1",
            "weekly.2011-02-01",
            "weekly.2011-01-20",
            "weekly.2011-01-19",
            "weekly.2011-01-12",
            "weekly.2011-01-06",
            "weekly.2010-12-22",
            "weekly.2010-12-15.1",
            "weekly.2010-12-15",
            "weekly.2010-12-08",
            "weekly.2010-12-02",
            "weekly.2010-11-23",
            "weekly.2010-11-10",
            "weekly.2010-11-02",
            "weekly.2010-10-27",
            "weekly.2010-10-20",
            "weekly.2010-10-13.1",
            "weekly.2010-10-13",
            "weekly.2010-09-29",
            "weekly.2010-09-22",
            "weekly.2010-09-15",
            "weekly.2010-09-06",
            "weekly.2010-08-25",
            "weekly.2010-08-11",
            "weekly.2010-08-04",
            "weekly.2010-07-29",
            "weekly.2010-07-14",
            "weekly.2010-07-01",
            "weekly.2010-06-21",
            "weekly.2010-06-09",
            "weekly.2010-05-27",
            "weekly.2010-05-04",
            "weekly.2010-04-27",
            "weekly.2010-04-13",
            "weekly.2010-03-30",
            "weekly.2010-03-22",
            "weekly.2010-03-15",
            "weekly.2010-03-04",
            "weekly.2010-02-23",
            "weekly.2010-02-17",
            "weekly.2010-02-04",
            "weekly.2010-01-27",
            "weekly.2010-01-13",
            "weekly.2010-01-05",
            "weekly.2009-12-22",
            "weekly.2009-12-09",
            "weekly.2009-12-07",
            "weekly.2009-11-17",
            "weekly.2009-11-12",
            "weekly.2009-11-10.1",
            "weekly.2009-11-10",
            "weekly.2009-11-06"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2018-16873.json"
          }
        }
      ],
      "modified": "2026-10-24T10:30:53.584980333Z",
      "provider": "osv",
      "references": [
        "https://groups.google.com/forum/?pli=1#%21topic/golang-announce/Kw31K8G7Fi0",
        "https://lists.debian.org/debian-lts-announce/2021/03/msg00014.html",
        "https://lists.debian.org/debian-lts-announce/2021/03/msg00015.html",
        "https://security.gentoo.org/glsa/201812-09",
        "https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-16873"
      ],
      "provider_metadata": {
        "unresolved_ranges": [
          {
            "cpes": [
              "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*"
            ],
            "vendor_product": "debian:debian_linux",
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "9.0"
                  },
                  {
                    "last_affected": "9.0"
                  }
                ],
                "source": "CPE_STRING"
              }
            ]
          },
          {
            "cpes": [
              "cpe:2.3:a:opensuse:backports_sle:15.0:-:*:*:*:*:*:*"
            ],
            "vendor_product": "opensuse:backports_sle",
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "15.0-NA"
                  },
                  {
                    "last_affected": "15.0-NA"
                  }
                ],
                "source": "CPE_STRING"
              }
            ]
          },
          {
            "cpes": [
              "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*",
              "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*",
              "cpe:2.3:o:opensuse:leap:42.3:*:*:*:*:*:*:*"
            ],
            "vendor_product": "opensuse:leap",
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "15.0"
                  },
                  {
                    "last_affected": "15.0"
                  },
                  {
                    "introduced": "15.1"
                  },
                  {
                    "last_affected": "15.1"
                  },
                  {
                    "introduced": "42.3"
                  },
                  {
                    "last_affected": "42.3"
                  }
                ],
                "source": "CPE_STRING"
              }
            ]
          },
          {
            "cpes": [
              "cpe:2.3:o:suse:linux_enterprise_server:12:-:*:*:*:*:*:*"
            ],
            "vendor_product": "suse:linux_enterprise_server",
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "12-NA"
                  },
                  {
                    "last_affected": "12-NA"
                  }
                ],
                "source": "CPE_STRING"
              }
            ]
          }
        ]
      }
    },
    "related_cves": [
      {
        "value": "CVE-2018-16873",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 437960,
  "published_at": "2018-12-14T14:29:00.227+00:00"
}