Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iknowjason/edge

Recon tool for cloud provider attribution. Supports AWS, Azure, Google, Cloudflare, and Digital Ocean.
https://github.com/iknowjason/edge

bugbounty pentesting pentesting-tools redteam-tools

Last synced: 1 day ago
JSON representation

Recon tool for cloud provider attribution. Supports AWS, Azure, Google, Cloudflare, and Digital Ocean.

Awesome Lists containing this project

README

        

# Cloud edge
*Lookup an IP to find the cloud provider and other details based on the provider's published JSON, CSV, or text data*

Cloud edge is a recon tool focused on exploring cloud service providers. It can be used for cloud attribution and forensics, pentesting, bug bounty, red teaming, or general R&D of cloud providers. Edge automatically loads Cloud Service Provider (CSP) published IP address ranges (AWS, Azure, GCP, Cloudflare, Digital Ocean) files and performs a prefix lookup based on the input IP address. Can be used to integrate in with other recon tooling. In a black box network pentest, edge quickly discovers which cloud CSP the customer is hosted with, or just double-verifying the scope for rules of engagement. Each of these CSPs publish a list of all of their IP prefixes and/or netblocks. For Azure and AWS, this adds the region/data center and service name. This is an excellent enrichment for threat intelligence, allowing you to map IP addresses to physical data centers and cloud services. Cloud Edge can be useful for reconnaissance workflows to quickly know "what you're dealing with" - it quickly parses and performs a lookup based on IP prefix.

![](edge-usage.png)

# Input and Output
Here are a few notes on how the tool works for inputs and output.

## Getting Started: First Run Download of CSP Files

Run Cloud Edge and it will automatically download all cloud provider files supported. If the files don't exist in working directory, they will be downloaded:

```
% ./edge
[INF] Starting Cloud Edge version 0.2.4
[INF] File cloud.json has been downloaded and created
[INF] File aws.json has been downloaded and created
[INF] File cloudflare-ipv4.txt has been downloaded and created
[INF] File cloudflare-ipv6.txt has been downloaded and created
[INF] File digitalocean.csv has been downloaded and created
[INF] File azure.json has been downloaded and created
```

If you're offline and they can't be downloaded, check the ```csp-files``` directory in this repository. Copy them to working directory.

## Files from cloud providers

When the tool runs for the first time, it automatically tries to download and load the six cloud provider IP address ranges JSON, text, and csv files to the working directory. Here is how it works:

By default it will attempt to download the six files from the URLs below unless the files are already in the working directory.

| Provider | Local File | Remote URL |
|:-------------:|:-------------:| :-----:|
| AWS | aws.json | https://ip-ranges.amazonaws.com/ip-ranges.json |
| Azure | azure.json | https://azservicetags.azurewebsites.net/ |
| GCP | cloud.json | https://www.gstatic.com/ipranges/cloud.json |
| Cloudflare | cloudflare-ipv4.txt | https://www.cloudflare.com/ips-v4/# |
| Cloudflare | cloudflare-ipv6.txt | https://www.cloudflare.com/ips-v6/# |
| Digital Ocean | digitalocean.csv | https://digitalocean.com/geo/google.csv |

Cloud Edge checks for each file before downloading. So if the file already exists, it obviously won't be downloaded again unless you delete it.

These six files are included in this github repository in the ```csp-files``` directory. Since the Cloud Providers frequently update their lists, ensure you have the latest files by removing the files in your working directory: ```aws.json, azure.json, cloud.json, cloudflare-ipv4.txt, cloudflare-ipv6.txt, digitalocean.csv```.

If found in working directory, all IP prefixes are loaded into memory. The cloud provider IP ranges files always attempt to load from working directory. Enabling the actual lookup is done with the ```-prefix``` flag.

When ```-dns``` mode is enabled, DNS lookups for both A and CNAME records are buffered without display until all DNS queries are finished. After the queries are finished, the output is displayed.

## Default [INF] Mode enabled

By the default the output displays Informational messages starting with ```[INF]```. This can be disabled with ```-silent``` flag. The output will look like this:
```
./edge -single 140.179.144.130
[INF] Single IP prefix lookup of 140.179.144.130
[INF] Matched IP [140.179.144.130] to Cloud Provider via prefix [AWS:140.179.144.128/25]
[INF] Matched IP [140.179.144.130] to Cloud Service [API_GATEWAY] and Region [cn-north-1]
140.179.144.130,Provider:AWS;Prefix:140.179.144.128/25;Region:cn-north-1;Service:API_GATEWAY
```

Informational messages will tell you if a record is found through a DNS 'A' record, DNS 'CNAME' record, Certificate (crt.sh), or if a prefix match is found. Prefix matches will tell you the cloud provider detected with the matching prefix, as well as the cloud service and region if applicable. Azure regions are not currently detected but AWS ones are.

## Default CSV Output

With ```-dns``` or ```crt``` mode, the output is is sent by default to the console as comma delimited results. This makes it easy to use other tools to parse these results.
```
FQDN,IP,SOURCE,CNAME,DESCRIPTION
```

* **FQDN:** This is the DNS lookup as a FQDN.
* **IP:** This is the IP address returned from an A record if found.
* **SOURCE:** This is the source of the lookup. Either A, CNAME, or Certificate.
* **CNAME:** This returns the CNAME or ALIAS if the request is a CNAME.
* **DESCRIPTION:** This returns any results from the IP address ranges description if ```-prefix``` is enabled.

With ```-prefix``` mode and either ```-ip``` or ```-nmap```, the output is sent by default to the console as comma delimited results:

```
IP,DESCRIPTION
```

The ```IP``` is the IP address and the ```DESCRIPTION``` is the results from the IP address ranges lookup in the cloud provider IP address ranges JSON files, if applicable.

With ```-ptr``` mode and either ```ip``` or ```nmap```, the output is sent by default to the console as comma delimited results:
```
IP,PTR
```

The ```IP``` is the IP address and the ```PTR``` is the results from the DNS PTR lookup if found.

## IP Address files with -IP
The ```-ip``` flag signals to iterate through a list of IP addresses and can be used in ```prefix``` or ```ptr``` mode. When you run the tool with ```-ip ```, it expects each IP address in a separate line, and will iterate through the list doing lookups. Here is an example of the file contents:
```
user@host:~/demo$ cat ip.txt
3.133.110.237
18.117.232.92
18.221.247.211
3.137.199.52
```

## Nmap XML files
The ```-nmap``` flag signals to parse an nmap XML file. It will look for any host in the nmap scan file marked as "Up." For example, ```-nmap scan1.xml``` will tell the tool to parse the scan1.xml file and look for any hosts marked as Up by nmap. You then run it with either -ptr or -prefix to do a lookup of the IP.

## Subdomain enumeration with -wordlist
The tool performs classic subdomain enumeration by iterating through a wordlist containing hostnames, one hostname per line. This is used in ```-dns``` mode with ```-wordlist ```. An example of what this looks like for the hosts.txt file:

```
user@host:~/demo$ more subdomains-5k.txt
www
blog
news
blogs
en
online
```

# Options
```
$ edge -help
Usage of edge:
-crt
Certificate transparency lookup mode
-csv string
Output results to CSV file
-dns
A and CNAME record lookup mode
-domain string
The domain to perform guessing against.
-ip string
The text file to use with IP addresses
-nmap string
Nmap scan xml file to use.
-output
Enable output to CSV
-prefix
IP Prefix CSP lookup mode
-ptr
PTR lookup mode
-resolver string
The DNS server to use. (default "8.8.8.8:53")
-silent
Enable silent mode to suppress [INF]
-single string
Single IP address to do a prefix lookup
-verbose
Enable verbose output
-wordlist string
The wordlist to use for guessing.
-workers int
The amount of workers to use. (default 10)
```

# Examples

**Example #1:** Look up a single IP address
```
edge -single
```

**Description:** Perform a prefix lookup of a single IP address supplied with `````` against the cloud provider's JSON files.

**Sample Output:**
```
edge -single 140.179.144.130
[INF] Single IP prefix lookup of 140.179.144.130
[INF] Matched IP [140.179.144.130] to Cloud Provider via prefix [AWS:140.179.144.128/25]
[INF] Matched IP [140.179.144.130] to Cloud Service [API_GATEWAY] and Region [cn-north-1]
140.179.144.130,Provider:AWS;Prefix:140.179.144.128/25;Region:cn-north-1;Service:API_GATEWAY
```

***
**Example #2:** Look up a single IP address and suppress Info messages
```
$ edge -single -silent
```

**Description:** Same as above, except enable the silent mode. This suppresses the [INF] messages with extra information.

**Sample Output:**
```
edge -single 140.179.144.130
140.179.144.130,Provider:AWS;Prefix:140.179.144.128/25;Region:cn-north-1;Service:API_GATEWAY
```
***
**Example #3:** Use local provider JSON files instead of downloading them.

```
edge -single -silent -nd
```

**Description:** Don't try to download the provider JSON files, but instead use the local files in working directory.

***
**Example #4:** Wordlist subdomain enumeration with certificate transparancy and prefix lookup.

```
edge -domain -dns -crt -prefix -wordlist
```

**Description:** Perform a wordlist subdomain enumeration of all A and CNAME records based on wordlist.txt against domain with certificate transparency lookup. For each enumerated host found with Cert transparency, also do a DNS lookup. Do an IP prefix lookup of the IP address across all three cloud service provider's published list of IP prefixes.

**Sample Output:**
```
edge -domain tesla.com -dns -crt -prefix -wordlist subdomains-5k.txt
[INF] Found host via crt.sh [nas-origin.tesla.com]
nas-origin.tesla.com,,Certificate,,
[INF] Found host via crt.sh [eua-origin.tesla.com]
eua-origin.tesla.com,,Certificate,,
[INF] Found host via CNAME [fleetview.prd.na.fn.tesla.com.:fleetview.prd.usw2.fn.tesla.com]
fleetview.prd.na.fn.tesla.com.,,CNAME,fleetview.prd.usw2.fn.tesla.com,
[INF] Found host via CNAME [fleetview.prd.usw2.fn.tesla.com.:a69ff530d53f14d8e8059a3aee44e9ab-1848028946.us-west-2.elb.amazonaws.com]
fleetview.prd.usw2.fn.tesla.com.,,CNAME,a69ff530d53f14d8e8059a3aee44e9ab-1848028946.us-west-2.elb.amazonaws.com,
[INF] Found host via A [a69ff530d53f14d8e8059a3aee44e9ab-1848028946.us-west-2.elb.amazonaws.com:52.39.128.70]
[INF] Matched Cloud Provider via prefix [AWS:52.36.0.0/14]
[INF] Matched IP [52.39.128.70] to Cloud Service [EC2] and Region [us-west-2]
```
***
**Example #5:** Wordlist subdomain enumeration without certificate transparency or IP prefix lookup.

```
edge -domain -dns -wordlist
```

**Description:** Perform just a wordlist scan of all A and CNAME records based on wordlist.

**Sample Output:**
```
edge -domain tesla.com -dns -wordlist subdomains-5k.txt
[INF] Found host via CNAME [fleetview.prd.na.fn.tesla.com.:fleetview.prd.usw2.fn.tesla.com]
fleetview.prd.na.fn.tesla.com.,,CNAME,fleetview.prd.usw2.fn.tesla.com,
[INF] Found host via A [e9056.b.akamaiedge.net:23.2.254.58]
e9056.b.akamaiedge.net,23.2.254.58,A,teslamotors.vanity3.ca1.qualtrics.com,
```
***
**Example #6:** Wordlist subdomain enumeration without certificate transparency but looking up IP prefix for any IP addresses found.

```
edge -domain -dns -wordlist -prefix
```

**Description:** Perform just a wordlist scan of all A and CNAME records based on wordlist. For every IP address enumerated, perform a prefix lookup.

***

**Example #7:** Certificate transparency log lookup.

```
edge -domain -crt
```

**Description:** Do a Certificate Transparency log lookup using https://crt.sh

**Sample Output:**
```
edge -domain tesla.com -crt
[INF] Running certificate transparency lookup crt.sh
[INF] Found host via crt.sh [solarbonds.tesla.com]
solarbonds.tesla.com,,Certificate,,
[INF] Found host via crt.sh [energydesk.tesla.com]
energydesk.tesla.com,,Certificate,,
```

***

**Example #8:** Certificate transparency with DNS lookup

```
edge -domain -dns -crt
```

**Description:** Perform a Certificate transparency lookup. For each host discovered via Cert Transparency, do a full DNS A or CNAME lookup.

***

**Example #9:** IP prefix lookup with IP address list

```
edge -prefix -ip
```

**Description:** Perform a lookup of the IP address for the cloud service provider IP prefix. Takes a list of IP addresses in ip-hosts.txt and looks through it doing a lookup. One IP address per line.

**Sample Output:**
```
edge -prefix -ip ip-hosts.txt
[INF] Matched IP [140.179.144.130] to Cloud Provider via prefix [AWS:140.179.144.128/25]
[INF] Matched IP [140.179.144.130] to Cloud Service [API_GATEWAY] and Region [cn-north-1]
140.179.144.130,Provider:AWS;Prefix:140.179.144.128/25;Region:cn-north-1;Service:API_GATEWAY
[INF] Matched IP [18.189.124.22] to Cloud Provider via prefix [AWS:18.189.0.0/16]
[INF] Matched IP [18.189.124.22] to Cloud Service [EC2] and Region [us-east-2]
18.189.124.22,Provider:AWS;Prefix:18.189.0.0/16;Region:us-east-2;Service:EC2
[INF] Matched IP [20.60.128.132] to Cloud Provider via prefix [Azure:20.60.0.0/16]
[INF] Matched IP [20.60.128.132] to Cloud Service [AzureStorage]
20.60.128.132,Provider:Azure;Prefix:20.60.0.0/16;Name:Storage;ID:Storage;Platform:Azure;SystemService:AzureStorage
```

***

**Example #10:** DNS PTR lookup with ip address list

```
edge -ptr -ip
```

**Description:** Does a DNS PTR lookup based on the IP address on each line of ip-hosts.txt.

**Sample Output:**
```
edge -ptr -ip ip-hosts.txt
140.179.144.130,ec2-140-179-144-130.cn-north-1.compute.amazonaws.com.cn.
```

***

**Example #11:** Parses nmap file and does prefix lookup of IP addresses found

```
edge -prefix -nmap
```

**Description:** Parses an nmap scan XML file, identifying all "Up" hosts. For every "Up" host in nmap XML scan results, do an IP prefix lookup for the cloud service provider.

***

**Example #12:** Parses nmap file and does DNS PTR lookup of each IP address found

```
edge -ptr -nmap
```

**Description:** Parses an nmap scan XML file, and does a PTR lookup of every "Up" host.

***

**Example #13:** Adds concurrency with 100 workers to boost performance

```
edge -domain -dns -wordlist -workers 100
```

**Description:** Uses a DNS concurrency scan of 100 workers. This increases the scan speed. Default workers: 10.

***

**Example #14:** Specify a DNS resolver

```
edge -domain -dns -wordlist -resolver 8.8.4.4:53
```

**Description:** Specify a DNS resolver of 8.8.4.4 on port 53. Default is 8.8.8.8.

# Installing

## Binaries
You can grab the pre-compiled binaries or build it. Make sure you also get the cloud provider IP prefix JSON files.

## Building
Tested with go1.19

```
$ git clone https://github.com/iknowjason/edge.git
$ cd edge
~/edge$ go build edge.go
~/edge$ ./edge (Verify it)
```

# Credits
@mosesrenegade for tool inspiration

@0xdabbad00 for general AWS tools and inspiration

This tool was inspired from many other tools and authors, including dnsrecon and gobuster. Yeah I know. Not a lot new here - just another subdomain enumeration tool. I just really wanted to learn Golang :-)

"Black Hat Go" book