Skip to content

Harden Localhost Tunnels Against AI-Driven Scanners

Shrink your tunnel attack surface: pick the right tunnel type, lock down File Server, stop idle tunnels and get alerts via Localtonet webhooks.

Summary in your language
In this article 12 sections
Illustration of automated scanners probing a public tunnel endpoint that is protected by a security boundary in front of a local service.
Automated scanners probe public endpoints continuously, so every exposed tunnel needs a defined boundary.
Security · Secure Localhost Tunnel · Localtonet · 2026

Assume your public endpoint will be found, then make sure there is almost nothing to find

Automated reconnaissance and exploitation tooling, increasingly orchestrated by large language models, now probes public infrastructure faster and more thoroughly than a human attacker ever could. A tunnel that exposes a localhost service is part of that public infrastructure while it runs. This guide shows how to shrink what scanners can reach: threat modeling a tunneled service, choosing the right tunnel type for the people who actually need access, keeping sensitive services off public endpoints, locking down File Server, keeping tunnel lifecycles short, and getting alerted through our Token/Tunnel webhooks when something comes online unexpectedly. It ends with a pre-exposure checklist and a verification routine you can run against your own endpoints.

🔒 Attack surface reduction for tunneled services 🌐 HTTP, TCP/UDP, File Server and VPN Manager compared ⚡ Lifecycle discipline and Connected/Disconnected alerts

Why AI-driven scanners change the threat model for tunnels

For years, the informal security model for a quick demo or a home lab service was "nobody knows the address, so nobody will come." That model was always weak, and it is now obsolete. Internet-wide scanning has been cheap for a long time, but the newer development is orchestration: agentic penetration testing frameworks that chain reconnaissance, fingerprinting, vulnerability lookup, and exploitation attempts without a human deciding each step. Security vendors have publicly described the rapid spread of these frameworks and the growing number of source addresses running them. The practical consequence for developers is simple. Once a service is reachable from the internet, you should expect it to be discovered, fingerprinted, and tested against known weaknesses, often within a short window and repeatedly afterward.

Automated tooling changes three things in particular. First, coverage: an orchestrator does not get bored, so it will try every path in a wordlist, every default credential pair it knows, and every known exploit for the software version it detected. Second, adaptivity: a model-guided tool can read an error page, infer the framework behind it, and pick the next probe accordingly, which makes verbose error messages and version banners more valuable to an attacker than before. Third, volume: when thousands of addresses run similar tooling, blocking a single noisy IP address does very little.

A tunnel does not make a service more or less vulnerable by itself. What a tunnel does is change reachability. With Localtonet, the client application on your device opens an outbound connection to one of our relay servers, and the relay gives you a public URL or a public host and port. No inbound port forwarding, firewall change, or public IP address is needed on your side. That convenience is exactly why discipline matters: the service behind the tunnel becomes as reachable as any server on the internet, for as long as the client is connected and the tunnel is running. Everything the local service exposes, including its bugs, default settings, and debug endpoints, is now part of the public attack surface.

Hardening therefore follows a clear order of priorities, and the rest of this guide follows it:

  • Do not expose what does not need to be public. Choose the access model based on who actually needs to connect.
  • Require authentication for everything that is public. Obscurity is not access control.
  • Reduce what an authenticated or unauthenticated visitor can do. Least privilege, permissions, and safe defaults.
  • Reduce the time window. Run tunnels only while they are needed.
  • Detect surprises. Alert when an endpoint comes online that should not.
  • Verify. Test your own endpoint from the outside, the way a scanner would see it.
🎯 Reachability, not secrecy A running tunnel makes the local target reachable from the internet. Treat it like any public server, regardless of how unusual the hostname looks.
🤖 Tireless, adaptive probing Orchestrated tools read responses, infer the stack, and choose follow-up probes. Banners, stack traces, and default pages feed that loop.
⏱️ Exposure is time-bound A Localtonet tunnel is available only while the selected client is connected and the tunnel is running. Shorter run times mean a smaller window for probing.
🧱 Layers, not a single control Access model, authentication, least privilege, lifecycle, and alerting each fail differently. Combining them is what makes a tunneled service resilient.

How public hostnames and ports get discovered

Four-step flow showing certificate logs, hostname enumeration, port sweeps and service fingerprinting leading to a discovered tunnel hostname.
Typical discovery path: public logs and DNS reveal hostnames, then port sweeps and fingerprinting identify the service behind them.

A random subdomain feels private because you did not tell anyone about it. Unfortunately, hostnames leak through many channels that have nothing to do with you announcing them. Understanding these channels is the best argument for never relying on an obscure address as your only protection.

Certificate and DNS observation

Publicly trusted TLS certificates are recorded in Certificate Transparency logs, which anyone can search and which many scanners monitor continuously. When a certificate names a specific hostname, that hostname becomes public knowledge the moment the certificate is logged. A wildcard certificate does not reveal individual subdomains, but you should not build your security on assumptions about how a particular hostname's certificate is issued, especially for custom domains that you configure yourself. DNS is another source: passive DNS datasets collect resolved names from resolvers around the world, and any lookup of your hostname by any client may eventually end up in such a dataset.

Leaks from normal usage

Sharing a link in a chat tool often triggers link-preview fetchers. Pasting it into a ticket, a document, or a code review puts it in systems with their own indexing and integrations. Browsers can send the address in Referer headers to third-party resources a page loads. Browser extensions, sync services, and history features may transmit visited URLs. Search engines index anything they can reach that is not explicitly excluded, and a robots.txt file is a polite request rather than an enforcement mechanism. Any of these can put your "secret" address into a place where automated tooling can harvest it.

Enumeration and brute force

Even without any leak, subdomain enumeration tools guess names from wordlists and check which ones resolve. A custom subdomain such as a project name or the word "dev" or "admin" is especially easy to guess. Raw TCP and UDP endpoints are even more exposed: they are identified by a host and port, and internet-wide port scanners sweep address ranges and port numbers systematically. Once a port answers, service fingerprinting tools identify what is listening, often down to the software version, from the first bytes of the handshake or banner.

A random subdomain is not access control

Our HTTP and File Server tunnels can use a random subdomain, a custom subdomain, or a custom domain. All three serve the same content at a public HTTPS address. None of them restricts who can connect. Treat the hostname as an address, not a password, and put real authentication in front of anything that should not be public.

Choose the tunnel type based on who actually needs access

Side-by-side diagram comparing an open public tunnel reachable by anyone with a restricted tunnel reachable only by known clients.
Match the tunnel's reach to the people who actually need it, rather than defaulting to a fully public endpoint.

The single most effective hardening decision happens before any configuration: deciding what kind of access you actually need. Start by answering one question for each service: who needs to reach it? "Anyone with a browser" is a very different answer from "my two teammates" or "my own laptop when I travel," and each answer points to a different Localtonet feature.

Our documented tunnel categories are HTTP/s, TCP, UDP, TLS, combined UDP/TCP, File Server, Proxy Server (HTTP and SOCKS5), and VPN Manager. HTTP, TCP, UDP, combined UDP/TCP, and TLS tunnels point to a local IP address and port on, or reachable from, the client device. File Server publishes a local folder path instead of an IP and port. Proxy tunnels make the connected device the proxy exit node rather than forwarding to a conventional local service. VPN Manager is our private mesh VPN with granular firewall rules, and it is the only one of these features that is actually a VPN. The table below maps these options to access patterns from a security perspective.

Option Best for Security considerations
HTTP/s tunnel Web apps, APIs, webhook receivers, and demos that browsers or external services must reach Public HTTPS address. Put application-level authentication or an authenticating reverse proxy in front of the app. Avoid exposing development servers with debug modes enabled.
TCP tunnel Non-HTTP protocols that a specific external client must reach A public host and port that port scanners can find and fingerprint. The protocol's own authentication and encryption are your main defenses, so only use it for services that have strong ones.
UDP or combined UDP/TCP tunnel Game servers, VoIP, and other UDP-based services that the public or specific peers must reach Same exposure as raw TCP. UDP services are often less hardened against malformed input, so keep server software patched and limit what the server process can access.
TLS tunnel Services that need a TLS-based tunnel type rather than plain HTTP routing Encryption in transit is not authentication. The service behind it still needs its own access control.
File Server Sharing or syncing a specific folder through a browser file manager, SFTP, or WebDAV Publishes only the selected folder path. The Default web manager includes permissions, share-link controls, and documented security defaults covered later in this guide.
Proxy Server (HTTP, SOCKS5) Using your device as a proxy exit node Traffic sent through the proxy leaves from your device and network. An exit node that unauthorized parties can use is a serious abuse risk, so run it only while needed and review the access options in your dashboard.
VPN Manager Private access for known people and devices to admin panels, databases, SSH, and LAN resources A private mesh network with granular firewall rules instead of a public endpoint. The right choice when there is no reason for the service to be on the public internet at all.

A useful rule of thumb: if you can list everyone who needs access by name, you probably want private access through VPN Manager rather than a public tunnel. If the audience is unknown in advance, such as customers testing a demo, a third-party service delivering webhooks, or a mobile app in review, a public HTTP tunnel with proper authentication is appropriate. Raw TCP and UDP tunnels sit in between: they are public, but they suit protocols that HTTP cannot carry, so they deserve the most scrutiny about what is actually listening behind them.

One service per tunnel, one purpose per service

It is tempting to point a single tunnel at a local reverse proxy that routes to many internal apps. That is fine when the reverse proxy enforces authentication consistently, but it also means one mistake exposes everything behind it. Where practical, create a separate tunnel for each service you intend to publish, so that each one has its own lifecycle and you can stop one without affecting the others. This also makes your Connected/Disconnected alerts more meaningful, because each alert maps to a single, known exposure.

AI agent and MCP endpoints

Exposing endpoints for AI agents deserves special care. Our MCP Gateway tunnel exposes a locally running McpNet Gateway to the public internet, and anything published that way gives remote callers a path to the tools the gateway offers. Apply the same rules as for any API: require authentication, expose only the tools that remote callers genuinely need, and run the tunnel only while it is in use. Our Localtonet MCP Server goes the other direction: it lets AI coding assistants create, start, and stop Localtonet tunnels directly from the assistant. That is convenient, but it also means an assistant session can open a public endpoint. Review tunnel actions an assistant proposes before approving them, and pair this workflow with the webhook alerts described later so a newly connected tunnel never goes unnoticed. You can read more in our posts on exposing an MCP Gateway with Localtonet and on managing tunnels with the Localtonet MCP Server.

Keep admin panels, databases and SSH off public endpoints

Certain services are the primary targets of automated tooling, because compromising them yields immediate control. Database ports, SSH, remote desktop, router and NAS admin pages, container management dashboards, CI servers, and application admin panels all appear near the top of every scanner's target list. They also tend to share two dangerous properties: default credentials that are well known, and a long history of published vulnerabilities that an orchestrator can match against a detected version.

Our recommendation is direct: do not put these services on a public tunnel endpoint. When you need remote access to them, use private access instead. VPN Manager is our free private mesh VPN with granular firewall rules, and it can bridge local LANs. With it, your administrative services are reachable from the devices you enroll, rather than from every address on the internet. See our overview of VPN Manager as a free private mesh network for how it works.

🗄️ Databases Database wire protocols are designed for trusted networks. A public TCP endpoint invites credential stuffing and exploit attempts. Use private access, and keep the database listening only on interfaces that need it.
🖥️ SSH and remote desktop These are the most brute-forced services on the internet. If you must expose them, disable password logins in favor of keys, but private access remains the better default.
🛠️ Admin panels and dashboards CMS admin areas, container dashboards, and device configuration pages often ship with known default paths and credentials that scanners try first.
🐞 Debug and development servers Framework debug modes can reveal stack traces, environment details, or interactive consoles. Never tunnel a server with debug features enabled.

Split the public part from the private part

Many applications have a public face and an administrative back end on the same server. If the framework allows it, run the admin interface on a separate port or path that is not routed through the public tunnel, and access it through VPN Manager or directly on the local machine. If the application cannot separate them, consider a local reverse proxy that blocks admin paths for traffic arriving from the tunnel. Remember that blocking by path is a convenience, not a guarantee: frameworks sometimes expose the same functionality under alternative routes, so verify the result from outside.

Bind services to the narrowest interface

A tunnel's local target is an IP address and port on, or reachable from, the client device. That flexibility means the client can forward to another machine on your LAN, which is useful but also widens what a misconfiguration can expose. Bind local services to 127.0.0.1 when only the local client needs to reach them, so they are not also reachable from other devices on your network. Point the tunnel at exactly the service you mean to publish, and double-check the IP and port before starting it, because a typo in a port number can expose a completely different service.

Check what else is on the target host

If a tunnel points to another machine on your LAN, that machine's service is public while the tunnel runs. Confirm which process listens on the target port before starting the tunnel, and never point a public tunnel at a router, printer, camera, or NAS administration interface.

Put authentication in front of every exposed service

Every public endpoint needs an answer to the question "who is allowed in, and how does the service know?" For an HTTP service, the options in roughly increasing order of strength are: the application's own login, an authenticating reverse proxy in front of the application, and single sign-on or token-based access enforced by a dedicated layer. For raw TCP and UDP services, authentication is whatever the protocol itself provides, which is why the protocol choice matters so much.

What we can and cannot state about edge controls

This guide sticks to Localtonet behavior documented on our site. Features such as IP allowlisting, edge authentication in front of a tunnel, or per-tunnel access policies are not covered by the documentation this article relies on, so we do not describe them here. Check the tunnel settings in your dashboard and the current Localtonet documentation for what is available for your tunnel type and plan. Whatever edge options you find, treat them as an additional layer and keep authentication in the application or a local reverse proxy as well, so a single misconfiguration does not leave the service open.

Example: an authenticating reverse proxy with nginx

If the application you want to share has no login of its own, such as a static preview, an internal tool, or a prototype, a small local reverse proxy can add one. The example below uses nginx with HTTP Basic authentication. It listens on a local port, requires a username and password, and forwards authenticated requests to the application on another local port. You would then point your HTTP tunnel at the nginx port, not the application port.

First, create a password file. On Debian and Ubuntu, the htpasswd utility comes from the apache2-utils package. The -c flag creates the file, so omit it when adding more users later.

sudo apt install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd reviewer

Then add a server block. In this example, the application listens on 127.0.0.1:3000 and nginx listens on 127.0.0.1:8080. Adjust the ports to match your setup.

server {
    listen 127.0.0.1:8080;

    # Do not advertise the nginx version in headers or error pages
    server_tokens off;

    # Reject very large request bodies unless the app needs them
    client_max_body_size 10m;

    location / {
        auth_basic           "Restricted preview";
        auth_basic_user_file /etc/nginx/.htpasswd;

        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Test the configuration and reload nginx after editing:

sudo nginx -t
sudo systemctl reload nginx

Basic authentication is simple and widely supported, but it is a shared-secret scheme. Use a long, unique password, change it when people no longer need access, and rely on the HTTPS address of the tunnel so credentials are not sent in plain text across the internet. For anything long-lived or multi-user, prefer the application's own accounts or a proper identity layer with per-user credentials and multi-factor authentication.

Reverse proxy hardening habits

  • Hide version information. Turn off server version tokens and framework banners. Version strings are the fastest way for automated tooling to match your software against known vulnerabilities.
  • Return generic errors. Disable stack traces and detailed error pages in anything reachable through the tunnel.
  • Limit request sizes and methods. If the app only needs GET and POST, there is no reason to accept everything else.
  • Rate limit login attempts. Use your reverse proxy or application to slow down repeated failed logins. Distributed scanners rotate addresses, so combine rate limiting with strong credentials rather than relying on it alone.
  • Keep software patched. Orchestrated tools match detected versions against public vulnerability data. An outdated framework is often the shortest path in.
  • Log and review. Keep access logs on the local service so you can see what was requested while the tunnel was running.

Raw TCP and UDP services

For a TCP or UDP tunnel there is no HTTP layer in which to add a login page. The service's own protocol must carry the security. Prefer protocols with strong built-in authentication and encryption, disable anonymous or guest access, change every default credential, and keep the server software up to date. If a service has weak or no authentication, it should not be on a public raw port at all; use VPN Manager instead.

Harden File Server with its documented controls

File Server publishes a local folder instead of forwarding to a local IP and port. It has three sub-types. Default is a browser-based file manager that needs no client installed on either side. SFTP provides compatibility with standard SFTP clients and automation tools such as FileZilla, WinSCP, and rsync. WebDAV mounts the folder as a native network drive in File Explorer on Windows or Finder on macOS. The Default web file manager has the most documented security controls, and that is what this section focuses on.

Scope of the controls below

The permission system, share links, folder encryption, and security defaults described here are documented for the Default web file manager. Our published material does not state whether every one of these features also applies to the SFTP and WebDAV sub-types, so check the tunnel settings in your dashboard before relying on a specific control for SFTP or WebDAV access.

Publish the narrowest folder possible

The most important File Server decision is the folder path. Our documentation shows examples such as C:\Users\Work on Windows or /root and /usr/share on Linux and macOS to illustrate the format. From a security standpoint, avoid publishing a home directory, a system directory, or a drive root. Create a dedicated folder that contains only what you intend to share, and publish that. Home directories in particular often contain SSH keys, cloud credentials, browser profiles, and configuration files that should never leave the machine.

Set up a File Server tunnel

The documented setup sequence for a File Server tunnel is short. The steps below follow it exactly; see the File Server documentation for the full reference.

1

Install the Localtonet app for your operating system

Install and run the client on the device that holds the folder you want to share. The tunnel will only be available while this client is connected.

2

Open the File Server Tunnel page

In the dashboard, go to the File Server Tunnel page to create a new File Server tunnel.

3

Select the Process Type

Choose Random Sub Domain, Custom Sub Domain, or Custom Domain. All three serve the same content at a public HTTPS address, so none of them replaces access controls.

4

Select the AuthToken and server

Pick the token for the device that will serve the folder and choose an available relay server. Tokens are device-specific; never share them or paste them into public places.

5

Enter the local folder path

Enter the path of a dedicated folder that contains only what you intend to share, rather than a home directory or drive root.

6

Press Start

Creating the tunnel does not make it public. Pressing Start does, so review permissions and settings before this step and stop the tunnel when you are done.

Permissions: global flags and per-path overrides

The Default file manager has global permission flags for Upload, Download, Delete, Create Folder, Move, and Share, plus per-path overrides. When rules overlap, the most specific path wins, and changes apply without restarting the tunnel. This lets you design permissions in a least-privilege pattern:

  • Set the global flags to the minimum your audience needs. For a read-only download area, that may mean Download only, with Upload, Delete, Move, Create Folder, and Share turned off.
  • Use per-path overrides to grant extra capabilities only where needed, such as Upload on a single "incoming" subfolder.
  • Because changes apply live, you can tighten permissions immediately if you notice unexpected activity, without taking the tunnel down.

Disabling Delete and Move globally is a strong default for shared folders. If an account or link is misused, the damage is limited to what is permitted, and destructive operations are often the most costly outcome.

Share links with expiry, download limits and passwords

Public share links in the Default file manager support an expiry date, a download limit, and a separate link password. Use all three when sharing with people outside your team. A link with a short expiry and a low download limit is much less useful to anyone who harvests it from a chat log or an email thread, and a separate password means the link alone is not enough. Send the password through a different channel than the link itself.

Folder encryption for sensitive content

For folders that hold sensitive material, the Default manager supports per-folder encryption using AES-256-CBC with a folder password. The key is derived with PBKDF2 using 100,000 iterations. Neither the key nor the password is stored; only a salt and a verification hash are kept in a hidden .fsvault file. Unlock tokens last 30 minutes. There is no admin override and no password recovery, so store the folder password in a password manager. A forgotten password means the encrypted content cannot be recovered.

Documented security defaults

Several protections are documented as defaults in the Default file manager, and they map directly onto common automated attack techniques:

Default protection What it defends against What you should still do
Path-traversal protection Requests using sequences like ../ to escape the shared folder and read other files on the machine Still publish a dedicated folder, so even a mistake in sharing scope exposes as little as possible
Per-IP rate limiting High-volume probing and brute force from individual addresses Use strong passwords on share links and encrypted folders, because distributed scanners spread requests across many addresses
Blocked executable extensions, with optional allowlist mode Uploading executable payloads into the shared folder Consider allowlist mode when you only expect specific file types, and keep Upload limited to the paths that need it
Hidden dotfiles Accidental exposure of configuration files such as .env or .git data Do not keep credentials in the shared folder at all; hidden is not the same as absent
TLS terminated at the tunnel edge Interception of file traffic between visitors and the tunnel edge Treat TLS as transport protection, not authentication, and keep permissions tight

Watch file activity with File Server webhooks

The Default file manager can send file-event webhooks for upload, delete, rename, and move events, with an optional path filter and HMAC signing. This is separate from the platform-wide Token/Tunnel webhooks covered later. File-event webhooks are useful for spotting unexpected writes: for example, alerting on any upload outside the one folder where uploads are expected, or on any delete at all. Verify the HMAC signature in your receiver so forged requests cannot trigger your automation. For more detail on all of these features, see our posts on the Localtonet File Server, secure File Server tunnels, and how to use File Server.

Confirm how visitors authenticate to your file manager

Permissions, share-link passwords, and folder encryption limit what visitors can do, but you should also confirm in your dashboard how access to the file manager itself is protected for your tunnel. Do not assume that a File Server address is private because it is hard to guess.

Tunnel lifecycle discipline: start late, stop early

Timeline showing a short tunnel active only during work versus an idle tunnel left running and exposed to probes, with a webhook alert on tunnel start.
Short-lived tunnels shrink the exposure window, and webhooks flag tunnels that start unexpectedly.

Every hour a tunnel runs is an hour of potential probing. Lifecycle discipline is the simplest hardening technique and costs almost nothing. In Localtonet, creating a tunnel does not mean it is running: it must be started with the Start button, and it can later be stopped or deleted. The tunnel is available only while the selected client device is connected and the tunnel is running. These properties give you three natural control points.

  • Start only when needed. Create a tunnel ahead of time if that is convenient, but leave it stopped until the moment you need it, such as the start of a demo, a test session, or a webhook integration run.
  • Stop when the session ends. When the demo finishes or the test passes, stop the tunnel. A stopped tunnel no longer exposes the local target.
  • Delete what you no longer use. Old tunnels for finished projects are easy to restart by accident. Deleting them keeps your dashboard reflecting only real, intended exposures.

The client connection is also a control point

Because a tunnel requires the client to be connected, a device that is off or disconnected cannot serve its tunnels. That is useful, but do not treat it as your primary control: a laptop that reconnects automatically at the next Wi-Fi network may bring its tunnels back online. Stop tunnels explicitly rather than relying on the device going offline, and use the webhook alerts in the next section to catch any reconnection you did not expect.

Rotate exposure after a public session

If you shared an address widely, for example in a conference talk, a public issue tracker, or a livestream, assume it will be probed for some time afterward. Once the session ends, stop the tunnel. If you need the service again later, consider a fresh random subdomain rather than reusing the advertised one. This is not access control, but it does mean the address circulating in recordings and logs no longer leads anywhere.

Protect device tokens

A device or auth token identifies the client device that runs tunnels. Tokens are device-specific and must never be exposed. Keep them out of screenshots, shared terminal recordings, public repositories, and container images. If a token is exposed, treat it as compromised and replace it from the dashboard. A leaked token is a lifecycle problem as well as a credentials problem, because it can affect which devices can bring tunnels online under your account.

Alert on unexpected exposure with Token/Tunnel webhooks

Lifecycle discipline works best with monitoring. Our platform-wide Token/Tunnel webhooks fire when a token or tunnel in a selected Token Group changes to Connected or Disconnected. Each event is an HTTP POST with a JSON body of type WebHookRequest containing four fields: Id (the tunnel id or the authtoken), ActionDate, Type (either "Token" or "Tunnel"), and Status ("Connected" or "Disconnected"). The configuration reference is in our webhook documentation.

An illustrative payload has this shape. The placeholder values are ours; check a real delivery for the exact format of each field, particularly the date.

{
  "Id": "<tunnel-id>",
  "ActionDate": "<timestamp>",
  "Type": "Tunnel",
  "Status": "Connected"
}

Turn events into security signals

A Connected event is the moment an endpoint becomes reachable, which makes it exactly the event you want to know about. A few patterns turn these events into useful alerts:

  • Expected-window alerts. Maintain a list of tunnels that should only run during scheduled sessions. Alert whenever one of them connects outside that window.
  • "Should never be online" tunnels. If you keep a tunnel defined but stopped for emergencies, any Connected event for it deserves an immediate notification.
  • Unexpected token connections. A Token Connected event from a device you thought was retired, or at an unusual time, may indicate a leaked token or a forgotten machine.
  • Forgotten tunnels. Record Connected events and alert if no matching Disconnected event arrives within the time you expect a session to last, so long-running exposures do not slip by.

A minimal receiver sketch

The example below uses Python and Flask to accept the webhook, check the Status and Id fields, and call a notification function you provide. It is a starting point, not a production service. Run it somewhere reliable, behind HTTPS, and connect notify to your chat, email, or paging tool.

from flask import Flask, request

app = Flask(__name__)

# Tunnel ids or tokens that should normally be offline.
WATCHED_IDS = {"<tunnel-id-that-should-stay-stopped>"}

def notify(message):
    # Replace with your chat, email, or paging integration.
    print(message)

@app.post("/hooks/localtonet-status")
def localtonet_status():
    event = request.get_json(silent=True) or {}
    status = event.get("Status")
    item_id = event.get("Id")
    item_type = event.get("Type")

    if status == "Connected" and item_id in WATCHED_IDS:
        notify(f"Unexpected {item_type} connection: {item_id} at {event.get('ActionDate')}")

    return "", 204
Treat the webhook receiver as a public endpoint too

Request signing is documented for File Server file-event webhooks, but our documentation does not describe signing for Token/Tunnel webhooks. Use HTTPS, an unpredictable path, and logic that only notifies rather than taking destructive actions automatically. Because the payload can contain an authtoken as its Id, store and log these events carefully and never publish them.

Keep the two webhook systems distinct in your monitoring. Token/Tunnel webhooks tell you when exposure starts and stops. File Server webhooks tell you what happens to files while a File Server tunnel is exposed. Together they cover both "is something reachable?" and "is something being changed?"

Pre-exposure checklist

Run through this list before you press Start on any tunnel. Most items take seconds, and together they remove the issues that automated scanners find first.

Check Question to answer Safe outcome
Audience Who exactly needs to reach this service? Known people and devices use VPN Manager; unknown audiences use a public tunnel with authentication
Service type Is this an admin panel, database, SSH, or device management page? If yes, it stays off public endpoints
Local target Is the IP and port exactly the service I intend to publish? Verified listening process; services bound to 127.0.0.1 where possible
Authentication What stops an anonymous visitor? Application login or authenticating reverse proxy with unique, strong credentials; no default accounts
Information leakage Do errors, headers, or banners reveal versions or internals? Debug modes off, generic errors, version tokens hidden
Patching Is the exposed software current? Latest stable releases of the app, framework, and server
File Server scope Am I publishing a dedicated folder? No home directories, drive roots, or folders containing credentials
File Server permissions Are global flags at the minimum, with per-path overrides only where needed? Delete and Move off unless required; Upload limited to specific paths
Share links Do external links have an expiry, a download limit, and a password? All three set; password sent through a separate channel
Lifecycle When will this tunnel be stopped, and by whom? A defined end time; unused tunnels deleted
Monitoring Will I be alerted if this tunnel or its token connects unexpectedly? Token/Tunnel webhooks configured for the relevant Token Group
Tokens Is the device token absent from screenshots, repositories, and images? Token kept private; replaced from the dashboard if ever exposed

Verify your own endpoint the way a scanner would

Configuration is a claim; testing is evidence. After starting a tunnel, check it from outside your network, ideally from a different connection such as a mobile hotspot, so your results are not influenced by local network shortcuts. The commands below use standard tools and placeholder addresses. Replace them with your own tunnel's public URL or host and port.

Only test systems you are authorized to test

Run these checks only against endpoints you own or have explicit written permission to test. Scanning or probing other people's systems can be illegal and can violate service terms, even when your intent is defensive. Keep scans light and targeted at your own tunnel.

1. Confirm unauthenticated requests are refused

Request your public URL without credentials and inspect the response status and headers. If you used the nginx Basic authentication example above, an unauthenticated request should receive a 401 response.

curl -sI https://your-tunnel-address.example/

Then confirm that valid credentials work, so you know the 401 came from your authentication layer and not from a broken backend:

curl -sI -u reviewer https://your-tunnel-address.example/

With -u and only a username, curl prompts for the password instead of placing it in your shell history.

2. Look for information leaks in headers and errors

In the header output, look for Server or X-Powered-By values that reveal software versions. Request a path that does not exist and check that the error page is generic:

curl -s https://your-tunnel-address.example/this-path-should-not-exist

If you see a framework debug page, a stack trace, or file paths from your machine, fix the application configuration before continuing.

3. Probe the paths scanners try first

Automated tools commonly request well-known sensitive paths. Check a handful against your own service and confirm none of them return content:

for p in /.env /.git/config /admin /phpinfo.php /server-status; do
  printf "%s " "$p"
  curl -s -o /dev/null -w "%{http_code}\n" "https://your-tunnel-address.example$p"
done

A 401, 403, or 404 is what you want. A 200 on any of these deserves investigation, because it means content is being served at that path.

4. Test path traversal on File Server

Path-traversal protection is a documented default of the Default file manager, but it is still worth confirming that your shared folder cannot be escaped. The --path-as-is option tells curl not to normalize ../ sequences before sending the request:

curl -s --path-as-is -o /dev/null -w "%{http_code}\n" "https://your-file-server-address.example/../../etc/passwd"

We do not document a specific status code for blocked traversal attempts, so the check is simply that no file content from outside the shared folder is returned. Also open the file manager and confirm that dotfiles are hidden and that permissions match what you configured: try an upload, delete, or move in a path where it should be denied.

5. Check raw TCP and UDP endpoints

For a TCP tunnel, a targeted nmap scan of your own public host and port shows what a port scanner would learn. The -sV option asks nmap to identify the service and version, which tells you how much your banner reveals:

nmap -Pn -sV -p <public-port> <public-host>

If the result names your exact software version, consider whether the service can be configured to reveal less, and make sure that version is current. For UDP services, nmap's UDP scanning is slower and less conclusive; testing with the service's own client from an outside network is usually more informative.

6. Confirm that stopping really stops exposure

Stop the tunnel in the dashboard and repeat the first request. The public address should no longer reach your service. This step confirms that your mental model matches reality and that no other tunnel is pointing at the same local target. If you configured Token/Tunnel webhooks, confirm that you received a Disconnected event, and that starting the tunnel again produces a Connected event in your receiver.

7. Review your local logs

After a test session, read the access logs of your local service or reverse proxy. You will often see requests from addresses you do not recognize, probing paths you never published. That is normal background noise on the internet, and it is a useful reminder that the controls you just verified are what stand between those requests and your data.

Common hardening mistakes and how to fix them

Most incidents involving tunneled services do not come from sophisticated attacks. They come from small configuration gaps that automated tooling finds reliably. These are the patterns worth watching for.

The tunnel points at the application instead of the proxy

If you add an authenticating reverse proxy but leave the tunnel's local target on the application port, the proxy is bypassed entirely. Symptom: unauthenticated requests succeed. Fix: point the tunnel at the proxy's port, and bind the application to 127.0.0.1 so it is not reachable on other interfaces either.

A forgotten tunnel keeps running

A tunnel started for a demo weeks ago and never stopped is one of the most common exposures. Fix: review running tunnels in the dashboard regularly, delete the ones you no longer need, and set up Connected/Disconnected webhooks so long-running sessions generate a reminder.

The shared folder is too broad

Publishing a home directory "just for a minute" can expose keys and credential files. Even with dotfiles hidden, non-dotfile credential files and documents may be visible. Fix: stop the tunnel, create a dedicated folder, move only the intended files into it, and publish that path instead.

Share links outlive their purpose

A link without expiry or download limits can circulate indefinitely. Fix: set an expiry date and a download limit on every external link, and use a separate link password. Revisit active links when a project ends.

Default credentials survive on a public port

Self-hosted tools frequently start with a default admin account. Automated scanners try these first. Fix: change or disable default accounts before the first tunnel start, and verify by attempting the default login from outside.

An AI assistant opened a tunnel you did not expect

If you use the Localtonet MCP Server so a coding assistant can manage tunnels, a tunnel may be created and started as part of a task. Fix: review tunnel actions before approving them, include the relevant Token Group in your webhook alerts, and stop or delete any tunnel the task no longer needs.

Frequently asked questions

Is a random Localtonet subdomain enough to keep my service private?

No. Random Sub Domain, Custom Sub Domain, and Custom Domain all serve the same content at a public HTTPS address, and none of them restricts who can connect. Hostnames can be discovered through certificate logs, DNS data, link previews, referrers, and enumeration. Put authentication in front of any service that should not be public, and use VPN Manager for services that only known people need.

Should I use a TCP tunnel or VPN Manager for SSH and databases?

For SSH, databases, and admin interfaces, we recommend VPN Manager. It is our private mesh VPN with granular firewall rules, so these services are reachable from enrolled devices rather than from a public host and port that internet-wide scanners will find. A TCP tunnel exposes the service publicly while it runs, which makes its own authentication your only barrier.

Does Localtonet offer IP allowlisting or authentication at the tunnel edge?

The documentation this guide relies on does not cover IP allowlisting or edge authentication, so we do not make claims about them here. Check your tunnel settings in the dashboard and the current Localtonet documentation for what is available for your tunnel type and plan. Either way, keep authentication in your application or a local reverse proxy so protection does not depend on a single layer.

Which File Server protections are on by default?

The Default web file manager documents path-traversal protection, per-IP rate limiting, blocked executable extensions with an optional allowlist mode, hidden dotfiles, and TLS terminated at the tunnel edge. You can add least-privilege permissions, password-protected share links with expiry and download limits, and per-folder encryption. Whether each control also applies to the SFTP and WebDAV sub-types is not stated in our published material, so confirm in the dashboard.

How do I get alerted when a tunnel comes online unexpectedly?

Configure Token/Tunnel webhooks for the relevant Token Group. They send a POST with a JSON body containing Id, ActionDate, Type ("Token" or "Tunnel"), and Status ("Connected" or "Disconnected") whenever a token or tunnel in that group changes state. Your receiver can compare the Id against a list of tunnels that should stay offline and notify you on any Connected event.

Does creating a tunnel make my service public immediately?

No. Creating a tunnel does not start it. A tunnel must be started with the Start button, and it is available only while the selected client device is connected and the tunnel is running. You can stop it at any time and delete it when you no longer need it.

Can I scan my tunnel endpoint to check my hardening?

You can test endpoints you own or have explicit permission to test, using standard tools such as curl and targeted nmap scans of your own host and port. Keep the tests light and focused on your own tunnel. Never scan systems you are not authorized to test.

Expose only what you mean to, for only as long as you need

Create your Localtonet account, keep private services on VPN Manager, publish public services through authenticated HTTP or File Server tunnels with least-privilege settings, and set up Connected/Disconnected webhooks so no endpoint goes live without you knowing.

Get Started Free →

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

Support