Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-5542

Encryption algorithms should be used with secure mode and padding scheme

    XMLWordPrintable

    Details

    • Message:
      Use a secure mode and padding scheme.
    • Default Severity:
      Critical
    • Impact:
      High
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      ABAP, APEX, Cobol, CSS, Flex, Go, HTML, Kotlin, PL/I, PL/SQL, RPG, Ruby, Rust, Scala, Solidity, Swift, T-SQL, TypeScript, VB6, XML
    • Covered Languages:
      C#, C, C++, Java, JavaScript, Objective-C, PHP, Python, VB.Net
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      20min
    • Analysis Level:
      Syntactic Analysis
    • Analysis Scope:
      Main Sources
    • CERT:
      MSC61-J.
    • CWE:
      CWE-327, CWE-780
    • OWASP:
      A6, A3
    • SANS Top 25:
      Porous Defenses
    • FindSecBugs:
      ECB_MODE, PADDING_ORACLE, RSA_NO_PADDING
    • FxCop:
      CA5358

      Description

      Encryption operation mode and the padding scheme should be chosen appropriately to guarantee data confidentiality, integrity and authenticity:

      • For block cipher encryption algorithms (like AES):
        • The GCM (Galois Counter Mode) mode which works internally with zero/no padding scheme, is recommended, as it is designed to provide both data authenticity (integrity) and confidentiality. Other similar modes are CCM, CWC, EAX, IAPM and OCB.
        • The CBC (Cipher Block Chaining) mode by itself provides only data confidentiality, it's recommended to use it along with Message Authentication Code or similar to achieve data authenticity (integrity) too and thus to prevent padding oracle attacks.
        • The ECB (Electronic Codebook) mode doesn't provide serious message confidentiality: under a given key any given plaintext block always gets encrypted to the same ciphertext block. This mode should not be used.
      • For RSA encryption algorithm, the recommended padding scheme is OAEP.

      See

        Attachments

          Issue Links

          1.
          Java RSPEC-5543 Language-Specification Active Unassigned
          2.
          Kotlin RSPEC-5544 Language-Specification Active Unassigned
          3.
          C# RSPEC-5545 Language-Specification Active Unassigned
          4.
          PHP RSPEC-5568 Language-Specification Active Unassigned
          5.
          Python RSPEC-5620 Language-Specification Active Unassigned
          6.
          VB.Net RSPEC-5638 Language-Specification Active Unassigned
          7.
          JavaScript RSPEC-5670 Language-Specification Active Unassigned
          8.
          C-Family RSPEC-5891 Language-Specification Active Unassigned

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              eric.therond Eric Therond
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: