Secure Coding in Java
Injection Attacks: Interpreted code User input formed maliciously System interprets input as a part of normal operation Unanticipated behavior Common Types SQL LDAP (Lightweight Directory Access Protocol) XSS/CSS (Cross site scripting) CRLF (Carriage Return and Line Feed) XPath SMTP/IMAP Code injection OS Command injection Host header injection SQL Injection: SQL Injection Situation SQL statement formed with variables String concatenation Malicious input repurposes SQL statement Example: foo ' or '1' = ' 1 SQL Injection Prevention Use the concept of PreparedStatement SQL statements accept variable as "?" placeholder Bind variable attached to statements, not query LDAP Injection: Caused by lack of sanitizing input (&(sn=<USERSN>(userpassword=<USERPASSWORD>)) Consider f* for USERSN with * for USERPASSWORD XPath Injection: Caused by lack of sanitizing input Vey similar to SQL injection in function Can be dangerous in injecting and manipulating dat...