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_uwGT5ucwhSbJy035R6n0FWc0GTLR_8t4KxvucLa1qyOKvXZf32SEbpUfw7-5YsFoB_2vK3tv6GgUTYJDkpIwx_1bFPASBa2N6mnN8SHK2PDG0HGPpd15f3cOzkUmSiRsKUdT4equwcpt9-fyt1Mwaj8jfOT0pEHS7qmpzYbO5-QcRQ=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_stYoesJpx5AMM-H9ivP4Kwyit2wR7-5LCaeU05vWosPeTayqseo2gfV1su3RWV_4ja44-2cG_gQI1fkJLcaFHluxp6h1g1706xK4_6I7vHw_15y6q3_Xcw5ZyWq2_usS5mlTYvYFhC-GLBc0xCA4wd3ZtelylY_B00L_QZkayKhPnMwQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vdnmGHrikMy8h9mHIn5G-WJk8jzMy-i1pp1Hxj7AxpPGldQHdGvOmfIxBBlko3WodLer_x1Be7gU3c-Lc83iz9Gt1Q2-PqIncPe293nBVoPxNUbfQ663x52S0xtyI39u5C6xmCSSj0YrNtmrvv5NUsf_rWkOrm43fBDBo9nFLOZtE5sA=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_sQWAQc3g_JnmaywBleyoIYq94kVq-2A-6UY-q0RPLB1ZZu2x0qRK3Gf0RHKwnqdu5wx-nUpC0qgxb58e3PFLE8cxMQ5FEzHo2oDYE5ClRWQIv2ngE6Xa2F8CVneVKQOaqCTi5cSQXKSDMrv4Cqc_E7cTSkT32Fd0SmWMFu5P1coeFNXQ=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_sS5BStBxEr8RoEUUPQf2jDAP9HqTP6w_5zZkpAf3g7Vm7Bud6uVD8GURDFct7u9SZKIlSzvWNVhUXvleZroB-FuZdq4K0hSVJWIqcdAXb3fz005J2fEaXjyGqpx1huC4VWL7vmmBD2UU4vaiXQKGxt5dI5NcHcKQklbn3U3pGUFqcCmg=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_txV7VYxijcr_fxDdPUDUazWyC8TkAslWeleB8YMoF9LbvG6G92no2RWkcH_oU_6XlNOlrFTN-Hoc4Gi1Sud6WHAWCDNgtQnjko3lJAAaCji_54Yl8mw9WyooCNLFgBClWkWVDTn7rboMhQurx9Ishi4-imKDGtU2WWW1Mp34geS1Ib=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_sMkID6kA4oAXkcoac7bH1Xa2KVncvc8RWcCBZegwFJ0BIxNnsOJE2rKclmCFes3wgySvRCHCLcl9m5eMGeT591pmbPiTMPRYvzzuZmehvnstOzR-RisEaJa78P0bRLRNzWjFcuPe6VETKV5NnkiPeWDsWIcf4kGHc7s0bSqWytVjAMDps=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_v3MMNTCdDXnxiytPEUDuQ7vQzMoapW8D0ASTMMJ9h9dTBCHFvtC0nOAj6fqFPKfPVNl26cg1dapK-JLnp_dBdOBHAVWiXZHBdHimKpPnahNd-uCqgLy_V94Mps6jf1YlnyAMO0B27ovaMPW8FS9nx6IHpqcTZkCGqcYwsZ0kjBLN9faMs=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_vanOe9fa_41QhdTim9LbpqGwqZfR1vhCOHYCqOR5NXyGvFYskhuAwSYxfSYE_L-8fipuoEuQWKAsjcQesghhu0kucHgFRZmJVdCUxC3-_oAsH_LhlUZButWNT4s993sAYXMDIS3IN0WtpkPCs4GcrcJh5Ha0v_2YgoJxOXcbtNmRhXUoc=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_tRs4XS1s6u0ckp5B-mOQ7ciWK-XB0djFrUWjbZYR4zCphC3Hv7iqeXSVeCDsrdEWz4Il5U4WsbhqOz8UnMM6Yz-LG5NRG2tKy0F-8PIgIVBMt7_00bDqaVfWJ_mMcEsLvBASW-GqCY4dGqLyMbOpbzh_5byr49Nd45PllzEuEo51xYRZY=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_u1LxZyK8l2gt3OjUzQGJzWpB8we2BBm1ctJqmCrGTpKF-G6cURVEiz2oZC_3Y0i-reik-zof4GlyoWeSkhSETRWMzsltXgUvPP4WDpGHP5KMGRDZ_gveevpnNQGKMO-Zul0Ay-ZcK-v3m0eq8zcsoY_IHTCfGkiG2sr67ufvZVPhn55Q=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_tl9jab3zT41ndqVsk3oXLpneeD_EEEGAuoyGzjbmJZ_IZDmjL6JUewN2DqingGq6Ys6qVv5dV_r6PyIp0vzMMc-1DhNYNqWL7g-XxCQxSj6RaaYEodoacBHjNR1IdMYXOpBVQlm_XCVw7r_gKvn5ReULM1pgUSkv0K8GJ-p1s-VzhYz_g=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_v7UK70ueLGIHwGzJ_6ggG6hPlW3xt5BSc1oH_EsJeDZoJ-FxL-XJXGseWsdjV8V8w1wcp1qOp8MI1beMevrXIBqOgOKbxVOgGiLzRb5kOx3QseeTYKyYQ1lIXDWhSLjeQ5glerEIOdi90f_JSg4tsAad3dQ7RJIuqqznKzhPoEesHOCsc=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_tUxRoANWh-VWpi85ORRGJVTDQpwxoEM8i0itUASoYp0SN26-mWc9CWIS-sibtWXyIZOrNDy0GgU-0GIaA9U-9VvVLccMkEf1t7qQx42hCIAxrq6K3AORi2RrXxv-GJbCdKbvNBEDFDH-xxJ_OM_1wWEO4NwR8KaNAUWLwWZtEEYbg9jw=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_sCH0fG8e-OUnAxCqajgkVXfRHxio9LQ0vg-DD8qrINZXqmpoJ_GIKm2dF87rwvG-1v9biRWMbjC9bRTgniyiB_-FXlwYSphQRufCxZyHrzifKf5XMCJAy03FDe6q9Fs11heJ22tua1HMeNqcDbxkHCdc4beh5cvS2ASnaMXF3GvMqy4A=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_vhc_AALZQHjGZ9l6--rJuGd1GCaW_bIcOM20B4iMVK8EY7iMXIMkKmt9UFtHH7RAtlv4wOS5ZBt_dzgXxjaYAvVNcr3djx7IUhUTvJKg8OE3jEUIr-Z4vzZIJFJ_AG1JIOzz4bdUq1-pp6fSxY-Cbox5Xmt5xqqUYFB3f3aCpEp969Z78=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t97mDFUS-iPWcpLBL-hU3kC2AslZx1ZEnUlS4nqhGLFkBzldqLVpcZq02M47XraEMihZmYdjg3huo9DkVALzO97KT7eqFNYjNk58ID5-pmTS6VKJeUd5XJ35E-Ct06KPytEG4Zzopn5IWLM8vOaVPqGmQ2cN5JRapQFNqwTiRmFL_TDbc=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t7vsaPAO4aP2NGClIyB429LV2UkQgAMA_MUisu1IsPdh2ZS0PcIEwm6c_2rRcRRKdwz1IzvW_GTn0R17p1rSALpRnOYynZzpspFN525qlDbGP5zRa_Ah3eJK0fetsV5L-EUbdWuqEDXS65b0XXekqFWiZI0oO1L64GgOSywHq7uJKe8H8=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_v6qkC0huDykZ915Q33oq6oSHyHPdL44easrvm3C2kHgnFlkLvdTTGIzpOWK5Ug1TGl6C6l5S_uMN33J1Xn2nvn47cmMYkiI1hGRM1_0LBf9257c-_cMJWk6jLrEJ6dbQKbzSOwJTxxEd4wJPOIUWMW404QyWh7NujWzCdhBX7OooPbFHs=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t9NhoblSPlTxH1G50zdsvaDk7AROv6aGJmjALepX3x5rOpcani95iuy-ejeesQgKVBEfQYkthM2i35yRXBTsz8cyskIqhdESca6JgDs0PWiVgXjqUQJOAIXbKBzLpMXBnB1ous7mpX-wyA_KRRrB3ewGWUXtyJaPq79HELX-H7HF_cFZY=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_t66z_Ih66HBF4V3THlrtFrncZlB5KP1C0Fg2gIx1ckcqtw2UfLDOBe8C4HmjWAzgPR_PAMAwo4xyODs7-oCb-Ry6N_PWKp8B4ZqM_brfg5FEhF1Kfo5HEw-UdwgxiXzKYjaEGbwgqrv5zzoj4zme1Jy82CY5ZaeXfMznYGnBB2Ce0sBpE=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tYtvTFs7R0mOST0sOy6_zMb1glyZsoeqZykLS_v_PxfO0NJ5FHwS5epMlBHwzA426Hsp8ME-Yxl-hQ9MldyE2-o7sdEoGAXZ3pUGzm0MNY_iv6g2OQsf4bxaMtuB1t5fI8AJl_xQP-TVolW7CioiCKCjLEberZ00WAsWPQQ4A6sdPqofg=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tbGLIfmWjhD_juaUOv9c5h1dIklb2-1hNeVOduUG383imeCOHm5VyizB-voCg3kBPis6ZN2i5fvSpnO8hsU7VUKb37aBWlnuMHABypj845WxUVxB9KVKgGsuQxNN8o1tMT5pRwyQo0eymN-_RYJUvbDkWyZBQkjG-IDk_oVfWPAxYb2fU=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uyYarJpsRZ8P6Q26h-TgSaBE70oKvQJtwYTPdRCbK4P5Fp8cjyl3NnGdPTMj2w9VunS24zuRSp5iQyZ21j4tohFq7gfQvKVFWBNLM51KNiBUHI_btKyd_G4ZJGhc_mU9t_fZqlSRW07fQJ8uZd6tbH47r9PP4fsZwc9c_M_H-Dkw3Mm-s=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v1l10zApPOYVIxt3_3dSNprDzi6WKUZLu616ab08p7MaA_Bnt3tMPcGLsKSX7oyDEQi4vzImDRH-aK-lpzrMd8kn35w3hvRxMDrd0Q5t6udNip_Bupq1UoFjljS-Hy7pz92w6HSe8U7JwrGWycAOWmAqoGUOvlw0lo4-g57vCV_QUBwg=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v_nIYKZmpgCptGIpZwykAsslGAknSmjb0B1qiuldl8KhHXbZeYTMHBdN5fR7gUwoASdPdXELzNMdGuWI5HyRbFhTZ4WoNrXDdxrEpOcNI_u_XO_EnKXsdYRLlIJmhgEDJexVpaGIjsV_vQevn01gXDF6-3UR3fGfcRN12x7V4KwNIqZw=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_vd1Ea4xP1LCyV2qG-0oU_q1RCSKafLQrKRszrTeJZEbrygnxPlqRcHbYdaq-rGF89wm1GAhvqgcDjRME2E5f_fo-oNDocpC95KLw2rwedVoq6dL8dpqABDRIAJzqNvdPYB2uVSLWfJRD4bOk3VIjxosN6fzLD726u_n6MQR0E-7V-E-IM=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tIjWRYxWyxuXGhjVploHp6U-1lGdZdRXJOqs0V2JwDx5upzge9WpJ_PnUHMaOy-bKsnsb9ewnnIxzbR-OeL__BXWAYtin1X-Q6LZcCZkS6gorFleWr2Q8bfNMrSPLXsq_cXBZ5_dTgqjgA2CBvJPaM6sjMpTsNOwZmkHCsPAQhTocD6V4=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vVZqPlUBjZiY9CLS1fLpYD0tpkub3Sn3Wck59hWagd7Z8tmzFqv4Q9-okBmwTVHYrqA8UNdFA2HmhVaYQsjPQI7FduW3pQ8gI5sxPY1qDCH0Otqqpr4XSQUGzdr6vL8i1mORwWHLcniyDFlNSMbJbVUq902c-4qQyqQ2umn9xW8T0dmg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s65VgBI_75zXYsm1spgsQ9aIWefVIsqCe57YaG0C2iDT3hwX9KqJ-ai6feD-lgI0oqD8xcv7KZX_T5sQ9AJQovbwzYy4SlrFHOIi1mbzkLoLzDh3oSqJVpFE3WZ5dusyc5hWedbmxCZH86hbWqpeah0kBcck_AQEWQZOpgO4XFKwvmQwI=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uh0RgdMR3Gbz9Q8KJaGcMweaZmVjlpYJCFCjaGZEE5v0rW1ozd_DurTEqJRZRamP5bEr_Q6s7OT-Ky3Y4fHoQmXBdT6hCyC8bALus2z6WMMJRH-k5uf_PR-u8517poIxqC8F1wHmdq9IGOF5999Ele_wuW-Pjwv0dfKGo_gs6LkTM6UY0=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_shOf75Hyc5ZIdFMJEnRY27NSX40NqjY5z4fzvulB0oMEMz_sRNRoBjuY8Wzh25paS2hMjoFSHk_aqbFElxmx1ChJwbnuv97_n-IoD23o8eImgsvon3pkuosnAQDR2RwzJtiFDym1j4DxS4R2SsQBvtgRVr5nZrLR6pbkWjm9AF__RIcC8=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t9o6NZBudllDGmtaJwtAnacCZoyxcC6EBL_IGnISJts9b8dip40jIszq92LpoVjaOidIdJUnsT7zy5qiEJ0DBVEyTyB0ahzWMNCjUztURCG8PgY1KbqilzaZNoA_5uHszOsPJM_iEG-OSJHnjajD4Kp2bNe-RNSKL_00n8e6ZT2spBiGg=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_vtUwAkCvMJlmJh7Vy5_UKbnSTfqfNTvVMlp8wstXtoRCZ4sxFcvb9JTYwIiem-OYzWA0yGmwVS5g4n1-Rq47vnr0iOQyFEdJPNWRKWFXbiLk-cAEPx_WujQnvFUlcSwLY00_94nQThjXHlfvC2sJctHaG0GSXgomaBMGqIoifmGi9DJsA=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_uCMDbSwX4pRlyMN6EDUGYeIRKdkt8cBU1fgAllVZudfEh2v8jGFPn5kKIceSqaKMD182CjiMQgiuvvg_32Yl3QtOlB7ZtHIZhk3YKkAVX-IdLv-qpW-Y4FmKYvLpdiE-g9lG9gZ-uWpGsm4aD7ltaRYtOw9qRgQQ72tyFDlW4T7G_bUhc=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_vH3mqu2lGolv9S9BDdDbKiadZJi49ld_kwDN3A8PVkjSkgHN7a5l0d53x1kMHoXTWki4vBX4UPkCqKFLDI4qLkSf6QIS5kuT8tJHVOr0E6TAdbnpUy90Be8AzmCYEfhgXdGHfyKcpLOh--WNfSlW-8btsZP4Rb3e1mPh-6HbE_1srj5A0=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_vFcbkOmm_Z_e8n-CfCkzBxqjiNlKaVLoCaAxgqlUecCKSBR3BggcRAqGiQg7NrZ-_JwSoRSj86ivSdGzgxZKogk4bC7NfblekJqVv9c-m-epaj3ItkWiBey50I2sVi0sZQH4E3s_ELZ0JlTiIyOLkemoM1T0x0TProLyVkP44CLGd-rg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vB0jVYuH0dqfeMrQfI0i08Yum1zhNWkVW_Cu6RLNx8_lJHITYcJkmuYORzsPM9vyzBtI6M93c3rDCA_hEQUdow0C05j-N7PFpp4HWDazd6YNO3J29y545hymuP9h4oRHomdrGCpXh-fpkuIsAksz0kCN4jjB_MuC4pXReIe27SaTrZBKE=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t7lsKFllFRA0LPGtbnh-yd9LI-gPt97Ky9uYmtOx-BNc36LXVpc_51gaCk4Q5kM5sCs4PbSqO5SZBld27BBrZxdA7gEmFc60zBsZV1f9WlKpe93JWKNdS2tN3dMVj55ckp2D5_YPiISCthAjqzF7Q4kdZekBIobC4cfs_OmIlz2yaezg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sPg7Xb3JmF3pg8UfZnmbP48xMXRGAwyi9dzYj-IDb2mHxRzVWh0zeZr2H3RWyYsi1N5WmEGRBC7NfJooiyM_ldnMFgvu61OIX7Eu4vKlq87nyfNkhPbCFYXlo9dpi1GISNRfNcIUQVAoNFUc0-ZrKS26_sj58A-nwNIhpE-jr6fZ5ofus=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s9Ze-Ten-e-HVFj0sMDCnA6INadQXfI5aHj9Ta2Y__h9rICQd1nH6ucQMcvWIEltPjIAhyTa7NrUFfJQoSb-iy1320aiShmioUkVM2eokk5n6sc7NMpdbNpTvREZCF5EXeS6xPFbpLQHsy5loy7XjwArpINsGdDSGfDcIX2E32W67FJsc=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_t7n5veX_Qfe9mYHOoeZShzSmMabxOAJBK3nmgF4epdI0E1wOnr1erT6Uwfj4efL1kXkSMJttxVLEifBnO8Q-bN7sFzRi8_ve93vuIwxcoLeF3PeO3DG7V4iIPY0--evoH9ybl9a6YDwb7ZK3dEZ4Ni1EJ8ZH17TP40iaJa4jQxA_FR9sk=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vKW27lJf72HvkWyvRmHHVF1s1dR1Xk-rz063Cq-gnJGd-0Wz1UlYTgoQ9bOKAYallnT9WCThXOY3S3_SXMLqhXEtlqKx-i8NNXMisVeP6BI9eNCPrpw1d1v2bDCa67wppbimABuvB8Z5ym1K7-e483qXAdDtx4ytDSu-cQivHITo4pFNs=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sFU3hdB7w2OtuKsIWn71jQdSr8c_5vCDVnWUN7J6qAI3HDQifZHxHR0yz32XbW37RSV-mcuSqAhamkwaXND5Lb4YQdZKw3ZVxlIVf7bCoVYYRCo1jjceJVKBKxMbMOYsVvetlls4wPR4L8mLceJJbF0_psexoyhOlS3jPaAP30Tcv0vg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v8ABxvabm7pEmQfNU-KK5rZvxBtwk7d8OwWjekklHrmWgNiPdFykr6PqLjKyhyU4bcfGr0UheS4LDXYFrJ7QcD-_S1eHwpltxwVsWsyAeRcz3dbbacvwPa61ShvRbvIv5Ya2TdiQglLnvxtskmSc8JbXyWi8YPfsWzNBiDE3G2400u2U0=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