Penetration testing: Using ReconFTW - Part 1

In short
  • Cybersecurity has become a priority for companies; penetration testing is part of the learning process.
  • Introducing ReconFTW, a reconnaissance framework that orchestrates many tools.
  • Deployment on Rocky Linux 9, followed by the first scan in "recon" mode.
  • Powerful tools to be used responsibly, only on your own targets.

Introduction

Cybersecurity has become a major issue for companies. Long neglected, especially in France, IT security is now among the top priorities of managers and company executives.


In its early days, IT was mainly composed of experts and enthusiasts with a very technical approach.

But things gradually changed starting in the 2000s, accelerating progressively.

The famous "digitalization" and digital transformation made IT more accessible to the rest of the company...and above all, the financial stakes continued to increase, making IT increasingly lucrative for some players.


After the cloud, big data, and blockchain, it is now cybersecurity's turn to be in the spotlight. For several years, many executives have suddenly developed a passion for IT security, with a desire to finally understand what their IT teams are doing.

To do this, they could rely on numerous consulting and auditing firms that were able to present themselves as experts in the subject through carefully prepared PowerPoint presentations and vocabulary filled with trendy jargon.

SIEM, SOC, IPS, IDR, WAF, VOC, XOAR... So many acronyms... And so many ways to sell miracle solutions and products!


Overnight, everything became cyber: backups, server clustering, DR/BC plans, OS configuration...

Engineers and technicians who have been working in the field for years suddenly saw dynamic managers, full of questions and advice about protecting the IT architecture, sitting next to them. Unfortunately, most of these newcomers were unable to explain the difference between TCP and UDP or type a single command into any shell.


Add to this the explosion of AI, and we find ourselves in a period ripe for BFM and 01net articles filled with catchy and alarming headlines. This is enough to make business leaders and other managers who subscribe to numerous X and LinkedIn feeds tremble, reassuring them in their new position as cybersecurity experts.

Furthermore, there's a continued focus on delivery at the expense of security, forcing tight schedules, and ignoring the warnings of those with their hands in the trenches.


As a result, we see data breaches one after another, while EDR (Endpoint Detection and Response) and DLP (Data Loss Prevention) solutions are more widely deployed than ever. However, they can do little to address basic credential errors in sources that are themselves hosted on public Git repositories...


I would like to share a post by David L., co-founder of Orsec and SYlink, a cybersecurity expert, who expresses a view that I fully share.

Post by Davi L

Click the image to enlarge.

Faced with technical teams under immense pressure, who are no longer given the time to do their jobs, and whose recommendations are ignored, increasingly professional hackers are taking advantage of companies' legacy systems and the bad habits they have developed over time. They quietly infiltrate IT systems around the world and attempt to make some profits.


Of course, I am not opposed to the democratization of cybersecurity or to our leaders becoming aware, even belatedly, of this crucial issue. After all, expertise is only valuable if it benefits something other than itself.

Ideally, knowledge should be shared. But for that, we need to involve the right people and know how to be humble, even if we believe we have the highest possible level of education. I have often seen self-taught individuals do much better than graduates from top schools.


It is time to go back to basics, to dig again and revisit the fundamentals. Cybersecurity is not done only with an Excel sheet and a roadmap; it is also done with tech, hours of work, listening and practice.

And in this regard, AI, when used effectively, can become a valuable tool for learning how to use and understand tools that were previously reserved for an elite group in the field.

Even though a true cybersecurity expert can never be replaced by a few tutorials and a prompt, we can now try to improve our skills through experimentation and continuous assessment of our knowledge.

reconFTW

To better combat the enemy, we need to learn how to use our weapons and understand their techniques. To that end, let's learn to play the role of attackers and engage in pentesting, or penetration testing, as it is known in French. This is a method used to evaluate the security of an IT system (website, application, network, etc.) by simulating real attacks. The goal is to detect security vulnerabilities before they are exploited by malicious attackers.


It's misleading to believe that most of the so-called miracle tools on the market for penetration testing and vulnerability detection operate independently of existing open-source software components. Open source has been providing powerful tools dedicated to cybersecurity for years, but user experience and interface design have never been a priority for the developers involved.


To better address cybersecurity challenges and feel more comfortable with the subject, I decided to try out the reconFTW solution

reconFTW

Click the image to enlarge.

reconFTW is an automation tool used primarily in penetration testing, bug bounty programs, or security audits. It automates the entire reconnaissance process for a target, from discovering domains to analyzing vulnerabilities, by combining a wide variety of popular tools.

It takes a domain (private or public) as input and then scans it using:

  • A passive reconnaissance: there is no direct interaction with the assets associated with that domain, but multiple cybersecurity repositories are consulted in an attempt to identify elements related to the target domain (subdomains, whois information, vulnerability databases, data leaks, etc.).
  • An active reconnaissance technique: in this context, ReconFTW will use numerous scanners that directly interact with the domain's assets to attempt to identify vulnerabilities and associated flaws. These tests can be more or less intrusive and may cause incidents on the targeted assets.

The objective of ReconFTW is to cover the following areas:

  • Complete enumeration of subdomains (passive, brute force, permutations, certificate transparency, etc.)
  • Vulnerability scanning for XSS, SSRF, SQLi, LFI, SSTI, and other vulnerabilities
  • OSINT (Open Source Intelligence or intelligence from open sources) for email addresses, metadata, API leaks, and misconfigurations of third-party services

ReconFTW is a powerful tool that has been available since 2021 and is still maintained by its original creator, @six2dez, a cybersecurity researcher active in the bug bounty and offensive security community.

ReconFTW is widely used in the cybersecurity world and relies on reference tools. To learn about them, ChatGPT or a similar tool is a good way to start. In this case, AI is faster than Google searches (but keep in mind that knowing a tool doesn't mean you know how to use it).


🔍 Subdomain discovery:

  • Subfinder: A fast and popular tool for passive subdomain discovery.
  • Amass: A reference tool for advanced enumeration (passive, active, brute force, graphs).
  • Assetfinder: Quickly searches for subdomains from root domains.

🌐 Service verification and HTTP scanning:

  • Httpx: Tests which subdomains are online and collects HTTP information (headers, codes, etc.).
  • Naabu: A fast port scanner based on masscan/zmap.
  • Nmap: A classic tool for in-depth network scans (banners, services, OS).

🛡️ Vulnerability scanning:

  • Nuclei: A vulnerability scanner based on templates.

    Widely used in bug bounty programs.
  • Dalfox: Specialized in detecting XSS vulnerabilities (reflected, stored, DOM).
  • KXSS: Detects potential injection points for XSS in URLs.

🗂️ URL and endpoint indexing:

  • Waybackurls: Retrieves old archived URLs (from the Wayback Machine).
  • Gau (GetAllUrls): Aggregates known endpoints for a domain from various services.
  • Hakrawler: A crawler written in Go that retrieves links, forms, JS endpoints, etc.

🛠️ Other key tools:

  • FFUF: A path/parameter fuzzer used for brute-forcing directories.
  • GF (Grep patterns): Used to filter for interesting patterns in files (XSS, LFI).
  • JSParser: Analyzes JavaScript files to find hidden URLs or endpoints.

This list is not exhaustive, but it provides a good overview of the tools used by ReconFTW. Feel free to visit the project website to learn more.

A tool to be used with caution

Warning: The use of ReconFTW should only be done for legitimate and controlled purposes. You should only apply it to assets that you own, being aware of the potential impacts.

Depending on the configuration used, you may make the services scanned by the tools executed by ReconFTW unavailable.

Also, be careful about the source you use to run the tool. For example, if you are using a public cloud server, your provider may detect abnormal traffic from your machine and ask you for explanations. Providers may not appreciate the use of their service for penetration testing because they cannot know whether your usage is legitimate or not.

I would also like to clarify that, even though I find the subject of cybersecurity fascinating, and have done so for a long time, I am not an expert.

The purpose of this article is to show you what is possible by taking a genuine interest in cybersecurity.

By combining the power of open-source tools and access to AI, we can assess the security of our IT infrastructure…with a few precautions, of course.

Don't hesitate to do your own research, develop your skills as much as possible, and experiment extensively.

Deployment

Using WSL

To demonstrate that it is possible to use powerful tools from a simple workstation running a mainstream operating system like Windows 11, the entire tutorial will be done from my personal computer, and for once, I will not talk about containers or Kubernetes (even though ReconFTW is fully compatible as a container, with additional automation scripting compatible with Ansible/Terraform).

However, I will be relying on the Windows Subsystem For Linux layer that I have previously presented in this article.

This Windows feature allows you to run a Linux environment on a Windows machine. Traditionally, cybersecurity tools are more focused on the Linux world. There are even specialized distributions like Kali Linux, dedicated to penetration testing.

WSL version used

Click the image to enlarge.

If you really dislike Microsoft, you can directly use a Linux operating system, specifically of the RedHat type. In my case, I will be using a WSL Rocky Linux 9 image.

Of course, this is still an experiment and demonstration. In a real-world scenario, I recommend running reconFTW on a dedicated server or a workstation with a native Linux operating system and appropriate hardware configuration.

I will also be using the ollama AI tool, which I have presented many times before, including here, and which allows you to run local LLM models. As we will see later, reconFTW offers an AI integration script that can request assistance from an Ollama instance to analyze results.

Be aware that if you want to use this AI component as well, you will need hardware with a GPU that has at least 12GB of VRAM.

I won't detail the installation of WSL on Windows. You can go here to learn how to do it.

However, since Rocky Linux is not directly available for WSL, I will download the image directly from the editor's website.

Downloading the Rocky Linux image for WSL

Click the image to enlarge.

Once the image is downloaded, simply type the following command:

wsl --install --from-file F:\Down\Rocky-9-WSL-Base.latest.x86_64.wsl
Installing the rockylinux image

Click the image to enlarge.

The Rocky Linux subsystem is deployed, and you just need to create a user and then assign a password to it.

Creating the user and associated password

Click the image to enlarge.

The first thing to do once you are in Rocky Linux is to update the system with the following command:

sudo dnf update
Updating the image

Click the image to enlarge.

Next, we install the additional package findutils before installing ollama with the command dnf install findutils .

Installing findutils

Click the image to enlarge.

Setting up ollama

The next step is to deploy ollama within WSL. To do this, simply type the following command:

curl -fsSL https://ollama.com/install.sh | sudo bash
Installing Ollama

Click the image to enlarge.

You can check that ollama has started correctly with the following command:

sudo systemctl status ollama
Checking the installation

Click the image to enlarge.

To have an LLM available, we download a small model optimized for cybersecurity: foundation-sec-abliterated.

This is a model based on liama3.1, offered by Cisco and dedicated to cybersecurity. It is available without "censorship" for ollama and can be downloaded with the following command:

ollama pull huihui_ai/foundation-sec-abliterated
Downloading an LLM model

Click the image to enlarge.

We verify that the model is available in the list.

ollama list
Checking for the presence of the model

Click the image to enlarge.

Prerequisites for reconFTW

Now we can move on to the prerequisites for reconFTW

By default, Rocky Linux 9.x comes with Python version 3.9. As of the writing of this article, you need at least version 3.11 to be fully compatible with the reconftw tool suite.

Default Python version in rockylinux

Click the image to enlarge.

To do this, it's simple: just install the desired version, remembering to include pip3.

sudo dnf install python3.11 python3.11-pip
Installing python3.11

Click the image to enlarge.

To ensure that this version 3.11 is used as the default, you need to use the alternative command. The goal is to give Python 3.11 a higher priority than Python 3.9.

sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 10 sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 20
Installing python3.11

Click the image to enlarge.

You can verify the new configuration with the following command:

sudo alternatives --config python3
Checking the default Python version

Click the image to enlarge.

Do the same with pip3.

sudo alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.9 10 sudo alternatives --install /usr/bin/pip3 pip3 /usr/bin/pip3.11 20 sudo alternatives --config pip3
Setting the correct pip version as default

Click the image to enlarge.

At this point, I recommend restarting your WSL instance.

After returning to the Rocky Linux operating system, run the python3 --version command to display its version, which should be 3.11.

Checking the Python version

Click the image to enlarge.

Other packages will need to be installed:

sudo dnf install -y git curl wget
Installing prerequisites for reconftw

Click the image to enlarge.

python3 -m pip install --user pipx
Continuing with the prerequisites

Click the image to enlarge.

Everything is ready; now it's time to move on to reconftw itself.

Installing reconFTW

To do this, clone the Git repository. I encourage you to create a dedicated directory in your user profile for this purpose.

mkdir cyber cd cyber
Creating the directory

Click the image to enlarge.

git clone https://github.com/six2dez/reconftw.git
Downloading the source code

Click the image to enlarge.

Navigate into the retrieved source code and run the installation script.

./install.sh
Starting the installation

Click the image to enlarge.

This will take care of retrieving all the necessary components, starting with the GO runtime environment on which several tools launched by reconftw rely.

Installation process of the components

Click the image to enlarge.

Installation process of the components

Click the image to enlarge.

All binaries and scripts will be placed in a Tools folder at the root of your user directory.

The installation may take some time. It is possible that some software will not install.

End of the installation

Click the image to enlarge.

We will fix this later.

Once the installation is complete, you can proceed with configuring reconftw.

Configuring reconFTW

It should be noted that, as we saw at the beginning, Reconftw uses a multitude of tools, and each of them may require specific configuration.

I will not cover all applications, and I will only focus on the most relevant configuration elements.

To start, let's populate the ~/.config/subfinder/provider-config.yaml file.

This file is used to define all API keys associated with different online services that you may need.

Again, the list is long, and I will not use everything.

I will start with the Shodan API. It is a well-known site in the hacking community, as it references many services exposed on the internet. It is a specialized search engine that allows you to discover connected devices and, especially, those accessible from the web... often without their owners' knowledge.

Reconftw will use it in the reconnaissance phase to obtain passive information about your domain and see if any potential data is known to Shodan (which would indicate the exposure of an unintended asset).

You can create a free account on the Shodan website to obtain your API key. Be aware that with the free plan, you will be limited in the number of requests and features, but it's still a good starting point.

Obtaining an API key for Shodan

Click the image to enlarge.

Simply enter your API key in the ~/.config/subfinder/provider-config.yaml file.

Next, we have VirusTotal. This is also a reference site that allows you to scan files and URLs with multiple antivirus programs.

You can create a free account and request an API key, which you then need to insert into the ~/.config/subfinder/provider-config.yaml file.

Obtaining an API key for VirusTotal

Click the image to enlarge.

Then comes Chaos. This is a public project that provides a massive database of subdomains collected from bug bounty programs. A bug bounty (or ethical hacking program in French) is a reward program set up by a company or organization to encourage security researchers (or ethical hackers) to find and report vulnerabilities in its systems.

Obtaining an API key is free and requires registration in the ~/.config/subfinder/provider-config.yaml file.

Obtaining an API key for Chaos

Click the image to enlarge.

We will also use IntelX. This is an OSINT (Open Source Intelligence) platform for monitoring, investigation, and searching for data leaks, which functions as a specialized search engine for sensitive data.

Obtaining an API key for Intelx

Click the image to enlarge.

Finally, we finish with github, the most widely used community GIT repository in the world. With an API key obtained after creating a free account, Reconftw can scan public repositories looking for elements related to your domain. Note that when creating the API key, you should only grant read access.

Obtaining a GitHub token

Click the image to enlarge.

All of these elements will be used by reconftw to perform passive data collection. Even without directly scanning your assets, it will use these various repositories to attempt to identify compromises that are referenced and could be linked to your domain.

List of APIs and websites for OSINT

Click the image to enlarge.

The GitHub token must also be entered in ~/Tools/.github_tokens.

You also have the option of creating a GitLab account and generating a read-only token. This token can then be added to your ~/Tools/.gitlab_tokens file.

Obtaining a token for GitLab

Click the image to enlarge.

Read-only token for GitLab

Click the image to enlarge.

We are now moving on to the main configuration file for reconftw.

This is reconftw.cfg, located in the root directory of the reconftw installation.

It is necessary to edit it to adjust some variables. It is within this file that you can enable or disable certain features. By default, most options are enabled and may be suitable for many cases.

Again, it will be necessary to add API keys.

Specifically, the key already retrieved for shodan.

As well as an API key associated with a new site: WHOISXML.

WHOISXML is a suite of services that allows you to query WHOIS databases and information about past DNS resolutions. WHOIS is a protocol (and a public database) that allows you to retrieve information about the registration of a domain name or an IP address. It is one of the most widely used tools in passive reconnaissance in cybersecurity, penetration testing, or OSINT. Therefore, it is normal to find it in reconftw.

Obtaining an API key for WHOISXML

Click the image to enlarge.

Documenting the API keys

Click the image to enlarge.

Although the goal of the initial scan is purely reconnaissance, it may be interesting to enable vulnerability searching.

This is disabled by default; therefore, you must specify the value VULNS_GENERAL as true. Be aware that, as indicated in the comment associated with the parameter, this makes the scan more intrusive and takes longer.

Enabling vulnerability scanning

Click the image to enlarge.

Finally, there is the AI section at the end of the file. You must specify the LLM model to use; in our example, huihui_ai/foundation-sec-abliterated. This will be called at the end of the scan to analyze the output of the various tools.

You can also indicate the type of report you want:

  • Executive: a report intended for management, with recommendations and a summary of the results.
  • Brief: a simple summary that is easy to understand.
  • Bughunter: a more technical report, intended for penetration testers.

I recommend sticking with a Markdown output format, as it's easier to convert to HTML or PDF later.

Configuring the AI component

Click the image to enlarge.

Everything is finally ready; we can start the penetration test.

Execution

To begin, we simply run ./reconftw.sh.

This will allow us to see examples of how to pass arguments and, more importantly, to check if all the necessary components are present.

In my example, I can see that some applications are missing. This is a risk, and in this case, manual deployments will be required.

Missing applications

Click the image to enlarge.

Adding missing components

First, we need to install the compilation tools because some tools are not directly available through their binaries.

sudo dnf install -y git make gcc
Installing compilation tools

Click the image to enlarge.

Next, we start with the first missing tool: gitleaks.

Gitleaks is an open-source tool for detecting secrets in source code. It's designed to help developers and security teams avoid leaking sensitive information in Git repositories.

We retrieve the latest version of the binary directly from the developer's repository (at the time of writing this article, version 8.28).

Downloading the gitleaks binary

Click the image to enlarge.

wget https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_linux_x64.tar.gz
Downloading gitleak

Click the image to enlarge.

We decompress the archive.

tar -xzf gitleaks_8.28.0_linux_x64.tar.gz

We copy the binary to /usr/local/bin.

sudo mv gitleaks /usr/local/bin/

We verify that the binary is functional:

gitleaks version
Verifying gitleaks

Click the image to enlarge.

We can clearly see the logic behind reconFTW. For example, if a Git repository associated with your domain or one that could be similar is found through passive reconnaissance, reconFTW can pass control to Gitleaks to check if any confidential information might be hosted there.

Next, we proceed with MassDNS.

MassDNS allows you to:

  • Resolve millions of domain names or subdomains in record time.
  • Determine which subdomains actually exist (resolve) and which are just assumptions.
  • Quickly generate a list of active domains from a wordlist and a root domain.

This is why we deployed the compilation tools.

We clone the project's repository:

git clone https://github.com/blechschmidt/massdns.git
Downloading massdns

Click the image to enlarge.

We compile the source code:

cd massdns make

We copy the binary to /usr/local/bin:

sudo cp bin/massdns /usr/local/bin/
Compiling massdns

Click the image to enlarge.

Now, it's time for Katana.

Katana is a fast and customizable web crawler. In ReconFTW, Katana is used to automatically explore web pages and extract interesting paths, parameters, subdomains, or endpoints.

It's a library written in GO, and since ReconFTW has already taken care of retrieving the associated runtime environment, you just need to type.

go install github.com/projectdiscovery/katana/cmd/katana@latest
Installing Katana

Click the image to enlarge.

Similarly, jsluice is a command-line tool written in Go, designed to extract URLs, accessible paths, secrets (API keys, tokens, etc.), and other interesting elements from static JavaScript code.

go install github.com/BishopFox/jsluice/cmd/jsluice@latest
Installing jsluice

Click the image to enlarge.

Next, we have nmap, the well-known network scanner, and jq, the tool for manipulating JSON from the command line.

There are no difficulties; these applications are available directly through OS packages.

sudo dnf install -y nmap sudo dnf install -y jq
Installing nmap

Click the image to enlarge.

Installing jq

Click the image to enlarge.

Finally, the last one is ripgen, a command-line tool that allows you to quickly and efficiently generate IP address ranges from CIDR notation (x.x.x.x/yy).

For this one, you need to deploy the Rust runtime environment.

It's very simple with the following command:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Downloading RUST

Click the image to enlarge.

Remember to restart your Rocky Linux instance so that you can call elements specific to Rust from your session.

Then, thanks to Rust's dependency management system (cargo), we will install the tool by running the following command: cargo install ripgen

Installing ripgen

Click the image to enlarge.

Running the first scan

Finally, we can scan our domain.


To do this, several modes are possible:

  • Passive (option -p): This is risk-free for your assets and primarily serves to perform OSINT.

  • Recon (option -r): In addition to passive tests, access will be attempted to your assets. Normally there is little risk, but you may experience some interruptions on your sites, especially due to the Bruteforce Subdomain Enumeration test, which will heavily load your DNS servers. In my case, they eventually stopped responding for a few minutes.
  • All (option -a): This is the most aggressive test with attacks attempted on your assets. Your services may be affected by this. It's the most effective way to test your cybersecurity, but also the riskiest.

If you are just starting out, you can focus on the passive mode, but you will not have a truly complete test. However, it may be sufficient for OSINT

The recon test is more useful. By taking some precautions (be careful with your DNS), you can run it, and it will give you a good overview of your architecture.

The All test should be reserved for experts or adventurers...


In any case, plan your penetration test. Choose time slots when you have no critical activity on your services. You can choose to notify or not notify the operations teams, depending on the goal. At a minimum, it is always good to inform a few key people. Of course, in a professional environment, you must inform your management and obtain authorization to run the tool.

Make sure you can quickly interrupt the test if there is a problem, and stay close to the teams and supervisors during the scans.


You can enable or disable the -ai parameter to start analyzing the reports at the end of the scan, using the chosen LLM model and the Ollama instance deployed at the beginning of this article.

In my case, and for my domain, this translates to the following command:

./reconftw.sh -d myprivatelab.tech -r –ai
Running the first scan

Click the image to enlarge.

Be careful with your firewalls and security tools that are pre-installed on your workstation or server used for scanning. You must authorize the traffic necessary for the analysis.

In my case, I opened my OPNsense firewall in outbound mode on all ports and protocols, and I disabled the Windows firewall. Some antivirus or EDR software may also not appreciate the use of reconftw.

Disabling the Windows firewall

Click the image to enlarge.

The different tools will be called one after another, and the operations will proceed gradually.

Scan process

Click the image to enlarge.

Scan process

Click the image to enlarge.

For example, it took a little over 2 hours for the analysis to complete.

End of the scan

Click the image to enlarge.

During the last phase, we can see GPU usage related to the use of AI for analyzing the results.

Loading the AI onto the GPU

Click the image to enlarge.

All output elements are located in ~/cyber/reconftw/Recon/domain_name

Scan output

Click the image to enlarge.

Conclusion

Now, to get more details about the result and understand the output of the different tools, you will need to continue by reading the second part.

Other types of scans will also be discussed, such as advanced vulnerability scanning, which is disabled by default.

In the meantime, don't hesitate to embark on this adventure, but always being fully aware of what you are doing and where you are doing it.

Reconftw uses powerful tools that can be used for good or bad. It is up to you to learn how to use them and to become familiar with each one.

The path of learning is long, but so rewarding. I myself have just started on this path, and although I am far from seeing the finish line, the journey promises to be exciting.