OWASP: how to use Cppcheck output 如何閱讀cppcheck output 以改進代碼安全性

How to install cppcheck

  1. Download Windows 64-bit (No XP support) Installer, and install

  2. new project
    The project file requires a larger storage space; it is recommended not to save it on the C drive.
    File -> Open Project File…

  3. save outupt to xml

How to read output xml

as .XML

https://codebeautify.org/xmlviewer

open in excel

I recommend using this method, and the results can be arranged by column."
在这里插入图片描述

Description

column nameinfoexample
version version2cppcheck version2.14.1
idtype of errorinvalidscanf
severityas namewarning, error, performance, style…
msgthe error logfscanf() without field width limits can crash with huge input data.
verboserevise sugestionfscanf() without field width limits can crash with huge input data. Add a field width specifier to fix this problem.
sincedatedate to scan by cpppcheck2024/08/28
file0on which filexxx.c xxx.cpp
cweThe CWE entry that this error violates119
filesame as file0N/A
linethe source code line408
infoother adviseParameter ‘args’ can be declared as pointer to const

Using cppcheck, a static analysis tool for C/C++ code, can help identify issues that may align with some of the vulnerabilities highlighted in the OWASP Top 10. However, cppcheck alone cannot guarantee that your code will fully comply with OWASP standards, as OWASP covers a broad range of web application security concerns that might require additional tools or manual code review.

Relationship between CWE and OWASP

The CWE (Common Weakness Enumeration) and OWASP Top 10 are both critical resources in the field of cybersecurity, but they do not have a strict one-to-one correspondence.

Instead, the OWASP Top 10 represents a list of the most critical security risks to web applications, while CWE is a broader catalog of software weaknesses. Each OWASP Top 10 entry may map to multiple CWEs, and vice versa.

Here’s a general idea of how some of the OWASP Top 10 categories might map to CWEs:

Injection (OWASP A1)

CWE-79: Improper Neutralization of Input During Web Page Generation (‘Cross-site Scripting’)
CWE-89: SQL Injection

Broken Authentication (OWASP A2)

CWE-287: Improper Authentication
CWE-384: Session Fixation

Sensitive Data Exposure (OWASP A3)

CWE-311: Missing Encryption of Sensitive Data
CWE-319: Cleartext Transmission of Sensitive Information

XML External Entities (XXE) (OWASP A4)

CWE-611: Improper Restriction of XML External Entity Reference

Broken Access Control (OWASP A5)

CWE-284: Improper Access Control
CWE-285: Improper Authorization

Security Misconfiguration (OWASP A6)

CWE-16: Configuration
CWE-220: Sensitive Data Under Protected

Cross-Site Scripting (XSS) (OWASP A7)

CWE-79: Improper Neutralization of Input During Web Page Generation (‘Cross-site Scripting’)

Insecure Deserialization (OWASP A8)

CWE-502: Deserialization of Untrusted Data

Using Components with Known Vulnerabilities (OWASP A9)

CWE-1104: Use of Unmaintained Third-Party Components
CWE-494: Download of Code Without Integrity Check

Insufficient Logging & Monitoring (OWASP A10)

CWE-778: Insufficient Logging
CWE-223: Omission of Security-relevant Information

While there is some overlap, each OWASP Top 10 category could relate to multiple CWEs, and each CWE could apply to different aspects of multiple OWASP Top 10 categories. Therefore, it’s more accurate to say that there are many-to-many relationships between these two resources.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值