Port Scanning Protection: Stop Websites From Probing Your Network
How websites use JavaScript to probe local network ports and detect services, and how to block port scanning at the browser level.
Introduction
Your computer runs services on various network ports: development servers, database engines, remote desktop protocols, VNC, Docker, and more. Every time you visit a website, scripts on that page can attempt to probe your local network ports to discover which services are running. The pattern of open and closed ports creates a distinctive fingerprint of your local environment, one that is unique enough to identify you across sessions and even across different browsers.
This is a serious privacy concern. Port fingerprinting can persist even when you change your IP address, clear your cookies, or switch to a different browser profile. The services running on your machine tend to stay consistent over time, making this a highly reliable tracking signal for any website that chooses to collect it.
BotBrowser provides built-in port protection that controls how the browser responds to local port probes at the engine level. Rather than simply blocking connections (which is itself detectable), BotBrowser ensures that all local port probes return uniform results. This makes it impossible for websites to distinguish open ports from closed ones, effectively neutralizing this entire category of fingerprint tracking.
Why Port Privacy Matters
Port scanning from the browser is a real and well-documented privacy concern. Websites have been observed probing dozens of local ports to build a picture of the software running on visitors' machines. The types of information that can be collected include details about your entire computing environment.
Development tools are a common target. When a web developer has services running on ports commonly associated with frameworks and build tools, any website can learn that the visitor is likely a software developer. This information alone narrows down the potential identity pool significantly.
Remote access software is another signal. Services associated with remote desktop, terminal access, and screen sharing tools reveal important details about how you use your machine and what kind of infrastructure you manage.
Database services running on standard ports tell websites about the technology stack you work with. Whether you use relational databases, document stores, or in-memory caches, each running service adds another data point to your port fingerprint.
Container and virtualization services are particularly telling. Their presence indicates a certain type of technical user and can reveal details about your development and deployment workflow.
Security and networking tools round out the picture. VPN clients, firewall management interfaces, and security monitoring services each contribute to a comprehensive profile of your computing setup.
The combination of all these signals creates a stable fingerprint. Your set of running services tends to be consistent across browsing sessions, making it one of the most reliable tracking signals available. Even if you rotate your IP, clear all browser storage, and use a fresh browser profile, the pattern of your running services remains largely the same.
When port scan results are combined with traditional browser fingerprinting techniques like Canvas analysis, WebGL rendering, and font enumeration, the overall fingerprint becomes even more unique and persistent. This multi-layered approach to fingerprint tracking is why port protection is an essential component of comprehensive privacy.
The Challenge of Port Protection
Protecting against port-based fingerprinting is more nuanced than it might initially appear. Several common approaches have significant limitations that reduce their effectiveness in practice.
Why Simple Blocking Falls Short
A straightforward approach to port protection is to block all connections to local addresses. However, this creates its own set of problems that can actually make your browser more identifiable, not less.
When connections to localhost are blocked outright, the error pattern is different from what a standard browser produces. A website can detect the blocking behavior itself, turning your protection measure into yet another distinguishing signal. Additionally, uniform blocking is conspicuous in its own way. If every port returns the same blocked response instantly, the uniformity stands out against the natural variation that a normal browser would show.
Blocking also breaks legitimate functionality. Many web applications need to communicate with local services. Music streaming services that connect to desktop apps, development tools that use localhost for hot reloading, and authentication flows that rely on local redirect servers all depend on localhost connectivity. Blanket blocking disrupts these workflows.
Browser Extensions
Extensions that filter network requests can block connections to local addresses through their filter rules. However, extensions operate in the JavaScript layer, which means they intercept requests after the browser engine has already begun processing them. The timing characteristics of the blocking itself may provide information that can be analyzed. Extensions can also be detected through their side effects on browser APIs, and not all connection types may be consistently intercepted across different request mechanisms like WebSocket, image loads, and fetch calls.
Firewall Rules
Operating system firewalls can restrict which processes can bind to ports. However, this does not address port fingerprinting because the browser is making outbound connections to localhost, not receiving inbound connections from the internet. Firewall rules that block the browser from connecting to localhost would break legitimate local service communication and create the same detectability problems as simple blocking.
Network Namespaces and Containers
Running the browser in a container with a separate network namespace can prevent it from reaching host services. This approach is effective in isolation but adds significant infrastructure complexity. It may not be practical for all deployment scenarios, especially when the browser needs to interact with services on the host machine as part of legitimate workflows.
VPN-Based Approaches
Some VPN configurations can route local traffic differently. This adds network overhead and introduces additional complexity without fully addressing the underlying fingerprinting concern. The fundamental issue is how the browser responds to port probes, and routing changes alone do not normalize those responses.
BotBrowser's Approach to Port Protection
Engine-Level Protection
BotBrowser solves the port fingerprinting problem at the right level: inside the browser engine itself. The --bot-port-protection flag (PRO) activates protection that controls port access behavior at the deepest possible layer. When enabled, all connections to local addresses produce uniform timing characteristics regardless of whether a service is actually running on that port.
chrome --bot-profile="/path/to/profile.enc" \
--bot-port-protection
This approach is fundamentally different from the blocking and filtering methods described above, and it provides protection that those methods cannot match.
Connections proceed normally. BotBrowser does not block connections to localhost. Instead, it controls the observable timing behavior so that open ports and closed ports are indistinguishable to any script running on the page. Your local services continue to function as expected.
No detectable artifacts. All browser APIs behave normally. There are no missing properties, altered prototypes, or unusual error patterns that would indicate protection is active. The browser looks and behaves exactly like a standard installation.
Legitimate local services still work. Applications that need localhost communication function correctly. Whether you are using a music streaming service, a local development server, or any other application that relies on localhost connectivity, everything works as expected. The protection specifically addresses the timing signals that would allow a website to distinguish between port states.
Comprehensive Coverage
BotBrowser's port protection covers all commonly probed address ranges to ensure complete privacy:
- 127.0.0.0/8: The full IPv4 loopback range, including all 127.x.x.x addresses
- ::1: IPv6 loopback address
- localhost: Hostname-based access to local services
The protection covers 30 commonly probed ports across these address ranges. These are the ports most frequently targeted by browser-based port fingerprinting, covering development tools, databases, remote access services, container platforms, and other commonly running software.
Profile-Based Configuration
In addition to the CLI flag, port protection can be enabled directly in the profile configuration. This is ideal for profiles that should always have port protection active, ensuring the protection is never accidentally omitted.
{
"configs": {
"portProtection": true
}
}
When set in the profile, port protection activates automatically when the profile loads. No additional CLI flag is needed. This makes it easy to standardize port protection across your entire fleet of browser profiles.
Configuration and Usage
Basic CLI Setup
Getting started with port protection requires just one additional flag added to your BotBrowser launch command:
chrome --bot-profile="/path/to/profile.enc" \
--bot-port-protection \
--user-data-dir="$(mktemp -d)"
This single addition protects your local service fingerprint for the entire browsing session.
Complete Privacy Configuration
For comprehensive network privacy, combine port protection with proxy, DNS, and WebRTC protection. This combination addresses all major network-layer fingerprinting and tracking vectors:
chrome --bot-profile="/path/to/profile.enc" \
--bot-port-protection \
--proxy-server=socks5://user:pass@proxy:1080 \
--bot-local-dns \
--bot-webrtc-ice=google
This configuration ensures that your local services, DNS queries, IP address, and WebRTC connections are all protected simultaneously. Each layer of protection addresses a different tracking vector, and together they provide a comprehensive network privacy solution.
Playwright Integration
BotBrowser integrates naturally with Playwright. Add the port protection flag to your launch arguments and the protection is active for all page navigation throughout the browser session:
const { chromium } = require('playwright-core');
(async () => {
const browser = await chromium.launch({
executablePath: '/path/to/botbrowser/chrome',
args: [
'--bot-profile=/path/to/profile.enc',
'--bot-port-protection',
],
headless: true,
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com');
// Port protection is active for all page navigation
await browser.close();
})();
Puppeteer Integration
The same straightforward integration works with Puppeteer. Add the flag and your local services are protected for every page the browser visits:
const puppeteer = require('puppeteer-core');
(async () => {
const browser = await puppeteer.launch({
executablePath: '/path/to/botbrowser/chrome',
args: [
'--bot-profile=/path/to/profile.enc',
'--bot-port-protection',
],
headless: true,
defaultViewport: null,
});
const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();
})();
Headless Server Deployment
On headless servers, port protection is especially important. Servers typically run many services, including databases, monitoring agents, container platforms, and application servers. Without port protection, any website visited by the browser could potentially catalog all of these services, creating a highly distinctive fingerprint that is tied to that specific server.
chrome --bot-profile="/path/to/profile.enc" \
--bot-port-protection \
--headless=new \
--proxy-server=socks5://user:pass@proxy:1080
For production deployments, consider setting port protection in the profile configuration rather than passing it as a CLI flag. This ensures protection is always active regardless of how the browser is launched.
Verification
To confirm that port protection is working correctly in your environment:
- Start a known service on a specific port (for example, a simple HTTP server on port 8080)
- Launch BotBrowser with
--bot-port-protection - Navigate to a fingerprint testing page that checks for port accessibility
- Confirm that the testing page cannot distinguish the open port from closed ports
- Verify that your local services still function correctly through the browser
This verification process ensures that the protection is active and that your legitimate workflows remain unaffected.
Best Practices
-
Enable port protection on development machines. Developers typically run many services that create a highly distinctive port fingerprint. Port protection is especially valuable in this scenario because the combination of development servers, databases, and tooling creates a fingerprint that is often unique to a single individual.
-
Enable port protection on servers. Headless servers running multiple services such as databases, monitoring agents, Docker, and application servers are particularly susceptible to port fingerprinting. The rich service landscape on a production or staging server makes it an easy target for identification through port analysis.
-
Combine with other network protections. Port protection addresses local service fingerprinting, which is one piece of the network privacy picture. Combine it with proxy configuration for IP privacy, DNS leak prevention for query privacy, and WebRTC protection for connection privacy. Together, these protections create a comprehensive network privacy layer.
-
Use profile-based configuration for consistent protection. If port protection should be active for a specific profile, set it in the profile's
configs.portProtectionfield so it activates automatically every time. This eliminates the risk of forgetting to include the CLI flag and ensures consistent protection across all sessions. -
Test after configuration changes. Whenever you modify your network setup, proxy configuration, or server environment, verify that port protection is still functioning as expected. A quick verification confirms that all protection layers are working together correctly.
-
Consider your full fingerprint surface. Port protection is most effective when used as part of a complete fingerprint protection strategy. Review your Canvas, WebGL, font, and other fingerprint settings alongside port protection to ensure comprehensive coverage against tracking.
Frequently Asked Questions
Does port protection break local development workflows? No. Port protection controls the timing characteristics of local connections, not whether they succeed or fail. Legitimate connections to local services work normally. Your development servers, database connections, and local tooling all continue to function as expected. The protection specifically prevents websites from using timing differences to map your local service landscape.
Does port protection cover all ports? BotBrowser covers 30 commonly probed ports across IPv4 loopback (127.0.0.0/8), IPv6 loopback (::1), and localhost. These ports were selected based on real-world analysis of which ports are most frequently targeted by browser-based port fingerprinting. They cover the vast majority of services that fingerprinting scripts attempt to detect.
Can I use port protection without a proxy? Yes. Port protection is independent of proxy configuration. It protects your local service fingerprint regardless of your network routing setup. However, for comprehensive privacy, we recommend combining port protection with a proxy to also protect your IP address.
Does port protection affect WebSocket connections to localhost? WebSocket connections to localhost still function normally. The protection ensures that connection behavior is uniform across ports, preventing websites from using WebSocket probes to map your local services.
Is port protection enabled by default?
No. Port protection requires either the --bot-port-protection CLI flag or the configs.portProtection profile setting. It is not active by default, giving you full control over when and where the protection is applied.
Does port protection work in headless mode? Yes. Port protection works identically in both headful and headless modes. Whether you are running BotBrowser on a desktop or on a headless server, the protection provides the same level of coverage.
Can websites detect that port protection is active? BotBrowser's port protection operates at the engine level, below the JavaScript layer. The timing normalization ensures that open and closed ports are indistinguishable from each other. There are no JavaScript-visible artifacts, altered API behaviors, or unusual response patterns that would indicate the protection is active. The browser behaves exactly as a standard installation would.
What about ports on the local network (192.168.x.x)? BotBrowser's port protection covers the loopback address ranges (127.0.0.0/8, ::1, localhost). For local network addresses (192.168.x.x, 10.x.x.x, 172.16.x.x), consult the latest documentation for current coverage details.
How does port protection complement other BotBrowser features? Port protection is one layer in BotBrowser's comprehensive fingerprint protection system. It works alongside Canvas protection, WebGL protection, font protection, WebRTC leak prevention, DNS leak prevention, and many other features to create a consistent and authentic browser fingerprint. Each feature addresses a different tracking vector, and together they provide thorough protection against fingerprint-based tracking.
Summary
Browser-based port fingerprinting creates a persistent tracking signal by analyzing which services are running on your machine. This fingerprint persists across IP changes, cookie clears, and browser resets, making it one of the most durable tracking methods available to websites today.
BotBrowser's engine-level port protection ensures that all port probes return uniform results, making it impossible for websites to map your local service landscape. The protection works at the deepest possible level, produces no detectable artifacts, and preserves full compatibility with legitimate local services.
Combined with proxy configuration, DNS leak prevention, and WebRTC protection, port protection completes the network privacy picture. Together, these features ensure that your network environment reveals nothing that could be used for fingerprint tracking.
For related network protections, see DNS Leak Prevention and WebRTC Leak Prevention. For complete identity management, see Multi-Account Browser Isolation.