<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Heap on Arzedlab 🪵</title><link>https://arzedlab.github.io/tags/heap/</link><description>Recent content in Heap on Arzedlab 🪵</description><generator>Hugo</generator><language>en-us</language><copyright>© Ravshan</copyright><lastBuildDate>Fri, 22 Aug 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://arzedlab.github.io/tags/heap/index.xml" rel="self" type="application/rss+xml"/><item><title>Exploring Integer Overflow: libxml2 Integer Overflow, which leads to OOB</title><link>https://arzedlab.github.io/posts/exploring-integer-overflow-libxml2-integer-overflo-2573648c0bf48058ace1d536b4a81251/</link><pubDate>Fri, 22 Aug 2025 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/exploring-integer-overflow-libxml2-integer-overflo-2573648c0bf48058ace1d536b4a81251/</guid><description>&lt;h1 id="exploring-integer-overflow-libxml2-integer-overflow-oob">Exploring Integer Overflow: libxml2 Integer Overflow OOB&lt;/h1>
&lt;p>In everyday life, numbers feel endless. You can always count one higher, or subtract one more. But computers don’t work like that. Inside your machine, numbers are stored in &lt;strong>fixed-sized containers&lt;/strong> and when you push them past their limits, strange things happen. When a calculation produces a value that’s too large or too small for its container, we get integer overflow or integer underflow.&lt;/p></description></item><item><title>EXIM: CVE-2020-28025: Heap out-of-bounds read in pdkim_finish_bodyhash()</title><link>https://arzedlab.github.io/posts/exim-analysis-4-92-1-r-1fc3648c0bf4804d9828e1aa08614f70/</link><pubDate>Mon, 26 May 2025 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/exim-analysis-4-92-1-r-1fc3648c0bf4804d9828e1aa08614f70/</guid><description>&lt;h1 id="exim-analysis-4921-r">EXIM: Analysis 4.92.1-R&lt;/h1>
&lt;p>This is just as re-analysis to better understand, the reporter and author of there vulnerabileties is company Qualys official link: &lt;a href="https://www.qualys.com/2021/05/04/21nails/21nails.txt">https://www.qualys.com/2021/05/04/21nails/21nails.txt&lt;/a>&lt;/p>
&lt;h2 id="cve-2020-28025-heap-out-of-bounds-read-in-pdkim_finish_bodyhash">CVE-2020-28025: Heap out-of-bounds read in pdkim_finish_bodyhash()&lt;/h2>
&lt;ol>
&lt;li>Callers of &lt;code>pdkim_finish_bodyhash()&lt;/code>&lt;/li>
&lt;/ol>
&lt;p>&lt;code>main()&lt;/code> → &lt;code>receive_msg()&lt;/code> → &lt;code>dkim_exim_verify_finish()&lt;/code>&lt;/p>
&lt;p>&lt;code>dkim_exim_verify_finish()&lt;/code> be called to verify DKIM (DomainKeys Identified Mail)
signature, then calls &lt;code>pdkim_feed_finish()&lt;/code> &lt;strong>, which calls&lt;/strong> &lt;code>pdkim_finish_bodyhash()&lt;/code>&lt;/p>
&lt;ol>
&lt;li>DKIM (DomainKeys Identified Mail) looks like this.&lt;/li>
&lt;/ol>
&lt;p>&lt;img src="image.png" alt="image.png">&lt;/p>
&lt;p>Code of the function &lt;code>pdkim_finish_bodyhash()&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>...
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> /* VERIFICATION --------------------------------------------------------- */
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> /* Be careful that the header sig included a bodyash */
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">if&lt;/span> &lt;span style="color:#ff79c6">(&lt;/span> sig-&amp;gt;bodyhash.data
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;amp;&amp;amp;&lt;/span> memcmp&lt;span style="color:#ff79c6">(&lt;/span>b-&amp;gt;bh.data, sig-&amp;gt;bodyhash.data, b-&amp;gt;bh.len&lt;span style="color:#ff79c6">)&lt;/span> &lt;span style="color:#ff79c6">==&lt;/span> 0&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> DEBUG&lt;span style="color:#ff79c6">(&lt;/span>D_acl&lt;span style="color:#ff79c6">)&lt;/span> debug_printf&lt;span style="color:#ff79c6">(&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;PDKIM [%s] Body hash compared OK\n&amp;#34;&lt;/span>, sig-&amp;gt;domain&lt;span style="color:#ff79c6">)&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> DEBUG&lt;span style="color:#ff79c6">(&lt;/span>D_acl&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	debug_printf&lt;span style="color:#ff79c6">(&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;PDKIM [%s] Body hash signature from headers: &amp;#34;&lt;/span>, sig-&amp;gt;domain&lt;span style="color:#ff79c6">)&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	pdkim_hexprint&lt;span style="color:#ff79c6">(&lt;/span>sig-&amp;gt;bodyhash.data, sig-&amp;gt;bodyhash.len&lt;span style="color:#ff79c6">)&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	debug_printf&lt;span style="color:#ff79c6">(&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;PDKIM [%s] Body hash did NOT verify\n&amp;#34;&lt;/span>, sig-&amp;gt;domain&lt;span style="color:#ff79c6">)&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	&lt;span style="color:#ff79c6">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> sig-&amp;gt;verify_status &lt;span style="color:#ff79c6">=&lt;/span> PDKIM_VERIFY_FAIL;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> sig-&amp;gt;verify_ext_status &lt;span style="color:#ff79c6">=&lt;/span> PDKIM_VERIFY_FAIL_BODY;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>...
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Unfortunately, at line 826, &lt;code>sig-&amp;gt;bodyhash.data&lt;/code> is attacker-controlled (through a &amp;ldquo;DKIM-Signature:&amp;rdquo; mail header) and &lt;code>memcmp()&lt;/code> is called without checking first that &lt;code>sig-&amp;gt;bodyhash.len&lt;/code> is equal to &lt;code>b-&amp;gt;bh.len&lt;/code>: &lt;code>memcmp()&lt;/code> can read &lt;code>sig-&amp;gt;bodyhash.data&lt;/code> out-of-bounds. If the &lt;code>acl_smtp_dkim&lt;/code> is set (it is unset by default), an unauthenticated remote attacker may transform this vulnerability into an information disclosure; we have not fully explored this possibility.&lt;/p></description></item><item><title>CVE-2021-36414: heap-buffer-overflow MP4Box</title><link>https://arzedlab.github.io/posts/cve-2021-36414-1cb3648c0bf480a3b897cfdfea0a9efc/</link><pubDate>Tue, 04 Apr 2023 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/cve-2021-36414-1cb3648c0bf480a3b897cfdfea0a9efc/</guid><description>&lt;h1 id="cve-2021-36414">CVE-2021-36414&lt;/h1>
&lt;p>A heap-buffer-overflow has occurred when running program MP4Box,which leads to a Deny of Service caused by dividing zero without sanity check,this can reproduce on the lattest commit.&lt;/p>
&lt;p>Here: the main problem is dividing into zero&lt;/p>
&lt;p>&lt;img src="image.png" alt="image.png">&lt;/p>
&lt;p>&lt;strong>Assigning &lt;code>block_size&lt;/code>:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c" data-lang="c">&lt;span style="display:flex;">&lt;span>block_size &lt;span style="color:#ff79c6">=&lt;/span> ent &lt;span style="color:#ff79c6">?&lt;/span> ent&lt;span style="color:#ff79c6">-&amp;gt;&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">sampleDelta&lt;/span> : &lt;span style="color:#bd93f9">160&lt;/span>;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>This line uses the conditional (ternary) operator to assign a value to &lt;code>block_size&lt;/code>.&lt;/li>
&lt;li>It checks if &lt;code>ent&lt;/code> is not &lt;code>NULL&lt;/code>.
&lt;ul>
&lt;li>If &lt;code>ent&lt;/code> is valid (i.e., not &lt;code>NULL&lt;/code>), &lt;code>block_size&lt;/code> is assigned the value of &lt;code>ent-&amp;gt;sampleDelta&lt;/code>.&lt;/li>
&lt;li>If &lt;code>ent&lt;/code> is &lt;code>NULL&lt;/code>, &lt;code>block_size&lt;/code> is assigned a default value of &lt;code>160&lt;/code>.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h2 id="fix">Fix&lt;/h2>
&lt;p>&lt;img src="image%201.png" alt="image.png">&lt;/p></description></item></channel></rss>