7 min #defense-of-depth #web security #infrastructure security #pentesting

Importance of Multilayered Security Explained

This article explains the importance of multilayered security, also known as Defense in Depth, using the castle analogy to show how overlapping protections reduce the impact of successful attacks. Through real-world scenarios such as remote code execution and cross-site scripting, it demonstrates why securing a single component is never enough.



Version 1.0 Updated:

Introduction

In this article, we'll explain the importance of multilayered security and showcase its real-world impact. The following chapters break down the concept of multilayered security using the Castle Analogy and show how it works in practice through concrete examples:

  • Scenario 1: Remote Execution on External Asset
  • Scenario 2: Multilayered Protection Against Cross-Site Scripting (XSS)

Company Network as the Castle

The best thinking framework for securing an organization is to simultaneously fine-tune our protections to the highest level while assuming they will eventually fail.

How is that helpful?

This defensive pattern is a perfect analogy to a medieval castle. Take a moment to look at the image below. Fortress is not protected only by its walls, highlighted by the blue outline. There are several other defensive mechanisms such as:

  • Moats
  • Walls
  • Watchtowers
  • Defensive Ditches
  • Castle Defenders

and so on...

Following our line of thought medieval architects had to be confident the walls were thick and high enough, existed without any kind of holes leading to inner fortress zone and allowed its active protection by implementing arrow slits and murder holes.

Despite that people responsible for castle defenses had to implement other defense mechanisms in order to protect population inside. The layering of well-designed defensive features often meant that a siege could drag on for months, sometimes long enough for the attackers to exhaust their supplies, lose manpower, or abandon the assault altogether.

Translating the way of thinking into cybersecurity

Similar to the example stated in the previous subchapter the perfectly designed organization should rely on multilayered defenses where each one should be written / configured in a way which is resilient to attack.

In the examples below we will be able to see on the specific cases how multilayered defense works in practice and why should we implement pattern of thinking into our organization.

Scenario 1: Remote Code Execution on External Asset

For sake of understanding this case lets simplify the asset diagram. Assume we have external facing web application which is hosted from internal company network where there is also other system holding critical information. In our cybersecurity game we do not have to only protect our externally facing service but also make sure that taking over one server is not equivalent with the company drowning.

In a world without protections...

If the system in any shape or form is not protected from the attackers usually the situation is pretty simple - sooner or later we are getting hacked.

When it comes to our case shown in the picture above an attacker has a few steps to complete in order to compromise the critical target.

  • Initial Access through RCE on the Web Application
  • Pivoting to the SQL Server using credentials obtained from environment variables
  • Target System Admin Account Takeover through XSS on login page

Remediation?

Since our attack path starts after compromising the Web Application our initial thought can be to harden the Web Application to its limits. However this is very well approach looking from the asset perspective we should take a broader picture.

Why? Even if our web application is "unhackable" there is still chance of compromising our target. For example we are prone to the following initial footholds:

  • Insider Threat
  • Supply Chain Compromise
  • Social Engineering

Despite it being only a fraction of all possibilities an attacker could still take advantage of any of these attack and get to DMZ or straight into the Internal Network.

That is the reason why we implement Defense in Depth - it protect us not only from the anticipated threats but also from the ones we did not think about.

Below we are able to see sample Multilayered Security implementation which defends our organization not only from one attack paths but also from many others.

Scenario 2: Multilayered Protection Against Cross-Site Scripting (XSS)

The interesting thing about Defense in Depth is that we can not only implement it in the big picture but also at the lower level. Remember step from the picture below? If we break it down we can also build multilayered security on top of protection from single vulnerability - in this case Cross Site Scripting.

The situation here is pretty straightforward. Our task is to understand the nature of vulnerability, protect the core and add additional protections on top of it.

That approach in case of our example can be found below.

Conclusion

Defense in Depth is the fundamental part of security strategy in this day and age.

As demonstrated through real-world scenarios, effective security is not about creating an "unhackable" system, but about stacking complementary controls across infrastructure, applications, and users. When implemented thoughtfully, multilayered defenses turn isolated weaknesses into manageable risks and significantly raise the cost and complexity of successful attacks.

Hacker Studio

Secure Your Organization

We offer professional penetration testing services to help you identify and fix security weaknesses before attackers do. Tailored assessments for web apps, APIs, networks and cloud infrastructure - with clear reports and remediation guidance.

  • Expert manual penetration testing
  • Actionable reports with PoCs and remediation steps
  • Post-test support & retesting
Ready to reduce risk and strengthen defenses? Click through to learn more.