JCorreia365843 (Community Member) asked a question.

What the solution for CWE-73 in C#? I have validated the path against System.IO.Path.GetInvalidPathChars() but Veracode still complaining about the code.

  • I can recommend looking at the following Community Article on how to fix CWE 73 flaws: https://community.veracode.com/s/article/how-do-i-fix-cwe-73-external-control-of-file-name-or-path-in-java (please note you must be logged in to the Community with a customer account).

    Though it has Java examples the same applies for .NET.

     

    Please note that System.IO.Path.GetInvalidPathChars() does not remove the security risk of an attacker being able to manipulate file paths as it only verifies that there are not invalid characters in the path (something like ../ which an attacker could use are valid characters and will not be blocked).

     

    Thank you,

    Boy Baukema

    Expand Post
  • JCorreia365843 (Community Member)

    Thanks for your response. But it seems that the article has no content.

    See screenshot below. I can only see the title.

     

    CWE73

  • Ah, sorry, thank you for letting me know! Looks like there is a problem with the access, I'll ask a Community administrator and let you know when it is available.

  • MMayerhofer153360 (Community Member)

    Hi,

     

    I have the same issue with accessing the article link, could you please also let me know once this is resolved.

     

    Thanks,

    Martin

    Expand Post
  • Asha, Customer Engagement (Veracode, Inc.)

    @JCorreia365843 (Community Member)​  & @MMayerhofer153360 (Community Member)​  - You should be able to see the article which Boy suggested. I apologize for the inconvenience. Please confirm. If the article helps answer your question, I would really appreciate it if you could select Boy's response as the Best Answer to help other Veracode Community members who have a similar inquiry. Thank you!

Topics (1)

No articles found
Loading

Ask the Community

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