<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>iot on SecMate Blog</title><link>https://blog.secmate.dev/tags/iot/</link><description>What we find. What we share.</description><generator>Hugo</generator><language>en-us</language><managingEditor>noreply@blog.secmate.dev//blog.secmate.dev/ (SecMate Team)</managingEditor><lastBuildDate>Tue, 25 Aug 2026 06:06:13 +0000</lastBuildDate><atom:link href="https://blog.secmate.dev/tags/iot/index.xml" rel="self" type="application/rss+xml"/><item><title>Four Vulnerabilities in Tuya's Arduino TuyaOpen Framework</title><link>https://blog.secmate.dev/posts/tuya-arduino-tuyaopen-vulnerabilities-disclosure/</link><pubDate>Thu, 21 May 2026 00:00:00 +0000</pubDate><dc:creator>Maxime Rossi Bellom</dc:creator><dc:creator>Ramtine Tofighi Shirazi</dc:creator><category>Security</category><category>Vulnerability Research</category><category>IoT</category><guid>https://blog.secmate.dev/posts/tuya-arduino-tuyaopen-vulnerabilities-disclosure/</guid><description>SecMate found four vulnerabilities across Tuya's Arduino framework libraries: DNSServer, TuyaIoT, WiFiMulti, and WiFiUDP. The attacker paths include same-LAN DNS and UDP traffic, malicious AP connections, and malicious DP events delivered through the Tuya cloud path.</description><content:encoded><![CDATA[<h1 id="four-vulnerabilities-in-tuyas-arduino-tuyaopen-framework">Four Vulnerabilities in Tuya&rsquo;s Arduino TuyaOpen Framework</h1>
<p>Tuya is an IoT platform vendor. Its developer documentation describes a public-cloud platform for smart-device development, covering hardware development tools, app tools, cloud services, and smart-industry development <a href="#ref1">[1]</a>.</p>
<p>SecMate found four vulnerabilities in <a href="https://github.com/tuya/arduino-TuyaOpen" rel="noopener noreferrer" target="_blank">arduino-tuyaopen</a> <a href="#ref2">[2]</a>, Tuya&rsquo;s Arduino framework for connected devices. The issues affect DNS parsing, Tuya Data Point handling, Wi-Fi credential storage, and UDP packet reception: <code>CVE-2026-28519</code>, <code>CVE-2026-28521</code>, <code>CVE-2026-28520</code>, and <code>CVE-2026-28522</code>.</p>
<p>The bugs are in reusable framework libraries. They do not form one exploit chain, and the evidence does not support a claim that every TuyaOpen device is affected.</p>
<p>All four issues were fixed in commit <code>54ac201</code> on February 25, 2026 <a href="#ref6">[6]</a>. The fixes later shipped in the <code>1.2.1</code> release line <a href="#ref8">[8]</a>.</p>
<h2 id="vulnerability-map">Vulnerability Map</h2>
<table>
<thead>
<tr>
<th>Area</th>
<th>Vulnerability</th>
<th>CVE</th>
<th>Affected code</th>
<th>Reachability</th>
</tr>
</thead>
<tbody>
<tr>
<td>DNSServer</td>
<td>DNS QNAME heap overflow</td>
<td><a href="https://secmate.dev/disclosures/SECMATE-2026-0001?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=tuya-arduino-tuyaopen-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="tuya-arduino-tuyaopen-vulnerabilities-disclosure" data-post-category="security"><code>CVE-2026-28519</code></a></td>
<td><code>libraries/DNSServer/src/DNSServer.cpp</code></td>
<td>Same-network DNS input when firmware exposes <code>DNSServer</code></td>
</tr>
<tr>
<td>TuyaIoT</td>
<td>Out-of-bounds read in DP event helper</td>
<td><a href="https://secmate.dev/disclosures/SECMATE-2026-0002?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=tuya-arduino-tuyaopen-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="tuya-arduino-tuyaopen-vulnerabilities-disclosure" data-post-category="security"><code>CVE-2026-28521</code></a></td>
<td><code>libraries/TuyaIoT/src/TuyaIoT.cpp</code></td>
<td>API boundary; caller passes unchecked <code>index</code></td>
</tr>
<tr>
<td>WiFiMulti</td>
<td>Heap off-by-one in Wi-Fi credential storage</td>
<td><a href="https://secmate.dev/disclosures/SECMATE-2026-0004?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=tuya-arduino-tuyaopen-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="tuya-arduino-tuyaopen-vulnerabilities-disclosure" data-post-category="security"><code>CVE-2026-28520</code></a></td>
<td><code>libraries/WiFi/src/WiFiMulti.cpp</code></td>
<td>API boundary; application passes SSID or passphrase to <code>addAP()</code></td>
</tr>
<tr>
<td>WiFiUDP</td>
<td>Null-pointer dereference in UDP receive path</td>
<td><a href="https://secmate.dev/disclosures/SECMATE-2026-0003?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=tuya-arduino-tuyaopen-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="tuya-arduino-tuyaopen-vulnerabilities-disclosure" data-post-category="security"><code>CVE-2026-28522</code></a></td>
<td><code>libraries/WiFi/src/WiFiUdp.cpp</code></td>
<td>Incoming UDP traffic under low-memory conditions</td>
</tr>
</tbody>
</table>
<h2 id="affected-code-and-use-cases">Affected Code and Use Cases</h2>
<p>The vulnerable implementations referenced in this post are from public repository code around commit <code>eaec2c903e2e629f9c53da789c39e12ea226d0b2</code> <a href="#ref2">[2]</a>. Public history places the affected paths between August and November 2024, with fixes landing on February 25, 2026 <a href="#ref3">[3]</a> <a href="#ref4">[4]</a> <a href="#ref5">[5]</a> <a href="#ref6">[6]</a>.</p>
<p><code>arduino-tuyaopen</code> ships as an Arduino board package for targets including <code>t2</code>, <code>t3</code>, <code>t5</code>, <code>ln882h</code>, and <code>esp32</code> <a href="#ref2">[2]</a>. The relevant libraries are used for captive-portal DNS handling, UDP packet reception, Wi-Fi connection fallback, and Tuya cloud DP processing.</p>
<p>At a reachability level, the DNS and UDP issues are adjacent-network issues: the attacker must be on the same LAN or AP-side network path as the device. The WiFiMulti issue is a local Wi-Fi/provisioning issue: the device must consume attacker-controlled AP or Wi-Fi credential data. The TuyaIoT DP issue is a device-control-path issue: attacker-controlled DP event data must reach the device through the Tuya cloud path.</p>
<p>A product does not inherit all four attack paths by default. Exposure depends on whether the affected library is present in the firmware and connected to the corresponding attacker-controlled input.</p>
<h2 id="recommendations">Recommendations</h2>
<ul>
<li>Update <code>arduino-tuyaopen</code> to the <code>1.2.1</code> release line or later, or to a commit containing <code>54ac201</code>.</li>
<li>If TuyaOpen libraries were vendored into firmware, check whether the February 25, 2026 fixes are present.</li>
<li>If firmware exposes captive-portal DNS handling, reject malformed or oversized QNAME inputs before copying into fixed buffers.</li>
<li>If firmware uses <code>WiFiUDP</code>, test receive paths under allocation failure and low-memory conditions.</li>
<li>Treat Wi-Fi provisioning data and Tuya DP indexes as untrusted unless the application enforces bounds before calling framework helpers.</li>
</ul>
<h2 id="timeline">Timeline</h2>
<div style="position: relative; padding-left: 1.5rem; margin: 1.5rem 0;">
  <div style="position: absolute; left: 0.35rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--color-border);"></div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">February 22, 2026</div>
    <div style="color: var(--color-text);">SecMate reports four issues in <code>arduino-tuyaopen</code> to Tuya Security.</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">February 25, 2026</div>
    <div style="color: var(--color-text);">The public fix commit lands in <code>arduino-tuyaopen</code> <a href="#ref6">[6]</a>.</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">March 11, 2026</div>
    <div style="color: var(--color-text);">Tuya SRC announcement <a href="https://src.tuya.com/announcement/32">32</a> is available.</div>
  </div>
  <div style="position: relative;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">March 12, 2026</div>
    <div style="color: var(--color-text);">SecMate publishes the four public disclosure pages linked in the vulnerability map.</div>
  </div>
</div>
<h2 id="takeaway">Takeaway</h2>
<p>The common issue is not Tuya cloud. It is memory safety in reusable firmware framework code. DNS helpers, UDP receive paths, Wi-Fi provisioning helpers, and cloud-event accessors often become part of product firmware.</p>
<p>The highest-confidence impacts are same-network memory corruption where the DNS helper is exposed, denial of service in UDP receive paths under low-memory conditions, and memory-safety failures in helper APIs that downstream firmware may treat as safe building blocks.</p>
<p>For the full list of our disclosures, see our disclosure page at <a href="https://secmate.dev/disclosures?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=tuya-arduino-tuyaopen-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="tuya-arduino-tuyaopen-vulnerabilities-disclosure" data-post-category="security">secmate.dev/disclosures</a>.</p>
<h2 id="references">References</h2>
<ul>
<li>
<p><a id="ref1"></a>[1] Tuya. &ldquo;Tuya Developer Platform.&rdquo; <a href="https://developer.tuya.com/en/docs/iot/introduction-of-tuya?id=K914joffendwh" rel="noopener noreferrer" target="_blank">Documentation</a></p>
</li>
<li>
<p><a id="ref2"></a>[2] Tuya. &ldquo;<code>arduino-tuyaopen</code> repository.&rdquo; <a href="https://github.com/tuya/arduino-TuyaOpen" rel="noopener noreferrer" target="_blank">Repository</a></p>
</li>
<li>
<p><a id="ref3"></a>[3] Tuya. &ldquo;<code>add ble&amp;wifi libraries</code> (<code>b6d68ec</code>, August 6, 2024).&rdquo; <a href="https://github.com/tuya/arduino-TuyaOpen/commit/b6d68ec1be2b67fd286a1d9f76d7d2a2a6041748" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref4"></a>[4] Tuya. &ldquo;<code>add http mqtt</code> (<code>89be820</code>, November 21, 2024).&rdquo; <a href="https://github.com/tuya/arduino-TuyaOpen/commit/89be82061b5892546ffb61dec303f5c3985bdee8" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref5"></a>[5] Tuya. &ldquo;<code>Update TuyaIoT libraries</code> (<code>53bf5bc</code>, August 27, 2024).&rdquo; <a href="https://github.com/tuya/arduino-TuyaOpen/commit/53bf5bcade07718a70737f55ece0481739f89e85" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref6"></a>[6] Tuya. &ldquo;<code>Fix security issues</code> (<code>54ac201</code>, February 25, 2026).&rdquo; <a href="https://github.com/tuya/arduino-TuyaOpen/commit/54ac201c458d040af49d375514f291360acc9ff9" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref7"></a>[7] Tuya SRC. &ldquo;Announcement 32.&rdquo; <a href="https://src.tuya.com/announcement/32" rel="noopener noreferrer" target="_blank">Announcement page</a></p>
</li>
<li>
<p><a id="ref8"></a>[8] Tuya. &ldquo;<code>1.2.0</code> to <code>1.2.1</code> comparison.&rdquo; <a href="https://github.com/tuya/arduino-TuyaOpen/compare/1.2.0...1.2.1" rel="noopener noreferrer" target="_blank">Repository diff</a></p>
</li>
</ul>
<hr>
<p><em>The SecMate Team</em></p>
]]></content:encoded><media:content url="https://blog.secmate.dev/images/og_image.png" medium="image"/></item><item><title>Six Vulnerabilities in Siemens SICAM SIAPP SDK</title><link>https://blog.secmate.dev/posts/siemens-siapp-sdk-vulnerabilities-disclosure/</link><pubDate>Wed, 15 Apr 2026 00:00:00 +0000</pubDate><atom:updated>2026-04-15T00:00:00+00:00</atom:updated><dc:creator>Maxime Rossi Bellom</dc:creator><dc:creator>Ramtine Tofighi Shirazi</dc:creator><category>Security</category><category>Vulnerability Research</category><category>IoT</category><guid>https://blog.secmate.dev/posts/siemens-siapp-sdk-vulnerabilities-disclosure/</guid><description>SecMate's automated analysis found six vulnerabilities in Siemens SICAM SIAPP SDK before 2.1.7, spanning UNIX socket helper flaws and sample application bugs used to build custom SIAPP applications. Five of the affected code paths were present in the public repository from June 2020; Siemens fixed all six in version 2.1.7 and published advisory SSA-903736 on March 10, 2026.</description><content:encoded><![CDATA[<h1 id="six-vulnerabilities-in-siemens-sicam-siapp-sdk">Six Vulnerabilities in Siemens SICAM SIAPP SDK</h1>
<p>SecMate&rsquo;s automated analysis found six vulnerabilities in Siemens SICAM SIAPP SDK before version <code>2.1.7</code>. The set includes one out-of-bounds write in shipped sample code, one stack buffer overflow in the shipped <code>DemoProject</code>, two stack overflows in UNIX socket path handling, one command injection in UNIX socket permission handling, and one uncontrolled file or socket deletion issue caused by unchecked <code>unlink()</code>.</p>
<p>SIAPP SDK is Siemens&rsquo; development kit for building custom containerized applications that run on SICAM A8000 equipment used in substation automation, distribution grids, and other power-automation environments. These findings concern the SIAPP SDK path for custom applications; they do not, by themselves, imply that the core SICAM A8000 firmware or Siemens-provided standard functionality is affected by default.</p>
<p>Taken together, the bugs fall into two buckets: four issues in the SDK&rsquo;s UNIX socket helper code and two in sample applications Siemens ships as part of the developer workflow.</p>
<p>Exploitability depends on how downstream applications use the SDK, whether untrusted input reaches the affected paths, and whether hardening measures are applied.</p>
<p>In the public repository history, <strong>five of the six affected code paths trace back to the initial public commit on June 10, 2020</strong> and remained there until Siemens fixed them in <code>SIAPP SDK 2.1.7</code> on <strong>January 16, 2026</strong>. That is <strong>2,046 days</strong> in the public repository.</p>
<p>The sixth affected code path appears later, on <strong>March 19, 2021</strong>, and remained until the same <code>2.1.7</code> fix, for <strong>1,764 days</strong> in the public repository.</p>
<p>Siemens published these issues in advisory <code>SSA-903736</code> on <strong>March 10, 2026</strong> <a href="#ref1">[1]</a>.</p>
<h2 id="what-is-sicam-siapp-sdk">What Is SICAM SIAPP SDK?</h2>
<p>SIAPP SDK is Siemens&rsquo; development kit for building and emulating <strong>SIAPPs</strong>, containerized applications intended to run on the <a href="https://www.siemens.com/global/en/products/energy/energy-automation-and-smart-grid/substation-automation/automation-and-remote-terminal-units-sicam-a8000-series.html?_originalHost=marketplace.siemens.com&amp;language=en_US" rel="noopener noreferrer" target="_blank">SICAM A8000</a> family <a href="#ref2">[2]</a> <a href="#ref3">[3]</a> <a href="#ref4">[4]</a> <a href="#ref5">[5]</a>. Siemens&rsquo; documentation describes SIAPP as an application model for <strong>CP-8031</strong> and <strong>CP-8050</strong> processor modules; developers build an app as a Docker image, emulate it locally, and then load it onto the device <a href="#ref3">[3]</a> <a href="#ref4">[4]</a>.</p>
<p>The SDK includes:</p>
<ul>
<li>build and emulation tooling</li>
<li>an <strong>EdgeData API</strong> for exchanging signals with the platform <a href="#ref6">[6]</a></li>
<li>example applications such as <code>DemoProject</code>, <code>DemoSshd</code>, and <code>CodeSnippets</code></li>
<li>a local simulation environment for testing SIAPP behavior off-device</li>
</ul>
<p>Siemens markets <a href="https://www.siemens.com/global/en/products/energy/energy-automation-and-smart-grid/substation-automation/automation-and-remote-terminal-units-sicam-a8000-series.html?_originalHost=marketplace.siemens.com&amp;language=en_US" rel="noopener noreferrer" target="_blank">SICAM A8000</a> for <strong>substation automation</strong>, <strong>distribution grids</strong>, <strong>renewable integration</strong>, and <strong>industrial power</strong> <a href="#ref5">[5]</a>. This equipment is used to monitor and control parts of the electrical grid and adjacent industrial power systems. Its SIAPP material describes use cases such as transformer controllers, energy-storage optimization, weather-driven renewable control, and energy-trading optimization <a href="#ref4">[4]</a>, and the launch material frames the platform for customers such as <strong>major energy suppliers, municipal utilities, and industrial companies</strong> <a href="#ref7">[7]</a>. The SIAPP SDK is the official development kit for building custom applications in that environment.</p>
<p>The developer workflow in the repository is straightforward <a href="#ref3">[3]</a>:</p>
<ol>
<li>Write a SIAPP project with a <code>Dockerfile</code></li>
<li>Build it with <code>build.py</code></li>
<li>Test it with <code>run.py</code> and the local simulation flow</li>
<li>Deploy it to a SICAM A8000 target</li>
</ol>
<p>The SDK ships starter applications to accelerate that process. <code>DemoProject</code> is a small web application exposing configured signals. <code>DemoSshd</code> is a test container with SSH access. <code>CodeSnippets</code> contains small example programs showing how to use the EdgeData API. That matters because this is the code developers are most likely to copy into real projects.</p>
<p>Siemens&rsquo; advisory is careful on scope: these are not generic internet-wide bugs in every installation. As Siemens states, they are exploitable <strong>if the API is used improperly or hardening measures are not applied</strong> <a href="#ref1">[1]</a>. In practice, that puts weight on the SDK itself, because developers learn the safe and unsafe paths from the code Siemens ships.</p>
<h2 id="public-repository-timeline">Public Repository Timeline</h2>
<p>Five of the six vulnerabilities trace back to the initial public commit on <strong>June 10, 2020</strong> <a href="#ref8">[8]</a> <a href="#ref10">[10]</a>:</p>
<ul>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25569" rel="noopener noreferrer" target="_blank">CVE-2026-25569</a> in <code>CodeSnippets/src/helper.c</code></li>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25571" rel="noopener noreferrer" target="_blank">CVE-2026-25571</a> in <code>edgedataapi/src/edgedata.cpp</code></li>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25572" rel="noopener noreferrer" target="_blank">CVE-2026-25572</a> in <code>edgedataapi/src/edgedata.cpp</code></li>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25573" rel="noopener noreferrer" target="_blank">CVE-2026-25573</a> in <code>edgedataapi/src/edgedata.cpp</code></li>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25605" rel="noopener noreferrer" target="_blank">CVE-2026-25605</a> in <code>edgedataapi/src/edgedata.cpp</code></li>
</ul>
<p>The one later issue was introduced on <strong>March 19, 2021</strong> <a href="#ref9">[9]</a>:</p>
<ul>
<li><a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25570" rel="noopener noreferrer" target="_blank">CVE-2026-25570</a> in <code>DemoProject/src/demo.cpp</code></li>
</ul>
<p>Four of the six vulnerabilities live in the UNIX socket IPC helper code used by the SDK. The other two live in sample applications Siemens ships as part of the developer workflow.</p>
<h2 id="vulnerability-1-codesnippets-helper-out-of-bounds-write-cve-2026-25569-11ref11">Vulnerability #1: CodeSnippets Helper Out-of-Bounds Write (CVE-2026-25569 <a href="#ref11">[11]</a>)</h2>
<p><strong>Location</strong>: <code>helper_get_edgedata_text()</code> in <code>CodeSnippets/src/helper.c</code><br>
<strong>Introduced</strong>: <code>ff331c2</code> on June 10, 2020<br>
<strong>Fixed</strong>: <code>e4edda8</code> on January 16, 2026<br>
<strong>Siemens advisory</strong>: CVSS v3.1 7.4 <a href="#ref1">[1]</a></p>
<p>This issue is in the <code>CodeSnippets</code> sample application, not in the shared IPC helper. The helper <code>helper_get_edgedata_text()</code> formats multiple fields into a caller-provided buffer and advances <code>pos</code> using each <code>snprintf()</code> return value without validating truncation:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="n">pos</span> <span class="o">+=</span> <span class="p">(</span><span class="kt">uint32_t</span><span class="p">)</span><span class="nf">snprintf</span><span class="p">(</span><span class="o">&amp;</span><span class="n">edgedata_to_text</span><span class="p">[</span><span class="n">pos</span><span class="p">],</span> <span class="p">(</span><span class="n">max_len_edgedata_to_text</span><span class="o">-</span><span class="n">pos</span><span class="p">),</span> <span class="s">&#34;Topic: %s&#34;</span><span class="p">,</span> <span class="n">edge_data</span><span class="o">-&gt;</span><span class="n">topic</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="n">pos</span> <span class="o">+=</span> <span class="p">(</span><span class="kt">uint32_t</span><span class="p">)</span><span class="nf">snprintf</span><span class="p">(</span><span class="o">&amp;</span><span class="n">edgedata_to_text</span><span class="p">[</span><span class="n">pos</span><span class="p">],</span> <span class="p">(</span><span class="n">max_len_edgedata_to_text</span><span class="o">-</span><span class="n">pos</span><span class="p">),</span> <span class="s">&#34;, Type:&#34;</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="n">pos</span> <span class="o">+=</span> <span class="nf">helper_get_data_type_text</span><span class="p">(</span><span class="n">edge_data</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">edgedata_to_text</span><span class="p">[</span><span class="n">pos</span><span class="p">],</span> <span class="p">(</span><span class="n">max_len_edgedata_to_text</span><span class="o">-</span><span class="n">pos</span><span class="p">));</span>
</span></span></code></pre></div><p>If a topic exceeds remaining space, <code>pos</code> can move beyond the real buffer boundary, and subsequent writes can go out of bounds. In the shipped examples, <code>discover.c</code>, <code>subscribe.c</code>, and <code>simple_dido.c</code> call this helper with fixed 300-byte stack buffers, so oversized topic strings can trigger stack corruption.</p>
<h2 id="vulnerability-2-demoproject-floating-point-formatting-stack-overflow-cve-2026-25570-12ref12">Vulnerability #2: DemoProject Floating-Point Formatting Stack Overflow (CVE-2026-25570 <a href="#ref12">[12]</a>)</h2>
<p><strong>Location</strong>: <code>convert_value_to_str()</code> in <code>DemoProject/src/demo.cpp</code><br>
<strong>Introduced</strong>: <code>4139bfb</code> on March 19, 2021<br>
<strong>Fixed</strong>: <code>e4edda8</code> on January 16, 2026<br>
<strong>Siemens advisory</strong>: CVSS v3.1 7.4 <a href="#ref1">[1]</a></p>
<p>This issue is in the <code>DemoProject</code> sample application. <code>convert_value_to_str()</code> writes to fixed-size buffers (including <code>char value_str[50]</code>) and used unbounded <code>sprintf()</code> for floating-point values:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="k">case</span> <span class="nl">E_EDGE_DATA_TYPE_FLOAT32</span><span class="p">:</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl">   <span class="nf">sprintf</span><span class="p">(</span><span class="n">out_value</span><span class="p">,</span> <span class="s">&#34;%f&#34;</span><span class="p">,</span> <span class="n">value</span><span class="o">-&gt;</span><span class="n">float32</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl">   <span class="nf">sprintf</span><span class="p">(</span><span class="n">out_type</span><span class="p">,</span> <span class="s">&#34;FLOAT32&#34;</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">   <span class="k">break</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">5</span><span class="cl"><span class="k">case</span> <span class="nl">E_EDGE_DATA_TYPE_DOUBLE64</span><span class="p">:</span>
</span></span><span class="line"><span class="ln">6</span><span class="cl">   <span class="nf">sprintf</span><span class="p">(</span><span class="n">out_value</span><span class="p">,</span> <span class="s">&#34;%lf&#34;</span><span class="p">,</span> <span class="n">value</span><span class="o">-&gt;</span><span class="n">double64</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">7</span><span class="cl">   <span class="nf">sprintf</span><span class="p">(</span><span class="n">out_type</span><span class="p">,</span> <span class="s">&#34;DOUBLE64&#34;</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">8</span><span class="cl">   <span class="k">break</span><span class="p">;</span>
</span></span></code></pre></div><p>Large floating-point values can expand to strings longer than 50 bytes, causing stack overflow in <code>value_str</code>. The formatter is used in <code>/edgedata/get</code> and <code>/edgedata/get_events</code> response paths, so oversized <code>DOUBLE64</code> values can trigger memory corruption during XML serialization.</p>
<h2 id="vulnerability-3-client-unix-socket-path-overflow-cve-2026-25571-13ref13">Vulnerability #3: Client UNIX Socket Path Overflow (CVE-2026-25571 <a href="#ref13">[13]</a>)</h2>
<p><strong>Location</strong>: <code>edgedata_ipc_unix_client_connect()</code> in <code>edgedataapi/src/edgedata.cpp</code><br>
<strong>Introduced</strong>: <code>ff331c2</code> on June 10, 2020<br>
<strong>Fixed</strong>: <code>e4edda8</code> on January 16, 2026<br>
<strong>Siemens advisory</strong>: CVSS v3.1 5.1 <a href="#ref1">[1]</a></p>
<p>This is a client-side length validation issue in the shared UNIX socket helper. <code>edgedata_ipc_unix_client_connect()</code> copies a caller-provided socket path into <code>sockaddr_un.sun_path</code> using <code>strcpy()</code> without bounds checking:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="nf">strcpy</span><span class="p">(</span><span class="n">addr</span><span class="p">.</span><span class="n">sun_path</span><span class="p">,</span> <span class="n">fd</span><span class="o">-&gt;</span><span class="n">read_channel_name</span><span class="p">.</span><span class="nf">c_str</span><span class="p">());</span>
</span></span></code></pre></div><p>On Linux, <code>sun_path</code> is fixed-size (commonly 108 bytes). Longer paths can overflow the stack buffer before <code>connect()</code>. Exploitation depends on downstream integration: if untrusted or oversized input is passed into this API, the overflow is reachable.</p>
<h2 id="vulnerability-4-server-unix-socket-path-overflow-cve-2026-25572-14ref14">Vulnerability #4: Server UNIX Socket Path Overflow (CVE-2026-25572 <a href="#ref14">[14]</a>)</h2>
<p><strong>Location</strong>: <code>edgedata_ipc_unix_server_listen()</code> in <code>edgedataapi/src/edgedata.cpp</code><br>
<strong>Introduced</strong>: <code>ff331c2</code> on June 10, 2020<br>
<strong>Fixed</strong>: <code>e4edda8</code> on January 16, 2026<br>
<strong>Siemens advisory</strong>: CVSS v3.1 5.1 <a href="#ref1">[1]</a></p>
<p>This is the server-side twin of the previous bug. The same unbounded copy is used when preparing the server socket address:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="nf">strcpy</span><span class="p">(</span><span class="n">addr</span><span class="p">.</span><span class="n">sun_path</span><span class="p">,</span> <span class="n">fd</span><span class="o">-&gt;</span><span class="n">read_channel_name</span><span class="p">.</span><span class="nf">c_str</span><span class="p">());</span>
</span></span></code></pre></div><p>If a downstream application accepts an untrusted socket path and forwards it into the SDK, the server helper can overflow the stack before <code>bind()</code> runs. As with the client-side variant, the default examples do not expose this path directly to attackers; the precondition is still misuse at the API boundary.</p>
<h2 id="vulnerability-5-unix-socket-helper-command-injection-cve-2026-25573-15ref15">Vulnerability #5: UNIX Socket Helper Command Injection (CVE-2026-25573 <a href="#ref15">[15]</a>)</h2>
<p><strong>Location</strong>: <code>edgedata_ipc_unix_server_listen()</code> in <code>edgedataapi/src/edgedata.cpp</code><br>
<strong>Introduced</strong>: <code>ff331c2</code> on June 10, 2020<br>
<strong>Fixed</strong>: <code>e4edda8</code> on January 16, 2026<br>
<strong>Siemens advisory</strong>: CVSS v3.1 7.4 <a href="#ref1">[1]</a></p>
<p>This issue is more serious because the vulnerable code does not just mishandle memory. It builds shell commands from caller-controlled strings and executes them:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">snprintf</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">cmd</span><span class="p">),</span> <span class="s">&#34;chown %s %s&#34;</span><span class="p">,</span> <span class="n">user</span><span class="p">,</span> <span class="n">addr</span><span class="p">.</span><span class="n">sun_path</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">system</span><span class="p">(</span><span class="n">cmd</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">snprintf</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">cmd</span><span class="p">),</span> <span class="s">&#34;chmod 777 %s&#34;</span><span class="p">,</span> <span class="n">addr</span><span class="p">.</span><span class="n">sun_path</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">system</span><span class="p">(</span><span class="n">cmd</span><span class="p">);</span>
</span></span></code></pre></div><p>If an application exposes <code>user</code> or <code>channel_name</code> to untrusted input, shell metacharacters become part of the command line interpreted by <code>/bin/sh</code>. This is not an abstract quoting issue. The helper literally concatenates caller-controlled data into a shell command and runs it.</p>
<p>As with the path overflows, exploitability depends on integration. The repository examples do not themselves expose arbitrary remote input for these parameters. But once a downstream application lets an untrusted user influence socket ownership or socket path values, the bug becomes command injection.</p>
<h2 id="vulnerability-6-unchecked-unlink-in-unix-socket-setup-cve-2026-25605-16ref16">Vulnerability #6: Unchecked <code>unlink()</code> in UNIX Socket Setup (CVE-2026-25605 <a href="#ref16">[16]</a>)</h2>
<p><strong>Location</strong>: <code>edgedata_ipc_unix_server_listen()</code> in <code>edgedataapi/src/edgedata.cpp</code><br>
<strong>Introduced</strong>: <code>ff331c2</code> on June 10, 2020<br>
<strong>Fixed</strong>: <code>e4edda8</code> on January 16, 2026<br>
<strong>Siemens advisory</strong>: CVSS v3.1 6.7 <a href="#ref1">[1]</a></p>
<p>Before binding the server socket, the helper called:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="nf">unlink</span><span class="p">(</span><span class="n">fd</span><span class="o">-&gt;</span><span class="n">read_channel_name</span><span class="p">.</span><span class="nf">c_str</span><span class="p">());</span>
</span></span></code></pre></div><p>There was no validation that the path pointed to an existing socket, no restriction to a dedicated socket directory, and no <code>lstat()</code> / <code>S_ISSOCK</code> guard. If a downstream application lets an untrusted party influence <code>channel_name</code>, the process can be induced to delete any file or socket it has permission to remove.</p>
<p>This does not automatically mean arbitrary file deletion from the network. The vulnerable operation is local to the API boundary, so the precondition is still that a caller passes untrusted data into the helper. But once that happens, the delete happens before the bind, with no type check at all.</p>
<h2 id="what-siemens-fixed-in-217">What Siemens Fixed in <code>2.1.7</code></h2>
<p>The <code>SIAPP SDK 2.1.7</code> commit includes direct fixes in the affected code paths:</p>
<ul>
<li><code>strcpy()</code> on <code>sun_path</code> was replaced with explicit length checks and bounded copies</li>
<li>unconditional <code>unlink()</code> was replaced with <code>lstat()</code> and socket-type validation</li>
<li>shell-based <code>chown</code> and <code>chmod</code> calls were replaced with <code>getpwnam()</code>, <code>chown()</code>, and <code>chmod()</code></li>
<li><code>sprintf()</code> was replaced with bounded <code>snprintf()</code>, and the float formatting was changed from <code>%f</code> / <code>%lf</code> to <code>%g</code></li>
<li>the <code>CodeSnippets</code> helper was rewritten to check truncation after each append and to cap copied topic length</li>
</ul>
<h2 id="disclosure-timeline">Disclosure Timeline</h2>
<div style="position: relative; padding-left: 1.5rem; margin: 1.5rem 0;">
  <div style="position: absolute; left: 0.35rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--color-border);"></div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 3, 2026</div>
    <div style="color: var(--color-text);">SecMate reports six vulnerabilities to Siemens ProductCERT, including two affecting example code only <a href="#ref17">[17]</a></div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 5, 2026</div>
    <div style="color: var(--color-text);">Siemens ProductCERT confirms the case was opened as <code>#33016</code> on the first business day after the January 3 report <a href="#ref17">[17]</a></div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 16, 2026</div>
    <div style="color: var(--color-text);">Siemens fixes all six issues in <a href="https://github.com/siemens/siapp-sdk/commit/e4edda8">SIAPP SDK 2.1.7</a> <a href="#ref10">[10]</a></div>
  </div>
  <div style="position: relative;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Mar 10, 2026</div>
    <div style="color: var(--color-text);">Siemens publishes advisory <a href="https://cert-portal.siemens.com/productcert/html/ssa-903736.html">SSA-903736</a> covering <code>CVE-2026-25569</code>, <code>CVE-2026-25570</code>, <code>CVE-2026-25571</code>, <code>CVE-2026-25572</code>, <code>CVE-2026-25573</code>, and <code>CVE-2026-25605</code> <a href="#ref1">[1]</a></div>
  </div>
</div>
<h2 id="closing-thoughts">Closing Thoughts</h2>
<p>Several of these patterns sat for years in a vendor SDK used to build software for power-automation environments.</p>
<p>Four of these vulnerabilities were in reusable UNIX socket SDK code, and two were in sample applications shipped to show developers how to build on the platform.</p>
<p>For SDK maintainers, especially in embedded and industrial systems, the lesson is simple: helper APIs and sample projects are part of the security boundary.</p>
<h2 id="references">References</h2>
<ul>
<li>
<p><a id="ref1"></a>[1] Siemens ProductCERT. &ldquo;SSA-903736: Multiple vulnerabilities in SICAM SIAPP SDK before V2.1.7.&rdquo; Published March 10, 2026. <a href="https://cert-portal.siemens.com/productcert/html/ssa-903736.html" rel="noopener noreferrer" target="_blank">Advisory</a></p>
</li>
<li>
<p><a id="ref2"></a>[2] Siemens. &ldquo;siapp-sdk.&rdquo; <a href="https://github.com/siemens/siapp-sdk" rel="noopener noreferrer" target="_blank">GitHub repository</a></p>
</li>
<li>
<p><a id="ref3"></a>[3] Siemens. &ldquo;SIAPP SDK README.&rdquo; <a href="https://github.com/siemens/siapp-sdk/blob/master/README.md" rel="noopener noreferrer" target="_blank">Repository documentation</a></p>
</li>
<li>
<p><a id="ref4"></a>[4] Siemens. &ldquo;SICAM application - SIAPP.&rdquo; <a href="https://www.siemens.com/global/en/products/energy/energy-automation-and-smart-grid/substation-automation/sicam-application-siapp.html" rel="noopener noreferrer" target="_blank">Product page</a></p>
</li>
<li>
<p><a id="ref5"></a>[5] Siemens. &ldquo;Automation and remote terminal units - SICAM A8000 Series.&rdquo; <a href="https://www.siemens.com/global/en/products/energy/energy-automation-and-smart-grid/substation-automation/automation-and-remote-terminal-units-sicam-a8000-series.html?_originalHost=marketplace.siemens.com&amp;language=en_US" rel="noopener noreferrer" target="_blank">Product page</a></p>
</li>
<li>
<p><a id="ref6"></a>[6] Siemens. &ldquo;EDGEDATAAPI.md.&rdquo; <a href="https://github.com/siemens/siapp-sdk/blob/master/EDGEDATAAPI.md" rel="noopener noreferrer" target="_blank">Repository documentation</a></p>
</li>
<li>
<p><a id="ref7"></a>[7] Siemens Press. &ldquo;Siemens launches new platform to create customer-specific apps for distribution grids.&rdquo; Published July 7, 2020. <a href="https://press.siemens.com/global/en/pressrelease/siemens-launches-new-platform-create-customer-specific-apps-distribution-grids" rel="noopener noreferrer" target="_blank">Press release</a></p>
</li>
<li>
<p><a id="ref8"></a>[8] Siemens. &ldquo;initial commit&rdquo; (<code>ff331c2</code>, June 10, 2020). <a href="https://github.com/siemens/siapp-sdk/commit/ff331c2" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref9"></a>[9] Siemens. &ldquo;SIAPP SDK 1.1.1&rdquo; (<code>4139bfb</code>, March 19, 2021). <a href="https://github.com/siemens/siapp-sdk/commit/4139bfb" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref10"></a>[10] Siemens. &ldquo;SIAPP SDK 2.1.7&rdquo; (<code>e4edda8</code>, January 16, 2026). <a href="https://github.com/siemens/siapp-sdk/commit/e4edda8" rel="noopener noreferrer" target="_blank">Commit</a></p>
</li>
<li>
<p><a id="ref11"></a>[11] NVD. &ldquo;CVE-2026-25569.&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25569" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref12"></a>[12] NVD. &ldquo;CVE-2026-25570.&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25570" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref13"></a>[13] NVD. &ldquo;CVE-2026-25571.&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25571" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref14"></a>[14] NVD. &ldquo;CVE-2026-25572.&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25572" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref15"></a>[15] NVD. &ldquo;CVE-2026-25573.&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25573" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref16"></a>[16] NVD. &ldquo;CVE-2026-25605.&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-25605" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref17"></a>[17] Email correspondence between SecMate and Siemens ProductCERT regarding <code>siapp-sdk</code>, January 3, 2026 to March 25, 2026. On file.</p>
</li>
</ul>
<hr>
<p><em>The SecMate Team</em></p>
]]></content:encoded><media:content url="https://blog.secmate.dev/images/og_image.jpg" medium="image"/></item><item><title>Four Memory Safety Vulnerabilities in Golioth's IoT Firmware</title><link>https://blog.secmate.dev/posts/golioth-vulnerabilities-disclosure/</link><pubDate>Wed, 25 Feb 2026 00:00:00 +0000</pubDate><atom:updated>2026-02-25T00:00:00+00:00</atom:updated><dc:creator>Maxime Rossi Bellom</dc:creator><dc:creator>Ramtine Tofighi Shirazi</dc:creator><category>Security</category><category>Vulnerability Research</category><category>IoT</category><guid>https://blog.secmate.dev/posts/golioth-vulnerabilities-disclosure/</guid><description>SecMate discovered four memory safety vulnerabilities across Golioth's Firmware SDK and Pouch BLE protocol: an unauthenticated BLE heap overflow (CVE-2026-23750), a LightDB State integer underflow (CVE-2026-23748), an assert guarded stack overflow (CVE-2026-23747), and a CoAP blockwise path OOB read (CVE-2026-23749). With server certificate validation disabled, three form a theoretical chain from BLE proximity to RCE.</description><content:encoded><![CDATA[<h1 id="four-memory-safety-vulnerabilities-in-golioths-iot-firmware">Four Memory Safety Vulnerabilities in Golioth&rsquo;s IoT Firmware</h1>
<p>We discovered four memory safety vulnerabilities in Golioth&rsquo;s Firmware SDK and Pouch BLE protocol: an unauthenticated BLE heap overflow, an integer underflow causing out-of-bounds reads, a stack buffer overflow guarded only by <code>assert()</code>, and an off-by-one <code>strncpy</code> bug. Each is independently triggerable under its own preconditions.</p>
<p>Three of the four chain together into a path from unauthenticated BLE proximity to remote code execution. Golioth&rsquo;s defense-in-depth blocks this chain: server certificate validation (<code>CONFIG_POUCH_VALIDATE_SERVER_CERT</code>) is enabled by default and rejects injected certificates at step two.</p>
<h2 id="what-is-golioth">What is Golioth?</h2>
<p><a href="https://golioth.io/" rel="noopener noreferrer" target="_blank">Golioth</a> <a href="#ref1">[1]</a> is an IoT device infrastructure platform for fleet management, OTA updates, data routing, and device monitoring. It ships two open-source products relevant to this research:</p>
<p>The <strong>Golioth Firmware SDK</strong> <a href="#ref1">[1]</a> is a C library for device-to-cloud communication over CoAP/DTLS <a href="#ref3">[3]</a>. It supports LightDB State (device-shadow key/value store), OTA firmware updates, logging, and settings. The SDK targets Zephyr RTOS, nRF Connect SDK, ESP-IDF, and Infineon ModusToolbox, running on hardware including the nRF9160, nRF52840, and ESP32.</p>
<p><strong>Golioth Pouch</strong> <a href="#ref2">[2]</a> is a non-IP protocol for device-to-cloud communication through BLE gateways. Pouch uses BLE GATT for the device-to-gateway leg, with end-to-end encryption to the Golioth cloud. It is designed around an <strong>untrusted gateway model</strong>: gateways relay data but cannot inspect it. A BLE GATT server on the device exchanges certificates with a gateway, which then brokers the encrypted session.</p>
<p>SecMate&rsquo;s automated analysis identified <strong>four memory safety vulnerabilities</strong> spanning both products.</p>
<p>One finding is particularly worth highlighting: a stack buffer overflow whose only bounds check is <code>assert()</code>, which the C standard defines as a debugging aid and which is compiled out of every release build. This pattern, using <code>assert()</code> as a security boundary, is common across embedded codebases and is almost always a vulnerability in production.</p>
<h2 id="architecture-overview">Architecture Overview</h2>
<h3 id="firmware-sdk-device-to-cloud">Firmware SDK: Device to Cloud</h3>
<p>The Firmware SDK handles all cloud communication over CoAP/DTLS. The device authenticates to Golioth using a pre-provisioned certificate or PSK, then exchanges CoAP messages for state synchronization (LightDB State), firmware updates, and telemetry. Payloads arrive as raw byte buffers with an associated <code>payload_size</code>, and the parsing code trusts that relationship implicitly. The vulnerable code paths are in <code>lightdb_state.c</code>, <code>payload_utils.c</code>, <code>coap_blockwise.c</code>, and <code>coap_client.c</code>.</p>
<h3 id="pouch-non-ip-gateway-protocol">Pouch: Non-IP Gateway Protocol</h3>
<p>Pouch is a non-IP protocol designed to route device traffic through BLE gateways to the Golioth cloud. Its security model is built around an <strong>untrusted gateway assumption</strong>: gateways are treated as opaque relays that forward data but cannot inspect or modify it, thanks to end-to-end encryption between the device and cloud. This is a deliberate design choice: the protocol explicitly considers the scenario where an intermediary gateway is compromised.</p>
<p>What makes the first vulnerability particularly notable is that Pouch&rsquo;s threat model accounts for gateway compromise but <em>not</em> for unauthenticated BLE-level write access. The server certificate characteristic is registered with <code>BT_GATT_PERM_WRITE</code>, meaning <strong>any BLE client in range can write to it without pairing, bonding, or encryption</strong>. The untrusted gateway model protects data in transit, but the certificate exchange itself has no access control. This is the entry point for the attack chain.</p>
<h2 id="vulnerability-1-ble-gatt-server-certificate-heap-overflow-cve-2026-23750-4ref4">Vulnerability #1: BLE GATT Server Certificate Heap Overflow (CVE-2026-23750 <a href="#ref4">[4]</a>)</h2>
<p><strong>Location</strong>: <code>server_cert_write()</code> in <code>server_cert_characteristic.c</code> (Golioth Pouch)</p>
<p>This is the lead vulnerability and the entry point for the full chain. Any BLE client within radio range can trigger it: no pairing, no bonding, no authentication of any kind.</p>
<h3 id="the-bug">The Bug</h3>
<p>The <code>server_cert_write</code> handler processes incoming BLE GATT writes to the server certificate characteristic. When the first fragment arrives, it allocates a fixed-size heap buffer. For every fragment, it blindly appends the payload:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln"> 1</span><span class="cl"><span class="c1">// server_cert_characteristic.c:105-153
</span></span></span><span class="line"><span class="ln"> 2</span><span class="cl"><span class="c1"></span><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">server_cert_write</span><span class="p">(</span><span class="k">struct</span> <span class="n">bt_conn</span> <span class="o">*</span><span class="n">conn</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 3</span><span class="cl">                                 <span class="k">const</span> <span class="k">struct</span> <span class="n">bt_gatt_attr</span> <span class="o">*</span><span class="n">attr</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 4</span><span class="cl">                                 <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">buf</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 5</span><span class="cl">                                 <span class="kt">uint16_t</span> <span class="n">len</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 6</span><span class="cl">                                 <span class="kt">uint16_t</span> <span class="n">offset</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 7</span><span class="cl">                                 <span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">)</span>
</span></span><span class="line"><span class="ln"> 8</span><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="ln"> 9</span><span class="cl">    <span class="k">struct</span> <span class="n">golioth_ble_gatt_server_cert_ctx</span> <span class="o">*</span><span class="n">ctx</span> <span class="o">=</span> <span class="n">attr</span><span class="o">-&gt;</span><span class="n">user_data</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">10</span><span class="cl">    <span class="kt">bool</span> <span class="n">is_first</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">11</span><span class="cl">    <span class="kt">bool</span> <span class="n">is_last</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">12</span><span class="cl">    <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">payload</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">13</span><span class="cl">    <span class="kt">ssize_t</span> <span class="n">payload_len</span> <span class="o">=</span>
</span></span><span class="line"><span class="ln">14</span><span class="cl">        <span class="nf">golioth_ble_gatt_packetizer_decode</span><span class="p">(</span><span class="n">buf</span><span class="p">,</span> <span class="n">len</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">payload</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">is_first</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">is_last</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">15</span><span class="cl">
</span></span><span class="line"><span class="ln">16</span><span class="cl">    <span class="k">if</span> <span class="p">(</span><span class="mi">0</span> <span class="o">&gt;=</span> <span class="n">payload_len</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">17</span><span class="cl">    <span class="p">{</span>
</span></span><span class="line"><span class="ln">18</span><span class="cl">        <span class="k">return</span> <span class="nf">BT_GATT_ERR</span><span class="p">(</span><span class="n">BT_ATT_ERR_UNLIKELY</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">19</span><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="ln">20</span><span class="cl">
</span></span><span class="line"><span class="ln">21</span><span class="cl">    <span class="k">if</span> <span class="p">(</span><span class="n">is_first</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">22</span><span class="cl">    <span class="p">{</span>
</span></span><span class="line"><span class="ln">23</span><span class="cl">        <span class="nf">free</span><span class="p">((</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span> <span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">buffer</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">24</span><span class="cl">        <span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">buffer</span> <span class="o">=</span> <span class="nf">malloc</span><span class="p">(</span><span class="n">CONFIG_POUCH_SERVER_CERT_MAX_LEN</span><span class="p">);</span>  <span class="c1">// Fixed-size allocation
</span></span></span><span class="line"><span class="ln">25</span><span class="cl"><span class="c1"></span>        <span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">size</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">26</span><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="ln">27</span><span class="cl">
</span></span><span class="line"><span class="ln">28</span><span class="cl">    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">buffer</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">29</span><span class="cl">    <span class="p">{</span>
</span></span><span class="line"><span class="ln">30</span><span class="cl">        <span class="k">return</span> <span class="nf">BT_GATT_ERR</span><span class="p">(</span><span class="n">BT_ATT_ERR_INSUFFICIENT_RESOURCES</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">31</span><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="ln">32</span><span class="cl">
</span></span><span class="line"><span class="ln">33</span><span class="cl">    <span class="c1">// ** VULNERABILITY: No check that ctx-&gt;cert.size + payload_len
</span></span></span><span class="line"><span class="ln">34</span><span class="cl"><span class="c1"></span>    <span class="c1">//    &lt;= CONFIG_POUCH_SERVER_CERT_MAX_LEN **
</span></span></span><span class="line"><span class="ln">35</span><span class="cl"><span class="c1"></span>    <span class="nf">memcpy</span><span class="p">((</span><span class="kt">void</span> <span class="o">*</span><span class="p">)</span> <span class="o">&amp;</span><span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">buffer</span><span class="p">[</span><span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">size</span><span class="p">],</span> <span class="n">payload</span><span class="p">,</span> <span class="n">payload_len</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">36</span><span class="cl">    <span class="n">ctx</span><span class="o">-&gt;</span><span class="n">cert</span><span class="p">.</span><span class="n">size</span> <span class="o">+=</span> <span class="n">payload_len</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">37</span><span class="cl">    <span class="c1">// ...
</span></span></span><span class="line"><span class="ln">38</span><span class="cl"><span class="c1"></span><span class="p">}</span>
</span></span></code></pre></div><p>The critical issue is the <code>memcpy</code> call: it copies <code>payload_len</code> bytes into <code>ctx-&gt;cert.buffer</code> at offset <code>ctx-&gt;cert.size</code> without ever checking whether the cumulative size exceeds <code>CONFIG_POUCH_SERVER_CERT_MAX_LEN</code>. The packetizer decode function returns a length derived directly from the GATT write size. No upper bound is enforced.</p>
<h3 id="the-permission-model">The Permission Model</h3>
<p>The characteristic is registered with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1">// server_cert_characteristic.c:155-161
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1"></span><span class="nf">GOLIOTH_BLE_GATT_CHARACTERISTIC</span><span class="p">(</span><span class="n">server_cert</span><span class="p">,</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl">                                <span class="p">(</span><span class="k">const</span> <span class="k">struct</span> <span class="n">bt_uuid</span> <span class="o">*</span><span class="p">)</span> <span class="o">&amp;</span><span class="n">golioth_ble_gatt_server_cert_chrc_uuid</span><span class="p">,</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">                                <span class="n">BT_GATT_CHRC_READ</span> <span class="o">|</span> <span class="n">BT_GATT_CHRC_WRITE</span><span class="p">,</span>
</span></span><span class="line"><span class="ln">5</span><span class="cl">                                <span class="n">BT_GATT_PERM_READ</span> <span class="o">|</span> <span class="n">BT_GATT_PERM_WRITE</span><span class="p">,</span>  <span class="c1">// No auth/encryption
</span></span></span><span class="line"><span class="ln">6</span><span class="cl"><span class="c1"></span>                                <span class="n">server_cert_serial_read</span><span class="p">,</span>
</span></span><span class="line"><span class="ln">7</span><span class="cl">                                <span class="n">server_cert_write</span><span class="p">,</span>
</span></span><span class="line"><span class="ln">8</span><span class="cl">                                <span class="o">&amp;</span><span class="n">server_cert_chrc_ctx</span><span class="p">);</span>
</span></span></code></pre></div><p><code>BT_GATT_PERM_WRITE</code> grants write access to any connected BLE client. Compare this with <code>BT_GATT_PERM_WRITE_ENCRYPT</code> or <code>BT_GATT_PERM_WRITE_AUTHEN</code>, which require an encrypted link or authenticated pairing respectively. The weakest permission level was chosen.</p>
<h3 id="impact">Impact</h3>
<p>An attacker can overflow the heap buffer in two ways:</p>
<ol>
<li><strong>Single large write</strong>: Send a GATT write whose decoded payload exceeds <code>CONFIG_POUCH_SERVER_CERT_MAX_LEN</code> in one shot.</li>
<li><strong>Fragmented overflow</strong>: Send multiple fragments whose cumulative size exceeds the allocation.</li>
</ol>
<p>On MCUs with deterministic heap layouts (no ASLR), the immediate impact is a crash (denial of service). Depending on the allocator implementation and heap layout, heap metadata corruption may also enable controlled overwrites, but exploitation reliability varies by target and configuration.</p>
<p>Beyond heap overflow, there is a subtler but equally dangerous impact: <strong>certificate injection</strong>. If the attacker writes a valid but attacker-controlled certificate <em>within</em> the buffer bounds (no overflow needed, just a normal-sized write), the device will accept it via <code>pouch_server_certificate_set()</code> and use it for subsequent encrypted sessions. This establishes a man-in-the-middle position without triggering any crash. Certificate injection opens the door to everything that follows.</p>
<p>Note: Pouch provides a server certificate validation option (<code>CONFIG_POUCH_VALIDATE_SERVER_CERT</code>, enabled by default) that checks injected certificates against an embedded CA. When this validation is active, the certificate injection is rejected. The attack chain requires this validation to be disabled, a configuration the build system explicitly warns against for production use.</p>
<h2 id="vulnerability-2-lightdb-state-string-underflow-out-of-bounds-read-cve-2026-23748-5ref5">Vulnerability #2: LightDB State String Underflow Out-of-Bounds Read (CVE-2026-23748 <a href="#ref5">[5]</a>)</h2>
<p><strong>Location</strong>: <code>lightdb_state.c</code> (Golioth Firmware SDK)</p>
<h3 id="chain-context">Chain Context</h3>
<p>With a rogue certificate injected via Vulnerability #1 and server certificate validation disabled, the attacker can sit in the middle of the device encrypted session to the Golioth cloud. From this position, they can craft arbitrary CoAP responses to any LightDB State query the device makes.</p>
<h3 id="the-bug-1">The Bug</h3>
<p>When the SDK receives a LightDB State response for a string value, it strips the surrounding JSON quotes by copying from <code>payload + 1</code> for <code>payload_size - 2</code> bytes:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1">// lightdb_state.c:408-414
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1"></span><span class="k">case</span> <span class="nl">LIGHTDB_GET_TYPE_STRING</span><span class="p">:</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">    <span class="c1">// Remove the leading and trailing quote to get the raw string value
</span></span></span><span class="line"><span class="ln">5</span><span class="cl"><span class="c1"></span>    <span class="kt">size_t</span> <span class="n">nbytes</span> <span class="o">=</span> <span class="nf">min</span><span class="p">(</span><span class="n">ldb_response</span><span class="o">-&gt;</span><span class="n">buf_size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">payload_size</span> <span class="o">-</span> <span class="mi">2</span><span class="p">);</span>  <span class="c1">// &lt;-- UNDERFLOW
</span></span></span><span class="line"><span class="ln">6</span><span class="cl"><span class="c1"></span>    <span class="nf">memcpy</span><span class="p">(</span><span class="n">ldb_response</span><span class="o">-&gt;</span><span class="n">buf</span><span class="p">,</span> <span class="n">payload</span> <span class="o">+</span> <span class="mi">1</span> <span class="cm">/* skip quote */</span><span class="p">,</span> <span class="n">nbytes</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">7</span><span class="cl">    <span class="n">ldb_response</span><span class="o">-&gt;</span><span class="n">buf</span><span class="p">[</span><span class="n">nbytes</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">8</span><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="ln">9</span><span class="cl"><span class="k">break</span><span class="p">;</span>
</span></span></code></pre></div><h3 id="the-math">The Math</h3>
<p><code>payload_size</code> is a <code>size_t</code>, an unsigned type. When the server responds with a 1-byte payload:</p>
<pre tabindex="0"><code>payload_size = 1

payload_size - 2 = 1 - 2
                 = (size_t)(-1)
                 = 0xFFFFFFFF  (on 32-bit MCU)
                 = 4,294,967,295
</code></pre><p>The <code>min()</code> macro then selects <code>ldb_response-&gt;buf_size - 1</code> (the smaller value, e.g., 63 or 127 depending on the caller&rsquo;s buffer). The <code>memcpy</code> then reads that many bytes starting from <code>payload + 1</code>, which is already one byte past the end of the actual 1-byte payload buffer.</p>
<h3 id="why-this-passes-the-null-check">Why This Passes the Null Check</h3>
<p>The code does check for null payloads before reaching this path:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1">// lightdb_state.c:387-391
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1"></span><span class="k">if</span> <span class="p">(</span><span class="nf">golioth_payload_is_null</span><span class="p">(</span><span class="n">payload</span><span class="p">,</span> <span class="n">payload_size</span><span class="p">))</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">    <span class="n">ldb_response</span><span class="o">-&gt;</span><span class="n">is_null</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">5</span><span class="cl">    <span class="k">return</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">6</span><span class="cl"><span class="p">}</span>
</span></span></code></pre></div><p>But <code>golioth_payload_is_null()</code> only returns true for <code>NULL</code> pointers, zero-length payloads, or payloads starting with the string <code>&quot;null&quot;</code>. A 1-byte payload like <code>'&quot;'</code> passes through.</p>
<h3 id="impact-1">Impact</h3>
<p>The <code>memcpy</code> reads <code>buf_size - 1</code> bytes from memory adjacent to the payload buffer. On embedded devices with flat memory models, this can leak:</p>
<ul>
<li>DTLS session keys stored nearby in heap memory</li>
<li>WiFi/BLE credentials</li>
<li>Other application secrets</li>
</ul>
<p>Even without useful data in adjacent memory, the out-of-bounds read will likely fault on unmapped regions, causing a device crash (DoS).</p>
<h2 id="vulnerability-3-assert-guarded-memcpy-stack-buffer-overflow-cve-2026-23747-6ref6">Vulnerability #3: Assert-Guarded Memcpy Stack Buffer Overflow (CVE-2026-23747 <a href="#ref6">[6]</a>)</h2>
<p><strong>Location</strong>: <code>golioth_payload_as_int()</code> / <code>golioth_payload_as_float()</code> in <code>payload_utils.c</code> (Golioth Firmware SDK)</p>
<h3 id="chain-context-1">Chain Context</h3>
<p>Still operating as MITM via the injected certificate, the attacker crafts an oversized integer or float payload in response to a LightDB State query.</p>
<h3 id="the-bug-2">The Bug</h3>
<p>The payload parsing helpers use <code>assert()</code> as their sole bounds check:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln"> 1</span><span class="cl"><span class="c1">// payload_utils.c:15-23
</span></span></span><span class="line"><span class="ln"> 2</span><span class="cl"><span class="c1"></span><span class="kt">int32_t</span> <span class="nf">golioth_payload_as_int</span><span class="p">(</span><span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">payload</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">payload_size</span><span class="p">)</span>
</span></span><span class="line"><span class="ln"> 3</span><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="ln"> 4</span><span class="cl">    <span class="c1">// Copy payload to a NULL-terminated string
</span></span></span><span class="line"><span class="ln"> 5</span><span class="cl"><span class="c1"></span>    <span class="kt">char</span> <span class="n">value</span><span class="p">[</span><span class="mi">12</span><span class="p">]</span> <span class="o">=</span> <span class="p">{};</span>
</span></span><span class="line"><span class="ln"> 6</span><span class="cl">    <span class="nf">assert</span><span class="p">(</span><span class="n">payload_size</span> <span class="o">&lt;=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">value</span><span class="p">));</span>   <span class="c1">// &lt;-- Only defense
</span></span></span><span class="line"><span class="ln"> 7</span><span class="cl"><span class="c1"></span>    <span class="nf">memcpy</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">payload</span><span class="p">,</span> <span class="n">payload_size</span><span class="p">);</span>    <span class="c1">// &lt;-- Unbounded in release
</span></span></span><span class="line"><span class="ln"> 8</span><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="ln"> 9</span><span class="cl">    <span class="k">return</span> <span class="nf">strtol</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">10</span><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="ln">11</span><span class="cl">
</span></span><span class="line"><span class="ln">12</span><span class="cl"><span class="c1">// payload_utils.c:25-33
</span></span></span><span class="line"><span class="ln">13</span><span class="cl"><span class="c1"></span><span class="kt">float</span> <span class="nf">golioth_payload_as_float</span><span class="p">(</span><span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">payload</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">payload_size</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">14</span><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="ln">15</span><span class="cl">    <span class="c1">// Copy payload to a NULL-terminated string
</span></span></span><span class="line"><span class="ln">16</span><span class="cl"><span class="c1"></span>    <span class="kt">char</span> <span class="n">value</span><span class="p">[</span><span class="mi">32</span><span class="p">]</span> <span class="o">=</span> <span class="p">{};</span>
</span></span><span class="line"><span class="ln">17</span><span class="cl">    <span class="nf">assert</span><span class="p">(</span><span class="n">payload_size</span> <span class="o">&lt;=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">value</span><span class="p">));</span>   <span class="c1">// &lt;-- Only defense
</span></span></span><span class="line"><span class="ln">18</span><span class="cl"><span class="c1"></span>    <span class="nf">memcpy</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">payload</span><span class="p">,</span> <span class="n">payload_size</span><span class="p">);</span>    <span class="c1">// &lt;-- Unbounded in release
</span></span></span><span class="line"><span class="ln">19</span><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="ln">20</span><span class="cl">    <span class="k">return</span> <span class="nf">strtof</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">21</span><span class="cl"><span class="p">}</span>
</span></span></code></pre></div><p>These functions are called directly from the network-facing <code>on_payload()</code> callback:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1">// lightdb_state.c:395-396
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1"></span><span class="k">case</span> <span class="nl">LIGHTDB_GET_TYPE_INT</span><span class="p">:</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl">    <span class="o">*</span><span class="n">ldb_response</span><span class="o">-&gt;</span><span class="n">i</span> <span class="o">=</span> <span class="nf">golioth_payload_as_int</span><span class="p">(</span><span class="n">payload</span><span class="p">,</span> <span class="n">payload_size</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">    <span class="k">break</span><span class="p">;</span>
</span></span></code></pre></div><h3 id="the-anti-pattern-assert-as-a-security-check">The Anti-Pattern: <code>assert()</code> as a Security Check</h3>
<p>The C standard defines <code>assert()</code> as a <em>debugging aid</em>. When the macro <code>NDEBUG</code> is defined, which is <strong>standard practice in release/production builds</strong>, <code>assert()</code> expands to nothing:</p>
<pre tabindex="0"><code>// &lt;assert.h&gt; with NDEBUG defined:
#define assert(expression) ((void)0)
</code></pre><p>Here is what the compiler sees in each build configuration:</p>
<p><strong>Debug build</strong> (assert active):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="kt">char</span> <span class="n">value</span><span class="p">[</span><span class="mi">12</span><span class="p">]</span> <span class="o">=</span> <span class="p">{};</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1">// assert fires, aborts if payload_size &gt; 12
</span></span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="c1"></span><span class="p">((</span><span class="n">payload_size</span> <span class="o">&lt;=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">value</span><span class="p">))</span> <span class="o">?</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="mi">0</span> <span class="o">:</span> <span class="nf">__assert_fail</span><span class="p">(...));</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="nf">memcpy</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">payload</span><span class="p">,</span> <span class="n">payload_size</span><span class="p">);</span>
</span></span></code></pre></div><p><strong>Release build</strong> (NDEBUG defined):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="kt">char</span> <span class="n">value</span><span class="p">[</span><span class="mi">12</span><span class="p">]</span> <span class="o">=</span> <span class="p">{};</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1">// assert compiled away --- nothing here
</span></span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="c1"></span><span class="p">((</span><span class="kt">void</span><span class="p">)</span><span class="mi">0</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="nf">memcpy</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">payload</span><span class="p">,</span> <span class="n">payload_size</span><span class="p">);</span>  <span class="c1">// copies whatever the network sent
</span></span></span></code></pre></div><p>In the release build, <code>memcpy</code> copies <code>payload_size</code> bytes, directly controlled by the network, into a 12-byte (or 32-byte) stack buffer with no bounds check whatsoever.</p>
<h3 id="impact-2">Impact</h3>
<p>On MCUs where stack canaries are not enabled (common in Zephyr and ESP-IDF default configurations for size and performance reasons), this is a textbook stack buffer overflow:</p>
<ul>
<li>The attacker sends a LightDB State integer response with 100+ bytes of payload.</li>
<li><code>memcpy</code> writes past <code>value[12]</code>, overwriting the saved frame pointer, return address, and any other locals on the stack.</li>
<li>On Cortex-M (ARM Thumb), the saved return address on the stack is loaded into the PC. The attacker controls the PC.</li>
<li>With a deterministic memory layout and a known firmware image, this enables control flow hijack and potential RCE on embedded targets without common mitigations.</li>
</ul>
<p>The float variant (<code>value[32]</code>) requires a slightly larger payload but is otherwise identical.</p>
<h2 id="vulnerability-4-coap-blockwise-unterminated-path-out-of-bounds-read-cve-2026-23749-7ref7">Vulnerability #4: CoAP Blockwise Unterminated Path Out-of-Bounds Read (CVE-2026-23749 <a href="#ref7">[7]</a>)</h2>
<p><strong>Location</strong>: <code>blockwise_transfer_init()</code> in <code>coap_blockwise.c</code> (Golioth Firmware SDK)</p>
<p>This vulnerability is locally triggered (by the application&rsquo;s own path strings) rather than network-exploitable. We include it to complete the pattern of C memory safety hazards found across the SDK.</p>
<h3 id="the-bug-3">The Bug</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln"> 1</span><span class="cl"><span class="c1">// coap_blockwise.c:76-94
</span></span></span><span class="line"><span class="ln"> 2</span><span class="cl"><span class="c1"></span><span class="k">static</span> <span class="kt">int</span> <span class="nf">blockwise_transfer_init</span><span class="p">(</span><span class="k">struct</span> <span class="n">blockwise_transfer</span> <span class="o">*</span><span class="n">ctx</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 3</span><span class="cl">                                   <span class="k">struct</span> <span class="n">golioth_client</span> <span class="o">*</span><span class="n">client</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 4</span><span class="cl">                                   <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">path_prefix</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 5</span><span class="cl">                                   <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">path</span><span class="p">,</span>
</span></span><span class="line"><span class="ln"> 6</span><span class="cl">                                   <span class="k">enum</span> <span class="n">golioth_content_type</span> <span class="n">content_type</span><span class="p">)</span>
</span></span><span class="line"><span class="ln"> 7</span><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="ln"> 8</span><span class="cl">    <span class="k">if</span> <span class="p">(</span><span class="nf">strlen</span><span class="p">(</span><span class="n">path</span><span class="p">)</span> <span class="o">&gt;</span> <span class="n">CONFIG_GOLIOTH_COAP_MAX_PATH_LEN</span><span class="p">)</span>  <span class="c1">// allows ==
</span></span></span><span class="line"><span class="ln"> 9</span><span class="cl"><span class="c1"></span>    <span class="p">{</span>
</span></span><span class="line"><span class="ln">10</span><span class="cl">        <span class="k">return</span> <span class="o">-</span><span class="n">EINVAL</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">11</span><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="ln">12</span><span class="cl">    <span class="nf">strncpy</span><span class="p">(</span><span class="n">ctx</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">CONFIG_GOLIOTH_COAP_MAX_PATH_LEN</span><span class="p">);</span>  <span class="c1">// no NUL if len == max
</span></span></span><span class="line"><span class="ln">13</span><span class="cl"><span class="c1"></span>    <span class="c1">// ...
</span></span></span><span class="line"><span class="ln">14</span><span class="cl"><span class="c1"></span><span class="p">}</span>
</span></span></code></pre></div><p>The buffer is declared as <code>char path[CONFIG_GOLIOTH_COAP_MAX_PATH_LEN + 1]</code>, providing space for a NUL terminator. However, when <code>strlen(path)</code> is <em>exactly</em> <code>CONFIG_GOLIOTH_COAP_MAX_PATH_LEN</code>:</p>
<ol>
<li>The <code>&gt;</code> check passes (it should be <code>&gt;=</code>).</li>
<li><code>strncpy</code> copies exactly <code>CONFIG_GOLIOTH_COAP_MAX_PATH_LEN</code> bytes and does <strong>not</strong> append a NUL terminator (this is <code>strncpy</code>&rsquo;s documented behavior when the source length equals or exceeds the count).</li>
<li>Later, <code>strlen(ctx-&gt;path)</code> in <code>coap_client.c</code> reads past the buffer searching for a NUL byte.</li>
</ol>
<p>This is a classic <code>strncpy</code> misunderstanding. Many C developers assume <code>strncpy</code> always NUL-terminates. It does not when the source string fills the destination.</p>
<h3 id="impact-3">Impact</h3>
<p>The out-of-bounds <code>strlen()</code> read can cause:</p>
<ul>
<li>A crash if it walks into unmapped memory</li>
<li>Incorrect path construction if it finds a stale NUL byte further in memory</li>
<li>On safety-critical IoT devices (medical, industrial), even a locally-triggered crash can have real-world consequences</li>
</ul>
<h2 id="theoretical-chain-ble-proximity-to-device-compromise">Theoretical Chain: BLE Proximity to Device Compromise</h2>
<p>The following attack chain is <strong>theoretical</strong>. It has not been demonstrated end to end. It requires <code>CONFIG_POUCH_VALIDATE_SERVER_CERT</code> to be disabled, which is not default and the build system explicitly warns against for production use. With certificate validation enabled, the default, the chain breaks at step 2 and injected certificates are rejected.</p>
<p>That said, the chain illustrates how individual memory safety bugs compound when defense-in-depth is weakened. If certificate validation were disabled, three of the four vulnerabilities could connect into a path from unauthenticated BLE proximity to arbitrary code execution:</p>
<div style="position: relative; padding-left: 2.5rem; margin: 1.5rem 0;">
  <div style="position: absolute; left: calc(0.25rem + 10px); top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--color-accent);"></div>
  <div style="position: relative; padding-bottom: 1.5rem;">
    <div style="position: absolute; left: -2.25rem; top: 0.15rem; width: 22px; height: 22px; border-radius: 50%; background: var(--color-text-secondary); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--color-bg); line-height: 22px; text-align: center;">1</div>
    <div style="font-weight: 600; color: var(--color-text);">BLE Discovery (unauthenticated)</div>
    <div style="font-size: 0.875rem; color: var(--color-text-secondary);">Attacker scans for BLE GATT services, discovers server cert characteristic. No pairing or bonding required.</div>
  </div>
  <div style="position: relative; padding-bottom: 1.5rem;">
    <div style="position: absolute; left: -2.25rem; top: 0.15rem; width: 22px; height: 22px; border-radius: 50%; background: var(--color-accent); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--color-bg); line-height: 22px; text-align: center;">2</div>
    <div style="font-weight: 600; color: var(--color-text);">Certificate Injection <span style="font-size: 0.8rem; font-weight: 400; color: var(--color-accent);">(Vuln 1)</span></div>
    <div style="font-size: 0.875rem; color: var(--color-text-secondary);">Write attacker-controlled cert via GATT (<code>BT_GATT_PERM_WRITE</code>, no auth). Device stores it via <code>pouch_server_certificate_set()</code>.</div>
  </div>
  <div style="position: relative; padding-bottom: 1.5rem;">
    <div style="position: absolute; left: -2.25rem; top: 0.15rem; width: 22px; height: 22px; border-radius: 50%; background: var(--color-accent); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--color-bg); line-height: 22px; text-align: center;">3</div>
    <div style="font-weight: 600; color: var(--color-text);">MITM Established</div>
    <div style="font-size: 0.875rem; color: var(--color-text-secondary);">Device authenticates server using injected cert. Attacker holds the private key, intercepts and proxies the connection.</div>
  </div>
  <div style="position: relative;">
    <div style="position: absolute; left: -2.25rem; top: 0.15rem; width: 22px; height: 22px; border-radius: 50%; background: var(--color-accent); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--color-bg); line-height: 22px; text-align: center;">4</div>
    <div style="font-weight: 600; color: var(--color-text);">Exploitation <span style="font-size: 0.8rem; font-weight: 400; color: var(--color-accent);">(Vuln 2 or Vuln 3)</span></div>
  </div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 1rem 0 1.5rem;">
<div style="background: var(--color-bg-card); border: 1px solid #f59e0b; border-radius: 8px; padding: 1rem 1.25rem;">
<div style="font-weight: 600; color: var(--color-text); margin-bottom: 0.25rem;">Memory Disclosure</div>
<div style="font-size: 0.8rem; font-weight: 600; color: #f59e0b; margin-bottom: 0.5rem;">Vuln 2</div>
<div style="font-size: 0.85rem; color: var(--color-text-secondary); line-height: 1.5;">Send 1-byte string response → <code>size_t</code> underflow → OOB read → leak adjacent heap memory (keys, creds)</div>
</div>
<div style="background: var(--color-bg-card); border: 1px solid #dc2626; border-radius: 8px; padding: 1rem 1.25rem;">
<div style="font-weight: 600; color: var(--color-text); margin-bottom: 0.25rem;">Remote Code Execution</div>
<div style="font-size: 0.8rem; font-weight: 600; color: #dc2626; margin-bottom: 0.5rem;">Vuln 3</div>
<div style="font-size: 0.85rem; color: var(--color-text-secondary); line-height: 1.5;">Send oversized integer response → <code>assert()</code> absent in release → <code>memcpy</code> overflows 12-byte stack buffer → overwrite return address → RCE</div>
</div>
</div>
<h3 id="step-by-step-walkthrough">Step-by-Step Walkthrough</h3>
<ol>
<li>
<p><strong>BLE Discovery</strong> (~10-100m range): The attacker uses a BLE scanner (e.g., <code>nRF Connect</code>, a custom <code>bleak</code> script) to discover the Golioth GATT service and the server certificate characteristic UUID.</p>
</li>
<li>
<p><strong>Certificate Injection</strong>: The attacker writes a valid, attacker-controlled X.509 certificate to the characteristic. Because <code>BT_GATT_PERM_WRITE</code> requires no authentication, this succeeds on first connection. The device calls <code>pouch_server_certificate_set()</code> and persists the certificate. No overflow is needed for this step. The certificate just needs to be within <code>CONFIG_POUCH_SERVER_CERT_MAX_LEN</code>.</p>
</li>
<li>
<p><strong>MITM Established</strong>: When the device next initiates a session to the Golioth cloud, it uses the injected certificate to authenticate the server. The attacker, holding the corresponding private key, terminates the connection from the device and opens a separate connection to the real Golioth cloud, proxying traffic between the two. This step requires <code>CONFIG_POUCH_VALIDATE_SERVER_CERT</code> to be disabled; with validation enabled (the default), the injected certificate is rejected against the embedded CA and the chain breaks here.</p>
</li>
<li>
<p><strong>Exploitation</strong>: From the MITM position, the attacker waits for, or triggers, a LightDB State query from the device, then:</p>
<ul>
<li><strong>For memory disclosure (Vuln 2)</strong>: Responds with a 1-byte payload to a string GET, causing the underflow and OOB read. Leaked memory may contain DTLS keys or other secrets.</li>
<li><strong>For code execution (Vuln 3)</strong>: Responds with an oversized payload to an integer GET. In release builds, the assert is gone, and <code>memcpy</code> overwrites the stack. On Cortex-M with no ASLR or stack canaries, the return address is overwritten with an attacker-controlled value.</li>
</ul>
</li>
</ol>
<h3 id="feasibility-and-limitations">Feasibility and Limitations</h3>
<ul>
<li><strong>BLE range constraint</strong>: The initial step requires physical proximity. In practice, directional antennas can extend BLE range significantly, and many IoT deployments are in physically accessible locations.</li>
<li><strong>Certificate persistence</strong>: Whether the injected certificate persists across reboots depends on the Pouch configuration and storage backend. If persistent, the MITM survives power cycles.</li>
<li><strong>Release build requirement</strong>: Vulnerability 3 requires that <code>NDEBUG</code> is defined. This is the default for production firmware on all supported platforms.</li>
<li><strong>Certificate validation</strong>: The MITM step requires <code>CONFIG_POUCH_VALIDATE_SERVER_CERT</code> to be disabled. This option is enabled by default and validates server certificates against an embedded CA. When enabled, certificate injection is blocked.</li>
<li><strong>Vulnerability 4 is independent</strong>: The CoAP blockwise path issue is locally triggered and is not part of this chain.</li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>Four memory safety vulnerabilities across two Golioth IoT products. Each is independently triggerable under its own preconditions. The BLE heap overflow, Vuln 1, is the most immediately dangerous: any device running Pouch with BLE enabled can be crashed or have its certificate store corrupted by an unauthenticated attacker in radio range.</p>
<p>The theoretical chain from BLE to RCE requires certificate validation to be disabled, which is not the default. But the individual bugs do not require special configuration. A 1-byte CoAP response triggers the integer underflow. An oversized integer payload overwrites the stack in any release build. These are real risks independent of any chain.</p>
<p>The bugs themselves are not exotic. They are <code>memcpy</code> without bounds checks, <code>assert</code> instead of <code>if</code>, <code>strncpy</code> without NUL termination, unsigned subtraction without underflow guards. These are patterns that every C programmer learns to avoid, and that every C codebase eventually contains unless the review process catches them.</p>
<p>Embedded firmware needs the same level of scrutiny as kernel code. It runs with equivalent privilege (there is no lower ring on a Cortex-M), handles untrusted input from multiple interfaces (BLE, WiFi, CoAP, MQTT), and deploys to devices that may be physically accessible to attackers and difficult to update after deployment.</p>
<h2 id="disclosure-and-fix">Disclosure and Fix</h2>
<p>We reported all four vulnerabilities to Golioth through coordinated disclosure. The team responded promptly and confirmed all fixes before the disclosure deadline. SecMate would like to thank the Golioth team and maintainers for their responsiveness and security awareness. Fixes are available in Firmware SDK v0.22.0 and Pouch commit <a href="https://github.com/golioth/pouch/commit/1b2219a1" rel="noopener noreferrer" target="_blank">1b2219a1</a>.</p>
<h3 id="disclosure-timeline">Disclosure Timeline</h3>
<div style="position: relative; padding-left: 1.5rem; margin: 1.5rem 0;">
  <div style="position: absolute; left: 0.35rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--color-border);"></div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Oct 31, 2025</div>
    <div style="color: var(--color-text);">SecMate sent initial report to Golioth (<code>security@golioth.io</code>) with findings and proof-of-concept code</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Nov 5, 2025</div>
    <div style="color: var(--color-text);">Golioth confirmed receipt and began internal review</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 7, 2026</div>
    <div style="color: var(--color-text);">SecMate followed up; noted 90-day disclosure window ending ~Jan 29, 2026</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 9, 2026</div>
    <div style="color: var(--color-text);">Golioth confirmed all reported vulnerabilities have been addressed</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 15, 2026</div>
    <div style="color: var(--color-text);">Golioth confirmed no CVEs assigned; agreed to end-of-January disclosure; SecMate offered to handle CVE assignment</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 16, 2026</div>
    <div style="color: var(--color-text);">CVE IDs assigned by <a href="https://vulncheck.com/">VulnCheck</a>: CVE-2026-23747, CVE-2026-23748, CVE-2026-23749, CVE-2026-23750</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 22, 2026</div>
    <div style="color: var(--color-text);">Version ranges provided to VulnCheck; CVE records finalized for Firmware SDK vulnerabilities</div>
  </div>
  <div style="position: relative;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Jan 30, 2026</div>
    <div style="color: var(--color-text);">Public disclosure</div>
  </div>
</div>
<h3 id="cve-summary">CVE Summary</h3>
<div style="display: grid; gap: 0.75rem; margin: 1.5rem 0;">
<div style="background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.875rem 1.25rem;">
<div style="display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin-bottom: 0.375rem;"><span style="display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; font-size: 0.8rem; font-weight: 600; font-family: var(--font-mono); border-radius: 4px; background: color-mix(in srgb, #dc2626 12%, transparent); color: #dc2626; border: 1px solid color-mix(in srgb, #dc2626 25%, transparent);">CVE-2026-23750</span><span style="font-weight: 600; color: var(--color-text); font-size: 0.9rem;">BLE GATT Server Cert Heap Overflow</span></div>
<div style="font-size: 0.825rem; color: var(--color-text-secondary);">Pouch &middot; Introduced v0.1.0 &middot; Fixed in <a href="https://github.com/golioth/pouch/commit/1b2219a1" style="color: var(--color-accent);">1b2219a1</a></div>
</div>
<div style="background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.875rem 1.25rem;">
<div style="display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin-bottom: 0.375rem;"><span style="display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; font-size: 0.8rem; font-weight: 600; font-family: var(--font-mono); border-radius: 4px; background: color-mix(in srgb, #f59e0b 12%, transparent); color: #f59e0b; border: 1px solid color-mix(in srgb, #f59e0b 25%, transparent);">CVE-2026-23748</span><span style="font-weight: 600; color: var(--color-text); font-size: 0.9rem;">LightDB State String Underflow OOB Read</span></div>
<div style="font-size: 0.825rem; color: var(--color-text-secondary);">Firmware SDK &middot; Introduced v0.10.0 &middot; Fixed in <a href="https://github.com/golioth/golioth-firmware-sdk/commit/d7f55b38" style="color: var(--color-accent);">d7f55b38</a> (v0.22.0)</div>
</div>
<div style="background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.875rem 1.25rem;">
<div style="display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin-bottom: 0.375rem;"><span style="display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; font-size: 0.8rem; font-weight: 600; font-family: var(--font-mono); border-radius: 4px; background: color-mix(in srgb, #f59e0b 12%, transparent); color: #f59e0b; border: 1px solid color-mix(in srgb, #f59e0b 25%, transparent);">CVE-2026-23747</span><span style="font-weight: 600; color: var(--color-text); font-size: 0.9rem;">Assert-Guarded Memcpy Stack Overflow</span></div>
<div style="font-size: 0.825rem; color: var(--color-text-secondary);">Firmware SDK &middot; Introduced v0.10.0 &middot; Fixed in <a href="https://github.com/golioth/golioth-firmware-sdk/commit/57eac06" style="color: var(--color-accent);">57eac06</a> (v0.22.0)</div>
</div>
<div style="background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.875rem 1.25rem;">
<div style="display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin-bottom: 0.375rem;"><span style="display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; font-size: 0.8rem; font-weight: 600; font-family: var(--font-mono); border-radius: 4px; background: var(--color-muted-bg); color: var(--color-text-secondary); border: 1px solid var(--color-border);">CVE-2026-23749</span><span style="font-weight: 600; color: var(--color-text); font-size: 0.9rem;">CoAP Blockwise Unterminated Path OOB Read</span></div>
<div style="font-size: 0.825rem; color: var(--color-text-secondary);">Firmware SDK &middot; Introduced v0.19.1 &middot; Fixed in <a href="https://github.com/golioth/golioth-firmware-sdk/commit/0e788217" style="color: var(--color-accent);">0e788217</a> (v0.22.0)</div>
</div>
</div>
<h2 id="whats-next">What&rsquo;s Next</h2>
<p>This is our second public disclosure, after the <a href="/posts/libcoap-vulnerabilities-disclosure/">libcoap vulnerabilities</a> we published earlier. These four CVEs bring our public total to six, with more findings across embedded and systems projects still in coordinated disclosure.</p>
<p>For the full list, see our <a href="https://secmate.dev/disclosures?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=golioth-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="golioth-vulnerabilities-disclosure" data-post-category="security">disclosure page</a>. If you&rsquo;re building on embedded systems and want to find vulnerabilities before attackers do, <a href="https://secmate.dev/register?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=golioth-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_register" data-post-slug="golioth-vulnerabilities-disclosure" data-post-category="security">reach out</a>.</p>
<h2 id="references">References</h2>
<ul>
<li>
<p><a id="ref1"></a>[1] Golioth. &ldquo;Golioth Firmware SDK&rdquo; <em>GitHub</em>. <a href="https://github.com/golioth/golioth-firmware-sdk" rel="noopener noreferrer" target="_blank">Repository</a></p>
</li>
<li>
<p><a id="ref2"></a>[2] Golioth. &ldquo;Golioth Pouch&rdquo; <em>GitHub</em>. <a href="https://github.com/golioth/pouch" rel="noopener noreferrer" target="_blank">Repository</a></p>
</li>
<li>
<p><a id="ref3"></a>[3] IETF. &ldquo;RFC 7252 - The Constrained Application Protocol (CoAP)&rdquo; <em>IETF Datatracker</em>, June 2014. <a href="https://datatracker.ietf.org/doc/html/rfc7252" rel="noopener noreferrer" target="_blank">RFC</a></p>
</li>
<li>
<p><a id="ref4"></a>[4] NVD. &ldquo;CVE-2026-23750 - BLE GATT Server Certificate Heap Overflow in Golioth Pouch&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-23750" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref5"></a>[5] NVD. &ldquo;CVE-2026-23748 - LightDB State String Underflow OOB Read in Golioth Firmware SDK&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-23748" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref6"></a>[6] NVD. &ldquo;CVE-2026-23747 - Assert-Guarded Memcpy Stack Overflow in Golioth Firmware SDK&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-23747" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref7"></a>[7] NVD. &ldquo;CVE-2026-23749 - CoAP Blockwise Unterminated Path OOB Read in Golioth Firmware SDK&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-23749" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
</ul>
<hr>
<p><em>The SecMate Team</em></p>
]]></content:encoded><media:content url="https://blog.secmate.dev/images/og_image.jpg" medium="image"/></item><item><title>How SecMate Discovered two Vulnerabilities in libcoap</title><link>https://blog.secmate.dev/posts/libcoap-vulnerabilities-disclosure/</link><pubDate>Wed, 14 Jan 2026 00:00:00 +0000</pubDate><atom:updated>2026-01-14T00:00:00+00:00</atom:updated><dc:creator>Maxime Rossi Bellom</dc:creator><dc:creator>Ramtine Tofighi Shirazi</dc:creator><category>Security</category><category>Vulnerability Research</category><category>IoT</category><guid>https://blog.secmate.dev/posts/libcoap-vulnerabilities-disclosure/</guid><description>SecMate's AI-powered static analysis tool discovered two vulnerabilities in libcoap: an out-of-bounds write in address resolution (CVE-2025-34468) and an out-of-bounds read in OSCORE parsing (CVE-2025-59391). Here's the technical breakdown.</description><content:encoded><![CDATA[<h1 id="how-secmate-discovered-vulnerabilities-in-libcoap">How SecMate Discovered Vulnerabilities in libcoap</h1>
<p>We discovered two memory-safety issues in libcoap, a widely deployed IoT library. The first is an out-of-bounds write in a fixed buffer reachable via proxy requests that can crash servers with a single UDP packet. The second is an out-of-bounds read in OSCORE configuration parsing that can crash the parser on malformed input. Both vulnerabilities have amplified impact on the constrained embedded devices the library was built for.</p>
<h2 id="about-secmate">About SecMate</h2>
<p><a href="https://secmate.dev?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=libcoap-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_secmate" data-post-slug="libcoap-vulnerabilities-disclosure" data-post-category="security">SecMate</a> combines static analysis with AI to find security vulnerabilities in source code, specifically in embedded devices and low-level code.</p>
<p>So far, we have reported <strong>more than 60 vulnerabilities</strong> across embedded and systems projects, most still under <a href="https://secmate.dev/disclosures?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=libcoap-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="libcoap-vulnerabilities-disclosure" data-post-category="security">coordinated disclosure</a>.</p>
<p>Today, we are sharing two of our findings in libcoap (the first two CVEs uncovered with SecMate), a widely-used CoAP implementation for IoT devices.</p>
<h2 id="what-is-libcoap">What is libcoap?</h2>
<p>libcoap <a href="#ref1">[1]</a> is a C implementation of the Constrained Application Protocol (CoAP), standardized as RFC 7252 <a href="#ref2">[2]</a>. Think of CoAP as &ldquo;HTTP for IoT&rdquo;: a lightweight protocol for devices that can&rsquo;t afford the overhead of full HTTP/TCP stacks.</p>
<p>The library is mature and widely deployed:</p>
<ul>
<li>Supports multiple TLS backends (OpenSSL, GnuTLS, Mbed TLS, wolfSSL)</li>
<li>Runs on everything from Linux servers to ESP32 microcontrollers</li>
<li>Used in smart home devices, industrial sensors, and critical infrastructure</li>
</ul>
<p>Here is the catch: the devices running libcoap are often <em>constrained</em>. Limited memory, no MMU, no ASLR, no stack canaries. When you find a memory-safety issue in this context, the impact is amplified.</p>
<h2 id="vulnerability-1-static-buffer-overflow-in-address-resolution-cve-2025-34468-3ref3">Vulnerability #1: Static Buffer Overflow in Address Resolution (CVE-2025-34468 <a href="#ref3">[3]</a>)</h2>
<p><strong>Location</strong>: <code>coap_resolve_address_info()</code> in <code>src/coap_address.c</code></p>
<h3 id="the-bug">The Bug</h3>
<p>This vulnerability affects libcoap servers running in <strong>proxy mode</strong>. The vulnerable function resolves hostnames for CoAP proxy requests, copying the hostname into a fixed 256-byte static buffer without checking the length:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="k">static</span> <span class="kt">char</span> <span class="n">addrstr</span><span class="p">[</span><span class="mi">256</span><span class="p">];</span>  <span class="c1">// Fixed-size static buffer
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="c1"></span><span class="nf">memset</span><span class="p">(</span><span class="n">addrstr</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">addrstr</span><span class="p">));</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="k">if</span> <span class="p">(</span><span class="n">address</span> <span class="o">&amp;&amp;</span> <span class="n">address</span><span class="o">-&gt;</span><span class="n">length</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">    <span class="nf">memcpy</span><span class="p">(</span><span class="n">addrstr</span><span class="p">,</span> <span class="n">address</span><span class="o">-&gt;</span><span class="n">s</span><span class="p">,</span> <span class="n">address</span><span class="o">-&gt;</span><span class="n">length</span><span class="p">);</span>  <span class="c1">// No bounds check!
</span></span></span><span class="line"><span class="ln">5</span><span class="cl"><span class="c1"></span><span class="k">else</span>
</span></span><span class="line"><span class="ln">6</span><span class="cl">    <span class="nf">memcpy</span><span class="p">(</span><span class="n">addrstr</span><span class="p">,</span> <span class="s">&#34;localhost&#34;</span><span class="p">,</span> <span class="mi">9</span><span class="p">);</span>
</span></span><span class="line"><span class="ln">7</span><span class="cl"><span class="nf">getaddrinfo</span><span class="p">(</span><span class="n">addrstr</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">hints</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">res</span><span class="p">);</span>
</span></span></code></pre></div><p>The <code>address-&gt;length</code> field comes directly from parsing CoAP options. An attacker controls this value.</p>
<h3 id="the-attack">The Attack</h3>
<p>When a CoAP server runs in proxy mode, it accepts <code>Proxy-Uri</code> options that specify where to forward requests. The hostname from this URI flows directly into the vulnerable <code>memcpy()</code>:</p>
<ol>
<li>A CoAP request arrives with a <code>Proxy-Uri</code> option containing an oversized hostname (&gt;256 bytes)</li>
<li>The proxy extracts the hostname and passes it to <code>coap_resolve_address_info()</code></li>
<li>The function calls <code>memcpy(addrstr, address-&gt;s, address-&gt;length)</code> without bounds checking</li>
<li>The fixed-size buffer overflows, corrupting adjacent memory</li>
<li>The server crashes or misbehaves; the exact impact depends on layout and mitigations</li>
</ol>
<h3 id="impact">Impact</h3>
<p>On a standard Linux system, this bug is likely to crash the server (Denial of Service). On embedded devices without memory protection, memory corruption can have broader consequences, but practical exploitation depends on layout and mitigations. One UDP packet, no authentication required when proxy mode is enabled.</p>
<h2 id="vulnerability-2-out-of-bounds-read-in-oscore-parsing-cve-2025-59391-4ref4">Vulnerability #2: Out-of-Bounds Read in OSCORE Parsing (CVE-2025-59391 <a href="#ref4">[4]</a>)</h2>
<p><strong>Location</strong>: <code>get_split_entry()</code> in <code>src/coap_oscore.c</code></p>
<h3 id="the-bug-1">The Bug</h3>
<p>OSCORE (Object Security for Constrained RESTful Environments) is a security layer for CoAP. libcoap parses OSCORE configuration files that include boolean fields. The parsing code uses <code>memcmp()</code> with a user-controlled length:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="ln">1</span><span class="cl"><span class="k">case</span> <span class="nl">COAP_ENC_BOOL</span><span class="p">:</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl">    <span class="k">if</span> <span class="p">(</span><span class="nf">memcmp</span><span class="p">(</span><span class="s">&#34;true&#34;</span><span class="p">,</span> <span class="n">begin</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="n">begin</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl">        <span class="n">value</span><span class="o">-&gt;</span><span class="n">u</span><span class="p">.</span><span class="n">value_int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl">    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="nf">memcmp</span><span class="p">(</span><span class="s">&#34;false&#34;</span><span class="p">,</span> <span class="n">begin</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="n">begin</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
</span></span><span class="line"><span class="ln">5</span><span class="cl">        <span class="n">value</span><span class="o">-&gt;</span><span class="n">u</span><span class="p">.</span><span class="n">value_int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span></span></code></pre></div><p>The problem: <code>end - begin</code> comes from the configuration file. If an attacker provides a value like <code>trueAAAAAAAA...</code> (thousands of characters), the <code>memcmp()</code> reads past the static string <code>&quot;true&quot;</code> into adjacent memory.</p>
<h3 id="impact-1">Impact</h3>
<p>This issue requires the ability to provide malicious OSCORE configuration input, which is typically a local or trusted provisioning path rather than a network-facing vector. The realistic outcome is a crash or parse failure on malformed configs.</p>
<h3 id="theoretical-oracle-attack">Theoretical Oracle Attack</h3>
<p>In theory, if a local attacker could repeatedly provide different config files and observe success/failure signals from the parser, they could use this as an oracle to infer adjacent <code>.rodata</code> bytes one at a time. The diagram below illustrates what such an attack would look like:</p>
<svg viewBox="0 0 440 100" style="width: 100%; max-width: 440px; height: auto; margin: 1.5rem auto; display: block; font-family: monospace;">
  <style>
    .svg-label { fill: var(--color-text-secondary); }
    .svg-bg { fill: var(--color-muted-bg); stroke: var(--color-border); }
    .svg-known { fill: color-mix(in srgb, var(--color-accent) 30%, var(--color-bg-card)); stroke: var(--color-accent); }
    .svg-unknown { fill: var(--color-bg-card); stroke: var(--color-border); }
    .svg-text { fill: var(--color-text); }
    .svg-text-muted { fill: var(--color-text-secondary); }
  </style>
  <text x="220" y="14" text-anchor="middle" class="svg-label" font-size="11">memory layout</text>
  <rect x="10" y="22" width="420" height="44" rx="4" class="svg-bg" stroke-width="1"/>
  <rect x="15" y="26" width="36" height="36" rx="3" class="svg-known" stroke-width="2"/><text x="33" y="50" text-anchor="middle" class="svg-text" font-size="15">t</text>
  <rect x="56" y="26" width="36" height="36" rx="3" class="svg-known" stroke-width="2"/><text x="74" y="50" text-anchor="middle" class="svg-text" font-size="15">r</text>
  <rect x="97" y="26" width="36" height="36" rx="3" class="svg-known" stroke-width="2"/><text x="115" y="50" text-anchor="middle" class="svg-text" font-size="15">u</text>
  <rect x="138" y="26" width="36" height="36" rx="3" class="svg-known" stroke-width="2"/><text x="156" y="50" text-anchor="middle" class="svg-text" font-size="15">e</text>
  <rect x="179" y="26" width="36" height="36" rx="3" class="svg-known" stroke-width="2"/><text x="197" y="50" text-anchor="middle" class="svg-text" font-size="12">\0</text>
  <rect x="220" y="26" width="36" height="36" rx="3" class="svg-unknown" stroke-width="1"><animate attributeName="fill" values="var(--color-bg-card);#7f1d1d;#166534;#166534;#166534;#166534" dur="6s" repeatCount="indefinite"/><animate attributeName="stroke" values="var(--color-border);#dc2626;#22c55e;#22c55e;#22c55e;#22c55e" dur="6s" repeatCount="indefinite"/></rect>
  <text x="238" y="50" text-anchor="middle" class="svg-text-muted" font-size="15"><animate attributeName="opacity" values="1;1;0;0;0;0" dur="6s" repeatCount="indefinite"/>?</text>
  <text x="238" y="50" text-anchor="middle" class="svg-text" font-size="15"><animate attributeName="opacity" values="0;0;1;1;1;1" dur="6s" repeatCount="indefinite"/>f</text>
  <rect x="261" y="26" width="36" height="36" rx="3" class="svg-unknown" stroke-width="1"><animate attributeName="fill" values="var(--color-bg-card);var(--color-bg-card);var(--color-bg-card);#7f1d1d;#166534;#166534" dur="6s" repeatCount="indefinite"/><animate attributeName="stroke" values="var(--color-border);var(--color-border);var(--color-border);#dc2626;#22c55e;#22c55e" dur="6s" repeatCount="indefinite"/></rect>
  <text x="279" y="50" text-anchor="middle" class="svg-text-muted" font-size="15"><animate attributeName="opacity" values="1;1;1;1;0;0" dur="6s" repeatCount="indefinite"/>?</text>
  <text x="279" y="50" text-anchor="middle" class="svg-text" font-size="15"><animate attributeName="opacity" values="0;0;0;0;1;1" dur="6s" repeatCount="indefinite"/>a</text>
  <rect x="302" y="26" width="36" height="36" rx="3" class="svg-unknown" stroke-width="1"/><text x="320" y="50" text-anchor="middle" class="svg-text-muted" font-size="15">?</text>
  <rect x="343" y="26" width="36" height="36" rx="3" class="svg-unknown" stroke-width="1"/><text x="361" y="50" text-anchor="middle" class="svg-text-muted" font-size="15">?</text>
  <rect x="384" y="26" width="36" height="36" rx="3" class="svg-unknown" stroke-width="1"/><text x="402" y="50" text-anchor="middle" class="svg-text-muted" font-size="15">?</text>
  <text x="135" y="88" text-anchor="start" font-size="15" font-weight="bold" class="svg-label">true\0</text>
  <text x="200" y="88" text-anchor="start" font-size="15" font-weight="bold" class="svg-label"><animate attributeName="opacity" values="1;0;0;0;0;0" dur="6s" calcMode="discrete" repeatCount="indefinite"/>...</text>
  <text x="200" y="88" text-anchor="start" font-size="15" font-weight="bold" fill="#dc2626"><animate attributeName="opacity" values="0;1;0;0;0;0" dur="6s" calcMode="discrete" repeatCount="indefinite"/>Y ✗</text>
  <text x="200" y="88" text-anchor="start" font-size="15" font-weight="bold" fill="#22c55e"><animate attributeName="opacity" values="0;0;1;0;0;0" dur="6s" calcMode="discrete" repeatCount="indefinite"/>f ✓</text>
  <text x="200" y="88" text-anchor="start" font-size="15" font-weight="bold" fill="#dc2626"><animate attributeName="opacity" values="0;0;0;1;0;0" dur="6s" calcMode="discrete" repeatCount="indefinite"/>fK ✗</text>
  <text x="200" y="88" text-anchor="start" font-size="15" font-weight="bold" fill="#22c55e"><animate attributeName="opacity" values="0;0;0;0;1;0" dur="6s" calcMode="discrete" repeatCount="indefinite"/>fa ✓</text>
  <text x="200" y="88" text-anchor="start" font-size="15" font-weight="bold" fill="#22c55e"><animate attributeName="opacity" values="0;0;0;0;0;1" dur="6s" calcMode="discrete" repeatCount="indefinite"/>fa</text>
</svg>
<p>However, this attack is impractical: OSCORE configuration is loaded from local files, so an attacker would need repeated local access to provide different config files and observe results. At that point, they likely have access that makes this leak scenario moot.</p>
<blockquote class="admonition admonition-insight">
<strong>Why This Bug is Easy to Miss</strong>
<p>This vulnerability is subtle: the out-of-bounds read in <code>memcmp()</code> may not crash or produce obvious symptoms during normal operation. Spotting it requires reasoning about how data flows through multiple operations, something traditional static analysis tools typically miss.</p>
</blockquote>
<h2 id="the-embedded-security-challenge">The Embedded Security Challenge</h2>
<p>Both vulnerabilities share a common theme: <strong>they are worse on the devices libcoap is designed for</strong>.</p>
<p>Desktop and server systems have decades of hardening:</p>
<ul>
<li>ASLR randomizes memory layout</li>
<li>Stack canaries detect buffer overflows</li>
<li>DEP/NX prevents code execution from data segments</li>
<li>Sandboxing limits blast radius</li>
</ul>
<p>Constrained embedded devices often have none of these. A microcontroller running FreeRTOS or bare metal has:</p>
<ul>
<li>Flat, predictable memory layout</li>
<li>No memory protection unit (MPU) or it is disabled for performance</li>
<li>No operating system to enforce isolation</li>
<li>Direct hardware access for any code that runs</li>
</ul>
<p>This isn&rsquo;t a criticism of libcoap. It is the reality of their target environment. But it means bugs like these deserve extra scrutiny.</p>
<blockquote class="admonition admonition-insight">
<strong>Key Insight</strong>
<p>When auditing code for constrained devices, assume the worst-case exploitation scenario. Mitigations you take for granted on desktop systems simply don't exist.</p>
</blockquote>
<h2 id="disclosure-and-fix">Disclosure and Fix</h2>
<p>We reported both vulnerabilities to the libcoap maintainers through coordinated disclosure. The team responded quickly and professionally, and fixes are now available in version 4.3.5a.</p>
<h3 id="disclosure-timeline">Disclosure Timeline</h3>
<div style="position: relative; padding-left: 1.5rem; margin: 1.5rem 0;">
  <div style="position: absolute; left: 0.35rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--color-border);"></div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 3, 2025</div>
    <div style="color: var(--color-text);">SecMate reported OSCORE out-of-bounds read to libcoap security team</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 3, 2025</div>
    <div style="color: var(--color-text);">Maintainer acknowledged and confirmed the issue is reproducible</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 10, 2025</div>
    <div style="color: var(--color-text);">SecMate reported static buffer overflow to libcoap security team</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 10, 2025</div>
    <div style="color: var(--color-text);">Maintainer acknowledged the second vulnerability</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 15, 2025</div>
    <div style="color: var(--color-text);">Fix for OSCORE issue merged (<a href="https://github.com/obgm/libcoap/pull/1730">PR #1730</a>)</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 15, 2025</div>
    <div style="color: var(--color-text);">Fix for static buffer overflow merged (<a href="https://github.com/obgm/libcoap/pull/1737">PR #1737</a>)</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-secondary); border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Sep 15, 2025</div>
    <div style="color: var(--color-text);">CVE requests submitted to MITRE for both issues</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Nov 27, 2025</div>
    <div style="color: var(--color-text);">libcoap v4.3.5a released with patches for both vulnerabilities</div>
  </div>
  <div style="position: relative; padding-bottom: 1.25rem;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Dec 8, 2025</div>
    <div style="color: var(--color-text);">CVE-2025-59391 assigned by MITRE <span style="color: var(--color-text-secondary);">(85 days after request)</span></div>
  </div>
  <div style="position: relative;">
    <div style="position: absolute; left: -1.15rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; border: 2px solid var(--color-bg);"></div>
    <div style="font-size: 0.75rem; color: var(--color-text-secondary); font-weight: 600;">Dec 31, 2025</div>
    <div style="color: var(--color-text);">CVE-2025-34468 assigned by <a href="https://vulncheck.com/">VulnCheck</a> <span style="color: var(--color-text-secondary);">(same day, MITRE never responded)</span></div>
  </div>
</div>
<p>We want to thank the libcoap team, particularly Jon Shallow, for their responsiveness in addressing these issues. The maintainer responded on the same day for both reports. Maintaining open-source security infrastructure is often thankless work, and their quick turnaround made the ecosystem safer.</p>
<h2 id="whats-next">What&rsquo;s Next</h2>
<p>These two CVEs are just a sample of what SecMate has found. We&rsquo;re continuing to analyze embedded codebases and report vulnerabilities through coordinated disclosure.</p>
<p>If you&rsquo;re curious about our other findings, check out our <a href="https://secmate.dev/disclosures?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=libcoap-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_disclosures" data-post-slug="libcoap-vulnerabilities-disclosure" data-post-category="security">disclosure page</a>. And if you&rsquo;re building embedded systems and want to find vulnerabilities before attackers do, <a href="https://secmate.dev/register?utm_source=blog&amp;utm_medium=body&amp;utm_campaign=libcoap-vulnerabilities-disclosure&amp;utm_content=security" rel="noopener noreferrer" target="_blank" data-cta-type="body_register" data-post-slug="libcoap-vulnerabilities-disclosure" data-post-category="security">reach out</a>.</p>
<h2 id="references">References</h2>
<ul>
<li>
<p><a id="ref1"></a>[1] libcoap. &ldquo;libcoap - C-Implementation of CoAP&rdquo; <em>GitHub</em>. <a href="https://github.com/obgm/libcoap" rel="noopener noreferrer" target="_blank">Repository</a></p>
</li>
<li>
<p><a id="ref2"></a>[2] IETF. &ldquo;RFC 7252 - The Constrained Application Protocol (CoAP)&rdquo; <em>IETF Datatracker</em>, June 2014. <a href="https://datatracker.ietf.org/doc/html/rfc7252" rel="noopener noreferrer" target="_blank">RFC</a></p>
</li>
<li>
<p><a id="ref3"></a>[3] NVD. &ldquo;CVE-2025-34468 - Static Buffer Overflow in libcoap&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2025-34468" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
<li>
<p><a id="ref4"></a>[4] NVD. &ldquo;CVE-2025-59391 - Out-of-Bounds Read in libcoap&rdquo; <em>National Vulnerability Database</em>. <a href="https://nvd.nist.gov/vuln/detail/CVE-2025-59391" rel="noopener noreferrer" target="_blank">CVE</a></p>
</li>
</ul>
<hr>
<p><em>The SecMate Team</em></p>
]]></content:encoded><media:content url="https://blog.secmate.dev/images/og_image.jpg" medium="image"/></item></channel></rss>