Each feature that you add to a website results in a new element that has to be managed.
The credentials are accepted by a login page, the data by a contact form, new code is introduced by a plugin, and an API is used to connect your website to another service. It is also possible that an old staging site or a forgotten backup may still be accessible from the internet.
The collection of these exposed components constitutes your website attack surface.
Understanding your attack surface answers a practical security question: what an attacker can access and what might happen if one of those areas is vulnerable.

What we want is not to get rid of all the features, but to work out which ones are visible, take out those that are unnecessary, and ensure that the ones that need to stay do stay.
The attack surface of a website refers to all the points at which an attacker might attempt to enter the system, affect its operation, or gain access to data.
According to NIST, an attack surface consists of the places from which someone might try to gain access, produce an effect, or obtain data from a system.
For a typical website, that can include:
OWASP recommends these entry and exit points be examined in order to determine which sections of the application require extra testing and protection.
The fact that a website has a larger attack surface doesn’t mean that it is insecure. However, each extra component will add another area that has to be patched, configured, monitored, and protected.
Suppose there is a small ecommerce website.
At first sight it might seem to consist of nothing more than a storefront and an administrator dashboard, however, it could also have:
Every component has a valid purpose and at the same time provides another possible route which requires security controls.
Risk may still exist with regard to software that you no longer use if the files from that software remain on the server.
Turning off a plugin is not always equivalent to getting rid of it. If the component is unnecessary, then uninstalling it means less code has to be maintained.
The same principle holds true in the case of abandoned themes, test scripts, old CMS installations, and leftover migration tools.
Each account sets up a further method of authentication.
Administrator accounts are particularly important since they have wide-ranging privileges and any old employee, contractor, developer, or agency accounts should be deleted when access is no longer needed.
For those who are active users, the principle of least privilege should be applied by granting each person only the permissions necessary for carrying out their job.
CMS dashboards, database administration tools, hosting panels, and other administrative interfaces can be accessed from the internet.
They may need to remain accessible, but they deserve stronger controls such as:
Websites and services can automatically exchange information through the use of APIs.
They can be used for making payments, for shipping, for mobile applications, for inventory management, for CRM systems, for analytics, and for a number of other purposes. Yet each API endpoint or credential means that something has to be secured.
Get rid of any integrations that are not any longer in use and cancel the old API credentials.
A site used for staging can have the same software, administrative accounts, and database records as the production environment.
When it is publicly accessible or is in a state of poor maintenance, it provides attackers with another means of probing.
When testing is over, remove the temporary environments and apply access controls to protect the staging environment.
Organizations often accumulate subdomains such as:
A number of them stay online long after the purpose for which they were originally created is no longer there.
Make a list of the subdomains that are currently active and delete the DNS entries and applications that are no longer needed.
It is essential to have backups if you want to recover data, but backup files that are not properly stored may also reveal the source code, configuration details, or the contents of the database.
Do not leave downloadable archives in web directories that anyone can access.
For example:
example.com/backup.zipIt could turn into a serious problem if it is possible for anyone to retrieve it. Secure the backups and limit who can access them.
Reducing the attack surface is mainly about getting rid of any unnecessary exposure and at the same time reinforcing the parts that you still need.
It is impossible to guarantee ownership of assets of which you are unaware.
Create a basic inventory of:
For smaller websites, a spreadsheet will be sufficient.
Keep a record of who owns each component and whether it is still required.
Review the inventory and ask:
Does the website still require this?
If the answer is negative, take it out properly.
It could involve removing a plugin, erasing an abandoned CMS installation, closing an old account, cancelling an API token, or retiring a temporary subdomain.
Simplifying by removing unneeded components also makes maintenance easier.
It is not possible to get rid of all components that are accessible over the internet, so you should keep those that are left.
Keep the following up to date:
Fixing the known vulnerabilities involves patching, and at the same time, removing unused software gets rid of components that no longer need to exist.
They are connected but distinct security practices.
Restrict the actions that accounts can perform.
Do not grant Administrator access to anyone who merely needs to publish content or check orders.
Get rid of inactive accounts and take back the credentials when employees, developers, or vendors no longer require access.
The website relies on them and so those areas cannot be deleted.
Secure those areas using multiple layers of security.
For example:
A website firewall can act as a protective barrier between internet traffic and the website, enabling it to filter out malicious requests before these requests get to the application.
The area that can be attacked varies with time.
A developer can introduce a new API, marketing can install a plugin, a temporary subdomain can become permanent, and a new employee can be given administrator access.
It is recommended by OWASP that the attack surface should be reviewed whenever an application is changed since new interfaces, authentication methods, user roles and technologies could all bring about different risks.
As part of regular website maintenance, carry out an attack-surface review.

Although these terms are connected, they are not interchangeable.
An attack surface refers to anything that is exposed and with which an attacker can interact.
A weakness constitutes a vulnerability.
For example, any plugin that is available to the public adds to your attack surface. When that plugin has a software defect which can be exploited, then the defect is a vulnerability.
Getting rid of a plugin that is not being used completely eliminates the attack surface.
The need for the plugin to function means that the vulnerability can be dealt with without reducing the attack surface of the website.
This distinction is useful because good website security requires both approaches:
Minimize unnecessary exposure and address the weaknesses in the components that you retain.
An attack vector is the means or route that an attacker uses when trying to carry out a compromise.
For example:
Similarly:
Considering matters in this way can simplify the process of making security decisions; you should first determine what is exposed and then think about the ways in which those areas could be attacked.
Review your website and ask:
It is not necessary to deal with all the issues at once. Instead, begin with the components that are exposed and offer little or no business value, since these usually present the simplest opportunity for reducing risk.
It’s not realistic for a public website to have no means by which it can be attacked.
If the visitors are able to connect with it, then there must be something that is reachable.
What we are aiming for, therefore, is not to achieve zero. Instead, our aim should be to keep the attack surface as small as is practical while at the same time protecting the services that the website actually needs.
It involves getting rid of unnecessary components, restricting access, fixing any software problems, keeping an eye on changes, and installing defensive measures at all key entry points.
It’s simpler to ensure website security if you know precisely what you are trying to protect.
Your attack surface includes more than the pages visitors see. It extends to logins, software components, APIs, user accounts, hosting tools, development environments, subdomains, integrations, and backups.
Start by making those components visible. Remove what you do not need. Patch and restrict what remains. Then monitor your website as its attack surface changes.
For additional visibility, use Sucuri SiteCheck to scan publicly accessible website pages for known malware and certain security issues, and consider website security monitoring to help detect changes and threats.