The vulnerability CVE-2025-56572 lies in the seekZero function in finance.js. This function is designed to find the root of a given function fn. However, it lacks any mechanism to limit the number of iterations of its while loops. An attacker can exploit this by causing the fn function to behave in a way that the loops never terminate.
The seekZero function is not directly exposed as part of the public API of the finance.js library. Instead, it is used internally by the IRR (Internal Rate of Return) function. The IRR function is part of the public API and can be called with user-controlled input (an array of cash flows).
The IRR function creates a helper function, npv, and passes it as the fn argument to seekZero. The return value of this npv function depends on the cash flows provided by the user. By providing a malicious set of cash flows, an attacker can control the return values of the npv function, and in turn, control the execution of the while loops inside seekZero.
Specifically, an attacker can ensure that the condition to exit the while loops in seekZero is never met, causing an infinite loop. This will lock up the Node.js event loop or the browser's main thread, leading to a Denial of Service.
Therefore, during an exploit, a runtime profiler would show a call to Finance.IRR, which in turn calls seekZero, where the application's execution will be stuck. Both functions are critical for identifying the vulnerability at runtime.