<feed xmlns="http://www.w3.org/2005/Atom"> <id>https://alighaffarian.github.io/</id><title>Ali Ghaffarian</title><subtitle>A blog focused on embedded Linux and C programming, along with CTF writeups</subtitle> <updated>2026-10-11T16:58:22+03:30</updated> <author> <name>Ali Ghaffarian</name> <uri>https://alighaffarian.github.io/</uri> </author><link rel="self" type="application/atom+xml" href="https://alighaffarian.github.io/feed.xml"/><link rel="alternate" type="text/html" hreflang="en" href="https://alighaffarian.github.io/"/> <generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator> <rights> © 2026 Ali Ghaffarian </rights> <icon>/assets/img/favicons/favicon.ico</icon> <logo>/assets/img/favicons/favicon-96x96.png</logo> <entry><title>[draft] Making VMs Talk Over Emulated UART</title><link href="https://alighaffarian.github.io/posts/running-multi-node-iot-protocol-using-qemu/" rel="alternate" type="text/html" title="[draft] Making VMs Talk Over Emulated UART" /><published>2026-10-08T00:00:00+03:30</published> <updated>2026-10-11T16:57:59+03:30</updated> <id>https://alighaffarian.github.io/posts/running-multi-node-iot-protocol-using-qemu/</id> <content type="text/html" src="https://alighaffarian.github.io/posts/running-multi-node-iot-protocol-using-qemu/" /> <author> <name>Ali Ghaffarian</name> </author> <category term="internship" /> <summary>TL;DR: I didn’t have ESP32 boards to test my token passing protocol (silly_proto v1), so I simulated them. QEMU’s -serial option can redirect an emulated ESP32’s UART to a TCP socket, so I wrote a runner that acts as a central TCP proxy. It forwards the master’s output to every slave and the slaves’ output back to the master. The runner also builds and starts the nodes and shows each one in its...</summary> </entry> <entry><title>C Bit Fields Are Not Portable</title><link href="https://alighaffarian.github.io/posts/c-bit-fields-are-not-portable/" rel="alternate" type="text/html" title="C Bit Fields Are Not Portable" /><published>2026-09-26T00:00:00+03:30</published> <updated>2026-09-26T00:00:00+03:30</updated> <id>https://alighaffarian.github.io/posts/c-bit-fields-are-not-portable/</id> <content type="text/html" src="https://alighaffarian.github.io/posts/c-bit-fields-are-not-portable/" /> <author> <name>Ali Ghaffarian</name> </author> <category term="C" /> <category term="pitfalls" /> <summary>TL;DR When needing to parse a non byte aligned data structure, mapping it directly to C bit fields in a packed struct seems like a clever decoding approach. But the C standard lets the implementation to make some decisions on the binary layout, beyond our control. Although directly casting to a bit field described structure works fine on amd64(gcc) and probably little endian machines in genera...</summary> </entry> <entry><title>Do Me a Favor When X happens! Making a code Programmable Using Dynamic Callbacks</title><link href="https://alighaffarian.github.io/posts/do-me-a-favor-when-x-happens/" rel="alternate" type="text/html" title="Do Me a Favor When X happens! Making a code Programmable Using Dynamic Callbacks" /><published>2026-09-13T00:00:00+03:30</published> <updated>2026-09-13T00:00:00+03:30</updated> <id>https://alighaffarian.github.io/posts/do-me-a-favor-when-x-happens/</id> <content type="text/html" src="https://alighaffarian.github.io/posts/do-me-a-favor-when-x-happens/" /> <author> <name>Ali Ghaffarian</name> </author> <category term="internship" /> <summary>TL;DR While implementing a custom networking protocol for an IoT project, I ran into a decoupling problem: a central event emitter needed to reset timers owned by separate state machines. Hardcoding this logic into the emitter created a tight coupling anti pattern. I solved this by implementing a thread safe, dynamic callback system in C, complete with hook points and self unregistering callbac...</summary> </entry> <entry><title>Pwn K17 Huge Binary 1 Writeup</title><link href="https://alighaffarian.github.io/posts/pwn-k17-huge-binary-1-writeup/" rel="alternate" type="text/html" title="Pwn K17 Huge Binary 1 Writeup" /><published>2026-09-12T00:00:00+03:30</published> <updated>2026-09-18T20:20:14+03:30</updated> <id>https://alighaffarian.github.io/posts/pwn-k17-huge-binary-1-writeup/</id> <content type="text/html" src="https://alighaffarian.github.io/posts/pwn-k17-huge-binary-1-writeup/" /> <author> <name>Ali Ghaffarian</name> </author> <category term="CTF" /> <category term="pwn" /> <summary>TL;DR This writeup covers the exploitation of huge-binary-1, chaining an arbitrary stack read with a format string vulnerability. I used the stack read to leak __libc_start_main’s return address and calculate the libc base. Then, I used a format string bug to perform a 16-bit chunked GOT overwrite, replacing printf with system, and passed /bin/sh through a second buffer to get a shell. Contex...</summary> </entry> </feed>
