Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptographic API Misuse Vulnerability : Do not use non-random/static)predictable IVs in CBC #29

Closed
gxx777 opened this issue Nov 17, 2023 · 2 comments

Comments

@gxx777
Copy link

gxx777 commented Nov 17, 2023

Description:

In the PyPinkSign v0.5.1,it is a friendly Python library for NPKI.

It utilizes a non-random or static IV for Cipher Block Chaining (CBC) mode in AES encryption. Using default predictable IVs can lead to vulnerabilities like the disclosure of information about the plaintext of subsequent messages. IV=0123456789012345

Affected Version

v0.5.1

Location:

https://github.com/bandoche/PyPinkSign/blob/main/pypinksign/pypinksign.py#L504
https://github.com/bandoche/PyPinkSign/blob/main/pypinksign/pypinksign.py#L537

Reference

  • CWE-329: Generation of Predictable IV with CBC Mode;
  • CWE-330: Use of Insufficiently Random Values

Expected Behavior:

The IV for CBC mode should be random and unpredictable for each encryption operation to ensure the security of the encryption scheme.

Actual Behavior:

A static IV is used across encryption operations, making the encrypted data less secure and potentially leading to patterns that can be exploited by attackers. Default--> IV=0123456789012345

Recommendation

Do not set default constant iv for CBC encryption. And modify the encryption process to generate a random IV each time an encryption operation is performed.

Addressing these issues is critical to maintaining the confidentiality and integrity of the data processed by PyPinkSign. It is recommended to take immediate action to correct these vulnerabilities and prevent potential exploits.

@kerokim
Copy link

kerokim commented Jun 27, 2024

안녕하세요.
공인인증서 기술 문서에 IV 값을 "0123456789012345"로 고정해서 사용해야한다는 내용이 있습니다.
PyPinkSign은 공인인증서 처리를 위한 라이브러리이므로, 공인인증서 기술 문서에 따라 IV 값을 지정한 것으로 보입니다.

스크린샷 2024-06-27 오전 11 29 09

https://www.rootca.or.kr/kcac/down/TechSpec/2.3-KCAC.TS.ENC.pdf

Hello.
In Accredited Certificate(공인인증서) spec document, IV value should be fixed "0123456789012345".
PyPinkSign is a library for processing Accredited Certificate, it seems that IV value is according to spec document.

(Google Translate Image)
스크린샷 2024-06-27 오전 11 29 09

@bandoche
Copy link
Owner

bandoche commented Jul 7, 2024

Thanks @gxx777 @kerokim
As @kerokim said, Accredited certificate (K-NPKI) using fixed IV.

@bandoche bandoche closed this as completed Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants