Mapping an Application's Attack Surface to Reconnaissance Steps
Gaining visibility into an application’s attack surface is really important in identifying risk areas. In cases of an attack, it can also help in determining root cause i.e. the part(s) of an attack surface that was the origin of the breach.
In using an attacker’s perspective through reconnaissance, you can proactively identify attack surfaces. This will always help in quickly noticing attack surface changes or deciding on the best strategy for minimizing risk.
I will be highlighting the various attack surface components that can be found during the different phases of a typical (web app) reconnaissance workflow. To have a better understanding, I will make use of football analogies.
Football Analogy: Attack Surface Enumeration via Recon
Let’s do an illustration by using analogies from the beautiful game of football, specifically using a phase of play that has been well discussed in the last couple of years: The Build-Up Play
. Think of this as any football game where in building up from the back, the goal is to move the ball (in this case our workflow/process) from our half to the opponent’s half
.
Befittingly we’ll be using the 4-3-3 formation to show this, used by some of the greatest and most celebrated teams of all time; Ajax 1971–73, Bayern 1973–76, Barcelona 2008-2012.
PATHWAY 1: Build-Up Play (Through the Middle)
A flowing move through the middle is always fun
[6] SUBDOMAIN ENUMERATION
- ATTACK SURFACE (DNS Information)
There is great value in having complete knowledge of all DNS properties (e.g. subdomains) mapped to an application. Subdomain enumeration is a process that involves a lot of open source intelligence (OSINT), by combing various sources for valuable data like ip addresses, whois info, asn, zone records, email addresses etc. A company could have subdomains that they are not aware of, which affects visibility into those subdomains and could make them less secure. A good tool for finding, tracking and automating the DNS discovery process is Amass.
Category | Component | Notes |
---|---|---|
DNS Information | Subdomains | test.corp.ng |
IP Address | 10.10.10.10 |
[5] PORT SCAN
- ATTACK SURFACE (Network Information)
Disabling unneeded ports or services is a well known hardening control to help reduce attack surfaces.
Category | Component | Notes |
---|---|---|
Network Information | Open Ports/Protocol | 8443 (TCP) |
Running Services | Apache |
[4] GATHER VALID TARGETS
- ATTACK SURFACE (Input Vectors)
In navigating the application, the aim here is to discover any functionality in the application that accepts input.
Category | Component | Notes |
---|---|---|
Input Vectors | Data entry {CRUD} forms & Fields | /signup |
Inquiries and Search Functions | /search | |
File Upload Functions | /upload |
- ATTACK SURFACE (Access Controls)
We also want to understand how the application implements security measures for things like authentication, authorization or session management.
Category | Component | Notes |
---|---|---|
Access Controls | Roles | Admin, User |
Privileges | /upload, /search | |
Session State/Cookies | #####, #### |
- ATTACK SURFACE (Key Functionality)
Finally we try to identify key functions based on the business workflow or logic.
Category | Component | Notes |
---|---|---|
Key Functionality | Business Workflow/Logic | API Calls, Database Access |
[8] DIRECTORY-FILE DISCOVERY
- ATTACK SURFACE (Hidden Content)
It is time to find additional data, anything that will uncover parts of the application that may be hidden or content that does not have direct links to pages.
Category | Component | Notes |
---|---|---|
Hidden Content | Files | .bak .tmp .conf “cache:” robots.txt |
Directories | /ccard/2020, admin panel, error pages |
[10] PLATFORM IDENTIFICATION
- ATTACK SURFACE (Tech Stack)
Category | Component | Notes |
---|---|---|
Tech Stack | Language | python |
Framework | django | |
Technologies/Platforms | aws github | |
Integrations/Plugins | shopify |
PATHWAY 2: Build-Up Play (Long Ball Over the Top)
A long ball over the top could achieve the same goal
[9] FIND MISCONFIGURATIONS
- ATTACK SURFACE (3rd Party Platforms)
Category | Component | Notes |
---|---|---|
3rd Party Platforms | Configuration Weaknesses | (subdomain takeover) example.corp.ng/404.html |
(github page) api secret key |
PATHWAY 3: Build-Up Play (Through the Flanks)
Sometimes the flanks provide a better path to move upfield
[2]&[7] DISCOVER PUBLIC EXPLOITS
- ATTACK SURFACE (Known Vulnerabilities)
Vulnerability scanners primarily perform this function, which is to identify service/software versions and compare it with a database of known vulnerabilities or use any signature-matching process. However because of the possibility of false positives or negatives, it is always a good idea to manually review vulnerability scan results when possible.
Category | Component | Notes |
---|---|---|
Known Vulnerabilities | Service/Software Exploits | RCE exploit (apache version) |
[3]&[11] DISCOVER ENTRYPOINTS
- ATTACK SURFACE (ENDPOINTS)
Category | Component | Resource | Method | Entrypoint | Parameter |
---|---|---|---|---|---|
Endpoints | Rest API | /login | POST | api.corp.ng | username=admin&password=*** |
Conclusion
Attack surfaces change all the time from the introduction of new app servers, to changes in the software packages running on them and so on. Therefore it is crucial that different strategies be taken to keep accurate information of an applications attack surface. Today we have looked at enumerating attack surfaces via a typical recon workflow, but beyond identification it is also necessary to do analysis for determining high risk areas based on the different functionalities of the application. To read further on this, I recommend going through the owasp cheatsheet for attack surface analysis: Owasp Attack Surface Cheatsheet.