• Hi @MSkidmore454594 (Community Member)​ 

     

    CWE 117 (https://cwe.mitre.org/data/definitions/117.html) concerns the Log forging attack. It is flagged by the scanner whenever it finds a logging statement using some variables derived from untrusted sources. The application code does incorrectly neutralizes output that is written to logs.

     

    Please make sure the variables are cleansed for CRLF characters before concatenating with other hard-coded parts of the logging statement.

     

    Highly recommend using the supported cleansing functions from https://help.veracode.com/r/review_cleansers.

    Select the functions which address CWE 117 in particular.

    Alternatively, you can implement a CRLF cleanser, which filters out CRLF characters like (\n, \r, %0a, %0A, %0D, %0d ) from those variables. [A method that accepts a String and returns a String by replacing all the CRLF characters from it]. But with that approach, you will have to manually raise 'Mitigate By Design' proposals.

     

    Regards,

    Kashif

     

     

     

     

     

    Expand Post
  • Hi @MSkidmore454594 (Community Member)​ ,

     

    To add onto what @Kashif, Security Consultant (Veracode inc)​ mentioned. console.log will typically be used in 2 contexts. in the client side JS in a browser like Chrome or server-side in a runtime like Node.JS. But can also be used for example in the browser but also captured to a server side process.

     

    Veracode Static Analysis is unable to determine the context of a logging statement (indeed with modern practices like isomorphic JavaScript it may be impossible to determine unless at runtime).

     

    In general we recommend ensuring that an attacker will not be able to add log lines to any line delimited log file by ensuring that the data being logged does not have new lines. You can do this by removing newlines as @Kashif, Security Consultant (Veracode inc)​ mentioned but also by using a dataformat that simply does not have newlines like a Number:

     

    console.log("Got file of length " + +file.byteLength);

     

    Thank you,

    Boy Baukema

    Expand Post
    • HI @peterdevpl (Community Member)​ ,

       

      Unfortunately, Veracode Research has not been able to discover any properly implemented and broadly supported functions. If you have any ideas on this please consider registering them with Veracode Community Ideas at https://community.veracode.com/s/ideas .

       

      Veracode Static Analysis does automatically close flaws based on custom functions. You will need to document its use in a mitigation proposal ( https://help.veracode.com/r/improve_mitigation ) and have it manually reviewed by a member of your security team.

       

      Thank you,

      Boy Baukema

      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.