CWE-327 使用已被攻破或存在风险的密码学算法

admin 2021年12月16日15:52:35评论300 views字数 8029阅读26分45秒阅读模式

CWE-327 使用已被攻破或存在风险的密码学算法

Use of a Broken or Risky Cryptographic Algorithm

结构: Simple

Abstraction: Class

状态: Draft

被利用可能性: High

基本描述

The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.

扩展描述

The use of a non-standard algorithm is dangerous because a determined attacker may be able to break the algorithm and compromise whatever data has been protected. Well-known techniques may exist to break the algorithm.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 693 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: PeerOf cwe_CWE_ID: 311 cwe_View_ID: 1000

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Confidentiality Read Application Data The confidentiality of sensitive data may be compromised by the use of a broken or risky cryptographic algorithm.
Integrity Modify Application Data The integrity of sensitive data may be compromised by the use of a broken or risky cryptographic algorithm.
['Accountability', 'Non-Repudiation'] Hide Activities If the cryptographic algorithm is used to ensure the identity of the source of the data (such as digital signatures), then a broken algorithm will compromise this scheme and the source of the data cannot be proven.

检测方法

Automated Analysis

Automated methods may be useful for recognizing commonly-used libraries or features that have become obsolete.

False negatives may occur if the tool is not aware of the cryptographic libraries in use, or if custom cryptography is being used.

DM-7 Manual Analysis

This weakness can be detected using tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session.

These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.

Automated Static Analysis - Binary or Bytecode

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Bytecode Weakness Analysis - including disassembler + source code weakness analysis
  • Binary Weakness Analysis - including disassembler + source code weakness analysis
  • Binary / Bytecode simple extractor – strings, ELF readers, etc.

Manual Static Analysis - Binary or Bytecode

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies

Dynamic Analysis with Automated Results Interpretation

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Web Application Scanner
  • Web Services Scanner
  • Database Scanners

Dynamic Analysis with Manual Results Interpretation

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Man-in-the-middle attack tool
Cost effective for partial coverage:
  • Framework-based Fuzzer
  • Automated Monitored Execution
  • Monitored Virtual Environment - run potentially malicious code in sandbox / wrapper / virtual machine, see if it does anything suspicious

Manual Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Manual Source Code Review (not inspections)
Cost effective for partial coverage:
  • Focused Manual Spotcheck - Focused manual analysis of source

Automated Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Source code Weakness Analyzer
  • Context-configured Source Code Weakness Analyzer

Automated Static Analysis

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Configuration Checker

Architecture or Design Review

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Formal Methods / Correct-By-Construction
Cost effective for partial coverage:
  • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

可能的缓解方案

MIT-24 Architecture and Design

策略: Libraries or Frameworks

When there is a need to store or transmit sensitive data, use strong, up-to-date cryptographic algorithms to encrypt that data. Select a well-vetted algorithm that is currently considered to be strong by experts in the field, and use well-tested implementations. As with all cryptographic mechanisms, the source code should be available for analysis.
For example, US government systems require FIPS 140-2 certification.
Do not develop custom or private cryptographic algorithms. They will likely be exposed to attacks that are well-understood by cryptographers. Reverse engineering techniques are mature. If the algorithm can be compromised if attackers find out how it works, then it is especially weak.
Periodically ensure that the cryptography has not become obsolete. Some older algorithms, once thought to require a billion years of computing time, can now be broken in days or hours. This includes MD4, MD5, SHA1, DES, and other algorithms that were once regarded as strong. [REF-267]

Architecture and Design

策略:

Design the software so that one cryptographic algorithm can be replaced with another. This will make it easier to upgrade to stronger algorithms.

Architecture and Design

策略:

Carefully manage and protect cryptographic keys (see CWE-320). If the keys can be guessed or stolen, then the strength of the cryptography itself is irrelevant.

MIT-4 Architecture and Design

策略: Libraries or Frameworks

Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
Industry-standard implementations will save development time and may be more likely to avoid errors that can occur during implementation of cryptographic algorithms. Consider the ESAPI Encryption feature.

MIT-25 ['Implementation', 'Architecture and Design']

策略:

When using industry-approved techniques, use them correctly. Don't cut corners by skipping resource-intensive steps (CWE-325). These steps are often essential for preventing common attacks.

示例代码

These code examples use the Data Encryption Standard (DES).

bad C

EVP_des_ecb();

bad Java

Cipher des=Cipher.getInstance("DES...");
des.initEncrypt(key2);

bad PHP

function encryptPassword($password){

$iv_size = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "This is a password encryption key";
$encryptedPassword = mcrypt_encrypt(MCRYPT_DES, $key, $password, MCRYPT_MODE_ECB, $iv);
return $encryptedPassword;

}

Once considered a strong algorithm, DES now regarded as insufficient for many applications. It has been replaced by Advanced Encryption Standard (AES).

分析过的案例

标识 说明 链接
CVE-2008-3775 Product uses "ROT-25" to obfuscate the password in the registry. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3775
CVE-2007-4150 product only uses "XOR" to obfuscate sensitive data https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4150
CVE-2007-5460 product only uses "XOR" and a fixed key to obfuscate sensitive data https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5460
CVE-2005-4860 Product substitutes characters with other characters in a fixed way, and also leaves certain input characters unchanged. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-4860
CVE-2002-2058 Attackers can infer private IP addresses by dividing each octet by the MD5 hash of '20'. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-2058
CVE-2008-3188 Product uses DES when MD5 has been specified in the configuration, resulting in weaker-than-expected password hashes. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3188
CVE-2005-2946 Default configuration of product uses MD5 instead of stronger algorithms that are available, simplifying forgery of certificates. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2946
CVE-2007-6013 Product uses the hash of a hash for authentication, allowing attackers to gain privileges if they can obtain the original hash. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6013

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
CLASP Using a broken or risky cryptographic algorithm
OWASP Top Ten 2004 A8 CWE More Specific Insecure Storage
CERT C Secure Coding MSC30-C CWE More Abstract Do not use the rand() function for generating pseudorandom numbers
CERT C Secure Coding MSC32-C CWE More Abstract Properly seed pseudorandom number generators
The CERT Oracle Secure Coding Standard for Java (2011) MSC02-J Generate strong random numbers
OMG ASCSM ASCSM-CWE-327

相关攻击模式

  • CAPEC-20
  • CAPEC-459
  • CAPEC-473
  • CAPEC-475
  • CAPEC-608
  • CAPEC-614
  • CAPEC-97

引用

文章来源于互联网:scap中文网

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日15:52:35
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-327 使用已被攻破或存在风险的密码学算法http://cn-sec.com/archives/613209.html

发表评论

匿名网友 填写信息