Vulnerabilities in pkg:golang/github.com/gofiber/template/django/v3

PACKAGE
Advisory Identifier: GHSA-4mq2-gc4j-cmw6
Advisory Summary

CVE-2024-22199 is a CRITICAL (CVSS 9.3) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Github.com/gofiber/template/django/v3 libraries in the Go ecosystem. The issue involves django template engine vulnerable to xss. Remediation is available by upgrading affected packages to version 3.1.9.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/gofiber/template/django/v3

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/gofiber/template/django/v3. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-4mq2-gc4j-cmw6 CVE-2024-22199 CRITICAL Django Template Engine Vulnerable to XSS

CVE-2024-22199 at a Glance

CVE Identifier CVE-2024-22199
GHSA Identifier GHSA-4mq2-gc4j-cmw6
Severity CRITICAL
CVSS v3.1 Base Score 9.3
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product Github.com/gofiber/template/django/v3
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.3

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:C/C:L/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2024-22199

To remediate this vulnerability, upgrade all affected Github.com/gofiber/template/django/v3 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/gofiber/template/django/v3 fixed: 3.1.9
Upgrade github.com/gofiber/template/django/v3 to 3.1.9
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/gofiber/template/django/v3

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-22199, inspect your project dependencies for Github.com/gofiber/template/django/v3:

inspect dependencies for github.com/gofiber/template/django/v3

Analyze the terminal output to locate any version of Github.com/gofiber/template/django/v3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.9), 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-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Github.com/gofiber/template/django/v3, 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 **Vulnerability Type:** Cross-Site Scripting (XSS) **Affected Users:** All users of the Django template engine for Fiber prior to the patch. This vulnerability specifically impacts web applications that render user-supplied data through this template engine, potentially leading to the execution of malicious scripts in users' browsers when visiting affected web pages. ### Patches The vulnerability has been addressed. The template engine now defaults to having autoescape set to `true`, effectively mitigating the risk of XSS attacks. Users are advised to upgrade to the latest version of the Django template engine for Fiber, where this security update is implemented. Ensure that the version of the template engine being used is the latest, post-patch version. ### Workarounds For users unable to upgrade immediately to the patched version, a workaround involves manually implementing autoescaping within individual Django templates. This method includes adding specific tags in the template to control autoescape behavior: ```django {% autoescape on %} {{ "<script>alert('xss');</script>" }} {% endautoescape %} ``` ### References - Official documentation of the Django template engine for Fiber: https://docs.gofiber.io/template/django/ - Django built-in template tags: https://docs.djangoproject.com/en/5.0/ref/templates/builtins/

CVE-2024-22199 Affected Github.com/gofiber/template/django/v3 Versions

1 component(s)
Fixed Versions:
3.1.9
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gofiber/template/django/v3
Go
< 3.1.9
3.1.9

References

Frequently Asked Questions

What is CVE-2024-22199?
CVE-2024-22199 is a security vulnerability in Github.com/gofiber/template/django/v3 involving Django Template Engine Vulnerable to XSS under CWE-116: Improper Encoding or Escaping of Output.
Which Github.com/gofiber/template/django/v3 versions are affected?
Affected versions include releases prior to 3.1.9 across affected packages: github.com/gofiber/template/django/v3.
What version fixes CVE-2024-22199?
Upgrading to 3.1.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gofiber/template/django/v3 affected?
Yes, github.com/gofiber/template/django/v3 is affected in releases prior to 3.1.9. Upgrade your dependency to 3.1.9 or later.
What is the CVSS score of CVE-2024-22199?
CVE-2024-22199 has a CVSS v3.1 base score of 9.3 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:N.
What CWE is associated with CVE-2024-22199?
CVE-2024-22199 is classified under CWE-116: Improper Encoding or Escaping of Output (The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.).
How can I check Go dependencies for CVE-2024-22199?
Run the dependency tree command: 'inspect dependencies for github.com/gofiber/template/django/v3'. 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-4mq2-gc4j-cmw6",
  "modified" : "2024-01-11T19:00:53Z",
  "published" : "2024-01-11T16:41:42Z",
  "aliases" : [ "CVE-2024-22199" ],
  "summary" : "Django Template Engine Vulnerable to XSS",
  "details" : "### Impact\n\n**Vulnerability Type:** Cross-Site Scripting (XSS)  \n**Affected Users:** All users of the Django template engine for Fiber prior to the patch. This vulnerability specifically impacts web applications that render user-supplied data through this template engine, potentially leading to the execution of malicious scripts in users' browsers when visiting affected web pages.\n\n### Patches\n\nThe vulnerability has been addressed. The template engine now defaults to having autoescape set to `true`, effectively mitigating the risk of XSS attacks. Users are advised to upgrade to the latest version of the Django template engine for Fiber, where this security update is implemented. Ensure that the version of the template engine being used is the latest, post-patch version.\n\n### Workarounds\n\nFor users unable to upgrade immediately to the patched version, a workaround involves manually implementing autoescaping within individual Django templates. This method includes adding specific tags in the template to control autoescape behavior:\n```django\n{% autoescape on %}\n{{ \"<script>alert('xss');</script>\" }}\n{% endautoescape %}\n```\n\n### References\n\n- Official documentation of the Django template engine for Fiber: https://docs.gofiber.io/template/django/\n- Django built-in template tags: https://docs.djangoproject.com/en/5.0/ref/templates/builtins/\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gofiber/template/django/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.1.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/template/security/advisories/GHSA-4mq2-gc4j-cmw6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22199"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/template/commit/28cff3ac4d4c117ab25b5396954676d624b6cb46"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gofiber/template"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-116", "CWE-20", "CWE-79" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-11T16:41:42Z",
    "nvd_published_at" : "2024-01-11T18:15:45Z"
  }
}