Domains and Infrastructure

Video + 11 min read · includes a lab

Public traces of chaicorp.example

chaicorp.example
Mail servermail.chaicorp.example
Certificate
Old test sitetest.chaicorp.example
Forgotten
Domains and Infrastructure
0:00 / 6:34 · Domains and Infrastructure
Chapters and transcript

Domains and Infrastructure Every organisation that is online leaves technical traces. A domain name, mail servers, certificates, and sometimes a forgotten test website. These traces are public by design, because the internet needs them to work. In this lesson, you will learn what each one reveals, and how defenders find weak spots before attackers do.

Domains A domain name, such as chaicorp dot example, is the human-friendly name of a website. Computers use IP addresses instead. The Domain Name System, or DNS, translates one into the other. The laptop asks the DNS server for chaicorp dot example. The server replies with an IP address. Now the laptop can connect to the website.

Domains To get a domain, an organisation pays a registrar, a company that sells domain names, for a set period. Under the main domain, the owner can create subdomains, such as mail, shop and test. Each one may point to a different server or service. Large organisations can have hundreds, and they often lose track of some.

WHOIS records WHOIS is a public lookup service that shows registration details for a domain. A newer system called RDAP does the same job in a more modern format. Both are free. WHOIS shows the creation date, the expiry date, and the registrar and name servers. Owner details are usually hidden today, because of privacy laws and privacy services.

WHOIS records On Linux or macOS, you can run whois followed by the domain. In this simplified result, the domain was created in twenty sixteen and expires in twenty twenty-seven. If a company lets an important domain expire, someone else can register it. You can also see the registrar and name server. The registrant line says redacted for privacy, which is normal today.

WHOIS records For defenders, the creation date is one of the most useful facts. An email arrives that looks like it is from a bank. The staff member looks up the sender domain in WHOIS. The answer comes back. The domain was created only last week. Scam websites are often registered just days or weeks before they are used. That is a strong warning sign.

DNS records DNS holds different types of records. A and AAAA records give the IP address, version 4 or version 6, which shows where a website is hosted. MX records name the mail servers, revealing the email provider. NS records show who manages the DNS. A CNAME is an alias pointing to another name, which can reveal third-party services. And TXT records hold free text, including email security settings.

DNS records You can look up records with nslookup or dig. Here, dig shows the MX record, so we see which mail server receives email. The TXT record starts with v equals spf1. That is SPF, the list of servers allowed to send email for the domain. The DMARC record, stored at underscore dmarc, tells receiving servers what to do with email that fails checks. Another TXT line is a verification code for a cloud service.

DNS records Why does this matter? This domain has a DMARC policy of p equals none, which does nothing. An attacker sends a fake email that claims to come from chaicorp dot example. The receiving mail server is not told to reject it, so it reaches the inbox. Missing SPF or DMARC records, or a DMARC policy that does nothing, make spoofing easier. This is one of the first things a defender should check.

Certificate transparency Websites that use HTTPS need a TLS certificate from a certificate authority. To stop fake certificates going unnoticed, trusted authorities record every certificate in certificate transparency logs. These are public and append-only, so entries can be added but not changed or removed. Each certificate lists the names it protects, and free sites such as crt dot sh let anyone search them.

Certificate transparency Watch it work. A certificate authority issues a certificate for dev dot chaicorp dot example, and records it in the CT log. Later, a defender searches the log for the company domain. The results include the dev subdomain, even though no website links to it. Defenders also get early warning of certificates they did not request. Note that a wildcard certificate covers every subdomain, so it does not reveal individual names.

Risky infrastructure Here is one serious problem. The subdomain promo dot chaicorp dot example still points to a cloud service the company stopped using. This is a dangling DNS record. An attacker claims that service for themselves. Now, when a visitor opens the company subdomain, the attacker controls what appears. This is called a subdomain takeover. The fix is to delete DNS records you no longer use.

Risky infrastructure Domain research can uncover these problems. Forgotten test or dev subdomains running unpatched software. Dangling DNS records. Expiring domains that may still receive email. Lookalike domains, such as chalcorp with an L instead of an I. And weak email security. Remember the line. WHOIS, DNS and CT logs are passive. Scanning the servers you discover, or trying to log in, needs written permission.

Quick check Quick check. You look up the DMARC record for your company domain. It says v equals DMARC1, p equals none. What does this tell you? Take a moment, then choose.

Check your own domain If you own a domain, or your manager approves a review, try these steps. Check WHOIS for the expiry date and auto-renewal. Confirm SPF and DMARC exist, and plan to move beyond p equals none once genuine email passes. List every subdomain in CT logs, and ask who owns it. Delete dangling records. Watch for lookalike domains. And repeat every few months, because infrastructure changes.

Key takeaways Let us put it together. WHOIS shows when a domain was created and when it expires. DNS records reveal hosting, email providers and services. SPF and DMARC make email spoofing harder. CT logs reveal subdomains, including forgotten ones. And dangling records can lead to subdomain takeover. Now read the lesson below, and answer the quiz.

Every organisation that is online leaves technical traces: domain names, mail servers, certificates and forgotten websites. These traces are public by design, because the internet needs them to work. In this lesson you will learn what each one reveals and how defenders use them to find weak spots before attackers do.

Domains and who owns them

A domain name is the human-friendly name of a website or service, such as chaicorp.example. Computers do not use names to talk to each other. They use IP addresses, such as 203.0.113.10. The Domain Name System (DNS) translates names into addresses.

To get a domain, an organisation pays a registrar, a company that sells domain names. The domain is registered for a set period, often one year or more, and must be renewed.

Under a domain, the owner can create subdomains, such as:

  • mail.chaicorp.example
  • shop.chaicorp.example
  • test.chaicorp.example

Each subdomain may point to a different server or service. Large organisations can have hundreds of them, and they often lose track of some.

WHOIS records

WHOIS is a public lookup service that shows registration details for a domain. A newer system called RDAP does the same job with a more modern format. Both are free to use.

On Linux or macOS you can run:

whois example.com

A simplified result might look like this:

Domain Name: CHAICORP.EXAMPLE
Registrar: Example Registrar Ltd
Creation Date: 2016-04-11
Registry Expiry Date: 2027-04-11
Name Server: NS1.EXAMPLEDNS.NET
Registrant: REDACTED FOR PRIVACY

What WHOIS can tell you:

  • Creation date. How old is the domain? Scam websites are often registered only days or weeks before they are used.
  • Expiry date. If a company lets an important domain expire, someone else can register it.
  • Registrar and name servers. Which companies host the domain's records.
  • Owner details. In the past, names, addresses and phone numbers were often shown. Today, because of privacy laws and privacy services, owner details are usually hidden or replaced with "redacted".

For defenders, the creation date is one of the most useful facts. If you receive an email from a bank-like domain that was created last week, that is a strong warning sign.

DNS records

DNS holds different types of records. Each type answers a different question. The most important for OSINT are:

Record What it shows What it can reveal
A The IPv4 address for a name Where a website is hosted
AAAA The IPv6 address for a name The same, for IPv6
MX The mail servers for a domain Which email provider the company uses
NS The name servers for a domain Who manages the DNS
CNAME An alias pointing to another name Third-party services the company uses
TXT Free text records Email security settings and service verification codes

You can look up records with nslookup (on Windows, macOS and Linux) or dig (on Linux and macOS):

nslookup -type=mx example.com
dig example.com MX
dig example.com TXT

TXT records often contain two important email security settings:

  • SPF (Sender Policy Framework) lists which servers are allowed to send email for the domain. It starts with v=spf1.
  • DMARC tells receiving mail servers what to do with email that fails checks. It is stored at _dmarc. followed by the domain, and starts with v=DMARC1.

If a company has no SPF or DMARC records, or has a DMARC policy that does nothing, attackers find it easier to send fake emails that appear to come from that company. This is one of the first things a defender should check.

TXT records also often contain verification codes for cloud services, which can reveal which online tools a company uses. Attackers use this to make phishing more believable, for example by copying the login page of a service they know the company uses.

Subdomains and certificate transparency

Finding subdomains helps both attackers and defenders. An old or forgotten subdomain is often less protected than the main website. It may run outdated software, a test version of an app, or an admin panel.

One of the best passive sources for subdomains is certificate transparency (CT). Websites that use HTTPS need a TLS certificate, issued by a certificate authority (CA). To stop fake certificates from going unnoticed, trusted CAs record every certificate they issue in public, append-only logs. "Append-only" means entries can be added but not changed or removed. Modern browsers expect publicly trusted certificates to appear in these logs.

Each certificate lists the names it protects, such as shop.chaicorp.example. So by searching CT logs for a domain, anyone can see many of its subdomains, including ones that are not linked from any website. Free public search sites, such as crt.sh, let you do this.

Defenders gain two things from CT logs:

  1. A list of their own subdomains, which helps find forgotten systems.
  2. Early warning of certificates issued for their domain, or for lookalike names, that they did not request.

Note that some certificates are wildcard certificates, written as *.chaicorp.example. They cover every subdomain at once, so they do not reveal individual names.

Spotting risky infrastructure

Here are common problems that domain and DNS research can uncover:

  • Forgotten subdomains. test, dev or old subdomains running unpatched software.
  • Dangling DNS records. A subdomain still points to a cloud or hosting service that the company stopped using. If an attacker can claim that service, they control what appears on the company's subdomain. This is called a subdomain takeover.
  • Expiring domains. An old domain that staff once used for email may still receive messages. If it expires and someone else registers it, they may receive those emails.
  • Lookalike domains. Attackers register names that look like a real one, such as chalcorp.example (with an L instead of an I) or chaicorp-support.example. These are used for phishing.
  • Weak email security. Missing SPF or DMARC records make spoofing easier.

Remember the line between passive and active. Looking up WHOIS, DNS and CT logs is passive and uses public services. Scanning the servers you discover, or trying to log in to them, is active testing and needs written permission from the owner.

Check your own domain

If you own a domain, or your manager approves a review of your organisation's domain, try these steps:

  1. Run a WHOIS lookup. Check the expiry date and whether auto-renewal is on. Check that contact details are correct.
  2. Look up MX and TXT records. Confirm that SPF and DMARC exist. If DMARC is set to p=none, plan to move towards a stronger policy once you are sure all your genuine email passes the checks.
  3. Search CT logs for your domain. Make a list of every subdomain you find. For each one, ask: do we still use this? Who owns it?
  4. Remove dangling records. If a subdomain points to a service you no longer use, delete the DNS record.
  5. Watch for lookalikes. Search CT logs and the web for names similar to yours. Some services can alert you when new lookalike domains are registered.
  6. Repeat regularly. Infrastructure changes. A review every few months is far better than a single check.

In the next lesson you will look at the human side: how attackers profile people, and how to reduce your own footprint.

HANDS-ON LAB

Lookalike Domain Watch

A certificate transparency alert fired for names like chaicorp. Find the new lookalike domain that is ready to send phishing email.

Start the lab →

Check your understanding

Answer every question correctly to complete this lesson. If you miss one, try the quiz again.

1. Which DNS record type tells you which servers receive email for a domain?

2. Why are certificate transparency logs useful for finding subdomains?

3. A company's subdomain promo.chaicorp.example still points to a cloud service the company stopped paying for. What is the risk?

Locked: answer every quiz question above correctly to complete this lesson.

Spotted a mistake or something unclear? Report a mistake