CWE-329 在CBC加密模式中未使用随机化IV向量

admin 2021年12月16日15:53:18评论227 views字数 1822阅读6分4秒阅读模式

CWE-329 在CBC加密模式中未使用随机化IV向量

Not Using a Random IV with CBC Mode

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: Medium

基本描述

Not using a random initialization Vector (IV) with Cipher Block Chaining (CBC) Mode causes algorithms to be susceptible to dictionary attacks.

相关缺陷

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

  • cwe_Nature: ChildOf cwe_CWE_ID: 573 cwe_View_ID: 1000

适用平台

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

常见的影响

范围 影响 注释
['Confidentiality', 'Other'] ['Read Application Data', 'Other'] If the CBC is not properly initialized, data that is encrypted can be compromised and therefore be read.
Integrity Modify Application Data If the CBC is not properly initialized, encrypted data could be tampered with in transfer.
['Access Control', 'Other'] ['Bypass Protection Mechanism', 'Other'] Cryptographic based authentication systems could be defeated.

可能的缓解方案

Implementation

策略:

It is important to properly initialize CBC operating block ciphers or their utility is lost.

示例代码

In the following examples, CBC mode is used when encrypting data:

bad C

EVP_CIPHER_CTX ctx;
char key[EVP_MAX_KEY_LENGTH];
char iv[EVP_MAX_IV_LENGTH];
RAND_bytes(key, b);
memset(iv,0,EVP_MAX_IV_LENGTH);
EVP_EncryptInit(&ctx,EVP_bf_cbc(), key,iv);

bad Java

public class SymmetricCipherTest {

public static void main() {


byte[] text ="Secret".getBytes();
byte[] iv ={

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

};
KeyGenerator kg = KeyGenerator.getInstance("DES");
kg.init(56);
SecretKey key = kg.generateKey();
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, key, ips);
return cipher.doFinal(inpBytes);

}

}

In both of these examples, the initialization vector (IV) is always a block of zeros. This makes the resulting cipher text much more predictable and susceptible to a dictionary attack.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
CLASP Not using a random IV with CBC mode

引用

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

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日15:53:18
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-329 在CBC加密模式中未使用随机化IV向量https://cn-sec.com/archives/613181.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息