<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mirseyid Mirzazada on Medium]]></title>
        <description><![CDATA[Stories by Mirseyid Mirzazada on Medium]]></description>
        <link>https://medium.com/@m1r1?source=rss-862f18be092c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zw3qyMtxeweVIejnwUv4uQ.jpeg</url>
            <title>Stories by Mirseyid Mirzazada on Medium</title>
            <link>https://medium.com/@m1r1?source=rss-862f18be092c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:55:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m1r1/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lazy VM-idekCTF 2025 Writeup]]></title>
            <link>https://m1r1.medium.com/lazy-vm-idekctf-2025-writeup-077a8653a870?source=rss-862f18be092c------2</link>
            <guid isPermaLink="false">https://medium.com/p/077a8653a870</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Mirseyid Mirzazada]]></dc:creator>
            <pubDate>Mon, 04 Aug 2025 19:30:56 GMT</pubDate>
            <atom:updated>2025-08-04T19:30:56.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*7j7Vte7k3K2YiHdzVUf2VA.png" /><figcaption>idekCTF</figcaption></figure><p><strong>Challange Description —</strong> <br>I was too lazy busy to code a CTF challenge myself, so I hired a freelancer online for just $5 to take care of it. However, when I received the work, the quality was far below expectations. Deciding not to pay for the poor-quality challenge, I refused to settle the debt. Frustrated, the freelancer left the challenge running online, refusing to hand it over or shut it down.</p><p>All I know is that it’s a virtual machine challenge, and the flag.txt file is located in the same folder as the challenge. Beyond that, I have no idea how the challenge works.</p><p>Connection: nc lazy-vm.chal.idek.team 1337</p><h3>Initial Analysis</h3><p>When connecting to the service, I was greeted with a simple prompt asking for code input. My first instinct was to try some basic commands, but they all resulted in “Unknown instruction” errors.</p><pre>$ nc lazy-vm.chal.idek.team 1337<br>== proof-of-work: disabled ==<br>Please enter your code:<br>help<br>Unknown instruction at ip=0x0</pre><p>This immediately told me I was dealing with a bytecode interpreter, not a text-based interface.</p><p>The Long Road of Wrong Assumptions</p><h3>Bytecode Exploration &amp; Debug Discovery</h3><p>I started by systematically testing different byte sequences to understand the instruction set:</p><pre><br>printf &#39;\x00\x00\x00&#39; | nc lazy-vm.chal.idek.team 1337  # Thanks for playing<br>printf &#39;\x01\x00\x01&#39; | nc lazy-vm.chal.idek.team 1337  # Thanks for playing  <br>printf &#39;\xFF\xFF\xFF&#39; | nc lazy-vm.chal.idek.team 1337  # Unknown instruction</pre><p>Some opcodes worked (returned “Thanks for playing”), others didn’t. I initially thought:</p><ul><li>0x01 was a register assignment instruction</li><li>0x08 was a print instruction</li><li>0x05 was memory read</li></ul><p>After hours of testing, I discovered something interesting:</p><pre>printf &#39;\x05\x00\x69\x08\x00\x00&#39; | nc lazy-vm.chal.idek.team 1337<br><br>#output<br>============== REGISTER ==================<br>R0 = 0x0<br>R1 = 0x0<br>...<br>=================== MEMORY =====================<br>The pay is only $5. Too lazy to implement this</pre><p>I also discovered that certain byte values were forbidden:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*xQz-egHwwewB_h0beHDRHw.png" /></figure><p>The bytes 0x61 (&#39;a&#39;), 0x66 (&#39;f&#39;), 0x67 (&#39;g&#39;), and 0x6c (&#39;l&#39;)` were blocked - basically preventing direct flag manipulation.</p><p>After spending way too much time trying to manipulate individual registers and memory addresses, I realized my fundamental assumption was wrong. This wasn’t a register-based VM — it was stack-based</p><p>I started researching stack-based VM architectures and realized that instructions like 0x01 weren&#39;t setting registers directly, but pushing values onto a stack.</p><p><strong>The Real Architecture</strong></p><p>Once I understood it was stack-based, everything clicked. Here’s what I discovered:</p><blockquote>0x01: PUSH immediate value<br>0x02: POP to register <br>0x03: PUSH register value<br>0x04: ADD register to R0<br>0x05: XOR R0 with register<br>0x06: MOVE register to memory address<br>0x07: LOAD from memory to register<br>0x08: SYSCALL (R0 contains syscall number)<br>0x69: DEBUG — print VM state</blockquote><p><strong>The key insight was that </strong><strong>0x08 wasn&#39;t a print instruction - it was a syscall interface</strong></p><h3>Exploit</h3><p>With this understanding, I could build a proper exploit. The VM supports Linux syscalls:</p><ul><li>syscall 0: read(fd, buf, count)</li><li>syscall 1: write(fd, buf, count)</li><li>syscall 2: open(filename, flags)</li></ul><p>My strategy:</p><ol><li>Read filename from stdin</li><li>Open the file</li><li>Read file contents</li><li>Write contents to stdout</li></ol><h3>The code</h3><pre>from pwn import *<br><br>class VMAssembler:<br>    def __init__(self):<br>        self.instructions = []<br>    <br>    def _add_opcode(self, opcode):<br>        self.instructions.append(f&quot;{opcode:02x}&quot;)<br>    <br>    def _add_byte(self, value):<br>        self.instructions.append(f&quot;{value:02x}&quot;)<br>    <br>    def load_immediate(self, value):<br>        self._add_opcode(0x01)<br>        self._add_byte(value)<br>    <br>    def store_register(self, register_id):<br>        self._add_opcode(0x02)<br>        self._add_byte(register_id)<br>    <br>    def load_register(self, register_id):<br>        self._add_opcode(0x03)<br>        self._add_byte(register_id)<br>    <br>    def perform_syscall(self):<br>        self._add_opcode(0x08)<br>    <br>    def move_register_value(self, source_reg, target_reg):<br>        &quot;&quot;&quot;Move register value - corrected opcode usage&quot;&quot;&quot;<br>        self._add_opcode(0x06)<br>        self._add_byte(source_reg)<br>        self._add_byte(target_reg)<br>    <br>    def compile(self):<br>        hex_data = &quot;&quot;.join(self.instructions)<br>        return bytes.fromhex(hex_data)<br><br>def create_file_reader():<br>    assembler = VMAssembler()<br>    <br>    # Use working memory addresses from previous tests<br>    FILENAME_BUFFER = 0x10  # Known working address<br>    FLAG_BUFFER = 0x30      # işlədi burda axırki<br>    <br>    # Step 1: Read filename (reduced size)<br>    assembler.load_immediate(0)              # read sys call<br>    assembler.store_register(0)<br>    assembler.load_immediate(0)              # stdin<br>    assembler.store_register(1)<br>    assembler.load_immediate(FILENAME_BUFFER)<br>    assembler.store_register(2)<br>    assembler.load_immediate(8)              # Smaller buffer size<br>    assembler.store_register(3)<br>    assembler.perform_syscall()<br>    <br>    # Step 2: Open file<br>    assembler.load_immediate(2)              # open syscall<br>    assembler.store_register(0)<br>    assembler.load_immediate(FILENAME_BUFFER)<br>    assembler.store_register(1)<br>    assembler.load_immediate(0)              # read-only flags<br>    assembler.store_register(2)<br>    assembler.perform_syscall()<br>    assembler.move_register_value(4, 0)      # Save file descriptor to R4<br>    <br>    # Step 3: Read file content<br>    assembler.load_immediate(0)              # read syscall<br>    assembler.store_register(0)<br>    assembler.load_register(4)               # file descriptor<br>    assembler.store_register(1)<br>    assembler.load_immediate(FLAG_BUFFER)<br>    assembler.store_register(2)<br>    assembler.load_immediate(40)            <br>    assembler.store_register(3)<br>    assembler.perform_syscall()<br>    <br>    # Step 4: Write to stdout (reduced size)<br>    assembler.load_immediate(1)              # write syscall<br>    assembler.store_register(0)<br>    assembler.load_immediate(1)              # stdout<br>    assembler.store_register(1)<br>    assembler.load_immediate(FLAG_BUFFER)<br>    assembler.store_register(2)<br>    assembler.load_immediate(40)            <br>    assembler.store_register(3)<br>    assembler.perform_syscall()<br>    <br>    return assembler<br><br>def execute_exploit():<br>    print(&quot;Assembling VM program...&quot;)<br>    vm_program = create_file_reader()<br>    payload = vm_program.compile()<br>    <br>    print(f&quot;Payload: {payload.hex()}&quot;)<br>    print(f&quot;Length: {len(payload)} bytes&quot;)<br>    <br>    print(&quot;Establishing connection...&quot;)<br>    connection = remote(&quot;lazy-vm.chal.idek.team&quot;, 1337)<br>    <br>    try:<br>        # Get banner<br>        connection.recvuntil(b&quot;Please enter your code:\n&quot;)<br>        print(&quot;Received prompt&quot;)<br>        <br>        # Send bytecode<br>        connection.sendline(payload)<br>        <br>        # Send filename<br>        print(&quot;Sending filename...&quot;)<br>        connection.sendline(b&quot;flag.txt&quot;)<br>        response = connection.recv()<br>        <br>        print(&quot; Output received:&quot;)<br>        print(&quot;=&quot; * 60)<br>        print(response.decode(&#39;utf-8&#39;, errors=&#39;ignore&#39;))<br>        print(&quot;=&quot; * 60)<br>        <br>    except Exception as e:<br>        print(f&quot;Execution failed: {e}&quot;)<br>    finally:<br>        connection.close()<br><br>if __name__ == &quot;__main__&quot;:<br>    execute_exploit()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lb1XuyAWGEBU_CtTAJ-ANA.png" /><figcaption>idek{Th15_I$_thE_L@Z13$t_vM_i_h4vE_EvEr_}</figcaption></figure><p>This challenge was a great lesson in not making assumptions. I spent hours trying to reverse engineer a register-based VM when it was actually stack-based. The “$5 freelancer” story was clever misdirection — the VM wasn’t actually broken or incomplete, it was just a different architecture than I expected.</p><p>The forbidden characters were a red herring that made me think I needed to bypass character filters, when in reality I just needed to use the proper syscall interface to read the file directly</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=077a8653a870" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Systemd Units]]></title>
            <link>https://m1r1.medium.com/systemd-units-5afd875d3e2b?source=rss-862f18be092c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5afd875d3e2b</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[systemctl]]></category>
            <category><![CDATA[redhat-linux]]></category>
            <category><![CDATA[linux-administration]]></category>
            <category><![CDATA[systemd]]></category>
            <dc:creator><![CDATA[Mirseyid Mirzazada]]></dc:creator>
            <pubDate>Fri, 19 Apr 2024 13:06:37 GMT</pubDate>
            <atom:updated>2024-04-19T13:06:37.131Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Systemd?</h3><p>Systemd is a component that manages the entire system and its <strong>PID</strong> Number is <strong>1</strong>. When the system starts, the systemd process is the first to start after the kernel. For Linux to work, certain components are needed, which are managed by systemd. These components are called units in Linux.</p><blockquote><strong>When systemd starts a service, it reads these 4 directories :<br>/run/<br>/etc/<br>/lib/<br>/usr/</strong></blockquote><h3>Systemd Unit Directories</h3><p><strong>There are several main directories where units are located:<br>- </strong>Default system-provided systemd unit files are in<strong> /usr/lib/systemd/system<br>- </strong>%90 List of units <strong>/lib/systemd/system<br>- </strong>Run-time automatically-generated unit files are in <strong>/run/systemd/system</strong></p><figure><img alt="Units in Linux" src="https://cdn-images-1.medium.com/max/563/1*udgNq4SrC1BlOzppnmN-gg.png" /><figcaption>Units in Linux</figcaption></figure><blockquote>Note : While modifying a unit file, do NOT edit the file in <strong>/usr/lib/systemd/system</strong> but create a custom file in <strong>/etc/systemd/system </strong>that is used as an overlay file.</blockquote><h3>Systemd — Edit Units(Services)</h3><pre># These commands used read &amp; edit configure services.<br>systemctl edit unit.service<br>systemctl cat sshd</pre><blockquote>Note : If the Configuration file is opened with the Nano editor, by default <strong>$EDITOR</strong> variable, nano uses. To change:</blockquote><pre>export EDITOR=/usr/bin/vim</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*PNQ3BKLariO2w-QsaMPuBQ.png" /><figcaption>httpd.service file</figcaption></figure><p><strong>[Unit] Section <br>[unit]</strong> — By default, Linux provides these services as a unit. we can change it if we want.<br><strong>Description</strong> — info about service.<br><strong>After</strong> — Set dependency on a service. For example, if you are configuring Apache web server, you want the server to start after the network is online. This typically includes targets or other services.<br><strong>Before </strong>— Start current service before specified service. In this example, I tell that “I want Apache web server running before the service for Nextcloud is started”. This is because, in my case, Nextcloud server depends on he Apache web server. This too, like After, includes targets or other services.</p><h4>[Service] Section</h4><p><strong>ExecStart </strong>— The command that needs to be executed when the service starts. In our case, we want the Apache server to start.<br><strong>ExecReload - </strong>This is an optional field. It specifies how a service is restarted. For services that perform disk I/O (especially writing to disk, like a database), it is best to gracefully kill them and start again. Use this field in case you wish to have a specific restart mechanism.<br><strong>type=forking - </strong>“Run the service in the background”. That is, when the service starts, we will not see the service in fg (fore ground).<br><strong>Restart -</strong> This is another optional field but one that you will very likely use. This specifies if a service should be restarted depending on circumstances or not. The available options are <strong>no</strong>, <strong>on-success</strong>, <strong>on-failure</strong>, <strong>on-abnormal</strong>, <strong>on-watchdog,</strong> <strong>on-abort</strong> and <strong>alwa<br>PIDFile</strong> : Shows the file where the PID number of the service is located</p><blockquote><strong>Note</strong> - All PID (Process id) numbers are located in a single file under the run directory.</blockquote><p><strong>ExecStartPre</strong> (Before starting) - Before the service starts, it deletes the old process if there is a dead process, then if everything is fine, it goes and starts the service.<br><strong>KillSignall</strong> - Sends sigquit (3-digit signal) if a process needs to be deleted in the reload layer.<br><strong>TimeoutStopsec</strong> - The number of seconds to stop the service.<br><strong>KillMode</strong> - Specifies the mode in which to kill the process. Because the mode is mixed in this service, it can be deleted or not deleted depending on the request.<br><strong>Wantedby=multi-user.target</strong> - Means that the Service must should be multi-user.target.<br>[Install] Section</p><h3><strong>[Install] Section</strong></h3><p>The Install section, as the name says, handles the installation of a systemd service/unit file. This is used when you run either <strong>systemctl enable</strong> and <strong>systemctl disable</strong> command for enabling or disabling a service.</p><h3><strong>Systemd Unit Dependencies</strong></h3><p>Systemd units normally depend on other units<br>Use <strong>systemctl list-dependencies</strong> for a complete overview of all currently loaded units and their dependencies</p><pre>systemctl list-dependencies</pre><p><strong>Masking Services</strong></p><p>Briefly: Prevents the service from being started by other services.<br>Masks Some units cannot work simultaneously on the same system. To prevent administrators from accidentally starting these units, use <strong>systemctl mask &lt;unit.service&gt;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*LiKMuQz2EtjsBbOd6wNbxA.png" /><figcaption>/dev/null, effectively preventing the sshd service from being started.</figcaption></figure><pre>systemctl mask #links a unit to the /dev/null device, which ensures that it cannot be started<br>systemctl unmask # Removes the unit mask</pre><h4>Systemd unit management commands</h4><pre>systemctl start # will start a unit that is not currently active<br>systemctl status # to get current status<br>systemctl start # will start a unit that is not currently active<br>systemctl enable --now #is used to flag the unit for automatic starting upon system start<br>systemctl disable --now # is used to flag the unit to be no longer automically started<br>systemctl reload # will reload the unit configuration without restarting the unit.<br>systemctl restart # restarts the unit after which the process it manages gets a new PID<br>systemctl edit &lt;unit.service&gt; # to edit unit files<br>systemctl show # to show available parameters<br>systemctl cat sshd # Used to read Unit&#39;s configuration file</pre><h3>Practice lab :</h3><blockquote><strong><em>Step 1</em></strong><em> - Edit the httpd unit file :</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*U8D4XUYVb_kIIiLFB_LVhQ.png" /><figcaption>systemctl edit httpd</figcaption></figure><blockquote><em>Step 2 - Adding this configration :</em></blockquote><pre>[Service]<br>Restart=Always<br>RestartSec=5s</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*XXs7u7QL5ZpcrGY2mhD5Iw.png" /><figcaption>after adding line</figcaption></figure><blockquote><em>Step 3 - Verify using </em><strong><em>cat</em></strong><em> command :</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-CokMCxgD4id5k74yDMBA.png" /><figcaption>systemctl cat httpd</figcaption></figure><p>Often, this configuration is installed on web services in High Availability Clusters, so that if there is any problem, the service can be restarted again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5afd875d3e2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TLP]]></title>
            <link>https://m1r1.medium.com/tlp-1453e5e45c3-87241e5e45c3?source=rss-862f18be092c------2</link>
            <guid isPermaLink="false">https://medium.com/p/87241e5e45c3</guid>
            <category><![CDATA[cyber]]></category>
            <category><![CDATA[data-protection]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mirseyid Mirzazada]]></dc:creator>
            <pubDate>Fri, 10 Nov 2023 15:38:07 GMT</pubDate>
            <atom:updated>2023-11-10T15:38:07.282Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Traffic Light Protocol </strong>(TLP)</h3><p><strong>The Traffic Light Protocol</strong> həssas məlumatların paylaşılmasını asanlaşdırmaq və lazımsız yerə açıqlanmadan müvafiq auditoriyaya çatmasını təmin etmək üçün nəzərdə tutulmuşdur. O, təşkilatlara və şəxslərə kibertəhlükəsizlik insidentləri, təhdidlər, zəifliklər və ya digər həssas mövzularla bağlı məlumatları necə idarə etməli və paylaşmalı olduqlarını müəyyən etməyə kömək edir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljQ0I_bjHMkxJd7jjs37YQ.jpeg" /></figure><ul><li><strong>RED — personal for named recipients only<br></strong>Görüş kontekstində, məsələn, QIRMIZI məlumat iclasda iştirak edənlərlə məhdudlaşır. QIRMIZI məlumatın paylanması ümumiyyətlə müəyyən edilmiş siyahı vasitəsilə həyata keçiriləcək və ekstremal şəraitdə yalnız şifahi və ya şəxsən ötürülə bilər.</li><li><strong>AMBER — limited distribution<br></strong>Qəbul edən “AMBER” məlumatını təşkilat daxilində başqaları ilə paylaşa bilər, lakin yalnız “bilməli olanlar” əsasında. Yaradıcının həmin paylaşımın nəzərdə tutulan limitlərini müəyyən etməsi gözlənilə bilər.</li><li><strong>GREEN — community wide<br></strong>Bu kateqoriyaya aid məlumatlar müəyyən bir icma daxilində geniş şəkildə yayıla bilər. Bununla belə, məlumat dərc edilə və ya açıq şəkildə İnternetdə yerləşdirilə və ya cəmiyyətdən kənarda yayımlana bilməz.</li><li><strong>WHITE — unlimited<br></strong>Standart müəllif hüquqları qaydalarına uyğun olaraq, WHITE məlumatı məhdudiyyət olmadan sərbəst şəkildə yayıla bilər.</li></ul><p><strong>TLP</strong> kibertəhlükəsizlik icmaları daxilində məlumat mübadiləsi kontekstində mühüm əhəmiyyət kəsb edir, çünki o, etibarlı tərəflər arasında lazımi əməkdaşlıq və ünsiyyətə imkan yaradaraq həssas məlumatların yanlış əllərə keçməsinin qarşısını almağa kömək edir. Məxfilik səviyyəsini aydın şəkildə qeyd etməklə TLP məlumatın daha təhlükəsiz rəqəmsal mühitə töhfə verərək məsuliyyətli və effektiv şəkildə yayılmasını təmin edir.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87241e5e45c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>