Bug 1233334 (CVE-2015-1840)

Summary: CVE-2015-1840 rubygem-jquery-rails: CSRF Vulnerability in jquery-ujs and jquery-rails
Product: [Other] Security Response Reporter: Vasyl Kaigorodov <vkaigoro>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: apatters, bkearney, bleanhar, cbillett, ccoleman, cpelland, dajohnso, dclarizi, dmcphers, gblomqui, gmccullo, gtanzill, jdetiber, jfrey, jhardy, jialiu, jkeck, joelsmith, jokerman, jorton, jprause, jrafanie, jrusnack, jstribny, katello-bugs, kseifried, lmeyer, mmaslano, mmccomas, obarenbo, roliveri, tomckay, vondruch, xlecauch
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-jquery-rails 3.1.3,rubygem-jquery-rails 4.0.4 Doc Type: Bug Fix
Doc Text:
A flaw was found in the way rubygem-jquery-rails filtered CSRF tokens from HTTP requests. An attacker able to control the href attribute of an anchor tag or the action attribute of a form tag, could use this flaw to force an application to send a request that includes a CSRF token to an attacker-specified site, thus leaking the CSRF token.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-07 07:00:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1233336, 1233337, 1233338    
Bug Blocks: 1250027    
Attachments:
Description Flags
3-1-2-jquery-rails-csrf.patch
none
4-0-3-jquery-rails-csrf.patch none

Description Vasyl Kaigorodov 2015-06-18 16:19:29 UTC
There's an vulnerability in jquery-ujs and jquery-rails that can be used to bypass CSP protections and allows attackers to send CSRF tokens to attacker domains.

In the scenario where an attacker might be able to control the href attribute of an anchor tag or the action attribute of a form tag that will trigger a POST action, the attacker can set the href or action to " https://attacker.com" (note the leading space) that will be passed to JQuery, who will see this as a same origin request, and send the user's CSRF token to the attacker domain.

Workarounds
-----------
To work around this problem, change code that allows users to control the href attribute of an anchor tag or the action attribute of a form tag to filter the user parameters.

For example, code like this:

    link_to params

to code like this:

    link_to filtered_params

    def filtered_params
      # Filter just the parameters that you trust
    end

Patches that fix this issue are attached.

Comment 1 Vasyl Kaigorodov 2015-06-18 16:20:10 UTC
Created attachment 1040569 [details]
3-1-2-jquery-rails-csrf.patch

Comment 2 Vasyl Kaigorodov 2015-06-18 16:20:35 UTC
Created attachment 1040577 [details]
4-0-3-jquery-rails-csrf.patch

Comment 4 Vasyl Kaigorodov 2015-06-18 16:21:20 UTC
Created rubygem-jquery-rails tracking bugs for this issue:

Affects: fedora-all [bug 1233336]

Comment 5 Fedora Update System 2015-06-30 00:04:11 UTC
rubygem-jquery-rails-3.1.0-3.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2015-06-30 00:18:07 UTC
rubygem-jquery-rails-3.1.0-3.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Ján Rusnačko 2015-08-07 06:58:34 UTC
Acknowledgements:

Red Hat would like to thank the Ruby on Rails project for reporting this issue.