Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  1. SQL Injections: Occurs when untrusted data is used to construct dynamic SQL statements using string concatenation. Consider the following example

    Code Block
    languagejava
    titleDynamic SQL Concatenation
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    {
    
        try {
          //Retrieve the "userName" parameter from the GET request
          String userName = request.getParameter("username");
       
          //Perform an SQL query for the roles associated with the given "username"
          String result = doQuery("SELECT roles FROM userroles WHERE username = '" + userName +"'");
    
          response.getOutputStream().print(result);
        }
    }


      If an attacker manipulated username and entered: "' or '1'='1". The query would read (attacker's payload in red 

    SELECT roles FROM userroles WHERE username ='' or '1'='1'

    This query would give the attacker all the roles possible. There are several forms of SQL injections like blind SQL injection and others. They all share the main idea of using user-controllable data to construct SQL statements.


  2. Cross-site Scripting: occurs when the application uses untrusted data to build HTML back to the browser. An attacker could use this vulnerability to inject malicious script into user's browser, possibly gaining full control over the user browsers.
    Consider the following example:

    Code Block
    languagejava
    <html>
    <head>
    <title>Reflected Cross-site Scripting Example</title>
    </head>
    <body>
       <div>The following error occurred:</div>
       <div><%=request.getParameter("msg")%></div>
    </body>
    </html>



  3. Parameter Tampering:
  4. Command Injection:
  5. Cross-site Request Forgery:
  6. Weak Authentication:
  7. Weak Authorization
  8. Insecure File Upload:
  9. Invalidated Redirects:

...