<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Matthew Gasiewski</title>
    <description>The latest articles on DEV Community by Matthew Gasiewski (@matthew_gasiewski_98e9ad4).</description>
    <link>https://dev.to/matthew_gasiewski_98e9ad4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3784525%2F0c8dd3a3-53f8-4656-b702-e95a61452f96.jpg</url>
      <title>DEV Community: Matthew Gasiewski</title>
      <link>https://dev.to/matthew_gasiewski_98e9ad4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matthew_gasiewski_98e9ad4"/>
    <language>en</language>
    <item>
      <title>Yet Another CVE analysis (CVE-2019-14287)</title>
      <dc:creator>Matthew Gasiewski</dc:creator>
      <pubDate>Mon, 23 Feb 2026 23:19:34 +0000</pubDate>
      <link>https://dev.to/matthew_gasiewski_98e9ad4/yet-another-cve-analysis-cve-2019-14287-4kp6</link>
      <guid>https://dev.to/matthew_gasiewski_98e9ad4/yet-another-cve-analysis-cve-2019-14287-4kp6</guid>
      <description>&lt;p&gt;Last time I did a heap overflow CVE analysis. I wanted to analyze a different kind of bug this time, so I chose one for Sudo that is a logic bug. The CVE is CVE-2019-14287 and it contains an error with how Sudo handled integers and unsigned integer wrapping with -1.&lt;/p&gt;

&lt;p&gt;So the linux program &lt;code&gt;sudo&lt;/code&gt; allows a user to temporarily elevate access so that a program (such as an installer) can run and change something a user would otherwise not have access to do. This program has a configurations file called &lt;code&gt;sudoers&lt;/code&gt; that specifies which users a particular user can. In order to exploit this CVE, you must specify the user as having &lt;code&gt;(ALL, !root)&lt;/code&gt; access in the sudoers file which means the user can assume anyone accept root.&lt;/p&gt;

&lt;p&gt;To achieve this, the user with this sudoers entry must pass &lt;code&gt;-1&lt;/code&gt; as a command line argument to specify the user number the user wants to assume. Like this: &lt;code&gt;sudo -u -1&lt;/code&gt;. -1 is not a valid user number, and so when sudo receives it, the number wraps back around to 4294967295, the highest number for an unsigned int.&lt;/p&gt;

&lt;p&gt;The kernel reinterprets this as a -1 which means "don't change the uid of the current user." However, Sudo runs as root, so when this kernel function is called, the user is changed to root. That is the exploit, the user will switch to root as a result and be given full access.&lt;/p&gt;

&lt;p&gt;I set this environment up by using Docker and an old image of Ubuntu, 18.04. From there, I downloaded the sudo version 1.8.27 because this version was patched. I created a tesuser and updated the sudoers file. Then I ran the command &lt;code&gt;sudo -u#-1 /bin/bash&lt;/code&gt; and it gave me root access.&lt;/p&gt;

&lt;p&gt;CVE 2019-14287 was very easy to reproduce, and I would recommend giving this a try if you want to see a relatively simple CVE. It's very gratifying to do this and actually get root access.&lt;/p&gt;

</description>
      <category>infosec</category>
      <category>sudo</category>
      <category>cybersecurity</category>
      <category>linux</category>
    </item>
    <item>
      <title>CVE-2021-3156 analysis.</title>
      <dc:creator>Matthew Gasiewski</dc:creator>
      <pubDate>Sun, 22 Feb 2026 05:54:06 +0000</pubDate>
      <link>https://dev.to/matthew_gasiewski_98e9ad4/cve-2021-3156-analysis-n9k</link>
      <guid>https://dev.to/matthew_gasiewski_98e9ad4/cve-2021-3156-analysis-n9k</guid>
      <description>&lt;p&gt;This past week, I decided I wanted to learn more about exploits and exploit analysis. As a result, I checked out CVE-2021-3156, a Sudo vulnerability from 2021 that has long since been patched. Reproducing the vulnerability presented a number of difficulties: setting up an environment with a pre-2021 version of Sudo, ensuring it hadn't been patched, and triggered the heap overflow. However, I was unable to achieve full code execution due to heap layout differences in Docker.&lt;/p&gt;

&lt;p&gt;CVE-2021-3156 is a heap-based buffer overflow in sudo. The vulnerability allows you to write data beyond the bounds of an allocated buffer, corrupting adjacent memory on the heap. The exploit targets the &lt;code&gt;service_user&lt;/code&gt; struct in glibc's Name Service Switch (NSS) system, which contains function pointers used for user and group lookups. By overflowing the buffer, you can overwrite these function pointers to redirect them to attacker-controlled code.&lt;br&gt;
When sudo calls an NSS function (like &lt;code&gt;getpwnam_r()&lt;/code&gt; to look up user information), it follows the corrupted function pointer and executes your code instead. Since sudo runs with root privileges, your code inherits those privileges, allowing you to spawn a root shell.&lt;/p&gt;

&lt;p&gt;I needed to set up an environment with this vulnerability. The first approach was to run Ubuntu 18.04 in the UTM virtualization application. The older Ubuntu image presented some issues. Installation crashed repeatedly across multiple attempts, and even the live image of this version would not run. I abandoned this approach in favor of using a docker container.&lt;/p&gt;

&lt;p&gt;A Docker container running Ubuntu 18.04 ran successfully on my machine. However when I attempted the exploit, I received a usage error indicating that Sudo had been updated. I checked the binary's timestamp and it had been compiled in 2023 which was two years after the patch.&lt;/p&gt;

&lt;p&gt;Finally, I simply downloaded the old version of Sudo in the docker instance of Ubuntu 18.04, and I installed it. I ran it from it's location, and success! I can achieve a memory access error using this version of sudo.&lt;/p&gt;

&lt;p&gt;From here I downloaded the exploit scripts, and attempted to exploit this flaw to gain root access. Because these scripts assume the default version of sudo and not the one I installed, they repeatedly would not work. I made a symlink to the newly installed sudo and that did allow the heap overflow attempt to gain root access. Unfortunately after trying multiple different chunk sizes, I could not gain root access through the exploit. I speculate that Docker may arrange heap memory substantially differently from a typical Ubuntu install, making this exploit more difficult to achieve.&lt;/p&gt;

&lt;p&gt;So while I did not get to root shell, the exercise taught me a lot: how heap-based buffer overflows work, the difficulties of exploits on different architectures, using virtualization to match a target architecture, and why exploits are not universal across architectures.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>infosec</category>
      <category>linux</category>
      <category>security</category>
    </item>
  </channel>
</rss>
