-
Notifications
You must be signed in to change notification settings - Fork 9.4k
jquery PCI Compliance vulnerability CVE-2015-9251 #15156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
jQuery 1 and 3 are different. Also this sounds very generic. The solution is to pass the data-type in .ajax/get/post calls. |
Not sure about how this is generic... I just know that I can't go in and replace the jQuery without breaking the deployment, since its making a change to core magento files (jquery). Yes, I could do some bash shell trickery, or maybe something in local.xml and use a module, but that seems like such a workaround / unreliable. |
Reference: jquery/jquery#2432 Still, jQuery 1 can not be easily replaced by jQuery 3. Can you point us to specific files which are jQuery 1.x or jQuery 2.x so we can migrate the core and other modules? |
Generic in means of: there is a CVE (with low and medium scores) that can be misused but there is not yet a reference to a specific line or lines of code. Also if you feel like there is a vulnerability in Magento (XSS in this case) which can be actually abused and there is a proof (please don't post it publicly) then inform the security team of Magento. It highly depends on the usage of jQuery in Magento. Also no user can change the generated JS code. We might just have to check if all XHR requests done by jQuery set the proper data type to prevent the processing by |
lib/web/jquery/jquery.min.js looks like it is at 1.12.x at the moment. I’m on my phone I’ll have to do a more exhaustive search Monday when I’m back to work. |
https://github.com/magento/magento2/blob/2.2-develop/lib/web/jquery.js But replacing it with jQuery 2 or 3 will break things for sure. |
@daniel many pci scanners utilize the existence of the outdated .js file as a flag for failure. Simply loading it is enough to trigger the scan to detect it whether or not magento is using the compromised functions. Anything that causes a Medium to High can be considered a failure. |
Sure, but upgrading will be an epic (multiple issues) and not be a simple "fix". |
I don’t have access to anything to organize an epic. I’m used to setting them up in Jira, so I probably could at least identify all the affected files and create tickets for all of them, or at least their modules. |
This would be helpful. And probably one extra ticket which is linked from the others where we can see the current state (open / closed). |
This is just FYI, but it looks like there is already some action going on for upgrading jQuery to v3 and adding support to other libraries for that version, just search through the PR's: https://github.com/magento/magento2/pulls?utf8=%E2%9C%93&q=is%3Apr+jquery |
Where do these tickets go? Where’s the ticket system. I’m not a project team developer with access like that. |
@mitcht these are normal pull requests which reference normal issues of magento/magento2 afaik. Or what exactly do you mean? |
I'm pushing this one forward: #14637 |
Do we have a backport for 2.2-develop? |
Jquery is consumed mostly by the RWD theme. It Could be used all the way to 1.9 |
@DanielRuf @mitcht Not sure about backporting so far. It has backward-incompatible changes. |
Can existing versions not be patched by adding the proper ajaxPrefilter to the end of the jQuery file? This should emulate the fix for the CVE - users will still need to dispute / false positive on PCI scans.
After adding this patch, running the XSS check in the console turns up that it's no longer vulnerable: |
Hey all. I'd like to see us land a fix for this to mitigate the current risks. Some comments:
I've created a gist with the fix I'd like to see contributed. Do we have any volunteers to open the PR and carry this through to the finish line? |
@DrewML Oh come one, you told me that back in Milan, in April. P.S. 3 months is enough time for vendors to patch code, if you give notice. |
@kirmorozov I'm not strictly against an eventual upgrade to jQuery 3, but for a security fix I want the minimal amount of changes necessary so it can be shoved into a release and moved along. I'm not involved in the current processing of those 3 PRs you have mentioned, but it's likely there are higher priority items that are being addressed at the moment. |
@DrewML I like your idea - only concern would be that the preFilter code should run immediately after jQuery is included without the possibility of any other code running before it. I assume you've done the research to ensure that base file is the right location? |
@cadencelabs-master Yeah, so the order of execution is roughly:
Everything happens synchronously so it should be the correct order unless something changes about the merging logic. You do make a good point, though. It might be better if we can make it obvious in the code that execution order is important. We could map requests for jQuery to // jquery-init.js
define(['jquery'], function ($) {
$.noConflict();
// XSS patch code
return $;
}); The only painful parts there will be setting up the RequireJS config in such a way that:
|
I thought there was no upstream patch? Also wouldn't break this some things? And I guess this should be done with This here is just some "workaround" to fix it somehow. |
Also I think this can only land in 2.3 as it will break many things. |
Appreciate the input, @DanielRuf.
There is not. However, the CVE is due to bad defaults. A "fix" is to correct those defaults so you have to explicitly opt-in to dangerous behavior - this is what the snippet above addresses.
It will break any code that is making a request with
Can't speak to
I did a diff (ignoring whitespace) and the lib was identical to the official copy. Looks like we adjusted formatting |
@mitcht, thank you for your report. |
Issue already fixed in 2.3 |
Thanks for the concern for all of us 1.x users. |
Issue already fixed in 2.2.7 release. |
Preconditions
Steps to reproduce
Expected result
Actual result
This vulnerability applies to Magento 2.x and Magento 1.x
jQuery is vulnerable to Cross-site Scripting (XSS) attacks when a cross-domain Asynchronous JavaScript and Extensible Markup Language (AJAX) Request is performed without the dataType option, causing text/javascript responses to be executed. This finding is based on version information which may not have been updated by previously installed patches (e.g., Red Hat "back ports"). All Cross-Site Scripting vulnerabilities are considered non-compliant by PCI.
CVE: CVE-2015-9251 http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-9251
NVD: CVE-2015-9251
CVSSv2: AV:N/AC:M/Au:N/C:N/I:P/A:N
Service: http
Application: nginx:nginx
Reference:
jquery/jquery#2432
https://snyk.io/vuln/npm:jquery:20150627
Evidence:
Match: '1.12.4' is less than '3.0.0'
Remediation:
Upgrade jquery to version 3.0.0 or higher.
The text was updated successfully, but these errors were encountered: