The vulnerability, CVE-2023-41904, is an unauthenticated remote code execution flaw in FUXA caused by a hardcoded JWT secret. When authentication is enabled without a user-configured secret, the application defaults to a publicly known hardcoded secret. This allows an attacker to forge JWT tokens, gain administrative privileges, and execute arbitrary code.
The analysis of the patch commit ea7b3df066f9fdef8ecdce318398ae40546bc50d reveals the mitigation strategy. The patch introduces a new secretCode setting that can be configured through the UI and API. The core of the fix lies in modifying the server-side logic to handle this new setting.
The identified functions are central to the fix. The startup script in server/main.js is modified to read the secretCode from the settings file. The init and mergeUserSettings functions in server/api/index.js are updated to process and apply the secretCode when settings are changed via the API. These changes ensure that a user-provided secret is used for signing and verifying JWTs, rather than the hardcoded default.
Therefore, the functions that were modified to read, process, and apply the secretCode are the ones that address the vulnerability. An attacker would exploit the absence of this logic in older versions to bypass authentication. During exploitation on a vulnerable version, the JWT verification function (likely in the authJwt module) would be in the call stack, using the hardcoded secret. The patched functions are the ones that prevent this from happening by allowing the secret to be changed.