Vulnerabilities

24 via 24 paths

Dependencies

83

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 3
  • 8
  • 12
  • 1
Status
  • 24
  • 0
  • 0

critical severity

Dependency on Vulnerable Third-Party Component

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.28.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Dependency on Vulnerable Third-Party Component via the sharp image processing dependency used by next/image. A vulnerable version of sharp is bundled as an optional dependency, and an attacker can exploit a flaw in that library to achieve remote code execution, full confidentiality loss, integrity loss, and availability loss on both the application and system level.

Remediation

Upgrade next to version 15.5.28, 16.4.1 or higher.

References

critical severity

Insecure Automated Optimizations

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.24.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Insecure Automated Optimizations through the image-optimizer path in packages/next/src/server/image-optimizer.ts. An attacker can execute code in the server-side image optimization process by supplying an AVIF image to a Next.js image optimization request. The vulnerable optimization path hands AVIF content to sharp/libheif for decoding, so a crafted AVIF file processed by the image API can trigger arbitrary code execution in the Next.js server. This can compromise the application server and expose or alter data handled by the process.

Workaround

Disable AVIF image optimization in Next.js image handling so AVIF files are not processed by the image optimizer and cannot trigger the vulnerable sharp/libheif decode path.

Remediation

Upgrade next to version 15.5.24, 16.3.3 or higher.

References

critical severity

Improper Authorization

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@12.3.5.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Improper Authorization due to the improper handling of the x-middleware-subrequest header. An attacker can bypass authorization checks by sending crafted requests containing this specific header.

Workaround

This can be mitigated by preventing external user requests which contain the x-middleware-subrequest header from reaching your Next.js application.

Remediation

Upgrade next to version 12.3.5, 13.5.9, 14.2.25, 15.2.3, 15.3.0-canary.12 or higher.

References

high severity

Directory Traversal

  • Vulnerable module: postcss
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6 › postcss@8.4.5
    Remediation: Upgrade to next@16.3.0.

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Directory Traversal via the process function. An attacker can access arbitrary files and obtain the first ~10 bytes of their contents by supplying a crafted sourceMappingURL comment in CSS input, which is parsed and dereferenced without proper validation. This can lead to disclosure of sensitive information, confirmation of file existence, and potential denial of service by targeting large or special files.

Details

A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.

Directory Traversal vulnerabilities can be generally divided into two types:

  • Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.

st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.

If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

Note %2e is the URL encoded version of . (dot).

  • Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as Zip-Slip.

One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:

2018-04-15 22:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../root/.ssh/authorized_keys

Remediation

Upgrade postcss to version 8.5.12 or higher.

References

high severity

Directory Traversal

  • Vulnerable module: postcss
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6 › postcss@8.4.5
    Remediation: Upgrade to next@16.3.0.

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Directory Traversal via the loadMap process. An attacker can access the contents of arbitrary .map files on the filesystem by submitting crafted CSS containing a sourceMappingURL comment with a path traversal or absolute path, which is then loaded and its content merged into the resulting source map returned by the process.

Details

A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.

Directory Traversal vulnerabilities can be generally divided into two types:

  • Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.

st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.

If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

Note %2e is the URL encoded version of . (dot).

  • Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as Zip-Slip.

One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:

2018-04-15 22:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../root/.ssh/authorized_keys

Remediation

Upgrade postcss to version 8.5.18 or higher.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@14.2.32.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the resolve-routes. An attacker can access internal resources and potentially exfiltrate sensitive information by crafting requests containing user-controlled headers (e.g., Location) that are forwarded or interpreted without validation.

Note: This is only exploitable if custom middleware logic is implemented in a self-hosted deployment. The project maintainers recommend using the documented NextResponse.next({request}) to explicitly pass the request object.

Remediation

Upgrade next to version 14.2.32, 15.4.2-canary.43, 15.4.7 or higher.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.21.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the prepareDestination rewrite/redirect handling in packages/next/src/shared/lib/router/utils/prepare-destination.ts. An attacker can make the application proxy a request to an arbitrary hostname by supplying crafted path or query values that are substituted into an external rewrites() or redirects() destination hostname. When a destination hostname is built from request-controlled input, Next.js accepts the attacker-chosen host instead of the configured suffix, causing rewrites to fetch and serve content from the attacker’s target host and redirects to send users there. This can expose internal services to SSRF or send users to unintended destinations.

Workarounds

  • Do not build the hostname of an external rewrites() or redirects() destination from user-controlled input.
  • If you must use a dynamic subdomain in a rewrites() rule, constrain the capture to hostname-safe characters, for example value: '(?<region>[a-z0-9-]+)'.

Remediation

Upgrade next to version 15.5.21, 16.2.11 or higher.

References

high severity

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.10.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the fetchExternalImage() function, which is used for image optimization and loads external images into memory without a maximum size limit. An attacker can exhaust system memory and disrupt service availability by requesting optimization of very large images from external domains.

Note:

This is only exploitable if remotePatterns is configured to allow image optimization from external domains and the attacker can serve or control a large image on an allowed domain.

Remediation

Upgrade next to version 15.5.10, 16.1.1-canary.15, 16.1.5 or higher.

References

high severity

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.16.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the Image Optimization API when handling requests to the /_next/image endpoint that match the images.localPatterns configuration. An attacker can exhaust server memory and cause a denial of service by requesting large local assets, leading to out-of-memory conditions.

Note: This is only exploitable if the default image loader is used and the images.localPatterns configuration allows access to large local files.

Workaround

This vulnerability can be mitigated by disabling routing of large local assets through /_next/image, disabling image optimization for large or untrusted local files, blocking image optimization access to those assets at the edge, or setting images.localPatterns: [] in the configuration.

Remediation

Upgrade next to version 15.5.16, 16.2.5 or higher.

References

high severity

Missing Authorization

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@13.5.8.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Missing Authorization when using pathname-based checks in middleware for authorization decisions. If i18n configuration is not configured, an attacker can get unintended access to pages one level under the application's root directory.

e.g. https://example.com/foo is accessible. https://example.com/ and https://example.com/foo/bar are not.

Note:

Only self-hosted applications are vulnerable. The vulnerability has been fixed by Vercel on the server side.

Remediation

Upgrade next to version 13.5.8, 14.2.15, 15.0.0-canary.177 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@14.2.7.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Uncontrolled Recursion through the image optimization feature. An attacker can cause excessive CPU consumption by exploiting this vulnerability.

Workaround

Ensure that the next.config.js file has either images.unoptimized, images.loader or images.loaderFile assigned.

Remediation

Upgrade next to version 14.2.7, 15.0.0-canary.109 or higher.

References

medium severity

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@16.1.7.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling due to the lack of an upper bound on the disk cache used by the image optimization. An attacker can exhaust disk storage by generating a large number of unique image optimization variants, leading to service disruption.

Workaround

This vulnerability can be mitigated by periodically cleaning the .next/cache/images directory or by reducing the number of possible image variants through configuration of images.localPatterns, images.remotePatterns, and images.qualities.

Remediation

Upgrade next to version 16.1.7, 16.2.0-canary.54 or higher.

References

medium severity

Directory Traversal

  • Vulnerable module: postcss
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6 › postcss@8.4.5
    Remediation: Upgrade to next@16.3.0.

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Directory Traversal in the PreviousMap.loadFile() method of lib/previous-map.js, which nests its traversal guard inside an if (cssFile) branch that is skipped when the from option is unset, leaving only a check that the target path ends in .map. An attacker can read arbitrary .map files from the filesystem, disclosing their sources paths and sourcesContent through the generated source map, by placing an absolute or ../ path in a sourceMappingURL comment in the processed CSS. This requires the application to process attacker-influenced CSS without the from option, with map enabled and the source-map module available, and then expose result.map to the attacker, and the read is limited to JSON-parseable files ending in .map.

Workaround

This vulnerability can be avoided by passing an explicit from option when processing untrusted CSS, which restores the traversal guard that is otherwise skipped.

Note: This is a bypass of the fix for the vulnerability described in CVE-2026-45623.

Details

A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.

Directory Traversal vulnerabilities can be generally divided into two types:

  • Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.

st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.

If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

Note %2e is the URL encoded version of . (dot).

  • Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as Zip-Slip.

One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:

2018-04-15 22:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../root/.ssh/authorized_keys

Remediation

Upgrade postcss to version 8.5.23 or higher.

References

medium severity

  • Vulnerable module: cookie
  • Introduced through: @sentry/node@7.1.1

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › @sentry/node@7.1.1 › cookie@0.4.2
    Remediation: Upgrade to @sentry/node@7.75.0.

Overview

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the cookie name, path, or domain, which can be used to set unexpected values to other cookie fields.

Workaround

Users who are not able to upgrade to the fixed version should avoid passing untrusted or arbitrary values for the cookie fields and ensure they are set by the application instead of user input.

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

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 cookie to version 0.7.0 or higher.

References

medium severity

HTTP Request Smuggling

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.13.

Overview

next is a react framework.

Affected versions of this package are vulnerable to HTTP Request Smuggling during the rewrite of the proxy traffic to an external backend. An attacker can access unintended backend routes by sending crafted DELETE or OPTIONS requests with Transfer-Encoding: chunked headers. This is only exploitable if the application is not hosted on providers that handle rewrites at the CDN level.

Workaround

This vulnerability can be mitigated by blocking chunked DELETE/OPTIONS requests on rewritten routes at the edge/proxy, or by enforcing authentication and authorization on backend routes.

Remediation

Upgrade next to version 15.5.13, 16.1.7, 16.2.0-canary.102 or higher.

References

medium severity
new

HTTP Request Smuggling

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@15.5.29.

Overview

next is a react framework.

Affected versions of this package are vulnerable to HTTP Request Smuggling via App Router route handlers and the fetch cache, when a self-hosted application forwards a fetched upstream response unchanged. The fetch layer transparently decodes compressed bodies but preserves the original framing headers (content-length, content-encoding, transfer-encoding), causing the declared framing to diverge from the body actually sent. When such an application sits behind an HTTP/1.1 reverse proxy that permits pipelined response queueing, a crafted upstream response can desynchronize responses between clients, enabling cross-client response injection and disclosure of other clients' responses.

Note: This is only exploitable when the application is self-hosted behind an HTTP/1.1 reverse proxy that permits pipelined response queueing and forwards fetched upstream responses unchanged.

Remediation

Upgrade next to version 15.5.29, 16.4.5 or higher.

References

medium severity

Race Condition

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@14.2.24.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Race Condition in the Pages Router. An attacker can cause the server to serve incorrect pageProps data instead of the expected HTML content by exploiting a race condition between two requests, one containing the ?__nextDataRequest=1 query parameter and another with the x-now-route-matches header.

Notes:

  1. This is only exploitable if the CDN provider caches a 200 OK response even in the absence of explicit cache-control headers, enabling a poisoned response to persist and be served to subsequent users;

  2. No backend access or privileged escalation is possible through this vulnerability;

  3. Applications hosted on Vercel's platform are not affected by this issue, as the platform does not cache responses based solely on 200 OK status without explicit cache-control headers.

  4. This is a bypass of the fix for CVE-2024-46982

Workaround

This can be mitigated by stripping the x-now-route-matches header from all incoming requests at your CDN and setting cache-control: no-store for all responses under risk.

Remediation

Upgrade next to version 14.2.24, 15.1.6 or higher.

References

medium severity

Use of Cache Containing Sensitive Information

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@14.2.31.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Use of Cache Containing Sensitive Information in the image optimization process, when responses from API routes vary based on request headers such as Cookie or Authorization. An attacker can gain unauthorized access to sensitive image data by exploiting cache key confusion, causing responses intended for authenticated users to be served to unauthorized users.

Note: Exploitation requires a prior authorized request to populate the cache.

Remediation

Upgrade next to version 14.2.31, 15.4.2-canary.19, 15.4.5 or higher.

References

medium severity

Use of Cache Containing Sensitive Information

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@16.3.8.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Use of Cache Containing Sensitive Information via cross-request deduplication in the use-cache-wrapper.ts cache function, where draft mode state is not accounted for when sharing cached fills across concurrent requests. A draft mode request can join a pending public cache fill and receive published content instead of draft content, or conversely, a fill executed under draft mode containing unpublished content can be registered and served to non-draft requests.

Note: This is only exploitable when the 'use cache' directive is in use and concurrent requests occur, one of which has draft mode enabled.

Remediation

Upgrade next to version 16.3.8 or higher.

References

medium severity

Use of Cache Containing Sensitive Information

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@16.3.8.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Use of Cache Containing Sensitive Information via insufficient scoping of response cache keys in the server's cache key generation logic, where cache keys are not bound to their source route. An attacker can trigger a cache key collision between distinct routes, causing one route's cached response to be served for a different route and resulting in partial availability loss for affected endpoints.

Remediation

Upgrade next to version 15.5.27, 16.3.8, 16.3.8 or higher.

References

medium severity

Resource Exhaustion

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@13.5.0.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Resource Exhaustion via the cache-control header. An attacker can cause a denial of service to all users requesting the same URL via a CDN by caching empty prefetch responses.

Remediation

Upgrade next to version 13.4.20-canary.13 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: postcss
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6 › postcss@8.4.5
    Remediation: Upgrade to next@16.3.0.

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in CSS Stringify Output. An attacker can execute arbitrary JavaScript code in the context of the affected web page by submitting crafted CSS containing </style> sequences that are not properly escaped when embedded within HTML <style> tags.

PoC

const postcss = require('postcss');

// Parse user CSS and re-stringify for page embedding
const userCSS = 'body { content: "</style><script>alert(1)</script><style>"; }';
const ast = postcss.parse(userCSS);
const output = ast.toResult().css;
const html = `<style>${output}</style>`;

console.log(html);
// <style>body { content: "</style><script>alert(1)</script><style>"; }</style>
//
// Browser: </style> closes the style tag, <script> executes

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

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 postcss to version 8.5.10 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: postcss
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6 › postcss@8.4.5
    Remediation: Upgrade to next@13.5.4.

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Improper Input Validation when parsing external Cascading Style Sheets (CSS) with linters using PostCSS. An attacker can cause discrepancies by injecting malicious CSS rules, such as @font-face{ font:(\r/*);}. This vulnerability is because of an insecure regular expression usage in the RE_BAD_BRACKET variable.

Remediation

Upgrade postcss to version 8.4.31 or higher.

References

low severity

Missing Source Correlation of Multiple Independent Data

  • Vulnerable module: next
  • Introduced through: next@12.1.6

Detailed paths

  • Introduced through: next-typescript-api@UnlyEd/next-typescript-api-vercel-boilerplate › next@12.1.6
    Remediation: Upgrade to next@14.2.31.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Missing Source Correlation of Multiple Independent Data in image-optimizer. An attacker can cause arbitrary files to be downloaded with attacker-controlled content and filenames by supplying malicious external image sources.

Note: This is only exploitable if the application is configured to allow external image sources via the images.domains or images.remotePatterns configuration.

Remediation

Upgrade next to version 14.2.31, 15.4.2-canary.19, 15.4.5 or higher.

References