暗号化アルゴリズムの破損やリスクが高い
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
OWASP カテゴリ: MASVS-CRYPTO: 暗号
概要
データの機密性と完全性を保護するために暗号が広く使用されていますが、デベロッパーが誤って脆弱な暗号アルゴリズムや古い暗号アルゴリズムを実装すると、重大なリスクが生じます。この脆弱性は、これらのアルゴリズムに固有の弱点に起因しており、必要な計算能力や知識を持つ悪意のある行為者によって悪用される可能性があります。このような不正使用の結果は深刻になる可能性があり、不正アクセス、データ侵害、機密情報の操作につながる可能性があります。
影響
機密データが公開、変更、偽造される可能性があります。破損した暗号アルゴリズムやリスクの高い暗号アルゴリズムは脆弱性につながる可能性があり、機密情報の復号、データの改ざん、正当なエンティティのなりすましに悪用される可能性があります。このような脆弱性を悪用されると、データ漏洩や金銭的損失から、評判の低下やユーザーの信頼の喪失まで、さまざまな影響が生じる可能性があります。
リスク: 脆弱な暗号学的ハッシュ関数または破損した暗号学的ハッシュ関数
脆弱な暗号ハッシュ関数(MD5
や SHA1
など)を使用すると、データのセキュリティと完全性が著しく損なわれる可能性があります。ハッシュ関数は、入力データの一意の固定長フィンガープリント(ハッシュ)を作成するように設計されています。これにより、データの完全性検証、パスワードの保存、デジタル署名など、さまざまな目的に使用できます。ただし、脆弱なハッシュ関数や侵害されたハッシュ関数が使用されると、次のような脆弱性が生じる可能性があります。
- 衝突攻撃: 弱いハッシュ関数は衝突攻撃を受けやすく、攻撃者は同じハッシュ値を生成する 2 つの異なる入力を検出します。これにより、不正なデータを正規のデータに置き換えることが可能になり、データの完全性が損なわれる可能性があります。
- データ侵害: パスワードが脆弱なアルゴリズムでハッシュ化されている場合、システムへの侵害が成功すると、ユーザー認証情報が漏洩する可能性があります。攻撃者は、レインボー テーブルなどの手法を使用してパスワードを解読し、アカウントへの不正アクセスを試みます。
- デジタル署名の否認: デジタル署名で使用されている弱いハッシュ関数が不正使用され、偽造された署名が作成される可能性があります。これにより、ドキュメントやメッセージの信頼性と完全性を判断することが難しくなります。
リスクの軽減
こうしたリスクを軽減するには、SHA-2
や SHA-3
などの強力で十分に検証された暗号学的ハッシュ関数を使用し、新しい脆弱性が発見されたら更新し続けることが重要です。また、パスワードのソルト処理や、bcrypt
や Argon2
などのパスワード固有のハッシュ アルゴリズムの使用などのセキュリティ対策を採用することで、データ保護をさらに強化できます。
リスク: 脆弱な暗号化関数または破損した暗号化関数
脆弱な暗号化関数(DES
や RC4
など)を使用すると、機密データの機密性が著しく損なわれる可能性があります。暗号化は、情報を解読不能な形式に変換して保護するように設計されていますが、暗号化アルゴリズムに欠陥があると、これらの保護が回避される可能性があります。
- データ漏洩: 弱い暗号化アルゴリズムは、ブルート フォース攻撃、既知の平文攻撃、暗号解読手法など、さまざまな攻撃を受けやすくなります。攻撃が成功すると、暗号化されたデータが漏洩し、個人情報、財務記録、機密のビジネスデータなどの機密情報に不正アクセスされる可能性があります。
- データの操作と改ざん: 攻撃者がデータを完全に復号できない場合でも、暗号化アルゴリズムが弱いと、検出されずにデータを操作できる可能性があります。これにより、データの不正な変更につながり、不正行為、虚偽表示、その他の悪意のある行為が発生する可能性があります。
リスクの軽減
暗号化関数で強力な暗号アルゴリズムを使用する
これらのリスクを軽減するには、強力で十分に検証された暗号アルゴリズムを使用し、鍵管理と暗号化の実装に関するベスト プラクティスに従うことが重要です。暗号化アルゴリズムを定期的に更新し、新たな脅威に関する最新情報を常に把握することも、堅牢なデータ セキュリティを維持するうえで不可欠です。
使用が推奨されるデフォルトのアルゴリズムは次のとおりです。
- 対称暗号化:
GCM
モードの AES-128
/AES-256
Chacha20
- 非対称暗号化:
OAEP
パディングを含む RSA-2048
/RSA-4096
暗号ライブラリの安全なプリミティブを使用して、一般的な落とし穴を減らす
適切な暗号化アルゴリズムを選択することは重要ですが、セキュリティの脆弱性を最小限に抑えるには、合理化された API を提供し、安全なデフォルト構成を重視する暗号ライブラリの使用を検討してください。このアプローチにより、アプリケーションのセキュリティが強化されるだけでなく、コーディング エラーによる脆弱性の発生を大幅に減らすことができます。たとえば、Tink は AEAD
暗号化と Hybrid
暗号化という 2 つの異なるオプションを提供することで、暗号化の選択を簡素化し、デベロッパーが十分な情報に基づいてセキュリティに関する意思決定を行えるようにします。
リスク: 脆弱な暗号署名関数または破損した暗号署名関数
脆弱な暗号署名関数(RSA-PKCS#1 v1.5
など、脆弱なハッシュ関数に基づくもの)を使用すると、データと通信の完全性に重大なリスクが生じます。デジタル署名は、認証、否認防止、データ完全性を提供し、メッセージやドキュメントが特定の送信者から送信され、改ざんされていないことを保証するように設計されています。ただし、基盤となる署名アルゴリズムに欠陥がある場合、これらの保証は損なわれる可能性があります。
- 署名の偽造: 弱い署名アルゴリズムは、悪意のある行為者が偽造署名を作成できる攻撃に対して脆弱である可能性があります。つまり、正規のエンティティを装ったり、文書を偽造したり、メッセージを改ざんしたりしても、検知されません。
- 署名の否認: 署名アルゴリズムが破られると、署名者は文書に署名していないと虚偽の主張をすることができ、否認防止の原則が損なわれ、法的およびロジスティック上の問題が生じる可能性があります。
- データの操作と改ざん: 署名を使用してデータの完全性を保護するシナリオでは、アルゴリズムが弱いと、攻撃者が署名を無効にすることなくデータを変更できるため、改ざんが検出されず、重要な情報が漏洩する可能性があります。
リスクの軽減
強力な暗号署名アルゴリズムを使用する
これらのリスクを軽減するには、強力で十分に検証された暗号署名アルゴリズムを使用することが重要です。
PSS
パディングを含む RSA-2048
/RSA-4096
- 安全な曲線を使用した楕円曲線デジタル署名アルゴリズム(
ECDSA
)
暗号ライブラリの安全なプリミティブを使用して、一般的な落とし穴を減らす
適切な署名アルゴリズムを選択することは不可欠ですが、セキュリティの脆弱性を最小限に抑えるには、デフォルトで堅牢なセキュリティ保証を提供する暗号ライブラリを検討してください。たとえば、Tink は、安全な曲線を使用した ECDSA
をデフォルト オプションとして提供することで、署名の選択を簡素化します。これはすべて、わかりやすく包括的な API 内で行われます。このアプローチにより、セキュリティが強化されるだけでなく、複雑な構成や意思決定が不要になるため、開発が合理化されます。
リソース
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# Broken or risky cryptographic algorithm\n\n\u003cbr /\u003e\n\n**OWASP category:** [MASVS-CRYPTO: Cryptography](https://mas.owasp.org/MASVS/06-MASVS-CRYPTO)\n\nOverview\n--------\n\nDespite the widespread use of cryptography to protect data confidentiality and\nintegrity, a significant risk arises when developers inadvertently implement\nweak or outdated cryptographic algorithms. This vulnerability stems from the\ninherent weaknesses in these algorithms, which can be exploited by malicious\nactors possessing the necessary computational power or knowledge. The\nconsequences of such exploitation can be severe, potentially leading to\nunauthorized access, data breaches, and manipulation of sensitive information.\n\nImpact\n------\n\nSensitive data can be exposed, modified, or forged. Broken or risky\ncryptographic algorithms might lead to vulnerabilities and can be abused to\ndecrypt sensitive information, tamper with data, or impersonate legitimate\nentities. The impact of exploiting such vulnerabilities can range from data\nbreaches and financial losses to reputational damage and loss of user trust.\n\nRisk: Weak or broken cryptographic hash functions\n-------------------------------------------------\n\nThe use of weak or broken cryptographic hash functions (such as `MD5` or `SHA1`)\nposes a significant risk to the security and integrity of data. Hash functions\nare designed to create unique, fixed-length fingerprints (hashes) of input data,\nmaking them useful for various purposes, including data integrity verification,\npassword storage, and digital signatures. However, when weak or compromised hash\nfunctions are employed, several vulnerabilities can arise:\n\n- **Collision Attacks**: Weak hash functions are susceptible to collision attacks, where an attacker finds two different inputs that produce the same hash value. This can allow them to substitute malicious data for legitimate data without detection, compromising data integrity.\n- **Data Breaches**: If passwords are hashed with a weak algorithm, a successful breach of a system could lead to the exposure of user credentials. Attackers could then use rainbow tables or other techniques to crack the passwords, gaining unauthorized access to accounts.\n- **Repudiation of Digital Signatures**: Weak hash functions used in digital signatures can be exploited to create forged signatures, making it difficult to determine the authenticity and integrity of documents or messages.\n\n### Mitigations\n\nTo mitigate these risks, it is crucial to use strong, well-vetted cryptographic\nhash functions like [`SHA-2`](https://en.wikipedia.org/wiki/SHA-2) or [`SHA-3`](https://en.wikipedia.org/wiki/SHA-3), and\nto keep them updated as new vulnerabilities are discovered. Additionally,\nadopting security practices such as salting passwords and using\npassword-specific hashing algorithms like [`bcrypt`](https://en.wikipedia.org/wiki/Bcrypt) or\n[`Argon2`](https://en.wikipedia.org/wiki/Argon2) can further enhance data protection.\n\n*** ** * ** ***\n\nRisk: Weak or broken cryptographic encryption functions\n-------------------------------------------------------\n\nThe use of weak or broken cryptographic encryption functions (such as `DES` or\n`RC4`) poses severe risks to the confidentiality of sensitive data. Encryption\nis designed to protect information by transforming it into an unreadable format,\nbut if the encryption algorithm is flawed, these protections can be bypassed:\n\n- **Data Breaches:** Weak encryption algorithms are susceptible to various attacks, including brute-force attacks, known-plaintext attacks, and cryptanalysis techniques. If successful, these attacks can expose encrypted data, allowing unauthorized access to sensitive information such as personal details, financial records, or confidential business data.\n- **Data Manipulation and Tampering:** Even if an attacker cannot fully decrypt the data, they may still be able to manipulate it without detection if the encryption algorithm is weak. This can lead to unauthorized modifications of data, potentially resulting in fraud, misrepresentation, or other malicious activities.\n\n### Mitigations\n\n#### Use strong cryptographic algorithms in encryption functions\n\nTo mitigate these risks, it is crucial to use strong, well-vetted cryptographic\nalgorithms and follow best practices for key management and encryption\nimplementation. Regularly updating encryption algorithms and staying informed\nabout emerging threats is also essential to maintain robust data security.\n\nSome recommended default algorithms to use:\n\n- Symmetric encryption:\n - `AES-128`/`AES-256` with [`GCM`](https://en.wikipedia.org/wiki/Galois/Counter_Mode) mode\n - `Chacha20`\n- Asymmetric encryption:\n - `RSA-2048`/`RSA-4096` with [`OAEP`](https://datatracker.ietf.org/doc/html/rfc8017) padding\n\n#### Use secure primitives from a cryptography library to reduce common pitfalls\n\nWhile selecting an appropriate encryption algorithm is crucial, to truly\nminimize security vulnerabilities, consider using a cryptography library that\noffers a streamlined API and emphasizes secure default configurations. This\napproach not only strengthens the security of your applications but also\nsignificantly reduces the likelihood of introducing vulnerabilities through\ncoding errors. For example, [Tink](https://developers.google.com/tink) simplifies encryption choices by offering\ntwo distinct options: [`AEAD`](https://developers.google.com/tink/streaming-aead) and [`Hybrid`](https://developers.google.com/tink/hybrid) encryption, making it easier\nfor developers to make informed security decisions.\n\n*** ** * ** ***\n\nRisk: Weak or broken cryptographic signature functions\n------------------------------------------------------\n\nThe use of weak or broken cryptographic signature functions (such as\n[`RSA-PKCS#1 v1.5`](https://www.rfc-editor.org/rfc/rfc2313), or the ones based on weak hash functions)\nposes severe risks to the integrity of data and communication. Digital\nsignatures are designed to provide authentication, non-repudiation, and data\nintegrity, ensuring that a message or document originates from a specific sender\nand has not been tampered with. However, when the underlying signature algorithm\nis flawed, these assurances can be compromised:\n\n- **Forging signatures**: Weak signature algorithms can be vulnerable to attacks that allow malicious actors to create forged signatures. This means they can impersonate legitimate entities, fabricate documents, or tamper with messages without detection.\n- **Repudiation of signatures**: If a signature algorithm is broken, a signer may be able to falsely claim that they did not sign a document, undermining the principle of non-repudiation and creating legal and logistical challenges.\n- **Data manipulation and tampering**: In scenarios where signatures are used to protect the integrity of data, a weak algorithm could allow attackers to modify the data without invalidating the signature, leading to undetected tampering and potential compromise of critical information.\n\n### Mitigations\n\n#### Use strong cryptographic signature algorithms\n\nTo mitigate these risks, it is crucial to use strong, well-vetted cryptographic\nsignature algorithms:\n\n- `RSA-2048`/`RSA-4096` with [`PSS`](https://datatracker.ietf.org/doc/html/rfc8017) padding\n- Elliptic Curve Digital Signature Algorithm ([`ECDSA`](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm)) with secure curves\n\n#### Use secure primitives from a cryptography library to reduce common pitfalls\n\nChoosing the right signature algorithm is essential, but to truly minimize\nsecurity vulnerabilities, consider a cryptography library that provides robust\nsecurity assurances by default. [Tink](https://developers.google.com/tink), for example, simplifies signature\nchoices by offering `ECDSA` with secure curves as its default option, all within\na straightforward and comprehensive API. This approach not only enhances\nsecurity but also streamlines development by eliminating the need for complex\nconfiguration or decision-making.\n\n*** ** * ** ***\n\nResources\n---------\n\n- [Tink cryptography library](https://developers.google.com/tink/what-is)\n- [Android App quality: Cryptography](/privacy-and-security/cryptography)\n- [Digital Signature with Tink](https://developers.google.com/tink/digital-signature)\n- [Hybrid Encryption with Tink](https://developers.google.com/tink/hybrid)\n- [Authenticated Encryption with Tink](https://developers.google.com/tink/streaming-aead)\n- [Weak or broken cryptographic hash and encryption functions Android security lint](https://github.com/google/android-security-lints/blob/main/checks/src/main/java/com/example/lint/checks/BadCryptographyUsageDetector.kt)\n- [CWE-327: Use of a Broken or Risky Cryptographic Algorithm](https://cwe.mitre.org/data/definitions/327.html)\n- [CWE-328: Use of Weak Hash](https://cwe.mitre.org/data/definitions/328.html)\n- [CWE-780: Use of RSA Algorithm without OAEP](https://cwe.mitre.org/data/definitions/780.html)\n- [NIST page about Approved Hash Functions](https://csrc.nist.gov/projects/hash-functions)\n- [Advanced Encryption Standard (Wikipedia)](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)\n- [Secure Hash Algorithm 2 (Wikipedia)](https://en.wikipedia.org/wiki/SHA-2)\n- [Secure Hash Algorithm 3 (Wikipedia)](https://en.wikipedia.org/wiki/SHA-3)\n- [RSA cryptosystem (Wikipedia)](https://en.wikipedia.org/wiki/RSA_(cryptosystem))\n- [Elliptic Curve Digital Signature Algorithm (Wikipedia)](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm)\n- [Stream cipher ChaCha (Wikipedia)](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant)\n- [Salting password (Wikipedia)](https://en.wikipedia.org/wiki/Salt_(cryptography))\n- [Hybrid cryptosystem (Wikipedia)](https://en.wikipedia.org/wiki/Hybrid_cryptosystem)\n- [Authenticated encryption](https://en.wikipedia.org/wiki/Authenticated_encryption)"]]