Security vulnerability: Auth Bypass in Dart due to incorrect parsing of the backslash characters in the URL #50075
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-core
type-enhancement
A request for a change that isn't a bug
TL;DR: Backslash is not recognized as equivalent to forward slash in URLs, leading to potential auth bypasses in web apps
There is a Auth Bypass vulnerability in your service at https://github.com/dart-lang/sdk.
URI parsing is done in https://github.com/dart-lang/sdk/blob/main/sdk/lib/core/uri.dart (likely around this part but didn't find the exact place)
The dart:uri library is a core dart library that is used to parse and validate URLs. However, it is vulnerable to the "backslash-trick" due to incorrect parsing of the backslash characters in the URL. This can be used to bypass certain types of URL validation checks and when used in conjunction with the dart:html library can lead to issues such as CSRF, XSS etc.
The dart:html library exposes fairly powerful web APIs to the developer such as the the iframe API, window.location API, object elements and the lower-level fetch API to name a few. In traditional web development, the developer is responsible for safegaurding and validating the data that is consumed by these APIs. For example, the developer might write the following code to validate the URL that is passed to the src attribute to a iframe from a user-supplied source:
However, when writing something similar for Dart, the check against the host (using the URI) class can be bypassed and would not be complete.
The code above is not safe because the developer is not able to guarantee that the URL is valid. A input like http://othersite.com\@google.com/ (or http://othersite.com:123\@google.com/) will be evaluated to have a hostname of google.com whereas the browser would resolve this to othersite.com loading the attacker controlled domain in the iframe. This could lead to unwanted disclosure of data to the attacker or even a cross-site scripting attack depending on how the messages between the two frames are being handled.
The text was updated successfully, but these errors were encountered: