{
	"id": "707c2713-a7ed-47c2-9620-aa5d64735f80",
	"created_at": "2023-01-12T15:01:06.539218Z",
	"updated_at": "2026-11-18T02:05:25.530429Z",
	"deleted_at": null,
	"sha1_hash": "06bf07e5b822e4cd632f8e4f44d0a2cad2dab39a",
	"title": "2017-10-19 - A deeper look at Tofsee modules",
	"llm_title": "2017-10-19 - A deeper look at Tofsee modules",
	"authors": "",
	"file_creation_date": "2022-05-28T03:33:13Z",
	"file_modification_date": "2022-05-28T03:33:13Z",
	"file_size": 306285,
	"plain_text": "1/9\r\nA deeper look at Tofsee modules\r\ncert.pl/en/news/single/a-deeper-look-at-tofsee-modules/\r\nTofsee is a multi-purpose malware with wide array of capabilities – it can mine bitcoins, send\r\nemails, steal credentials, perform DDoS attacks, and more. All of this is possible because of\r\nits modular nature.\r\nWe have already published about Tofsee/Gheg a few months ago –\r\nhttps://www.cert.pl/en/news/single/tofsee-en. Reading or at least skimming it is probably\r\nrequired to fully understand this post. Note that it is meant as an extension of that research,\r\nfocusing on plugin functionality that we previously ignored. We will shortly summarize each\r\nplugin and highlight its most important features.\r\nThe post is rather long – for the impatient, list of hashes and table of contents in one:\r\nResource Id DLL name DLL MD5 hash\r\n1 ddosR.dll fbc7eebe4a56114e55989e50d8d19b5b\r\n2 antibot.dll a3ba755086b75e1b654532d1d097c549\r\n3 snrpR.dll 385b09563350897f8c941b47fb199dcb\r\n4 proxyR.dll 4a174e770958be3eb5cc2c4a164038af\r\n5 webmR.dll 78ee41b097d402849474291214391d34\n\n2/9\r\nResource Id DLL name DLL MD5 hash\r\n6 protect.dll 624c5469ba44c7eda33a293638260544\r\n7 locsR.dll 2d28c116ca0783046732edf4d4079c77\r\n10 hostR.dll c90224a3f8b0ab83fafbac6708b9f834\r\n11 text.dll 48ace17c96ae8b30509efcb83a1218b4\r\n12 smtp.dll 761e654fb2f47a39b69340c1de181ce0\r\n13 blist.dll e77c0f921ef3ff1c4ef83ea6383b51b9\r\n14 miner.dll 47405b40ef8603f24b0e4e2b59b74a8c\r\n15 img.dll e0b0448dc095738ab8eaa89539b66e47\r\n16 spread.dll 227ec327fe7544f04ce07023ebe816d5\r\n17 spread2.dll 90a7f97c02d5f15801f7449cdf35cd2d\r\n18 sys.dll 70dbbaba56a58775658d74cdddc56d05\r\n19 webb.dll 8a3d2ae32b894624b090ff7a36da2db4\r\n20 p2p.dll e0061dce024cca457457d217c9905358\r\n1. ddosR.dll\r\nOriginal filename: p:\\cmf5\\small2\\plugins\\plg_ddos\\ddos.cpp\r\nThis plugin can perform DDOS attacks. Implemented attacks are not very complicated, for\r\nexample request spamming (HTTP Flood):\r\nOr plain old SYN flood (using PassThru driver, aka grabb module).\r\nWe haven’t observed any DDoS activity from Tofsee yet, so this plugin is probably not used\r\nby the botmaster.\r\nConfiguration from the C\u0026C for this plugin is very simple:\r\nThe binary contains a lot of strings, what simplifies analysis greatly:\r\n2. antibot.dll\r\nOriginal filename: z:\\cmf5\\small2\\plugins\\plg_antibot\\plugin.cpp\r\nNow, this is an interesting plugin, because it removes other malware from victim’s computer.\n\n3/9\r\nIt can:\r\nenumerate processes and kill ones that may be dangerous (search by configured\r\nnames)\r\nsearch SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper\r\nObjects registry branch, and remove bad browser helper objects\r\nenumerate mutexes and kill processes that own them (search by mutex names).\r\nList of browser helper objects removed by this module (downloaded from C\u0026C):\r\n3. snrpR.dll\r\nOriginal filename: p:\\\\cmf5\\\\small2\\\\plugins\\\\plg_sniff\\\\sniff.cpp\r\nRelated config section:\r\nCommunication is sniffed and replaced using PassThru driver (accessible through named\r\npipe “\\\\\\\\.\\\\PassThru”)\r\nmail.sniff enables stealing mail addresses from incoming e-mails. Mail\r\naddresses are stolen from “From” and “To” fields. It also looks for entities\r\n“%40″,”#64″,”#064” in content (looking for “@” char).\r\nftp.sniff and pop.sniff enables POP3 and FTP credentials stealing. The plugin is\r\nlooking for “user” and “pass” protocol commands, gets authentication data and\r\nsends through Passthru driver.\r\nmail.replace functionality replaces incoming e-mails using a specified template\r\n(stored in ‘mailbody’ key of config)\r\nTemplate example that we received (despite this function being turned off right now):\r\nIt leaves original “From” and “To” headers (%FROM_LINE, %TO_LINE), has the ability to\r\nleave original subject (%SUBJ, %_SUBJ), and original timestamps (%DATE, %P5DATE,\r\n%M5DATE).\r\n4. proxyR.dll\r\nOriginal filename: p:\\\\cmf5\\\\small2\\\\plugins\\\\plg_proxy\\\\plugin.cpp\r\nThis plugin listens for TCP connections on 0.0.0.0:1080 and provides multithreaded SOCKS\r\nproxy server. The sample we analyzed identifies itself in Proxy-Agent HTTP header as\r\nWinRoute Pro/4.1.\r\nTraffic is redirected to addresses specified at a proxy_cfg section, separately for each region.\n\n4/9\r\nAddresses are specified as a reference to a work_srv list or directly.\r\nIn proxy_cfg we can also find some defined timeouts for a socket.\r\nWhen any value is missing in configuration, binary has some sane defaults inside.\r\nPlugin also adds port mapping using UPNP, disguising itself as Skype:\r\nStrings from the binary give a little more insight about the purpose of this plugin:\r\n6. protect.dll\r\nOriginal filename: z:\\cmf5\\small2\\plugins\\plg_protect\\plugin.cpp\r\nThis plugin downloads and installs malicious service in system:\r\nMalicious service binary is obfuscated with “state-of-the-art encryption algorithm” – i.e.\r\nnegating every byte:\r\nMd5 of decrypted backdoor = 49642f1d1b1673a40f5fa6263a66d056. This file is protected by\r\npacker, and it’s the only packed binary that we observed during our analysis of Tofsee – it\r\nsuggests that the binary could’ve been created by another actor and reused in Tofsee.\r\n7. locsR.dll\r\nOriginal filename: z:\\cmf5\\cmf5\\small2\\plugins\\plg_locs\\plg.cpp\r\nThis plugin steals network credentials for Microsoft Outlook:\r\nAfter extracting them from the registry, they are decrypted and used to send more emails.\r\nAdditionally, it generates email in form [computer name]@mail.ru and attempts to send\r\nemails using it (with raw SMTP protocol).\r\nStrings from binary:\r\n10. hostR.dll\r\nThis is HTTP server plugin. It masquerades as Apache/2.2.15 (Win32). It can serve files,\r\nprobably for other bots.\r\nIt is able to blacklist some IPs – probably security analysts (for example Forcepoint and\r\nGoogle are banned).\r\nConfiguration for this module, fetched from the C\u0026C:\r\n11. text.dll\n\n5/9\r\nOriginal filename: p:\\cmf5\\small2\\plugins\\plg_text\\plg_text.cpp\r\nVery short plugin, it is able to process email templates downloaded from C\u0026C.\r\n12. smtp.dll\r\nVery important module – it generates and sends emails. It’s probably biggest module and\r\ncode is rather complicated sometimes.\r\nMost interesting thing about it is the fact that it uses its own dedicated scripting language for\r\ngenerating messages. Script example, received from C\u0026C:\r\nIf someone recognizes this as a real scripting language, we’d be grateful for the information.\r\nWe have never seen something like this, so we analyzed interpreter of this language.\r\nThe syntax is rather simple, but very assemblish and primitive. We hope that malware\r\nauthors are generating this scripts from a higher level language because writing something\r\nlike this must really hurt one’s sanity ;].\r\nA lot of opcodes are supported – take a look at this (simplified) parsing function for example:\r\nWe didn’t reverse all of them, but few most important ones are:\r\nC ip:port – Connect\r\nL lbl – Create Label lbl.\r\nJ lbl – Jump to label lbl.\r\nv name value – Create variable name and assign value value.\r\nW text – Write something to output – in this case to final email.\r\nI lbl condition – If condition is satisfied than jump to lbl\r\nAdditionally wrapping text in “”” allows for newlines and escape sequences in it, and\r\n__v(XX)__ is a variable interpolation.\r\nAgain, few from the most interesting strings from that binary:\r\nWe thought that IfYouAreReadingThisYouHaveTooMuchFreeTime is an easter egg for us,\r\nmalware analysts, but it turns out that it’s just a strange quirk related to hotmail\r\nauthentication.\r\nConfiguration for this module, fetched from C\u0026C:\r\n13. blist.dll\r\nThis plugin checks if a bot is listed as a spambot and blacklisted. In the config we observed\r\nfollowing DNSBLs (DNS-based Blackhole Lists) were supplied:\n\n6/9\r\nDNSBL is a service based on DNS used for publishing IP addresses of spam senders. If\r\nspam server uses DNSBL filters, it will do a DNS request to DNSBL domain with each\r\nincoming SMTP connection. Technical details are outside of the scope of this post, but any\r\ninterested reader can take a look at http://www.us.sorbs.net/using.shtml or\r\nhttps://en.wikipedia.org/wiki/DNSBL.\r\nChecking DNSBL is implemented with gethostbyname:\r\nConfiguration for this module, fetched from C\u0026C:\r\n14. miner.dll\r\nThis is (as the name suggests) cryptocurrency miner. This plugin only coordinates the work,\r\nbut it has few accompanying binaries, that perform the dirty work.\r\nOne binary, called grabb, is distributed straight from the C\u0026C. Other binaries are\r\ndownloadable through URLs specified in configs – in theory. In practice, servers distributing\r\nminers seem to be dead, so we were not able to download miners.\r\nMiner “verifies” that has really downloaded right binary, but hashing was probably too difficult\r\nfor malware creators to implement, so they settled on size verification – for example, they are\r\ncheck that cores_gt_1 binary has exactly 223744 bytes.\r\nWe didn’t analyze it in-depth because crypto miners are boring enough, and strings from\r\nbinary give enough information about inner workings anyway:\r\nAnd the rest can be read from the configuration, fetched from C\u0026C:\r\n15. img.dll\r\nThis short plugin processes malicious attachments – encodes them with base64 and\r\nappends to emails.\r\nNothing interesting here, as can be seen in hardcoded strings:\r\nConfiguration for this module, fetched from the C\u0026C:\r\n16. spread.dll\r\nFirst, it extracts xs, datr, c_user (and more) cookies.\r\nExact method depends on the browser, but generally plugin reads cookies stored on disk by\r\nthe browser – for example cookies.sqlite from \\Mozilla\\Firefox\\Profiles, for Firefox. Supported\r\nbrowsers are Chrome, IE, Firefox, Safari, and Opera.\r\nAfter that, plugin uses that cookies to impersonate user in facebook API:\n\n7/9\r\nList of friends is downloaded through API and a message is sent to them. Format of\r\nmessage is stored in configuration, for example:\r\n‘fb.message1’: ‘%SPRD_TEXT1|%LANG_ID| %SPRD_URL1’\r\nTwitter is handled very similarly: cookies are stolen, followers are downloaded by API call to\r\nhttps://twitter.com/followers, and messages are sent.\r\nVKontakte also seems to be supported, but that functionality is optional and held in another\r\nplugin. This module only checks if VK is enabled in config and calls handler (that can be\r\ninitialized from another plugin), if it’s defined. Malware creators usually don’t like to attack\r\nRussia, so this function is disabled and VKontakte plugin is not distributed.\r\nPlugin can also spread itself through Skype, but reverse engineering Skype protocol was\r\nclearly too hard for malware authors, so plugin waits until Skype is started, and then sends\r\nwindows messages to Skype window:\r\nThe plugin has dozens of strings hardcoded, so analyzing it in disassembler is a breeze. Few\r\nmore interesting groups:\r\nReferences to the OCR plugin – to avoid captchas:\r\nFacebook cookies:\r\nStrings related to Facebook spread:\r\nStrings related to cookie stealing:\r\nStrings related to Skype hijacking:\r\nTwitter cookies:\r\nAnd Twitter spread:\r\nFinally, things needed to send stolen cookies somewhere:\r\nRich functionality means rich configuration from the C\u0026C:\r\n17. spread2.dll\r\nThis plugin uses methods more than 15 years old, and tries to spread Tofsee through…\r\ninfected USB drives! This doesn’t sound like an effective idea for A.D. 2017, but despite that,\r\nthe plugin is still enabled.\r\nFirst it copies malicious binary into RECYCLER\\\u003crandom_gibberish\u003e.exe file on the USB\r\ndrive, then sets READONLY and SYSTEM attributes on that file, and finally writes malicious\r\nautorun.inf file:\n\n8/9\r\nThe malicious binary that will be spread is downloaded from the internet (see also sys.dll\r\nplugin and %FIREURL variable).\r\nNothing too interesting in hardcoded strings, except operation logs:\r\nConfiguration for this module, fetched from the C\u0026C:\r\n18. sys.dll\r\nThis plugin seems to be a downloader or rather an updater. It sends requests, depending on\r\na value of the %FIREURL configuration variable.\r\nExample values of the %FIREURL variable (one per line):\r\nVariables are expanded recursively, and %SYS_RN means \\r\\n of course, so first possible\r\nvalue can be read as:\r\nIf we send this request to that IP address on port 80, we will get yet another malicious binary.\r\nDifferent requests lead to different binaries.\r\nIf a request is invalid, or not supported, following image is sent instead:\r\nWe appreciate the humor.\r\nNothing surprising in hardcoded strings:\n\n9/9\r\nConfiguration for this module, fetched from the C\u0026C:\r\nAdditionally the %FIREURL variable from config is used.\r\n19. webb.dll\r\nThis plugin tries to locate iexplore.exe process. If this succeeds, it injects DLL file called\r\nIEStub.dll to this process.\r\nIEStub.dll hooks a lot of functions from iexplorer. List of hooked functions:\r\nHooks intercept called functions and can change their parameters. We haven’t analyzed\r\nhooks in depth, but most of them seem to be loggers intercepting “interesting” data from\r\nparameters – We haven’t observed any web injects served by Tofsee.\r\nFor completeness, interesting hardcoded strings:\r\nConfiguration for this module, fetched from the C\u0026C:\r\n20. P2P.dll\r\nOriginal filename: p:\\cmf5\\small2\\plugins\\plg_p2p\\plg_p2p.cpp\r\nThis plugin is rather short. Despite promising name, it’s rather boring – opening a port on a\r\nrouter and listening for connection is the most important thing it does. It doesn’t implement\r\nany commands, this is left for the main module to handle.\r\nLike almost every module, it logs to %TMP%\\log_%s.txt, and when this fails falls back to\r\nC:\\log.txt.\r\nAlso adds port mapping using UPnP, in the same way as plugin 4 (proxyR.dll).\r\nConfiguration for this module, fetched from the C\u0026C:\r\nInteresting strings:",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"VXUG"
	],
	"origins": [
		"pdf"
	],
	"references": [
		"https://papers.vx-underground.org/papers/Malware Defense/Malware Analysis 2017/2017-10-19 - A deeper look at Tofsee modules.pdf"
	],
	"report_names": [
		"2017-10-19 - A deeper look at Tofsee modules.pdf"
	],
	"threat_actors": [],
	"ts_created_at": 1673535666,
	"ts_updated_at": 1794967525,
	"ts_creation_date": 1653708793,
	"ts_modification_date": 1653708793,
	"files": {
		"pdf": "https://archive.orkl.eu/06bf07e5b822e4cd632f8e4f44d0a2cad2dab39a.pdf",
		"text": "https://archive.orkl.eu/06bf07e5b822e4cd632f8e4f44d0a2cad2dab39a.txt",
		"img": "https://archive.orkl.eu/06bf07e5b822e4cd632f8e4f44d0a2cad2dab39a.jpg"
	}
}