diff --git a/README.md b/README.md index bedbab2..3e72b34 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Once the libraries are installed, refer to the tool usage commands to run the to $ python3 dakshscra.py -h // To view available options and arguments - usage: dakshscra.py [-h] [-r RULE_FILE] [-f FILE_TYPES] [-v] [-t TARGET_DIR] [-l {R,RF}] [-recon] [-estimate] + usage: usage: dakshscra.py [-h] [-r RULE_FILE] [-f FILE_TYPES] [-v] [-t TARGET_DIR] [-l {R,RF}] [-recon] [-estimate] options: -h, --help Show this help message and exit diff --git a/rules/scanning/platform/java/java.xml b/rules/scanning/platform/java/java.xml index 11d238e..e303471 100644 --- a/rules/scanning/platform/java/java.xml +++ b/rules/scanning/platform/java/java.xml @@ -58,6 +58,81 @@ + + + + Deprecated MODE_WORLD_WRITEABLE Usage + + Detects usage of the deprecated MODE_WORLD_WRITEABLE mode. + The MODE_WORLD_WRITEABLE mode allows any application to write to your app's files, leading to potential data corruption or unauthorized modifications. + Avoid using MODE_WORLD_WRITEABLE. Consider using content providers or other mechanisms to share data securely. + Check Java/Kotlin source files for occurrences of MODE_WORLD_WRITEABLE and ensure that secure alternatives are used. + + + + Deprecated MODE_WORLD_READABLE Usage + + Detects usage of the deprecated MODE_WORLD_READABLE mode. + The MODE_WORLD_READABLE mode allows any application to read your app's files, potentially exposing sensitive data to unauthorized access. + Avoid using MODE_WORLD_READABLE. Use content providers or define explicit permissions to control data access. + Check Java/Kotlin source files for occurrences of MODE_WORLD_READABLE and ensure secure data sharing mechanisms are in place. + + + + Insecure File Operations + + Detects insecure file operations using deprecated world-readable or world-writable modes. + Using world-readable or world-writable modes in file operations can lead to unauthorized access or modifications to the app's files. + Replace the use of MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE with private modes or secure sharing mechanisms such as content providers. + Review Java/Kotlin source files for file operations that use insecure modes, ensuring that secure alternatives are implemented. + + + + File Sharing Without Content Provider + + Detects file sharing operations that use URIs without a content provider. + Sharing files directly using URIs without a content provider can expose sensitive data to unauthorized applications. Content providers offer a controlled mechanism for sharing files securely. + Use a content provider to securely share files between applications, ensuring proper access control and data protection. + Check Java/Kotlin source files for file sharing operations using `Intent` with `Uri.parse`. Verify that files are shared through content providers with appropriate permissions. + + + + + + + Insecure External Storage Write + + Detects writing to external storage without proper validation or encryption. + Writing sensitive information to external storage can lead to unauthorized access or modification, as external storage is globally writable and can be accessed by any application or user. + Store only non-sensitive information on external storage. For sensitive data, use internal storage or encrypt the data before writing it to external storage. + Verify that external storage is used only for non-sensitive data. Ensure that sensitive information is encrypted or stored securely. + + + Dynamic Loading from External Storage + + Detects dynamic loading of files from external storage. + Loading executables or class files from external storage without cryptographic verification can lead to code execution vulnerabilities if the files are tampered with. + Avoid loading executables or class files from external storage. If necessary, ensure files are cryptographically signed and verified before loading. + Check for usage of `DexClassLoader` or `PathClassLoader` with files retrieved from external storage. Verify that proper cryptographic verification mechanisms are in place. + + + Insecure External Storage Read + + Detects reading data from external storage without proper input validation. + Reading unvalidated data from external storage can lead to vulnerabilities such as malicious file execution or unexpected application behavior. + Validate and sanitize all data read from external storage as it may come from untrusted sources. + Ensure that data read from external storage is properly validated and sanitized before use. + + + Executable File Storage on External Storage + + Detects storage of executable files on external storage. + Storing executable files on external storage can lead to unauthorized code execution if the files are tampered with by other applications or users. + Avoid storing executable files on external storage. If necessary, ensure files are cryptographically signed and verified before usage. + Review external storage usage to ensure that executable files are not stored insecurely. Verify that any necessary executables are cryptographically signed and verified. + + + File Upload Functionality diff --git a/rules/scanning/platform/kotlin/kotlin.xml b/rules/scanning/platform/kotlin/kotlin.xml index 453d8e9..180c96d 100644 --- a/rules/scanning/platform/kotlin/kotlin.xml +++ b/rules/scanning/platform/kotlin/kotlin.xml @@ -33,6 +33,7 @@ Reviewers should verify the presence of secure coding practices, such as parameterized queries or proper input validation and sanitization, to mitigate the risk of SQL injection vulnerabilities in Room database queries. They should also assess the sensitivity of the data retrieved from Room queries and confirm that relevant security measures are implemented correctly. + Insecure Method Call: Runtime.exec() @@ -83,6 +84,82 @@ Reviewers should verify if any custom methods for setting HTML content, such as setHtmlText, properly sanitize or validate the input HTML content to prevent XSS vulnerabilities. They should ensure that developers have implemented appropriate security measures to handle HTML content securely and mitigate potential security risks. + + + + + Deprecated MODE_WORLD_WRITEABLE Usage + + Detects usage of the deprecated MODE_WORLD_WRITEABLE mode. + The MODE_WORLD_WRITEABLE mode allows any application to write to your app's files, leading to potential data corruption or unauthorized modifications. + Avoid using MODE_WORLD_WRITEABLE. Consider using content providers or other mechanisms to share data securely. + Check Java/Kotlin source files for occurrences of MODE_WORLD_WRITEABLE and ensure that secure alternatives are used. + + + + Deprecated MODE_WORLD_READABLE Usage + + Detects usage of the deprecated MODE_WORLD_READABLE mode. + The MODE_WORLD_READABLE mode allows any application to read your app's files, potentially exposing sensitive data to unauthorized access. + Avoid using MODE_WORLD_READABLE. Use content providers or define explicit permissions to control data access. + Check Java/Kotlin source files for occurrences of MODE_WORLD_READABLE and ensure secure data sharing mechanisms are in place. + + + + Insecure File Operations + + Detects insecure file operations using deprecated world-readable or world-writable modes. + Using world-readable or world-writable modes in file operations can lead to unauthorized access or modifications to the app's files. + Replace the use of MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE with private modes or secure sharing mechanisms such as content providers. + Review Java/Kotlin source files for file operations that use insecure modes, ensuring that secure alternatives are implemented. + + + + File Sharing Without Content Provider + + Detects file sharing operations that use URIs without a content provider. + Sharing files directly using URIs without a content provider can expose sensitive data to unauthorized applications. Content providers offer a controlled mechanism for sharing files securely. + Use a content provider to securely share files between applications, ensuring proper access control and data protection. + Check Java/Kotlin source files for file sharing operations using `Intent` with `Uri.parse`. Verify that files are shared through content providers with appropriate permissions. + + + + + + + Insecure External Storage Write + + Detects writing to external storage without proper validation or encryption. + Writing sensitive information to external storage can lead to unauthorized access or modification, as external storage is globally writable and can be accessed by any application or user. + Store only non-sensitive information on external storage. For sensitive data, use internal storage or encrypt the data before writing it to external storage. + Verify that external storage is used only for non-sensitive data. Ensure that sensitive information is encrypted or stored securely. + + + Dynamic Loading from External Storage + + Detects dynamic loading of files from external storage. + Loading executables or class files from external storage without cryptographic verification can lead to code execution vulnerabilities if the files are tampered with. + Avoid loading executables or class files from external storage. If necessary, ensure files are cryptographically signed and verified before loading. + Check for usage of `DexClassLoader` or `PathClassLoader` with files retrieved from external storage. Verify that proper cryptographic verification mechanisms are in place. + + + Insecure External Storage Read + + Detects reading data from external storage without proper input validation. + Reading unvalidated data from external storage can lead to vulnerabilities such as malicious file execution or unexpected application behavior. + Validate and sanitize all data read from external storage as it may come from untrusted sources. + Ensure that data read from external storage is properly validated and sanitized before use. + + + Executable File Storage on External Storage + + Detects storage of executable files on external storage. + Storing executable files on external storage can lead to unauthorized code execution if the files are tampered with by other applications or users. + Avoid storing executable files on external storage. If necessary, ensure files are cryptographically signed and verified before usage. + Review external storage usage to ensure that executable files are not stored insecurely. Verify that any necessary executables are cryptographically signed and verified. + + + Insecure Mitigation: WebView.addJavascriptInterface() @@ -93,6 +170,7 @@ Reviewers should verify that WebView.addJavascriptInterface() is used securely and that any input passed as the interface object is properly validated, sanitized, and limited to trusted values to prevent JavaScript injection vulnerabilities. They should also ensure that developers follow best practices for securely communicating between JavaScript and native code. + Mitigation Identified: SQL Injection (Room Database)