Hi, I have tried my best to give the best explanation of this bug to make sure our beloved Zotero (for real :)) stays safe as it can be! Hope to work with you on a quick fix for that soon enough! Thanks a lot!
Description is as follows:
Zotero version: 5.0.86 (May 28, 2021)
Chrome version: 91.0.4472.77
OS version: Windows 10 Home 19042.985
When Zotero update and get new translators code – it doesn’t validate authenticity of the files.
Hence, attacker can exploit this, using a limited permissions chrome-app to exploit and run JS code inside Zotero content-scripts with all of Zotero’s permissions. This can be also exploited from low-priv app running on PC.
Relevant Vulnerable lines:
Actually the call for getTranslatorsCode, which always try first to reach the local Zotero Server running on PC – will download from localhost at TCP port 23119 all of the translators JS files.
PoC & Reproduce Instructions:
This PoC shows an exploit where one low-privilege chrome-app exploits Zotero to gain more privileges. Attacker can use this as a way to gain limit-less access to any site!!!
Poc Video: https://youtu.be/3Rz_M6SJWX8
Steps to reproduce:
1. Download “Mappy” chrome-app from here (just checkout all directory):
https://github.com/barakolo/ExtensionExploiter/
2. Install this github as a chrome-app, its name will be “Mappy”.
a. goto chrome://extensions
b. switch to developer mode.
c. Then click – “load unpacked” – click over the downloaded “Mappy” directory.
d. Observe – that this “Mappy” chrome-app – have no permissions to any site!!!
3. Open your own server listener in: http://localhost:8080/ (This will get victim’s data – this can be any site controlled by attacker and not just localhost).
4. Restart Zotero – and open new tab – in google.com for example.
5. You will now see that the backend server (stage 3) – gets all cookies / running js in google context.
What can be a fix for that?
The easiest way would be to disable download of translators code over Zotero localhost RPC, and user only verified Zotero HTTPS servers for downloading new JS files and executables.
But if one wants to add some more features/extensibility for users – then adding validation when downloading any JS file – and also verify it has a valid translator hash – using previously given set of valid hashes downloaded from trustworthy source, such as Zotero github or something like that? Then, when downloading new JS files – validate its hash is one of these hashes previously downloaded. Also, update the hashes from time to time to allow users to update translators code and add more of it over again.
This translator code can be a security hazard, and can really take over Zotero from other extensions/apps in other contexts as well, hence elevating privileges and can be a useful stuff in other type of attacks as well.