StackFences. According to (Cowan et al., 1998),
ctags with StackGuard has an overhead of 80%
when processing 78 files, 37,000 lines of code. Using
the same number of files and an approximated num-
ber of lines of code (37,188) we got for StackFences a
lower performance penalty: 31% with the production
policy and 41% with the debug policy.
According to Table 1, gcc and tcc generate
equally fast ctags executables. Therefore, for this
particular experience we can compare the overheads
of the two protection mechanisms independently of
the compilers implementing them. And the conclu-
sion is that StackFences is faster than StackGuard,
which makes less validation actions! This paradox is
probably explained by the fact that the performance
figures presented in (Cowan et al., 1998) were ob-
tained with a non-optimized version of StackGuard,
that added canaries and code for checking them to all
functions, instead of doing it only for functions with
vulnerable local variables. This fact is mentioned
in the performance optimisations for StackGuard de-
scribed in (Cowan et al., 1998). StackFences, on
the contrary, was optimized to add canaries and for
checking them locally with canReduce only in
functions with vulnerable variables.
8 CONCLUSIONS
We have presented StackFences, a run-time solution
for detecting buffer overflows affecting variables allo-
cated in stack frames. StackFences detects overflows
in all potentially vulnerable local variables instead of
detecting only overflows affecting known attack tar-
gets, like return addresses. To the best of our knowl-
edge this is the first solution to perform such a de-
tailed run-time stack analysis.
For balancing detection accuracy and performance
we conceived two checking policies for StackFences:
a development policy, more detailed and allowing a
more accurate and timely detection of overflow occur-
rences, suitable for development scenarios; and a pro-
duction policy, lazier, checking only when absolutely
necessary, suitable for production environments.
In terms of effectiveness, StackFences detected and
halted all the 12 attacks of the test suite described
in (Wilander and Kambar, 2002). Although it may
appear that StackFences is minutely different from
propolice, which avoids 10 of those attacks, that
is not true because StackFences detects other over-
flows that are not considered by the test suite and nei-
ther tackled by propolice. StackFences is much
better suited for assessing the correctness of applica-
tions in run-time than propolice, though the test
suite does not properly demonstrate that.
The performance of StackFences is acceptable but
depends a lot on the compiled application. We be-
lieve that optimizing canary checking code can fur-
ther reduce StackFences’ overheads. As desired, the
overhead of the production policy is lower than the
overhead of the debug policy. Finally, StackFences’
overheads are mainly compiler independent, though
they may depend on some compiling options.
REFERENCES
Aleph One (1996). Smashing The Stack For Fun And Profit.
Phrack Magazine, 7(49).
Baratloo, A., Singh, N., and Tsai, T. (2000). Transparent
Run-Time Defense Against Stack Smashing Attacks.
In Proc. of the USENIX Annual Technical Conf., San
Diego, CA, USA.
Bellard, F. (2003). Tiny C Compiler, version 0.9.20.
http://fabrice.bellard.free.fr/tcc.
Chiueh, T.-C. and Hsu, F.-H. (2001). RAD: A Compile-time
Solution to Buffer Overflow Attacks. In IEEE Int.
Conf. on Distr. Computing Systems (ICDCS), Phoenix,
AZ, USA.
Cowan, C., Beattie, S., Johansen, J., and Wagle, P. (2003).
PointGuard: Protecting Pointers From Buffer Over-
flow Vulnerabilities. In 12th USENIX Security Symp.,
Washington, D.C., USA.
Cowan, C., Pu, C., Maier, D., Hinton, H., Walpole, J.,
Bakke, P., Beattie, S., Grier, A., Wagle, P., and Zhang,
Q. (1998). StackGuard: Automatic Adaptive Detec-
tion and Prevention of Buffer-Overflow Attacks. In
Proc. 7th USENIX Security Conf., pages 63–78, San
Antonio, TX, USA.
Etoh, H. and Yoda, K. (2000). propolice: Im-
proved stack-smashing attack detection. IPSJ
SIGNotes Computer SECurity Abstract, 43(12).
http://www.ipsj.or.jp/members/
Journal/Eng/4312/article053.html.
Frantzen, M. and Shuey, M. (2001). StackGhost: Hard-
ware Facilitated Stack Protection. In Proc. of the 10th
USENIX Security Symp., Washington, D.C., USA.
Larochelle, D. and Evans, D. (2001). Statically Detecting
Likely Buffer Overflow Vulnerabilities. In Proc. of the
10th USENIX Security Symp., pages 177–190, Wash-
ington, D.C., USA.
McGraw, G. (2002). Building Secure Software. In
RTO/NATO Real-Time Intrusion Detection Symp., Es-
toril, Portugal. Invited Talk.
Spafford, E. H. (1989). The Internet Worm Incident. In
Ghezzi, C. and McDermid, J. A., editors, ESEC‘89
2nd European Software Engineering Conf., University
of Warwick, Coventry, United Kingdom. Springer.
Wagle, P. and Cowan, C. (2003). StackGuard: Simple Stack
Smash Protection for GCC. In Proc. of the GCC De-
velopers Summit, pages 243–255.
Wagner, D., Foster, J. S., Brewer, E. A., and Aiken, A.
(2000). A First Step towards Automated Detection of
STACKFENCES: A RUN-TIME APPROACH FOR DETECTING STACK OVERFLOWS
83