<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by elze1n on Medium]]></title>
        <description><![CDATA[Stories by elze1n on Medium]]></description>
        <link>https://medium.com/@elze1n?source=rss-5cdeeb04edfe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P0Edu87bPe__s2C9px5xkA.jpeg</url>
            <title>Stories by elze1n on Medium</title>
            <link>https://medium.com/@elze1n?source=rss-5cdeeb04edfe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:08:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elze1n/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Message That Ate the CPU: Finding a Quadratic-Time DoS in Markdown Parsing]]></title>
            <link>https://elze1n.medium.com/the-message-that-ate-the-cpu-finding-a-quadratic-time-dos-in-markdown-parsing-7813c2dc8df4?source=rss-5cdeeb04edfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/7813c2dc8df4</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[elze1n]]></dc:creator>
            <pubDate>Sat, 21 Nov 2026 12:44:21 GMT</pubDate>
            <atom:updated>2026-11-21T12:44:21.903Z</atom:updated>
            <content:encoded><![CDATA[<p>How three characters in a Markdown message turned a normal chat operation into a server-side CPU exhaustion vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KyFHuJo-O4UFVF7GGQd6mA.png" /></figure><h4>بسم الله والحمد لله والصلاة والسلام على رسول الله</h4><blockquote><strong>Hello Folks, Hope this write-up find you well<br>My name is elzein (elze1n), </strong>Welcome to my first write-up i hope you like it</blockquote><p>Imagine sending a chat message.<br>Nothing unusual about it. No attachments, no images, no complicated formatting. Just a string of characters.<br>You press Enter. And then you wait.</p><blockquote>5 seconds. 10 seconds. 20 seconds. …no response?</blockquote><p>Meanwhile, one of your server’s CPU cores is running at 100%, doing nothing but processing that message.</p><p>Sounds strange for a chat application, right?<br>That’s exactly what happened when I investigated a server-side denial-of-service vulnerability in the Collab-app</p><p>The entire problem came down to an inefficient Markdown parsing algorithm and a surprisingly simple input pattern:</p><pre>](a](a](a](a](a](a](a](a...</pre><h3>1. Normal Text vs. Crafted Markdown</h3><p>The platform processes Markdown on the server, so I wanted to understand whether malformed Markdown could trigger expensive parsing operations.</p><p>I created two messages of approximately the same size:</p><p><strong>Control message:</strong></p><pre>message = &quot;a&quot; * 65536</pre><p><strong>Crafted message:</strong></p><pre>message = &quot;](a&quot; * 21845</pre><p>Both messages contain approximately 64 KB of text.</p><p>I sent them through the same authenticated API endpoint:</p><pre>POST /api/v4/posts</pre><p>The results were immediately interesting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*tyPk_XvO0u9sMIGq3EU4tg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*CEmieXP4XKhMNyquzc9-Zg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*SurBqlyrS0l8EZTIRR_Jig.png" /></figure><p>The crafted input was triggering significantly more server-side processing.</p><p>And the most interesting part was that increasing the input size produced a disproportionate increase in execution time.</p><h3>2. The Three Characters Behind the Problem</h3><p>To understand the vulnerability, we need to look at how Markdown links work.</p><p>A standard Markdown link looks like this:</p><pre>[link text](destination)<br>[Click here](https://example.com)</pre><p>The parser encounters ], checks whether it is followed by (, and attempts to parse the destination.</p><p>Now consider an incomplete link:</p><pre>](some-destination</pre><p>There is no closing ).</p><p>An incomplete construct like this becomes interesting when repeated thousands of times:</p><pre>](a](a](a](a](a](a](a](a...</pre><p>Each ]( sequence can trigger another attempt to parse a link destination.</p><p>The problem is what happens when the destination parser cannot find a closing parenthesis.</p><p>Instead of stopping after a reasonable search window, it continues scanning toward the end of the input.</p><h3>3. Why Does This Become O(n²)?</h3><p>Conceptually, the work looks like this:</p><pre>First opener:   scan almost N characters<br>Second opener:  scan almost N characters<br>Third opener:   scan almost N characters<br>...<br>Last opener:    scan a few characters</pre><p>The total amount of work resembles:<br>N + (N-1) + (N-2) + (⋯) + 1</p><h3>4. The Problem Doesn’t Stop When the Message Is Sent</h3><p>This was arguably the most interesting part of the investigation.</p><p>Initially, I expected the expensive operation to happen only when creating a post.</p><p>However, tracing the application revealed that Markdown inspection happens in multiple places.</p><p>During post creation, the relevant processing includes:</p><ul><li>getFirstLink in post_metadata.go</li><li>getImages in post_metadata.go</li><li>getExplicitMentions in notification.go</li></ul><p>These operations invoke Markdown inspection. The post is also processed again when preparing it for clients:</p><pre>PreparePostForClientWithEmbedsAndImages</pre><p><strong>The attacker pays the cost once to publish the message. Other users can pay that cost again when retrieving it.</strong></p><p>Unfortunately, it was marked as a duplicate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*zCXqeiXYXo_7B00j4xKAqA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7813c2dc8df4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>