# Uncovering Tetris – a Full Surveillance Kit Running in your Browser **imp0rtp3.wordpress.com/2021/08/12/tetris** By imp0rtp3 August 12, 2021 ## Executive Summary A Chinese state sponsored threat actor is targeting Chinese-speaking opposition through waterholed websites. The Campaign uses a modular and custom JS surveillance framework, dubbed “Tetris”, implementing a wide range of browser feature. Almost all of Tetris’ components have zero AV detections. Tetris exploits vulnerabilities is 58 widely used websites, including Baidu, QQ, Tmall and the NYT. Two different waterholed websites have been found, there are indications to at least 5 more.. ## IntroductionLatest from the Blog This report is based on exemplary work by @felixaime, who found 2 waterholed websites which triggered all this research. As of the time of this writing, all the components of the framework are undetected by AV, except a 2nd stage detected by “Ikarus”. This report includes several detection and prevention ideas and indicators, for the web users and for developers. ----- ## Tetris Attack Chain ### Waterholed sites ----- Felix has found two sites containing links to the malicious domain googledrivers[.]com. The sites both appear to be independent newsblogs. Both are focused on China, one site on its actions against Taiwan and Hong-Kong written in Chinese and still updated and the other about general atrocities done by the Chinese government, written in Swedish and last updated 2016. 1st site waterhole link 2nd site waterhole script As seen in the code snippets, the waterhole is embedded differently in each site. Moreover, while the first site has every page infected with the script, The second has the waterhole only on its homepage. I believe this difference stems from the first site being managed by WordPress and thus enabling the attackers to inject their script tag in the default heading. 301 redirection response to /s/02Bl Both links redirect to a second path in the same domain (Status 301 redirection). The path is the same except the value of ‘ver’ GET argument, which I later discovered is called Project ID by the Tetris developers. ----- ### Jetriz Jetriz is a Javascript script which has undergone massive obfuscation. After deobfuscation(see Appendix D), it turns out most of the script is an obfuscated version of the known JS frameworks “fetch.js” and “core.js”. Each time the script is requested from the server a different uid variable is set for it, so there is no common hash. **[Update 13/08/21 – Arkbird introduced me to a public obfuscation framework named plainly “Javascript obfuscator” available here. The framework has different options which allow the attacker to](https://twitter.com/Arkbird_SOLG)** choose the sophistication of the obfuscated script. It is highly likely this framework was used to obfuscate the Tetris scripts. The custom functions of the script are simple: 1. Anti-debugging (the script detects if the developer tools sidebar is opened). 2. Basic browser information extraction. 3. Sending of the browser information, the current time and the sid back to the server. 1 `{` 2 `device:` `"PC"` `,` 3 `language:` `"zh_CN"` `,` ``` engine: "Blink", ``` 4 ``` browser: "Chrome", ``` 5 ``` os: "Windows", ``` 6 ``` osVersion: "10.0", ``` 7 `version:` `"91.0.4472.124"` 8 `}` 9 Jetriz before deobfuscation, not much fun to read:( ----- The response to the request depends on whether the browsers’ language is Chinese. If it’s not then “