Table Of Content137_hackapps_FC 6/19/01 3:48 PM Page 1
1YEAR UPGRADE
BUYER PROTECTION PLAN
™
WW ee bb AA pp pp ll ii cc aa tt ii oo nn ss
YYoo uu rr
The Only Way to Stop a Hacker Is to Think Like One
• Step-by-Step Instructions for Developing Secure Web Applications
• Hundreds of Tools & Traps and Damage & Defense Sidebars
and Security Alerts!
• Complete Coverage of How to Hack Your Own Site
Jeff Forristal
FFrroomm tthhee aauutthhoorrss
Julie Traxler
Technical Editor
ooff tthhee bbeesstt--sseelllliinngg
HHAACCKK PPRROOOOFFIINNGG™™YYOOUURR NNEETTWWOORRKK
137_hackapps_FM 6/19/01 3:28 PM Page i
s o l u t i o n s @ s y n g r e s s . c o m
With more than 1,500,000 copies of our MCSE, MCSD, CompTIA, and Cisco
study guides in print, we continue to look for ways we can better serve the
information needs of our readers. One way we do that is by listening.
Readers like yourself have been telling us they want an Internet-based ser-
vice that would extend and enhance the value of our books. Based on
reader feedback and our own strategic plan, we have created a Web site
that we hope will exceed your expectations.
Solutions@syngress.com is an interactive treasure trove of useful infor-
mation focusing on our book topics and related technologies. The site
offers the following features:
(cid:2) One-year warranty against content obsolescence due to vendor
product upgrades. You can access online updates for any affected
chapters.
(cid:2) “Ask the Author”™ customer query forms that enable you to post
questions to our authors and editors.
(cid:2) Exclusive monthly mailings in which our experts provide answers to
reader queries and clear explanations of complex material.
(cid:2) Regularly updated links to sites specially selected by our editors for
readers desiring additional reliable information on key topics.
Best of all, the book you’re now holding is your key to this amazing site.
Just go to www.syngress.com/solutions, and keep this book handy when
you register to verify your purchase.
Thank you for giving us the opportunity to serve your needs. And be sure
to let us know if there’s anything else we can do to help you get the max-
imum value from your investment. We’re listening.
www.syngress.com/solutions
137_hackapps_FM 6/19/01 3:28 PM Page ii
137_hackapps_FM 6/19/01 3:28 PM Page iii
1YEAR UPGRADE
BUYER PROTECTION PLAN
™
WWee bb AA pp pp ll ii cc aa tt ii oo nn ss
YYoo uu rr
The Only Way to Stop a Hacker Is to Think Like One
137_hackapps_FM 6/19/01 3:28 PM Page iv
Syngress Publishing,Inc.,the author(s),and any person or firm involved in the writing,editing,or production
(collectively “Makers”) of this book (“the Work”) do not guarantee or warrant the results to be obtained from
the Work.
There is no guarantee of any kind,expressed or implied,regarding the Work or its contents.The Work is sold
AS IS and WITHOUT WARRANTY.You may have other legal rights,which vary from state to state.
In no event will Makers be liable to you for damages,including any loss of profits,lost savings,or other inci-
dental or consequential damages arising out from the Work or its contents.Because some states do not allow
the exclusion or limitation of liability for consequential or incidental damages,the above limitation may not
apply to you.
You should always use reasonable case,including backup and other appropriate precautions,when working
with computers,networks,data,and files.
Syngress Media®,Syngress®,and “Career Advancement Through Skill Enhancement®,”are registered trademarks
of Syngress Media,Inc. “Ask the Author™,”“Ask the Author UPDATE™,”“Mission Critical™,”and “Hack
Proofing™”are trademarks of Syngress Publishing,Inc.Brands and product names mentioned in this book are
trademarks or service marks of their respective companies.
KEY SERIAL NUMBER
001 BN837R45G
002 AP9EEF4574
003 ZPHGJ264G8
004 BNJ3RG22TS
005 356YH8LLQ2
006 CF4H6J8MMX
007 22D56G7KM6
008 6B8MDD4G6Z
009 L9MNG542FR
010 BY45MQ98WA
PUBLISHED BY
Syngress Publishing,Inc.
800 Hingham Street
Rockland,MA 02370
Hack Proofing Your Web Applications
Copyright © 2001 by Syngress Publishing,Inc.All rights reserved.Printed in the United States of America.
Except as permitted under the Copyright Act of 1976,no part of this publication may be reproduced or dis-
tributed in any form or by any means,or stored in a database or retrieval system,without the prior written
permission of the publisher,with the exception that the program listings may be entered,stored,and executed
in a computer system,but they may not be reproduced for publication.
Printed in the United States of America
1 2 3 4 5 6 7 8 9 0
ISBN: 1-928994-31-8
Technical edit by:Julie Traxler Freelance Editorial Manager:Maribeth Corona-Evans
Technical review by:Robert Hansen and Kevin Ziese Copy edit by:Darren Meiss and Beth A.Roberts
Co-Publisher:Richard Kristof Index by:Jennifer Coker
Developmental Editor:Kate Glennon Page Layout and Art by:Shannon Tozier
Acquisitions Editor:Catherine B.Nolan Cover Design by:Michael Kavish
Distributed by Publishers Group West in the United States.
137_hackapps_FM 6/19/01 3:28 PM Page v
Acknowledgments
We would like to acknowledge the following people for their kindness and support
in making this book possible.
Richard Kristof and Duncan Anderson of Global Knowledge,for their generous
access to the IT industry’s best courses,instructors and training facilities.
Ralph Troupe,Rhonda St.John,and the team at Callisma for their invaluable insight
into the challenges of designing,deploying and supporting world-class enterprise
networks.
Karen Cross,Lance Tilford,Meaghan Cunningham,Kim Wylie,Harry Kirchner,Bill
Richter,Kevin Votel,and Brittin Clark of Publishers Group West for sharing their
incredible marketing experience and expertise.
Mary Ging,Caroline Hird,Simon Beale,Caroline Wheeler,Victoria Fuller,Jonathan
Bunkell,and Klaus Beran of Harcourt International for making certain that our
vision remains worldwide in scope.
Anneke Baeten,Annabel Dent,and Laurie Giles of Harcourt Australia for all
their help.
David Buckland,Wendi Wong,Daniel Loh,Marie Chieng,Lucy Chong,Leslie Lim,
Audrey Gan,and Joseph Chan of Transquest Publishers for the enthusiasm with
which they receive our books.
Kwon Sung June at Acorn Publishing for his support.
Ethan Atkin at Cranbury International for his help in expanding the Syngress
program.
Joe Pisco,Helen Moyer,and the great folks at InterCity Press for all their help.
vv
137_hackapps_FM 6/19/01 3:28 PM Page vi
137_hackapps_FM 6/19/01 3:28 PM Page vii
Contributors
Chris Broomes (MCSE,MCT,MCP+I,CCNA) is a Senior
Network Analyst at DevonIT (www.devonitnet.com),a leading net-
working services provider specializing in network security and VPN
solutions.Chris has worked in the IT industry for over eight years and
has a wide range of technical experience.Chris is Founder and
President of Infinite Solutions Group Inc.(www.infinitesols.com),a
network consulting firm located in Lansdowne,PA that specializes in
network design,integration,security services,technical writing,and
training.Chris is currently pursuing the CCDA and CCNP certifica-
tions while mastering the workings of Cisco and Netscreen VPN and
security devices.
Jeff Forristal is the Lead Security Developer for Neohapsis,a
Chicago-based security solution/consulting firm.Apart from assisting
in network security assessments and application security reviews
(including source code review),Jeff is the driving force behind
Security Alert Consensus,a joint security alert newsletter published on
a weekly basis by Neohapsis,Network Computing,and the SANS
Institute.
Drew Simonis (CCNA) is a Security Consultant for Fiderus
Strategic Security and Privacy Services.He is an information-security
specialist with experience in security guidelines,incident response,
intrusion detection and prevention,and network and system adminis-
tration.He has extensive knowledge of TCP/IP data networking and
Unix (specifically AIX and Solaris),as well as sound knowledge of
routing,switching,and bridging.Drew has been involved in several
large-scale Web development efforts for companies such as AT&T,
IBM,and several of their customers.This has included both planning
and deployment of such efforts as online banking,automated customer
care,and an online adaptive insurability assessment used by a major
vii
137_hackapps_FM 6/19/01 3:28 PM Page viii
national insurance company.Drew helps customers of his current
employer with network and application security assessments as well as
assisting in ongoing development efforts.Drew is a member of
MENSA and holds several industry certifications,including IBM
Certified Specialist,AIX 4.3 System Administration,AIX 4.3
Communications,Sun Microsystems Certified Solaris System
Administrator,Sun Microsystems Certified Solaris Network
Administrator,Checkpoint Certified Security Administrator,and
Checkpoint Certified Security Engineer.He resides in Tampa,FL.
Brian Bagnall (Sun Certified Java Programmer and Developer) is co-
author of the Sun Certified Programmer for Java 2 Study Guide.He is cur-
rently the lead programmer at IdleWorks,a company located in
Western Canada.IdleWorks develops distributed processing solutions
for large and medium-sized businesses with supercomputing needs.His
background includes working for IBM developing client-side applica-
tions.Brian is also a key programmer of Lejos,a Java software develop-
ment kit for Lego Mindstorms.Brian would like to thank his family
for their support,and especially his father Herb.
Michael Dinowitz hosts CF-Talk,the high-volume ColdFusion
mailing list,out of House of Fusion.Com.He publishes and writes
articles for the Fusion Authority Weekly News Alert (www.fusionau-
thority.com/alert).Michael is the author of Fusebox:Methodology and
Techniques (ColdFusion Edition) and is the co-author of the best-
selling ColdFusion Web Application Construction Kit.Whether it’s
researching the lowest levels of ColdFusion functionality or presenting
to an audience,Michael’s passion for the language is clear.Outside of
Allaire,there are few evangelists as dedicated to the spread of the lan-
guage and the strengthening of the community.
Jay D. Dyson is a Senior Security Consultant for OneSecure Inc.,a
trusted provider of managed digital security services.Jay also serves as
part-time Security Advisor to the National Aeronautics and Space
viii
137_hackapps_FM 6/19/01 3:28 PM Page ix
Administration (NASA).His extracurricular activities include main-
taining Treachery.Net and serving as one of the founding staff mem-
bers of Attrition.Org.
Joe Dulay (MCSD) is the Vice-President of Technology for the IT Age
Corporation.IT Age Corporation is a project management and soft-
ware development firm specializing in customer-oriented business
enterprise and e-commerce solutions located in Atlanta,GA.His cur-
rent responsibilities include managing the IT department,heading the
technology steering committee,software architecture,e-commerce
product management,and refining development processes and method-
ologies.Though most of his responsibilities lay in the role of manager
and architect,he is still an active participant of the research and devel-
opment team.Joe holds a bachelor’s degree from the University of
Wisconsin in computer science.His background includes positions as a
Senior Developer at Siemens Energy and Automation,and as an inde-
pendent contractor specializing in e-commerce development.Joe would
like to thank his family for always being there to help him.
Michael Cross (MCSE,MCPS,MCP+I,CNA) is a Microsoft
Certified System Engineer,Microsoft Certified Product Specialist,
Microsoft Certified Professional + Internet,and a Certified Novell
Administrator.Michael is the Network Administrator,Internet
Specialist,and a Programmer for the Niagara Regional Police Service.
He is responsible for network security and administration,program-
ming applications,and Webmaster of their Web site at www.nrps.com.
He has consulted and assisted in computer-related/Internet criminal
cases and is part of an Information Technology team that provides sup-
port to a user base of over 800 civilian and uniform users.
Michael owns KnightWare,a company that provides consulting,
programming,networking,Web page design,computer training,and
other services.He has served as an instructor for private colleges and
technical schools in London,Ontario Canada.He has been a freelance
writer for several years and has been published over two dozen times
ix