Summary
A stored cross-site scripting vulnerability in the Vega expression handling of OpenSearch Dashboards allows crafted visualizations to contain JavaScript that executes in other users' browser sessions.
Exploitation requires an authenticated actor with dashboard write permissions and may expose session-context data or enable actions available to affected users.
Affected context
The vulnerability occurs in OpenSearch Dashboards when Vega visualizations are saved and later rendered for other users. It is relevant where authenticated users can create or modify dashboards and where Vega expressions are processed by the checkForFunctionProperty validation routine. The validation may miss function properties nested inside arrays of objects.
Exploit preconditions
- Attack surface: OpenSearch Dashboards Vega visualization and expression handling
- Required access: An authenticated account with dashboard write permissions
- Trigger point: Rendering a saved visualization for another user
- Why exploitation is possible: Validation does not recursively inspect function properties located inside arrays of objects, allowing executable content to persist in a dashboard
Why this happens
The underlying bug is incomplete recursive input validation. The checkForFunctionProperty routine checks some object structures but fails to traverse arrays containing objects, allowing a function property in that nested structure to bypass the intended restriction.
When the saved visualization is later rendered in a browser, the unvalidated content can be interpreted as JavaScript. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
Potential impact
- Arbitrary JavaScript may execute in the browser context of affected users
- Sensitive dashboard data may be read or exposed
- Browser actions available to the victim may be performed
- Authentication context or session-related information could be abused, depending on deployment controls
- Malicious visualizations may persist and affect multiple users who view them
General mitigation guidance
Mitigation generally focuses on complete, context-aware validation and safe rendering of Vega content.
Common defensive patterns include:
- Recursively validate every supported object and array structure before saving or rendering visualizations
- Reject executable function properties unless they are explicitly required and safely constrained
- Prefer declarative visualization features and secure-by-default expression subsets
- Apply output encoding, browser isolation, and content security policies appropriate to the rendering context
- Reduce input trust by limiting who can create or modify shared dashboards
- Apply least-privilege access controls to dashboards and visualization management
- Treat saved visualization definitions as untrusted content throughout their lifecycle
How teams detect issues like this
Detection approaches may include:
- Static analysis for validation routines that inspect objects without recursively traversing arrays
- Code review checks for dynamic JavaScript evaluation or function-bearing visualization definitions
- Tests covering nested arrays, objects, and mixed data structures in Vega validation logic
- Monitoring for unusual dashboard modifications or newly saved visualizations containing unexpected function-like properties
- Policy enforcement that restricts executable expressions and requires review for shared dashboard changes
- Automated security testing and code review tools configured to identify stored XSS and incomplete input validation patterns

