Unit 1.3 (Types - of - Attacks - On App)
Unit 1.3 (Types - of - Attacks - On App)
BY Prof.Vidya Harkal
1. Target: The software itself, including its code, data, logic, APIs, or the environment in which it runs.
2. Method: Exploits flaws in design, development, configuration, or user interaction.
3. Impact: Can result in data breaches, financial loss, reputational harm, or denial of service.
Several factors can lead to an attack on an application. These factors are often
vulnerabilities or weaknesses in the design, implementation, configuration, or
operation of the application. Below are the primary causes that contribute to
attacks:
1. Software Vulnerabilities
● Description: Mistakes by developers, administrators, or users that create opportunities for attacks.
● Examples:
○ Hardcoding sensitive information (e.g., API keys or passwords) in the code.
○ Mismanaging user roles and permissions.
○ Clicking on phishing links or using weak passwords.
● Description: Applications that do not properly validate user inputs are vulnerable to injection attacks.
● Examples:
○ SQL Injection: Malicious SQL commands are executed.
○ Command Injection: Arbitrary system commands are executed.
○ Cross-Site Scripting (XSS): Malicious scripts are injected into web pages.
5. Insufficient Authentication and Authorization
● Description: Weak or poorly implemented mechanisms to verify user identity and permissions.
● Examples:
○ Use of weak passwords or no multi-factor authentication (MFA).
○ Broken session management, leading to session hijacking.
○ Lack of proper access controls.
6. Unpatched Vulnerabilities
7. Overexposed APIs
● Description: Applications that are not thoroughly tested for security issues may have undetected
vulnerabilities.
● Examples:
○ Failing to perform penetration testing.
○ Skipping code reviews or vulnerability scanning.
9. Insider Threats
● Description: Failure to encrypt sensitive data at rest or in transit leaves it vulnerable to interception or
theft.
● Examples:
○ Transmitting sensitive information over unencrypted channels (e.g., HTTP instead of HTTPS).
○ Storing sensitive data in plaintext.
11. Social Engineering
● Description: Manipulating users into revealing sensitive information or performing actions that
compromise security.
● Examples:
○ Phishing attacks to steal login credentials.
○ Impersonating technical support to gain access.
● Description: Applications with unnecessarily complex architectures increase the risk of overlooked
vulnerabilities.
● Examples:
○ Using multiple interconnected systems with inadequate security controls.
○ Difficult-to-maintain codebases.
Access control is a security mechanism to put restrictions on the accessibilities of the resources and decide who or
what can view or use the resources of a company. This is checked after authentication, and what authorized users
are allowed to do. It is not an easy task to do, any failure while checking, can lead to data modification or
destruction of data or unauthorized performance of the business functions, etc. Sometimes, developers don’t
design access control specifically but simply design them along with the website. As a result that special collection
of rules becomes hard to understand.
What is Broken Access Control?
Poor implementation of access control mechanism leads to flawed access control, which can be easily exploited.
This is called broken access control. Because of broken access control, unauthorized users can view content that
they are not allowed to view, can perform unauthorized functions, even an attacker can delete the content, or take
over site administration.
1. Lack of Authorization Verification: The application doesn't check whether the authenticated user is
allowed to access a particular resource or function.
2. Failure to Enforce Access Policies: Role-based access control (RBAC) or permission models are
misconfigured or not enforced.
3. Insecure Object References: Direct access to resources (e.g., files, database records) is allowed through
predictable identifiers like URLs or query parameters.
Overview
Moving up from the fifth position, 94% of applications were tested for some form of broken
access control with the average incidence rate of 3.81%, and has the most occurrences in
the contributed dataset with over 318k.
1. Whenever we make an account on a website, we are given a unique ID. By using that ID, we can access the
database where all our sensitive contents are saved. Suppose, you have logged into a website, and your user ID is
986. The URL of your profile page should look something like this: https://brokenaccesscontrol.com/profile?id=986.
We have to keep in mind that, like you, everyone else who makes his/her account on that website, is given a unique
user ID. So, if you replace your ID with someone else’s user ID, then you can get access to his/her profile. Yes, this
can happen if access control is not properly implemented in the server.
2. Hackers can take advantage of access flaws to gain access to the resources and services that should not be
accessible to normal users.
For example, the admin page of a web application should only be accessible to the admin, and shouldn’t be
available to any other user. However, if the access control is broken then hackers can easily get access to it just by
making some changes in the URL. With that privilege, they can steal other users’ data or deploy malicious payloads
to destroy the entire application hosting ecosystem.
3. There are possibilities of Distributed Denial of Service attacks (DDOS). With access to those user accounts,
attackers can attempt to disrupt the normal traffic of a targeted server, by deploying bots. This makes it difficult for
the server to distinguish legitimate user traffic from attack traffic.
Example Attack Scenarios
Scenario #1: The application uses unverified data in a SQL call that is accessing account information:
pstmt.setString(1, request.getParameter("acct"));
ResultSet results = pstmt.executeQuery( );
An attacker simply modifies the browser's 'acct' parameter to send whatever account number they want. If not
correctly verified, the attacker can access any user's account.
https://example.com/app/accountInfo?acct=notmyacct
Scenario #2: An attacker simply forces browses to target URLs. Admin rights are required for access to the
admin page.
https://example.com/app/getappInfo
https://example.com/app/admin_getappInfo
If an unauthenticated user can access either page, it's a flaw. If a non-admin can access the admin page, this is a
Mitigation Strategies
Shifting up one position to #2, previously known as Sensitive Data Exposure, which is more of a
broad symptom rather than a root cause, the focus is on failures related to cryptography (or lack
thereof). Which often lead to exposure of sensitive data.
1. Data at Rest
○ Description: Data stored on a physical or virtual medium, such as databases, file systems, or cloud storage.
○ Examples:
■ Database files, archived documents, and log files.
○ Failures:
■ Storing sensitive data without encryption.
■ Using outdated encryption algorithms (e.g., DES, MD5).
2.Data in Motion
● Description: Data being transmitted between systems, such as over a network or API calls.
● Examples:
○ HTTPS requests, API communication, email exchanges.
● Failures:
○ Transmitting sensitive data over unencrypted channels (e.g., HTTP).
○ Weak TLS configurations (e.g., using TLS 1.0).
3.Data in Use
● Description: Data actively being processed or manipulated in memory, such as in RAM or CPU caches.
● Examples:
○ Decrypted data during computation or in session tokens stored in memory.
● Failures:
○ Leaving sensitive data in plaintext in application logs or memory.
○ Failing to protect data in volatile storage.
How Cryptographic Failures Occur
1. Data Breach:
○ Exposure of sensitive user data (e.g., passwords, financial details).
2. Reputation Damage:
○ Loss of customer trust and business credibility.
3. Financial Loss:
○ Legal fines due to non-compliance with regulations (e.g., GDPR, HIPAA).
4. Operational Disruption:
○ Loss of critical data affecting business operations.
5. Nation-State Risks:
○ Espionage and exploitation in cases of government-level data exposure.
Examples of Cryptographic Failures
1. Strong Cryptography:
○ Use modern algorithms (e.g., AES-256, RSA-2048, SHA-256).
2. Secure Key Management:
○ Store keys in hardware security modules (HSMs) or secure vaults.
○ Rotate keys periodically.
3. Encrypt Everywhere:
○ Encrypt data at rest, in transit, and in use using appropriate
mechanisms.
4. Secure Protocols:
○ Use secure transport protocols like HTTPS, TLS 1.3, and SFTP.
5. Regular Audits:
○ Perform regular cryptographic assessments to identify weak
configurations or outdated protocols.
A03:2021 – Injection
An injection attack occurs when an attacker exploits vulnerabilities in an application by injecting malicious input into the system.
The input tricks the application into executing unintended commands, accessing unauthorized data, or altering the application's
behavior.
Injection slides down to the third position. 94% of the applications were tested for some form of injection with
a max incidence rate of 19%, an average incidence rate of 3%, and 274k occurrences.
Notable Common Weakness Enumerations (CWEs) included are
CWE-79: Cross-site Scripting,
CWE-89: SQL Injection, and
CWE-73: External Control of File Name or Path.
Types of Injection Attacks
1. SQL Injection:
○ Injecting malicious SQL queries into an application's input fields to manipulate the database.
○ Example: Exploiting a login form by inputting admin' OR '1'='1 in the username field.
2. Command Injection:
○ Executing system-level commands on a server through a vulnerable application.
○ Example: Adding ; rm -rf / to a file upload path to delete server files.
3. Cross-Site Scripting (XSS):
○ Injecting malicious scripts into web pages viewed by other users.
○ Example: Injecting <script>alert('hacked')</script> into a comment section.
LDAP Injection:
XML Injection:
NoSQL Injection:
Path Traversal:
1. Input Handling:
○ The application accepts user inputs without proper validation or sanitization.
2. Malicious Payload:
○ Attackers craft inputs that exploit the application's handling of commands, queries, or scripts.
3. Execution:
○ The application processes the malicious input, executing unintended commands or exposing
sensitive data.
Why Do Injection Attacks Occur?
● During Input Handling: When processing user data in forms, URLs, APIs, or files.
1. Web Applications:
○ Login forms, search bars, and comment sections.
2. APIs:
○ Endpoints that accept dynamic parameters.
3. File Systems:
○ Applications handling file uploads or paths.
4. Backend Services:
○ Database servers, LDAP servers, or command-line interfaces.
5. IoT Devices:
○ Systems with minimal input validation in command execution.
Impact of Injection Attacks
1. Data Breach:
○ Accessing, modifying, or deleting sensitive data.
2. System Compromise:
○ Gaining unauthorized control of the system or application.
3. Denial of Service:
○ Crashing the application or server.
4. Privilege Escalation:
○ Gaining higher privileges to perform restricted actions.
5. Reputation Damage:
○ Loss of trust and credibility with users.
6. Financial Loss:
○ Costs from downtime, legal penalties, or compliance violations.
Mitigation Strategies
A new category for 2021 focuses on risks related to design and architectural flaws, with a call
for more use of threat modeling, secure design patterns, and reference architectures. As a
community we need to move beyond "shift-left" in the coding space to pre-code activities that
are critical for the principles of Secure by Design.
1. Poor Planning:
○ Security considerations are not integrated into the software development lifecycle (SDLC).
2. Lack of Threat Modeling:
○ Developers fail to identify potential attack vectors or threats.
3. Insufficient Security Training:
○ Teams lack knowledge about secure coding practices and design principles.
4. Ignoring Best Practices:
○ Overlooking established frameworks or guidelines like OWASP or NIST.
5. Business Pressure:
○ Prioritizing speed or functionality over security during development.
Why Insecure Design Matters
● During the early phases of development when functional requirements are prioritized over security.
● When changes are introduced without considering their security implications (e.g., feature additions).
1. Data Breaches:
○ Sensitive data can be stolen or exposed.
2. Reputational Damage:
○ Loss of customer trust due to compromised systems.
3. Regulatory Penalties:
○ Fines for failing to meet compliance standards.
4. Business Disruption:
○ Downtime caused by exploitation of insecure designs.
5. Exploitation at Scale:
○ Design flaws can be exploited by multiple attackers simultaneously.
Mitigation Strategies for Insecure Design
Moving up from #6 in the previous edition, 90% of applications were tested for some form of misconfiguration,
with an average incidence rate of 4.%, and over 208k occurrences of a Common Weakness Enumeration (CWE) in
this risk category.
With more shifts into highly configurable software, it's not surprising to see this category move up.
Notable CWEs included are
CWE-16 Configuration and
CWE-611 Improper Restriction of XML External Entity Reference.
How Security Misconfiguration Happens
1. Default Settings:
○ Leaving default credentials or configurations unchanged (e.g., admin/admin).
2. Unnecessary Features:
○ Enabling unneeded services or components that increase the attack surface.
3. Weak Permissions:
○ Files, databases, or APIs are accessible by unauthorized users.
4. Outdated Components:
○ Using outdated or unpatched software versions.
5. Improper Error Handling:
○ Revealing stack traces, database credentials, or other sensitive information in error messages.
1. Lack of Awareness:
○ Developers or administrators might not understand the implications of insecure settings.
2. Complex Systems:
○ Modern applications involve multiple components, making misconfigurations likely.
3. Time Pressure:
○ Teams may skip thorough security configurations due to tight deadlines.
4. Poor Documentation:
○ Insufficient documentation on secure configurations for the tools and frameworks being used.
When Security Misconfiguration Occurs
● During Setup:
○ When initial settings or defaults are not reviewed or secured.
● During Updates:
○ Introducing misconfigurations while updating or deploying new features.
● When Integrating Systems:
○ Failure to secure communication and access points between interconnected systems.
1. Web Servers:
○ Exposing unnecessary HTTP methods (e.g., TRACE, OPTIONS).
2. Databases:
○ Allowing unrestricted access to database servers.
3. Cloud Services:
○ Open S3 buckets, insecure API endpoints, or default security group rules.
4. Containers and VMs:
○ Using untrusted images or failing to restrict container privileges.
5. APIs:
○ Lack of authentication or rate limiting.
6. Applications:
○ Verbose error messages revealing sensitive details.
Examples of Security Misconfiguration
1. Default Credentials:
○ Leaving the default username and password (e.g., "admin/admin") for a web application.
2. Unnecessary Services Enabled:
○ Enabling directory listing on a web server, allowing attackers to browse sensitive files.
3. Unprotected APIs:
○ APIs with no authentication mechanism expose sensitive data to the public.
4. Verbose Error Messages:
○ Exposing stack traces, database names, or credentials in error messages.
5. Excessive Permissions:
○ Granting read/write permissions to all users for a sensitive database.
Example Scenario
Exposed S3 Bucket
● What Happened:
A cloud storage bucket (S3) is configured with public access, allowing anyone to view and download sensitive files.
● Impact:
An attacker gains access to customer data, leading to a data breach and reputational damage.
● Mitigation:
Implement strict access policies for the bucket and use encryption to protect stored data.
Impact of Security Misconfiguration
1. Data Breaches:
○ Unauthorized access to sensitive data due to weak configurations.
2. Service Exploitation:
○ Attackers exploiting unnecessary or misconfigured services for further attacks.
3. Reputational Damage:
○ Loss of trust among users and stakeholders.
4. Regulatory Penalties:
○ Fines or legal actions for non-compliance with data protection regulations.
5. Operational Disruption:
○ Misconfigurations leading to service outages or downtimes.
Mitigation Strategies for Security Misconfiguration
1. Secure Defaults:
○ Use secure configurations by default for all systems and applications.
2. Disable Unnecessary Features:
○ Turn off features or services that are not actively used.
3. Use Strong Authentication:
○ Enforce the use of strong passwords, multi-factor authentication, and role-based access controls.
4. Regular Updates:
○ Keep all software, frameworks, and dependencies up-to-date.
5. Environment Segregation:
○ Separate development, testing, and production environments.
6. Perform Security Audits:
○ Regularly review configurations and perform penetration testing.
7. Error Handling:
○ Ensure error messages are generic and do not reveal sensitive details.
8. Monitor and Log:
○ Enable logging to detect misconfiguration issues and unauthorized access.
A06:2021 – Vulnerable and Outdated Components