>
>
PVS-Studio 7.15: MISRA, CWE, OWASP, Unr…

Andrey Karpov
Articles: 671

PVS-Studio 7.15: MISRA, CWE, OWASP, Unreal Engine

We are actively developing the PVS-Studio static analysis tool towards detecting Safety and Security-related errors. To be more precise, we've expanded the coverage of the MISRA C:2012 and OWASP ASVS standards. We have supported the MISRA Compliance 2020 standard. One of the more extraordinary innovations is the Best Warnings display mode. This mode displays the most significant (meaningful) warnings and can be useful when you are just starting out with the analyzer.

Analyzer Best Warnings

We have introduced a new feature for the PVS-Studio plugin for Visual Studio. Now you can display the Best Warnings the analyzer issued for a project. In other words, these are the analyzer's most valuable warnings. They demonstrate the analyzer's capabilities for someone, who is just starting out with the analyzer.

We call this feature Analyzer Best Warnings. PVS-Studio has always been grouping analyzer warnings by 3 certainty levels. We've been traditionally using these levels to prioritize showing the analysis results — all best warnings should be first-level warnings. For the new version of our analyzer, we have developed a more accurate mechanism to evaluate warnings. Now the mechanism uses many extra criteria in addition to levels — both static (the average diagnostic "value") and dynamic. The dynamic criteria are based on warnings the analyzer issues for a specific code base (for example, detection frequency).

The Analyzer Best Warnings feature is not a substitute for working with the full report. The full report may contain other dangerous errors that need to be addressed.

In future releases, we plan to expand the capabilities of the new warning evaluation mode. We also plan to add the support of this mode to other IDE plugins and analysis integration modes. You can read more about the Analyzer Best Warnings feature in our blog and documentation.

Unreal Engine

We have improved the quality of Unreal Engine project analysis. We have additionally annotated hundreds of standard functions from Unreal Engine in the C++ PVS-Studio analyzer.

MISRA Compliance

In the report conversion utilities, we have supported the compliance report generation based on the MISRA Compliance 2020 standard. You can read more about this format and the generation of the MISRA compliance report in our blog: Why do you need the MISRA Compliance report and how to generate one in PVS-Studio?

Diagnostics

Since this release is dedicated to Safety and Security, the new diagnostics are made to expand the support of the MISRA C, AUTOSAR, and OWASP standards.

We have covered 70% of the MISRA C standard. By the end of this year, we plan to increase the coverage to 80%.

The OWASP Top 10 2017 support now covers 9 out of 10 categories. Thus, the only category left unsupported by PVS-Studio is the A9:2017 category: Using Components with Known Vulnerabilities. This category belongs to the SCA (Software Composition Analysis) tool class. In the future releases, we plan to implement SCA in the C# PVS-Studio analyzer to completely cover OWASP Top 10.

On our website, you can find PVS-Studio diagnostics classified according to the list of the most dangerous and common potential vulnerabilities (CWE Top 25).

New diagnostics (C, C++)

  • V2604. MISRA. Features from <stdarg.h> should not be used.
  • V2605. MISRA. Features from <tgmath.h> should not be used.
  • V2606. MISRA. There should be no attempt to write to a stream that has been opened for reading.
  • V2607. MISRA. Inline functions should be declared with the static storage class.
  • V2608. MISRA. The 'static' storage class specifier should be used in all declarations of object and functions that have internal linkage.
  • V2609. MISRA. There should be no occurrence of undefined or critical unspecified behaviour.
  • V2610. MISRA. The ', " or \ characters and the /* or // character sequences should not occur in a header file name.
  • V2611. MISRA. Casts between a pointer to an incomplete type and any other type shouldn't be performed.
  • V2612. MISRA. Array element should not be initialized more than once.
  • V2613. MISRA. Operand that is a composite expression has more narrow essential type than the other operand.
  • V2614. MISRA. External identifiers should be distinct.
  • V3555. AUTOSAR. The 'static' storage class specifier should be used in all declarations of functions that have internal linkage.

New diagnostics (C#)

  • V3173. Possible incorrect initialization of variable. Consider verifying the initializer.
  • V5612. OWASP. Do not use old versions of SSL/TLS protocols as it may cause security issues.
  • V5613. OWASP. Use of outdated cryptographic algorithm is not recommended.
  • V5614. OWASP. Potential XXE vulnerability. Insecure XML parser is used to process potentially tainted data.
  • V5615. OWASP. Potential XEE vulnerability. Insecure XML parser is used to process potentially tainted data.

Other enhancements

In the analyzer for C++, for large numbers, we have standardized the format for variable value range output. We have changed the text of some messages, so they may reappear in the report even though they were suppressed by the baselining mechanism. If you encounter this, please suppress these warnings again.

In the plugin for Visual Studio, you now can set shortcuts to suppress false positives and mark up warnings.

We've also optimized the C# analyzer's performance. We reduced the project preparation time before the analysis for large projects. This significantly sped up analysis. You can read more about it in our blog.

Some fresh articles in our blog