On The Importance of The Separation-Of-Concerns Principle in Secure Software Engineering
On The Importance of The Separation-Of-Concerns Principle in Secure Software Engineering
Abstract
The separation-of-concerns principle is one of the essential principles
in software engineering. It states that software should be decomposed in
such a way that different aspects of the problem at hand are addressed
in well-separated modules or parts of the software system. Yet, many
security experts feel uneasy about trying to isolate security-related con-
cerns. And in fact, separating security-related elements such as access
control, or defensive input checking, is indeed very hard to achieve with
nowadays mainstream software engineering technologies. However, sepa-
rating security aspects from other aspects of an application (even though
in many cases not completely successful) is necessary to raise the secu-
rity level of most software systems. Maximizing the separation of security
aspects leads to two major advantages. Firstly, it increases flexibility in
applying security mechanisms and policies. This leads in itself to simpli-
fied adaptation in light of unanticipated or evolving risks. Secondly, it
improves the effectiveness of the few security experts in the development
team, resulting in fewer security design and implementation errors.
1 Introduction
A secure system results from many activities, including architectural design,
system integration, system configuration and software development. This paper
focuses on the security challenges in the software development part. It is well-
recognized that software vulnerabilities are one of the main causes for security
breaches, and hence ways to enhance the software development approach in the
light of security objectives are required to build secure systems.
More specifically, this paper positions the separation-of-concerns principle
as an essential means to build secure software. In short, this principle says
that software should be decomposed in such a way that different “concerns” or
aspects of the problem at hand are solved in well-separated modules or parts
of the software. While well accepted in other areas, this principle is not so
1
popular in the security field. In security-related textbooks and papers, it is
often stressed that security is a pervasive property of a system, and that it is
impossible to separate security-aspects from the functional parts of the system.
It is impossible to simply add security to an application after the fact. While the
authors fully agree with the observation that security is a pervasive property,
they argue in this paper that separating security logic from functional logic
(even though not necessarily fully achieveable) is extremely important to raise
the security level of most software. In fact, as pervasiveness of security is one
of the main reasons why security is so hard to get right, one should exploit
techniques that can help to control and possibly reduce pervasiveness.
The structure of this paper is as follows: first, we analyze some causes of
the actual challenge to design secure software. Then, we introduce innovative
techniques in software engineering that allow for better separation of concerns
(or at least promise to do so in the future). We estimate the applicability and
relevance of these techniques for separation of concerns in security. Finally, in
a discussion section, we consider advantages as well as possible drawbacks or
problems related to our approach.
2
certain coding rules on programmers. The delegation of certain responsiblities
to a compiler, to a run-time, or even by enforcing coding rules can significantly
increase security, but this will never solve all problems of this category. For ex-
ample, arbitrary canonicalization errors or race conditions can not be resolved
this way.
Coding securely requires a kind of defensive attitude from the programmer:
he must think not only about how to realize the required functionality, but
also how to make sure that his code cannot be abused to achieve undesirable
results. The kinds of bugs that can lead to security problems are heterogeneous,
sometimes exotic and very often extremely intricate.
3
Moreover, by trying to build a very secure system from the start, the initial
application often gets very complex and thus expensive to build, and the appli-
cation owner (sponsor) may not be willing to make the highest investment up
front.
We will show in the paper that, by applying the separation of concerns
principle, one can build more evolvable systems, that can be more easily adapted
to unanticipated or changing threats.
4
out in separate modules using classical object-oriented or other state-of-the-art
techniques. The code responsible for fault-tolerant behavior for instance is not
well-separated in one class or method, but cuts across many classes and methods
and functions.
To separate such crosscutting concerns, new modularization techniques are
necessary. In the software engineering research community, several of such new,
advanced separation of concerns techniques are studied under the umbrella-
term Aspect-Oriented Programming (AOP) ([10]). AOP programming systems
are typically (but not necessarily) extensions of object-oriented programming
systems.
The techniques used to factor out crosscutting concerns broadly fall into two
categories:
• interception-based approaches, where certain events in the execution of a
program are intercepted to do some additional processing (taking care for
the crosscutting concern) before or after the event.
• weaving-based approaches, where the the code realizing the crosscutting
concern is woven in with the other application code by a weaver tool, at
compile time, load time or even run time.
5
places in an application. For instance, implementing method level access control
can be achieved by adding some extra code in the beginning of every method
body to enforce the authorization, and by adding code where necessary to keep
the state of the authorization engine up to date.
In this simplified view, for a specific application level security concern four
questions must be answered1 what (e.g., RBAC based method level access con-
trol), how (e.g., by using a reference monitor or central authorization engine),
where (e.g., in the beginning of each method, maybe only for some methods)
and when (e.g., only if some application-specific condition is satisfied). In the
past, separation of concerns has already improved the how part in several con-
secutive phases. In a first phase, cryptographic algorithms were factored out in
cryptographic libraries in order to enable their reuse. Later on, cryptographic
service providers (CSP’s) replaced these libraries to achieve algorithm indepen-
dence as well as implementation independence. But until now, only the security
functionality (i.e., what and how) was factored out, the relationship between
application and security (i.e., when and where) is still an intrinsic part of the
application (the application still requires specific calls to the security libraries).
Modularizing this kind of crosscutting pervasiveness is exactly what the AOP
research community is trying to make possible. With the current state-of-the-
art in AOP, complete separation of highly complex security concerns is not yet
possible. But partial solutions are available already.
6
specifications. The CORBASec specification primarily describes the external
view of the system, but it does not extend any further on how it should be
implemented. Furthermore, the specification is fairly extensive and complex.
As a result, few CORBA implementations support CORBASec.
Other work, including our own, tries to tackle this problem from a more
generic point of view by providing a supporting architecture that enables the
use of custom security mechanisms. Evidently, flexibility comes at a cost. Sev-
eral important problems must be solved here, among which a generic initializa-
tion and interaction mechanism for custom mechanisms and a way to control
dependencies between different mechanisms. Details on this work can be found
in [1, 14, 5].
Besides interception based security, weaving based approaches for this cat-
egory of problems are very recent and mainly subject of current research. We
briefly discuss two of them.
Naccio [4] is a system to specify safety policies separate from the applica-
tion in a general and platform-independent way. Based on this policy and a
representation of the platform and the available resources, a special purpose
generator produces a policy-enforcing platform library adapted to the safety
policy. Note that in this case, not the application itself, but the system libraries
are weaved. Therefore, besides the resource invocation parameters, other ap-
plication level information cannot be used during security enforcement. The
typical use cases of this work are resource oriented, addressing rather low level
controls, for example to limit the amount of bytes that can be written to a file.
Some of the authors of this paper ([2]) have applied general purpose AOP
weaving systems to security concerns. This work focuses on true transparent
application level security. Hereby, security decisions can depend on application
state. The idea here is to capture the generic behavior of security mechanisms
into reusable aspects and to compose as such a flexible and reusable framework
of security aspects. The work provides some interesting results that demonstrate
the feasibility of this promising approach.
7
AOP tools, but it is our opinion that research should go into developing weaving
technology that can support such cases.
5 Discussion
5.1 Advantages
We have witnessed in the previous section that separation of concerns for se-
curity aspects is feasible with state-of-the-art software engineering techniques
based on AOP. In our opinion, applying and extending these techniques can
lead to more secure software for the following reasons.
8
5.2 Potential showstoppers
Finally, we also want to mention two possible problems with the proposed ap-
proach.
A first issue is the fact that adaptability itself can be a major security risk.
If the security mechanisms are very adaptable, attackers might be able to use
the adaptation mechanisms to turn off security checks completely. Clearly, this
problem will have to be dealt with.
A second issue we see is that, at this point in time, software engineering is
not mature yet, and it may well be that techniques to separate most security
concerns in an appropriate way will take a lot of time to be developed. In other
words, maybe AOP is not yet ready for prime-time.
6 Conclusion
This paper defends the importance of the separation of concerns principle for
software security. By separating the security concern as much as possible, two
important benefits are obtained: security mechanisms become more adaptable,
supporting a monitor-and-evolve approach to security rather than a get-it-all-
right-the-first-time approach, and separation of certain security concerns will
reduce the number of implementation errors, because a well separated concern
is easier to get right than a crosscutting concern.
In the very long term, our vision is that an application programmer will
have to concentrate only on the functional problem he is facing. He solves this
problem using a secure language that covers to a large extent the well-localized
security problems (such as buffer overflows, etc.). For the other, more advanced
application level security problems, a security engineer uses a framework of
security aspects and specifies (declaratively or by point&click) the places in
the application where security mechanisms must be enforced and possibly how
strong they have to be. An appropriate tool will then make sure that the selected
mechanisms are applied correctly and consistently. This way the application
programmer is no longer bothered with security (and he shouldn’t be). The
security expert has far better control over the security measures he chooses, in
the beginning as well as later on when they have to be changed when facing
new security challenges.
References
[1] B. De Win, J. Van den Bergh, F. Matthijs, B. De Decker and W. Joosen, A
Security Architecture for Electronic Commerce Applications, Information
Security for Global Information Infrastructures (S. Qing and J. Eloff, eds.),
Kluwer Academic Publishers, pp. 491–500, 2000.
9
[2] B. De Win, B. Vanhaute and B. De Decker, How aspect-oriented program-
ming can help to build secure software, Informatica Volume 26, No. 2, pp.
141–149, 2002
[3] E.W. Dijkstra, A Discipline of programming, Prentice Hall, Englewood
Cliffs, NJ, 1976
[4] D. Evans, A. Twyman, Flexible Policy-Directed Code Safety, Proc. of the
IEEE Symposium on Research in Security and Privacy, Oakland, Califor-
nia, pp. 32-45, IEEE Computer Society. CA, 1999.
[5] R.E. Filman, S. Barrett, D.D. Lee and T. Linden, Controlling communica-
tions by inserting illities, Communications of the ACM, Volume 45, No. 1,
pp. 116-122, 2002
[6] M.O. Killijian, J.C. Fabre, Implementing a reflective fault-tolerant Corba
system, Proc. of the Symposium on Reliability in Distributed Software, pp.
54-163, 2000
[7] C. Lopes, A language framework for distributed programming, PhD thesis,
Northeastern university, 1997
[8] OMG, Security Service Specification Version 1.8, 2002
[9] D.L. Parnas, On the criteria to be used in decomposing systems into mod-
ules, Communications of the ACM, Volume 15, No. 12, 1972
[10] Various authors, special issue on AOP, Communications of the ACM, Vol-
ume 44 , No. 10, 2001
[11] B. Robben, Language technology and metalevel architectures for dis-
tributed objects, PhD thesis, Dept. of CompScience, KULeuven, 1999
[12] Sun Microsystems, Enterprise JavaBeans Specification Version 2.1, 2002
[13] V. Shah, F. Hill, Using Aspect-Oriented Programming for Addressing Secu-
rity Concerns, Supplementary Proc. of the 13th International Symposium
on Software Reliability Engineering (ISSRE’2002), pp. 115–119, 2002.
10