Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the authenticity of a Chrome extension?

The Context:

  • You have a web server which has to provide an exclusive content only if your client has your specific Chrome extension installed.
  • You have two possibilities to provide the Chrome extension package:
    1. From the Chrome Web Store
    2. From your own server

The problem:

  • There is a plethora of solutions allowing to know that a Chrome extension is installed:
    1. Inserting an element when a web page is loaded by using Content Scripts.
    2. Sending specific headers to the server by using Web Requests.
    3. Etc.
  • But there seems to be no solution to check if the Chrome extension which is interacting with your web page is genuine.
  • Indeed, as the source code of the Chrome extension can be viewed and copied by anyone who want to, there seems to be no way to know if the current Chrome extension interacting with your web page is the one you have published or a cloned version (and maybe somewhat altered) by another person.
  • It seems that you are only able to know that some Chrome extension is interacting with your web page in an "expected way" but you cannot verify its authenticity.

The solution?

  • One solution may consist in using information contained in the Chrome extension package and which cannot be altered or copied by anyone else:
    1. Sending the Chrome extension's ID to the server? But how?
      • The ID has to be sent by you and your JavaScript code and there seems to be no way to do it with an "internal" Chrome function.
      • So if someone else just send the same ID to your server (some kind of Chrome extension's ID spoofing) then your server will consider his Chrome extension as a genuine one!
    2. Using the private key which served when you packaged the application? But how?
      • There seems to be no way to access or use in any way this key programmatically!
  • One other solution my consist in using NPAPI Plugins and embed authentication methods like GPG, etc. But this solution is not desirable mostly because of the big "Warning" section of its API's doc.
  • Is there any other solution?

Notes

This question attempts to raise a real security problem in the Chrome extension's API: How to check the authenticity of your Chrome extension when it comes to interact with your services. If there are any missing possibilities, or any misunderstandings please feel free to ask me in comments.

like image 386
fsenart Avatar asked Sep 17 '12 13:09

fsenart


People also ask

Are Chrome extensions verified?

The Chrome Web Store may appear like a secure location for all your extension needs, but it is not. Google uses automated checks that scan extensions that developers upload to the store. These checks catch some but not all forms of privacy-invasive or outright-malicious functions.


1 Answers

I'm sorry to say but this problem as posed by you is in essence unsolvable because of one simple problem: You can't trust the client. And since the client can see the code then you can't solve the problem.

Any information coming from the client side can be replicated by other means. It is essentially the same problem as trying to prove that when a user logs into their account it is actually the user not somebody else who found out or was given their username and password.

The internet security models are built around 2 parties trying to communicate without a third party being able to imitate one, modify or listen the conversation. Without hiding the source code of the extension the client becomes indistinguishable from the third party (A file among copies - no way to determine which is which).

If the source code is hidden it becomes a whole other story. Now the user or malicious party doesn't have access to the secrets the real client knows and all the regular security models apply. However it is doubtful that Chrome will allow hidden source code in extensions, because it would produce other security issues.

Some source code can be hidden using NPAPI Plugins as you stated, but it comes with a price as you already know.


Coming back to the current state of things:

Now it becomes a question of what is meant by interaction.

If interaction means that while the user is on the page you want to know if it is your extension or some other then the closest you can get is to list your page in the extensions manifest under app section as documented here

This will allow you to ask on the page if the app is installed by using

    chrome.app.isInstalled

This will return boolean showing wether your app is installed or not. The command is documented here

However this does not really solve the problem, since the extension may be installed, but not enabled and there is another extension mocking the communication with your site.

Furthermore the validation is on the client side so any function that uses that validation can be overwritten to ignore the result of this variable.

If however the interaction means making XMLHttpRequests then you are out of luck. Can't be done using current methods because of the visibility of source code as discussed above.

However if it is limiting your sites usability to authorized entities I suggest using regular means of authentication: having the user log in will allow you to create a session. This session will be propagated to all requests made by the extension so you are down to regular client log in trust issues like account sharing etc. These can of course be managed by making the user log in say via their Google account, which most are reluctant to share and further mitigated by blocking accounts that seem to be misused.

like image 90
DeadAlready Avatar answered Oct 14 '22 16:10

DeadAlready