Summary
MaxKB evaluates attacker-controlled JavaScript supplied as a custom tool parameter validator when the tool's Debug form renders. An authenticated user with the default USER workspace role can store a validator and trigger script execution in the MaxKB origin by opening that form, without entering or submitting a parameter value.
Affected context
The issue occurs in custom Tool Init Param definitions submitted through the workspace tool creation and update endpoints. Attacker-controlled props_info.rules[].validator strings are stored without restriction and later passed to eval() when the parameter form renders. Opening the tool's Debug screen is sufficient to trigger execution. The same form is available to accounts with edit permission on a tool, but execution by a different account was not independently verified.
Exploit preconditions
- Attack surface: MaxKB workspace tool creation or update APIs and the tool's Debug form.
- Required access: An authenticated user with the default USER workspace role can store a crafted validator. Tool edit permission may also expose the form to other accounts.
- Trigger point: The Debug screen renders the tool's Init Param form; no parameter value needs to be entered or submitted.
- Why exploitation is possible: The stored validator string is evaluated as JavaScript in the MaxKB origin without being treated as untrusted data.
Why this happens
The application passes a user-controlled validator string to eval() during form rendering. Evaluating input as code allows an attacker who can store that input to execute JavaScript in the application's origin. This is improper neutralization of dynamically evaluated code, described by CWE-95. The reported behavior confirms execution in the MaxKB origin; access to another user's bearer token or account authority is plausible only if that user renders the malicious form and was not independently verified.
Potential impact
- JavaScript may execute in the MaxKB origin when the affected form is rendered.
- Code may act with the privileges and session context available to the user who opens the form.
- Access to another user's bearer token or account authority could be possible if that user renders the malicious form, but this outcome was not independently verified.
General mitigation guidance
Defensive patterns focus on treating validator definitions as data rather than executable code:
- Avoid evaluating user-controlled strings; use declarative validation rules or a constrained, non-executable expression format.
- Validate validator definitions against a strict schema and allowlist supported operators and rule types.
- Reduce trust in user-editable tool configuration and restrict who can create or modify tools.
- Apply least privilege to workspace roles and limit sensitive actions available to sessions that render configurable forms.
- Use browser-side controls such as a restrictive Content Security Policy as defense in depth, not as a substitute for removing dynamic evaluation.
How teams detect issues like this
- Use static analysis to identify
eval()and similar dynamic-code execution APIs, especially when their arguments originate from API requests or persisted configuration. - Review tool creation and update paths for storage of validator strings and trace whether they reach executable sinks during form rendering.
- Add code-review checks and CI policies that prohibit dynamic evaluation of user-controlled configuration.
- Monitor for unexpected script-like validator definitions and audit permissions for creating or editing tools.

