<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abdelrahman A. Esmat</title>
    <description>The latest articles on DEV Community by Abdelrahman A. Esmat (@abdelrahman-ae).</description>
    <link>https://dev.to/abdelrahman-ae</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2094023%2F358cdb4d-17d3-4f19-ba40-ac3b8af0e994.jpg</url>
      <title>DEV Community: Abdelrahman A. Esmat</title>
      <link>https://dev.to/abdelrahman-ae</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abdelrahman-ae"/>
    <language>en</language>
    <item>
      <title>Hack The Box (HTB): Cap Machine (Full Walkthrough)</title>
      <dc:creator>Abdelrahman A. Esmat</dc:creator>
      <pubDate>Mon, 25 May 2026 02:56:34 +0000</pubDate>
      <link>https://dev.to/abdelrahman-ae/hack-the-box-htb-cap-machinefull-walkthrough-2jgh</link>
      <guid>https://dev.to/abdelrahman-ae/hack-the-box-htb-cap-machinefull-walkthrough-2jgh</guid>
      <description>&lt;p&gt;Welcome! In this article, we will try to solve the Cap Machine from HackTheBox and provide as many details as we can so it can be a reference for anyone who wants to recall any part of it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1csh8picv4fhibir9pdx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1csh8picv4fhibir9pdx.png" alt="Cap Machine Logo" width="300" height="300"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Here are some details about the machine itself from the official website:&lt;br&gt;
&lt;em&gt;Level: Easy&lt;br&gt;
OS: Linux&lt;br&gt;
Machine URL: Hack The Box: Cap Machine&lt;br&gt;
About: Cap is an easy difficulty Linux machine running an HTTP server that performs administrative functions including performing network captures. Improper controls result in Insecure Direct Object Reference (IDOR) giving access to another user’s capture. The capture contains plaintext credentials and can be used to gain foothold. A Linux capability is then leveraged to escalate to root.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s get started:&lt;/p&gt;
&lt;h1&gt;
  
  
  Task 1: How many TCP ports are open?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthai24ovtzn2g0791hqm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthai24ovtzn2g0791hqm.png" alt="Port Scanning with nmap" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-Pn: if the machine is refusing the ping requests, port scan only.&lt;br&gt;
-p-: if for scanning all ports.&lt;br&gt;
-sC: Scan with default NSE scripts.&lt;br&gt;
-sV: attempts to find the version of the service.&lt;br&gt;
— min-rate 10000: Send packets no slower than 10000 per second.&lt;/p&gt;

&lt;p&gt;So, as we can see, it’s 3 ports open: 21 (FTP), 22 (SSH), 80 (HTTP).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer: 3&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h1&gt;
  
  
  Task 2: After running a “Security Snapshot”, the browser is redirected to a path of the format /[something]/[id], where [id] represents the id number of the scan. What is the [something]?
&lt;/h1&gt;

&lt;p&gt;It’s a web enumeration task, let’s try the http port, so we write this domain in our website: &lt;a href="http://10.129.5.192" rel="noopener noreferrer"&gt;http://10.129.5.192&lt;/a&gt; (knowing that this ip is the target ip), and we get this page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4lyiikm95id973pw54fc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4lyiikm95id973pw54fc.png" alt="http://&amp;lt;target-ip&amp;gt;" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;with this side menu:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhysxcs533m5yq5w6f41q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhysxcs533m5yq5w6f41q.png" alt=" " width="546" height="706"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So we chose the third option as mentioned in the instructions of the task, and we got this page with this URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzko7h1al25ytgc0glqt6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzko7h1al25ytgc0glqt6.png" alt=" " width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As we can see, the [something] part is data.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer: data.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h1&gt;
  
  
  Task 3: Are you able to get to other users’ scans?
&lt;/h1&gt;

&lt;p&gt;We tried some ids from 0 to 10 on the URL instead of 1, and we found that ID 0 gives some packets in a .pcap file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy611cycvmmktgzw1s3t7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy611cycvmmktgzw1s3t7.png" alt=" " width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So, we downloaded the file, analysed it and found that it has network logs about the user and password of the account:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhglbzpr8574nd6q6o7uv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhglbzpr8574nd6q6o7uv.png" alt=" " width="800" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Username: nathan&lt;br&gt;
Password: Buc**************&lt;br&gt;
Answer: yes&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h1&gt;
  
  
  Task 4: What is the ID of the PCAP file that contains sensitive data?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer: 0&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h1&gt;
  
  
  Task 5: Which application layer protocol in the pcap file can the sensitive data be found in?
&lt;/h1&gt;

&lt;p&gt;As we can see from the screenshot above from the wireshark analysis, it’s communicating via ftp.&lt;/p&gt;

&lt;p&gt;Answer: ftp&lt;/p&gt;


&lt;h1&gt;
  
  
  Task 6: We’ve managed to collect Nathan’s FTP password. On what other service does this password work?
&lt;/h1&gt;

&lt;p&gt;We’ll try getting access using ssh, by writing this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh nathan@10.129.5.192
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we got it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7sf9jdgszo44ior33ayi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7sf9jdgszo44ior33ayi.png" alt=" " width="800" height="672"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When writing ls we found a file called user.txt, so we opened it using cat user.txt, and we found the user flag:
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuy2c8y2pdvbaalctv8j.png" alt=" " width="800" height="139"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer: ssh&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  Task 7: Submit the flag located in the nathan user’s home directory.
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Answer: d78******************************ba2
&lt;/h2&gt;
&lt;h1&gt;
  
  
  Task 8: What is the full path to the binary on this machine has special capabilities that can be abused to obtain root privileges?
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;To get the flag from the root’s home directory, we should do privilege escalation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assuming that the machine runs python as a root, we tried to run python commands so we run python3, then importing the os library to use it, choosing the user id 0 by writing this os.setuid(0), checking our privileges with os.system(‘whoami’), then we run the shell using os.system(‘sh’), then we accessed the root privileges so we open the file cat /root/root.txt, and we got the root flag.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faszdi2y74g43qnmxgmk9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faszdi2y74g43qnmxgmk9.png" alt=" " width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer: /usr/bin/python3.8&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;This machine was a great exercise in enumeration and privilege escalation. It reinforced the importance of carefully analysing exposed services and reviewing file permissions for potential escalation vectors.&lt;/p&gt;

&lt;p&gt;Thank you for reading this walkthrough. Any feedback or suggestions for improvement are always appreciated.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>linux</category>
      <category>penetrationtesting</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
