Summary
MyBB contains a stored cross-site scripting vulnerability in checkbox and multiselect profile fields because certain malformed values bypass specialized validation and are stored as text. When the affected profile data is later rendered, an attacker may cause JavaScript to execute in the browsers of users viewing the content.
Affected context
The issue occurs in MyBB installations using profile fields configured as checkbox or multiselect types. It becomes risky when profile-field input can be submitted or altered in a form that produces a scalar value instead of the expected array structure, allowing the value to bypass specialized validation before being rendered by profile and post-related application code.
Exploit preconditions
- Attack surface: MyBB profile-field input and subsequent profile or post rendering
- Required access: An account or other permitted path able to submit a profile-field value; the exact requirement depends on forum configuration
- Trigger point: Validation and storage of a checkbox or multiselect profile-field value, followed by display to another user
- Why exploitation is possible: Scalar input falls through to generic text handling, is stored without the intended field-specific verification, and is later rendered without an appropriate safe output context
Why this happens
The underlying bug is an input-type validation failure mapped to CWE-79, Cross-Site Scripting. UserDataHandler::verify_profile_fields() performs specialized validation only when the supplied profile-field value is an array. A scalar value therefore follows a generic text-processing path even when the configured field expects an array, and the resulting data can be rendered directly rather than safely encoded for its output context. The insecure pattern is trusting request shape to select validation logic and treating stored user-controlled data as safe markup or script-capable output.
Potential impact
- JavaScript could execute in the browsers of users viewing affected content
- An attacker could perform actions through a victim's authenticated session
- Account or forum data could be exposed or modified
- Administrative users could be targeted for privilege-impacting actions
- Malicious content could persist and affect multiple viewers
General mitigation guidance
Mitigation generally focuses on validating profile-field values according to
their configured type regardless of whether the submitted value is scalar or
array-shaped.
Common defensive patterns include:
- Enforcing strict type, cardinality, and allowed-value checks before storage
- Applying context-appropriate output encoding at every rendering sink
- Treating all profile-field data as untrusted, including previously stored values
- Avoiding direct insertion of user-controlled values into HTML or script-capable contexts
- Using secure-by-default templating and encoding APIs
- Limiting profile-field modification rights according to least privilege
- Reviewing and safely handling legacy stored values during display and maintenance workflows
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules that identify user-controlled values reaching HTML-rendering sinks without contextual encoding
- Code review checks comparing configured field types with validation branches and accepted request shapes
- Tests that submit scalar, array, empty, repeated, and unexpected values to multiselect and checkbox fields
- Policy enforcement requiring output encoding at template and response boundaries
- Monitoring stored profile-field content for unexpected markup or script-like patterns, while recognizing that pattern matching is not a substitute for safe encoding
- Automated security review tools that trace input from profile-field handlers to rendering functions

