Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4208c3d
insecure-biometrics-swift
ESS-ENN Sep 5, 2024
2d4ea63
plaintext-http-link-html
ESS-ENN Sep 5, 2024
586888d
desede-is-deprecated-java
ESS-ENN Sep 5, 2024
9015c09
desede-is-deprecated-kotlin
ESS-ENN Sep 5, 2024
68be70d
sizeof-this-c
ESS-ENN Sep 5, 2024
3d453a8
cbc-padding-oracle-java
ESS-ENN Sep 5, 2024
e7b4680
no-null-cipher-java
ESS-ENN Sep 5, 2024
1ba2958
rsa-no-padding-java
ESS-ENN Sep 5, 2024
f182a4b
changed folder position of no-null-cipher-java
ESS-ENN Sep 5, 2024
ac0edaa
rsa-padding-set-scala
ESS-ENN Sep 5, 2024
650b88b
xmlinputfactory-dtd-enabled-scala
ESS-ENN Sep 5, 2024
b0c6e4e
Incorporated changes suggested by CodeRabbit Bot
ESS-ENN Sep 6, 2024
bd0bc1d
httponly-false-csharp
ESS-ENN Sep 6, 2024
5507b0a
reqwest-accept-invalid-rust
ESS-ENN Sep 6, 2024
456f431
libxml2-audit-parser-c
ESS-ENN Sep 6, 2024
30f9ae3
libxml2-audit-parser-cpp
ESS-ENN Sep 7, 2024
0970f4f
oracleconnectionstringbuilder-hardcoded-secret-csharp
ESS-ENN Sep 9, 2024
081bad0
ecb-cipher-java
ESS-ENN Sep 9, 2024
bec0b7e
Changed severity for 3 rules as suggested by Bot
ESS-ENN Sep 10, 2024
472fa36
use-of-weak-rsa-key-java
ESS-ENN Sep 10, 2024
5fea8a2
unencrypted-socket-java
ESS-ENN Sep 10, 2024
a85cbfb
use-of-weak-rsa-key-kotlin
ESS-ENN Sep 10, 2024
22b3dca
removing oracleconnectionstringbuilder-hardcoded-secret-csharp
ESS-ENN Sep 12, 2024
090e6af
use-of-md5-digest-utils-java
ESS-ENN Sep 12, 2024
fc5f3a1
weak-ssl-context-java
ESS-ENN Sep 12, 2024
bf350e6
use-of-rc4-java
ESS-ENN Sep 12, 2024
85c6f95
system-setproperty-hardcoded-secret-java
ESS-ENN Sep 12, 2024
07abf42
rsa-no-padding-kotlin
ESS-ENN Sep 12, 2024
126ec00
des-is-deprecated-java
ESS-ENN Sep 12, 2024
b62d49a
des-is-deprecated-kotlin
ESS-ENN Sep 12, 2024
ae12535
Made changes as per suggestions of coderabbit ai bot
ESS-ENN Sep 13, 2024
1326f4c
use-of-md5-java
ESS-ENN Sep 13, 2024
d26328d
use-of-sha1-java
ESS-ENN Sep 13, 2024
57c1edb
system-setproperty-hardcoded-secret-kotlin
ESS-ENN Sep 13, 2024
b679216
use-of-aes-ecb-java
ESS-ENN Sep 13, 2024
6ff4438
use-of-blowfish-java
ESS-ENN Sep 13, 2024
66dff6f
Update of use-of-md5-java
ESS-ENN Sep 13, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
no-null-cipher-java
  • Loading branch information
ESS-ENN committed Sep 5, 2024
commit e7b4680ecd928296e4d4d405aea7a4dbffd952bb
17 changes: 17 additions & 0 deletions rules/c/security/no-null-cipher-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
id: no-null-cipher-java
severity: warning
language: java
message: >-
NullCipher was detected. This will not encrypt anything; the cipher
text will be the same as the plain text. Use a valid, secure cipher:
Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions
for more information.
note: >-
[CWE-327] Use of a Broken or Risky Cryptographic Algorithm.
[REFERENCES]
- https://owasp.org/Top10/A02_2021-Cryptographic_Failures
rule:
any:
- pattern: new NullCipher($$$)
- pattern: new javax.crypto.NullCipher($$$)
10 changes: 10 additions & 0 deletions tests/__snapshots__/no-null-cipher-java-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
id: no-null-cipher-java
snapshots:
? |-
Cipher doNothingCihper = new NullCipher();
new javax.crypto.NullCipher();
: labels:
- source: new NullCipher()
style: primary
start: 25
end: 41
8 changes: 8 additions & 0 deletions tests/java/no-null-cipher-java-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id: no-null-cipher-java
valid:
- |
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
invalid:
- |
Cipher doNothingCihper = new NullCipher();
new javax.crypto.NullCipher();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Cases Correctly Demonstrated

The test cases are well-formed:

  • The valid test case correctly uses a secure cipher configuration.
  • The invalid test cases effectively demonstrate the security issue this rule aims to detect.

Static Analysis Hint: Missing New Line at End of File

To comply with YAML standards and static analysis tools, add a newline at the end of the file. This can be fixed by ensuring your text editor is configured to automatically add new lines at the end of files or by manually adding a newline.

+ 
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
invalid:
- |
Cipher doNothingCihper = new NullCipher();
new javax.crypto.NullCipher();
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
invalid:
- |
Cipher doNothingCihper = new NullCipher();
new javax.crypto.NullCipher();
Tools
yamllint

[error] 8-8: no new line character at the end of file

(new-line-at-end-of-file)