An attacker starts getting to know an organization from the face it shows to the internet: domains, open ports, management interfaces, VPN portals and the test server set up two years ago and forgotten. The inventory the organization knows and the real situation visible from the internet are often not the same. External attack surface management means finding these assets from where the attacker looks, assigning an owner to each and continuously monitoring their changes. Below we explain discovery methods that can be applied without depending on a commercial tool, prioritizing risky services, and how to tie findings to the firewall and publishing processes.
What the external attack surface covers
Keeping the scope narrow is the most common mistake; the inventory isn’t just an IP list. It includes these asset types:
- Domains and subdomains: the main brand domain, campaign domains, subsidiaries’ domains, old and inherited domains.
- IP addresses: blocks obtained from ISPs, data center and hosting addresses, public IPs at cloud providers.
- Services: web applications, email, VPN and remote access portals, API endpoints, file transfer services.
- Certificates: certificates that are about to expire, are weakly configured, or reveal unexpected subdomains.
- Third-party hosted assets: a campaign site set up by an agency, subdomains pointed to a SaaS service.
Asset discovery: DNS, certificate transparency and IP blocks
Discovery starts from sources the organization controls and expands with external sources. A single source isn’t enough.
DNS inventory
Export the zone records from the authoritative DNS provider. At this stage, also check that zone transfer (AXFR) is open only to authorized secondary servers; the AXFR command below is expected to return “Transfer failed” or a similar error. If a record list comes back, your entire zone is public.
dig +short NS example.com
dig AXFR example.com @ns1.example.com
dig +short example.com MX
dig +short _dmarc.example.com TXT
Certificate transparency
Publicly trusted certificate authorities write the certificates they issue to public transparency logs (RFC 6962). These logs are the most efficient way to find subdomains that aren’t in the DNS inventory. An example query with a search service such as crt.sh:
curl -s "https://crt.sh/?q=%25.example.com&output=json" \
| jq -r '.[].name_value' | tr 'A-Z' 'a-z' | sort -u > ct_subdomains.txt
# Check which of the names found still resolve
while read h; do printf "%s %s\n" "$h" "$(dig +short "$h" | tr '\n' ' ')"; done < ct_subdomains.txt
Wildcard certificates (*.example.com) don’t show subdomains individually; CT alone isn’t a sufficient source. Names that don’t resolve will also show up in the list. Don’t delete them; dangling CNAME candidates are often there.
IP blocks
Blocks allocated in the organization’s name can be queried in the RIPE NCC database through the organization or maintainer object (mntner); small blocks obtained from an ISP, however, usually appear under the ISP’s object and should be verified from contract records. Regularly export public IPs at cloud providers from the provider’s API or console. These addresses change often. A static list goes stale quickly.
External port and service scanning
Scan every IP in the inventory and every resolved name from a point looking in from the internet. If the scan is done from inside the corporate network, the firewall’s external policy isn’t tested; that’s the common misconception. The scope is only addresses the organization owns or tests with written permission; check the testing policies of cloud and hosting providers separately.
# All TCP ports, the organization’s own block (documentation block 203.0.113.0/28 in the example)
nmap -Pn -sS -p- --max-retries 2 -oA ext_tcp_full 203.0.113.0/28
# Service and version detection on the open ports found
nmap -Pn -sV -p 22,443,3389,8443 -oA ext_services 203.0.113.0/28
# Selected UDP services (slow; use them in a targeted way)
nmap -Pn -sU -p 53,123,161,500,623,4500 -oA ext_udp 203.0.113.0/28
The ndiff tool that comes with Nmap shows the difference between the previous scan and the new one: ndiff ext_tcp_prev.xml ext_tcp_full.xml. For web services, also record the HTTP header information, the page title and the names in the certificate; name-based virtual hosts on the same IP can host different applications. For details of the parameters, the Nmap Reference Guide can be used.
Risky services and a prioritization table
Not all findings are equally urgent. In prioritization, the type of service, the authentication method, whether its version has a known actively exploited vulnerability and the business justification are evaluated together. For information on whether a version is actively exploited, the CISA KEV catalog is a practical source.
| Service | Typical port | Priority | Expected action |
|---|---|---|---|
| RDP | TCP 3389 | Critical | Close to the internet, put behind a VPN or gateway |
| SMB | TCP 445 | Critical | Must never be exposed to the internet |
| Firewall/router management interface | HTTPS, SSH | Critical | Restrict to the management network or allowed IPs only |
| Server remote management card (IPMI, iLO, iDRAC) | HTTPS, UDP 623 | Critical | Move to a separate management network |
| Databases | 1433, 3306, 5432, 27017 | Critical | Put behind the application tier |
| Telnet, FTP | TCP 23, 21 | High | Close or move to an encrypted alternative |
| VPN portal | TCP 443, UDP 500/4500 | High | Current version, MFA, only the required portal |
| SNMP | UDP 161 | High | Close to the internet, use SNMPv3 |
| General web application | TCP 80/443 | Varies | Check the version, admin path and certificate |
VPN portals by their nature have to be exposed to the internet; their risk is managed through how current their version is and the strength of authentication. A service you can’t close, you keep up to date. Hardening these services is covered in the enterprise VPN security controls article.
Shadow IT and forgotten subdomains
The most common findings in discovery are assets put online not through the official process but via a project or vendor: a temporary test site, an old campaign domain, a remote access port a software vendor opened for support. Nobody closes them, because nobody remembers opening them.
Another thing to look at is dangling CNAME records. If a subdomain is pointed with a CNAME to a resource in a cloud hosting or SaaS service, but that resource has been deleted, someone else can claim the same resource name and publish content on the organization’s subdomain (subdomain takeover). The check is simple: if the CNAME target doesn’t resolve or returns the service provider’s “resource not found” page, either remove the record or reclaim the resource.
Assign an owner to every asset found. An asset whose owner can’t be found is a candidate for shutdown; before shutting it down, check the access logs to verify it really isn’t used.
Continuous monitoring and change alerts
The attack surface isn’t a one-off inventory; every new DNS record, NAT rule or cloud resource changes it. A sustainable cycle can be set up like this:
- Weekly: reporting new subdomains from CT logs and DNS zone changes.
- Weekly or daily: a full TCP scan of external IP blocks and an
ndiffcomparison with the previous result. - Change alert: opening a ticket for a newly opened port, a newly seen service or certificate, or a name that has started resolving.
- Monthly: reviewing ownerless assets, certificates about to expire and domain renewal dates.
- Annually or after a major change: validating discovery with a comprehensive external penetration test.
Tying findings to firewall and publishing processes
Discovery produces value only if findings get closed. If the report goes into a drawer, the surface doesn’t shrink. Set up three links:
- Firewall rule management: every NAT and allow rule opened to the internet is recorded with an owner, business justification and expiry date. An unexpected open port seen in the scan directly triggers a review of the related rule; this cycle can be merged with the firewall rule cleanup process.
- Publishing approval: exposing a new service to the internet isn’t approved until it passes checks for an up-to-date version, authentication, log collection and inclusion in the scanning scope.
- Vulnerability management: every discovered asset is automatically added to the vulnerability scanning scope, and findings are tracked according to the SLAs in the vulnerability management program.
When setting up the first round of discovery and a continuous scanning routine, the vulnerability analysis and security scanning service can be used as a starting point.
Frequently asked questions
Do we need permission to scan our own IP addresses?
For addresses the organization itself uses, internal approval is enough; if the addresses belong to a hosting or cloud provider, check the provider’s acceptable use and testing policy. If an external firm does the scan, the scope, time window and source IPs should be set out in writing.
What information do certificate transparency logs provide?
Certificates issued by publicly trusted certificate authorities are written to public logs. In these logs, all the subdomains in certificates issued for the organization’s domain are visible; forgotten test environments and services set up by external firms are often found this way. The attacker has access to the same information.
Is attack surface scanning the same as vulnerability scanning?
No. Attack surface management first finds what’s exposed to the internet and keeps the inventory up to date; vulnerability scanning looks for version- and configuration-related weaknesses on known assets. An undiscovered asset doesn’t fall within the scope of vulnerability scanning either; discovery comes first.
Is it necessary to buy a commercial EASM tool?
In small and mid-sized environments, a process working with a DNS inventory, certificate transparency queries and scheduled port scans can be set up. If there are many domains, frequently changing cloud assets and multiple subsidiaries, the continuous discovery and correlation capabilities of commercial tools reduce the operational load.