الگوریتم رمزنگاری شکسته یا خطرناک
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
دسته OWASP: MASVS-CRYPTO: رمزنگاری
نمای کلی
با وجود استفاده گسترده از رمزنگاری برای محافظت از محرمانه بودن و یکپارچگی داده ها، زمانی که توسعه دهندگان ناخواسته الگوریتم های رمزنگاری ضعیف یا قدیمی را پیاده سازی می کنند، خطر قابل توجهی ایجاد می شود. این آسیبپذیری ناشی از ضعفهای ذاتی در این الگوریتمها است که میتوانند توسط بازیگران مخربی که قدرت محاسباتی یا دانش لازم را دارند مورد سوء استفاده قرار گیرند. عواقب چنین بهره برداری می تواند شدید باشد و به طور بالقوه منجر به دسترسی غیرمجاز، نقض داده ها و دستکاری اطلاعات حساس شود.
تاثیر
داده های حساس را می توان در معرض دید، اصلاح یا جعل قرار داد. الگوریتمهای رمزنگاری شکسته یا مخاطرهآمیز ممکن است منجر به آسیبپذیری شوند و میتوانند برای رمزگشایی اطلاعات حساس، دستکاری دادهها یا جعل هویت موجودیتهای قانونی مورد سوء استفاده قرار گیرند. تأثیر سوء استفاده از چنین آسیبپذیریها میتواند از نقض دادهها و زیانهای مالی گرفته تا آسیب به شهرت و از دست دادن اعتماد کاربران باشد.
ریسک: توابع هش رمزنگاری ضعیف یا خراب
استفاده از توابع هش رمزنگاری ضعیف یا شکسته (مانند MD5
یا SHA1
) خطر قابل توجهی برای امنیت و یکپارچگی داده ها ایجاد می کند. توابع هش برای ایجاد اثر انگشت (هش) منحصر به فرد و با طول ثابت از داده های ورودی طراحی شده اند که آنها را برای اهداف مختلف از جمله تأیید صحت داده ها، ذخیره رمز عبور و امضای دیجیتال مفید می کند. با این حال، هنگامی که توابع هش ضعیف یا به خطر افتاده استفاده می شود، آسیب پذیری های متعددی ممکن است ایجاد شود:
- حملات برخورد : توابع هش ضعیف مستعد حملات برخورد هستند، جایی که مهاجم دو ورودی متفاوت را پیدا می کند که مقدار هش یکسانی را تولید می کنند. این می تواند به آنها اجازه دهد تا داده های مخرب را بدون شناسایی جایگزین داده های مشروع کنند و یکپارچگی داده ها را به خطر بیندازند.
- نقض داده ها : اگر رمزهای عبور با الگوریتم ضعیف هش شوند، نقض موفقیت آمیز یک سیستم می تواند منجر به افشای اعتبار کاربر شود. سپس مهاجمان میتوانند از جداول رنگین کمان یا تکنیکهای دیگر برای شکستن پسوردها استفاده کنند و به حسابها دسترسی غیرمجاز پیدا کنند.
- رد امضای دیجیتال : توابع هش ضعیفی که در امضای دیجیتال استفاده میشود، میتواند برای ایجاد امضای جعلی مورد سوء استفاده قرار گیرد، که تعیین صحت و یکپارچگی اسناد یا پیامها را دشوار میکند.
اقدامات کاهشی
برای کاهش این خطرات، استفاده از توابع هش رمزنگاری قوی و به خوبی بررسی شده مانند SHA-2
یا SHA-3
، و به روز نگه داشتن آنها با کشف آسیب پذیری های جدید بسیار مهم است. علاوه بر این، اتخاذ شیوههای امنیتی مانند نمکزدایی گذرواژهها و استفاده از الگوریتمهای هشسازی خاص رمز عبور مانند bcrypt
یا Argon2
میتواند حفاظت از دادهها را بیشتر کند.
ریسک: عملکردهای رمزگذاری رمزنگاری ضعیف یا خراب
استفاده از توابع رمزگذاری رمزنگاری ضعیف یا شکسته (مانند DES
یا RC4
) خطرات شدیدی را برای محرمانه بودن داده های حساس به همراه دارد. رمزگذاری برای محافظت از اطلاعات با تبدیل آنها به قالبی غیرقابل خواندن طراحی شده است، اما اگر الگوریتم رمزگذاری ناقص باشد، می توان از این حفاظت ها عبور کرد:
- نقض داده ها: الگوریتم های رمزگذاری ضعیف مستعد حملات مختلف، از جمله حملات brute-force، حملات متن ساده شناخته شده، و تکنیک های تحلیل رمز هستند. در صورت موفقیت آمیز بودن، این حملات می تواند داده های رمزگذاری شده را افشا کند و اجازه دسترسی غیرمجاز به اطلاعات حساس مانند جزئیات شخصی، سوابق مالی یا داده های تجاری محرمانه را بدهد.
- دستکاری و دستکاری داده ها: حتی اگر مهاجم نتواند به طور کامل داده ها را رمزگشایی کند، در صورت ضعیف بودن الگوریتم رمزگذاری، ممکن است همچنان قادر به دستکاری آن ها بدون شناسایی باشد. این می تواند منجر به تغییرات غیرمجاز داده ها شود که به طور بالقوه منجر به کلاهبرداری، ارائه نادرست یا سایر فعالیت های مخرب می شود.
اقدامات کاهشی
از الگوریتم های رمزنگاری قوی در توابع رمزگذاری استفاده کنید
برای کاهش این خطرات، استفاده از الگوریتم های رمزنگاری قوی و به خوبی بررسی شده و پیروی از بهترین شیوه ها برای مدیریت کلید و اجرای رمزگذاری بسیار مهم است. بهروزرسانی منظم الگوریتمهای رمزگذاری و اطلاعرسانی در مورد تهدیدات نوظهور نیز برای حفظ امنیت دادهها ضروری است.
برخی از الگوریتم های پیش فرض توصیه شده برای استفاده:
- رمزگذاری متقارن:
-
AES-128
/ AES-256
با حالت GCM
-
Chacha20
- رمزگذاری نامتقارن:
-
RSA-2048
/ RSA-4096
با بالشتک OAEP
برای کاهش تلههای رایج، از اصول اولیه ایمن از یک کتابخانه رمزنگاری استفاده کنید
در حالی که انتخاب یک الگوریتم رمزگذاری مناسب بسیار مهم است، برای به حداقل رساندن آسیبپذیریهای امنیتی، استفاده از یک کتابخانه رمزنگاری را در نظر بگیرید که یک API ساده ارائه میدهد و بر پیکربندیهای پیشفرض ایمن تأکید دارد. این رویکرد نه تنها امنیت برنامه های شما را تقویت می کند، بلکه احتمال ایجاد آسیب پذیری ها را از طریق خطاهای کدنویسی به میزان قابل توجهی کاهش می دهد. به عنوان مثال، Tink با ارائه دو گزینه متمایز، گزینه های رمزگذاری را ساده می کند: رمزگذاری AEAD
و Hybrid
، که تصمیم گیری آگاهانه امنیتی را برای توسعه دهندگان آسان تر می کند.
ریسک: عملکردهای امضای رمزنگاری ضعیف یا خراب
استفاده از توابع امضای رمزنگاری ضعیف یا شکسته (مانند RSA-PKCS#1 v1.5
، یا توابع مبتنی بر توابع هش ضعیف) خطرات شدیدی را برای یکپارچگی داده ها و ارتباطات ایجاد می کند. امضای دیجیتالی طراحی شده است تا احراز هویت، عدم انکار و یکپارچگی داده ها را فراهم کند و اطمینان حاصل کند که یک پیام یا سند از یک فرستنده خاص منشأ می گیرد و در آن دستکاری نشده است. با این حال، زمانی که الگوریتم امضای اساسی ناقص باشد، این تضمین ها می توانند به خطر بیفتند:
- جعل امضا : الگوریتمهای امضای ضعیف میتوانند در برابر حملاتی آسیبپذیر باشند که به عوامل مخرب اجازه میدهد امضاهای جعلی ایجاد کنند. این بدان معنی است که آنها می توانند هویت افراد قانونی را جعل کنند، اسناد را جعل کنند یا پیام ها را بدون شناسایی دستکاری کنند.
- رد امضا : اگر یک الگوریتم امضا خراب شود، امضاکننده ممکن است به دروغ ادعا کند که سندی را امضا نکرده است، که اصل عدم انکار را زیر سوال میبرد و چالشهای قانونی و لجستیکی ایجاد میکند.
- دستکاری و دستکاری داده ها : در سناریوهایی که از امضاها برای محافظت از یکپارچگی داده ها استفاده می شود، یک الگوریتم ضعیف می تواند به مهاجمان اجازه دهد تا داده ها را بدون باطل کردن امضا تغییر دهند، که منجر به دستکاری ناشناخته و به خطر انداختن احتمالی اطلاعات حیاتی می شود.
اقدامات کاهشی
از الگوریتم های امضای رمزنگاری قوی استفاده کنید
برای کاهش این خطرات، استفاده از الگوریتم های امضای رمزنگاری قوی و به خوبی بررسی شده بسیار مهم است:
-
RSA-2048
/ RSA-4096
با بالشتک PSS
- الگوریتم امضای دیجیتال منحنی بیضوی (
ECDSA
) با منحنی های ایمن
برای کاهش تلههای رایج، از اصول اولیه ایمن از یک کتابخانه رمزنگاری استفاده کنید
انتخاب الگوریتم امضای مناسب ضروری است، اما برای به حداقل رساندن آسیبپذیریهای امنیتی، یک کتابخانه رمزنگاری را در نظر بگیرید که به طور پیشفرض تضمینهای امنیتی قوی ارائه میکند. به عنوان مثال، Tink با ارائه ECDSA
با منحنی های ایمن به عنوان گزینه پیش فرض خود، همه در یک API ساده و جامع، انتخاب امضا را ساده می کند. این رویکرد نه تنها امنیت را افزایش می دهد، بلکه با حذف نیاز به پیکربندی پیچیده یا تصمیم گیری، توسعه را ساده می کند.
منابع
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی."],[],[],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)"]]