Good Secure Development Practices Presented By: Bil Corry lasso.pro Education Project
The Guide Complements  OWASP Top 10
310p Book
Free and open source Gnu Free Doc License Many contributors
Apps and web services
Most platforms Examples are J2EE, ASP.NET, and PHP Comprehensive Download from here: http://www.owasp.org/index.php/Category:OWASP_Guide_Project#tab=Download
Validating User Input
Input Validation Never trust client input!
failure to properly validate input leads to almost all of the major vulnerabilities in applications Validate input
Encode output GOLDEN RULE OF CLIENT INPUT “ All client input is hostile until proven otherwise or sanitized.”
Distrust Even Your Own Requests! CSRF (cross-site request forgery) and Clickjacking are two examples of where malicious requests appear to be initiated by you, from your browser, using your credentials
You can not be trusted!
Layered approach Integrity Checks When data passes from trusted boundary to untrusted boundary and returned Example: <input type=”hidden”>
Example: payment gateway Methods of integrity checking Checksum
HMAC
Encryption
Digital Signature
Layered Approach Validation Performed on every tier, presentation layer checks for HTML issues, persistence layer checks for SQLi, etc.
Includes sanitization
Layered Approach Business Rules Enforce the context
Document and test thoroughly
Consider the edge cases
Examples: E-trade and Schwab, in their signup process, failed to validate a limit of one bank account per any given user, allowing an attacker to assign the same bank account to tens of thousands of users, resulting in a loss of USD $50,000.00.
QVC lost more than USD $412,000.00 when a woman discovered she could purchase items via the QVC website, immediate cancel her order, but still receive the items.
An attacker posing as a legitimate eBay buyer was able to purchase a computer, remove expensive components from it, then return it as &quot;destroyed&quot; to the seller, successfully bypassing business policy controls for eBay, Paypal and UPS. Examples from: http://projects.webappsec.org/Insufficient-Process-Validation
Data Validation Strategies Accept known good (whitelisting) Parameters should be validated against  positive  specs: Data type (string, integer, real, etc…)
Minimum and maximum length
Whether null is allowed
Whether the parameter is required or not
Numeric range
Specific patterns (regular expressions) Reject known bad (blacklisting)
Sanitize
No validation (when you hate your employer)
Authentication
Authentication User identity / credential Ties system identity to individual Align with application risk Choose authentication controls based on risk Keep out the bad guys Deny access to attackers of the authentication system
Best practices User management process! The stronger the requirement for non-repudiation, the more expensive the process. Align credential with asset values Passwords (low-value)
SMS
Tokens Re-authenticate on privilege boundaries and high-value transactions
Passwords are trivially broken! Any password less than 16 characters in length can be brute forced in less than two weeks
Usernames & Passwords Let users choose user names Harder to enumerate
Avoid the use of Firstname.Lastname, e-mail address, credit card numbers or customer number, or any semi-public data, such as social security number Password policies (strength, change control, storage)

OWASP Secure Coding