{"id":86,"date":"2018-01-13T16:45:28","date_gmt":"2018-01-13T16:45:28","guid":{"rendered":"http:\/\/malwrforensics.com\/en\/?p=86"},"modified":"2018-01-14T04:40:08","modified_gmt":"2018-01-14T04:40:08","slug":"fysbis-backdoor-analysis","status":"publish","type":"post","link":"https:\/\/malwrforensics.com\/en\/2018\/01\/13\/fysbis-backdoor-analysis\/","title":{"rendered":"Fysbis backdoor analysis"},"content":{"rendered":"<p align=\"left\"><a href=\"http:\/\/researchcenter.paloaltonetworks.com\/2016\/02\/a-look-into-fysbis-sofacys-linux-backdoor\/\" target=\"_blank\" rel=\"noopener\">Reportedly<\/a>\u00a0the Fysbis backdoor has been used by the Sofacy(APT28) group in targetted attacks against defense organizations and East European governments. The malware has both 32 and 64-bit versions, but in this article we will show snippets from the latter one.<\/p>\n<p align=\"left\">As the program starts, it will check if it&#8217;s not already running and if not, it will install and start itself.<\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-87\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/start-300x288.png\" alt=\"\" width=\"454\" height=\"436\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/start-300x288.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/start.png 519w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/p>\n<p align=\"left\">To detect if it&#8217;s running it will first grep the process list:<\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-88\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/ps_grep-300x79.png\" alt=\"\" width=\"456\" height=\"120\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/ps_grep-300x79.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/ps_grep.png 515w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/p>\n<p align=\"left\">Next it will try to gain root privileges. If it succeeds, the drops itself in the \/bin folder with the name rsyncd, otherwise it will choose the\u00a0<tt><b>~\/.config\/dbus-notifier<\/b><\/tt>\u00a0with the name\u00a0<b>dbus-inotifier<\/b>. The malware checks if it is set to start automatically at startup. It does that by searching the active process list for the systemd process. If this process is found, it will recursively search the\u00a0<tt><b>\"\/usr\/lib\/systemd\/\"<\/b><\/tt>\u00a0folder and check every file for the\u00a0<tt><b>\"\/bin\/rsyncd\"<\/b><\/tt>\u00a0string.<\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-89\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/grep_usr_lib_systemd-300x197.png\" alt=\"\" width=\"458\" height=\"301\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/grep_usr_lib_systemd-300x197.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/grep_usr_lib_systemd.png 608w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/p>\n<p align=\"left\">f it doesn&#8217;t have root privileges, it checks the\u00a0<tt><b>~\/.config\/autostart\/<\/b><\/tt>\u00a0directory for the\u00a0<tt><b>dbus-inotifier<\/b><\/tt>\u00a0file.<\/p>\n<p align=\"left\">If the malware isn&#8217;t running and the program has root privileges it will try to create a service file and launch itself.<\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-90\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/systemd_not_running-300x164.png\" alt=\"\" width=\"474\" height=\"259\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/systemd_not_running-300x164.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/systemd_not_running.png 357w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/p>\n<p align=\"left\">To do that it will create the\u00a0<tt><b>rsyncd.service<\/b><\/tt>\u00a0unit configuration file in\u00a0<tt><b>\/usr\/lib\/systemd\/system\/<\/b><\/tt><\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/rsyncd_service_unit_file-300x96.png\" alt=\"\" width=\"478\" height=\"153\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/rsyncd_service_unit_file-300x96.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/rsyncd_service_unit_file.png 380w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/p>\n<p align=\"left\">Afterwards it installs &amp; launch the service by executing the following commands:<\/p>\n<table>\n<tbody>\n<tr>\n<td><tt><b>ln -s '\/lib\/systemd\/system\/rsyncd.service' '\/etc\/systemd\/system\/multi-user.target.wants\/rsyncd.service'<\/b><\/tt><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-92\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/install_service-300x98.png\" alt=\"\" width=\"603\" height=\"197\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/install_service-300x98.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/install_service.png 549w\" sizes=\"auto, (max-width: 603px) 100vw, 603px\" \/><\/p>\n<p><tt><b>systemctl daemon-reload<\/b><\/tt>\u00a0to reload the service<\/p>\n<p>If the backdoor doesn&#8217;t have root privileges, it creates the\u00a0<tt><b>~\/.config\/autostart\/dbus-inotifier.desktop<\/b><\/tt>\u00a0file with the following contents:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-93\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/dbus_notifier_desktop-300x89.png\" alt=\"\" width=\"496\" height=\"147\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/dbus_notifier_desktop-300x89.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/dbus_notifier_desktop.png 544w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/p>\n<p>It creates the directory\u00a0<tt><b>\/usr\/lib\/cva-ssys<\/b><\/tt>\u00a0to store its files its files in it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-94\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/mkdir_local_cva_ssys-300x111.png\" alt=\"\" width=\"495\" height=\"183\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/mkdir_local_cva_ssys-300x111.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/mkdir_local_cva_ssys.png 451w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/p>\n<p>In this folder it stores a sqlite3 database (named\u00a0<tt><b>My_BD<\/b><\/tt>) where it stores configuration data. The configuration is stored in a binary format in a table called\u00a0<b>chnnl<\/b>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-95\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/chnnl_table.png\" alt=\"\" width=\"380\" height=\"109\" \/><\/p>\n<p>The table has the following format:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-96\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/create_table-300x149.png\" alt=\"\" width=\"596\" height=\"296\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/create_table-300x149.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/create_table.png 508w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/p>\n<p>The backdoor will contact the command and control server (azureon-line.com) to register the infection and wait for commands:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-97\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/c2server-300x33.png\" alt=\"\" width=\"591\" height=\"65\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/c2server-300x33.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/c2server.png 578w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>The malware will send a request similar to the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-98\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/net_req-300x84.png\" alt=\"\" width=\"596\" height=\"167\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/net_req-300x84.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/net_req-768x214.png 768w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/net_req.png 840w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/p>\n<p align=\"left\">The backdoor allows for the following operations:<\/p>\n<table>\n<tbody>\n<tr>\n<td>control the main module that handles configuration data and plugins<\/td>\n<\/tr>\n<tr>\n<td>module that opens a remote shell and execute arbitrary commands<\/td>\n<\/tr>\n<tr>\n<td>module that interracts with the file system (example: exfiltrate data, set staging area, run additional malware, etc)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b>Commands supported by the shell module<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-99\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/shell_module-300x159.png\" alt=\"\" width=\"755\" height=\"400\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/shell_module-300x159.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/shell_module-768x406.png 768w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/shell_module.png 990w\" sizes=\"auto, (max-width: 755px) 100vw, 755px\" \/><\/p>\n<p><b>Commands supported by the filesystem module<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-100\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fs_module-300x157.png\" alt=\"\" width=\"705\" height=\"369\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fs_module-300x157.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fs_module.png 713w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/p>\n<p><a href=\"https:\/\/github.com\/asaygo\/fysbis_detect\">Here<\/a>\u00a0you can find a python tool to detect this backdoor:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-101\" src=\"http:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fysbis_scan-300x53.png\" alt=\"\" width=\"594\" height=\"105\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fysbis_scan-300x53.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fysbis_scan-768x136.png 768w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2018\/01\/fysbis_scan.png 815w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><\/p>\n<p align=\"left\">File information:<\/p>\n<table>\n<tbody>\n<tr>\n<td>SHA256<\/td>\n<td>8bca0031f3b691421cb15f9c6e71ce193355d2d8cf2b190438b6962761d0c6bb<\/td>\n<\/tr>\n<tr>\n<td>SHA1<\/td>\n<td>9444d2b29c6401bc7c2d14f071b11ec9014ae040<\/td>\n<\/tr>\n<tr>\n<td>MD5<\/td>\n<td>364ff454dcf00420cff13a57bcb78467<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Reportedly\u00a0the Fysbis backdoor has been used by the Sofacy(APT28) group in targetted attacks against defense organizations and East European governments. The malware has both 32 and 64-bit versions, but in this article we will show snippets from the latter one. As the program starts, it will check if it&#8217;s not already running and if not, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[22,21,11,18],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-security","tag-backdoor","tag-fysbis","tag-linux","tag-malware"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[]}},"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable_v2":"<p>Reportedly\u00a0the Fysbis backdoor has been used by the Sofacy(APT28) group in targetted attacks against defense organizations and East European governments. The malware has both 32 and 64-bit versions, but in this article we will show snippets from the latter one. As the program starts, it will check if it&#8217;s not already running and if not, it will install and start itself. To detect if it&#8217;s running it will first grep the process list: Next it will try to gain root privileges. If it succeeds, the drops itself in the \/bin folder with the name rsyncd, otherwise it will choose the\u00a0~\/.config\/dbus-notifier\u00a0with&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/malwrforensics.com\/en\/category\/security\/\" rel=\"category tag\">Security<\/a>","author_info_v2":{"name":"malwrforensics","url":"https:\/\/malwrforensics.com\/en\/author\/u_malwrforensics\/"},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":1,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/86\/revisions\/102"}],"wp:attachment":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}