amass

The OWASP Amass Project performs network mapping of attack surfaces and external asset discovery using open source information gathering and active reconnaissance techniques.

        .+++:.            :                             .+++.
      +W@@@@@@8        &+W@#               o8W8:      +W@@@@@@#.   oW@@@W#+
     &@#+   .o@##.    .@@@o@W.o@@o       :@@#&W8o    .@#:  .:oW+  .@#+++&#&
    +@&        &@&     #@8 +@W@&8@+     :@W.   +@8   +@:          .@8
    8@          @@     8@o  8@8  WW    .@W      W@+  .@W.          o@#:
    WW          &@o    &@:  o@+  o@+   #@.      8@o   +W@#+.        +W@8:
    #@          :@W    &@+  &@+   @8  :@o       o@o     oW@@W+        oW@8
    o@+          @@&   &@+  &@+   #@  &@.      .W@W       .+#@&         o@W.
     WW         +@W@8. &@+  :&    o@+ #@      :@W&@&         &@:  ..     :@o
     :@W:      o@# +Wo &@+        :W: +@W&o++o@W. &@&  8@#o+&@W.  #@:    o@+
      :W@@WWWW@@8       +              :&W@@@@&    &W  .o#@@W&.   :W@WWW@@&
        +o&&&&+.                                                    +oooo.

Usage

The most basic use of the tool for subdomain enumeration:

amass enum -d example.com

Typical parameters for DNS enumeration:

$ amass enum -brute -min-for-recursive 2 -d example.com
example.com (FQDN) --> node --> www.example.com (FQDN)
www.example.com (FQDN) --> a_record --> 123.456.789.01 (IPAddress)
...

Executing the tool via the Docker image:

docker run -v OUTPUT_DIR_PATH:/.config/amass/ caffix/amass:latest enum --list

The volume argument allows the Amass graph database to persist between executions and output files to be accessed on the host system. The first field (left of the colon) of the volume option is the amass output directory that is external to Docker, while the second field is the path, internal to Docker, where amass will write the output files.

Command-line Usage Information

The amass tool has several subcommands shown below for handling your Internet exposure investigation.

SubcommandDescription
intelCollect open source intelligence for investigation of the target organization
enumPerform DNS enumeration and network mapping of systems exposed to the Internet
dbManage the graph databases storing the enumeration results

All subcommands have some default global arguments that can be seen below.

FlagDescriptionExample
-h/-helpShow the program usage messageamass subcommand -h
-configPath to the YAML configuration fileamass subcommand -config config.yaml
-dirPath to the directory containing the graph databaseamass subcommand -dir PATH -d example.com
-nocolorDisable colorized outputamass subcommand -nocolor -d example.com
-silentDisable all output during executionamass subcommand -silent -json out.json -d example.com

Each subcommand’s own arguments are shown in the following sections.

The ‘intel’ Subcommand

The intel subcommand can help you discover additional root domain names associated with the organization you are investigating. The data source sections of the configuration file are utilized by this subcommand in order to obtain passive intelligence, such as reverse whois information.

FlagDescriptionExample
-activeEnable active recon methodsamass intel -active -addr 192.168.2.1-64 -p 80,443,8080
-addrIPs and ranges (192.168.1.1-254) separated by commasamass intel -addr 192.168.2.1-64
-asnASNs separated by commas (can be used multiple times)amass intel -asn 13374,14618
-cidrCIDRs separated by commas (can be used multiple times)amass intel -cidr 104.154.0.0/15
-dDomain names separated by commas (can be used multiple times)amass intel -whois -d example.com
-demoCensor output to make it suitable for demonstrationsamass intel -demo -whois -d example.com
-dfPath to a file providing root domain namesamass intel -whois -df domains.txt
-efPath to a file providing data sources to excludeamass intel -whois -ef exclude.txt -d example.com
-excludeData source names separated by commas to be excludedamass intel -whois -exclude crtsh -d example.com
-ifPath to a file providing data sources to includeamass intel -whois -if include.txt -d example.com
-includeData source names separated by commas to be includedamass intel -whois -include crtsh -d example.com
-ipShow the IP addresses for discovered namesamass intel -ip -whois -d example.com
-ipv4Show the IPv4 addresses for discovered namesamass intel -ipv4 -whois -d example.com
-ipv6Show the IPv6 addresses for discovered namesamass intel -ipv6 -whois -d example.com
-listPrint the names of all available data sourcesamass intel -list
-logPath to the log file where errors will be writtenamass intel -log amass.log -whois -d example.com
-oPath to the text output fileamass intel -o out.txt -whois -d example.com
-orgSearch string provided against AS description informationamass intel -org Facebook
-pPorts separated by commas (default: 80, 443)amass intel -cidr 104.154.0.0/15 -p 443,8080
-rIP addresses of preferred DNS resolvers (can be used multiple times)amass intel -r 8.8.8.8,1.1.1.1 -whois -d example.com
-rfPath to a file providing preferred DNS resolversamass intel -rf data/resolvers.txt -whois -d example.com
-timeoutNumber of minutes to execute the enumerationamass intel -timeout 30 -d example.com
-vOutput status / debug / troubleshooting infoamass intel -v -whois -d example.com
-whoisAll discovered domains are run through reverse whoisamass intel -whois -d example.com

The ‘enum’ Subcommand

This subcommand will perform DNS enumeration and network mapping while populating the selected graph database. All the setting available in the configuration file are relevant to this subcommand. The following flags are available for configuration:

Mode description

  • Normal: Run enum subcommand without specifing active or passive flag will seed the enumeration from data sources and leverage DNS to validate findings and further investigate the namespaces in scope (provided domain names)

    amass enum -d example.com

  • Active: It will perform all of the Normal mode and reach out to the discovered assets and attempt to obtain TLS certificates, perform DNS zone transfers, use NSEC walking, and perform web crawling.

    amass enum -active -d example.com -p 80,443,8080

  • Passive: It will only obtain information from data sources and blindly accept it.

    amass enum --passive -d example.com

FlagDescriptionExample
-activeEnable active recon methodsamass enum -active -d example.com -p 80,443,8080
-altsEnable generation of altered namesamass enum -alts -d example.com
-awPath to a different wordlist file for alterationsamass enum -aw PATH -d example.com
-awm”hashcat-style” wordlist masks for name alterationsamass enum -awm dev?d -d example.com
-blBlacklist of subdomain names that will not be investigatedamass enum -bl blah.example.com -d example.com
-blfPath to a file providing blacklisted subdomainsamass enum -blf data/blacklist.txt -d example.com
-brutePerform brute force subdomain enumerationamass enum -brute -d example.com
-dDomain names separated by commas (can be used multiple times)amass enum -d example.com
-demoCensor output to make it suitable for demonstrationsamass enum -demo -d example.com
-dfPath to a file providing root domain namesamass enum -df domains.txt
-dns-qpsMaximum number of DNS queries per second across all resolversamass enum -dns-qps 200 -d example.com
-efPath to a file providing data sources to excludeamass enum -ef exclude.txt -d example.com
-excludeData source names separated by commas to be excludedamass enum -exclude crtsh -d example.com
-ifPath to a file providing data sources to includeamass enum -if include.txt -d example.com
-ifaceProvide the network interface to send traffic throughamass enum -iface en0 -d example.com
-includeData source names separated by commas to be includedamass enum -include crtsh -d example.com
-ipShow the IP addresses for discovered namesamass enum -ip -d example.com
-ipv4Show the IPv4 addresses for discovered namesamass enum -ipv4 -d example.com
-ipv6Show the IPv6 addresses for discovered namesamass enum -ipv6 -d example.com
-listPrint the names of all available data sourcesamass enum -list
-logPath to the log file where errors will be writtenamass enum -log amass.log -d example.com
-max-depthMaximum number of subdomain labels for brute forcingamass enum -brute -max-depth 3 -d example.com
-min-for-recursiveSubdomain labels seen before recursive brute forcing (Default: 1)amass enum -brute -min-for-recursive 3 -d example.com
-nfPath to a file providing already known subdomain names (from other tools/sources)amass enum -nf names.txt -d example.com
-norecursiveTurn off recursive brute forcingamass enum -brute -norecursive -d example.com
-oPath to the text output fileamass enum -o out.txt -d example.com
-oAPath prefix used for naming all output filesamass enum -oA amass_scan -d example.com
-pPorts separated by commas (default: 443)amass enum -d example.com -p 443,8080
-passiveA purely passive mode of executionamass enum -passive -d example.com
-rIP addresses of untrusted DNS resolvers (can be used multiple times)amass enum -r 8.8.8.8,1.1.1.1 -d example.com
-rfPath to a file providing untrusted DNS resolversamass enum -rf data/resolvers.txt -d example.com
-rqpsMaximum number of DNS queries per second for each untrusted resolveramass enum -rqps 10 -d example.com
-scriptsPath to a directory containing ADS scriptsamass enum -scripts PATH -d example.com
-timeoutNumber of minutes to execute the enumerationamass enum -timeout 30 -d example.com
-trIP addresses of trusted DNS resolvers (can be used multiple times)amass enum -tr 8.8.8.8,1.1.1.1 -d example.com
-trfPath to a file providing trusted DNS resolversamass enum -trf data/trusted.txt -d example.com
-trqpsMaximum number of DNS queries per second for each trusted resolveramass enum -trqps 20 -d example.com
-vOutput status / debug / troubleshooting infoamass enum -v -d example.com
-wPath to a different wordlist file for brute forcingamass enum -brute -w wordlist.txt -d example.com
-wm”hashcat-style” wordlist masks for DNS brute forcingamass enum -brute -wm ?l?l -d example.com

The Output Directory

Amass has several files that it outputs during an enumeration (e.g. the log file). If you are not using a database server to store the network graph information, then Amass creates a file based graph database in the output directory. These files are used again during future enumerations.

By default, the output directory is created in the operating system default root directory to use for user-specific configuration data and named amass. If this is not suitable for your needs, then the subcommands can be instructed to create the output directory in an alternative location using the ‘-dir’ flag.

If you decide to use an Amass configuration file, it will be automatically discovered when put in the output directory and named config.yaml.

The Configuration File

The location of the configuration file can be specified using the -config flag or the AMASS_CONFIG environment variable.

Amass automatically tries to discover the configuration file (named config.yaml) in the following locations:

Operating SystemPath
Linux / Unix$XDG_CONFIG_HOME/amass/config.yaml or $HOME/.config/amass/config.yaml or /etc/amass/config.yaml
Windows%AppData%\amass\config.yaml
OSX$HOME/Library/Application Support/amass/config.yaml

These are good places for you to put your configuration file.

Note that these locations are based on the output directory. If you use the -dir flag, the location where Amass will try to discover the configuration file will change. For example, if you pass in -dir ./my-out-dir, Amass will try to discover a configuration file in ./my-out-dir/config.yaml.

Default Section

OptionDescription
modeDetermines which mode the enumeration is performed in: default, passive or active
output_directoryThe directory that stores the graph database and other output files
maximum_dns_queriesThe maximum number of concurrent DNS queries that can be performed

The resolvers Section

OptionDescription
resolverThe IP address of a DNS resolver and used globally by the amass package

The scope Section

OptionDescription
addressIP address or range (e.g. a.b.c.10-245) that is in scope
asnASN that is in scope
cidrCIDR (e.g. 192.168.1.0/24) that is in scope
portSpecifies a port to be used when actively pulling TLS certificates or crawling

The scope.domains Section

OptionDescription
domainA root DNS domain name to be added to the enumeration scope

The scope.blacklisted Section

OptionDescription
subdomainA DNS subdomain name to be considered out of scope during the enumeration

The graphdbs Section

The graphdbs.postgres Section

OptionDescription
primaryWhen set to true, the graph database is specified as the primary db
urlURL in the form of “postgres://[username:password@]host[:port]/database-name?sslmode=disable” where Amass will connect to a PostgreSQL database
optionsAdditional PostgreSQL database options

The bruteforce Section

OptionDescription
enabledWhen set to true, brute forcing is performed during the enumeration
recursiveWhen set to true, brute forcing is performed on discovered subdomain names as well
minimum_for_recursiveNumber of discoveries made in a subdomain before performing recursive brute forcing
wordlist_filePath to a custom wordlist file to be used during the brute forcing

The alterations Section

OptionDescription
enabledWhen set to true, permuting resolved DNS names is performed during the enumeration
edit_distanceNumber of times an edit operation will be performed on a name sample during fuzzy label searching
flip_wordsWhen set to true, causes words in DNS names to be exchanged for others in the alteration word list
flip_numbersWhen set to true, causes numbers in DNS names to be exchanged for other numbers
add_wordsWhen set to true, causes other words in the alteration word list to be added to resolved DNS names
add_numbersWhen set to true, causes numbers to be added and removed from resolved DNS names
wordlist_filePath to a custom wordlist file that provides additional words to the alteration word list

The data_sources Section

OptionDescription
ttlThe number of minutes that the responses of all data sources for the target are cached

The data_sources.SOURCENAME Section

OptionDescription
ttlThe number of minutes that the response of the data source for the target is cached
The data_sources.SOURCENAME.CREDENTIALSETID Section
OptionDescription
apikeyThe API key to be used when accessing the data source
secretAn additional secret to be used with the API key
usernameUser for the data source account
passwordValid password for the user identified by the ‘username’ option

The data_sources.disabled Section

OptionDescription
data_sourceOne of the Amass data sources that is not to be used during the enumeration

The Graph Database

All Amass enumeration findings are stored in a graph database. This database is either located in a single file within the output directory or connected to remotely using settings provided by the configuration file.

When a new enumeration begins and a graph database already exists with previous findings for the same target(s), the subdomain names from those previous enumerations are utilized in the new enumeration. New DNS queries are performed against those subdomain names to ensure that they are still legitimate and to obtain current IP addresses.

There is nothing preventing multiple users from sharing a single (remote) graph database and leveraging each others findings across enumerations.

Setting up PostgreSQL for OWASP Amass

Once you have the postgres server running on your machine and access to the psql tool, execute the follow two commands to initialize your amass database:

psql postgres://username:password@localhost:5432/ -c "CREATE DATABASE assetdb"
psql postgres://username:password@localhost:5432/ -c "ALTER DATABASE assetdb SET TIMEZONE to 'UTC'"

Now you can add the following setting into your Amass config.yaml file for storing and analyzing attack surface discoveries using PostgreSQL:

options:
  database: "postgres://username:password@localhost:5432/assetdb?testing=works"