Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: update MaD for HttpRequestMessage and UriBuilder #162

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

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);
    

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.

1 participant