Improper Input Validation Affecting github.com/gin-gonic/gin package, versions <1.9.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.14% (52nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improper Input Validation vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMGINGONICGIN-3324285
  • published3 May 2023
  • disclosed17 Feb 2023
  • creditt0rchwo0d

Introduced: 17 Feb 2023

CVE-2023-26125  (opens in a new tab)
CWE-20  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade github.com/gin-gonic/gin to version 1.9.0 or higher.

Overview

github.com/gin-gonic/gin is a package that implements a HTTP web framework called gin.

Affected versions of this package are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.

Note: Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic.

PoC

package main

import (
    "net/http"

    "github.com/gin-gonic/gin"
)

func main() {

    r := gin.Default()

    r.GET("/bug", func(c *gin.Context) {
        c.JSON(http.StatusBadRequest, gin.H{"msg": "bug"})
    })

    r.Run()
}

CVSS Scores

version 3.1