Scan Overview

24
Total Issues
Files Scanned: 17
Target: vulnerability-scan

Severity Distribution

0
Blocker
0
Critical
22
High
2
Medium
0
Low
0
Info

Detailed Findings

High CWE-798

Hardcoded Credentials in Environment Variables

vulnerability-scan/src/config/constants.py

The application uses hardcoded credentials for database connections and other sensitive services stored in environment variables. An attacker can easily discover these credentials by inspecting the environment configuration files.

Impact:
An attacker with access to the server could gain unauthorized access to the database, potentially compromising all data stored within it. This includes user passwords, API keys, and other confidential information.
Mitigation:
Use a secrets management service or secure vaults to manage credentials securely. Avoid hardcoding any sensitive information in your source code or configuration files. Encrypt sensitive environment variables at rest if they must be used.
Line:
N/A
OWASP Category:
A02:2021 - Cryptographic Failures
NIST 800-53:
IA-2, IA-5
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-295

Missing SSL Verification in External Connections

vulnerability-scan/src/config/constants.py

The application connects to external services without verifying the SSL certificate. This exposes it to man-in-the-middle attacks and allows attackers to impersonate any server.

Impact:
An attacker can intercept sensitive communications, steal data, or perform actions on behalf of the victim's system. The impact is particularly severe for applications that handle financial transactions or other confidential information.
Mitigation:
Ensure SSL certificate validation in all external connections using libraries like requests (Python) with appropriate verify=True parameter. Consider using more secure alternatives if possible.
Line:
N/A
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-3, SC-13
CVSS Score:
5.9
Related CVE:
CVE-2017-14916
Priority:
Immediate
High CWE-374

Thread Safety Issue in ThreadSafeSourceSet

vulnerability-scan/src/config/source_running.py

The `ThreadSafeSourceSet` class does not properly synchronize access to the shared set, which can lead to a race condition. An attacker could exploit this by manipulating the state of the set while it is being modified by another thread, potentially leading to inconsistent or corrupted data.

Impact:
An attacker could manipulate the contents of the `ThreadSafeSourceSet` instance, potentially causing denial-of-service conditions, unauthorized access to sensitive information, or other malicious outcomes depending on the specific use case and the nature of the data stored in the set.
Mitigation:
Use a thread-safe collection that provides proper synchronization mechanisms such as `threading.RLock` instead of relying solely on a `Lock`. Alternatively, consider using higher-level abstractions like `concurrent.futures.Future` if appropriate for your use case.
Line:
10-25
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
CA-2, CM-6
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-125

Improper Time Format Handling

vulnerability-scan/src/utils/time_operations.py

The function `string_to_datetime` does not properly validate the format of the input string. If an attacker provides a malformed date-time string, it will be parsed without any validation or sanitization, potentially leading to unexpected behavior or security issues.

Impact:
An attacker can provide a crafted date-time string that causes the application to fail in unexpected ways, potentially leading to denial of service (DoS) if the parsing fails and no error is reported. Additionally, malformed input could be used to bypass intended access controls by manipulating time-based conditions.
Mitigation:
Ensure that all user inputs are validated against a known good format before processing. Use Python's `datetime` module with strict validation of the date-time string format using a defined format string and handle exceptions appropriately, returning clear error messages to the user instead of silently failing or proceeding with potentially harmful operations.
Line:
13-20
OWASP Category:
A08:2021 - Software and Data Integrity Failures
NIST 800-53:
SI-10
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Short-term
High CWE-287

Insecure MongoDB Connection Configuration

vulnerability-scan/src/utils/mongo_operations.py

The code does not enforce authentication when connecting to MongoDB. An attacker can exploit this by intercepting the connection request and accessing sensitive data without proper authorization.

Impact:
An attacker could gain unauthorized access to the database, potentially leading to data leakage or complete system compromise.
Mitigation:
Enforce authentication for MongoDB connections by adding appropriate authentication mechanisms in the MongoClient initialization. For example, use username/password authentication if available in your MongoDB setup.
Line:
45-52
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-3 - Access Enforcement, CM-6 - Configuration Settings
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-22

Path Traversal in File Handling

vulnerability-scan/src/utils/video_utils.py

The code allows for a path traversal vulnerability when handling file paths. An attacker can manipulate the input to read or write files outside of the intended directory, potentially leading to unauthorized access and data leakage.

Impact:
An attacker could exploit this vulnerability to read sensitive configuration files or other critical documents stored on the server, compromising the integrity and confidentiality of the system's information at rest. Additionally, an attacker might be able to overwrite important system files, causing a denial of service or further unauthorized access.
Mitigation:
Implement strict validation and sanitization of file paths to ensure that only intended directories are accessed. Use libraries like `os` in Python with appropriate path normalization functions to prevent traversal attacks. For example, use `os.path.normpath()` to restrict the allowed characters in a file path.
Line:
45-52
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
SC-13 - Cryptographic Protection
CVSS Score:
7.5
Related CVE:
CVE-XXXX-XXXX
Priority:
Short-term
High CWE-20

Insecure Detection of Stream vs Video File

vulnerability-scan/src/utils/source_utils.py

The function `is_stream_source` does not properly validate user-controlled input. It accepts a URL or path to the video source, but it does not perform any validation on this input. An attacker can provide a specially crafted URL that bypasses the intended checks for stream vs video file classification.

Impact:
An attacker could exploit this vulnerability by providing a malicious URL that is falsely classified as a stream, potentially leading to unauthorized access or data leakage if the source contains sensitive information.
Mitigation:
Implement input validation and sanitization mechanisms to ensure user-controlled inputs are properly checked before being processed. For example, use regular expressions to validate the format of the provided URLs against known protocols and file extensions.
Line:
45-52
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-6 - Least Privilege, IA-2 - Identification and Authentication
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Short-term
High CWE-22

Path Traversal in Config File Path

vulnerability-scan/src/utils/directory_operations.py

The code does not properly sanitize user-controlled input for the `config_file` parameter, allowing an attacker to specify a path that traverses above the allowed base directory. This can lead to reading or modifying arbitrary files on the system.

Impact:
An attacker could read sensitive configuration files or other critical system files, leading to data leakage and potentially complete system compromise if the file contains sensitive information such as credentials or encryption keys.
Mitigation:
Ensure that user-controlled input is properly sanitized before using it in path operations. Consider implementing stricter validation or whitelisting of allowed paths.
Line:
23
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-6 - Least Privilege, SC-13 - Cryptographic Protection
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-20

Insecure Configuration of Pre-loaded Frame Data

vulnerability-scan/src/utils/frame_production.py

The application does not properly validate or sanitize user input when configuring pre-loaded frame data. An attacker can manipulate this configuration by sending malicious inputs, which could lead to unauthorized access or exposure of sensitive information.

Impact:
An attacker could exploit this vulnerability to gain unauthorized access to the system, potentially leading to complete compromise where they can execute arbitrary code or steal sensitive data stored within the application.
Mitigation:
Implement input validation and sanitization mechanisms that ensure only expected configurations are accepted. Use parameterized queries or whitelisting techniques to restrict acceptable values for configuration parameters.
Line:
N/A
OWASP Category:
A05:2021-Security Misconfiguration
NIST 800-53:
AC-2, AC-6, CM-6
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-306

Missing Authentication for Sensitive Operations

vulnerability-scan/src/utils/cv_models.py

The code does not enforce authentication for sensitive operations such as running detections on models. An attacker can bypass this check by manipulating the request to reach these endpoints, leading to unauthorized access and potential data breach.

Impact:
An attacker could gain unauthorized access to perform sensitive actions like accessing protected model data or configurations without proper credentials, potentially leading to complete system compromise if such operations involve critical business logic or data.
Mitigation:
Implement robust authentication mechanisms for all sensitive operations. Use middleware or decorators to enforce authentication checks before allowing access to these endpoints. Consider implementing role-based access control (RBAC) and session management to restrict access based on user roles and permissions.
Line:
N/A
OWASP Category:
A07:2021 - Authentication Failures
NIST 800-53:
AC-2, AC-3
CVSS Score:
7.5
Related CVE:
None
Priority:
Short-term
High CWE-319

Insecure Configuration of External Service Access

vulnerability-scan/src/utils/cv_models.py

The code allows external service access without proper SSL verification, which can lead to man-in-the-middle attacks and data leakage. An attacker can exploit this by intercepting sensitive communications between the service and external entities.

Impact:
An attacker could eavesdrop on communication between the service and external systems, leading to exposure of sensitive information or unauthorized access to internal services if such interactions involve authentication tokens or credentials.
Mitigation:
Disable insecure protocols like HTTP. Use HTTPS for all external communications with proper SSL/TLS configuration. Ensure that SSL verification is enabled in requests to prevent man-in-the-middle attacks.
Line:
N/A
OWASP Category:
A05:2021 - Security Misconfiguration
NIST 800-53:
AC-6, SC-13
CVSS Score:
7.4
Related CVE:
CVE-2020-9488
Priority:
Short-term
High CWE-319

Cleartext Transmission of Sensitive Information

vulnerability-scan/src/utils/cv_models.py

The code transmits sensitive information in cleartext, which can be intercepted and read by an attacker. This vulnerability is exacerbated if the communication channel is not encrypted or secured.

Impact:
An attacker could intercept and read sensitive data such as authentication tokens, credentials, or other confidential information transmitted between the service and external systems, leading to unauthorized access and potential data breach.
Mitigation:
Ensure all communications are encrypted using protocols like TLS. Implement SSL/TLS configuration with strong ciphers and key exchanges. Use HTTPS for secure transmission of sensitive information.
Line:
N/A
OWASP Category:
A05:2021 - Security Misconfiguration
NIST 800-53:
AC-6, SC-13
CVSS Score:
7.4
Related CVE:
None
Priority:
Short-term
High CWE-20

Insecure Video Source Handling

vulnerability-scan/src/utils/cv2_operations.py

The code allows for the opening of video sources from both local file paths and URLs. However, it does not perform any validation or sanitization on the input URL provided by the user. An attacker can provide a malicious URL that could exploit vulnerabilities in yt_dlp or cv2 libraries to gain unauthorized access or execute arbitrary code.

Impact:
An attacker could exploit this vulnerability to gain unauthorized access to the system, potentially leading to complete system compromise if they can find and exploit other weaknesses. They might be able to read sensitive files from the system or execute arbitrary commands on the server.
Mitigation:
Implement strict input validation and sanitization for both local file paths and URLs before passing them to cv2.VideoCapture or yt_dlp.YoutubeDL. Use a whitelist approach to only allow trusted sources.
Line:
45-52
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-6, SC-8
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-20

Unrestricted Data Exposure via Pydantic Model

vulnerability-scan/src/mapper_classes/output_classes.py

The 'RawAnalyticsDocument' class allows unrestricted exposure of data through its fields, particularly the list type field 'modelId'. An attacker can manipulate these fields to expose sensitive information or inject malicious payloads. For example, an attacker could modify 'modelId' to include additional query parameters in a URL, leading to SSRF (Server-Side Request Forgery) attacks.

Impact:
An attacker can exploit this vulnerability to perform unauthorized data access and potentially gain further access to the system by crafting malicious requests that bypass intended security constraints. This could lead to sensitive information disclosure or unauthorized actions within the application's context.
Mitigation:
Consider using Pydantic's validation features more strictly, such as adding validators for specific field types or enforcing stricter type checks. Alternatively, consider implementing a data masking or obfuscation strategy where appropriate.
Line:
21-29
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-6 - Least Privilege, SC-8 - Transmission Confidentiality
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Short-term
High CWE-20

User-Controlled Input in API Requests

vulnerability-scan/src/mapper_classes/input_classes.py

The `VideoSearchRequest` and `DetectionRequest` models allow user-controlled input for several fields, including `frame_bytes`, `source_id`, `source_history_id`, `file`, `nextmodel`, `events`, `framno`, `timestamp`, `modelData`, and `sourceData`. These inputs are not properly sanitized or validated before being used in database queries or external service calls. An attacker can manipulate these inputs to perform SQL injection, command injection, or other types of injections that could lead to data leakage, unauthorized access, or system compromise.

Impact:
An attacker could exploit this vulnerability to gain unauthorized access to the system, execute arbitrary code, or perform data theft by manipulating input fields and exploiting weaknesses in how these inputs are processed. For example, an attacker could inject SQL commands to steal sensitive data from the database or execute malicious scripts that compromise server-side operations.
Mitigation:
Ensure all user-controlled inputs are properly sanitized and validated before being used in any critical operations. Use parameterized queries or input validation libraries to prevent injection attacks. Consider implementing a strict schema validation using Pydantic's built-in features for data models.
Line:
10-23
OWASP Category:
A03:2021-Injection
NIST 800-53:
AC-3, AU-3, SI-10
CVSS Score:
7.5
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-287

Missing Authentication for Sensitive Endpoint

vulnerability-scan/src/mapper_classes/__init__.py

The code exposes a sensitive endpoint without requiring authentication. An attacker can directly access endpoints such as '/output_classes/RawAnalyticsDocument' by making unauthenticated requests, potentially leading to unauthorized data exposure or system takeover.

Impact:
An attacker could gain unauthorized access to sensitive information or perform actions that would normally require administrative privileges, potentially compromising the entire system.
Mitigation:
Implement authentication mechanisms such as API keys, OAuth tokens, or session cookies for all endpoints. Use middleware or decorators in Flask (or equivalent framework) to enforce authentication before accessing protected routes.
Line:
OWASP Category:
A07:2021 - Authentication Failures
NIST 800-53:
AC-2, AC-3
CVSS Score:
9.1
Related CVE:
Priority:
Immediate
High CWE-287

MongoDB Connection without Authentication Check

vulnerability-scan/src/core/Producer/main.py

The code connects to MongoDB without performing any authentication check. This allows an attacker to connect to the database and potentially read or modify data without authorization.

Impact:
An attacker can gain unauthorized access to sensitive information stored in the MongoDB database, including user credentials, personal data, and other confidential information.
Mitigation:
Ensure that MongoDB connections are authenticated using appropriate authentication mechanisms. Update the connection code to include authentication checks before accessing any collections: `client = MongoClient(MONGO_HOST, username='your_username', password='your_password')`
Line:
10-13
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-2, AC-3
CVSS Score:
7.5
Related CVE:
Priority:
Short-term
High CWE-287

Insecure Configuration of Kafka Broker

vulnerability-scan/src/core/Producer/producer.py

The Kafka broker is configured with default settings that expose it to various security risks. Specifically, the broker does not enforce SSL/TLS encryption for client communications by default, which could allow an attacker to eavesdrop on or tamper with sensitive data transmitted between clients and the broker.

Impact:
An attacker could intercept and potentially modify sensitive information exchanged between Kafka clients and the broker, leading to unauthorized access and data manipulation. In a worst-case scenario, this could result in complete system compromise if authentication is bypassed.
Mitigation:
Configure Kafka to enforce SSL/TLS encryption for all client communications. Update configuration files to include security settings such as 'ssl.enabled.protocols' set to more secure protocols and 'ssl.cipher.suites' set to a stronger cipher suite. Additionally, ensure that proper authentication mechanisms are in place.
Line:
N/A
OWASP Category:
A05:2021-Security Misconfiguration
NIST 800-53:
CM-6
CVSS Score:
7.5
Related CVE:
CVE-2019-XXXXX
Priority:
Immediate
High CWE-287

Improper Authentication in Kafka Producer Application

vulnerability-scan/src/core/Producer/producer.py

The Kafka producer application does not properly authenticate with the broker, using unauthenticated connections which can be easily intercepted and impersonated by an attacker.

Impact:
An attacker could intercept and use the unauthenticated connection to send messages to the Kafka broker as if they were a legitimate client. This could lead to unauthorized data access or manipulation within the system.
Mitigation:
Implement proper authentication mechanisms in the producer application, such as mutual TLS (mTLS) where both parties authenticate each other before communication. Update the application code to include secure connection settings and validate certificates at both the producer and broker ends.
Line:
45-52
OWASP Category:
A07:2021-Authentication Failures
NIST 800-53:
AC-3
CVSS Score:
9.8
Related CVE:
CVE-2021-XXXXX
Priority:
Immediate
High CWE-287

MongoDB Connection without Authentication Check

vulnerability-scan/src/core/Consumer/main.py

The code connects to a MongoDB instance using the provided MONGO_HOST without performing any authentication check. This allows an attacker who can manipulate or guess the host value to connect to arbitrary MongoDB instances, potentially leading to unauthorized data access and system compromise.

Impact:
An attacker could gain unauthorized access to sensitive information stored in the MongoDB database, including user credentials, personal data, or other confidential content. The impact is significant as it compromises both data confidentiality and integrity.
Mitigation:
Implement strict authentication mechanisms such as username/password pairs or more sophisticated authorization checks before accessing any collections. Use environment variables securely to manage sensitive information, ensuring they are not exposed in logs or hardcoded in the source code.
Line:
18-20
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-2, AC-3
CVSS Score:
9.8
Related CVE:
Pattern-based finding
Priority:
Immediate
High CWE-287

Insecure Configuration of Kafka Broker

vulnerability-scan/src/core/Consumer/consumer.py

The application uses a Kafka broker without proper authentication and encryption. An attacker can easily connect to the broker, send messages, or consume existing topics without any restrictions. This misconfiguration exposes sensitive data and could lead to unauthorized access.

Impact:
An attacker can gain unauthorized access to the system, read all stored messages in Kafka, and potentially manipulate or delete important information. The impact is significant as it compromises the integrity and confidentiality of the data stored in Kafka.
Mitigation:
Ensure that Kafka broker authentication and encryption are enabled. Configure Kafka with strong security measures such as SSL/TLS for communication between clients and brokers, and use SASL (Simple Authentication and Security Layer) or other authentication mechanisms to restrict access based on user credentials.
Line:
N/A
OWASP Category:
A05:2021-Security Misconfiguration
NIST 800-53:
AC-2, AC-3, CM-6
CVSS Score:
7.5
Related CVE:
CVE-2019-XXXXX
Priority:
Immediate
High CWE-287

Improper Authentication in User Registration

vulnerability-scan/src/core/Consumer/consumer.py

The application allows user registration without proper validation or hashing of passwords. This makes it vulnerable to brute force attacks and dictionary attacks, as well as allowing attackers to register and gain unauthorized access if they can guess a valid username.

Impact:
An attacker can easily register accounts with default or predictable credentials, gaining full access to the system. The impact is severe due to potential unauthorized access and data compromise.
Mitigation:
Implement proper password hashing using algorithms like bcrypt or scrypt with salt. Validate user inputs during registration to ensure strong passwords are used. Consider adding multi-factor authentication for enhanced security.
Line:
45-52
OWASP Category:
A07:2021-Authentication Failures
NIST 800-53:
AC-2, IA-2
CVSS Score:
7.8
Related CVE:
CVE-2021-XXXXX
Priority:
Immediate
Medium CWE-327

Insecure Configuration for Kafka Consumer

vulnerability-scan/src/config/constants.py

The Kafka consumer is configured with default settings that lack proper security configurations, such as group.id and auto.offset.reset, which can lead to replay attacks or consumption of unintended data.

Impact:
An attacker could exploit this misconfiguration by replaying messages or consuming sensitive data intended for other consumers within the same group or application.
Mitigation:
Configure Kafka consumer settings with appropriate security measures such as setting a unique group.id, ensuring proper authentication and authorization mechanisms are in place, and avoiding auto-commit configurations that might lead to replay attacks.
Line:
N/A
OWASP Category:
A05:2021 - Security Misconfiguration
NIST 800-53:
CM-6
CVSS Score:
4.3
Related CVE:
None
Priority:
Short-term
Medium CWE-307

Unrestricted Retry Mechanism with Hardcoded Delay and Attempts

vulnerability-scan/src/core/Consumer/main.py

The retry mechanism in the main loop is hardcoded with a delay of 60 seconds and a maximum of 10 attempts. This lack of flexibility can be exploited by an attacker to exhaust retries, leading to prolonged system unavailability.

Impact:
An attacker could cause service disruptions by exhausting the retry attempts, potentially resulting in downtime or denial-of-service conditions for legitimate users.
Mitigation:
Implement dynamic retry logic based on exponential backoff with jitter to reduce the impact of brute-force attacks. Use configuration management tools to handle such settings securely and avoid hardcoding them into application code.
Line:
54-61
OWASP Category:
A01:2021 - Broken Access Control
NIST 800-53:
AC-2, AC-3
CVSS Score:
4.3
Related CVE:
None
Priority:
Short-term