إرسال #1065180: Civilized Discourse Construction Kit, Inc. (Discourse) Discourse 2026.9.0-latest Published page remains publicly readable (and becomes unmanageabالمعلومات

عنوانCivilized Discourse Construction Kit, Inc. (Discourse) Discourse 2026.9.0-latest Published page remains publicly readable (and becomes unmanageab
الوصفDiscourse's page-publishing feature serves a topic's first post at the public URL /pub/:slug. Publishing is staff-only, and Guardian#can_publish_page? explicitly refuses private messages (return false if topic.private_message?, lib/guardian.rb:641-648). That check is applied at publish time, but not when a published topic is later converted to a private message. TopicConverter#convert_to_private_message (app/models/topic_converter.rb:48-86) changes the topic archetype to private_message inside a transaction, but never calls PublishedPage.unpublish!. The bulk-conversion path uses the same converter (lib/topics_bulk_action.rb:201-215), so it has the same gap. The only automatic unpublish call in the codebase is on topic destruction (lib/post_destroyer.rb:232); no conversion path performs it. PublishedPagesController#show only runs a guardian check when the page is not public: if !pp.public guardian.ensure_can_see!(pp.topic) end ... render layout: "publish" (app/controllers/published_pages_controller.rb:12-45). For a public page, the view renders @topic.first_post.cooked.html_safe with no guardian (app/views/published_pages/show.html.erb:23). After the topic becomes a private message, the page therefore continues to serve the full first-post body, title, author, and tags to anonymous visitors. The state is also orphaned: PublishedPagesController#destroy calls fetch_topic, which calls guardian.ensure_can_publish_page!(topic) (app/controllers/published_pages_controller.rb:70-74, 96-100). Because can_publish_page? rejects private messages, DELETE /pub/by-topic/:id returns 403 invalid_access after conversion. Staff cannot remove the page through the normal unpublish API; they must convert the topic back to public or destroy it. Preconditions: page publishing is enabled, staff publishes a topic, and staff later converts that topic to a private message (a normal privacy/moderation action). The attacker only needs the public URL; no account or interaction is required. Published URLs are intended for external embedding/indexing, so they may remain in search indexes, third-party embeds, logs, and caches after the content becomes private. Impact: confidentiality breach of the private message's first post (cooked HTML), title, author identity, and tags; persistence with no automatic cleanup; silent failure of the privacy action; and an unmanageable/orphaned page that survives ordinary remediation attempts. Observed result: topic id 15; publish 200 with slug leak-demo; pre-conversion anonymous request 200; conversion 200; post-conversion anonymous request 200 with the secret marker present (marker_found=1); the PublishedPage row survived ([[15,"leak-demo",true]]); anonymous GET /t/15 returned 404; DELETE /pub/by-topic/15 returned 403 invalid_access; the final anonymous request still returned 200. The HTTP log confirms this sequence for the 11:04 run. The state/details endpoint returned 403 after conversion because the topic is now a private message; the harness recorded this as PARSE_ERR. The database row and marker count come from the reported run rather than an independent re-execution. Suggested fix: inside the existing transaction of TopicConverter#convert_to_private_message, mirror the destroy path: PublishedPage.unpublish!(@user, @topic) if @topic.published_page Optionally allow published_pages#destroy to reach PM topics so staff can always clean up an orphaned page. Add a regression test that publishes a page, converts the topic to a private message, asserts the PublishedPage row is gone, and asserts /pub/:slug returns 404. Classification: CWE-284 / CWE-863 (Improper Access Control / broken state transition). Proposed CVSS 3.1: 4.9 Medium (AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N); 6.5 Medium if the staff conversion is modeled as user interaction (UI:R).
المصدر⚠️ https://gist.github.com/yxxx21635-tech/4b94561493801a4d931bb4f1249c12bc
المستخدم
 zerOiQ (UID 102613)
ارسال29/10/2026 06:19 PM (1 شهر منذ)
الاعتدال04/12/2026 12:46 AM (1 month later)
الحالةتمت الموافقة
إدخال VulDB449504 [Discourse حتى 2026.9.0 Page Publishing topic_converter.rb TopicConverter#convert_to_private_message تجاوز الصلاحيات]
النقاط20