Skip to content

Conversation

@LWSimpkins
Copy link
Collaborator

Update MaD for C# related to SSRF and URL path traversal scenarios. Some of these are regressions from 2.19.4 to 2.20.0 upgrade, some were missing before that.

HttpRequestMessage

  • Change MaD so constructor for Uri parameter matches string parameter, where the taint is to the class object instead of an internal synthetic field

  • Example:

    HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, new Uri(untrustedUrl)); // Fixed regression. Now the `request` variable is considered tainted again
    (new HttpClient()).SendAsync(request); // SSRF can be flagged again
    

UriBuilder

  • Add missing variants of the constructor

  • Add get/set property methods to support dataflow for MemberInitializer in ObjectInitializer

  • Examples:

    (new HttpClient()).GetAsync(new UriBuilder("https", untrustedHost).Uri); // Fixed regression. Now `untrustedHost` flows to synthetic `Uri` field, which is used in the `get_Uri` MaD model
    
    (new HttpClient()).GetAsync(new UriBuilder("https", untrustedHost, 443).Uri); // Added constructor variant that was previously missing
    
    // Added get/set property methods for MemberInitializer in ObjectInitializer
      var uriBuilder = new UriBuilder
      {
          Scheme = "https",
          Host = untrustedHost,
          Port = 443,
      };
      (new HttpClient()).GetAsync(uriBuilder.Uri);
    

@LWSimpkins
Copy link
Collaborator Author

Merged from upstream

@LWSimpkins LWSimpkins closed this Mar 28, 2025
@LWSimpkins LWSimpkins deleted the csharp-update-MaD branch March 28, 2025 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants