The vulnerability stems from a hardcoded JWT signing secret, 'frangoteam751', defined in server/api/jwt-helper.js. This became the default secret if the application was configured with security enabled but without a specific secret code.
The analysis of the patch between the last vulnerable version (1.2.11) and the first patched version (1.3.0) revealed several key changes. The commit c7e74e0ffc688130c0f02489d4f4946bead6403f directly addresses the issue.
-
Root Cause: In server/api/jwt-helper.js, the static variable secretCode was initialized to 'frangoteam751'. The patch replaces this with a call to utils.generateSecretCode(), ensuring a random secret is generated if one is not already set.
-
Missing Safeguards: The vulnerability was exploitable because the application's startup and settings-update logic failed to enforce the presence of a secret. The patch rectifies this by adding checks in two critical locations:
server/main.js: During server initialization, new code now checks if settings.secureEnabled is true and settings.secretCode is missing. If so, it generates a random secret.
server/api/index.js: Within the init function that handles API settings, a similar check is added to generate a secret if security is enabled without one being provided in the request.
Therefore, the vulnerable functions are the entry points that allowed the application to run with this insecure default (init and the main server startup logic) and any function within jwt-helper.js that used the hardcoded secret to verify tokens.