<?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 razvan.sh</title>
		<link>https://razvan.sh/posts/</link>
		<description>Recent content in Posts on razvan.sh</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
		
			<lastBuildDate>Sat, 28 Feb 2026 12:00:00 +0200</lastBuildDate>
		
			<atom:link href="https://razvan.sh/posts/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Cool Arbitrary-Write-to-RCE Chain in glibc&#39;s Thread Descriptor</title>
				<link>https://razvan.sh/posts/glibc-thread-descriptor/</link>
				<pubDate>Sat, 28 Feb 2026 12:00:00 +0200</pubDate>
				<guid>https://razvan.sh/posts/glibc-thread-descriptor/</guid>
				<description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;This post describes an arbitrary write to RCE chain I found in glibc’s per-thread descriptor (&lt;code&gt;struct pthread&lt;/code&gt;) in TLS on x86_64.&lt;/p&gt;&#xA;&lt;p&gt;On modern glibc versions (2.36+), the relevant fields are conveniently adjacent, allowing a single write to forge a cleanup node and achieve RCE. On older versions, the &lt;code&gt;canceltype&lt;/code&gt; field is located far away, usually necessitating two separate writes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;glibc stores per-thread cancellation and cleanup state in &lt;code&gt;struct pthread&lt;/code&gt;. The cancellation-unwind path in &lt;code&gt;unwind_stop&lt;/code&gt; eventually executes:&lt;/p&gt;</description>
			</item>
			<item>
				<title>rweb @ QnQSec CTF 2025</title>
				<link>https://razvan.sh/posts/rweb-qnqsec/</link>
				<pubDate>Sat, 18 Oct 2025 12:00:00 +0300</pubDate>
				<guid>https://razvan.sh/posts/rweb-qnqsec/</guid>
				<description>&lt;h2 id=&#34;challenge-details&#34;&gt;Challenge details&lt;/h2&gt;&#xA;&lt;p&gt;So you like web and reverse, can you try this one yet&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; byamb4&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://razvan.sh/posts-files/rweb-qnqsec/challenge&#34;&gt;challenge&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;challenge: Mach-O 64-bit x86_64 executable, flags:&amp;lt;|DYLDLINK|PIE&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;The challenge binary is a GoLang Mach-O executable compiled for x86_64 architecture. The challenge also provides an IP address and port where an HTTP server is running.&lt;/p&gt;&#xA;&lt;h2 id=&#34;reversing-the-binary&#34;&gt;Reversing the Binary&lt;/h2&gt;&#xA;&lt;p&gt;Most of the significant code is located in the &lt;code&gt;main.main.func1&lt;/code&gt; function. Reversing the binary reveals that the server listens on port 8080 and exposes a single endpoint: &lt;code&gt;/search&lt;/code&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>UAF in Linux Kernel Module - baby-kernel @ UIUCTF 2025</title>
				<link>https://razvan.sh/posts/baby-kernel-uiuctf/</link>
				<pubDate>Mon, 28 Jul 2025 12:00:00 +0300</pubDate>
				<guid>https://razvan.sh/posts/baby-kernel-uiuctf/</guid>
				<description>&lt;h2 id=&#34;challenge-details&#34;&gt;Challenge details&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://razvan.sh/posts-files/baby-kernel-uiuctf/handout.tar.zst&#34;&gt;handout.tar.zst&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;The challenge features a vulnerable kernel module &lt;code&gt;vuln.ko&lt;/code&gt; in a QEMU VM with Linux kernel &lt;a href=&#34;https://elixir.bootlin.com/linux/v6.6.16/source&#34;&gt;v6.6.16&lt;/a&gt;. It exposes &lt;code&gt;/dev/vuln&lt;/code&gt; with ioctl commands for allocating, freeing, reading, and writing a global kernel buffer. The main vulnerability is a UAF, as the buffer pointer remains dangling after free without nullification:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff7b72&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#79c0ff;font-weight:bold&#34;&gt;FREE&lt;/span&gt;: {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff7b72&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;!&lt;/span&gt;buf) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#ff7b72&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;-&lt;/span&gt;EFAULT;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;kfree&lt;/span&gt;(buf);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff7b72&#34;&gt;break&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff7b72&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#79c0ff;font-weight:bold&#34;&gt;USE_READ&lt;/span&gt;: {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff7b72&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;!&lt;/span&gt;buf) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#ff7b72&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;-&lt;/span&gt;EFAULT;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff7b72&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;copy_to_user&lt;/span&gt;((&lt;span style=&#34;color:#ff7b72&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;*&lt;/span&gt;)arg, buf, size);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;KASLR, SMEP &amp;amp; SMAP are enabled.&lt;/p&gt;</description>
			</item>
			<item>
				<title>FSOP in Cosmopolitan - cosmofile @ L3akCTF 2025</title>
				<link>https://razvan.sh/posts/cosmofile-l3ak/</link>
				<pubDate>Sun, 13 Jul 2025 12:00:00 +0300</pubDate>
				<guid>https://razvan.sh/posts/cosmofile-l3ak/</guid>
				<description>&lt;h2 id=&#34;challenge-details&#34;&gt;Challenge details&lt;/h2&gt;&#xA;&lt;p&gt;Have you ever read files? Hopefully, this will teach you how to read them. Go read the code, the Dockerfile, the fake flag, and the secrets of the universe&amp;hellip;and the real flag, of course.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://razvan.sh/posts-files/cosmofile-l3akctf/cosmofile.zip&#34;&gt;cosmofile.zip&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;This challenge features a binary compiled with &lt;a href=&#34;https://github.com/jart/cosmopolitan&#34;&gt;Cosmopolitan Libc&lt;/a&gt; - a build system that creates &amp;ldquo;Actually Portable Executable&amp;rdquo; binaries. There are no protections enabled except for NX.&lt;/p&gt;&#xA;&lt;p&gt;The binary opens &lt;code&gt;/tmp/cosmofile.txt&lt;/code&gt; and provides a menu with options to read from the file or exit. There&amp;rsquo;s also a hidden backdoor option &lt;code&gt;7238770&lt;/code&gt; that allows writing up to &lt;code&gt;0x70&lt;/code&gt; bytes directly to the FILE structure:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Allocating inside tcache_perthread_struct - limit @ smileyCTF 2025</title>
				<link>https://razvan.sh/posts/limit-smileyctf/</link>
				<pubDate>Tue, 24 Jun 2025 12:00:00 +0300</pubDate>
				<guid>https://razvan.sh/posts/limit-smileyctf/</guid>
				<description>&lt;h2 id=&#34;challenge-details&#34;&gt;Challenge details&lt;/h2&gt;&#xA;&lt;p&gt;I heard you could malloc into scary places, so im adding a check to prevent that from ever happening!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://razvan.sh/posts-files/limit-smileyctf/limit.tar.gz&#34;&gt;limit.tar.gz&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;This challenge implements a heap note system with malloc/free/print/write operations on &lt;code&gt;glibc 2.39&lt;/code&gt;. A limit check preventing chunks above the heap boundary via &lt;code&gt;sbrk(0)&lt;/code&gt; is present upon allocation:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chunks[idx] &lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;malloc&lt;/span&gt;(sz);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff7b72&#34;&gt;if&lt;/span&gt; (chunks[idx] &lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; limit) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#a5d6ff&#34;&gt;&amp;#34;hey where do you think ur going&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8b949e;font-style:italic&#34;&gt;// if (malloc_usable_size(chunks[idx])) free(chunks[idx])&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    chunks[idx] &lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a5d6ff&#34;&gt;0&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff7b72&#34;&gt;break&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8b949e;font-style:italic&#34;&gt;// this will be abused later&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8b949e;font-style:italic&#34;&gt;// chunks are still allocated even if above limit, only operations are blocked&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;The main vulnerability is an off by null bug in the write function, overflowing a null byte into the next chunk:&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
