<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Exploitation on Arzedlab 🪵</title><link>https://arzedlab.github.io/tags/exploitation/</link><description>Recent content in Exploitation on Arzedlab 🪵</description><generator>Hugo</generator><language>en-us</language><copyright>© Ravshan</copyright><lastBuildDate>Thu, 05 Jun 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://arzedlab.github.io/tags/exploitation/index.xml" rel="self" type="application/rss+xml"/><item><title>Linux Kernel Exploitation Part 1: ret2usr</title><link>https://arzedlab.github.io/posts/kernel-exploitation-ret2usr-part-1-2063648c0bf4802299a9f392ff3c809b/</link><pubDate>Thu, 05 Jun 2025 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/kernel-exploitation-ret2usr-part-1-2063648c0bf4802299a9f392ff3c809b/</guid><description>&lt;h1 id="kernel-exploitation-ret2usr-part-1">Kernel Exploitation ret2usr Part 1&lt;/h1>
&lt;p>&lt;strong>&lt;code>compress.sh&lt;/code> - To extract compressed image from linux&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-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">#!/bin/sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">&lt;/span>gcc -o exploit -static &lt;span style="color:#8be9fd;font-style:italic">$1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mv ./exploit ./initramfs
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">cd&lt;/span> initramfs
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>find . -print0 &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span>| cpio --null -ov --format&lt;span style="color:#ff79c6">=&lt;/span>newc &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span>| gzip -9 &amp;gt; initramfs.cpio.gz
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mv ./initramfs.cpio.gz ../
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>&lt;code>run.sh&lt;/code> - Run qemu configuration&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-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">#!/bin/sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">&lt;/span>qemu-system-x86_64 &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -s &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -m 128M &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -cpu kvm64,+smep,+smap &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -kernel vmlinuz &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -initrd initramfs.cpio.gz &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -hdb flag.txt &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -snapshot &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -nographic &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -monitor /dev/null &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -no-reboot &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> -append &lt;span style="color:#f1fa8c">&amp;#34;console=ttyS0 quiet panic=1 nosmep nosmap nopti nokaslr&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>As you can see all security mitigations are turned off. &lt;code>-s&lt;/code> flag set for debugging the linux kernel.&lt;/p></description></item><item><title>Linux Kernel Exploitation Part 2: Adding Mitigitions</title><link>https://arzedlab.github.io/posts/kernel-2-adding-mitigitions-2063648c0bf4808c81cec3f938783649/</link><pubDate>Thu, 05 Jun 2025 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/kernel-2-adding-mitigitions-2063648c0bf4808c81cec3f938783649/</guid><description>&lt;h1 id="kernel-2-adding-mitigitions">Kernel 2: Adding Mitigitions&lt;/h1>
&lt;h2 id="adding-smep">&lt;strong>Adding SMEP&lt;/strong>&lt;/h2>
&lt;p>&lt;code>SMEP&lt;/code>, abbreviated for &lt;a href="https://web.archive.org/web/20160803075007/https://www.ncsi.com/nsatc11/presentations/wednesday/emerging_technologies/fischer.pdf">Supervisor mode execution protection (SMEP)&lt;/a>, is a feature that marks all the userland pages in the page table as non-executable when the process is exectuting in &lt;code>kernel-mode&lt;/code>. In the kernel, this is enabled by setting the &lt;code>20th bit&lt;/code> of Control Register &lt;code>CR4&lt;/code>.&lt;/p>
&lt;p>&lt;img src="image.png" alt="image.png">&lt;/p>
&lt;p>&lt;img src="image%201.png" alt="image.png">&lt;/p>
&lt;h3 id="check-its-in-gdb">Check it&amp;rsquo;s in gdb&lt;/h3>
&lt;p>Run the qemu with &lt;code>-s&lt;/code> and on qemu boot, it can be enabled by adding &lt;code>+smep&lt;/code> to &lt;code>-cpu&lt;/code>, and disabled by adding &lt;code>nosmep&lt;/code> to &lt;code>-append&lt;/code>.&lt;/p></description></item><item><title>Linux Heap Exploitation internals</title><link>https://arzedlab.github.io/posts/linux-heap-exploitation-internals-17a3648c0bf480eda8dcc5f521e1351b/</link><pubDate>Tue, 14 Jan 2025 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/linux-heap-exploitation-internals-17a3648c0bf480eda8dcc5f521e1351b/</guid><description>&lt;h2 id="lifo-and-fifo">LIFO AND FIFO&lt;/h2>
&lt;p>&lt;img src="image.png" alt="image.png">&lt;/p>
&lt;p>LIFO (Last-In, First-Out) and FIFO (First-In, First-Out) are two fundamental methods for managing data structures, each with distinct characteristics and applications.&lt;/p>
&lt;p>&lt;strong>LIFO (Last-In, First-Out):&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Structure:&lt;/strong> Commonly implemented using a stack, where the most recently added item is the first to be removed.&lt;/li>
&lt;li>&lt;strong>Analogy:&lt;/strong> Think of a stack of plates; you add and remove plates from the top.&lt;/li>
&lt;li>&lt;strong>Applications:&lt;/strong>
&lt;ul>
&lt;li>&lt;strong>Memory Management:&lt;/strong> Utilized in function call management and recursive processes, where the last called function is the first to return.&lt;/li>
&lt;li>&lt;strong>Undo Functionality:&lt;/strong> In applications like text editors, the last action performed is the first to be undone.&lt;/li>
&lt;li>&lt;strong>Browser History:&lt;/strong> The most recently visited page is the first to be revisited when navigating backward.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>FIFO (First-In, First-Out):&lt;/strong>&lt;/p></description></item><item><title>Linux Heap Exploitation: Unsafe Unlink</title><link>https://arzedlab.github.io/posts/unsafe-unlink-1483648c0bf48032a944dc2bc36b5207/</link><pubDate>Tue, 14 Jan 2025 00:00:00 +0000</pubDate><guid>https://arzedlab.github.io/posts/unsafe-unlink-1483648c0bf48032a944dc2bc36b5207/</guid><description>&lt;h1 id="unsafe-unlink">Unsafe Unlink&lt;/h1>
&lt;h1 id="introduction">Introduction&lt;/h1>
&lt;p>The &amp;ldquo;Unsafe Unlink&amp;rdquo; technique is a heap exploitation attack that was once quite common. It involves manipulating the unlink macro in &lt;code>malloc.c&lt;/code> to remove a chunk from a bin. This attack exploits the pointer manipulation done in the unlink macro, which can lead to arbitrary code execution or other malicious activities.&lt;/p>
&lt;p>When we free allocated unsorted bin, it will be freed from a doubly linked list.&lt;/p>
&lt;p>A doubly linked list is a type of data structure that consists of a sequence of elements, where each element (or node) contains three parts:&lt;/p></description></item><item><title>write4 | ROPEmporium [4]</title><link>https://arzedlab.github.io/posts/ropemporium_write4/</link><pubDate>Tue, 12 Nov 2024 15:45:36 +0500</pubDate><guid>https://arzedlab.github.io/posts/ropemporium_write4/</guid><description>Functions themselves are in an external library we should call it from there. Imported files proves the command &lt;code>rabin2 -i &amp;lt;binary&amp;gt;&lt;/code></description></item><item><title>callme | ROPEmporium [3]</title><link>https://arzedlab.github.io/posts/ropemporium_callme/</link><pubDate>Tue, 12 Nov 2024 15:19:36 +0500</pubDate><guid>https://arzedlab.github.io/posts/ropemporium_callme/</guid><description>Ok we have three functions, and we should call them with arguments, which are given, there are &lt;code>0xdeadbeef&lt;/code>, &lt;code>0xcafebabe&lt;/code>, &lt;code>0xd00df00d&lt;/code> . Functions itself are in external library we should call them one by one. Buffer overflow offset is the same, and &lt;code>checksec&lt;/code></description></item><item><title>split | ROPEmporium [2]</title><link>https://arzedlab.github.io/posts/ropemporium-split/</link><pubDate>Tue, 12 Nov 2024 14:20:25 +0500</pubDate><guid>https://arzedlab.github.io/posts/ropemporium-split/</guid><description>In this challenge, we should run system() function with argument &lt;code>/bin/cat flag.txt&lt;/code></description></item><item><title>ret2win | ROPEmporium [1]</title><link>https://arzedlab.github.io/posts/ropemporium-ret2win/</link><pubDate>Mon, 11 Nov 2024 11:41:24 +0500</pubDate><guid>https://arzedlab.github.io/posts/ropemporium-ret2win/</guid><description>One common introductory ROP challenge is known as &lt;strong>ret2win&lt;/strong>. The goal is to call a specific function in the program called &lt;code>ret2win&lt;/code>, which prints a success message and reveal a flag.txt</description></item></channel></rss>