Lucene search

K
filippoioFilippo ValsordaFILIPPOIO:6250DAC0EF002CD2833DF5965F777CE4
HistorySep 16, 2017 - 2:47 p.m.

A secure captive portal browser with automatic DNS detection

2017-09-1614:47:47
Filippo Valsorda
blog.filippo.io
983

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

9.3 High

CVSS2

Access Vector

NETWORK

Access Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:M/Au:N/C:C/I:C/A:C

0.009 Low

EPSS

Percentile

81.0%

Captive portals are the worst.

Flaky detection. The OS and browser try to detect these annoying network features but fail quite often, leaving you with broken connections.

> DID YOU KNOW that probe-based captive portal detection really doesn’t work very well, with ~30% FP and ~30% FN rate in Chrome?
>
> – Emily Stark (@estark37) 15 September 2017

Attack surface. Even if it worked reliably, you wouldn’t want to use the OS automatic captive portal browser for security reasons. Since it can be triggered by a network attacker without user interaction, it’s the perfect target. It had vulnerabilities before and there is no information about whether it’s up to date and sandboxed. There’s also no option to disable Javascript or install security extensions.

DNS. I want to pick my own DNS server, and more specifically run my own unbound, for a number of reasons: clean results, local zones, overrides, DNSSEC… However most captive portals will block UDP traffic to anything except their DNS resolver (or would be trivially bypassed). So every time getting past a captive portal involves opening Network Settings, removing the custom DNS, logging in, and hopefully (that is, rarely) remember to put the custom DNS server back in.

HTTP. Finally, since a captive portal literally relies on a MitM attack, it results inaccessible when using HTTPS Everywhere in “Block all unencrypted requests” mode.

To recap, logging in involves resetting the DNS server, opening an Incognito window, enabling Javascript, maybe fumbling with cookies, logging in, and reverting DNS settings.

A dedicated Chrome captive browser

To scratch this itch I decided to make my own captive portal browser based on Chrome, such that it can be secure and configured as I please.

The main challenge is reaching the DHCP-provided captive portal DNS resolver without changing system settings. Chrome lacks the ability to configure DNS upstreams, but supports SOCKS5 which proxies name resolution.

With 100 lines of Go I built a small SOCKS5 proxy based on github.com/armon/go-socks5 that handles name resolution via a custom net.Resolver that always dials a fixed IP for the DNS server.

It automatically discovers the DHCP DNS server on macOS with this command:

ipconfig getoption en0 domain_name_server  

Finally it starts a Chrome instance configured to use the SOCKS5 proxy with the following command and waits for it to quit:

open -n -W -a "Google Chrome" --args \  
--user-data-dir="$HOME/Library/Application Support/Google/Captive" \
--proxy-server="socks5://$PROXY" \
--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost" \
--no-first-run --new-window --incognito \
http://example.com  

The separate --user-data-dir allows it to run alongside your normal Chrome instance, while still being (separately) configurable and --incognito ensures that no state is preserved across executions.

The commands can be configured with a TOML file to make the tool work on other operating systems.

Usage boils down to running captive-browser and logging into the captive portal from a secure, configurable, ephemeral environment. All without touching DNS settings.

Find the tool at github.com/FiloSottile/captive-browser and me on Twitter.

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

9.3 High

CVSS2

Access Vector

NETWORK

Access Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:M/Au:N/C:C/I:C/A:C

0.009 Low

EPSS

Percentile

81.0%

Related for FILIPPOIO:6250DAC0EF002CD2833DF5965F777CE4