-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Chrome and Firefox's current implementations (affected versions listed below) appear to enforce LNA after a local connection has been established. Doing LNA checks post-connection allows an adversary to misuse connection handshakes to transmit identifiers from public to local contexts, similar to the Local Mess abuse (https://localmess.github.io). Two working methods are as follows:
TLS SNI-based: The web script sends an HTTPS request to unique_id_1234.localtest.me:8080, which resolves to 127.0.0.1 due to a wildcard DNS record. Because the request uses HTTPS, the browser includes the full hostname in the TLS ClientHello's Server Name Indication (SNI) field. The local server/app listening on 127.0.0.1:8080 can then extract the subdomain from the SNI extension, recovering the embedded data (unique_id_1234) from the raw packet. An Android PoC app printing the SNI field is given below (lna.quest domain has a wildcard DNS record=127.0.0.1):
IP–based: As the whole 127.x.x.x /8 IP range can be used to communicate with localhost, the IP address itself can be used to encode the identifier to be transmitted. For example, the three last octets can be used to embed a unique ID, or multiple requests can be sent to transmit larger payloads in parts. The server can extract the local IP address from the TCP SYN packet using getsockname and decode the characters contained within.
Both methods are tested on Chrome Stable v145.0.7632.77, Firefox Nightly v150.0a1 and Chrome Canary 147.0.7701.0. The SNI-based method triggers a prompt on Firefox Nightly, but no prompt is shown on Chrome Stable or Canary. If a successful connection is established with the server, the permission prompt is triggered on both browsers. However, if a user selects “block” on the prompt, browsers still attempt to establish the connection first. Thus, the adversary can transmit identifiers from public to local via the TCP or TLS handshakes.
A comment in issue #44 notes Chrome’s plan to move the LNA prompt and check before a connection is established. We were wondering if the LNA spec will be updated to align with that change (pre-connection checks and prompts), or whether the exact time of the prompt/enforcement will be left to user agents. Perhaps being more specific would be beneficial for implementation consistency.
Doing the LNA enforcement pre-connection will obviously have a usability cost: for example, requests to sinkholed domains will now trigger LNA prompts, even if there’s no local server/app that would receive the request.
Two “bypasses” we describe above have limitations: they allow for ID sharing, but the adversary may not receive confirmation for the sent payload. DNS Rebinding and similar attacks that require sending HTTP requests are also not possible through these bypasses.
We are happy to share the PoC source code, if it helps any vendors reproduce the problem.
Mostafa Ansar (IP bypass), Stefan van Ieperen (SNI bypass) and the localmess team.