<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Cryptography on Monish Kumar&#39;s Blog</title>
        <link>https://itsmonish.pages.dev/tags/cryptography/</link>
        <description>Recent content in Cryptography on Monish Kumar&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Sat, 26 Apr 2025 17:51:33 +0530</lastBuildDate><atom:link href="https://itsmonish.pages.dev/tags/cryptography/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Cryptography - No need for brutus</title>
        <link>https://itsmonish.pages.dev/blog/huntress-ctf-2024/crypto-no-need-for-brutus/</link>
        <pubDate>Sat, 26 Apr 2025 17:51:33 +0530</pubDate>
        
        <guid>https://itsmonish.pages.dev/blog/huntress-ctf-2024/crypto-no-need-for-brutus/</guid>
        <description>&lt;h1 id=&#34;no-need-for-brutus&#34;&gt;No need for Brutus
&lt;/h1&gt;&lt;h2 id=&#34;challenge-statement&#34;&gt;Challenge Statement
&lt;/h2&gt;&lt;p&gt;Author:@aenygma&lt;/p&gt;
&lt;p&gt;A simple message for you to decipher:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;squiqhyiiycfbudeduutvehrhkjki&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Submit the original plaintext hashed with MD5, wrapped between the usual flag format: &lt;code&gt;flag{}&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;solution&#34;&gt;Solution
&lt;/h2&gt;&lt;p&gt;The title includes Brutus who is known for betraying Julius Caesar. Caesar happen to be named after a cipher he created, The Caesar cipher, also known as ROT cipher.&lt;/p&gt;
&lt;p&gt;This suggests that the cipher provided might be a ROT cipher for which we don&amp;rsquo;t know the key for.&lt;/p&gt;
&lt;p&gt;Using &lt;a class=&#34;link&#34; href=&#34;https://cyberchef.org/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Cyberchef&lt;/a&gt; we can use the recipe ROT13 Brute Force to list all possible plaintext for the cipher.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/no-need-for-brutus/1.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;Cyberchef result&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;We find a plain text with key value of 10. Since the challenge requires us to use the MD5Sum of this plaintext we can calculate it using:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo -n &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;caesarissimplenoneedforbrutus&amp;#34;&lt;/span&gt; | md5sum
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Covering the obtained hash with flag format yields the flag&lt;/p&gt;
</description>
        </item>
        <item>
        <title>Cryptography - Strive Marish Leadman TypeCDR</title>
        <link>https://itsmonish.pages.dev/blog/huntress-ctf-2024/crypto-strive-marish-leadman-typecdr/</link>
        <pubDate>Sat, 26 Apr 2025 17:51:33 +0530</pubDate>
        
        <guid>https://itsmonish.pages.dev/blog/huntress-ctf-2024/crypto-strive-marish-leadman-typecdr/</guid>
        <description>&lt;h1 id=&#34;strive-marish-leadman-typecdr&#34;&gt;Strive Marish Leadman TypeCDR
&lt;/h1&gt;&lt;h2 id=&#34;challenge-statement&#34;&gt;Challenge Statement
&lt;/h2&gt;&lt;p&gt;Author:@aenygma&lt;/p&gt;
&lt;p&gt;Looks like primo hex garbage.&lt;/p&gt;
&lt;p&gt;Maybe something went wrong?&lt;/p&gt;
&lt;p&gt;Can you make sense of it?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This challenge was accompanied with a per-user instance&lt;/p&gt;
&lt;h2 id=&#34;solution&#34;&gt;Solution
&lt;/h2&gt;&lt;p&gt;On spinning up the per-user instance, I was given a command to use Netcat into the instance.&lt;/p&gt;
&lt;p&gt;On connecting it just print out the following data and exitted.
&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/strive-marish-leadman-typecdr/1.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;data from nc&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Now if you have worked with cryptosystems you could have recognized what this is right away. But those who don&amp;rsquo;t, this is variable for a RSA public cryptosystem.&lt;/p&gt;
&lt;p&gt;The given are everything that needed to encrypt and decrypt data.&lt;/p&gt;
&lt;p&gt;A quick run down of that is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;p&lt;/code&gt; and &lt;code&gt;q&lt;/code&gt; are supposed to be very large prime numbers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;n = p * q&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now a value called Euler&amp;rsquo;s phi function for the value &lt;code&gt;n&lt;/code&gt; is calculated as &lt;code&gt;phi(n) = (p-1)*(q-1)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now a random value &lt;code&gt;e&lt;/code&gt; is selected such that &lt;code&gt;e &amp;lt; phi(n)&lt;/code&gt; and &lt;code&gt;e&lt;/code&gt; and &lt;code&gt;phi(n)&lt;/code&gt; are co-prime&lt;/li&gt;
&lt;li&gt;This &lt;code&gt;e&lt;/code&gt; is the public key&lt;/li&gt;
&lt;li&gt;Now the corresponding private key is derived such that &lt;code&gt;d*e = 1 mod phi(n)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;With this one can encrypt message &lt;code&gt;m&lt;/code&gt; to cipher &lt;code&gt;c&lt;/code&gt; with public key as &lt;code&gt;c = (m^e) mod n&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;This can be reversed or decrypted using private key as &lt;code&gt;m = (c^d) mod n&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since we have all the variables and assuming the data in the bottom is ciphertext, this boils down to a simple decrytion.&lt;/p&gt;
&lt;p&gt;I used a tool called &lt;a class=&#34;link&#34; href=&#34;https://github.com/RsaCtfTool/RsaCtfTool&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;rsactftool&lt;/a&gt; to get it done.&lt;/p&gt;
&lt;p&gt;By just plugging in the values of p, q, d, e and data to decrypt, the tool even decoded the output to UTF-8 making my job easier.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://itsmonish.pages.dev/images/huntressctf-2024/strive-marish-leadman-typecdr/2.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;rsactftool output&#34;
	
	
&gt;&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
