1. Overview, intro

https://owasp.org/www-project-top-ten/ All webapps suffer from the same kinds of vulnerabilities + misconfigurations. Above.

Always a common vector. Esp. with remote work, apps discussed here serve as foothold into an internal env during ext assessment, or as a foothold / lateral move / add'tl issue reported in internal assessment.

State of app sec in research survey commissioned by Barracuda

Categorization of common webapps and examples

Category Applications
Web Content Management Joomla, Drupal, WordPress, DotNetNuke, etc.
Application Servers Apache Tomcat, Phusion Passenger, Oracle WebLogic, IBM WebSphere, etc.
Security Information and Event Management (SIEM) Splunk, Trustwave, LogRhythm, etc.
Network Management PRTG Network Monitor, ManageEngine Opmanger, etc.
IT Management Nagios, Puppet, Zabbix, ManageEngine ServiceDesk Plus, etc.
Software Frameworks JBoss, Axis2, etc.
Customer Service Management osTicket, Zendesk, etc.
Search Engines Elasticsearch, Apache Solr, etc.
Software Configuration Management Atlassian JIRA, GitHub, GitLab, Bugzilla, Bugsnag, Bitbucket, etc.
Software Development Tools Jenkins, Atlassian Confluence, phpMyAdmin, etc.
Enterprise Application Integration Oracle Fusion Middleware, BizTalk Server, Apache ActiveMQ, etc.

There are potentially thousands of apps not mentioned above. https://enlyft.com/tech/

Many suffer from public exploits, func to gain RCE / steal creds, access sens. information with/without valid creds.

Enlyft site above: 3.7m companies using wordpress (70% market share) SIEM tool splunk 22k comp + 30% mkt share

Goal is to make a concerted effort to understand how these work and WHY specific vulns/misconfigs exist rather than just reproducing examples in module.


Module targets

URLs will be referred to like http://app.inlanefreight.local

IP=10.129.42.195
printf "%s\t%s\n\n" "$IP" "app.inlanefreight.local dev.inlanefreight.local blog.inlanefreight.local" | sudo tee -a /etc/hosts

Application discovery and enumeration

Many orgs DONT.

We'll likely ID forgotten apps, demo vers, trial licenses expired + converted to versions that do not require auth, apps with default creds, unauth/misconfig apps, apps w/ public vulns

Big picture here: LAY OF THE LAND on any network starting with very little to information, (black box discovery or just set of CIDR ranges) ping sweep to ID live hosts and portscan responding hosts

Say we nmap a network and find an enormous amount of hosts that have services running on 80 and 443 alone - sifting through this data manually would be tremendously time consuming esp. since assessments are under time constraints.


Organization - Tips and pointers on structuring notes

For this section, I would break down the Enumeration & Discovery section of my notebook into a separate Application Discovery section. Here I would create subsections for the scope, scans (Nmap, Nessus, Masscan, etc.), application screenshotting, and interesting/notable hosts to dig more into later. It is important to time and date stamp every scan that we perform and save all output and the exact scan syntax that was performed and the targeted hosts. This can be useful later on if the client has any questions about the activity they saw during the assessment.

An example OneNote (also applicable to other tools) structure may look like the following for the discovery phase:

External Penetration Test - <Client Name>

We will refer back to this structure throughout the module, so it would be a very beneficial exercise to replicate this and record all of our work on this module as if we were working through an actual engagement. This will help us refine our documentation methodology, an essential skill for a successful penetration tester. Having notes to refer back to from each section will be helpful when we get to the three skills assessments at the end of the module and will be extremely helpful as we progress in the Penetration Tester path.

Assume you're given a scope:

In non-evasive full scope pentest:

  1. Determine OS of servers
  2. Pay attention to hostnames - Vhosts simulate subdomains
  3. Names give hints - dev may indicate untested features and gitlab etc may be nice to take a real close look at
    1. Services that allow unauth users to register and access.
    2. Find add'tl repos potentially uncovering creds

Using eyewitness

  1. Takes XML output from nmap/nessus, creates report
  2. Will also categorize where possible, fingerprint, and suggest default creds based on the app
  3. Can be given a list of IP addresses and URLs and be told to pre-pend http:// and https://
  4. Performs DNS res for IPs and can be given specific set of ports to attempt to connect to + scerenshot.

https://github.com/FortyNorthSecurity/EyeWitness

Example usage with --web to take screenshots using nmap XML output from discovery as input:

eyewitness --web -x web_discovery.xml -d inlanefreight_eyewitness

Using Aquatone

Similar to eyewitness. Take screenshots provided .txt file of hosts, or nmap .xml with -nmap flag. Under active development in a new fork focusing on improvements and feature enhancements https://github.com/shelld3v/aquatone

 wget https://github.com/michenriksen/aquatone/releases/download/v1.7.0/aquatone_linux_amd64_1.7.0.zip
unzip aquatone_linux_amd64_1.7.0.zip

Move it to a location in our $PATH var like /usr/local/bin - Or, just drop binary in working directory. Personal preference but typically most effective to build our attack VMs with most tools available to use without having to constantly change directories or call them from other locations

 cat web_discovery.xml | ./aquatone -nmap

After opening report we'll see its organized in categories: High value being first and 'juiciest' to go after. Running Eyewitness against large envs and gen report with hundreds of pages that will take hours to go through. Often large reports will have interesting hosts buried in them. It's worth reviewing the entire thing and poking at/ researching hosts we aren't familiar with.

Some services may be buried deep and not autodetected.

Seeing Tomcat is a good sign. (Especially on an external assessment)

Take notes on interesting hosts, URL with app name/version for later, DO NOT begin attacking hosts right away - You may end up in a rabbit hole and miss something crucial later in the report!

During external tests expect mix of:

YMMV.

Sometimes you will encounter applications that absolutely should not be exposed, like a single page with a file upload button Internally you will see much of the same but the added inclusion of printer login pages, (which you could probably leverage to obtain cleartext LDAP), ESXi, vCenter login portals, iLO, and iDRAC, plethoea of network devices / IOT, IP Phones, internal code repos, sharepoints, custom intranet portals, security appliances, etc.

Focus on mindset and methodology.

Many testers have great technical skills but soft skills such as a sound, and repeatable, methodology along with organization, attention to detail, strong communication, and thorough notetaking/documentation and reporting can set us apart and help to build confidence in our skillsets from both our employers as well as our clients.

Initial web application enumeration: Using Eyewitness


sudo apt install eyewitness


stejwes@htb[/htb]$ eyewitness -h

usage: EyeWitness.py [--web] [-f Filename] [-x Filename.xml]
                     [--single Single URL] [--no-dns] [--timeout Timeout]
                     [--jitter # of Seconds] [--delay # of Seconds]
                     [--threads # of Threads]
                     [--max-retries Max retries on a timeout]
                     [-d Directory Name] [--results Hosts Per Page]
                     [--no-prompt] [--user-agent User Agent]
                     [--difference Difference Threshold]
                     [--proxy-ip 127.0.0.1] [--proxy-port 8080]
                     [--proxy-type socks5] [--show-selenium] [--resolve]
                     [--add-http-ports ADD_HTTP_PORTS]
                     [--add-https-ports ADD_HTTPS_PORTS]
                     [--only-ports ONLY_PORTS] [--prepend-https]
                     [--selenium-log-path SELENIUM_LOG_PATH] [--resume ew.db]
                     [--ocr]

EyeWitness is a tool used to capture screenshots from a list of URLs

Protocols:
  --web                 HTTP Screenshot using Selenium

Input Options:
  -f Filename           Line-separated file containing URLs to capture
  -x Filename.xml       Nmap XML or .Nessus file
  --single Single URL   Single URL/Host to capture
  --no-dns              Skip DNS resolution when connecting to websites

Timing Options:
  --timeout Timeout     Maximum number of seconds to wait while requesting a
                        web page (Default: 7)
  --jitter # of Seconds
                        Randomize URLs and add a random delay between requests
  --delay # of Seconds  Delay between the opening of the navigator and taking
                        the screenshot
  --threads # of Threads
                        Number of threads to use while using file based input
  --max-retries Max retries on a timeout
                        Max retries on timeouts

<SNIP>

Let's run the default --web option to take screenshots using the Nmap XML output from the discovery scan as input.

example nmap:

sudo nmap --open -sV 10.129.201.50
eyewitness --web -x web_discovery.xml -d inlanefreight_eyewitness

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

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


Common Web applications - Using Aquatone

┌──(root㉿kali)-[/tools]
└─# wget https://github.com/michenriksen/aquatone/releases/download/v1.7.0/aquatone_linux_amd64_1.7.0.zip

unzip and:

┌──(root㉿kali)-[/tools]
└─# mv aquatone /usr/local/bin/aquatone

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