Web Proxy Auto Discovery (WPAD) (2024)

Back in the mid-aughts, Adam G., a colleague on the IE team, used the email signature “IE Networking Team – Without us, you’d be browsing your hard drive.” And while I’m sure it was meant to be a bit tongue-in-cheek, it’s really true– without a working network stack, web browsers aren’t nearly as useful.

Background on Proxy Determination

One of the very first things a browser must do on startup is figure out how to send requests over the network. Typically, the host operating system already provides the transport (TCP/IP, UDP) and lower-level primitives, so the browser’s first task is to figure out whether or not web requests should be sent through a proxy. Until this question is resolved, the browser cannot send any network requests to load pages, sync profile information, update phishing blocklists, etc.

In some cases, proxy determination is simple— the browser is directly configured to ignore proxies, or to send all requests to a directly specified proxy.

However, for convenience and to simplify cases where a user might move a laptop between different networks with different proxy requirements, all major browsers support an algorithm called “Web Proxy Auto Discovery”, or WPAD. The WPAD process is meant to find and download a Proxy AutoConfiguration Script (PAC) for the current network.

The steps of the WPAD protocol are straightforward, if lengthy:

  1. Determine whether WPAD should be used, either by looking at browser settings or asking the host operating system if the browser is configured to match the OS setting.
  2. Ensure the network is ready.
  3. If WPAD is to be used, issue a DHCPINFORM query to ask for the URL of the PAC script to use.
  4. If the DHCPINFORM query fails to return a URL, perform a DNS lookup for the unqualified hostname wpad.
  5. If the DNS lookup succeeds, then the PAC URL shall be http://wpad/wpad.dat.
  6. Establish a HTTP(S) connection to discovered URL’s server and download the PAC script.
  7. If the PAC script downloads successfully, parse and optionally compile it.
  8. For each network request, call FindProxyForURL() in the PAC script and use the proxy settings returned from the function.

While conceptually simple, any of these steps might fail, and any failure might prevent the browser from using the network.

Performance

… or “Why on earth do I see Downloading proxy script… for a few seconds every time I start my browser!??!”

A Microsoft Edge feature team reached out to the networking team this week asking for help with an observed 3 second delay in the initialization of their feature. They observed that this delay magically disappeared if Fiddler happened to be running.

With symptoms like that, proxy determination is the obvious suspect, because Fiddler specifies the exact proxy configuration for browsers to use, meaning that they do not need to perform the WPAD process.

We asked the team to take an Edge network trace using the “Capture on Startup” steps. Sure enough, when we analyzed the resulting NetLog, we found almost exactly three seconds of blocking time during startup:

t= 52 PROXY_CONFIG_CHANGED --> new_config = Auto-detectt= 52 +PAC_FILE_DECIDER t= 52 PAC_FILE_DECIDER_WAIT t=2007 +PAC_FILE_DECIDER_FETCH_PAC_SCRIPT --> source = "WPAD DHCP"t=2032 -PAC_FILE_DECIDER_FETCH_PAC_SCRIPT --> net_error = -348 (ERR_PAC_NOT_IN_DHCP) t=2032 PAC_FILE_DECIDER_FALLING_BACK_TO_NEXT_PAC_SOURCE t=2032 +HOST_RESOLVER_IMPL_REQUEST --> host = "wpad:80" t=3033 CANCELLED

Note: Timestamps [e.g. t=52] are shown in milliseconds.

Because the browser took a full three seconds to decide whether or not to use a proxy, every feature that relies on the network will take at least three seconds to get the data it needs.

So, where’s the delay coming from? In this case, the delay comes from two places: a two second delay for PAC_FILE_DECIDER_WAIT and a one second delay for the DNS lookup of wpad.

The two second PAC_FILE_DECIDER_WAIT [Step #2] is a deliberate delay that is meant to delay PAC lookups after a network change event is observed, to accommodate situations where the browser is notified of a network change by the Operating System before the network is truly “ready” to perform the DHCP/DNS/Download steps of WPAD. In this browser-startup case, we haven’t yet figured out why the browser thinks a network change has occurred, but the repro is not consistent and it seems likely to be a bug.

The (failing) DNS lookup [Step #3] might’ve taken even longer to return, but it timed out after one second thanks to an enabled-by-default feature called WPADQuickCheckEnabled.

This three second delay on startup is bad, but it could be even worse. We got reports from one Microsoft employee that every browser startup took around 21 seconds to navigate anywhere. In looking at his network log, we found that the wpad DNS lookup [Step #5] succeeded, returning an IP address, but the returned IP was unreachable and took 21 seconds to timeout during TCP/IP connection establishment.

What makes these delays especially galling is that they were all encountered on a network that does not actually need a proxy!

Failures

Beyond the time delays, each of these steps might fail, and if a proxy is required on the current network, the user will be unable to browse until the problem is corrected.

For example, we recently saw that [Step #7] failed for some users because the Utility Process running the PAC script always crashed due to forbidden 3rd-party code injection. When the Utility Process crashes, Chromium attempts to bypass the proxy and send requests directly to the server, which was forbidden by the Enterprise customer’s network firewall.

We’ve also found that care must be taken in the JavaScript implementation of FindProxyForURL() [Step #8] because script functions behave slightly differently across different browsers. In most cases, scripts work just fine across browsers, but sometimes corner cases are encountered that require careful handling.

Script Download

In Chromium, if a PAC script must be downloaded, it is fetched bypassing the cache.

Even if we were to comment out the LOAD_DISABLE_CACHE directive in the fetch, this wouldn’t allow reuse of a previously downloaded script file– my assumption is that the download is happening in a NetworkContext that doesn’t actually have a persistent cache, but I haven’t looked into this.

The PAC script fetches will be repeated on network change or browser restart.

Security

WPAD is something of a security threat, because it means that another computer on your network might be able to become your proxy server without you realizing it. In theory, HTTPS traffic is protected against malicious proxy servers, but non-secure HTTP traffic hasn’t yet been eradicated from the web, and users might not notice if a malicious proxy performed an SSLStripping attack on a site that wasn’t HSTS preloaded, for example.

Note: Back in 2016, it was noticed that the default Chromium proxy script implementation leaked full URLs (including HTTPS URLs’ query strings) to the proxy script; this was fixed by truncating the URL to the hostname. (In the new world of DoH, there’s some question as to whether we might be able to avoid sending the hostname to the proxy at all).

Edge Legacy and Internet Explorer have a surprising default behavior that treats sites for which a PAC script returns DIRECT (“bypass the proxy for this request“) as belonging to your browser’s Intranet Zone.

This mapping can lead to functionality glitches and security/privacy risks. Even in Chrome and the new Edge, Windows Integrated Authentication still occurs Automatically for the Windows Intranet Zone, which means this WPAD Zone Mapping behavior is still relevant in modern browsers.

Web Proxy Auto Discovery (WPAD) (1)

Edge Legacy and Internet Explorer

Interestingly, performance and functionality problems with WPAD might have been less common for the Edge Legacy and Internet Explorer browsers on Windows 10. That’s because both of these browsers rely upon the WinHTTP Web Proxy Auto-Discovery Service:

Web Proxy Auto Discovery (WPAD) (2)

This is a system service that handles proxy determination tasks for clients using the WinHTTP/WinINET HTTP(S) network stacks. Because the service is long-running, performance penalties are amortized (e.g. a 3 second delay once per boot is much cheaper than a 3 second delay every time your browser starts), and the service can maintain caches across different processes.

Chromium does not, by default, directly use this service, but it can be directed to do so by starting it with the command-line argument:

--winhttp-proxy-resolver

A Group Policy that matches the command-line argument is also available.

SmartWPAD

Prior to the enhancement of the WinHTTP WPAD Service, a feature called SmartWPAD was introduced in Internet Explorer 8’s version of WinINET. SmartWPAD caches in the registry a list of networks on which WPAD has not resulted in a PAC URL, saving clients the performance cost of performing the WPAD process each time they restarted for the common case where WPAD fails to discover a PAC file:

Web Proxy Auto Discovery (WPAD) (3)

Cache entries would be maintained for a given network fingerprint for one month. Notably, the SmartWPAD cache was only updated by WinINET, meaning you’d only benefit if you launched a WinINET-based application (e.g. IE) at least once a month.

When a client (including IE, Chrome, Microsoft Edge, Office, etc) subsequently asks for the system proxy settings, SmartWPAD checks if it had previously cached that WPAD was not available on the current network. If so, the API “lies” and says that the user has WPAD disabled.

The SmartWPAD feature still works with browsers running on Windows 7 today.

Notably, it does not seem to function in Windows 10; the registry cache is empty. My Windows 10 Chromium browsers spend ~230ms on the WPAD process each time they are fully restarted.

Update: The WinINET team confirms that SmartWPAD support was removed after Windows 7; for clients using WinINET/WinHTTP it wasn’t needed because they were using the proxy service. Clients like Chromium and Firefox that query WinINET for proxy settings but use their own proxy resolution logic will need to implement a SmartWPAD-like feature optimize performance.

Disabling WPAD

If your computer is on a network that doesn’t need a proxy, you can ensure maximum performance by simply disabling WPAD in the OS settings.

By default (if not overridden by policy or the command line), Chromium adopts the Windows proxy settings by calling WinHttpGetIEProxyConfigForCurrentUser.

On Windows, you can thus turn off WPAD by default by using the Internet Control Panel (inetcpl.cpl) Connections > LAN Settings dialog, or the newer Windows 10 Settings applet’s Automatic Proxy Setup section:

Web Proxy Auto Discovery (WPAD) (4)

Simply untick the box and browsers that inherit their default settings from Windows (Chrome, Microsoft Edge, Edge Legacy, Internet Explorer, and Firefox) will stop trying to use WPAD.

Looking forward

WPAD is convenient, but somewhat expensive for performance and a bit risky for security/privacy. Every few years, there’s a discussion about disabling it by default (either for everyone, or for non-managed machines), but thus far none of those conversations has gone very far.

Ultimately, we end up with an ugly tradeoff– no one wants to land a change that results in users being limited to browsing their hard drives.

If you’re an end user, consider unticking the “Automatically Detect Settings” checkbox in your Internet settings. If you’re an enterprise administrator, consider deploying a policy to disable WPAD for your desktop fleet.

-Eric

Web Proxy Auto Discovery (WPAD) (2024)

FAQs

Should I disable WPAD? ›

The best security is achieved by disabling WPAD; however, doing so necessitates manually setting up proxy settings on each device. If you are unable to disable Web Proxy Auto-Discovery, think about implementing firewalls and using caution when visiting websites as extra security measures.

How to check if WPAD is working? ›

To confirm the WPAD service is running on a Window machine:
  1. On the Windows machine, open a command prompt with administrator privileges.
  2. Enter this command to check the status of the WPAD service: sc query winhttpautoproxysvc.
  3. Confirm that the reported state is RUNNING. For example, these results should appear.

What does auto proxy discovery do? ›

Web Proxy Auto-Discovery (WPAD) is an internet protocol used by web browsers to automatically locate cache services within a network. This protocol ensures that all devices on a network use the same web proxy configuration.

How do I disable WPAD in Chrome? ›

Go to %systemdrive%\Windows\System32\Drivers\etc\hosts. Create the following entry for WPAD in the host file: wpad (or 127.0. 0.1). Computer Configurations -> Policies -> Windows Settings -> Security Settings -> System Services; Edit the policy “WinHTTP WebProxy Auto-Discover Service” and set the policy to “Disabled”.

Is it bad to turn off proxy? ›

Disabling proxy settings can protect your privacy and improve network performance in some cases.

What are the risks of WPAD? ›

If an attacker registers a domain to answer leaked WPAD queries and configures a valid proxy, there is potential to conduct man-in-the-middle (MitM) attacks across the Internet. The WPAD vulnerability is significant to corporate assets such as laptops.

How do I know if my proxy is active? ›

  1. Right-click on the Start button and click Setting.
  2. Go to Network & Internet > Proxy.
  3. See if the Use a proxy server option is on.

How do I know if my proxy is working? ›

The easiest way to check the proxy status is by visiting ip2location.com. This IP database, which is widely considered to be one of the most accurate, allows you to check the details of your IP address, including the likely usage type.

How do I check my proxy issues? ›

You can check your proxy very quickly by clicking Start, and then Run, typing “cmd”, and finally clicking on OK. At the command prompt, type “netsh winhttp show proxy”, and then hit ENTER.

Should proxy be turned on? ›

If you want to change your IP and use an anonymous proxy server, it's best to keep it on. If not, then it should always be off. Routing your web traffic through a proxy server may increase data usage and an overall drop in internet speeds.

Can I turn off automatically detect proxy settings? ›

Search for Settings and open it. Select Network & Internet. From the left pane, click on Proxy. Under Automatic proxy setup, turn off Automatically detect settings option.

Should I enable proxy? ›

5 reasons you should use an online web proxy
  1. Control internet access. This is for all the concerned parents or productivity-minded bosses out there. ...
  2. Improve privacy. ...
  3. Access blocked sites. ...
  4. Improve speed and save bandwidth. ...
  5. Improve security.
Apr 22, 2024

Does Chrome support WPAD? ›

Google Chrome offers the functionality to configure the proxy settings by automatic discovery using WPAD (Web Proxy Auto-Discovery Protocol). Setting this configures the proxy settings for Chrome and ARC-apps, which ignore all proxy-related options specified from the command line.

What is WPAD Rogue Proxy Server? ›

The Web Proxy Automatic Discovery (WPAD) protocol helps clients in finding a proxy configuration script ( wpad. dat ). This script gives a set of proxies that can be used, and can be located with an hostname or an URL. Various mechanisms can be used to find its location (by order of resolution): WinHTTP/WinINET.

How to remove proxy authentication? ›

Clear proxy credentials in Chrome & Edge
  1. Turn your proxy off.
  2. Open Clear Browsing Data ( Ctrl+Shift+Del or Cmd+Shift+Del )
  3. Select Cookies and other site data.
  4. Select Passwords and other sign-in data (Chrome) or Passwords (Edge)
  5. Select a suitable time range (e.g. Last hour)
  6. Click Clear data.
Jun 9, 2021

What does WPAD stand for on a Windows network? ›

The Web Proxy Auto-Discovery (WPAD) Protocol is a method used by clients to locate the URL of a configuration file using DHCP and/or DNS discovery methods.

Is WPAD enabled by default? ›

Security researchers warn that WPAD, which is enabled by default on Windows and supported by other operating systems, could expose computer users' online accounts, web searches, and other private data.

How to clear WPAD cache? ›

Clearing WPAD cache and settings (solution)
  1. Step 1: Regedit. Computer\HKEY_USERS\S-1-5-19\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Wpad: delete all underlying keys.
  2. Step 2: Internet Options. ...
  3. Step 3: CMD as admin. ...
  4. Step 4: reboot the machine twice.
Jun 13, 2023

What is WPAD Windows 10? ›

Description. GNU Wget is a free network utility to retrieve files from the World Wide Web using HTTP and FTP, the two most widely used Internet protocols. It works non-interactively, thus enabling work in the background, after having logged off.

Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 5886

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.