Skip to navigation

Private Networks (Tailscale)

Overview

Some applications are only reachable inside a private network. If that network is a Tailscale tailnet, Pensar can join it for the length of a pentest and test hosts on it. That includes a MagicDNS name such as app.tail1a2b3c.ts.net, and a hostname under a private domain you list, such as app.corp.acme.example.

Each run joins your tailnet as a short-lived, tagged device. You decide exactly which hosts and ports that tag can reach through your tailnet policy.

Prerequisites

  • A Tailscale tailnet that can reach the target, by its .ts.net name or by an internal hostname under a domain you will list below.
  • Permission to edit the tailnet’s access control policy and create OAuth clients in the Tailscale admin console.
  • The target serves HTTP or HTTPS (ports 80 or 443 by default).

For an internal hostname that is not a MagicDNS name, the tailnet also needs:

  • A subnet router that advertises the network the target’s IP is in, with the route approved in the Tailscale admin console. Pensar accepts advertised routes when it joins.
  • Split DNS for the private domain: in the admin console under DNS, add your internal nameserver and restrict it to that domain (for example corp.acme.example). Pensar looks up the target’s IPv4 A record through your tailnet’s DNS, not public DNS.
  • If the target has no internal DNS record, add it under Settings → Network → Hostname mappings with its internal IP instead.

1. Allow the pentest tag in your policy

In Pensar, open Settings → Network → Private networks. Under Prepare your tailnet, enter the host or IP the pentest should reach. Pensar generates a policy snippet for the pentest tag (default tag:pensar-pentest):

{
"tagOwners": {
"tag:pensar-pentest": ["autogroup:admin"]
},
"grants": [
{
"src": ["tag:pensar-pentest"],
"dst": ["app.tail1a2b3c.ts.net"],
"ip": ["tcp:80", "tcp:443"]
}
]
}

Merge it into your tailnet policy file in the Tailscale admin console. Grant only the hosts and ports you want tested.

For a host behind a subnet router, grant its internal IP or a CIDR range (for example 10.0.0.5 or 10.0.0.0/24) rather than its hostname. Also grant the pentest tag udp:53 and tcp:53 to the split-DNS nameserver’s IP, whether it is behind the subnet router or a device in your tailnet, so the run can resolve the hostname.

2. Create a Tailscale OAuth client

In the Tailscale admin console, go to Settings → OAuth clients and create a client with:

  • Auth Keys: write scope.
  • The pentest tag (tag:pensar-pentest) selected.

Copy the client ID and secret. The secret is shown only once.

3. Connect in Pensar

Back on Settings → Network → Private networks, under Connect, enter:

FieldValue
Tailnet nameYour tailnet, for example tail1a2b3c.ts.net
OAuth client IDFrom step 2
OAuth client secretFrom step 2 (stored encrypted)
TagThe tag from step 1, tag:pensar-pentest by default
Private domainsInternal DNS names, one per line. Optional.

.ts.net hosts are routed through your tailnet without being listed. List an internal domain, such as corp.acme.example, when its names are not MagicDNS names. Pensar then routes that domain and its subdomains (app.corp.acme.example) through the tailnet. A name that only ends with the same characters, such as evilcorp.acme.example, is not included.

Each entry is a hostname with at least two labels. An IP address (10.0.0.1) and a single label (corp, com) are rejected.

Click Save. To rotate the secret later, paste the new one; leave it blank to keep the stored secret.

4. Add and test your private target

Add the host as a domain from your attack surface. A .ts.net host is marked verified without a DNS record, because public DNS can’t see it. Each run then checks that the host is a device in your connected tailnet.

A hostname under a private domain you listed is routed through the tailnet, but listing the domain does not verify it. Pensar checks the verification record from the public internet, so publish the _pensar TXT record in public DNS, or verify a parent hostname whose proof covers its subdomains, for example acme.example for app.corp.acme.example. The HTTP file method only works if the host is reachable from the internet.

Launch a pentest as usual. Each run uses a fresh, single-use auth key to join your tailnet as an ephemeral device with your pentest tag. The device is removed automatically after the run ends.

Before testing, the run looks up each private target and checks that it answers on port 443 or 80. A .ts.net host that isn’t in your tailnet, a private hostname your tailnet DNS can’t resolve, or a host that doesn’t answer on either port is reported as a warning. Hostname mappings are applied after this check, so a mapped host that your tailnet DNS can’t resolve can still be tested. The run stops with an error only when every target is a .ts.net host and none of them is in your tailnet.

Limitations

  • Pensar routes a target through your tailnet when it is a .ts.net hostname, or a private domain you listed or a subdomain of one. A raw IP and an internal hostname you did not list are not routed through the tailnet.
  • A run that joins your tailnet doesn’t use Pensar’s fixed egress IP. Public targets in the same run see a different source IP, so IP allowlists for Pensar won’t apply to that run.
  • Android app pentests can’t reach private network hosts.
  • Disconnecting Tailscale in Settings → Network → Private networks removes the stored credentials and your private-domain list. Pentests against .ts.net hosts fail until you reconnect. Hosts under your former private domains are no longer routed through the tailnet, so they are tested over the public internet if they are reachable there. Enter the private domains again when you reconnect.