Presentation is loading. Please wait.

Presentation is loading. Please wait.

Example – SQL Injection

Similar presentations


Presentation on theme: "Example – SQL Injection"— Presentation transcript:

1 Example – SQL Injection
MySQL & PHP code: // The next instruction prompts the user to supply an ID $personID = getIDstringFromUser(); $sqlQuery = "SELECT * FROM Users WHERE userID = " + $personID; What if the user supplies the following string for $personID? The resulting string assigned to sqlQuery is SELECT * FROM Users WHERE userID = _________ What if the user supplies the following string for $personID? Please check out OWASP

2 Input Validation – HOW? _________
user input controls SQL statements ultimately executed by a database server _____________________ attacker sends malicious values via URL parameters

3 Input Validation – common associated risks
____________ user input controls file location “double-dot attack” _____________ user input controls file naming in such a way as to get a program to read, write or delete files that should be protected Denial of Service user input controls causes application to consume excessive resources or simply stop executing due to unacceptable input _____________ user input leads to revealing confidential information that can be used as part of a more sophisticated attack Buffer Overflows user input controls exceeds limits in a way that allows the attacker to control application behavior _____________ user input injects commands, often via meta-characters, that cause a server to perform unintended functions

4 Cross Site Scripting (XSS)
more common associated risks Cross Site Scripting (XSS) user input controls injects HTML or script commands into Web application causing the Web application to breach its security <html> <head> <title>My Javascript Page</title> </head> <body> type your name here >>> <input type="text" id="userInput"> </input> <button onclick="buttonHandler()">Submit</button> <script> var thing = "blah"; function buttonHandler() { var stuff = document.getElementById("userInput").value; document.write(stuff); } </script> </body> </html>

5 user input injects commands, often via meta-characters, that cause
still more common associated risks ______________ user input injects commands, often via meta-characters, that cause a server to perform unintended functions Buffer Overflows user input controls exceeds limits in a way that allows the attacker to control application behavior

6 Before Mitigation Step 1 -  user interface  files
 parameters of externally-invoked methods  network sockets/ports  network certificates  URLs (passed to Web servers)  cookies Step 2 - Step 3 –

7 Mitigation Techniques
Bounds Checking Pattern Matching Data Reflecting Sanitizing Double Decoding Escaping Text Full Syntactic Analysis Exception Handling

8 Equivalent HTML escape
Escaping Text Escaping individual characters is a particularly effective way of mitigating XSS. Character Equivalent HTML escape &#34 # &#35 & &#38 &#39 ( &#40 ) &#41 / &#47 ; &#59 < &#60 > &#62 Use prepackaged best practice sanitation


Download ppt "Example – SQL Injection"

Similar presentations


Ads by Google