






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Date Assigned: _____________ Date Due: _____________ Last Edited : _____________ Lab Authored By: Ankeet Patel and Kirk Roberts Group Number: _________ Member Names: ___________________ _______________________
vulnerabilities.
We will be primarily concerned with three sections – user authentication, state management, and SQL injection.
http://www.onlamp.com/pub/a/php/excerpt/webdbapps_8/ to cover cookies and sessions in PHP.
installed. MySQL will also be setup during the lab. COPY ALL “sectionX” folders from the NAS folder to “C:\Program Files\EasyPHP1-8\www\”.
Download EasyPHP from www.easyphp.org and install the application. EasyPHP contains PHP, Apache, and MySQL. You should notice an “e” in the taskbar indicating that EasyPHP is running.
In this lab, we will specifically look at cookies (client-side) and session objects (server- side). The client and server will be the same computer in the lab environment.
A cookie is a small piece of information that scripts store on a client-side machine. The format for setting a cookie is the following: Set-Cookie: NAME = VALUE ; [expires= DATE ;] [path= PATH ;] [domain= DOMAIN_NAME ;] [secure] This will create a cookie called NAME with the value VALUE. The other parameters are optional. The “expires” field sets a date beyond which the cookie is no longer relevant. Together, the path and domain can be used to specify the URL for which the cookie is relevant. The “secure” keyword means that the cookie will not be sent over a plain HTTP connection. When a browser connects to an URL, it first searches the cookies stored locally. If any of the cookies are relevant to the URL, they will be sent back to the server. [1]
A session is used for state management because it stores session variables for a user. When a user initiates a session, they are given a session identifier (probably a cookie). This identifier is included in all communication between the client and server during the session. The server uses the session identifier to find the correct session before handling the request. [1]
Achilles is a tool used to test the security of web applications. It does this by acting as a proxy server (man-in-the-middle attack during an HTTP session). Achilles is a different from other proxy servers, which relay HTTP packets from the client and server. Achilles intercepts the packet and allows modification of it before passing it on. In this lab, we are not going to focus on the modification of HTTP packets, but will look at the data Achilles can capture. Achilles is available for download from http://www.mavensecurity.com/achilles.
‘ UNION SELECT name FROM sysobjects WHERE name != ‘d Screenshot 5: Take a Screenshot of the result. This SQL Injection attack is mildly useful as it gave us the name of one of the tables in the database. Now let’s use the information we gained from the previous injection to gain more. In the email field, type: ‘ UNION SELECT name FROM sysobjects WHERE name > ‘Categories Screenshot 6: Take a Screenshot of the result. We got the name of yet another table. We can keep going till there are no more table names left in the sysobjects table. If you wanted to do it again, simple change out the table name Categories with the table name you received from the above injection attack: In the email field, type: ‘ UNION SELECT name FROM sysobjects WHERE name > ‘CustomerAdd Experts in SQL can use this technique to find out most of the information about the database’s structure and then proceed to use that to extract any information from the database they wish. Since SQL is out of the scope of this lab and since we’re using a server on the virtual machine itself, we can look at the actual database structure and see if we can formulate any more attacks to gain information within the useful tables. Open the database manager: Start > Programs > Teratrax > Database Manager Double-click on (local) Click Connect (make sure Windows Authentication is selected) Double-click on Databases Double-click on Store Double-click on Tables Now you’ll notice just some of the tables in the database, each of the databases contains several tables, but these are the primary ones. Double-click on Customers Scroll down and find your account name Write down your CustomerID Scroll to the right and look at the Password field Ouch, right? If your password is stored simply as plaintext and an attacker can gain access to every field in the database, your password could easily be compromised. Now just imagine if the Customers table stored your credit card number.
Go back to the Password recovery webpage. Now type: ‘ UNION SELECT Password FROM Customers WHERE CustomerID = ‘
Turn in Answer sheet. Screenshots 1-7. Any comments or additions