CWE-319¶
Cleartext Transmission of Sensitive Information. [Information-Management-Errors, Protection-Mechanism-Failure]
Required inputs: IR
| The product transmits sensitive or security-critical data in cleartext in a communication channel that can be sniffed by unauthorized actors. |
Demonstrative Examples
Example 1
The following code attempts to establish a connection to a site to communicate sensitive information.
Example Language:Java (Unsupported language for documentation only)
try {
URL u = new URL("http://www.secret.example.org/");
HttpURLConnection hu = (HttpURLConnection) u.openConnection();
hu.setRequestMethod("PUT");
hu.connect();
OutputStream os = hu.getOutputStream();
hu.disconnect();
}
catch (IOException e) {
//...
}
Though a connection is successfully made, the connection is unencrypted and it is possible that all sensitive data sent to or received from the server will be read by unintended actors.
Example 2
In 2022, the OT:ICEFALL study examined products by 10 different Operational Technology (OT) vendors. The researchers reported 56 vulnerabilities and said that the products were "insecure by design" [REF-1283]. If exploited, these vulnerabilities often allowed adversaries to change how the products operated, ranging from denial of service to changing the code that the products executed. Since these products were often used in industries such as power, electrical, water, and others, there could even be safety implications.
Multiple vendors used cleartext transmission of sensitive information in their OT products.
Example 3
A TAP accessible register is read/written by a JTAG based tool, for internal use by authorized users. However, an adversary can connect a probing device and collect the values from the unencrypted channel connecting the JTAG interface to the authorized user, if no additional protections are employed.
Example 4
The following Azure CLI command lists the properties of a particular storage account:
(informative)
Example Language:Shell
az storage account show -g {ResourceGroupName} -n {StorageAccountName}
The JSON result might be:
Example Language:JSON (Unsupported language for documentation only)
{
"name": "{StorageAccountName}",
"enableHttpsTrafficOnly": false,
"type": "Microsoft.Storage/storageAccounts"
}
The enableHttpsTrafficOnly value is set to false, because the default setting for Secure transfer is set to Disabled. This allows cloud storage resources to successfully connect and transfer data without the use of encryption (e.g., HTTP, SMB 2.1, SMB 3.0, etc.).
Azure's storage accounts can be configured to only accept requests from secure connections made over HTTPS. The secure transfer setting can be enabled using Azure's Portal (GUI) or programmatically by setting the enableHttpsTrafficOnly property to True on the storage account, such as:
Example Language:Shell (Unsupported language for documentation only)
az storage account update -g {ResourceGroupName} -n {StorageAccountName} --https-only true
The change can be confirmed from the result by verifying that the enableHttpsTrafficOnly value is true:
Example Language:JSON (Unsupported language for documentation only)
{
"name": "{StorageAccountName}",
"enableHttpsTrafficOnly": true,
"type": "Microsoft.Storage/storageAccounts"
}
Note: to enable secure transfer using Azure's Portal instead of the command line:
- Open the Create storage account pane in the Azure portal.
- In the Advanced page, select the Enable secure transfer checkbox.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
unprotected_payload |
Data is transmitted without prior encryption or authentication. |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
critical_routines_pattern¶
critical_routines_pattern : typing.Pattern[str] = 'authenticate'
key_detection_pattern¶
key_detection_pattern : typing.Pattern[str] = 'BEGIN (.*) PRIVATE KEY'
payload_parameters¶
payload_parameters
Sinks that are only reported when their payload is additionally named like sensitive data, i.e. matches suspect_detection_pattern. Maps a function name to the positions of its data-carrying parameters.Type: dict[bauhaus.analysis.config.FunctionName, set[int]]
Default:
{ 'send': {1}, 'sendmsg': {1}, 'sendto': {1} }
protection_functions¶
protection_functions
Functions that render a payload acceptable to transmit or store. Integrity mechanisms are accepted alongside encryption, because coding standards covering vehicle buses treat an authenticated message as adequately protected. Delete the MAC/signature entries to read this rule strictly as a confidentiality check.Type: list[bauhaus.analysis.config.QualifiedName]
Default:
['EVP_EncryptUpdate', 'EVP_EncryptFinal_ex', 'EVP_CipherUpdate', 'mbedtls_cipher_update', 'mbedtls_aes_crypt_cbc', 'wc_AesCbcEncrypt', 'Csm_Encrypt', 'CryIf_ProcessJob', 'Crypto_ProcessJob', 'HMAC', 'EVP_DigestSignFinal', 'mbedtls_md_hmac_finish', 'wc_CmacFinal', 'Csm_MacGenerate']
sensitive_payload_functions¶
sensitive_payload_functions : set[bauhaus.analysis.config.QualifiedName] = {'CanIf_Transmit', 'Com_SendSignal', 'PduR_ComTransmit', 'SoAd_IfTransmit'}
suspect_detection_pattern¶
suspect_detection_pattern : typing.Pattern[str] = 'password'