Tài liệu Hack Proofing: Your Web Applications - Pdf 90

From the authors
of the best-selling
HACK PROOFING

YOUR NETWORK
Your Web Applications

1 YEAR UPGRADE
BUYER PROTECTION PLAN
Your Web Applications
From the authors
of the best-selling
HACK PROOFING

YOUR NETWORK
Jeff Forristal
Julie Traxler
Technical Editor
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
137_hackapps_FC 6/19/01 3:48 PM Page 1

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

BUYER PROTECTION PLAN
Your Web Applications
137_hackapps_FM 6/19/01 3:28 PM Page iii
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

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.
137_hackapps_FM 6/19/01 3:28 PM Page v
137_hackapps_FM 6/19/01 3:28 PM Page vi
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

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
137_hackapps_FM 6/19/01 3:28 PM Page viii
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

and is a certified paralegal from the University of Southern Colorado.
He has been working as a Network Administrator and Manager of a
top-level domain of Armenia. He has also worked for the United
Nations, the Ministry of Defense, a national telco, a bank, and has been
a partner in a law firm. He speaks four languages, likes good tea, and is
a member of ACM, IEEE CS, USENIX, CIPS, ISOC, and IPG.
David G. Scarbrough is a Senior Developer with Education
Networks of America where he is a lead member of the ColdFusion
development team. He specializes in developing e-commerce sites.
David has ColdFusion 4.5 Master Certification and is also experienced
with HTML, JavaScript, PHP,Visual Basic, ActiveX, Flash 4.0, and SQL
Server 7. He has also held positions as a Programmer and Computer
Scientist. David graduated from Troy State University on Montgomery,
AL with a bachelor of science in computer science. He lives in
Smyrna,TN.
137_hackapps_FM 6/19/01 3:28 PM Page x
xi
Julie Traxler is a Senior Software Tester for an Internet software com-
pany. Julie has also worked for DecisionOne, EXE Technologies, and
TV Guide in positions that include Project Manager, Business Analyst,
and Technical Writer. As a systems analyst and designer, Julie establishes
quality assurance procedures, builds QA teams, and implements testing
processes.The testing plans she has developed include testing for func-
tionality, usability, requirements, acceptance, release, regression, security,
integrity, and performance.
Kevin Ziese is a Computer Scientist at Cisco Systems, Inc. Prior to
joining Cisco he was a Senior Scientist and Founder of the
Wheelgroup Corporation, which was acquired by Cisco Systems in
April of 1998. Prior to starting the Wheelgroup Corporation,
he was Chief of the Advanced Countermeasures Cell at the Air Force

Professional 12
Understanding Current Attack Types 13
DoS/DDoS 13
Virus Hacking 16
Trojan Horses 18
Worms 21
Rogue Applets 22
Stealing 23
Credit Card Theft 24
Theft of Identity 26
Information Piracy 27
Recognizing Web Application Security Threats 28
Hidden Manipulation 29
Parameter Tampering 29
Cross-Site Scripting 29
Buffer Overflow 30
Cookie Poisoning 31
Understand how
rogue applets can
transmit bad code:
Mobile code applications,
in the form of Java
applets, JavaScript, and
ActiveX controls, are
powerful tools for
distributing information.
They are also powerful
tools for transmitting
malicious code. Rogue
applets do not replicate

Chapter 3 Understanding the Risks
Associated with Mobile Code 81
Introduction 82
Recognizing the Impact of Mobile Code Attacks 83
Browser Attacks 83
Mail Client Attacks 84
Malicious Scripts or Macros 85
Identifying Common Forms of Mobile Code 86
Macro Languages:Visual Basic for
Applications (VBA) 87
Security Problems with VBA 89
Protecting against VBA Viruses 92
JavaScript 93
JavaScript Security Overview 94
Thinking Creatively
When Coding

Be aware of outside
influences on your
code, expect the
unexpected!

Look for ways to
minimize your code;
keep the functionality
in as small a core as
possible.

Review, review, review!
Don’t try to isolate your

Identifying Bad ActiveX Controls 119
Client Security Updates 120
Summary 121
Solutions Fast Track 122
Frequently Asked Questions 123
Chapter 4 Vulnerable CGI Scripts 125
Introduction 126
What Is a CGI Script, and What Does It Do? 127
Typical Uses of CGI Scripts 129
When Should You Use CGI? 135
Understand how
mobile code works for
Java applets and
ActiveX controls:
Mobile Code Residing on a
Web Server
Sending Computer
HTML E-Mail Containing
URL Reference to Code
(Java Applet or ActiveX)
HTML E-Mail Retrieves
Code When Opened
Server
Applet or
ActiveX
Your Computer
137_hackapps_TOC 6/19/01 3:25 PM Page xv
xvi Contents
CGI Script Hosting Issues 136
Break-Ins Resulting from Weak CGI Scripts 137

E-Mail or Messaging Services 189
Telephones and Documents 191
Credentials 193
The Intentional “Back Door” Attack 195
Tools & Traps…Beware
of User Input
One of the most common
methods of exploiting CGI
scripts and programs is
used when scripts allow
user input, but the data
that users are submitting
is not checked. Controlling
what information users
are able to submit will
reduce your chances of
being hacked through a
CGI script dramatically.
137_hackapps_TOC 6/19/01 3:25 PM Page xvi
Contents xvii
Hard-Coding a Back Door Password 195
Exploiting Inherent Weaknesses in Code or
Programming Environments 198
The Tools of the Trade 199
Hex Editors 199
Debuggers 201
Disassemblers 202
Windows-Based Tools 202
Quick View 204
DOS-Based Tools 204

stumble across a back
door in my code base?
A: First and most
importantly, determine
that it is a genuine back
door. Segments of code
often appear to have
no authentication
aspect and can do
some rather powerful
things, but nonetheless
had proper
authentication
performed prior to their
being called. If your
best research still
indicates that it is a
back door, contact an
associate in your
security department
who understands the
language in which
you're coding and
request a review of the
code. If that person
determines it is a back
door, it should be
investigated to
determine whether the
code was introduced

Security and Java Applets 260
How Java Handles Security 264
Class Loaders 265
The Applet Class Loader 266
Adding Security to a Custom
Class Loader 266
Byte-Code Verifier 269
Java Protected Domains 275
Java Security Manager 276
Policy Files 277
The SecurityManager Class 284
How to Efficiently Trace
through a Program
; Tracing a program’s
execution from start to
finish is too time-
intensive.
; You can save time by
instead going directly
to problem areas.
; This approach allows
you to skip benign
application
processing/calculation
logic.
137_hackapps_TOC 6/19/01 3:25 PM Page xviii
Contents xix
Potential Weaknesses in Java 285
DoS Attack/Degradation of Service Attacks 285
Third-Party Trojan Horse Attacks 289

DTD 344
Schemas 345
Creating Web Applications Using XML 347
Complete coverage of
the Java Security
Model:

Class loaders

Byte-code verification

Security managers

Digital signatures

Authentication using
certificates

JAR signing

Encryption
Damage & Defense:
Debugging XSL
The interaction of a style
sheet with an XML
document can be a
complicated process, and
unfortunately, style sheet
errors can often be cryptic.
Microsoft has an HTML-

Methodology for Writing Safe ActiveX Controls 382
Object Safety Settings 383
Securing ActiveX Controls 385
Control Signing 385
Using Microsoft Authenticode 387
Control Marking 389
Using Safety Settings 389
Using IObjectSafety 390
Marking the Control in the Windows
Registry 395
Summary 397
Solutions Fast Track 398
Frequently Asked Questions 400
Chapter 10 Securing ColdFusion 403
Introduction 404
How Does ColdFusion Work? 404
Utilizing the Benefit of Rapid Development 406
Use ActiveX and
understand the
Authenticode Security
Warning
137_hackapps_TOC 6/19/01 3:25 PM Page xx
Contents xxi
Understanding ColdFusion Markup
Language 408
Scalable Deployment 410
Open Integration 410
Preserving ColdFusion Security 411
Secure Development 414
CFINCLUDE 414

ColdFusion Code:
When writing a ColdFusion
application, you must look
out for a number of tags
that involve the movement
of data in ways that can be
attacked. In most cases,
validating the data sent to
a page will prevent them
from being misused. In
others, not allowing
attributes to be set
dynamically is the answer.
For each tag we examine,
another solution may be to
just turn the tag off (an
option controlled by the
administration panel).
Other tags can not be
turned off and must be
coded properly.
Select Cryptography
Token, Key Type, and
Key Length
137_hackapps_TOC 6/19/01 3:25 PM Page xxi
xxii Contents
Reviewing the Basics of PKI 468
Certificate Services 471
iPlanet by Sun/Netscape 472
Using PKI to Secure Web Applications 472

Security Planning at the Network Level 522
Security Planning at the Application Level 523
Set up a checklist of
defects not easily
detected through
standard testing
methods for working
in a Java
environment:

Excessive copying of
strings—unnecessary
copies of immutable
objects

Failure to clone
returned objects

Unnecessary cloning

Copying arrays by hand

Copying the wrong
thing or making only a
partial copy

Testing new for null

Using == instead of
.equals


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status