breach ▫︎Uber Covered Up Hack On 57 Million People ▫︎Airline outage causes massive delays for British Airways travelers ▫︎Equifax Hack: Who Is At Risk? ▫︎Target Identity Theft Case Three Times Bigger Than Reported 9
application security risks ▫︎A powerful awareness document ▫︎Reference document for project security analysis ▫︎Published at regular intervals ▫︎Approximately once in 3 years ▫︎Last published in 2017 29
Sensitive Data Exposure 4. XML External Entities (XXE) 5. Broken Access Control 6. Security Misconfiguration 7. Cross Site Scripting (XSS) 8. Insecure Deserialization 9. Using components with known vulnerability 10.Insufficient Logging & Monitoring 30
data: ▫︎A4:2017 - XML External Entities (XXE) ▫︎New issues, supported by the community: ▫︎A8:2017 - Insecure Deserialization ▫︎A10:2017 - Insufficient Logging and Monitoring ▫︎Merged or retired, but not forgotten: ▫︎A4 - Insecure Direct Object References and A7 - Missing Function Level Access Control merged into A5:2017 - Broken Access Control ▫︎A8 - Cross Site Request Forgery (CSRF) ▫︎A10 - Unvalidated Redirects and Forwards 31
Queries) ▫︎Use Stored Procedures if possible ▫︎White List input validation ▫︎Escape all user supplied input ▫︎ESAPI ▫︎https://www.owasp.org/index.php/ SQL_Injection_Prevention_Cheat_Sheet ▫︎https://www.owasp.org/index.php/ Category:OWASP_Enterprise_Security_API 38
brute force or other automated attacks ▫︎Default, weak, or well-known passwords ▫︎"Password1" or “admin/admin” ▫︎Weak or ineffective credential recovery ▫︎Recovery questions like birthday, first car, … ▫︎Session IDs in the URL ▫︎PHPSESSID ▫︎JSESSIONID 40
algorithms ▫︎Hashing vs Encryption ▫︎MD5 is NOT encryption ▫︎Not verifying certificates / signatures ▫︎Transparent db encryption is still dangerous ▫︎The most common flaw is simply not encrypting sensitive data 44
/ SessionID or hidden field ▫︎Using actual name or key of an object when generating web pages ▫︎Don’t verify the user is authorised for the target object ▫︎Attackers can easily manipulate parameter values to access another object ▫︎http://photos.com/download.php?file=personal.jpg ▫︎http://mybank.com/accountInfo?accNumber=123456 46
▫︎Directory listing enabled on the server ▫︎Running outdated versions of software / dependencies ▫︎Equifax was running older version of struts ▫︎Unnecessary services running on the machine ▫︎Not changing default keys and passwords 48
password! ▫︎Public AWS S3 buckets ▫︎Revealing error handling information to the attackers, such as stack traces. ▫︎Default accounts and passwords enabled and unchanged. 49
by other users ▫︎No HTML or Javascript escaping ▫︎Can steal cookies, change page location, etc. ▫︎Script executes with same permission as current page 52
delivered via email or a neutral web site ▫︎Display a page of results for a user, without properly sanitising the request. ▫︎Ex. Search result with search term without sanitisation 53
Sensitive Data Exposure 4. XML External Entities (XXE) 5. Broken Access Control 6. Security Misconfiguration 7. Cross Site Scripting (XSS) 8. Insecure Deserialization 9. Using components with known vulnerability 10.Insufficient Logging & Monitoring 57
IIS: x-aspnet-version ▫︎Spring Boot: /mappings, /configprops, … ▫︎Dev endpoints can be used for attacks ▫︎Spring Boot: /shutdown ▫︎Tomcat: 8005 shutdown port, manager webapp ▫︎Find out what your server does and disable it. 60
with caution ▫︎ Once received, the browser will prevent any communications from being sent over HTTP to the specified domain and will instead send all communications over HTTPS ▫︎If you get this wrong, the impact can be catastrophic ▫︎HSTS not an option? Use HTTP 301 to forward to https 62
▫︎Browser represents the origin’s interests. ▫︎Same Origin Policy - If a request shouldn’t be read, the browser would not let you read it. ▫︎Cross Origin Resource Sharing - If a server won’t accept a request, the browser won’t send it. ▫︎A browser does not necessarily secure the user. ▫︎Browsers try to not be instruments of abuse to servers. 63
from a location that the script does not originate from 64 Scheme Domain Subdomain Port * depends checked checked ignored XHR depends checked checked checked Cookies depends checked depends ignored Web Sockets ignored ignored ignored ignored
POST request to https://google.com ▫︎Browser does pre-flight check whether the server will accept the request via OPTION request. ▫︎If server accepts from current origin, browser will do the request, otherwise drops the request. 65
IDs ▫︎Sufficient length and entropy to prevent guessing and brute-force ▫︎Never include PII ▫︎Don’t accept user-initialised session ▫︎Re-authenticate on privilege level change ▫︎Expire sessions on client and server-side 66
Update: PATCH, Replace: PUT, Delete: DELETE ▫︎Restrict unused HTTP verbs ▫︎ Not Allowed: 405 Method Not Allowed ▫︎Validate content-type of submitted data as you accept ▫︎Don’t trust user-submitted MIME-types ▫︎Validate your JSON schema ▫︎Avoid insecure direct object references 68
use, e.g. in SQL statements ▫︎eval() in JS is EVIL ▫︎Avoid XSS and other injection attacks ▫︎Be wary of encodings and charsets ▫︎Make sure you understand what your frameworks are doing! 69
and/or which type of resources are allowed to be loaded. ▫︎Define a loading behaviour in CSP "directive": ▫︎ default-src: All resources type (fallback) ▫︎ script-src: specifies valid sources for JavaScript ▫︎ object-src: specifies valid sources for <object>, <embed>, <applet> elements. ▫︎ style-src: specifies valid sources for sources for stylesheets ▫︎ img-src, media-src, child-src, frame-src, font-src, connect-src, form- action, sandbox, … ▫︎ https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP 71
reflect user-submitted MIME-types ▫︎X-Content-Type-Options: nosniff ▫︎Avoid clickjacking: X-Frame-Options: deny ▫︎Return the proper status codes ▫︎Do not leak information in response ▫︎Stack traces! 72
you handle inputs ▫︎Never block your endpoint ▫︎Offload expensive computation to workers or actors ▫︎Impose maximum input length on expensive operations ▫︎Impose maximum input length on expensive operations ▫︎Limit maximum password length to avoid DoS ▫︎Use caching, rate limiting where possible ▫︎Be a good citizen and don’t DoS others. 74
if software is vulnerable, unsupported, or out of date ▫︎Includes OS, runtime, web/application server, DBMS, applications, APIs and components, and libraries. ▫︎Subscribe to security advisories for your tech stack ▫︎Automate vulnerability scanning for your dependencies ▫︎Automate version updates: Branch, test, merge ▫︎Test compatibility of upgraded/patched libraries ▫︎Secure the component configuration 75