rrg (Community Member) asked a question.

Fixing CWE ID 757 for Android

CWE-757: Selection of Less-Secure Algorithm During Negotiation ('Algorithm Downgrade') is a new flaw that is now showing up for our Android Codebase. The first line below is what the scan points to:

HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

sc = SSLContext.getInstance("TLS");

 

Looking at the Android documentation, it does not look like we are doing anything incorrect here? Not sure what the fix should be so any help is appreciated!


  • Hi @rrg (Community Member)​ ,

     

    Great question! Veracode Static Analysis reports CWE 757 when it detects that you are allowing cipher suites that aren't the most secure ones available. In your particular case, you seem to be allowing all TLS versions, including v1.0 and v1.1 which aren't considered best practices anymore. We recommend that you either change the instance explicitly to TLSv1.2 or, if your library allows it, keep the general TLS but explicitly disallow versions v1.0 and v1.1.

     

    Thank you,

    Florian Walter

    Expand Post
    Selected as Best
  • Hi @rrg (Community Member)​ ,

     

    Great question! Veracode Static Analysis reports CWE 757 when it detects that you are allowing cipher suites that aren't the most secure ones available. In your particular case, you seem to be allowing all TLS versions, including v1.0 and v1.1 which aren't considered best practices anymore. We recommend that you either change the instance explicitly to TLSv1.2 or, if your library allows it, keep the general TLS but explicitly disallow versions v1.0 and v1.1.

     

    Thank you,

    Florian Walter

    Expand Post
    Selected as Best
    • rrg (Community Member)

      Thank you! Tried explicitly setting "TLSv1.2" and the sandbox scan no longer shows the flaw. I'm wondering if Android somehow selects the highest possible TLS version under the hood when protocol is only specified as "TLS" without a version? This is because our servers have been using v1.2 but the app is able to connect with the protocol just set to "TLS".

  • @rrg (Community Member)​ , whenever a client connects to a server, they will choose the safest possible version of SSL/TLS which both support. However, a man-in-the-middle (which is fairly easy to become e.g. in a public WiFi) intercepting the connection might be able to trick the server into thinking that the client does only support an unsafer version than TLSv1.2, i.e. the attacker downgrades the version of TLS being used.

    • rrg (Community Member)

      Got it, thank you!

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.