{"id":403108,"date":"2024-06-29T16:55:19","date_gmt":"2024-06-29T16:55:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=403108"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=403108","title":{"rendered":"<span>CWE Top 25 2021. What is it, what is it for and how is it useful for static analysis?<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>For the first time PVS-Studio provided support for the CWE classification in the 6.21 release. It took place on January 15, 2018. Years have passed since then and we would like to tell you about the improvements related to the support of this classification in the latest analyzer version.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/6c7\/064\/280\/6c706428086332649d765b3f6cdc4675.png\" alt=\"https:\/\/import.viva64.com\/docx\/blog\/0869_CWE_status\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c7\/064\/280\/6c706428086332649d765b3f6cdc4675.png\"\/>  <\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<p>We position the PVS-Studio analyzer as a Static Application Security Testing (SAST) tool. This means our analyzer not only detects typos and errors in code, but also searches for <a href=\"https:\/\/pvs-studio.com\/en\/blog\/terms\/6441\/\">potential vulnerabilities<\/a> and correlates them with various standards (CWE, OWASP, SEI CERT, MISRA, AUTOSAR, etc.). Why potential vulnerabilities? Because potential vulnerabilities (CWE) may become real vulnerabilities (CVE) only if someone exploits them. And to make it happen many, sometimes unrelated, factors must often coincide.<\/p>\n<p>  <\/p>\n<p>That&#8217;s why we decided to check how well PVS-Studio covers the most common defects now. To do this, it&#8217;s enough to refer to the CWE Top 25 list. Somehow, we missed this list. Well, it&#8217;s time to make amends! <\/p>\n<p>  <\/p>\n<h2>CWE. What this is and what it is for<\/h2>\n<p>  <\/p>\n<p>Let&#8217;s refresh some moments and definitions in memory. If you&#8217;re already good at terminology and know the difference between CVE and CWE, why we need CVSS and how CWE Top 25 is ranked, you can skip this part. Otherwise, I strongly recommend that you refresh those terms before you read the article. Below is a rather free interpretation of some points of <a href=\"https:\/\/cwe.mitre.org\/about\/faq.html\">CWE FAQ<\/a> and <a href=\"https:\/\/cve.mitre.org\/about\/faqs.html\">CVE FAQ<\/a>:<\/p>\n<p>  <\/p>\n<p><strong>How does a software defect differ from a software vulnerability?<\/strong>  <\/p>\n<p>  <\/p>\n<p>Defects are errors, failures and other problems of implementation, design or architecture of the software that can lead to vulnerabilities.<\/p>\n<p>  <\/p>\n<p>Vulnerabilities are errors that have already been found by someone. Attackers may use these vulnerabilities to get access to a system or a network, to disrupt services, etc.<\/p>\n<p>  <\/p>\n<p><strong>What is CWE? How is it different from CVE and what does CVSS have to do with it?<\/strong>  <\/p>\n<p>  <\/p>\n<ul>\n<li>CWE (Common Weakness Enumeration) is a general list of security defects. <\/li>\n<li>CVE (Common Vulnerabilities and Exposures) is a list of vulnerabilities and defects found in various software. <\/li>\n<li>CVSS (Common Vulnerability Scoring System) is a numerical score that indicates the potential severity of a vulnerability (CVE). It is based on a standardized set of characteristics.<\/li>\n<\/ul>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/e1f\/521\/019\/e1f521019e900fa7918cb9f1be94f37e.png\" alt=\"https:\/\/import.viva64.com\/docx\/blog\/0869_CWE_status\/image2.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e1f\/521\/019\/e1f521019e900fa7918cb9f1be94f37e.png\"\/>  <\/p>\n<p>  <\/p>\n<p><strong>What is CWE Top 25?<\/strong>  <\/p>\n<p>  <\/p>\n<p>CWE Top 25 is a list of the most dangerous and common defects. These defects are dangerous because someone can easily find and exploit them. Attackers can use them to disrupt the application&#8217;s operation, steal data or even completely take over a system. CWE Top 25 is a significant community resource. It helps developers, testers, users, project managers, security researchers and teachers. They use this list to get an idea of the most common and dangerous security defects now.<\/p>\n<p>  <\/p>\n<p><strong>What is an algorithm to compile and rank the CWE Top 25 list?<\/strong>  <\/p>\n<p>  <\/p>\n<p>To create <a href=\"https:\/\/cwe.mitre.org\/top25\/archive\/2021\/2021_cwe_top25.html\">the current version<\/a> of CWE Top 25, the CWE Team used data from U.D National Vulnerability Database (NVD) for 2019\u20132020. Next, the team of researchers used their own formula to calculate the ranking order. This formula takes into account the frequency, with which a defect (CWE) is the main cause of a vulnerability, and the potential danger of exploitation. The team made the formula that way, so it normalizes the frequency and predicted severity relative to their minimum and maximum values.<\/p>\n<p>  <\/p>\n<p>To obtain the frequency of mentions, the formula calculates how many times CVE referred to CWE within the NVD. The formula uses only those CVEs, which have a reference to CWE. If the formula uses the full data set, it will lead to very low frequency rates and an insignificant difference amongst the different types of defects.<\/p>\n<p>  <\/p>\n<p><em>Freq = {count(CWE_X&#8217; \u2208 NVD) for each CWE_X&#8217; in NVD}<\/em>  <\/p>\n<p>  <\/p>\n<p><em>Fr(CWE_X) = (count(CWE_X \u2208 NVD) \u2014 min(Freq)) \/ (max(Freq) \u2014 min(Freq))<\/em>  <\/p>\n<p>  <\/p>\n<p>Another important component of the scoring formula is a defect&#8217;s severity. The following formula calculates it: <\/p>\n<p>  <\/p>\n<p><em>Sv(CWE_X) = (average_CVSS_for_CWE_X \u2014 min(CVSS)) \/ (max(CVSS) \u2014 min(CVSS))<\/em>  <\/p>\n<p>  <\/p>\n<p>At the end, the final score is calculated by multiplying the frequency of mention by the severity score.<\/p>\n<p>  <\/p>\n<p><em>Score(CWE_X) = Fr(CWE_X) * Sv(CWE_X) * 100<\/em>  <\/p>\n<p>  <\/p>\n<p>This approach introduces a bias by analyzing only detected vulnerabilities and can potentially exclude a significant part of data. Although, the CWE Team believes that this approach helps to compile a more accurate CWE Top 25 list every year.<\/p>\n<p>  <\/p>\n<p><strong>Is the Top 25 updated annually?<\/strong>  <\/p>\n<p>  <\/p>\n<p>Yes, it is. For information about previous versions, visit CWE Top 25 <a href=\"https:\/\/cwe.mitre.org\/top25\/archive\/\">archive<\/a>.<\/p>\n<p>  <\/p>\n<p><strong>Who participates in the development of CWE Top 25?<\/strong>  <\/p>\n<p>  <\/p>\n<p>The CWE community includes individual researchers and representatives of numerous organizations, the scientific community, and government agencies. They are all interested in elimination of software defects. You can get a list of CWE Team members on the &#171;<a href=\"https:\/\/cwe.mitre.org\/community\/index.html\">CWE Community Members<\/a>&#187; page.<\/p>\n<p>  <\/p>\n<p><strong>Why should I know that?<\/strong>  <\/p>\n<p>  <\/p>\n<p>Today, developers use CWE as the main tool when discussing the elimination and \/ or minimizing security defects in the architecture, design, code, and software implementation. Organizations use CWE as a standard measure for evaluating software security verification tools and as a common baseline standard for identifying, preventing, and minimizing negative consequences.<\/p>\n<p>  <\/p>\n<p><strong>Can you give us examples of errors?<\/strong>  <\/p>\n<p>  <\/p>\n<p>The CWE classification covers the most common problems with the development of software and various equipment. For example:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>software defects:<\/strong> buffer overflows; errors in format strings; structure and data validation problems; common special elements manipulation; channel and path errors; handler errors; UI errors; pathname traversal and equivalence errors; authentication errors; resource management errors; insufficient data verification; code evaluation and injection problems; randomness and predictability problems;<\/li>\n<li><strong>hardware defects: <\/strong>core and computation errors typically associated with CPUs, graphics, Vision, AI, FPGA, and uControllers; privilege separation and access control issues related to the identification and policy, shared resources, locking controls, and other features and mechanisms; power, clock, and reset concerns related to voltage, electrical current, temperature, clock frequency control and state saving\/restoring.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>Read more about classification on the <a href=\"https:\/\/cwe.mitre.org\/\">cwe.mitre.org<\/a> website.<\/p>\n<p>  <\/p>\n<h2>The situation today<\/h2>\n<p>  <\/p>\n<p>We have been using the CWE classification for PVS-Studio diagnostics for more than three years. Their number increases every year. In 2018, we covered only 94 points on the CWE list. Now it&#8217;s almost 130. However, this article isn&#8217;t about the total number of diagnostics. Let&#8217;s talk about those that are included in the list of the most dangerous diagnostics in 2021. If you want to read the full list, you can get it in the &#171;<a href=\"https:\/\/pvs-studio.com\/en\/pvs-studio\/sast\/cwe\/\">CWE compliance<\/a>&#187; section of our documentation.<\/p>\n<p>  <\/p>\n<p>Below is a table of correspondence between the CWE Top 25 2021 list and the PVS-Studio diagnostics, divided by programming languages. In the future, we are going to regularly update the table with the CWE Top 25 coverage on our website.<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><strong>#<\/strong>  <\/th>\n<th><strong>CWE ID<\/strong>  <\/th>\n<th><strong>Name<\/strong>  <\/th>\n<th><strong>Evaluation<\/strong>  <\/th>\n<th><strong>PVS-Studio diagnostics<\/strong>  <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/787.html\">CWE-787<\/a>  <\/td>\n<td>Out-of-bounds Write  <\/td>\n<td>65,93  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v512\/\">V512<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v557\/\">V557<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v582\/\">V582<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v645\/\">V645<\/a><br \/>  C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3106\/\">V3106<\/a><br \/>  Java: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v6025\/\">V6025<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>2  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/79.html\">CWE-79<\/a>  <\/td>\n<td>Improper Neutralization of Input During Web Page Generation (&#8216;Cross-site Scripting&#8217;)  <\/td>\n<td>46,84  <\/td>\n<td>C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5610\/\">V5610<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>3  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/125.html\">CWE-125<\/a>  <\/td>\n<td>Out-of-bounds Read  <\/td>\n<td>24,90  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v512\/\">V512<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v557\/\">V557<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v582\/\">V582<\/a><br \/>  C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3106\/\">V3106<\/a><br \/>  Java: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v6025\/\">V6025<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>4  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/20.html\">CWE-20<\/a>  <\/td>\n<td>Improper Input Validation  <\/td>\n<td>20,47  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v739\/\">V739<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v781\/\">V781<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1010\/\">V1010<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1024\/\">V1024<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5009\/\">V5009<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>5  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/78.html\">CWE-78<\/a>  <\/td>\n<td>Improper Neutralization of Special Elements used in an OS Command (&#8216;OS Command Injection&#8217;)  <\/td>\n<td>19,55  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1010\/\">V1010<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5009\/\">V5009<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>6  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/89.html\">CWE-89<\/a>  <\/td>\n<td>Improper Neutralization of Special Elements used in an SQL Command (&#8216;SQL Injection&#8217;)  <\/td>\n<td>19,54  <\/td>\n<td>C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5608\/\">V5608<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>7  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/416.html\">CWE-416<\/a>  <\/td>\n<td>Use After Free  <\/td>\n<td>16,83  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v623\/\">V623<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v723\/\">V723<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v758\/\">V758<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v774\/\">V774<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1017\/\">V1017<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>8  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/22.html\">CWE-22<\/a>  <\/td>\n<td>Improper Limitation of a Pathname to a Restricted Directory (&#8216;Path Traversal&#8217;)  <\/td>\n<td>14,69  <\/td>\n<td>C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5609\/\">V5609<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>9  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/352.html\">CWE-352<\/a>  <\/td>\n<td>Cross-Site Request Forgery (CSRF)  <\/td>\n<td>14,46  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>10  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/434.html\">CWE-434<\/a>  <\/td>\n<td>Unrestricted Upload of File with Dangerous Type  <\/td>\n<td>8,45  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>11  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/306.html\">CWE-306<\/a>  <\/td>\n<td>Missing Authentication for Critical Function  <\/td>\n<td>7,93  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>12  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/190.html\">CWE-190<\/a>  <\/td>\n<td>Integer Overflow or Wraparound  <\/td>\n<td>7,12  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v629\/\">V629<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v658\/\">V658<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v673\/\">V673<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v683\/\">V683<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1026\/\">V1026<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1028\/\">V1028<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5004\/\">V5004<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5005\/\">V5005<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5006\/\">V5006<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5007\/\">V5007<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5010\/\">V5010<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5011\/\">V5011<\/a><br \/>  C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3113\/\">V3113<\/a><br \/>  Java: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v6105\/\">V6105<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>13  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/502.html\">CWE-502<\/a>  <\/td>\n<td>Deserialization of Untrusted Data  <\/td>\n<td>6,71  <\/td>\n<td>C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5611\/\">V5611<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>14  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/287.html\">CWE-287<\/a>  <\/td>\n<td>Improper Authentication  <\/td>\n<td>6,58  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>15  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/476.html\">CWE-476<\/a>  <\/td>\n<td>NULL Pointer Dereference  <\/td>\n<td>6,54  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v522\/\">V522<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v595\/\">V595<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v664\/\">V664<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v713\/\">V713<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1004\/\">V1004<\/a><br \/>  C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3027\/\">V3027<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3042\/\">V3042<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3080\/\">V3080<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3095\/\">V3095<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3100\/\">V3100<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3125\/\">V3125<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3145\/\">V3145<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3146\/\">V3146<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3148\/\">V3148<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3149\/\">V3149<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3152\/\">V3152<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3153\/\">V3153<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v3168\/\">V3168<\/a><br \/>  Java: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v6008\/\">V6008<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v6060\/\">V6060<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v6093\/\">V6093<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>16  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/798.html\">CWE-798<\/a>  <\/td>\n<td>Use of Hard-coded Credentials  <\/td>\n<td>6,27  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5013\/\">V5013<\/a><br \/>  C#: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5601\/\">V5601<\/a><br \/>  Java: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v5305\/\">V5305<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>17  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/119.html\">CWE-119<\/a>  <\/td>\n<td>Improper Restriction of Operations within the Bounds of a Memory Buffer  <\/td>\n<td>5,84  <\/td>\n<td>C++: <a href=\"https:\/\/pvs-studio.com\/en\/w\/v512\/\">V512<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v557\/\">V557<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v582\/\">V582<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v769\/\">V769<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v783\/\">V783<\/a>, <a href=\"https:\/\/pvs-studio.com\/en\/w\/v1004\/\">V1004<\/a>  <\/td>\n<\/tr>\n<tr>\n<td>18  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/862.html\">CWE-862<\/a>  <\/td>\n<td>Missing Authorization  <\/td>\n<td>5,47  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>19  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/276.html\">CWE-276<\/a>  <\/td>\n<td>Incorrect Default Permissions  <\/td>\n<td>5,09  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>20  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/200.html\">CWE-200<\/a>  <\/td>\n<td>Exposure of Sensitive Information to an Unauthorized Actor  <\/td>\n<td>4,74  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>21  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/522.html\">CWE-522<\/a>  <\/td>\n<td>Insufficiently Protected Credentials  <\/td>\n<td>4,21  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>22  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/732.html\">CWE-732<\/a>  <\/td>\n<td>Incorrect Permission Assignment for Critical Resource  <\/td>\n<td>4,20  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>23  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/611.html\">CWE-611<\/a>  <\/td>\n<td>Improper Restriction of XML External Entity Reference  <\/td>\n<td>4,02  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>24  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/918.html\">CWE-918<\/a>  <\/td>\n<td>Server-Side Request Forgery (SSRF)  <\/td>\n<td>3,78  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<tr>\n<td>25  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/77.html\">CWE-77<\/a>  <\/td>\n<td>Improper Neutralization of Special Elements used in a Command (&#8216;Command Injection&#8217;)  <\/td>\n<td>3,58  <\/td>\n<td>Coming in the future  <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>The table shows that PVS-Studio now covers <strong>52% (13 out of 25)<\/strong> of the CWE Top 25 2021 list. It seems that 52% is not so much. However, we continue to develop diagnostics further. In the future we will be able to find even more defects. If we reduce this list to the 10 most dangerous and common defects, the picture becomes clearer \u2014 the total coverage grows to 80%. \ud83d\ude42 But this is a completely different story.<\/p>\n<p>  <\/p>\n<h2>Changes in the CWE Top 25 over the past year<\/h2>\n<p>  <\/p>\n<p>For the most sophisticated, I suggest looking at a brief statistic on movements in the CWE Top 25 over the past year. <\/p>\n<p>  <\/p>\n<p>The five biggest upshifts:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><strong>#<\/strong>  <\/th>\n<th><strong>CWE ID<\/strong>  <\/th>\n<th><strong>Name<\/strong>  <\/th>\n<th><strong>Position in 2020<\/strong>  <\/th>\n<th><strong>Position in 2021<\/strong>  <\/th>\n<th><strong>Annual change<\/strong>  <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/276.html\">CWE-276<\/a>  <\/td>\n<td>Incorrect Default Permissions  <\/td>\n<td>41  <\/td>\n<td>19  <\/td>\n<td><font color=\"green\">22\u25b2<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>2  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/306.html\">CWE-306<\/a>  <\/td>\n<td>Missing Authentication for Critical Function  <\/td>\n<td>24  <\/td>\n<td>11  <\/td>\n<td><font color=\"green\">13\u25b2<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>3  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/502.html\">CWE-502<\/a>  <\/td>\n<td>Deserialization of Untrusted Data  <\/td>\n<td>21  <\/td>\n<td>13  <\/td>\n<td><font color=\"green\">8\u25b2<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>4  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/862.html\">CWE-862<\/a>  <\/td>\n<td>Missing Authorization  <\/td>\n<td>25  <\/td>\n<td>18  <\/td>\n<td><font color=\"green\">7\u25b2<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>5  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/77.html\">CWE-77<\/a>  <\/td>\n<td>Improper Neutralization of Special Elements used in a Command (&#8216;Command Injection&#8217;)  <\/td>\n<td>31  <\/td>\n<td>25  <\/td>\n<td><font color=\"green\">6\u25b2<\/font>  <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>The five biggest downshifts:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><strong>#<\/strong>  <\/th>\n<th><strong>CWE ID<\/strong>  <\/th>\n<th><strong>Name<\/strong>  <\/th>\n<th><strong>Position in 2020<\/strong>  <\/th>\n<th><strong>Position in 2021<\/strong>  <\/th>\n<th><strong>Annual change<\/strong>  <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/200.html\">CWE-200<\/a>  <\/td>\n<td>Exposure of Sensitive Information to an Unauthorized Actor  <\/td>\n<td>7  <\/td>\n<td>20  <\/td>\n<td><font color=\"red\">13\u25bc<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>2  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/119.html\">CWE-119<\/a>  <\/td>\n<td>Improper Restriction of Operations within the Bounds of a Memory Buffer  <\/td>\n<td>5  <\/td>\n<td>17  <\/td>\n<td><font color=\"red\">12\u25bc<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>3  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/94.html\">CWE-94<\/a>  <\/td>\n<td>Improper Control of Generation of Code (&#8216;Code Injection&#8217;)  <\/td>\n<td>17  <\/td>\n<td>28  <\/td>\n<td><font color=\"red\">11\u25bc<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>4  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/269.html\">CWE-269<\/a>  <\/td>\n<td>Improper Privilege Management  <\/td>\n<td>22  <\/td>\n<td>29  <\/td>\n<td><font color=\"red\">7\u25bc<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>5  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/732.html\">CWE-732<\/a>  <\/td>\n<td>Incorrect Permission Assignment for Critical Resource  <\/td>\n<td>16  <\/td>\n<td>22  <\/td>\n<td><font color=\"red\">6\u25bc<\/font>  <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>Most of the CWEs presented in the table above belong to categories that are difficult to analyze. We can explain their rating decline (and their appearance in this table). The community has improved its educational, instrumental, and analytical capabilities, thereby reduced the frequency of mentioning errors related to these categories.<\/p>\n<p>  <\/p>\n<p>\u00abNewbies\u00bb in the Top 25:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><strong>#<\/strong>  <\/th>\n<th><strong>CWE ID<\/strong>  <\/th>\n<th><strong>Name<\/strong>  <\/th>\n<th><strong>Position in 2020<\/strong>  <\/th>\n<th><strong>Position in 2021<\/strong>  <\/th>\n<th><strong>Annual change<\/strong>  <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/276.html\">CWE-276<\/a>  <\/td>\n<td>Incorrect Default Permissions  <\/td>\n<td>41  <\/td>\n<td>19  <\/td>\n<td><font color=\"green\">22\u25b2<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>2  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/918.html\">CWE-918<\/a>  <\/td>\n<td>Server-Side Request Forgery (SSRF)  <\/td>\n<td>27  <\/td>\n<td>24  <\/td>\n<td><font color=\"green\">3\u25b2<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>3  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/77.html\">CWE-77<\/a>  <\/td>\n<td>Improper Neutralization of Special Elements used in a Command (&#8216;Command Injection&#8217;)  <\/td>\n<td>31  <\/td>\n<td>25  <\/td>\n<td><font color=\"green\">6\u25b2<\/font>  <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>And in the end \u2014 the defects that were dropped out of the CWE Top 25 in 2021:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><strong>#<\/strong>  <\/th>\n<th><strong>CWE ID<\/strong>  <\/th>\n<th><strong>Name<\/strong>  <\/th>\n<th><strong>Position in 2020<\/strong>  <\/th>\n<th><strong>Position in 2021<\/strong>  <\/th>\n<th><strong>Annual change<\/strong>  <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/400.html\">CWE-400<\/a>  <\/td>\n<td>Uncontrolled Resource Consumption  <\/td>\n<td>23  <\/td>\n<td>27  <\/td>\n<td><font color=\"red\">4\u25bc<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>2  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/94.html\">CWE-94<\/a>  <\/td>\n<td>Improper Control of Generation of Code (&#8216;Code Injection&#8217;)  <\/td>\n<td>17  <\/td>\n<td>28  <\/td>\n<td><font color=\"red\">11\u25bc<\/font>  <\/td>\n<\/tr>\n<tr>\n<td>3  <\/td>\n<td><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/269.html\">CWE-269<\/a>  <\/td>\n<td>Improper Privilege Management  <\/td>\n<td>22  <\/td>\n<td>29  <\/td>\n<td><font color=\"red\">7\u25bc<\/font>  <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h2>Conclusion<\/h2>\n<p>  <\/p>\n<p>I hope you enjoyed this article and understood the current terminology.<\/p>\n<p>  <\/p>\n<p>Fortunately, static analyzers help us fight potential vulnerabilities. Therefore, I suggest that you <a href=\"https:\/\/pvs-studio.com\/en\/pvs-studio\/download\/\">download and test<\/a> the PVS-Studio static analyzer with your project. Maybe a couple of CWEs crept into your code and are about to become CVE \ud83d\ude42<\/p>\n<p>  <\/p>\n<h2>Additional links:<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0592\/\">Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities<\/a>.<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/terms\/6441\/\">Potential vulnerability<\/a>.<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/terms\/6478\/\">Zero-day vulnerability<\/a>.<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/0710\/\">What is the difference between DevOps and DevSecOps?<\/a>  <\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/csharp\/0831\/\">OWASP, vulnerabilities, and taint analysis in PVS-Studio for C#. Stir, but don&#8217;t shake<\/a>.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/580482\/\"> https:\/\/habr.com\/ru\/articles\/580482\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>For the first time PVS-Studio provided support for the CWE classification in the 6.21 release. It took place on January 15, 2018. Years have passed since then and we would like to tell you about the improvements related to the support of this classification in the latest analyzer version.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/6c7\/064\/280\/6c706428086332649d765b3f6cdc4675.png\" alt=\"https:\/\/import.viva64.com\/docx\/blog\/0869_CWE_status\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c7\/064\/280\/6c706428086332649d765b3f6cdc4675.png\"\/>  <\/p>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-403108","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/403108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=403108"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/403108\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=403108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=403108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=403108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}