| Titel | Civilized Discourse Construction Kit, Inc. (Discourse) Discourse 2026.9.0-latest Mass assignment of hidden user fields at signup enables privileg |
|---|
| Beschreibung | Discourse's signup endpoint accepts values for every UserField, not just fields intended for signup. In UsersController#create, the custom-field block loads user_fields = UserField.all and iterates all fields, writing supplied values into user.custom_fields["user_field_<id>"] (app/controllers/users_controller.rb:779-793). There is no editable, show_on_signup, or staff-only filter. The profile-update path in the same controller uses the correct pattern: fields = fields.where(editable: true) unless current_user.staff? (app/controllers/users_controller.rb:226). This differential shows the signup path is missing the intended restriction.
An unauthenticated attacker can register with a JSON body containing "user_fields":{"<hidden_field_id>":"<value>"} and the value is persisted even when the field has editable: false and show_on_signup: false. The field id is enumerable/guessable; the important effect is server-side.
The value becomes a security boundary when the Automation plugin's add_user_to_group_through_custom_field script is configured. On :user_first_logged_in (fired from User#logged_in at app/models/user.rb:1812; handler at plugins/automation/plugin.rb:136-142), the script reads the field, treats it as a group full_name, and calls group.add(user) with system authority (plugins/automation/lib/discourse_automation/scripts/add_user_to_group_through_custom_field.rb:45-70). Thus an anonymous signup can self-assign into the admin-configured group by supplying that group's full name in a hidden field. The attacker does not select an arbitrary group; they join whatever group the automation points at. The group's full name is discoverable via /groups.json for logged-in users.
Impact: group membership is a keystone used by category ACLs (CategoryGroup), private-message allowed_groups, category-moderation groups, grant_trust_level, view_raw_email_allowed_groups, and MCP McpGroupScope. A newly registered low-trust account can gain access to private categories or other group-derived capabilities. The field value persists until manually removed, and the recurring user_first_logged_in trigger re-adds membership after removal, so the escalation is persistent.
Observed result: setup produced field=62 group=67 category=6; an anonymous POST /users.json returned 200 and persisted user_field_62="Escalated Crew"; before the trigger membership=false, can_see=false; after the first-login trigger, membership=true, can_see_private_category=true. The HTTP log confirms the signup 200 and acceptance of the hidden field; the group addition was observed through the automation/model path in a runner, not as a completed HTTP login flow.
Suggested fix: at signup, filter to fields that are actually intended for signup (editable: true and/or show_on_signup: true) and reject values for other field ids; do not rely on the client to omit hidden fields. If the automation is meant to consume only admin-controlled data, restrict the group-pointer script to fields marked editable/show_on_signup, or require an explicit allowlist. Add a regression test that signs up with a non-editable field id and asserts the value is not persisted.
Classification: CWE-915 (Improperly Controlled Modification of Dynamically-Determined Object Attributes) / CWE-284 (Improper Access Control). Proposed CVSS 3.1: 6.5 Medium standalone (AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N); 7.4 High with the automation chain (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N); 9.1 Critical if the automation precondition is not modeled. |
|---|
| Quelle | ⚠️ https://gist.github.com/yxxx21635-tech/c82ef94af6e1b2308f5e4bed4bbea0e6 |
|---|
| Benutzer | zerOiQ (UID 102613) |
|---|
| Einreichung | 29.10.2026 17:58 (vor 1 Monat) |
|---|
| Moderieren | 04.12.2026 00:46 (1 month later) |
|---|
| Status | Akzeptiert |
|---|
| VulDB Eintrag | 449502 [Discourse bis 2026.10.1 User Signup Custom User Field lib/user_creator.rb UserCreator.assign_signup_fields user_fields Remote Code Execution] |
|---|
| Punkte | 20 |
|---|