Skip to content
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

Minimise token_auth exposure, hide token_auth from html responses #4171

Closed
anonymous-matomo-user opened this issue Sep 22, 2013 · 5 comments
Closed
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@anonymous-matomo-user
Copy link

After discussing with Matthieu Aubry. The original report:

Severity: Critical
Exploitabiliy: Medium
PIWIK version: Piwik 1.12

Consequences:
The risk of leaking a token_auth is very high, which leads to the complete compromise of the account.

Description:
The documentation clearly states that the token_auth is like a password and it should be handled as such. Unfortunately the application doesn't do so. In the same way as passwords are not shown on pages, they shouldn't ever sent back to the client, token_auth should be disclosed in any way.

At the moment token_auths are shown on pages (at least on the admin's users page), stored in hidden input fields in forms, thus, sent in requests. This could potentially lead to the leakage of the token_auth in browser cache, proxy cache.

Although the browser cache can be controlled from the server, but it is not trivial and very much depends on the type of the browser what will it do. If it saves the responses, then an attacker can steal token_auths either by accessing the cache from the browser, or stealing the cache from the filesystem.

Proof-of-Concept:
It was shown that a response with token_auth has been saved in the browser's memory cache. This means that if an attacker has access to a browser that was used to browse PIWIK recently, then he can steal the token_auth. Since not every occurrence of the token_auth was tested it is also possible that some responses would also be saved on the disk.

Recommendation:
The token_auth should never be disclosed as passwords are not disclosed either.

@anonymous-matomo-user
Copy link
Author

Attachment: Cached response
cache-header-screenshot.png

@anonymous-matomo-user
Copy link
Author

Attachment: token_auth in cached response
cache-token-auth-screenshot.png

@mattab
Copy link
Member

mattab commented Sep 22, 2013

Thank you for the suggestion. The way Piwik UI works at present is that it gets the token from the page, to use to sign the API request (the Piwik UI calls the API in the controller, or directly via ajax).

when we hide the token from the response as per this ticket, we will need a new way to authenticate to the API. Simply allowing API to read the current cookie/session would not work as it would open Piwik to CSRF if used logged in....?

proposal: we could change API authentication so it does not require token_auth, but can also be authenticated using a special token / Nonce, that will be valid only for this session.

@mattab
Copy link
Member

mattab commented Jun 2, 2014

see also #6559
See also #4616 Admin UI: mitigate the display of token_auth on screen

@anonymous-matomo-user anonymous-matomo-user added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab removed the P: normal label Aug 3, 2014
@mattab mattab modified the milestones: Piwik 2.8.0, Mid term Sep 26, 2014
@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Sep 26, 2014
@mattab mattab modified the milestones: Short term, Piwik 2.8.0 Sep 26, 2014
@mattab mattab removed the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Dec 1, 2014
@mattab mattab modified the milestones: Mid term, Short term Dec 1, 2014
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
@mattab
Copy link
Member

mattab commented Jul 8, 2020

Is this maybe now fixed with the App passwords #6559 ?

@tsteur tsteur closed this as completed Jul 8, 2020
@mattab mattab changed the title Minimise token_auth exposure, hide from piwik html responses Minimise token_auth exposure, hide token_auth from html responses Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

3 participants