プロジェクト

全般

プロフィール

Vote #77647

完了

Downloading of attachments with MIME type text/javascript fails

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Attachments_19
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
19
version_id:
122
issue_org_id:
23376
author_id:
2784
assigned_to_id:
1
comments:
4
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Right now, if you try to download an attachment with content type @text/javascript@ with Redmine 3, it will be blocked by the CSRF protection of Rails. The user-visible response will be an HTTP 422.

This is because Rails thinks that these attachments are dynamic JavaScript resources and thus have to fall under the same origin policy. Unless the request is an AJAX (hxr) request, the downloads are blocked by the @verify_same_origin_request@ after filter which is part of the CSRF protection. This behavior was added to Rails 4.1 in https://github.com/rails/rails/pull/13345.

The attached patch excludes the @AttachmentController#download@ action from this protection, allowing to download javascript attachments. This change won't cause an XSS vulnerability in Redmine but technically allows a specific attack of external sites:

  • Given the attacker (Mallory) knows the attachment download URL of a javascript attachment.
  • Given a user (Alice) is logged in to Redmine in their browser with permission to download the attachment.
  • If Mallory can trick Alice into visiting a Website which includes a @

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0