CVE-2021-23447: Teddy Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-5f38-9jw2-6r6h
CVSS 5.4
CWE-843 CWE-79
Published
Advisory Summary

CVE-2021-23447 is a MODERATE (CVSS 5.4) cross-site scripting vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Teddy libraries in the npm ecosystem. The issue involves cross-site scripting in teddy. Remediation is available by upgrading affected packages to version 0.5.9.

CVE-2021-23447 at a Glance

CVE Identifier CVE-2021-23447
GHSA Identifier GHSA-5f38-9jw2-6r6h
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Teddy
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.4

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

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

How to Fix CVE-2021-23447

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

teddy fixed: 0.5.9
npm install teddy@0.5.9
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls teddy

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-23447, inspect your project dependencies using npm:

npm ls teddy

Analyze the terminal output to locate any version of Teddy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.5.9), your application is affected.

Note: The npm ls teddy command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. In Teddy, 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

Teddy is a readable and easy to learn templating language. This affects the package teddy before 0.5.9. A type confusion vulnerability can be used to bypass input sanitization when the model content is an array (instead of a string).

CVE-2021-23447 Affected Teddy Versions

1 component(s)
Fixed Versions:
0.5.9
Product / Package Ecosystem Affected Versions Fixed Version
teddy
npm
< 0.5.9
0.5.9

References

Frequently Asked Questions

What is CVE-2021-23447?
CVE-2021-23447 is a security vulnerability in Teddy involving Cross-site Scripting in teddy under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Teddy versions are affected?
Affected versions include releases prior to 0.5.9 across affected packages: teddy.
What version fixes CVE-2021-23447?
Upgrading to 0.5.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is teddy affected?
Yes, teddy is affected in releases prior to 0.5.9. Upgrade your dependency to 0.5.9 or later.
What is the CVSS score of CVE-2021-23447?
CVE-2021-23447 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2021-23447?
CVE-2021-23447 is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check npm dependencies for CVE-2021-23447?
Run the dependency tree command: 'npm ls teddy'. 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-5f38-9jw2-6r6h",
  "modified" : "2022-05-04T03:42:48Z",
  "published" : "2021-10-12T16:22:04Z",
  "aliases" : [ "CVE-2021-23447" ],
  "summary" : "Cross-site Scripting in teddy",
  "details" : "Teddy is a readable and easy to learn templating language. This affects the package teddy before 0.5.9. A type confusion vulnerability can be used to bypass input sanitization when the model content is an array (instead of a string).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "teddy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23447"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rooseveltframework/teddy/pull/518"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rooseveltframework/teddy/commit/64c556717b4879bf8d4c30067cf6e70d899a3dc0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rooseveltframework/teddy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rooseveltframework/teddy/releases/tag/0.5.9"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-TEDDY-1579557"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-843" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-08T21:52:26Z",
    "nvd_published_at" : "2021-10-07T17:15:00Z"
  }
}