sreeramadasugiri (Community Member) asked a question.

How to fix Selection of Less-Secure Algorithm During Negotiation ('Algorithm Downgrade') (CWE ID 757) (6 flaws) in java

Dear Team,

Description: A protocol or its implementation supports interaction between multiple actors and allows those actors to negotiate which algorithm should be used as a protection mechanism such as encryption or authentication, but it does not select the strongest algorithm that is available to both parties. Effort to Fix: 1 - Trivial implementation error. Fix is up to 5 lines of code. One hour or less to fix.

Recommendations: Do not support SSLv2 or weak SSL/TLS ciphers (i.e. 56-bit key length or less, or other inherent weaknesses). 

 

My Java code is,

SSLContext sc = null;

try {

sc = SSLContext.getInstance("SSL"); -- error for CWE 757

logger.log(LogLevel.INFO, this.getClass().getName(), "SSL: ​"+sc);

} catch (NoSuchAlgorithmException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

I am getting CWE ID 757 error in the line "sc = SSLContext.getInstance("SSL");".

Can you help me to sort-out my issue.

Regards,

Giri


  • Hi @sreeramadasugiri (Community Member)​,

     

    Veracode Static Analysis reports CWE 757 ('Algorithm Downgrade') here because the `SSLContext` being used potentially allows insecure algorithms. SSL, as well as TLS versions below 1.2, are considered insecure and should no longer be used. To fix the flaw, please specify TLSv1.2 explicitly via `SSLContext.getInstance("TLSv1.2");`.

     

    Thank you,

    Florian Walter

    Expand Post

Topics (3)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.