Web Application Security Risks
https://owasp.org/www-project-top-ten/
The Open Web Application Security Project (OWASP) is an online community that produces freely available articles, methodologies, documentation, tools, and technologies in the field of web application security.
The Open Web Application Security Project (OWASP) provides free and open resources.
It is led by a non-profit called The OWASP Foundation.
The last paper was published on 2017
The OWASP Top 10 - 2021 is the published result of recent research based on comprehensive data compiled from over 40 partner organizations.
https://en.wikipedia.org/wiki/OWASP
The OWASP document is published as an awareness document, however, organizations use it as the de facto industry AppSec standard since its inception in 2003
Access control enforces policy such that users cannot act outside of their intended permissions.
Failures typically lead to unauthorized information disclosure, modification, or destruction of all data or performing a business function outside the user's limits
//Senrio 1 - unverified data injected into the SQL
//https://example.com/app/accountInfo?accountId=my-account-id
preparedStatement.setString(1, request.getParameter("accountId"));
ResultSet results = preparedStatement.executeQuery();
//https://example.com/app/accountInfo?accountId=NOT-MY-ACCOUNT-ID//Senrio 2 - Attacker gains access to a different
//url then the app intended with no permission access enforcement
https://example.com/app/getappInfo
https://example.com/app/admin_getappInfoPreviously known as Sensitive Data Exposure
The first thing is to determine the protection needs of data in transit and at rest.
For example, passwords, credit card numbers, health records, personal information, and business secrets require extra protection, mainly if that data falls under privacy laws, e.g., EU's General Data Protection Regulation (GDPR), or regulations, e.g., financial data protection such as PCI Data Security Standard (PCI DSS)
Are default crypto keys in use, weak crypto keys generated or re-used, or is proper key management or rotation missing? Are crypto keys checked into source code repositories?
Is encryption not enforced, e.g., are any HTTP headers (browser) security directives or headers missing?
Is the received server certificate and the trust chain properly validated?
Are deprecated hash functions such as MD5 or SHA1 in use, or are non-cryptographic hash functions used when cryptographic hash functions are needed?
Vulnerabilities
Classify data processed, stored, or transmitted by an application. Identify which data is sensitive according to privacy laws, regulatory requirements, or business needs.
Don't store sensitive data unnecessarily. Discard it as soon as possible
Make sure to encrypt all sensitive data at rest
Ensure up-to-date and strong standard algorithms, protocols, and keys are in place; use proper key management
Encrypt all data in transit with security protocols such as TLS with forwarding secrecy (FS) ciphers, cipher prioritization by the server, and secure parameters. Enforce encryption using directives like HTTP Strict Transport Security (HSTS)
Disable caching for responses that contain sensitive data.
More here: https://owasp.org/Top10/A02_2021-Cryptographic_Failures/
Scenario #1: An application encrypts credit card numbers in a database using automatic database encryption. However, this data is automatically decrypted when retrieved, allowing a SQL injection flaw to retrieve credit card numbers in cleartext.
Scenario #2: A site doesn't use or enforce TLS for all pages or supports weak encryption. An attacker monitors network traffic (e.g., at an insecure wireless network), downgrades connections from HTTPS to HTTP, intercepts requests, and steals the user's session cookie. The attacker then replays this cookie and hijacks the user's (authenticated) session, accessing or modifying the user's private data. Instead of the above they could alter all transported data, e.g., the recipient of a money transfer.
Scenario #3: The password database uses unsalted or simple hashes to store everyone's passwords. A file upload flaw allows an attacker to retrieve the password database. All the unsalted hashes can be exposed with a rainbow table of pre-calculated hashes. Hashes generated by simple or fast hash functions may be cracked by GPUs, even if they were salted.
An application is vulnerable to attack when:
User-supplied data is not validated, filtered, or sanitized by the application.
Dynamic queries or non-parameterized calls without context-aware escaping are used directly in the interpreter
Prevention
Example
//This is the SQL query our code is using - note data from the client is inserted as is
String query = "SELECT * FROM accounts WHERE custID='" + request.getParameter("id") + "'";
//The same thing can happen when we trust our ORM to help us - we need to use our tools correctly
Query HQLQuery = session.createQuery("FROM accounts WHERE custID='" + request.getParameter("id") + "'");
//For both cases - the attacher manipulates the URL into
http://example.com/app/accountView?id=' or '1'='1
//This makes the sql look like this
String query = "SELECT * FROM accounts WHERE custID='' or 1=1";
// The result is an always true
// then I can add "; select password from passowrd_table"Insecure design is a broad category representing different weaknesses, expressed as “missing or ineffective control design.” Insecure design is not the source for all other Top 10 risk categories. There is a difference between insecure design and insecure implementation. We differentiate between design flaws and implementation defects for a reason, they have different root causes and remediation. A secure design can still have implementation defects leading to vulnerabilities that may be exploited. An insecure design cannot be fixed by a perfect implementation as by definition, needed security controls were never created to defend against specific attacks. One of the factors that contribute to insecure design is the lack of business risk profiling inherent in the software or system being developed, and thus the failure to determine what level of security design is required.
Possible Attack vectors
Vulnerabilites
Preventions
Attack vectors
https://www.rapid7.com/blog/post/2019/12/06/hidden-helpers-security-focused-http-headers-to-protect-against-vulnerabilities/
Vulnerabilites
If you do not scan for vulnerabilities regularly and subscribe to security bulletins related to the components you use.
If you do not fix or upgrade the underlying platform, frameworks, and dependencies in a risk-based, timely fashion
Preventions
https://www.youtube.com/watch?v=NaGwa-x2I1Q
Vulnerabilities
Preventions
Vulnerabilities
Software and data integrity failures relate to code and infrastructure that does not protect against integrity violations. An example of this is where an application relies upon plugins, libraries, or modules from untrusted sources, repositories, and content delivery networks (CDNs). An insecure CI/CD pipeline can introduce the potential for unauthorized access, malicious code, or system compromise. Lastly, many applications now include auto-update functionality, where updates are downloaded without sufficient integrity verification and applied to the previously trusted application. Attackers could potentially upload their own updates to be distributed and run on all installations. Another example is where objects or data are encoded or serialized into a structure that an attacker can see and modify is vulnerable to insecure deserialization
Preventions
Attach Vectors
Vulnerabilities
Preventions
Vulnerabilities
Preventions
Attack Vectors