跳转到主要内容

cwe2是一个用于Python的CWE常见弱点枚举库

项目描述

cwe2是一个用于处理Python中CWE的库。CWE是漏洞的弱点类别。

主页和支持: https://github.com/nexB/cwe2

有关CWE的详细信息,请参阅 https://cwe.mitre.org/index.html。这是https://github.com/Julian-Nash/cwe的维护者分支。

它包含CWE数据的供应商副本。

版权(c)Julian-Nash, Ziad Hany, nexB. Inc.和他人。SPDX-License-Identifier: MIT和LicenseRef-scancode-cwe-tou

CWE数据有此声明

使用此网站上的通用弱点枚举(CWE)及其相关参考资料受使用条款约束。CWE由美国国土安全部(DHS)网络安全和基础设施安全局(CISA)赞助,由运营于麻省理工学院雷丁公司(MITRE)的国土安全系统工程和开发研究所(HSSEDI)管理。版权© 2006–2022,麻省理工学院雷丁公司。CWE、CWSS、CWRAF和CWE标志是麻省理工学院雷丁公司的商标。有关详细信息,请参阅cwe-tou.LICENSE。

安装

使用pip安装

pip install cwe2

用法

  • 通过ID获取CWE

    >>> from cwe2.database import Database
    >>> db = Database()
    >>> db.get(15)
    Weakness(cwe_id=15, name='External Control of System or Configuration Setting', weakness_abstraction='Base', status='Incomplete', description='One or more system settings or configuration elements can be externally controlled by a user.', extended_description='Allowing external control of system settings can disrupt service or cause an application to behave in unexpected, and potentially malicious ways.', related_weaknesses='::NATURE:ChildOf:CWE ID:642:VIEW ID:1000:ORDINAL:Primary::NATURE:ChildOf:CWE ID:610:VIEW ID:1000::NATURE:ChildOf:CWE ID:20:VIEW ID:700:ORDINAL:Primary::', weakness_ordinalities=nan, applicable_platforms=nan, background_details=nan, alternate_terms=nan, modes_of_introduction='::PHASE:Implementation:NOTE:Setting manipulation vulnerabilities occur when an attacker can control values that govern the behavior of the system, manage specific resources, or in some way affect the functionality of the application.::PHASE:Implementation:NOTE:REALIZATION: This weakness is caused during implementation of an architectural security tactic.::', exploitation_factors=nan, likelihood_of_exploit=nan, common_consequences='::SCOPE:Other:IMPACT:Varies by Context::', detection_methods=nan, potential_mitigations='::PHASE:Architecture and Design:STRATEGY:Separation of Privilege:DESCRIPTION:Compartmentalize the system to have safe areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.::PHASE:Implementation Architecture and Design:DESCRIPTION:Because setting manipulation covers a diverse set of functions, any attempt at illustrating it will inevitably be incomplete. Rather than searching for a tight-knit relationship between the functions addressed in the setting manipulation category, take a step back and consider the sorts of system values that an attacker should not be allowed to control.::PHASE:Implementation Architecture and Design:DESCRIPTION:In general, do not allow user-provided or otherwise untrusted data to control sensitive values. The leverage that an attacker gains by controlling these values is not always immediately obvious, but do not underestimate the creativity of the attacker.::', observed_examples=nan, functional_areas=nan, affected_resources=nan, taxonomy_mappings='::TAXONOMY NAME:7 Pernicious Kingdoms:ENTRY NAME:Setting Manipulation::TAXONOMY NAME:Software Fault Patterns:ENTRY ID:SFP25:ENTRY NAME:Tainted input to variable::', related_attack_patterns='::13::146::176::203::270::271::69::76::77::', notes=nan)
  • 使用点符号访问弱点的属性

    >>> weakness = db.get("15")
    >>> weakness.description
    'One or more system settings or configuration elements can be externally controlled by a user.'
  • 或使用弱点get方法

    >>> weakness.get("status")
    'Incomplete'
  • 获取弱点的字典(此例中已截断)

    >>> weakness.__dict__
    {'cwe_id': 15, 'name': 'External Control of System or Configuration Setting', 'weakness_abstraction': 'Base', 'status': 'Incomplete', 'description': 'One or more system settings or configuration elements can be externally controlled by a user.', 'extended_description': 'Allowing external control of system settings can disrupt service or cause an application to behave in unexpected, and potentially malicious ways.', 'related_weaknesses': '::NATURE:ChildOf:CWE ID:642:VIEW ID:1000:ORDINAL:Primary::NATURE:ChildOf:CWE ID:610:VIEW ID:1000::NATURE:ChildOf:CWE ID:20:VIEW ID:700:ORDINAL:Primary::', 'weakness_ordinalities': nan, 'applicable_platforms': nan, 'background_details': nan, 'alternate_terms': nan, 'modes_of_introduction': '::PHASE:Implementation:NOTE:Setting manipulation vulnerabilities occur when an attacker can control values that govern the behavior of the system, manage specific resources, or in some way affect the functionality of the application.::PHASE:Implementation:NOTE:REALIZATION: This weakness is caused during implementation of an architectural security tactic.::', 'exploitation_factors': nan, 'likelihood_of_exploit': nan, 'common_consequences': '::SCOPE:Other:IMPACT:Varies by Context::', 'detection_methods': nan, 'potential_mitigations': '::PHASE:Architecture and Design:STRATEGY:Separation of Privilege:DESCRIPTION:Compartmentalize the system to have safe areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.::PHASE:Implementation Architecture and Design:DESCRIPTION:Because setting manipulation covers a diverse set of functions, any attempt at illustrating it will inevitably be incomplete. Rather than searching for a tight-knit relationship between the functions addressed in the setting manipulation category, take a step back and consider the sorts of system values that an attacker should not be allowed to control.::PHASE:Implementation Architecture and Design:DESCRIPTION:In general, do not allow user-provided or otherwise untrusted data to control sensitive values. The leverage that an attacker gains by controlling these values is not always immediately obvious, but do not underestimate the creativity of the attacker.::', 'observed_examples': nan, 'functional_areas': nan, 'affected_resources': nan, 'taxonomy_mappings': '::TAXONOMY NAME:7 Pernicious Kingdoms:ENTRY NAME:Setting Manipulation::TAXONOMY NAME:Software Fault Patterns:ENTRY ID:SFP25:ENTRY NAME:Tainted input to variable::', 'related_attack_patterns': '::13::146::176::203::270::271::69::76::77::', 'notes': nan}

额外功能

  • 获取前25个弱点db.get_top_25_cwe()

  • 获取2021年OWASP前十名弱点db.get_owasp_top_ten_2021()

  • 获取nvd使用的弱点db.get_weaknesses_used_by_nvd()

  • 是否在CWE前25名(2022)db.is_cwe_top_25(20)

  • 是否被nvd使用弱点db.is_weaknesses_used_by_nvd(352)

  • 是否在OWASP前十名(2021)db.is_owasp_top_ten_2021(11)

弱点属性

以下弱点对象属性可访问

  • cwe_id

  • name

  • weakness_abstraction

  • status

  • description

  • extended_description

  • related_weaknesses

  • weakness_ordinalities

  • applicable_platforms

  • background_details

  • alternate_terms

  • modes_of_introduction

  • exploitation_factors

  • likelihood_of_exploit

  • common_consequences

  • detection_methods

  • potential_mitigations

  • observed_examples

  • functional_areas

  • affected_resources

  • taxonomy_mappings

  • related_attack_patterns

  • notes

测试

使用以下命令运行测试

make test

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

cwe2-3.0.0.tar.gz (8.9 MB 查看哈希

上传时间

构建分布

cwe2-3.0.0-py3-none-any.whl (9.0 MB 查看哈希

上传时间 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面