Authentication
Do
๐ธ Use pre-existing authentication providers and SSO solutions
Do not
⨯ Implement custom authentication
⨯ Implement custom encryption of user credentials
Authorization
Do
๐ธ Base authorization decisions on user identity
๐ธ Implement authorization centrally
Clickjacking
Do
๐ธ Send the X-Frame-Options header with all responses (e.g. set the value to SAMEORIGIN)
Do not
⨯ Allow the pages to be displayed in a frame
Client-side data
Do
๐ธ Consider encrypting data stored on the client
Do not
⨯ Store private data on the client (i.e. on the browser)
Cookies
Do
๐ธ Set all cookies as secure when over https
๐ธ Set all cookies as HTTPOnly
Do not
⨯ Store state in cookies
⨯ Trust any data stored in cookies
Cross-origin resource sharing (CORS)
Do not
⨯ Use JSONP
⨯ Use 'Access-Control-Allow-Origin' *
Cross-Site Request Forgery (CSRF)
Do
๐ธ Implement a standard protection (e.g. double-posting)
Cross-Site Scripting (XSS)
Do
๐ธ Use functions as parameters when calling setTimeout() & setInterval()
๐ธ Encode all user supplied input when rendered into the HTML.
Do not
⨯ Use eval()
Data security
Do
๐ธ Encrypt all data when it is 'at rest' (e.g. in a file, cache, database, service bus)
๐ธ Encrypt data when it is moving between processes
๐ธ Applied good database security practices
Denial of service (DoS)
Do
๐ธ Restrict unauthenticated activity using captchas
๐ธ Restrict a list of returned results for any query to hard coded limit
๐ธ Implement paged results
Beware of
⚠ High CPU and memory load associated with specific user interactions
Directory traversal
Do
๐ธ Implement input validation
๐ธ Reference files by id, rather than by name
๐ธ Validate user supplied filenames and paths
File upload/download
Do
๐ธ Add the header 'X-Content-Type' with nosniff
๐ธ Restrict the types of files that can be uploaded
๐ธ Run a virus scanner on uploaded files
๐ธ Consider directory traversal defenses
๐ธ Require authentication of the user uploading and downlaoding files
๐ธ Consider encrypting the files if they are stored on disk
Information disclosure
Do
๐ธ Remove all unnecessary http headers
๐ธ Restrict search engine discovery via robots.txt
Do not
⨯ Display verbose error messages
SQL Injection (SQLi)
Do
๐ธ Use ORMs such as Hibernate, NHibernate & Entity Framework
๐ธ Use parameterised queried
๐ธ Use stored procedures
Do not
⨯ Concatenate strings
⨯ Use sp_executesql
Beware of
⚠ Custom queries in ORMs
Stored Cross-Site Scripting
Do
๐ธ Validate all user supplied text against a whitelist of valid characters
๐ธ Encode all user supplied input when rendered into the HTML.
General
Do
๐ธ Remove obsolete and unused code
๐ธ Validate all input including query string parameters
๐ธ Implement logging
๐ธ Defend against log poisoning
Comments
Post a Comment