4.9.6. Common Weakness Enumeration (CWE) Compliance Checking Guide

4.9.6.1. Checking CWE Rule Compliance with Axivion Suite

Axivion Suite can be used to check the compliance of your code with Common Weakness Enumeration (CWE) rules. These checks are implemented as stylechecks.

The following table shows the available checks. For those that require static semantic analysis, you must also activate and configure the StaticSemanticAnalysis rule.

Supported CWE rules (Common Weakness Enumeration)

Configuration

CWE checks implemented as stylechecks can be selected and configured like other stylechecks; see Stylechecks.

Many CWE checks have individual configuration options in the GUI to fine-tune them to your needs.

Although we provide sensible default configurations, CWE checks should be adapted to your projects and specific threats. Additionally, some rules require configuration to be effective:

  • Rule CWE-89: Provide the CWE-89/sinks option to list the functions that receive SQL queries. By default, the relevant calls for the sqlite and MySQL C APIs are detected.

  • Rule CWE-335 and CWE-337: Provide either the routines_returning_predictable_values or whitelist option to configure the random number seeds allowed in your project.

  • Rule CWE-338: Provide the blacklist option to block additional weak random number generators.

  • Rule CWE-798: Set the suspect_detection_pattern option to a regular expression that matches objects in your project that might hold credentials.

  • Rule CWE-311, CWE-312 and CWE-319: Add the functions used by your project to transmit or store data to the sensitive_payload_functions option if all carried data is critical (e.g., a bus transmission). Alternatively, use the payload_parameters option, including the position of the data-carrying parameter, if a finding should also require the payload to be named as sensitive data. This name is matched against suspect_detection_pattern, as with CWE-798. Add functions that encrypt or authenticate a payload to the protection_functions option.

    By default, CWE-319 detects POSIX socket calls and AUTOSAR communication APIs; CWE-312 detects C standard library and POSIX file writes; and CWE-311 detects both. A payload is considered protected once it has passed any common OpenSSL, mbed TLS, wolfSSL, or AUTOSAR encryption or message-authentication entry points; remove the MAC entries from protection_functions to require encryption.

  • Rule CWE-321: Add your project’s key-setting functions and the position of their key parameters to the sinks option. By default, common OpenSSL, mbed TLS, wolfSSL, and AUTOSAR key-setting functions are detected. Note that this rule also requires StaticSemanticAnalysis to be active, as it follows the key through assignments and calls to reach the key parameter.

4.9.6.2. CWE Terms of Use

CWE™ is free to use by any organization or individual for any research, development,

and/or commercial purposes, per these CWE Terms of Use. Accordingly, The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. Any copy you make for such purposes is authorized on the condition that you reproduce MITRE’s copyright designation and this license in any such copy. CWE is a trademark of The MITRE Corporation. Please contact cwe@mitre.org if you require further clarification on this issue.

DISCLAIMERS

By accessing information through this site, you (as “the user”) hereby agree that the

site and the information are provided on an “as is” basis only without warranty of any kind, express or implied, including but not limited to implied warranties of merchantability, availability, accuracy, noninfringement, or fitness for a particular purpose. Use of this site and the information is at the user’s own risk. The user shall comply with all applicable laws, rules, and regulations, and the data source’s restrictions, when using the site.

By contributing information to this site, you (as “the contributor”) hereby represent and

warrant that the contributor has obtained all necessary permissions from copyright holders and other third parties to allow the contributor to contribute, and this site to host and display, the information and any such contribution, hosting, and displaying will not violate any law, rule, or regulation. Additionally, the contributor hereby grants all users of such information a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute such information and all derivative works.