New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 674806 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

window.crypto

Reported by srikuma...@gmail.com, Dec 16 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

Steps to reproduce the problem:
1. Load crypto.html in Chrome
2. You'll see "crypto's been pwned!"

What is the expected behavior?
You should see "crypto is safe. [object Crypto]" instead.

What went wrong?
The "window.crypto" property should not be "configurable". If it is, then it can be made temporarily writable and replaced with an implementation that can hijack all crypto calls for malicious purposes. The current value of Object.getOwnPropertyDescriptor(window, "crypto") is writable = false, enumerable = true, configurable = true. It should be writable = false, enumerable = true, configurable = false.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 54.0.2840.98  Channel: n/a
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 24.0 r0
 
crypto.html
1.0 KB View Download

Comment 1 Deleted

Also, I expect the entire object tree under "window.crypto" to be non-configurable and non-writable - i.e. "frozen".

Comment 3 Deleted

Adding 'Needs-Milestone' label, TE will check the issue and update the bug with comments & tag with respective Mstone
Cc: msrchandra@chromium.org
Labels: Needs-Feedback
@srikumarks -- Thank You for the report.
Navigated to the html file and observed the text, "crypto's been pwned!"

The same behavior is being seen on Firefox also.
Could you please re-check again and provide us the update.
Thanks in Advance.
Yes it is the same behaviour in Firefox too!
For the record, the WebCryptoAPI specification (https://www.w3.org/TR/WebCryptoAPI/) does not seem to say anything specific about the attributes of window.crypto. While that would make the current implementation conformant, it certainly isn't safe for it to be configurable if web devs are expected to be able to trust it.
Project Member

Comment 8 by sheriffbot@chromium.org, Jan 2 2017

Labels: -Needs-Feedback Needs-Review
Owner: msrchandra@chromium.org
Thank you for providing more feedback. Adding requester "msrchandra@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Needs-Review
Owner: ----
Could some one from Security team please look into the issue and update.
Thanks in Advance.

Comment 10 by ajha@chromium.org, Jan 17 2017

Cc: ajha@chromium.org
Labels: -Type-Bug -Pri-2 -Needs-Milestone M-57 hasbisect OS-Linux OS-Windows Pri-1 Type-Bug-Regression
Owner: yukishiino@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on the latest canary(57.0.2984.0) on Windows-10, Mac OS 10.12.2 and Linux Ubuntu 14.04. This is working the same on Firefox and IE. 

This changed behavior on Chrome in M-51.

Last good build: 51.0.2680.0
First bad build: 51.0.2681.0

Changelog: https://chromium.googlesource.com/chromium/src/+log/342f187bb5ba4f9ec5e7f0ea4018f54b682922da..607c6e18aae50211a534f964ebfdac47cdbf21be

Yuki@: Could this be related to https://codereview.chromium.org/1667653002
Cc: domenic@chromium.org
Labels: -Pri-1 Pri-2
+domenic@, do you have any advice on this issue?

The current behavior is by-design and, as the reporter wrote in #7, the current implementation is conformant to the current spec.  From this point of view, there is no problem.

It's possible that the current spec is not secure and needs a fix, but I'm not sure.  Given that you can run arbitrary script on the window (e.g. defineProperty), you can do anything in general not limited to window.crypto.  If you're running a harmful script, it's too late.  IMHO, making window.crypto unconfigurable doesn't help much.  If the script were harmful, then that script can rewrite a whole page to do phishing for example.

re: #10, my CL is not relevant and it's working fine by design.  We can technically make window.crypto unconfigurable with one-line-change, but I don't think we need to do so so far.
Yes, we should close this as working as intended.

This is the wrong level at which to solve the problem. If people are running arbitrary script inside your web page, then you are already irretrievably insecure. You need to mitigate that through measures such as HTTPS, CSP (nonces etc.), and so on.

The proper forum for this discussion is the web crypto spec repository, but I can guarantee they will give you the same answers.
Understand. I've noted this as an issue in that repo - https://github.com/w3c/webcrypto/issues/169

Scripts can also run via browser extensions.
Status: WontFix (was: Assigned)

Sign in to add a comment