shadow81627/daim

Snyk’s security scan found the following vulnerabilities.
Ready to fix your vulnerabilities? Automatically find, fix, and monitor vulnerabilities for free with Snyk.

Vulnerabilities

2 via 2 paths

Dependencies

343

Source

GitHub

Commit

46dcc589

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 2
  • 1
Severity
  • 1
  • 2
Status
  • 3
  • 0
  • 0

high severity

Use of Weak Hash

  • Vulnerable module: crypto-js
  • Introduced through: crypto-js@4.1.1

Detailed paths

  • Introduced through: daim@shadow81627/daim#46dcc589f1c4d8229c7005ffde8a696011f57c6e crypto-js@4.1.1
    Remediation: Upgrade to crypto-js@4.2.0.

Overview

crypto-js is a library of crypto standards.

Affected versions of this package are vulnerable to Use of Weak Hash due to inadequate security settings in the PBKDF2 configuration, which uses insecure SHA1 and has a low iteration count of 1. These insecure settings allow attackers to perform brute-force attacks when PBKDF2 is used with the default parameters.

No information is directly exposed when a hash is generated, regardless of whether the PBKDF2 function is in the vulnerable configuration or not. However, it may be possible to recover the original data, more or less easily depending on the configured parameters, using a brute force attack. This is a low impact on the confidentiality of the protected data, which are in a different scope than the vulnerable package.

The attacker similarly may be able to modify some data which is meant to be protected by the vulnerable package - most commonly when it is used for signature verification. This would require a subsequent exploitation, such as forcing a hash collision via length extension attack. The integrity of the data is therefore compromised, but the quantity and targeting of that data is not fully in the attacker's control, yielding a low integrity impact.

Notes

  • This vulnerability is related to https://security.snyk.io/vuln/SNYK-JS-CRYPTOES-6032390 in crypto-es.

  • According to the crypto-js maintainer: "Active development of CryptoJS has been discontinued. This library is no longer maintained." It is recommended to use the Node.js native crypto module.

Workaround

This vulnerability can be avoided by setting PBKDF2 to use SHA-256 instead of SHA-1 and increasing the number of iterations to a sufficiently high value depending on the intended use. See, for example, the OWASP PBKDF2 Cheat Sheet for recommendations.

Changelog:

2023-10-24 - Initial publication

2023-10-25 - Added fixed version, updated references, separated crypto-es, description changes, updated CVSS, added CVE ID

2023-11-07 - Re-assessed CVSS following a CVSS publication on NVD. No changes made to CVSS.

2024-01-11 - Revised CVSS and description after additional deeper investigation, to reflect the details of the severity assessment

Remediation

Upgrade crypto-js to version 4.2.0 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: @nuxtjs/mdc
  • Introduced through: @nuxt/content@2.9.0

Detailed paths

  • Introduced through: daim@shadow81627/daim#46dcc589f1c4d8229c7005ffde8a696011f57c6e @nuxt/content@2.9.0 @nuxtjs/mdc@0.2.9
    Remediation: Upgrade to @nuxt/content@3.0.0.

Overview

@nuxtjs/mdc is a Nuxt MDC module

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). Unsafe parsing logic of the URL from markdown can lead to arbitrary JavaScript code due to a bypass to the existing guards around the javascript: protocol scheme in the URL.

PoC

import { parseMarkdown } from '@nuxtjs/mdc/runtime';

# ✅ This is correctly escaped by the parser

- XSS Attempt:

<a href="javascript:alert(1)"> this gets sanitizied, yay!</a>

# ❌ These are vulnerable and not escaped

- Bypass 1:

<a href="jav&#x09;ascript:alert('XSS');">Click Me 1</a>

- Bypass 2:

<a href="jav&#x0A;ascript:alert('XSS');">Click Me 2</a>

- Bypass 3:

<a href="jav&#10;ascript:alert('XSS');">Click Me 3</a>

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade @nuxtjs/mdc to version 0.13.3 or higher.

References

medium severity

MPL-2.0 license

  • Module: @vercel/analytics
  • Introduced through: @vercel/analytics@1.0.1

Detailed paths

  • Introduced through: daim@shadow81627/daim#46dcc589f1c4d8229c7005ffde8a696011f57c6e @vercel/analytics@1.0.1

MPL-2.0 license