<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on MUGUREL</title><link>https://ft-mugurel.github.io/posts/</link><description>Recent content in Posts on MUGUREL</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><lastBuildDate>Tue, 06 May 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://ft-mugurel.github.io/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Vuln 1001</title><link>https://ft-mugurel.github.io/posts/vuln-1001/</link><pubDate>Tue, 06 May 2025 00:00:00 +0000</pubDate><guid>https://ft-mugurel.github.io/posts/vuln-1001/</guid><description>&lt;h1 id="01-introduction">01 Introduction&lt;/h1>
&lt;h2 id="vulnerability-types">Vulnerability Types&lt;/h2>
&lt;ul>
&lt;li>Heap out of bounds&lt;/li>
&lt;li>Use after free&lt;/li>
&lt;li>Type confusion&lt;/li>
&lt;li>Uninitialized use&lt;/li>
&lt;/ul>
&lt;h2 id="terms">Terms&lt;/h2>
&lt;h3 id="acid-attacker-controlled-input-data-tainted-date">ACID (Attacker Controlled Input Data) tainted date&lt;/h3>
&lt;ul>
&lt;li>ACID is a term used to describe the input data that an attacker can control.&lt;/li>
&lt;/ul>
&lt;h3 id="shellcode">Shellcode&lt;/h3>
&lt;ul>
&lt;li>Shellcode means a piece of code that an attacker wants user to execute.&lt;/li>
&lt;/ul>
&lt;h2 id="exploit-primitives">#Exploit Primitives&lt;/h2>
&lt;ul>
&lt;li>Exploit primitives are the basic building blocks of an exploit. They are the fundamental techniques that an attacker can use to gain control of a system or application.&lt;/li>
&lt;/ul>
&lt;h4 id="example">Example&lt;/h4>
&lt;ul>
&lt;li>Overwrite of return address&lt;/li>
&lt;li>Overwrite of other local variables&lt;/li>
&lt;li>Overwrite of heap data&lt;/li>
&lt;/ul>
&lt;h3 id="exploit-chain">Exploit Chain&lt;/h3>
&lt;ul>
&lt;li>This means that an attacker can use multiple exploit primitives together to create a more complex exploit.&lt;/li>
&lt;/ul>
&lt;h3 id="zero-day">Zero Day&lt;/h3>
&lt;ul>
&lt;li>A zero-day vulnerability is a security flaw that is unknown to the vendor and has not been patched. Attackers can exploit these vulnerabilities before the vendor releases a fix, making them particularly dangerous.&lt;/li>
&lt;/ul>
&lt;h3 id="n-day">N-day&lt;/h3>
&lt;ul>
&lt;li>An N-day vulnerability is a security flaw that has been publicly disclosed and for which a patch is available. Attackers can exploit these vulnerabilities if users do not apply the patch in a timely manner.&lt;/li>
&lt;/ul>
&lt;h3 id="attack-surface">Attack Surface&lt;/h3>
&lt;ul>
&lt;li>The attack surface is the totality of all the points in a system that an attacker can use to gain access to the system. This includes all the inputs, outputs, and interfaces that an attacker can use to interact with the system.
&lt;img src="https://ft-mugurel.github.io/posts/vuln-1001/attack-surface.png" alt="Attack Surface">&lt;/li>
&lt;/ul>
&lt;h3 id="sploity-sens">Sploity Sens&lt;/h3>
&lt;ul>
&lt;li>Sploity sens is a term used to describe when an vulnerability hunters develop a 6 sence to detect vulnerabilities. When they see so many vulnerabilities, they start to see patterns and can identify potential vulnerabilities more easily.&lt;/li>
&lt;/ul>
&lt;h3 id="words-of-power">Words of Power&lt;/h3>
&lt;ol>
&lt;li>Parse&lt;/li>
&lt;li>Decode&lt;/li>
&lt;li>Convert&lt;/li>
&lt;li>Deserialize&lt;/li>
&lt;li>Interpret&lt;/li>
&lt;li>Decompress&lt;/li>
&lt;/ol>
&lt;h3 id="program-paranoid">Program Paranoid&lt;/h3>
&lt;ul>
&lt;li>If you are not paranoid they ara out the get you.&lt;/li>
&lt;/ul>
&lt;h1 id="02-stack-buffer-overflow">02 Stack Buffer Overflow&lt;/h1>
&lt;h2 id="what-is-a-stack-buffer-overflow">What is a stack buffer overflow?&lt;/h2>
&lt;ul>
&lt;li>A stack buffer overflow is a type of vulnerability that occurs when a program writes more data to a buffer on the stack than it can hold. This can lead to overwriting adjacent memory locations, including the return address of a function, which can allow an attacker to execute arbitrary code.&lt;/li>
&lt;/ul>
&lt;h3 id="common-causes-of-stack-buffer-overflows">Common causes of stack buffer overflows&lt;/h3>
&lt;ul>
&lt;li>Using unsafe functions like &lt;code>strcpy&lt;/code>, &lt;code>strcat&lt;/code>, and &lt;code>sprintf&lt;/code> that do not check the size of the destination buffer.&lt;/li>
&lt;li>Sequentially data writes with in a loop with an ACID loop condition.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-c" data-lang="c">&lt;span class="line">&lt;span class="cl">&lt;span class="cp">#include&lt;/span> &lt;span class="cpf">&amp;lt;stdio.h&amp;gt;&lt;/span>&lt;span class="cp">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="cp">#include&lt;/span> &lt;span class="cpf">&amp;lt;string.h&amp;gt;&lt;/span>&lt;span class="cp">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="cp">&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kt">int&lt;/span> &lt;span class="nf">main&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="kt">int&lt;/span> &lt;span class="n">argc&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="kt">char&lt;/span> &lt;span class="o">*&lt;/span>&lt;span class="n">argv&lt;/span>&lt;span class="p">[])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kt">char&lt;/span> &lt;span class="n">buffer&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">8&lt;/span>&lt;span class="p">];&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nf">strcpy&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">buffer&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">argv&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">]);&lt;/span> &lt;span class="c1">// Vulnerable to stack buffer overflow
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">&lt;/span> &lt;span class="nf">printf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">&amp;#34;Buffer: %s&lt;/span>&lt;span class="se">\n&lt;/span>&lt;span class="s">&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">buffer&lt;/span>&lt;span class="p">);&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;img src="https://ft-mugurel.github.io/posts/vuln-1001/Example-stack01.png" alt="Example-stack">&lt;/p></description></item><item><title>Kernel Module Programming</title><link>https://ft-mugurel.github.io/posts/kernel-module/</link><pubDate>Thu, 17 Apr 2025 00:00:00 +0000</pubDate><guid>https://ft-mugurel.github.io/posts/kernel-module/</guid><description>&lt;h1 id="what-is-kernel">What is kernel?&lt;/h1>
&lt;h1 id="what-is-kernel-module">What is kernel module?&lt;/h1>
&lt;h1 id="initial-setup-for-debugging">Initial setup for debugging&lt;/h1>
&lt;h1 id="commands-about-kernel-modules">Commands about kernel modules&lt;/h1>
&lt;ul>
&lt;li>lsmod # List loaded kernel modules&lt;/li>
&lt;li>modinfo &amp;lt;module_name&amp;gt; # Show information about a kernel module&lt;/li>
&lt;li>insmod &amp;lt;module_name&amp;gt; # Load a kernel module&lt;/li>
&lt;li>rmmod &amp;lt;module_name&amp;gt; # Unload a kernel module&lt;/li>
&lt;li>dmesg &amp;lt;module_name&amp;gt; # Show messages from a kernel module&lt;/li>
&lt;li>dmesg -W # wait for new messages&lt;/li>
&lt;li>dmesg -w # Show all pass messages from a kernel module and wait for new messages&lt;/li>
&lt;li>modprobe &amp;lt;module_name&amp;gt; # Load a kernel module and its dependencies&lt;/li>
&lt;/ul></description></item><item><title>KFS</title><link>https://ft-mugurel.github.io/posts/kfs/</link><pubDate>Thu, 17 Apr 2025 00:00:00 +0000</pubDate><guid>https://ft-mugurel.github.io/posts/kfs/</guid><description>&lt;h1 id="kfs-1">KFS-1&lt;/h1>
&lt;h2 id="kfs-nedir">KFS Nedir?&lt;/h2>
&lt;ul>
&lt;li>KFS (Kernel From Scratch) tamamen sıfırdan bir kernel yazma projesidir. Bu proje ile birlikte kernel ve bilgisayar hardware konusunda bir çok bilgi edinilebilir.&lt;/li>
&lt;/ul>
&lt;h2 id="grub">GRUB&lt;/h2>
&lt;h3 id="grub-nedir">GRUB Nedir?&lt;/h3>
&lt;ul>
&lt;li>GRUB (GRand Unified Bootloader) bir bootloader&amp;rsquo;dir. Bilgisayar açılırken işletim sistemini yüklemek için kullanılır.&lt;/li>
&lt;li>GRUB, bir çok işletim sistemini destekler.&lt;/li>
&lt;/ul>
&lt;h2 id="stand-alone-binary">STAND Alone binary&lt;/h2>
&lt;h3 id="stand-alone-binary-nedir">STAND Alone binary Nedir?&lt;/h3>
&lt;ul>
&lt;li>STAND Alone binary, bir işletim sistemi olmadan çalışabilen bir binary&amp;rsquo;dir. Bu binary, işletim sistemi olmadan çalışabilir.&lt;/li>
&lt;li>&lt;/li>
&lt;/ul>
&lt;h2 id="multiboot">Multiboot&lt;/h2>
&lt;h2 id="vga">VGA&lt;/h2>
&lt;h3 id="vga-nedir">VGA Nedir?&lt;/h3>
&lt;ul>
&lt;li>VGA çipi eski bir standart lakin hala güncel ekran kartlarında desteklenmeye devam ediyor. Bu sebeple bunun için bir driver yazmak çekici bir durum.&lt;/li>
&lt;/ul>
&lt;h3 id="vga-nasıl-çalışır">VGA Nasıl çalışır?&lt;/h3>
&lt;ul>
&lt;li>&lt;/li>
&lt;/ul>
&lt;h2 id="gdt">GDT&lt;/h2>
&lt;h3 id="gdt-nedir">GDT Nedir?&lt;/h3>
&lt;ul>
&lt;li>GDT (Global Descriptor Table) bir bellek yönetim tablosudur. Bu tablo, bellek yönetimi için kullanılır.&lt;/li>
&lt;/ul>
&lt;h3 id="gdt-nasıl-çalışır">GDT Nasıl çalışır?&lt;/h3>
&lt;h2 id="idt">IDT&lt;/h2>
&lt;p>IDT (Interrupt Descriptor Table) bir kesme yönetim tablosudur. Bu tablo, kesme yönetimi için kullanılır.&lt;/p></description></item><item><title>VKM</title><link>https://ft-mugurel.github.io/posts/vkm/</link><pubDate>Thu, 17 Apr 2025 00:00:00 +0000</pubDate><guid>https://ft-mugurel.github.io/posts/vkm/</guid><description>&lt;h1 id="initial-setup-for-debugging">Initial setup for debugging&lt;/h1>
&lt;ol>
&lt;li>Install the VKM project for our vurnable kernel module.&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git clone https://github.com/ft-mugurel/VKM.git
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> VKM
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>Now we need an kernel with debugging enabled.&lt;/li>
&lt;/ul>
&lt;ol>
&lt;li>Install the linux kernel.&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.tar.xz
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tar xvf linux-6.8.tar.xz
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mv linux-6.8 linux
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> linux
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="2">
&lt;li>Create the default configuration file.&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">make defconfig
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">make kvm_guest.config
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="3">
&lt;li>Enable the following options by adding them to the &lt;code>.config&lt;/code> file:&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Coverage collection.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">CONFIG_KCOV&lt;/span>&lt;span class="o">=&lt;/span>y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Debug info for symbolization.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">CONFIG_DEBUG_INFO_DWARF4&lt;/span>&lt;span class="o">=&lt;/span>y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Memory bug detector&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">CONFIG_KASAN&lt;/span>&lt;span class="o">=&lt;/span>y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">CONFIG_KASAN_INLINE&lt;/span>&lt;span class="o">=&lt;/span>y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Required for Debian Stretch and later&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">CONFIG_CONFIGFS_FS&lt;/span>&lt;span class="o">=&lt;/span>y
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">CONFIG_SECURITYFS&lt;/span>&lt;span class="o">=&lt;/span>y
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Or just run the following command:&lt;/p></description></item></channel></rss>