Cryptography / Weak Cryptography

Web and API


Weak Cryptography (CWE-327) is a vulnerability related to cryptography which occurs when an application or system uses cryptographic algorithms that are insecure or have known weaknesses. The main risk of this vulnerability is that attackers can easily break the weak cryptography, allowing them to decipher the encrypted data. As defined by the OWASP Testing Guide, this vulnerability can be found in web and API applications.


Weak cryptography can put information at risk of being stolen or manipulated, due to its lack of robustness. In addition, weak cryptography can also increase the risk of brute-force attacks, dictionary attacks, and other types of attacks. The risk assessment for this vulnerability is high as it can lead to data breaches or other security incidents.


The best way to mitigate the risk associated with weak cryptography is to ensure that strong cryptography is used in all applications and systems. This means using algorithms such as AES-256 or higher, and using longer key lengths when available. It is also important to use the latest algorithms and protocols, as older algorithms may be vulnerable to attack.


The following code example demonstrates a vulnerable cryptography algorithm (CWE-327):

String plainText = "Test";
String encryptedText = Base64.encodeToString(plainText.getBytes(), Base64.DEFAULT);
String decryptedText = new String(Base64.decode(encryptedText, Base64.DEFAULT));

In this example, the plain text is encrypted using the Base64 algorithm, which is known to be weak and vulnerable to attack. Therefore, this code should be replaced by a stronger cryptographic algorithm.

Curious? Convinced? Interested?

Arrange a no-obligation consultation with one of our product experts today.