Penetration Testing and Ethical Hacking

Chapter 4
Reconnaissance, OSINT, and Attack-Surface Mapping

Diploma in Cyber security
Penetration Testing and Ethical Hacking   •   Diploma

Reconnaissance, OSINT, and Attack-Surface Mapping

Introduction

Reconnaissance is the disciplined process of collecting and interpreting information about a target before security testing begins. In penetration testing, reconnaissance is not simply “finding as much information as possible.” It is a controlled activity that supports defined objectives, respects authorization boundaries, protects personal information, and produces evidence that can be used to assess risk.

Open-source intelligence (OSINT) is intelligence derived from publicly available information. It may include domain-registration records, public web pages, certificate transparency records, job advertisements, technical documentation, social-media content, public code repositories, DNS data, and search-engine indexes. Some OSINT is highly reliable; other information may be outdated, misleading, duplicated, or deliberately planted. Professional reconnaissance therefore combines collection with validation and analysis.

Attack-surface mapping converts collected information into a structured representation of an organization’s externally visible assets, technologies, identities, data flows, trust relationships, and possible entry points. The resulting map supports later vulnerability assessment and helps an organization reduce unnecessary exposure.

Reconnaissance must always remain within the rules of engagement. A tester who discovers an interesting system is not automatically authorized to scan or access it. Scope, timing, source restrictions, rate limits, prohibited actions, data-handling requirements, and escalation contacts should be confirmed before testing begins.

Learning Objectives

By the end of this chapter, students should be able to:

  1. Distinguish passive reconnaissance, authorized active reconnaissance, and intrusive testing.
  2. Explain the role, strengths, and limitations of OSINT.
  3. Identify domains, subdomains, IP ranges, cloud services, applications, identities, technologies, and third-party dependencies.
  4. Build an attack-surface map using evidence, confidence ratings, and scope controls.
  5. Validate findings without unnecessarily collecting sensitive information.
  6. Document reconnaissance results in a professional and reproducible manner.
  7. Recognize legal, ethical, privacy, and governance obligations.

1. Reconnaissance as an Intelligence Process

A useful reconnaissance process contains six linked activities:

  1. Planning: define the objective, scope, authorization, constraints, and outputs.
  2. Collection: gather information from approved public and organizational sources.
  3. Normalization: remove duplicates, standardize names, and associate observations with assets.
  4. Validation: confirm whether observations are current, relevant, and attributable to the target.
  5. Analysis: identify relationships, exposure patterns, technology dependencies, and likely security significance.
  6. Reporting: document evidence, confidence, limitations, and recommended actions.

This process resembles an intelligence lifecycle rather than a checklist of tools. A tool can find a hostname, but the tester must determine whether it belongs to the client, whether it is still active, and whether testing it is authorized.

Passive and active reconnaissance

Passive reconnaissance collects information without directly interacting with the target’s systems, or by using information already published by others. Examples include reviewing a company’s public website, examining historical DNS information from an approved source, reading public job advertisements, and inspecting certificate transparency data.

Authorized active reconnaissance sends controlled requests to target-owned systems. Examples include resolving a domain, requesting a web page, checking service banners, or performing a limited port scan when specifically permitted. Active reconnaissance can create logs, consume resources, trigger defensive alerts, or affect fragile systems.

Intrusive testing goes beyond reconnaissance. Exploitation, authentication testing, content modification, denial-of-service activity, vulnerability proof-of-concept execution, and access to non-public data require explicit authorization and normally belong to later phases of an engagement.

ActivityTypical interactionMain riskRequired control
Passive OSINTNo direct target requestMisinterpretation or privacy over-collectionSource validation and minimization
DNS and web verificationLimited requestsLogging, rate limiting, false attributionScope, throttling, approved times
Service discoveryProbes to hosts or portsAlerts, load, fragile servicesWritten authorization and exclusions
ExploitationAttempts to trigger weaknessesData loss or service impactExplicit rules of engagement

2. Scope, Authorization, and Rules of Engagement

Before collecting data, the tester should identify the legal entity and assets covered by the engagement. Scope may be expressed as domain names, IP ranges, cloud accounts, applications, mobile packages, physical locations, or business processes. Scope should also identify exclusions, such as third-party hosted services, production databases, safety-critical systems, or employee personal accounts.

A sound rules-of-engagement document answers at least the following questions:

  • Who authorized the work, and who is the emergency contact?
  • Which assets, domains, ranges, applications, and subsidiaries are in scope?
  • Which assets are explicitly out of scope?
  • Is social engineering permitted?
  • Are password spraying, vulnerability exploitation, or authenticated tests permitted?
  • What dates and times are allowed?
  • What request rates and scanning intensity are acceptable?
  • How should evidence and personal data be stored?
  • What constitutes a critical finding requiring immediate notification?
  • How will testing stop if instability or unintended access occurs?

A practical principle is stop, verify, and escalate. If a discovered host appears to belong to a supplier, a cloud provider, or another organization, do not assume that the client’s permission transfers to it. Record the observation, verify ownership, and seek written clarification.

3. OSINT Sources and Their Evidential Value

OSINT sources differ in reliability, freshness, bias, and legal sensitivity. A professional report identifies the source and collection time rather than presenting every observation as fact.

Domain and naming information

Public DNS records may reveal authoritative name servers, mail exchangers, aliases, and application hostnames. Subdomain information may come from public certificates, documentation, search indexes, or historical records. DNS data is useful for discovering naming conventions and service relationships, but it does not prove that a host is active or owned by the client.

Registration information can provide organizational clues, although privacy services, registrars, and regional policies often limit its accuracy. A domain’s registrant, technical contact, or registration date should therefore be treated as supporting evidence, not definitive ownership proof.

Web content and search indexes

Public websites may reveal software frameworks, API documentation, downloadable files, staff roles, office locations, support portals, and links to external providers. Search indexes can expose pages that are difficult to find through normal navigation. However, an indexed page may be stale, cached, or incorrectly associated with the target.

A tester should avoid downloading large quantities of data merely because it is technically accessible. The objective is to establish exposure and risk, not to collect unnecessary personal or confidential information.

Certificates and encryption metadata

Public certificate transparency services can reveal names included in publicly issued certificates. These names may identify development, staging, remote-access, or legacy systems. Certificate entries can also contain historical names that are no longer active. Validation requires checking current DNS and authorization boundaries.

Public code and package repositories

Repositories may disclose architecture, dependencies, deployment instructions, endpoint names, or accidental secrets. Public code should be handled carefully: a suspected secret must not be used to access a system unless the rules explicitly permit credential validation. The preferred action is to preserve minimal evidence, notify the client through the agreed channel, and recommend revocation and rotation.

Job advertisements and professional profiles

Recruitment material can reveal technology stacks, cloud platforms, security products, operating systems, and organizational structure. Such information is valuable for exposure analysis but may describe future plans, preferred skills, or legacy systems rather than the current environment. It should be corroborated with technical evidence.

Third-party and supply-chain information

Organizations rely on content delivery networks, payment providers, identity platforms, software-as-a-service applications, managed service providers, and marketing platforms. These relationships may enlarge the apparent attack surface. The tester should distinguish between:

  • Owned assets: directly controlled by the client.
  • Delegated assets: operated by a provider on the client’s behalf.
  • Referenced assets: linked from the client but owned by another party.
  • Impersonation or look-alike assets: not controlled by the client but potentially relevant to brand abuse.

Only owned and explicitly delegated assets should normally enter active testing without further permission.

4. From Observations to an Attack-Surface Map

An attack-surface map is more than a list of IP addresses. It represents assets, relationships, exposure paths, trust boundaries, and business context.

A useful asset record contains:

FieldPurpose
Asset identifierDomain, hostname, IP, application, account, or service name
Asset typeWebsite, API, mail service, cloud storage, VPN, repository, or identity provider
OwnershipClient, subsidiary, provider, or unknown
SourceURL, DNS response, certificate record, document, or approved scan
First and last observedSupports freshness assessment
ExposurePublic, restricted, internal, or unknown
TechnologyProduct, framework, protocol, or hosting platform
Business roleCustomer portal, administration, development, support, or unknown
ConfidenceHigh, medium, or low, with justification
Scope statusIn scope, out of scope, or requires confirmation
NotesRisks, dependencies, and recommended validation

Confidence and corroboration

Confidence is a judgment about the reliability of an assertion. It is not the same as severity. A hostname identified in a current client-provided inventory and confirmed through DNS may have high confidence. A hostname appearing only in an old search result may have low confidence.

A simple qualitative model is often adequate:

  • High confidence: current evidence from two or more independent sources, or direct confirmation from the client.
  • Medium confidence: credible evidence from one current source, or partial corroboration.
  • Low confidence: historical, ambiguous, indirect, or potentially stale evidence.

The model should be explained in the report. It is a communication aid, not a claim of statistical certainty.

Exposure paths and trust boundaries

Mapping should show how a user, partner, or Internet-based service could reach an asset. Typical relationships include:

  • Public DNS → web application → identity provider.
  • Internet user → mail gateway → cloud mailbox.
  • Customer portal → payment provider.
  • Developer workstation → code repository → deployment pipeline.
  • Remote worker → virtual private network → internal administrative service.

Trust boundaries occur where control, identity, data sensitivity, or ownership changes. These boundaries deserve attention because misconfiguration or weak integration may create paths that are not visible when assets are examined separately.

Conceptual attack-surface map External actors Customers Employees Partners Public services Web, API, mail, DNS Identity provider Authentication and access Third-party provider Payment or SaaS platform Internal systems Admin, data, operations trust boundary
Conceptual attack-surface map showing external users, public services, identity provider, third-party provider, and internal systems
Figure: Conceptual attack-surface map showing external users, public services, identity provider, third-party provider, and internal systems

Figure: A conceptual attack-surface map showing public services, identity relationships, third-party dependencies, and internal trust boundaries.

5. Authorized Active Reconnaissance

Active reconnaissance should be incremental. Begin with low-impact verification and increase activity only when the scope and operational risk are understood.

Recommended sequence

  1. Confirm the target is in scope.
  2. Resolve approved domain names and record responses.
  3. Request only expected public pages or service metadata.
  4. Identify exposed services using approved, rate-limited methods.
  5. Record timestamps, source addresses, tools, settings, and errors.
  6. Stop when the objective has been met or unexpected behavior occurs.
  7. Compare results with client inventories and passive evidence.

The tester should use a dedicated testing source address where possible, follow agreed rate limits, and avoid bypassing access controls. A request that returns an access-denied response is evidence of an access-control boundary, not an invitation to circumvent it.

Technology identification

Technology identification may use HTTP response headers, page structure, JavaScript references, TLS metadata, public documentation, or client-provided architecture diagrams. Fingerprinting is imperfect. A reverse proxy may hide the origin server, a header may be deliberately altered, and a framework may be shared by many products. Reports should distinguish “observed technology” from “confirmed version.”

Version information is useful only when it is current and attributable. A banner may reveal a version that is not actually installed on the backend, while a vendor-managed service may patch systems without changing the public identifier. Technology observations should therefore lead to validation questions rather than unsupported vulnerability claims.

Operational safety

Active reconnaissance can affect availability and confidentiality. Important safeguards include:

  • use the minimum request volume needed;
  • avoid destructive or state-changing requests;
  • exclude fragile devices and safety-critical systems;
  • do not submit real credentials unless explicitly authorized;
  • do not retrieve sensitive records merely to prove access;
  • preserve logs and timestamps;
  • stop immediately if performance degradation or unexpected access occurs.

6. Public Information Exposure Assessment

Exposure assessment asks not only “What is public?” but also “Why is it public, who needs it, and what could it enable?” Findings should be tied to business impact.

Examples include:

  • an administrative portal publicly reachable when it was intended for staff;
  • a development hostname revealing a pre-production system;
  • documentation exposing internal naming conventions;
  • a repository containing a historical credential or access token;
  • an employee directory supporting targeted impersonation;
  • a cloud storage link exposing non-public business documents;
  • an outdated technology disclosure that assists attacker prioritization.

The presence of information is not automatically a vulnerability. Public contact information may be necessary for business operations. The assessment should consider necessity, sensitivity, accuracy, accessibility, and likely misuse.

Privacy and data minimization

OSINT can involve personal data. Testers should collect the minimum necessary, avoid profiling individuals, redact personal details in working notes, restrict access to evidence, and follow retention and deletion requirements. Screenshots should not include unrelated private content. A report should describe a category of exposure rather than reproducing a large dataset.

7. Reporting and Evidence Management

A reconnaissance report should allow another professional to understand what was observed, when it was observed, how it was validated, and what remains uncertain.

A concise finding format is:

  • Title: clear description of the exposure or asset.
  • Observation: what was seen.
  • Evidence: source, timestamp, and limited supporting extract.
  • Scope and ownership: why the asset is relevant and whether it is authorized.
  • Security significance: plausible consequences without speculation.
  • Confidence: high, medium, or low, with justification.
  • Recommendation: practical corrective or validation action.
  • Limitation: what was not tested or could not be confirmed.

Asset inventories should use stable identifiers and avoid duplicate records. When a hostname resolves to changing addresses, record both the hostname and observation time. When several names point to the same service, retain the aliases because they may represent different business functions or certificates.

A useful quality-control review asks:

  • Is every active probe supported by authorization?
  • Is every reported asset attributable to the client or clearly marked as uncertain?
  • Are historical records distinguished from current observations?
  • Are personal and confidential data minimized?
  • Can a client reproduce the result?
  • Are recommendations proportionate to the evidence?

8. Illustrative Case Study: Northbridge Learning Services

This is a fictional illustrative case for educational purposes.

Background

Northbridge Learning Services operates an online student portal, a public marketing site, a remote-access service for staff, and several cloud-hosted applications. It commissions a reconnaissance exercise before a broader penetration test. The written scope includes the marketing domain, student portal, and staff remote-access gateway. A payment provider and the cloud identity platform are explicitly excluded from active testing.

Problem

Management believes that the public website is the organization’s only Internet-facing asset. The security team wants to know whether forgotten or poorly documented services exist and whether public information reveals unnecessary technology or organizational detail.

Analysis

The tester first reviews the authorization document and creates an asset register. Passive collection identifies:

  • the primary website and student portal;
  • mail-related DNS records;
  • several names appearing in public certificates;
  • a support subdomain referenced in an old help article;
  • a cloud identity provider linked from the portal;
  • job advertisements mentioning a particular web framework;
  • a public repository containing deployment documentation.

The support subdomain is resolved and returns no active service. It is recorded as historical or inactive rather than reported as a live vulnerability. One certificate name resolves to a live host that appears to be a development environment. Because it is not listed in the scope, the tester does not scan it and marks it “requires confirmation.”

The public repository contains a sample configuration file. It includes a placeholder value, not a functioning credential. The tester records the exposure of configuration structure but does not attempt authentication. A limited authorized review of the student portal confirms that it redirects authentication to the approved identity provider. The payment provider is visible in the application flow but is not probed.

Approach and solution

The tester produces an attack-surface map with ownership and trust boundaries. The map identifies:

  1. Public web services controlled by Northbridge.
  2. An identity service controlled by a provider and excluded from testing.
  3. A payment service controlled by a third party and excluded.
  4. A possible development host requiring scope confirmation.
  5. A stale support hostname requiring DNS and documentation cleanup.

Recommendations include removing stale documentation, confirming ownership of the development host, restricting development services, reviewing repository publication controls, and maintaining a central asset inventory.

Outcome

Northbridge confirms that the development host belongs to an old contractor environment and was unintentionally still associated with a public certificate. The contractor removes the host and Northbridge updates its certificate and DNS management process. The public repository is retained, but deployment examples are rewritten to exclude internal naming and configuration details.

Learning points

  • Discovery does not equal authorization.
  • Historical evidence must be separated from current exposure.
  • Third-party relationships must appear on the map even when they are out of scope.
  • A placeholder secret and a functioning secret have different evidential status, but both may justify process improvement.
  • Asset ownership and lifecycle management are central to attack-surface reduction.

9. Challenges, Limitations, and Common Errors

Incomplete visibility

No OSINT process discovers everything. Private applications, unindexed content, recently deployed services, and provider-managed infrastructure may remain hidden. A clean result means “not observed under the stated method and time,” not “does not exist.”

False attribution

Shared hosting, content delivery networks, cloud platforms, and recycled IP addresses can make ownership ambiguous. IP ownership alone is insufficient to establish that a service belongs to the client.

Stale information

DNS records, certificates, repositories, job advertisements, and search indexes may persist after systems change. Every important observation should include a timestamp and freshness assessment.

Tool dependence

Automated tools can produce large volumes of duplicate or low-confidence results. Tool output should be treated as leads requiring human validation. Blind reliance can cause scope violations and inaccurate reporting.

Confirmation bias

Testers may seek evidence that supports an initial hypothesis, such as assuming that a hostname is a production server because its name sounds important. Alternative explanations should be considered and documented.

Excessive collection

Collecting unnecessary personal information, documents, or credentials increases legal, ethical, and breach risk. Reconnaissance should be purpose-limited and data-minimized.

10. Contemporary Developments and Professional Practice

Cloud adoption, remote work, software-as-a-service, infrastructure as code, and rapid deployment have made attack surfaces more dynamic. A single organization may use multiple cloud accounts, temporary environments, serverless functions, managed identity systems, and external APIs. Attack-surface mapping is therefore increasingly continuous rather than annual.

Artificial intelligence can assist with hostname clustering, duplicate removal, document classification, technology extraction, and relationship visualization. It should not be treated as an authoritative source. AI-generated associations may be wrong, and sending sensitive OSINT to an external model may violate confidentiality requirements. Human review, source citation, and controlled data handling remain essential.

Effective organizations combine reconnaissance findings with exposure-management processes. Asset inventories should have owners, lifecycle states, business criticality, and review dates. Newly discovered assets should enter a workflow for verification, remediation, or formal exception. The goal is not to eliminate all public exposure; it is to ensure that public exposure is deliberate, understood, and appropriately protected.

Chapter Summary

Reconnaissance is a controlled intelligence process that supports penetration testing and security improvement. Passive OSINT can reveal domains, services, technologies, organizational details, and third-party relationships without directly probing systems. Authorized active reconnaissance verifies selected observations through carefully limited interaction, but it must follow written scope, rate limits, timing restrictions, and safety procedures.

Attack-surface mapping organizes assets and relationships rather than merely listing addresses. Strong maps record ownership, exposure, business role, evidence, timestamps, confidence, and scope status. Trust boundaries and third-party dependencies are especially important because security risk often arises between systems rather than within one isolated asset.

Professional practice requires validation, data minimization, privacy protection, accurate attribution, and clear reporting. Historical or ambiguous information must not be presented as confirmed current exposure. Reconnaissance should produce actionable knowledge while avoiding unnecessary access, collection, or disruption.

Key Terms

Reconnaissance: The planned collection and analysis of information about a target.

OSINT: Intelligence derived from publicly available information.

Passive reconnaissance: Information collection that does not directly probe target systems.

Active reconnaissance: Controlled interaction with target systems to verify exposure or services.

Rules of engagement: Written conditions defining authorized activities, limits, timing, and contacts.

Scope: The assets, systems, organizations, and activities included in an engagement.

Attack surface: The collection of externally reachable assets and potential entry points.

Asset inventory: A structured record of systems, services, ownership, and status.

Trust boundary: A point where control, identity, data sensitivity, or ownership changes.

Certificate transparency: Public logging of issued digital certificates.

DNS: The Domain Name System, which maps names to network-related records.

Technology fingerprinting: Inferring software, platforms, or protocols from observable characteristics.

Confidence rating: An assessment of how reliable or corroborated an observation is.

Data minimization: Collecting and retaining only information necessary for the defined purpose.

Third-party dependency: An external service or provider on which an organization relies.

False attribution: Incorrectly associating an asset or service with the target.

Evidence: Information that supports a reported observation or conclusion.

Exposure management: The ongoing identification, evaluation, and reduction of unnecessary exposure.

Review Questions

Short Answer Questions

  1. What is the difference between passive and active reconnaissance?
  2. Why does discovery of an asset not automatically grant permission to test it?
  3. Name four fields that should appear in an asset record.
  4. What is the purpose of a confidence rating?
  5. Why should historical OSINT be distinguished from current evidence?

Long Answer Questions

  1. Explain the reconnaissance lifecycle from planning through reporting, including the role of validation.
  2. Discuss how DNS, certificate transparency, web content, repositories, and job advertisements can contribute to OSINT.
  3. Explain how trust boundaries and third-party providers should be represented in an attack-surface map.
  4. Describe the operational and ethical safeguards required during authorized active reconnaissance.
  5. Discuss the limitations of automated discovery tools and the importance of human judgment.

Analytical / Application Questions

  1. A public certificate reveals a hostname that resolves to an active server, but the hostname is absent from the engagement scope. Describe the steps you should take and explain why.
  2. An organization’s public repository contains deployment instructions and an apparent credential that is not confirmed to work. Assess the evidence, identify safe next steps, and propose remediation.
  3. Construct a conceptual attack-surface map for an organization with a public portal, cloud identity provider, payment service, remote-access gateway, and internal administration system. Identify ownership, trust boundaries, and which components require explicit authorization before active testing.

Multiple Choice Questions with Answers

Question 1

Which activity is the best example of passive reconnaissance?

A. Reviewing a publicly available company web page

B. Sending a high-volume port scan to a server

C. Attempting a password against a login portal

D. Uploading a test file to an application

Correct Answer: A. Reviewing a publicly available company web page

Question 2

What is the primary purpose of rules of engagement?

A. To guarantee that every vulnerability will be found

B. To define authorized activities, limits, timing, and contacts

C. To replace the need for evidence collection

D. To permit testing of every related third-party system

Correct Answer: B. To define authorized activities, limits, timing, and contacts

Question 3

Which statement about a hostname found in an old search result is most appropriate?

A. It is confirmed to be a current production asset

B. It should automatically be exploited

C. It should be treated as potentially stale and validated

D. It proves that the organization owns the associated IP address

Correct Answer: C. It should be treated as potentially stale and validated

Question 4

Which field most directly records whether an observed asset belongs to the client?

A. Font size

B. Ownership

C. Screen resolution

D. Browser language

Correct Answer: B. Ownership

Question 5

Why should a tester avoid retrieving large quantities of publicly accessible personal data?

A. Public data can never be relevant to security

B. It increases privacy, legal, and evidence-handling risks

C. It makes DNS resolution impossible

D. It automatically changes the testing scope

Correct Answer: B. It increases privacy, legal, and evidence-handling risks

Question 6

A service is operated by a cloud provider and is explicitly excluded from the engagement. What is the correct action when it appears in an application flow?

A. Probe it because it is technically reachable

B. Attempt authentication to verify its security

C. Record the dependency and respect the exclusion

D. Use it as a proxy for testing the client

Correct Answer: C. Record the dependency and respect the exclusion

Question 7

What does a confidence rating describe in an attack-surface inventory?

A. The financial value of an asset

B. The reliability and corroboration of an observation

C. The number of employees using a service

D. The maximum bandwidth of a network

Correct Answer: B. The reliability and corroboration of an observation

Question 8

Which action is most consistent with safe authorized active reconnaissance?

A. Using the minimum necessary request volume and agreed rate limits

B. Bypassing an access-denied response

C. Changing data to prove that access is possible

D. Scanning all addresses related to a provider

Correct Answer: A. Using the minimum necessary request volume and agreed rate limits

Question 9

What is a trust boundary in an attack-surface map?

A. A duplicate asset record

B. A point where control, identity, data sensitivity, or ownership changes

C. A list of expired certificates

D. A measure of Internet speed

Correct Answer: B. A point where control, identity, data sensitivity, or ownership changes

Question 10

Which statement best describes the role of AI in reconnaissance?

A. AI output is authoritative and requires no review

B. AI eliminates the need for authorization

C. AI can assist with classification and clustering but requires human validation

D. AI permits sensitive data to be shared without governance controls

Correct Answer: C. AI can assist with classification and clustering but requires human validation

Penetration Testing and Ethical Hacking
Chapter 4 of 15