The 20 most dangerous PAC mistakes
Ranked by the harm a mistake does when it is in the file, with the mistakes that let traffic past the proxy first. How often each mistake appears in real PAC files is shown in the table before the list. Most of them do not break anything visibly; they quietly route traffic around the proxy.
A PAC file is a small JavaScript program that tells the browser, for every request, whether to use a proxy (what a PAC file is). It is short, but it decides the route of all web traffic, and it is rarely tested. That makes a few kinds of mistakes very common.
Most of them have one thing in common: they fail open. “Fail open” means that the error does not stop traffic; it sends traffic directly to the internet, past the proxy. So nobody calls the help desk, and the mistake can stay in the file for years.
How often the mistakes appear in real files
About a third of the PAC files checked with this tester do not parse at all (PAC-E001). A browser cannot run such a file and connects directly, without a message. The table shows how often the other common mistakes appear in the files that do parse, and where each one stands in the ranked list below.
| Mistake | Share of the files that parse | Rank in the list |
|---|---|---|
| The host is compared without lower-casing it first | about 73% | #20 |
| A DNS lookup comes before the rules that need none | about 52% | #13, #16 |
| A host pattern also matches look-alike domains | about 49% | #3, #4, #5 |
| The script throws, returns nothing or returns an invalid value for some addresses | about 38% | #1, #7 |
The route depends on myIpAddress() | about 26% | #19 |
| The same condition appears twice (PAC-C013) | about 26% | not in the list |
| An IP range is matched as text, or with the wrong mask | about 22% | #9, #17 |
A host pattern is applied to url instead of host | about 18% | #2 |
The figures are rounded shares of the files checked with this tester since 2025. No file, no file content, no names and no addresses are published, and there are no counts. The PAC file statistics explain how the figures are made and show the grades.
How the list is ordered
The list is not ordered by how often a mistake appears. It is ordered by the harm a mistake does when it is in the file. The mistakes that send traffic past the proxy without anyone noticing, or that let an outsider choose the route, come first. The mistakes that slow requests down or make a rule miss come after them. The most common mistake, a host that is not lower-cased, is last for that reason: it makes some rules miss on Windows, but it does not open the network.
Each entry links to the rule in the rule catalogue with a bad example, a fixed example and the reason. To check your own file for all of them at once, paste it into the PAC file tester. When one URL goes the wrong way, the tester’s live trace shows the line that decided, and the article PAC file troubleshooting lists the usual causes. If you prefer the positive version, the page on how to optimize and improve a proxy.pac lists what to do instead.
- #1
A broken PAC plus a permissive outbound firewall
Chrome, Edge and Firefox fall back to a direct connection on every PAC failure (no default return, a parse error, a script error, a malformed return value). On Windows, a parse or script error reaches the program that asked for a proxy as an error, and the program decides whether it then connects directly. If the firewall lets clients out on 80/443, every direct fallback is silent and uncontrolled internet access. Default-deny client egress so PAC failures become loud. See: no-default-return, syntax-error, invalid-return-value, proxy-without-port.
- #2
Hostname pattern applied to url instead of host high
url is the request address as the browser passes it (scheme, host and port always; path, query or user name only in some engines); host is the bare hostname. A hostname pattern tested against url either never matches or matches far too much. The most common PAC mistake.
- #3
Trailing * in a host pattern matches attacker-controlled suffixes high
shExpMatch(host, "example.com*") matches example.com.evil.test and example.comms.test. Anyone who controls a domain can append the trusted name as a subdomain label and inherit the rule.
- #4
dnsDomainIs pattern without a leading dot matches look-alike domains high
dnsDomainIs is a plain string-suffix test. "corp.example" matches www.corp.example, corp.example and also notcorp.example. Only ".corp.example" restricts the match to subdomains.
- #5
Leading * without a dot matches look-alike domains high
shExpMatch(host, "*corp.example") matches badcorp.example as well as www.corp.example. The safe form is "*.corp.example", where the dot forces a label boundary.
- #6
PAC served over plain HTTP high
The PAC is executable routing policy fetched on every browser start. Over plain HTTP a network attacker (hostile Wi-Fi, compromised router, ISP middlebox) can rewrite it and route all web traffic through a proxy of their choice.
- #7
No unconditional return at the end of FindProxyForURL critical
Some code path reaches the end of FindProxyForURL without a return. The function then returns undefined, and Chromium, Firefox and WinHTTP all connect directly. Traffic silently bypasses the proxy.
- #8
Pattern matches an entire top-level domain high
shExpMatch(host, "*.de") or dnsDomainIs(host, ".com") routes a whole country or generic TLD. In the usual "proxy everything, except..." PAC this bypasses inspection for millions of unrelated sites.
- #9
IP range matched as a text prefix high
shExpMatch(host, "127.*") or "10.*" compares characters, not addresses. On its own it matches the hostname 127.foo.evil.test and, for "172.*", every public 172.x address. Use isInNet with a mask, or confirm the text match with isInNet on the same host in the same && condition.
- #10
PAC distributed via WPAD DNS discovery medium
WPAD clients look up wpad through the DNS suffix search list, and Windows also tries parent domains (DNS devolution). If no internal record answers, a wpad name outside your organisation can supply the PAC. Own the name, block wpad queries beyond your zones, prefer explicit configuration.
- #11
PAC URL distributed via DHCP option 252 medium
DHCP answers are plaintext broadcasts with no authentication in practice. A rogue DHCP responder on the same segment can hand out its own PAC URL and take over routing for every client that trusts option 252. Switch-level DHCP snooping or explicit configuration closes the gap.
- #12
String prefix used to match an IP range high
host.substring(0, 8) == "10.1.2.9" matches 10.1.2.99 and the hostname 10.1.2.9.evil.test. Prefix arithmetic on strings is not subnet arithmetic.
- #13
DNS function on the path of every request high
dnsResolve, isResolvable and isInNet on a hostname make the route depend on DNS. The engines cache answers, so only the first request to a name waits; when DNS does not answer, every request waits (about 12 s per call on Windows). Most PACs can decide on the hostname alone.
- #14
Port matched as a substring of the URL high
shExpMatch(url, "*:1080*") was meant to match port 1080 but also matches http://www.example.com/page?id=1080. A bypass is one query parameter away.
- #15
PROXY entry without a port medium
"PROXY proxy.corp.example" names no port. Chromium and Windows (WinHTTP) assume 80; Firefox is reported to reject the entry, and a rejected sole entry means a direct connection. Always write host:port.
- #16
isInNet called with a hostname medium
isInNet resolves its first argument when it is not an IP address. Unguarded, it makes every non-IP request depend on DNS. The first request to a name waits, every request waits when DNS does not answer, a failed lookup fails open, and only one of several addresses is checked.
- #17
RFC 1918 range with the wrong mask medium
172.16.0.0 with mask 255.255.0.0 covers only 172.16.x.x. The private block is 172.16.0.0/12 (mask 255.240.0.0), i.e. 172.16.0.0 to 172.31.255.255; the /16 misses fifteen sixteenths of it.
- #18
Only 127.0.0.1 excluded instead of 127.0.0.0/8 low
The entire 127.0.0.0/8 block is loopback. A PAC that only exempts 127.0.0.1 sends 127.0.0.2 or 127.1.2.3 (used by local development tools and some agents) to the proxy, where the connection fails.
- #19
Routing decided by myIpAddress() medium
Each engine picks "the client's IP" by its own rule (browsers the route to the internet, Windows the adapter order, pactester the computer's name), so with several adapters or a VPN the answer differs and can change. Location-based routing keyed on it is unreliable.
- #20
Upper-case letters in a hostname pattern medium
Browsers hand the PAC a lower-cased hostname, so a pattern such as "Intranet.Corp.Example" never matches in Chromium or Firefox. Where the host keeps its case (Windows programs using WinHTTP, such as BITS), comparisons are case-sensitive, so write patterns in lower case and lower-case host.
Mistakes specific to wpad.dat
A wpad.dat is an ordinary PAC file, so every mistake above applies to it too. The way WPAD delivers the
file adds risks of its own: lookups for wpad that leave your domain, DHCP answers that anyone on the
segment can send, and plain HTTP. The WPAD page explains them and how to reduce them.
All these mistakes can be fixed in the file. The weaknesses that every PAC file has, even a file without any of them, are on the page should you still use a PAC file.
Frequently asked questions
Which PAC file mistakes are the most dangerous?
At the top of the list is a broken PAC file combined with a firewall that lets clients out directly, because a PAC error then makes the browser connect directly, and that becomes uncontrolled internet access. Next come patterns matched against url instead of host, a trailing asterisk in a host pattern, and dnsDomainIs patterns without a leading dot, which let look-alike or attacker-controlled names take the direct route.
Why do PAC file mistakes often go unnoticed?
Because most of them fail open. When a PAC file has no default return, throws an error or returns an invalid string, the browser connects directly. Users notice nothing, and the traffic simply bypasses the proxy.
How do I find these mistakes in my own PAC file?
Paste the file into the PAC file tester at findproxyforurl.net/check/. It finds every mistake on this list that shows in the file itself or in how it is served, points to the line, and grades the file from A+ to F.