
GBhatnagar521131 (Community Member) asked a question.
Hello,
I received a security flaw during Veracode scan of my Windows C# EXE App and its DLLs on the following LINE in BOLD.
Untrusted Search Path(1 flaw)
Uncontrolled Search Path Element (CWE ID 427)(1 flaw)
string authorizationRequest = ProbeAgent.Adapters.MicrosoftOneDrive.OneDriveClient.GetDefaultLogoutUri();
System.Diagnostics.Process.Start(authorizationRequest);
.....
.....
public const string DefaultReturnUri = "http://localhost/authorize";
public static string GetDefaultLogoutUri()
{
return "https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri=" + OneDriveClient.DefaultReturnUri;
}
Can you please let me know how to fix this.
Thanks,
Gagan
.png)
Hi @GBhatnagar521131 (Community Member)
I recommend below In order to address this finding CWE 427 on attack vector System.Diagnostics.Process.Start() :
After reviewing and confirming the above guidelines, you can consider raising Mitigation by design proposal for this findings.
If you still have questions I would recommend you schedule a consultation call to discuss.
You can check out this knowledge article (https://community.veracode.com/s/article/How-to-schedule-a-consultation-call) on how to schedule a consultation call with us.
Regards,
Kashif.
Hello @Kashif, Security Consultant (Veracode inc)
Thank-you for your reply.
I am opening the URL in browser using C# code. Below is the modified version of the previous code snippet I shared. I have now hard-coded the entire URL string and used AllowList approach. It still reports Uncontrolled Search Path Element (CWE ID 427)(1 flaw)
string authorizationRequest = "https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri=http://localhost/authorize";
List<string> Allowlist = (List<string>)(new String[] { "https://login.microsoftonline.com/common/oauth2/v2.0/logout? post_logout_redirect_uri=http://localhost/authorize" }).ToList(); ;
if (Allowlist.Contains(authorizationRequest))
{
System.Diagnostics.Process.Start(authorizationRequest);
}
Please suggest.
Thanks,
Gagan