Saif Task 4
Saif Task 4
The OWASP Mobile Top 10 is a project by the Open Web Application Security Project (OWASP) that
identifies the top 10 most critical security risks for mobile applications. It aims to raise awareness among
developers, architects, managers, and organizations about these common vulnerabilities to help them
build more secure mobile applications. The list is periodically updated to reflect the current security
landscape.
Definition
Improper credential usage refers to insecure practices related to the handling, storage, and
management of user credentials such as usernames, passwords, and tokens. This can include
hardcoding credentials in the code, using weak credentials, not securing credentials properly during
storage or transmission, and failing to enforce strong authentication policies.
Impact
Improper credential usage can lead to unauthorized access to sensitive information, user accounts, and
application functionalities. It can also result in data breaches, identity theft, and other security incidents.
Scenario #1: Hardcoded Credentials: An attacker discovers hardcoded credentials within the mobile
app’s source code. They use these credentials to gain unauthorized access to sensitive functionality
within the app or backend systems.
Scenario #3: Insecure Credential Storage: An attacker gains physical access to a user’s device and
extracts stored credentials from the mobile app. The attacker uses these credentials to gain
unauthorized access to the user’s account.
Prevention
Defination
An attacker can manipulate application functionality by exploiting vulnerabilities in the mobile app supply
chain. For example, an attacker can insert malicious code into the mobile app’s codebase or modify the
code during the build process to introduce backdoors, spyware, or other malicious code.This can allow
the attacker to steal data, spy on users, or take control of the mobile device. Moreover, an attacker can
exploit vulnerabilities in third-party software libraries, SDKs, vendors, or hardcoded credentials to gain
access to the mobile app or the backend servers.
Impact
If vulnerabilities are present in third-party components, attackers can exploit them to compromise the
application, steal sensitive data, inject malicious code, or disrupt services. Supply chain attacks can
have far-reaching consequences, affecting not just the application in question but potentially the entire
ecosystem it interacts with.
Prevention
Implement secure coding practices, code review, and testing throughout the mobile app
development lifecycle to identify and mitigate vulnerabilities.
Ensure secure app signing and distribution processes to prevent attackers from signing and
distributing malicious code.
Use only trusted and validated third-party libraries or components to reduce the risk of
vulnerabilities.
Establish security controls for app updates, patches, and releases to prevent attackers from
exploiting vulnerabilities in the app.
Monitor and detect supply chain security incidents through security testing, scanning, or other
techniques to detect and respond to incidents in a timely manner.
M3: Insecure Authentication/Authorization
Defination
Insecure authentication and authorization encompass flaws in the processes that verify user identity and
control user access to resources. Authentication verifies the identity of a user, while authorization
determines what an authenticated user is allowed to do. Inadequate implementation of these processes
can lead to unauthorized access, data breaches, and other security issues.
Impact
If authentication and authorization mechanisms are insecure, attackers can exploit these weaknesses to
gain unauthorized access to user accounts, sensitive data, and application functionalities. This can
result in identity theft, data loss, and potentially severe legal and financial repercussions for the affected
organization.
Scenario #1: Hidden Service Requests: Developers assume that only authenticated users will be
able to generate a service request that the mobile app submits to its backend for processing. During
the processing of the request, the server code does not verify that the incoming request is
associated with a known user. Hence, adversaries submit service requests to the back-end service
and anonymously execute functionality that affects legitimate users of the solution.
Scenario #2: Interface Reliance: Developers assume that only authorized users will be able to see
the existence of a particular function on their mobile app. Hence, they expect that only legitimately
authorized users will be able to issue the request for the service from their mobile devices. The
back-end code that processes the request does not bother to verify that the identity associated with
the request is entitled to execute the service. Hence, adversaries are able to perform remote
administrative functionality using fairly low-privilege user accounts.
Scenario #3: Usability Requirements: Due to usability requirements, mobile apps allow for
passwords that are 4 digits long. The server code correctly stores a hashed version of the
password. However, due to the severely short length of the password, an adversary will be able to
quickly deduce the original passwords using rainbow hash tables. If the password file (or data store)
on the server is compromised, an adversary will be able to quickly deduce users’ passwords.
Scenario #4: Insecure Direct Object Reference: A user makes an API endpoint request to a backend
REST API that includes an actor ID and an OAuth bearer token. The user includes their actor ID as
part of the incoming URL and includes the access token as a standard header in the request. The
backend verifies the presence of the bearer token but fails to validate the actor ID associated with
the bearer token. As a result, the user can tweak the actor ID and attain the account information of
other users as part of the REST API request.
Scenario #5: Transmission of LDAP roles: A user makes an API endpoint request to a backend
REST API that includes a standard oAuth bearer token along with a header that includes a list of
LDAP groups that the user belongs to. The backend request validates the bearer token and then
inspects the incoming LDAP groups for the right group membership before continuing on to the
sensitive functionality. However, the backend system does not perform an independent validation of
LDAP group membership and instead relies upon the incoming LDAP information coming from the
user. The user can tweak the incoming header and report to be a member of any LDAP group
arbitrarily and perform administrative functionality.
Prevention
If you are porting a web application to a mobile equivalent, ensure the authentication requirements
of mobile applications match that of the web application component. It should not be possible to
authenticate with fewer factors than the web browser.
Local user authentication can lead to client-side bypass vulnerabilities. If the application stores data
locally, the authentication routine can be bypassed on jailbroken devices through runtime
manipulation or binary modification. If offline authentication is a compelling business requirement,
consult additional guidance on preventing binary attacks against the mobile app.
Perform all authentication requests server-side, where possible. Upon successful authentication,
application data will be loaded onto the mobile device, ensuring application data availability only
after successful authentication.
If client-side data storage is necessary, encrypt the data using an encryption key securely derived
from the user’s login credentials. However, there are additional risks that the data will be decrypted
via binary attacks.
The “Remember Me” functionality should never store a user’s password on the device.
Mobile applications should ideally use a device-specific authentication token that can be revoked
within the mobile application by the user, mitigating unauthorized access risks from a stolen/lost
device.
Avoid using spoof-able values for user authentication, including device identifiers or geo-location.
Persistent authentication within mobile applications should be implemented as an opt-in and not
enabled by default.
Where possible, refrain from allowing users to provide 4-digit PIN numbers for authentication
passwords.
Defination
Insufficient input/output (I/O) validation refers to the failure to properly validate, sanitize, and encode
input and output data in a mobile application. This includes data from users, other applications, and
external systems. Proper validation is crucial to prevent attackers from injecting malicious data that can
lead to various security vulnerabilities, including injection attacks, data breaches, and system
compromises.
Impact
Inadequate input/output validation can result in a wide range of security issues, such as SQL injection,
cross-site scripting (XSS), buffer overflows, and other forms of data manipulation attacks. These
vulnerabilities can allow attackers to execute arbitrary code, steal sensitive data, manipulate application
behavior, and compromise system integrity.
Example Attack Scenarios
Prevention
Input Validation:
Validate and sanitize user input using strict validation techniques.
Implement input length restrictions and reject unexpected or malicious data.
Output Sanitization:
Properly sanitize output data to prevent cross-site scripting (XSS) attacks.
Use output encoding techniques when displaying or transmitting data.
Context-Specific Validation:
Perform specific validation based on data context (e.g., file uploads, database queries) to prevent
attacks like path traversal or injection.
Defination
Most modern mobile applications exchange data with one or more remote servers. When the data
transmission takes place, it typically goes through the mobile device’s carrier network and the internet, a
threat agent listening on the wire can intercept and modify the data if it transmitted in plaintext or using a
deprecated encryption protocol. Threat agents might have different motives such as stealing sensitive
information, conducting espionage, identity theft and more. The following threat agents exist:
Impact
Insecure communication can lead to various security issues, such as data breaches, man-in-the-middle
(MitM) attacks, session hijacking, and unauthorized access to sensitive information. Compromised
communication channels can expose user data, credentials, and other critical information to attackers,
potentially leading to severe legal and financial consequences.
Prevention
Assume that the network layer is not secure and is susceptible to eavesdropping.
Apply SSL/TLS to transport channels that the mobile app will use to transmit data to a backend API
or web service.
Account for outside entities like third-party analytics companies, social networks, etc. by using their
SSL versions when an application runs a routine via the browser/webkit. Avoid mixed SSL sessions
as they may expose the user’s session ID.
Use strong, industry standard cipher suites with appropriate key lengths.
Use certificates signed by a trusted CA provider.
Never allow bad certificates (self-signed, expired, untrusted root, revoked, wrong host..).
Consider certificate pinning.
Defination
Privacy controls are concerned with protecting Personally Identifiable Information (PII), e.g., names and
addresses, credit card information, e-mail and IP addresses, information about health, religion, sexuality
and political opinions.
This information is valuable to attackers for several reasons. For example, an attacker could
Impact
Inadequate privacy controls can lead to unauthorized access to personal data, identity theft, financial
loss, and legal penalties due to non-compliance with data protection laws. It can also damage the
reputation of the organization and erode user trust.
Prevention
Evaluate if collecting details like name, address, gender, and age is essential for the application's
functionality.
Replace fine-grained location data with coarse-grained location data to reduce sensitivity while
maintaining necessary functionality.
Reduce the frequency of data collection, such as updating location information every hour instead of
every minute, to minimize sensitivity.
Implement anonymization techniques like hashing to protect user privacy while still enabling
necessary data analysis.
Allow users to opt-in to sharing additional data for enhanced services, clearly informing them of the
benefits and associated risks to ensure informed consent.
Defination
The binary could contain valuable secrets, such as commercial API keys or hardcoded cryptographic
secrets that an attacker could misuse. In addition, the code in the binary could be valuable on its own,
for example, because it contains critical business logic or pre-trained AI models. Some attackers might
also not target the app itself but use it to explore potential weaknesses of the corresponding backend to
prepare for an attack.
Impact
Without adequate binary protection, attackers can decompile the application, gain insights into its inner
workings, identify and exploit security vulnerabilities, steal intellectual property, and potentially
compromise user data. This can lead to data breaches, unauthorized access, and loss of revenue and
reputation for the application developer.
Scenario #1 Hardcoded API keys: Assume an app uses a commercial API where it must pay a small
fee for each call. These calls would be easily paid for by the subscription fee the users pay for that
app. However, the API key used for access and billing is hardcoded in the app’s unprotected binary
code. An attacker who wants access could reverse engineer the app with free tools and get access
to the secret string. Since API access is only protected with the API key and no additional user
authentication, the attacker can freely work on the API or even sell the API key. In the worst case,
the API keys could be misused a lot, causing substantial financial damage to the provider of the app,
or at least blocking legitimate users of the app if the API access is rate-limited.
Scenario #2 Disabling payment and license checks: A mobile game might publish its app and the
first levels for free. If the users like the game, they pay for full access. All the resources for the later
levels are shipped with the app. They are only protected by a license check, where the license is
downloaded when the user pays. An attacker could reverse engineer the app and try to understand
how the verification of the payment happens. If the app binary is not sufficiently protected, it is easy
to locate the license check and just replace it with a static success statement. The attacker can then
recompile the app and play it for free or even sell it under another name in the app stores.
Scenario #3 Hardcoded AI models: Assume a medical app that features an AI to answer user
requests given as speech or free text inputs needs. This app includes its specialized and quality-
assured AI model in its source code to enable offline access and avoid hosting own download
servers. This AI model is the most valuable asset of this app and took many person-years in
development. An attacker might try to extract this model from the source code and sell it to
competitors. If the app binary is insufficiently protected, the attacker could not only access the AI
model, but also learn how it is used, selling this information along with the AI training parameters.
Prevention
Reverse engineering: To prevent reverse engineering, the app binary should be made
incomprehensible. This is supported by many free and commercial obfuscation tools. Compiling part
of apps natively (iOS and Android) or using interpreters or nested virtual machines makes reverse
engineering even harder, as many decompiling tools only support one language and binary format.
This kind of obfuscation is a tradeoff between the complexity of the code and robustness against
reverse engineering, as many libraries that rely on certain strings or symbols in the code will not
work with full obfuscation. Developers could check the quality of their obfuscation by using the tools
from the previous section.
Breaking security mechanisms: Obfuscation also helps against manipulation, as an attacker must
understand the control flow in order to skip security checks and like. In addition, local security
checks should also be enforced by the backend. For example, required resources for a protected
feature should only be downloaded if a check succeeds locally and in the backend. Finally, integrity
checks could detect code tampering and render the app installation unusable, e.g., by deleting some
resources. However, such an integrity check could also be found and deactivated as any other local
security check.
Redistribution (with malicious code): Integrity checks, e.g., on startup, could also detect
redistribution and modification of app binaries. These violations could automatically be reported to
find and remove the unauthorized copies of the app from the app stores before they become
widespread. There are also specialized companies that support this use case.
Impact
Security misconfigurations can have significant repercussions, including unauthorized access to
sensitive data, data breaches, service disruptions, and reputational damage to the organization.
Attackers can exploit these misconfigurations to execute various attacks, such as privilege escalation,
injection attacks, and unauthorized data access.
Prevention
Secure default configurations: Ensure that default settings and configurations are properly secured
and do not expose sensitive information or provide unnecessary permissions.
Default credentials: Refrain from using hardcoded default credentials.
Insecure permissions: Avoid storing application files with overly permissive permissions like world-
readable and/or world-writable.
Least privilege principle: Request only the permissions necessary for the proper functioning of the
application
Secure network configuration: Disallow cleartext traffic and use certificate pinning when possible.
Disable Debugging: Disable debugging features in the production version of the app.
Disable backup mode (Android): By disabling backup mode on Android devices, you prevent the
inclusion of app data in the device’s backup, ensuring that sensitive data from the app is not stored
in the device backup.
Limit application attack surface by only exporting activities, content providers and services that are
necessary to be exported.
Defination
Insecure data storage in a mobile application can attract various threat agents who aim to exploit the
vulnerabilities and gain unauthorised access to sensitive information. These threat agents include skilled
adversaries who target mobile apps to extract valuable data, malicious insiders within the organisation
or app development team who misuse their privileges, state-sponsored actors conducting cyber
espionage, cybercriminals seeking financial gain through data theft or ransom, script kiddies utilising
pre-built tools for simple attacks, data brokers looking to exploit insecure storage for selling personal
information, competitors and industrial spies aiming to gain a competitive advantage, and activists or
hacktivists with ideological motives.
Impact
Insecure data storage can lead to severe consequences, including data breaches, identity theft,
financial fraud, and loss of user trust. Attackers can exploit vulnerabilities in data storage mechanisms to
access and manipulate sensitive user information, such as personal details, passwords, financial data,
and confidential documents.
Storing Passwords in Plain Text: The mobile application stores user passwords in plain text format
within a local database or file, making it easy for an attacker to retrieve and abuse these credentials
if they gain unauthorized access to the device.
Unsecured Local Storage: The mobile application stores sensitive user data, such as personally
identifiable information (PII), locally on the device without utilizing proper access controls or
encryption. This allows anyone with physical access to the device to extract and view the data.
Insecure Data Caching: The mobile application caches sensitive data, such as user authentication
tokens or session information, without implementing appropriate security measures. If an attacker
gains access to the device’s cache, they can obtain these credentials and impersonate the user.
Unprotected Logging: The mobile application logs sensitive data, including user actions, API
responses, or error messages, without proper security controls. This can lead to unintentional
exposure of sensitive information if an attacker gains access to the device or intercepts the log files.
Insecure Cloud Storage Configuration: The mobile application utilizes cloud storage services to
store user data but misconfigures the storage permissions, allowing unauthorized access to the
stored information. This can result in data leakage or unauthorized exposure of sensitive data.
Improper Handling of Temporary Files: The mobile application creates temporary files to process or
store sensitive data, but fails to properly handle and delete these files afterward. This leaves
sensitive information exposed and vulnerable to unauthorized access.
Prevention
Use Strong Encryption: Implement robust encryption algorithms and practices to protect sensitive
data both at rest and in transit. Utilise industry-standard encryption algorithms and ensure that
encryption keys are securely stored and managed.
Secure Data Transmission: Utilise secure communication protocols (e.g., HTTPS, SSL/TLS) to
protect data during transmission between the mobile application and backend servers. Avoid
sending sensitive data over unsecured channels.
Implement Secure Storage Mechanisms: Store sensitive data in secure storage locations that are
inaccessible to unauthorised users. Use platform-specific secure storage mechanisms provided by
the mobile operating system, such as Keychain (iOS) or Keystore (Android).
Employ Proper Access Controls: Implement strong access controls to restrict unauthorised access
to sensitive data. Authenticate users securely, enforce role-based access controls, and validate user
permissions before granting access to sensitive information.
Validate Input and Sanitize Data: Implement input validation and data sanitization techniques to
prevent injection attacks and ensure that only valid and expected data is stored. Validate user inputs
to mitigate the risk of malicious code injection or unintended data leakage.
Apply Secure Session Management: Implement secure session management techniques, such as
using randomly generated session tokens, setting proper session timeouts, and securely storing
session data on the client and server sides.
Defination
Threat agents who exploit insecure cryptography in mobile applications can undermine the
confidentiality, integrity, and authenticity of sensitive information. These threat agents include attackers
who target cryptographic algorithms or implementations to decrypt sensitive data, malicious insiders
who manipulate cryptographic processes or leak encryption keys, state-sponsored actors engaged in
cryptanalysis for intelligence purposes, cybercriminals who exploit weak encryption to steal valuable
data or conduct financial fraud, and attackers who leverage vulnerabilities in cryptographic protocols or
libraries.
Impact
Insufficient cryptography can lead to various security vulnerabilities, including data breaches,
unauthorized access, and data manipulation. Attackers can exploit weaknesses in cryptographic
systems to decrypt encrypted data, forge digital signatures, or impersonate legitimate users, leading to
severe consequences such as financial loss, privacy violations, and reputational damage.
Scenario #1: Man-in-the-Middle (MitM) Attacks - An attacker intercepts the communication between
the mobile application and the server. Weak cryptography can enable attackers to decrypt the
intercepted data, modify it, and re-encrypt it before forwarding it to the intended recipient. This can
lead to unauthorized access, data manipulation, or the injection of malicious content.
Scenario #2: Brute-Force Attacks- Attackers systematically try various combinations of keys until
they find the correct one to decrypt the data. Weak cryptography can shorten the time required for
such attacks, potentially exposing sensitive information.
Scenario #3: Cryptographic Downgrade Attacks - Mobile applications may support multiple
encryption protocols or algorithms to establish secure connections. If weak cryptography is allowed
as a fallback option, attackers can exploit this weakness and force the application to use weak
encryption. As a result, they can decrypt the intercepted data more easily and launch subsequent
attacks.
Scenario #4: Key Management Vulnerabilities - Weak key management practices can undermine
the security of the cryptographic systems used in mobile applications. For example, if encryption
keys are stored insecurely or are easily guessable, attackers can gain unauthorized access to the
keys and decrypt the encrypted data. This can result in data breaches and privacy violations.
Scenario #5: Crypto Implementation Flaws - Weak cryptography can also stem from implementation
flaws in the mobile application itself. These flaws may include incorrect usage of cryptographic
libraries, insecure key generation, improper random number generation, or insecure handling of
encryption-related functions. Attackers can exploit these flaws to bypass or weaken the encryption
protections.
Prevention
Use Strong Encryption Algorithms: Implement widely accepted and secure encryption algorithms,
such as AES (Advanced Encryption Standard), RSA (Rivest-Shamir-Adleman), or Elliptic Curve
Cryptography (ECC). Stay updated with current cryptographic standards and avoid deprecated or
weak algorithms.
Ensure Sufficient Key Length: Select encryption keys with an appropriate length to ensure strong
cryptographic strength. Follow industry recommendations for key lengths, considering the specific
encryption algorithm being used.
Follow Secure Key Management Practices: Employ secure key management techniques, such as
using key vaults or hardware security modules (HSMs) to securely store encryption keys. Protect
keys from unauthorized access, including restricting access to authorized personnel, encrypting
keys at rest, and using secure key distribution mechanisms.
Implement Encryption Correctly: Carefully implement encryption and decryption processes in the
mobile application, adhering to established cryptographic libraries and frameworks. Avoid custom
encryption implementations, as they are more prone to errors and vulnerabilities
Use Strong Hash Functions: Choose widely recognized and cryptographically secure hash functions
like SHA-256 or bcrypt. These algorithms are designed to resist attacks and provide a high level of
security.
Implement Salting: Always use a strong random salt when hashing passwords. Salting adds an
extra layer of security by making it harder for attackers to use precomputed tables or rainbow tables
to crack passwords.