---
title: "Information gathering"
date: 2023-08-17
draft: false
---

A typical penetration test comprises the following stages:

- Defining the Scope
- Information Gathering
- Vulnerability Detection
- Initial Foothold
- Privilege Escalation
- Lateral Movement
- Reporting/Analysis
- Lessons Learned/Remediation


**============Passive information gathering =============**
- AKA OSINT 
Definition: Openly-available [public] information about a target, without direct interaction 

Strictly: External third parties /only/ for information. 
Loosely: May interact with target, but only as a normal internet user would. If you can register for an account, you could do that. However, you would not test the website for vulnerabilities. 

``` 
The ultimate goal of passive information gathering is to obtain information that clarifies or expands an attack surface
```

**WHOIS** - `can provide information about a domain name, such as the name server and registrar.` This is often public - registrars charge a fee for private registration. 

**GoogleHacking** - essentially search filters. 
https://support.google.com/websearch/answer/2466433?hl=en

**Github**

![](/img/Pasted image 20230817215634.png)

```bash
trivera:$apr1$A0vSKwao$GV3sgGAj53j.c3GkS4oUC0
```

This manual approach will work best on small repos. For larger repos, we can use several tools to help automate some of the searching, such as _Gitrob_[8](https://portal.offsec.com/courses/pen-200/books-and-videos/modal/modules/information-gathering/passive-information-gathering/open-source-code#fn8) and _Gitleaks_.[9](https://portal.offsec.com/courses/pen-200/books-and-videos/modal/modules/information-gathering/passive-information-gathering/open-source-code#fn9). Most of these tools require an access token[10](https://portal.offsec.com/courses/pen-200/books-and-videos/modal/modules/information-gathering/passive-information-gathering/open-source-code#fn10) to use the source code-hosting provider's API.

**Shodan**
(Shodan, 2022), https://www.shodan.io/ ↩︎
(Wikipedia, 2022) https://en.wikipedia.org/wiki/Internet_of_things ↩︎

**## Security Headers and SSL/TLS**
(Scott Helme, 2022), https://securityheaders.com/ ↩︎


**===========ACTIVE INFO GATHER===========**

We'll mainly showcase active information gathering techniques that we can execute using pre-installed tools on our local Kali machine. However, in some cases during a penetration test, we won't have the luxury of running our favorite Kali Linux tool.

LOLBAS - living off the land binaries, scripts, and libraries
https://lolbas-project.github.io/

**DNS ENUMERATION**
Each domain can use different types of DNS records. Some of the most common types of DNS records include:

- **NS**: Nameserver records contain the name of the authoritative servers hosting the DNS records for a domain.
- **A**: Also known as a host record, the "_a record_" contains the IPv4 address of a hostname (such as www.megacorpone.com).
- **AAAA**: Also known as a quad A host record, the "_aaaa record_" contains the IPv6 address of a hostname (such as www.megacorpone.com).
- **MX**: Mail Exchange records contain the names of the servers responsible for handling email for the domain. A domain can contain multiple MX records.
- **PTR**: Pointer Records are used in reverse lookup zones and can find the records associated with an IP address.
- **CNAME**: Canonical Name Records are used to create aliases for other host records.
- **TXT**: Text records can contain any arbitrary data and be used for various purposes, such as domain ownership verification.

**IP SCANNING**
