Web application penetration testing
Penetration testing of Web applications involves identification of security weaknesses and vulnerabilities caused by insecure coding practices, misconfiguration and bugs. It is usually performed on a test instance of the application but can also be performed on live instances in certain cases.
The penetration testing process involves intercepting, analysing, modifying and generating specially crafted malicious and/or invalid HTTP requests to identify and exploit vulnerabilities that may exist in the application, such as the ones defined by the industry-standard sources such as OWASP Top 10 and CWE Top 25 outlined below.
OWASP Top 10 Web Application Security Risks
1. Injection. Injection flaws, such as SQL, NoSQL, OS, and LDAP injection, occur when untrusted data is sent to an interpreter as part of a command or query. The attacker’s hostile data can trick the interpreter into executing unintended commands or accessing data without proper authorization.
2. Broken Authentication. Application functions related to authentication and session management are often implemented incorrectly, allowing attackers to compromise passwords, keys, or session tokens, or to exploit other implementation flaws to assume other users’ identities temporarily or permanently.
3. Sensitive Data Exposure. Many web applications and APIs do not properly protect sensitive data, such as financial, healthcare, and PII. Attackers may steal or modify such weakly protected data to conduct credit card fraud, identity theft, or other crimes. Sensitive data may be compromised without extra protection, such as encryption at rest or in transit, and requires special precautions when exchanged with the browser.
4. XML External Entities (XXE). Many older or poorly configured XML processors evaluate external entity references within XML documents. External entities can be used to disclose internal files using the file URI handler, internal file shares, internal port scanning, remote code execution, and denial of service attacks.
5. Broken Access Control. Restrictions on what authenticated users are allowed to do are often not properly enforced. Attackers can exploit these flaws to access unauthorized functionality and/or data, such as access other users’ accounts, view sensitive files, modify other users’ data, change access rights, etc.
6. Security Misconfiguration. Security misconfiguration is the most commonly seen issue. This is commonly a result of insecure default configurations, incomplete or ad hoc configurations, open cloud storage, misconfigured HTTP headers, and verbose error messages containing sensitive information. Not only must all operating systems, frameworks, libraries, and applications be securely configured, but they must be patched/upgraded in a timely fashion.
8. Insecure Deserialization. Insecure deserialization often leads to remote code execution. Even if deserialization flaws do not result in remote code execution, they can be used to perform attacks, including replay attacks, injection attacks, and privilege escalation attacks.
9. Using Components with Known Vulnerabilities. Components, such as libraries, frameworks, and other software modules, run with the same privileges as the application. If a vulnerable component is exploited, such an attack can facilitate serious data loss or server takeover. Applications and APIs using components with known vulnerabilities may undermine application defenses and enable various attacks and impacts.
10. Insufficient Logging & Monitoring. Insufficient logging and monitoring, coupled with missing or ineffective integration with incident response, allows attackers to further attack systems, maintain persistence, pivot to more systems, and tamper, extract, or destroy data. Most breach studies show time to detect a breach is over 200 days, typically detected by external parties rather than internal processes or monitoring.
CWE Top 25 Most Dangerous Software Weaknesses
 CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
 CWE-787 Out-of-bounds Write
 CWE-20 Improper Input Validation
 CWE-125 Out-of-bounds Read
 CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer
 CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
 CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
 CWE-416 Use After Free
 CWE-352 Cross-Site Request Forgery (CSRF)
 CWE-78 Improper Neutralization of Special Elements used in an OS Command
 CWE-190 Integer Overflow or Wraparound
 CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
 CWE-476 NULL Pointer Dereference
 CWE-287 Improper Authentication
 CWE-434 Unrestricted Upload of File with Dangerous Type
 CWE-732 Incorrect Permission Assignment for Critical Resource
 CWE-94 Improper Control of Generation of Code ('Code Injection')
 CWE-522 Insufficiently Protected Credentials
 CWE-611 Improper Restriction of XML External Entity Reference
 CWE-798 Use of Hard-coded Credentials
 CWE-502 Deserialization of Untrusted Data
 CWE-269 Improper Privilege Management
 CWE-400 Uncontrolled Resource Consumption
 CWE-306 Missing Authentication for Critical Function
 CWE-862 Missing Authorization