ENTERPRISE WEB SERVICES SECURITY
LIMITED WARRANTY AND DISCLAIMER OF LIABILITY THE CD-ROM THAT ACCOMPANIES THE BOOK MAY BE USED ON A SINGLE PC ONLY. THE LICENSE DOES NOT PERMIT THE USE ON A NETWORK (OF ANY KIND). YOU FURTHER AGREE THAT THIS LICENSE GRANTS PERMISSION TO USE THE PRODUCTS CONTAINED HEREIN, BUT DOES NOT GIVE YOU RIGHT OF OWNERSHIP TO ANY OF THE CONTENT OR PRODUCT CONTAINED ON THIS CD-ROM. USE OF THIRD-PARTY SOFTWARE CONTAINED ON THIS CD-ROM IS LIMITED TO AND SUBJECT TO LICENSING TERMS FOR THE RESPECTIVE PRODUCTS. CHARLES RIVER MEDIA, INC. (“CRM”) AND/OR ANYONE WHO HAS BEEN INVOLVED IN THE WRITING, CREATION, OR PRODUCTION OF THE ACCOMPANYING CODE (“THE SOFTWARE”) OR THE THIRD-PARTY PRODUCTS CONTAINED ON THE CD-ROM OR TEXTUAL MATERIAL IN THE BOOK, CANNOT AND DO NOT WARRANT THE PERFORMANCE OR RESULTS THAT MAY BE OBTAINED BY USING THE SOFTWARE OR CONTENTS OF THE BOOK. THE AUTHOR AND PUBLISHER HAVE USED THEIR BEST EFFORTS TO ENSURE THE ACCURACY AND FUNCTIONALITY OF THE TEXTUAL MATERIAL AND PROGRAMS CONTAINED HEREIN. WE HOWEVER, MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, REGARDING THE PERFORMANCE OF THESE PROGRAMS OR CONTENTS. THE SOFTWARE IS SOLD “AS IS” WITHOUT WARRANTY (EXCEPT FOR DEFECTIVE MATERIALS USED IN MANUFACTURING THE DISK OR DUE TO FAULTY WORKMANSHIP). THE AUTHOR, THE PUBLISHER, DEVELOPERS OF THIRD-PARTY SOFTWARE, AND ANYONE INVOLVED IN THE PRODUCTION AND MANUFACTURING OF THIS WORK SHALL NOT BE LIABLE FOR DAMAGES OF ANY KIND ARISING OUT OF THE USE OF (OR THE INABILITY TO USE) THE PROGRAMS, SOURCE CODE, OR TEXTUAL MATERIAL CONTAINED IN THIS PUBLICATION. THIS INCLUDES, BUT IS NOT LIMITED TO, LOSS OF REVENUE OR PROFIT, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THE PRODUCT. THE SOLE REMEDY IN THE EVENT OF A CLAIM OF ANY KIND IS EXPRESSLY LIMITED TO REPLACEMENT OF THE BOOK AND/OR CD-ROM, AND ONLY AT THE DISCRETION OF CRM. THE USE OF “IMPLIED WARRANTY” AND CERTAIN “EXCLUSIONS” VARIES FROM STATE TO STATE, AND MAY NOT APPLY TO THE PURCHASER OF THIS PRODUCT.
ENTERPRISE WEB SERVICES SECURITY
RICKLAND HOLLAR RICHARD MURPHY
CHARLES RIVER MEDIA, INC. Hingham, Massachusetts
Copyright 2006 by THOMSON/DELMAR LEARNING. Published by CHARLES RIVER MEDIA, INC. All rights reserved. No part of this publication may be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means or media, electronic or mechanical, including, but not limited to, photocopy, recording, or scanning, without prior permission in writing from the publisher. Acquisitions Editor: James Walsh Cover Design: Tyler Creative CHARLES RIVER MEDIA, INC. 10 Downer Avenue Hingham, Massachusetts 02043 781-740-0400 781-740-8816 (FAX)
[email protected] www.charlesriver.com This book is printed on acid-free paper. Rickland Hollar and Richard Murphy. Enterprise Web Services Security. ISBN: 1-58450-413-7 eISBN: 1-58450-657-1 All brand names and product names mentioned in this book are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks should not be regarded as intent to infringe on the property of others. The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. Hollar, Rickland, 1954Enterprise Web services security / Rickland Hollar, Richard Murphy.-- 1st ed. p. cm. Includes bibliographical references and index. ISBN 1-58450-413-7 (pbk. with CD-ROM) 1. Computer networks--Security measures. 2. Web sites--Security measures. 3. Web services. I. Murphy, Richard, 1954- II. Title. TK5105.59.H66 2005 005.8--dc22 2005018419 Printed in the United States of America 05 7 6 5 4 3 2 First Edition CHARLES RIVER MEDIA titles are available for site license or bulk purchase by institutions, user groups, corporations, etc. For additional information, please contact the Special Sales Department at 781-740-0400. Requests for replacement of a defective CD-ROM must be accompanied by the original disc, your mailing address, telephone number, date of purchase, and purchase price. Please state the nature of the problem, and send the information to CHARLES RIVER MEDIA, INC., 10 Downer Avenue, Hingham, Massachusetts 02043. CRM’s sole obligation to the purchaser is to replace the disc, based on defective materials or faulty workmanship, but not on the operation or functionality of the product.
To our wives and children, with thanks for their love and support.
This page intentionally left blank
Contents Introduction 1
xxi
Security in the Networked World Business on the Internet
1 3
B2B
3
B2C
4
Evolving Business Models
4
Information Protection
5
Privacy
5
Corporate Confidentiality
6
Legal Obligations
6
Web Services
7
XML
8
SOAP
8
The Messaging Model
9
Security Challenges
10
Threats and Risks
10
Policy
10
Internet
11
Intranet
11
Extranet
12
Wireless
12
Countermeasures
13
WS-* Family of Standards
14
vii
viii
Contents
Virtual Domain Model for Web Services Security
2
3
15
Security Domains
15
Enclaves
15
Trust Relationships
16
The Model
16
Summary
16
References
17
Threats and Attacks
19
Threats, Vulnerabilities, and Countermeasures
20
Ensuring Reliability
21
Vandalism and Sabotage
24
Denial of Service
26
Privacy and Confidentiality Breaches
27
Data Integrity Violations
29
Man-in-the-Middle Attacks
30
Spoofing Attacks
31
Mobile-Code Threats
32
Fraud
34
Special Considerations for Web Services Environments
35
Summary
38
References
39
Security Goals
41
Protecting Your Assets
42
Common Security Terms
42
Reducing Vulnerabilities
43
Realistically Assessing Threats
47
Choosing the Right Countermeasures
51
Recognizing and Accepting Residual Risk
52
Contents
Classic Security Goals
53
Confidentiality
54
Integrity
54
Availability
55
Transaction Security Goals
4
ix
56
Authentication
57
Scalability
58
Nonrepudiation
59
The Role of Security Policy in Web Services Security Enforcement
60
Summary
61
References
61
The Internet and World Wide Web Infrastructure
63
Internet 101
64
TCP/IP
65
HTTP
67
Security Domains
71
Client System Vulnerabilities
73
Browser Vulnerabilities
74
Java Virtual Machine Vulnerabilities
76
Networks
77
TCP/IP Vulnerabilities
77
HTTP Vulnerabilities
79
SMTP Vulnerabilities
79
Server Vulnerabilities
81
Web Server Vulnerabilities
82
Other Vulnerabilities
82
Summary
83
References
83
x
Contents
5
Web Services Web Services Standards
86
XML
88
Elements and Attributes
88
Namespaces
90
Schemas
92
Transformations
96
SOAP
6
85
99
Document Style Messages
100
RPC Style Messages
103
Binding
105
WSDL
105
UDDI
109
Web Services Toolkits
115
Summary
116
References
116
Security Policy Basics
119
The Importance of Security Policy
120
Steps in Developing a Security Policy
122
Identify the Assets You Are Trying to Protect
123
Identify the Threats You Are Protecting Against
123
Map Threats to Probability of Loss and Cost
125
Implement Cost-Effective Measures
126
Continuously Review and Improve Security Policies
126
The Security Policy Document
127
Summary
127
References
128
Contents
7
Communicating Policy
129
Expressing Security Policy in Web Services
130
WS-Policy
131
Normal Form
132
Compact Form
133
Merging Policies and Resolving Conflicts
135
WS-SecurityPolicy SecurityToken
Integrity
135
Assertion
Confidentiality
Assertion
Assertion
Visibility
Assertion
SecurityHeader
Assertions
136 138 139 142 143
Assertions
144
Putting It Together: An Example
144
MessageAge
WS-PolicyAttachment
8
xi
146
Tying Policies to Subjects
146
Making Policies Discoverable
148
Effective Policy
152
Summary
153
References
153
Protecting the System Components
155
Security Controls for the System Components
156
The Client
156
Workstation Vulnerabilities
157
Operating System Security
158
Browser Security
159
Downloading Components
164
ActiveX Security
167
xii
Contents
9
Java Security
169
Scripting
171
Plug-Ins
172
The Network
173
Network Vulnerabilities
173
Wireless Communications
174
Firewalls
175
Gateways, Guards, and Routers
176
Virtual Private Networks
177
Servers
177
Web Server Vulnerabilities
179
Operating System Security
181
Summary
183
References
184
Protecting Messages, Transactions, and Data
187
Protecting a Web Services Exchange
188
Securing the Communications Channel
190
Link, Network, and Applications Layer Encryption
191
Point-to-Point Encryption
191
End-to-End Encryption
192
Using SSL to Establish Secure Sessions
192
Identity Management and Trust
192
Trust Relationships
193
Identity Management
193
Passwords and Pass-Phrases
195
Smart Cards
196
Third-Party Brokers
196
Certificate Authorities
197
Kerberos Authentication Servers
197
Contents
Policy Decision Points
197
Microsoft .NET Passport
197
Liberty Alliance
198
Authentication
198
User IDs and Passwords
199
X.509 Public Key Authentication
200
LDAP (The Role of Directory Services)
201
Kerberos
202
Authorization
205
Basic Web Servers
208
J2EE Applications Servers
210
ASP.NET Servers
211
Access Control
10
xiii
213
Choosing the Identity Mapping Scheme
217
Mandatory Access Controls
219
Choosing the Access Control Decision Point
220
Summary
221
References
221
Implementing the Information Security Triad Confidentiality
225 226
Encryption
226
Steganography
242
SSL and TLS
243
Integrity
247
Digital Signatures
247
Nonrepudiation
250
Summary
251
References
251
xiv 11
12
Contents
Communicating Security Credentials
253
Client-Server Credential Communication
254
WS-Security
255
Message Security Model
255
Security Header Element
256
XML Encryption
265
XML Signature
271
Message Protection
276
Putting It Together: An Example
277
Summary
279
References
280
Audit
283
Goal of Audit
284
What to Audit
284
Auditable Events
285
Audit Information
286
Levels of Audit
286
Network
287
Server
288
Components
288
Application
289
Active versus Passive Auditing
292
Audit Data Processing
293
Intrusion Detection and Prevention Systems
294
Intrusion Detection System Basics
295
Intrusion Prevention Systems
295
Summary
296
References
296
Contents
13
Virtual Domain Model for Web Services Security
299
Trust Relationships
300
General Security Context Model
301
Types of Trust Relationships
302
Trust Relationships Between Principals
303
Trust Domains
304
Trust Relationships Between Domains
306
Creating Physical and Logical Trust Domains
308
Where Should Trust Relationships Be Created?
308
What Credentials Will Be Used?
309
What Are the Integrity and Confidentiality Considerations?
310
How Will Credentials Be Provisioned?
311
What Principals Will a Given Principal Trust?
312
Creating Virtual Trust Domains
14
xv
314
Experience Based
314
Reference Based
315
Reputation Based
318
Summary
319
References
320
Establishing and Communicating Trust
321
Types of Trust Relationships
322
WS-Trust
324
The Web Services Trust Model
324
Requesting and Returning Tokens: The STS Framework
324
Negotiation and Challenge Extensions
328
Key and Token Extensions
329
WS-Federation
330
Basic Concepts
331
Federation Metadata
333
Attribute and Pseudonym Services
333
xvi
Contents
WS-SecureConversation Security Context
334
Context Binding
334
XKMS
15
334
335
XML Key Registration Service
335
XML Key Information Service
336
XML Key Management Service Bulk Operations
337
SAML
337
XACML
340
Summary
344
References
344
Pulling It All Together: Using Virtual Trust Domains to Secure Enterprise Web Services
347
Enterprise Web Services
348
Step 1: Identify the Parties Involved
349
Who Are the Clients?
350
How Will Clients Access the Service?
350
How Will Clients Discover the Service?
350
What Intermediaries Are Involved in the Transaction?
351
Does the Web Service use Other Services?
351
Step 2: Identify Relevant Domain Infrastructure and Capabilities
351
How Many Security Domains are Involved in Supporting the Service?
352
What Security Services are Provided in the Domains Involved?
352
What Token Services are Involved in Providing those Services?
352
What Supporting Services are Provided in the Domains Involved?
353
Step 3: Identify Necessary Security Services Based on Local Policies
353
Are Authentication Services Needed?
353
What Resource or Information Needs To Be Protected?
354
Are Authorization and Access Control Services Needed?
354
Are Confidentiality Services Needed?
355
Contents
Are Integrity Services Needed? Step 4: Identify Gaps and Project a Virtual Trust Domain
356 356
Missing Services
358
Differences in Services
359
Security-Relevant Differences in Levels
360
New Boundaries and Boundary Services
362
Step 5: Allocate New Infrastructure Services across Physical and Logical Domains
362
Security Services
364
Support Services
364
Service Distribution Strategy
364
Step 6: Allocate Security Services across Actors
16
xvii
364
J2EE Environment
365
.NET Environment
367
Crossing a Technology Boundary
368
Step 7: Create and Distribute Discovery and Policy Artifacts
371
Summary
371
FutureScape
373
Going Mobile
374
What Is Self-Protecting Data?
374
Protecting Data In Transit
375
Protecting Data At Rest
377
Protecting Data In Use
378
Digital Rights Management
379
Rights Expression Languages
380
Web Services’ Role
381
Summary
381
References
381
xviii
Contents
Appendix A The Security Policy Document
383
Introduction
384
Responsible Organizations
385
Physical Security
385
Personnel Security
386
Security Standards
386
Defending the Computing Environment
387
Workstation Security
388
Server Security
388
HTTP Services
389
Database Management System (DBMS) Services
389
Applications Services
390
Network Security
390
Secure Messaging
390
Mobile Code
390
Defending the Enclave Boundary
391
Firewalls
391
Virtual Private Networks (VPNs)
392
Remote Access
392
Guards
393
Content Filtering
393
Virus Protection
393
Gateway Spam Filtering and Virus Protection
393
Defending the Network and Infrastructure
394
Supporting Infrastructure
394
Key Management
394
Intrusion Protection
395
Audit
396
Backups and Retention
396
Disaster Recovery
396
Contents
xix
Web Services
397
Security Incident Handling and Response
398
Notification
398
Points of Contact
398
Containment
399
Assess Damage, Perform Triage
399
Recovery
399
References Appendix B About the CD-ROM
399 401
System Requirements
401
CD-ROM Contents
402
Web Site
402
Index
403
This page intentionally left blank
Introduction
eb Services are ushering in a new era in applications and applications development. When coupled with the Internet, Web Services are moving us toward a truly frictionless economy where traditional barriers to entry such as location, geography, and “perfect knowledge” are not only being removed, but are being utterly destroyed. Web Services are fueling the revolution because they are based on open standards, which are firewall friendly and vendor and platform agonistic. Building on object-oriented programming’s and distributed computing architecture’s (such as COM and CORBA®) legacies, they are the next big thing in computing and represent the potential for revolutionizing how we interact with business, with academia, and with government. Web Services provide the programmability that brings Sun Microsystems®’ Scott McNealy’s prediction of “the network is the computer” within reach. As with most things, progress brings not only opportunity but risk. The opportunity is the ability to develop new ways of interacting with customers, suppliers, and business partners. Web Services take the concept of disintermediation to a whole new level by enabling agent-based business-to-business and business-tocustomer applications. Web Services running across the Internet make it possible for even small businesses to have a global reach. Businesses are no longer confined to a local corner, the idiosyncrasies of the local traffic pattern, or the market potential defined by advertising budgets and word-of-mouth marketing. Even small businesses can now market globally and can develop value chains with suppliers and business partners from around the globe. Time zones and geographic and political boundaries become almost meaningless. The revolution is not confined to external interactions; it applies to internal interactions as well. When applied to an organization’s internal systems, Web Services provide a way to develop horizontally and vertically scalable applications that are always available. They also provide new ways of thinking about back office integration of these services.
W
xxi
xxii
Introduction
That is the upside. What is the downside? The downside is increased risk. People and organizations out there are willing to steal identities and corporate secrets or disrupt a site’s ability to support its customers, either as a game, to make a political statement, or for profit. Protecting yourself or your organization against these threats is what this book is about. Since Caesar’s day there has been a need for people to be able to interact and communicate securely. The earliest encryption techniques were introduced to help Caesar’s legions communicate. Traditional security techniques have evolved around the issue of protecting systems and networks in ways that allow people to rely on others being who they say they are and on being able to maintain the privacy and integrity of their communications. Web Service ride on top of these traditional systems and networks and build on the countermeasures and methods developed over the past half-century for maintaining confidentiality, integrity, and availability. Isaac Newton said, “If I have seen further [than certain other men] it is by standing upon the shoulders of giants” [Newton]. Web Services security in effect stands on the shoulders of giants. This book is designed to help you understand not only the evolving Web Services security standards and their use, but the underlying principles, concepts, and infrastructure on which they are built.
HOW THIS BOOK IS ORGANIZED This book is organized into major sections that you can use to familiarize yourself with the subject or in constructing either a one- or two-semester course, depending on the background and experience of your students. Chapter 1 begins with a brief introduction to conducting business on the Internet and the role Web Services play. It also introduces some of the security challenges and the virtual domain model we have developed based on the existing and emerging Web Services standards to help address those challenges. Chapters 2 and 3 discuss security threats and attacks and the classic security goals of protecting against those threats and attacks. Chapters 4 and 5 introduce the basic technologies Web services build upon. Chapter 4 discusses the Internet and the World Wide Web; Chapter 5 provides an overview of the extensible markup language (XML) and Web Services.
Introduction
xxiii
Chapter 6 discusses basic security policy and why security policy is important to an organization. Chapter 7 covers the Web Services standards in place for communicating policy. Chapters 8, 9, and 10 take a bottom-up look at implementing security measures. Chapter 8 looks at protecting networks and servers; Chapter 9 looks at protecting messages, transactions, and data; and Chapter 10 completes the information security triad by looking at confidentiality and integrity. Chapter 11 discusses the Web Services standards for communicating the security tokens and credentials between parties introduced in Chapters 8–10. The chapter goes into detail concerning the WS-Security, XML Encryption, and XML Signature standards. Chapter 12 looks at auditing and its role in the overall security architecture. Chapters 13 and 14 go into detail concerning the concepts of trust and communicating trust both between parties and across domains. Chapter 13 goes into depth concerning the types of trust and physical, logical, and virtual trust domains. Chapter 14 looks at the standards such as WS-Trust, WS-Federation, XKMS, SAML, and XACML for communicating trust and establishing trust relationships. Chapter 15 concludes the book with the development of a seven-step process for addressing enterprise Web Services security within a multiple domain context. You can customize how you approach this book depending on your background or that of your audience. If you are already familiar with basic Web Services technologies and are looking for a better grounding in security techniques and the supporting Web Services standards, you may want to skip Chapters 4 and 5. If you are already familiar with traditional security concepts and how they are applied and are just looking for how to use the Web Services standards, you may want to concentrate on Chapters 4, 5, 7, 11, 14, and 15.
WHO THIS BOOK IS FOR This book is intended for business, security, and technology professionals and students wanting to increase their understanding and knowledge of basic security principles, Web Services security standards and techniques, or both. We try to provide even coverage in suitable depth for teaching these concepts at an introductory level at either the undergraduate or graduate level. Our goal is to demystify many
xxiv
Introduction
of the basic security concepts and to illustrate how they can be applied using the Web Services standards as part of a comprehensive enterprise security strategy. The book is also for the professional. Regardless of whether you are a manager wanting to know about Web Services and security, a security professional wanting to better understand Web Services, or a Web Services architect or developer wanting to better understand security, you will find the foundation you need in this book.
REFERENCES [Newton] The Columbia World of Quotations, Columbia University Press, 1996. Available online at http://www.bartleby.com/66/18/41418.html.
1
Security in the Networked World
In This Chapter Business on the Internet Information Protection Web Services Security Challenges Countermeasures WS-* Family of Standards Virtual Domain Model for Web Services Security Summary References
he wide reach of the Internet and the World Wide Web have changed the way we do things in many ways that would not have been thought possible just 20 years ago. Consumers now interact directly with sellers, students now attend class online, businesses now interoperate with suppliers and partners through back office applications and electronic data exchange, and governments now provide direct online services to their constituents. We now have a generation that may never have had to use a library for basic research or snail-mail to file a tax return. More and more of us are using the Internet for comparing prices and making purchases. This helps reduce prices by increasing competitive pressures that in turn cause businesses to look for more efficient and effective ways of providing services that in turn drive down costs and prices in a continuing cycle that is driving a global economy. Consumers are no longer limited to local merchants when comparing prices, and merchants are no longer restricted to local customers when selling. The Internet is
T
1
2
Enterprise Web Services Security
creating a truly global marketplace where from an economic standpoint, there is near perfect knowledge, almost frictionless selling, and low barriers to entry. While these changes in the way we live are significant, they still cannot be called revolutionary, as we’ve basically moved our brick-and-mortar ways of doing business and interacting onto the Web. For example, rather than send out paper catalogs and depend on mail and telephone orders, companies now put their catalogs onto the Web and accept direct credit card orders from customers. This isn’t really all that different from the way companies did business before, as only the paper catalog and the intermediaries to the transaction have been eliminated. The revolution is about to begin. We are now seeing the beginnings of something that can be called truly revolutionary as the Internet enters its third generation. The first generation Internet was about connectivity and providing basic capabilities. It was defined by basic standards-based protocols, such as Transmission Control Protocol/Internet Protocol (TCP/IP) and Simple Mail Transport Protocol (SMTP), and services such as File Transfer Protocol (FTP) and email. The World Wide Web defined the second generation of the Internet through the HyperText Transport Protocol (HTTP) and HyperText Markup Language (HTML). The second generation was about browsing (discoverability) and presentation. The eXtensible Markup Language (XML) and the Web Services standards are defining the third generation of the Internet and are setting the stage for a semantic Web that many believe will be even more revolutionary. Web Services are often confused with more general services that may be available over the Web. We will clearly distinguish between Web Services and more general services by capitalizing both terms when referring to a Web Service. XML and Web Services are combining to provide programmability, which opens a whole new way of thinking about business models and interacting. These standards have the potential to drastically alter how individuals and companies work together and interact, allowing things that couldn’t be done or even conceived of before. New ways of doing things come with benefits and risks. As Metcalf’s law points out, the value of a network is proportional to the square of the number of connected nodes [Gilder93]. That means there is a potentially incredible upside to making services available on a highly interconnected network such as the Internet where there are millions of connected users, a population that is growing everyday. The downside is the accompanying potential for damage or loss. All the nodes out there are not necessarily friendly ones. Some are competitors, some may be adversaries, some may be criminals intent on stealing valuable information, and some may be hackers intent on disrupting or destroying information or capabilities as a game, a challenge, or to further their own motives.
Security in the Networked World
3
This book provides guidance for organizations that are ready to take that next step, that are considering moving onto more open networks such as the Internet and transforming their business processes using Web Services. We describe the capabilities of Web Services and how they can be safely used to augment or replace current business process and information exchange models. We do this from an enterprise perspective, as we realize one of the challenges an organization must face is in moving from wholly owned and controlled private networks to highly interconnected intranets and extranets, with some even having the Internet as their backbone. One of the concerns enterprises have with moving toward the use of Web Services is the security pitfalls that companies risk when converting to automated, online transactions and back office operations. Part of the purpose of this book is to explain the ways in which such a conversion can be effected while addressing the potential underlying security concerns. We describe security concerns not to frighten people away from moving online, but to help demystify the threats and risks and remove the hype and hysteria surrounding attacks and their potential impacts and to thereby hasten the transition.
BUSINESS ON THE INTERNET Several things are driving movement toward the Web Services way of doing business. Some of these drivers are caused by the current movement of more and more companies onto the Internet. The Internet offers low-cost, high-speed, highly reliable backbone networks that can give a company global reach. The Internet provides new ways for the business entities (buyers, sellers, end users, etc.) to work together by allowing new ways for business relationships to be built. The way these relationships have formed is driven partially by modeling and extending preexisting business models. The Internet has demonstrated additional flexibility in how business partners can interact. These include Internet-centered versions of traditional business operations (B2B and B2C, as will be described next) and new types of interactions made possible by Web Services. B2B The term business to business (B2B) refers to a business transaction that takes place between two companies. While the definition doesn’t require that the Internet be involved in the transaction, the term usually implies some networking involvement. B2B isn’t just a replacement for commodity sales between companies. There are many other types of Internet-centric B2B portals (Web sites that support business operations). These include:
4
Enterprise Web Services Security
Supply and procurement portals that allow companies to request products and suppliers to bid for those needs Brokering portals that act as intermediaries between buyers and sellers Vertical industry portals dedicated to a particular industry segment In the past, some B2B transactions were supported by proprietary electronic data interchange (EDI) transaction systems that routed and translated EDI forms between trading partners. The EDI forms themselves were standards based, there being industry standards (ANSI® X.12 series) for traditional business forms such as orders, invoices, manifests, etc., yet the internal forms and the networks connecting trading partners frequently remained closed or proprietary. Web Services systems are replacing these with systems built on open, standardized interfaces and open networks such as the Internet. Portals act like an equalizer because participation is available to companies of any size. Small companies selling products compete with larger suppliers on a level playing field. B2C Business to consumer (B2C) refers to a business transaction between a consumer and a business. This is the retail side of the business that drives other online transactions and is generally limited to online purchasing. Unlike B2B, there is no significant Web Services penetration in the B2C space, but Web Services plays a large part in the fulfillment systems that handle processing of customer orders. Evolving Business Models Don Tapscott, in his book Digital Capital [Tapscott00], discusses the effect highly connected networks, such as the Internet, are having on traditional business models. He discusses five types of business webs: Agora (Greek for “marketplace”): A real or virtual marketplace where buyers and sellers can come together to discover the price of a good or service, that is, a global flea market. Aggregators: Bring producers and consumers together, helping consumers select, organize, and purchase goods. Alliances: Each player, motivated by self-interest, contributes something to the product or service. Value Chains: A conductor designs, produces, and delivers products or services to meet a specific set of needs, possibly through B2B. Distributive Network: Facilitates the discovery and exchange of information or goods between providers and users.
Security in the Networked World
5
Web Services are a key enabler in each. As we will discuss in the next two sections, Web Services provide the information protection mechanisms necessary to operate in such a diverse, dynamically connected environment and the distributed transaction computing model needed to fuel multiorganization alliances, value chains, and distributive networks.
INFORMATION PROTECTION A second major driver behind the Web Services way of doing things is the increasing need for information security solutions that can span network and organizational boundaries. One of the primary purposes of an information security program is to protect the information (transaction records, customer data, etc.) generated or gathered by a company in support of their business operation. Sometimes the need to protect this information is obvious; for example, it’s easy to convince a company to protect information that would help a competitor gain a business advantage. Protecting the privacy of customer records may not be as easy to justify from a business standpoint; in this case, there may be laws that require a company to extend protection to records that may not have a direct business impact. Examples of these laws for the United States are the Health Insurance Portability and Accountability Act of 1996 (HIPAA) [CMS05] and the Sarbanes-Oxley Act of 2002 [SEC05] regulations. Europe has similar regulations such as the 2002 EC Directive on Privacy and Communications. (In most ways, European governments have stricter privacy regulations than the regulations in the U.S.) We can categorize some of these drivers for security regulations under the broad headings of privacy, corporate confidentiality, and legal obligation. Privacy Employers have fiduciary responsibilities to their employees and need to respect both their privacy and desire to keep confidential information confidential. The surreptitious interception of an employee’s computer communications, such as email or chat room sessions, or release of their personnel records can expose an employer to one set of issues; the compromise of employee medical, legal, financial, and grievance information can expose them to another. The Children’s Online Privacy Protection Act creates a responsibility relationship between a Web site sponsor and both underage users and their parents [FTC99]. The act gives parents control over the information a Web site can collect from and about their children when those children are under 13 years of age and provides provisions for parents to be able to “opt-out” of having that information collected for their children.
6
Enterprise Web Services Security
Consumers also have the right to obtain information businesses may collect and maintain about them or their transactions. The Federal Trade Commission (FTC) maintains a Web site providing guidance for businesses on the information they need to collect and protect and for consumers on how to obtain that information [FTC04]. Companies must be concerned with theft. When they collect information from their customers to help with order processing, those customers assume that the information they supply will be protected. The organization that accepts this data must take steps to protect the privacy of their customer’s information. Customer bank and credit card information that is a necessary part of transactions is a prime target for identity theft. As this is being written, there have been several cases of companies receiving negative publicity because of inadvertent loss of customer or employee information [Daurat05]. The problems in the cited article are examples of privacy violations that American consumers are just beginning to understand. Corporate Confidentiality Just as individuals have a right to privacy, businesses have the right to conduct business without being subjected to unfair methods of competition and of deceptive acts and practices within the marketplace. The FTC is the enforcement authority in this area. In today’s global marketplace and competitive environment, businesses must be concerned with a number of issues including trademark and copyright protection, piracy of digital content, and competitive intelligence. Competitive intelligence is information about a business that may give others insight into future plans, customers, products, or technologies and therefore a competitive advantage. The information you need to protect to avoid exposure is often less obvious than in the areas of trademarks, copyrights, or piracy protection. Competition can come in many forms. For example, recruiters working for a competitor may be interested in internal phone lists and payroll information in order to launch a raid on a firm’s employees. A competitor may be interested in customer lists, product development plans, or contract pricing strategy to aid them in planning and executing a counterstrategy or new sales promotion. Alarm codes, computer security codes, and application source code are also of interest to those wanting to obtain access or steal information from a company. Web applications should be written to carefully protect access to such information, allowing only authorized information to be exposed to Web users. Legal Obligations In addition to privacy and business reasons for protecting information, there may be a legal requirement to do so based on the particular type of organization or business area served and the type of information involved.
Security in the Networked World
7
Several legislative acts govern the use of information by executive branch agencies of the U.S. government. The Privacy Act of 1974 [DOJ04] regulates the collection, maintenance, use, and dissemination of personal information by these agencies. The Computer Matching and Privacy Protection Act of 1988 [DOJ04a] establishes further requirements for providing individuals notice and an opportunity to refute adverse or derogatory information collected about them. The Freedom of Information Act (FOIA) [DOJ04b] governs the release of information to individuals and organizations by the government. Sarbanes-Oxley requires public companies to appropriately manage, maintain, and control corporate information in order to ensure accountability, minimize risks, and increase corporate integrity as reported to stockholders and the public. Microsoft’s antitrust trial and Enron are two high-profile examples where the type of information covered in this act can come into play. There is also targeted legislation affecting major industries such as health care, education, and banking. The HIPAA regulations directed the U.S. Department of Health and Human Services (HHS) to establish a set of standards for health-care transactions. The purpose of these standards is to help improve the efficiency of the health-care industry by moving toward electronic transactions. In response, HHS has delivered a set of regulations and standards regarding privacy, security, and transaction details. HIPAA includes provisions ensuring the privacy of individual health records. Firms within the industry must follow strict rules in handling, transmitting, and releasing patient information contained within these records. Web Services can play a vital role in the implementation of HIPAA-compliant transaction processing systems. Educational institutions receiving funds from the U.S. Department of Education are subject to the Family Educational Rights and Privacy Act (FERPA) [ED05]. FERPA protects a student’s educational records and establishes the guidelines for the proper handling and release of that information. The Financial Modernization Act of 1999 (also known as the Gramm-LeachBliley Act) [FTC99a] requires banks to implement security programs protecting customer information and confidentiality. The Fair Credit Reporting Act [FTC02] protects the release of consumer information collected by consumer reporting agencies.
WEB SERVICES A service is a function or capability that is well-defined, self-contained, and does not depend on the context or state of other services [SOAdef04]. The World Wide Web Consortium (W3C) defines a Web Service as “a software system identified by a URI [RFC2396], whose public interfaces and bindings are defined and described
8
Enterprise Web Services Security
using XML. Its definition can be discovered by other software systems. These systems may then interact with the Web Service in a manner prescribed by its definition, using XML-based messages conveyed by Internet protocols” [W3Cdef04]. Web Services builds on open, standards-based architectures such as XML [XML00] and Simple Object Access Protocol (SOAP) [SOAP002] to assist architects and developers with the construction of loosely coupled distributed transaction systems. Web Services add protocol standards for service definition, service discovery, service invocation, and security that are grounded on a common XML base. Chapter 5 will introduce how XML and SOAP enable Web Services applications, and later chapters will expand on specific Web Services security standards. Web Services build on the Internet’s core protocols: TCP/IP and HTTP. This makes them ideal for organizations implementing new business models and ways of interacting with their customers and partners where either the Internet or an extranet built on Internet technologies is a key part of their enterprise network. B2B and health-care applications are part of a growing list of examples of places where Web Services are put to use today. Web Services security is used when it comes to protecting these new business models and to protecting the enterprise’s boundaries and assets. Defining how secure Web Services systems are designed, built, and used is the main thrust of this book. This book describes how enterprise applications can be moved to Web Services while limiting the security risks. XML XML is a standard data format for encapsulating data in both a human-readable and machine-readable text form. Normally, XML-encapsulated data is transported over the Internet using TCP/IP networking, but it can be stored in databases and transmitted by other means (such as via email). When a Web Services client wants to locate or communicate with a Web Services server (the component providing the service), it encodes its request in XML. After processing the request, the server returns its response to the client as XML as well. In addition to being useful for Web Services messages, XML is now a widely available encoding format for native database storage and query processing. SOAP Requests between Web Services components (clients and servers) use what are called remote procedure calls (RPCs). An RPC is used by one part of an application to make a request to another part that is generally running on a remote system (thus the remote part of the name). RPCs have been around for a long time and have helped distributed applications work across the Internet. One problem with the use of RPCs in the past was that they required a complex, technology-specific infrastructure that limited their use to a small number of systems. The problem
Security in the Networked World
9
with these systems was that a change to one side of the interface required changes to both sides and that changes to the infrastructure involved changes in all of the systems involved in the transaction. In other words, all of the systems needed to be “infrastructure aware” and on a common infrastructure. An example of this was the common object request broker architecture (CORBA) [OMG05] system. Each of the systems using a CORBA application had to install software and use a special interface definition language (IDL) to allow it to interact with the broker in the CORBA system. The object broker provided the glue allowing objects to transparently make requests and receive responses across an object bus. The need for this specialized middleware and client code limited the usefulness of the system when users did not have the prerequisite components. SOAP defines a means of encapsulating RPCs into XML format, making possible a distributed application that combines several types of systems. SOAP’s standards heritage allows it to overcome many of the problems earlier technologies faced: SOAP does not require special middleware or definition languages for interoperability or common infrastructure. SOAP uses the same network transport protocol that the World Wide Web uses (HTTP over TCP/IP). This means there are fewer barriers to SOAP-supported traffic as a transport mechanism because no special software components need to be installed on client systems. Since SOAP uses the same transport that Web pages use (HTTP) and is text (XML) based, it can easily pass through firewalls since those firewalls usually allow HTTP requests and do not require special filters. The Messaging Model A SOAP transaction is used in a peer-to-peer mode following a request-response model. Peer-to-peer means that two cooperating parties work together in a transaction where both agree (neither is in control or superior to the other) to the exchange. The party making the request is generally called the client and the one responding to the request is generally called the server in this model. The client builds a request by encoding their request for service into an XML form that the service provider can understand. This request usually indicates what the server is being asked to do and includes whatever parameters are necessary for the server to process the request (for example, customer ID, part numbers, and so forth). The request message is sent to the server over a SOAP TCP/IP connection. The server processes the request and sends a response with either an answer or an error message. (In some cases no immediate response is provided, but these are unusual.) This request-response model is simple and efficient, while handling a wide variety of possible service requests. Much more detail on how SOAP handles Web Services transactions will be provided in Chapter 5.
10
Enterprise Web Services Security
SECURITY CHALLENGES An enterprise can configure and use a Web Services environment in many ways. Each of them has unique security challenges that this book will address. Note that these environments are not mutually exclusive, as an organization may use one or all of them simultaneously. Threats and Risks The Web Services Interoperability Organization™ (WS-I™) identifies a number of specific types of security attacks that Web Service providers must take into consideration [WSIScenarios04]. These include: Key Attack: Weak algorithm or key length subjects message keys or algorithm to attack. Traffic Analysis: Contents may be derivable by an analysis of source, destination, size, or frequency. Host Penetration: Attack compromises host computing system. Network Penetration: Attack compromises host network. Timing: An action is derivable from the time it takes to perform the action. Covert Channels: Secret communication paths provide a route to sensitive information. Message Archives: Attacking SOAP queue compromises message traffic. Network Spoofing: Bad guy sends messages, pretending to be a good guy. Trojan Horse: Unauthorized information is hidden within a message. Virus: Message plants a virus in Web Services client or server. Tunneling: Planted software passes information along with messages. Denial of Service: Specific messages, sequence of messages, or quantity of messages cause failure or severe degradation. Repudiation: Sender denies sending a message. Details on each of these attacks are available in the referenced WS-I documentation. Most of these will be discussed in detail later in this book. Policy WS-I scenarios identify the security challenges in addressing each of these types of threats [WSIScenarios04]. Some of the challenges include
Security in the Networked World
11
Peer Identification and Authentication: The entities involved are who they claim to be. Data Origin and Authentication: The source of data received is as claimed. Data Integrity: Ability to determine data has not been changed, destroyed, or lost. Data Confidentiality: Ability to ensure data is not disclosed to unauthorized parties. Message Uniqueness: Ability to ensure a message is processed only once. An organization must weigh the risks posed by these challenges and the costs of protecting against the risks in developing its security policy. Security policy may divide infrastructure and capabilities across domains and enclaves, where each domain or enclave represents a set of owned and operated equipment and capabilities operating under a common or mutually agreed upon security policy. Unfortunately, there is no simple means of measuring such risks, as the threats depend on too many variables. For example, the value of the information, the size of the company, the nature of the users involved, the consequences of information tampering, and the cost of information disclosure all matter when deciding what risks to consider and how much protecting against those risks will cost. Internet Using the public Internet to support your business transactions clearly has serious security challenges. Because you are using a public network, you cannot control how your information travels between client and server. This leads to privacy exposure and the potential for confidential information to be exposed or tampered with. We will discuss ways the Internet can be used while minimizing the chances of these problems by using things like encryption technology. (Encryption is used to scramble information so unauthorized persons cannot understand it.) Another threat from the Internet is from hackers who attempt to compromise your systems by attacking them over your Internet connection. Most organizations restrict access to their internal systems so that attacks from the Internet do not compromise their servers or employee’s systems. Intranet An intranet is an internal network that is isolated from the Internet. Transactions over an internal network are usually assumed to be protected from access by outsiders. There still should be some attention paid to protecting transactions in these environments, as there are instances of insider attacks. Just because people are employees does not mean that they are always trustworthy. They may be deliberately
12
Enterprise Web Services Security
attacking the network or inadvertently used as part of an attack (as in viruses or network worms) The intranet provides a means of isolating such users, defending against some forms of internal attacks. Extranet An extranet is a network connection between trading partners. Usually, these are used between two unrelated companies or organizations that wish to share backend business information. For example, a company might make raw materials inventory information available to a supplier so they can replenish the supply when necessary. An extranet extends an organization’s local area network (LAN) or intranet across the Internet to interconnect with the partner’s systems. The extranet allows limited traffic to pass from the Internet to internal servers that are normally not exposed to the Internet. The unique security concern here is to allow this limited access without allowing that access to be used to compromise other internal systems. Wireless Wireless technology allows a client system to connect to a network using a radio transmitter and receiver set to replace the wires that would have carried the client’s traffic. The two distinct classes of wireless networks in use today are those used with mobile phones and those used with general-purpose computer systems. Both are used in Web Services environments and both have security concerns. A mobile phone can be a Web Services client. Usually this requires the use of a gateway, which is a system that translates a traditional Web page into a format the phone can accept. The gateway system communicates with the mobile phone using the Wireless Application Protocol (WAP) [OMA02]. The gateway extracts the important information from the Web site and translates it into a form that can be displayed on the phone (this translation is necessary if the application is going to accommodate the limited screen area on the typical mobile phone). Communications between the phone and the gateway are carried over a private network operated by the user’s mobile telephone carrier. The communications between the mobile phone and the WAP gateway are protected from exposure using methods similar to a “secure” Web site [WAPFAQ04]. The gateway connects to the ultimate server using secure Web protocols as well. These methods mean that a mobile user’s information is not easily intercepted by an attacker. However, there is a weak point because the WAP gateway system itself might be compromised. Since all application requests and responses pass through the gateway, there must be special attention paid to the gateway to ensure that it does not become a point of compromise.
Security in the Networked World
13
The other way in which wireless technology is used is for network connectivity for general purpose PCs or other computer systems. Today, most of these connections use Institute of Electrical and Electronics Engineers (IEEE) 802.11®, also known as Wi-Fi® [WiFi04]. Wi-Fi networking hardware is now available inexpensively, allowing easy mobility for laptop computers within a small area (such as inside a building). Unfortunately, there are a limited number of channels available for Wi-Fi traffic, and tools are available (such as Kismet [Kismet05]) that allow an attacker to receive wireless transmissions that are intended for another user. Unlike a wired connection that would require a physical connection to be “wiretapped,” Wi-Fi allows someone with most Wi-Fi networking cards to capture any Wi-Fi traffic in their local area without being detected. While security features are available for Wi-Fi systems, often these are not enabled. Even if they are being used, they may not provide real privacy because of flaws in their implementation. Much more information on the wireless flaws is available in a Network World Fusion article at [NW02]. Wired Equivalent Privacy (WEP) encryption does not provide real privacy and should be replaced with WPA® (Wireless Protected Access) where possible as described in the aforementioned article. Wi-Fi wireless networks have the characteristics of the Internet: they are public networks with a potential for hostile outsiders who may attempt to attack you with traffic floods or theft of information. Wireless networks have additional problems in that they are hosted on public airwaves. Attackers can use widely available software to watch all the packets that travel over a wireless LAN, compromising the privacy of the network users. We will discuss some of the ways in which wireless LANs can be secured in Chapter 8.
COUNTERMEASURES Each risk comes with one or more countermeasures to help mitigate or eliminate that risk. Many of these countermeasures have evolved through traditional network and systems security techniques. Web Services builds on and extends many of the traditional techniques for: Authentication: Determining that users and services are who they claim to be Authorization and Access Control: Determining users only have access to the services and data they are permitted to have Confidentiality: Keeping message exchanges private
14
Enterprise Web Services Security
Integrity: Ensuring that what was received was actually what was sent
WS-* FAMILY OF STANDARDS The WS-* family of standards provides a set of XML and Web Services standard formats, grammars, and message sequences for communicating policy information and addressing the various security challenges across different types of networks. This family of standards was introduced in 2002 by IBM and Microsoft as part of their overall Web Services roadmap [Roadmap02]. The roadmap introduced WSSecurity, which built on XML encryption and XML signature to create a foundation layer. It also introduced several higher-level standards including: WS-Policy: Defines the syntax and grammar for communicating policies as a set of assertions WS-Security: Defines the syntax and grammar for communicating security tokens, digital signatures, and message encryption information WS-Trust: Defines the syntax and grammar for establishing trust relationships and communicating with third-party trust brokers WS-SecureConversation: Improves the efficiency of exchanges by defining a way to exchange multiple messages within a single context or session WS-Federation: Lays the foundation for creating federated trust relationships across multiple domains and enclaves Since the initial roadmap was introduced, a number of supporting standards and standards proposals have been introduced. These include: WS-SecurityPolicy: Builds on WS-Policy, adding security-specific assertion elements for communicating security token, integrity, and confidentiality constraints. WS-PolicyAttachment: Defines the mechanisms for associating policies with a subject inherently, as part of its intrinsic definition, or through either its associated Web Services Description Language (WSDL) or Universal Description, Discovery, and Integration (UDDI) description. XKMS: The XML key management specification (XKMS) builds on XML signature and XML encryption, providing a service for registering and distributing public keys for those standards.
Security in the Networked World
15
SAML: The Security Assertion Markup Language (SAML) defines a framework for exchanging authentication and authorization information across domains in the form of assertions rather than identities or traditional security tokens. XACML: The eXtensible Access Control Markup Language (XACML) defines a hierarchical model for defining and evaluating policies.
VIRTUAL DOMAIN MODEL FOR WEB SERVICES SECURITY The WS-* standards each address a particular aspect of the overall security problem. Most build on traditional security methods and techniques, while others introduce new ways of approaching some of security’s more daunting challenges. Viewing them in isolation or in a piecemeal manner can leave you overwhelmed or with a false sense of security. One of the major purposes of this book is to explain a set of methods for building flexible networks and Web Services based on the aforementioned standards for enterprise entities to use while cooperating in a business relationship. These networks are called virtual domains and are built on the concepts of trust and trust relationships, where trust is the assured reliance the parties can have on one another and each other’s ability to perform a specific function. Security Domains The virtual domain model is a key concept discussed in this book. The model is built on the concept of a security domain, which is a collection of systems that have a single security policy and a single set of security controls. The domain may be physical, where the infrastructure and all of its components belong to a single organization, or logical, where the infrastructures are interconnected through bilateral agreement. Often a security domain is a single enterprise, but smaller or larger domains may exist. For example, an accounting department in a company may be a domain unto itself when working with accounting or payroll systems, but part of a second, larger security domain that covers the entire enterprise when dealing with any other systems. The virtual part of the model comes from its dynamics. A domain is referred to as “virtual” because it is organized around a particular business need, comes into existence when necessary, and then disappears when it is no longer needed.
16
Enterprise Web Services Security
Enclaves An enclave is an isolated component of a larger network or domain. The enclave is generally isolated either to more strictly protect the data it contains or to protect the larger network from users accessing it or attacks against the enclave. The enclave will frequently use different protection mechanisms than those enforced on the larger network. Trust Relationships When they wish to share information, a set of security domains mutually agree to enter into trust relationships with each other. In these relationships the domains agree to trust the security mechanisms, services, and data each provides to the extent necessary to do business together. Several types of trust relationships exist to allow flexible arrangements between domains. We will describe many examples of different types of trust domains and trust relationships in Chapter 13. The Model Different models can be used to define the trust relationships between security domains. Hierarchical relationships are traditionally used, but the virtual domain model allows for far more flexibility in how trust relationships are used. The virtual domain model projects the security policy for the domain or enclave hosting a Web Service across the physical and logical domains and enclaves supporting its clients and supporting services in order to determine The policy that must be met The capabilities that are currently available to meet that policy The capabilities that can be made available The equivalents that can be found We will look at how this model can be used in Microsoft’s .NET environment, Sun’s J2EE™ (Java 2 Enterprise Edition) environment, and wireless environments. We will build on the virtual domain model to develop a seven-step process for working through the deployment and security questions that frequently arise in developing and deploying enterprise Web Services in a highly interconnected environment.
Security in the Networked World
17
SUMMARY In this chapter we introduced the scope and purpose of this book and some of the business drivers that are fueling the move to the Internet and to Web Services. We looked at the rationale for moving to standards-based, XML-compliant Web Services, the benefits and risks this move introduces, and the Web Services standards to help address these risks. We will explore these topics in far greater detail in later sections of the book. We also briefly introduced the concepts of security domains and the concept of a virtual domain model for Web Services that will help us introduce a coherent, systematic approach to addressing information security within a Web Services context that we will discuss in detail later in this book.
REFERENCES [CMS05] Centers for Medicare and Medicaid Services, “Health Insurance Portability and Accountability Act of 1996.” Available online at http://www. cms.hhs.gov/hipaa/. [Daurat05] Daurat, Cecile, “Time Warner Reports Loss of Personal Data on 600,000 Employees,” Washington Post Online, May 3, 2005. Available online at http://www.washingtonpost.com/wp-dyn/content/article/2005/05/02/ AR2005050201528.html. [DOJ04] U.S. Department of Justice, “The Privacy Act of 1974.” Available online at http://www.usdoj.gov/foia/privstat.htm. [DOJ04a] U.S. Department of Justice, “Overview of the Privacy Act of 1974, 2004 Edition.” Available online at http://www.usdoj.gov/04foia/1974compmatch.htm. [DOJ04b] U.S. Department of Justice, “Freedom of Information Act (FOIA).” Available online at http://www.usdoj.gov/04foia/index.html. [ED05] U.S. Department of Education, “Family Educational Rights and Privacy Act (FERPA).” Available online at http://www.ed.gov/policy/gen/guid/fpco/ferpa/ index.html. [FTC02] Federal Trade Commission, “The Fair Credit Reporting Act.” Available online at http://www.ftc.gov/os/statutes/fcra.htm. [FTC04] Federal Trade Commission, “Federal Trade Commission Facts for Businesses and Consumers.” Available online at http://www.ftc.gov/ftc/business. htm. and http://www.ftc.gov/ftc/consumer.htm. [FTC99] Federal Trade Commission, “Federal Trade Commission Facts for Businesses, The Children’s Online Privacy Protection Rule.” Available online at http://www.ftc.gov/bcp/conline/pubs/buspubs/coppa.htm, November 1999. [FTC99a] Federal Trade Commission, “Financial Privacy: The Gramm-LeachBliley Act.” Available online at http://www.ftc.gov/privacy/glbact/.
18
Enterprise Web Services Security
[Gilder93] Gilder, George, “Metcalf’s Law and Legacy,” Forbes ASAP, September 13, 1993. Available online at http://www.seas.upenn.edu/~gaj1/metgg.html. [Kismet05] Kismet Forum, “What is Kismet?” Available online at http://www. kismetwireless.net/. [NW02] Network World, “What’s Wrong With WEP.” Available online at http:// www.networkworld.com/research/2002/0909wepprimer.html. September 9, 2002. [OMA02] Open Mobile Alliance, “WAP Forum Specifications.” Available online at http://www.wapforum.org/what/technical.htm. [OMG05] Object Management Group, “CORBA FAQ.” Available online at http://www.omg.org/gettingstarted/corbafaq.htm. [RFC2396] Berners-Lee, T., et al.,“Uniform Resource Identifiers (URI): Generic Syntax.” Available online at http://www.ietf.org/rfc/rfc2396.txt, August 1998. [Roadmap02] IBM Corporation and Microsoft Corporation, “Security in a Web Services World: A Proposed Architecture and Roadmap, A Joint White Paper from IBM Corporation and Microsoft Corporation,” Version 1.0. Available online at http://www-106.ibm.com/developerworks/webservices/library/wssecmap, April 7, 2002. [SEC05] U.S. Securities and Exchange Commission, “Spotlight on Sarbanes-Oxley Rulemaking and Reports.” Available online at http://www.sec.gov/spotlight/ sarbanes-oxley.htm. [SOAdef04] “Service Oriented Architecture (SOA) Definition.” Available online at http://www.service-architecture.com/web-services/articles/service-oriented_ architecture_soa_definition.html. [SOAP002] Mitra, Nilo, “SOAP Version 1.2 Part 0: Primer.” Available online at http://www.w3.org/tr/SOAP12-part0, June 26, 2002. [Tapscott00] Tapscott, Don, et al., Digital Capital: Harnessing the Power of Business Webs, Harvard Business School Press, 2000. [W3Cdef04] Austin, Daniel, et al., “Web Services Architecture Requirements W3C Working Group Note 11 February 2004.” Available online at http://www. w3.org/TR/2004/NOTE-wsa-reqs-20040211. [WAPFAQ04] The Wireless FAQ, “How Secure is WAP with SSL and WTLS?” Available online at http://www.thewirelessfaq.com/9.4.asp. [WiFi04] Wi-Fi Alliance, “Wi-Fi Overview.” Available online at http://www. wi-fi.com/OpenSection/why_Wi-Fi.asp?TID=2. [WSIScenarios04] Schwarz, Jerry, et al., “WS-I Security Scenarios, Working Group Draft, 2004/04/16.” Available online at: http://www.ws-i.org/Profiles/ BasicSecurity/SecurityScenarios-1.0.pdf. [XML00] Internet Engineering Task Force, “Extensible Markup Language (XML) 1.0 (Second Edition).” Available online at http://www.w3.org/tr/rec-xml, October 6, 2000.
2
Threats and Attacks
In This Chapter Threats, Vulnerabilities, and Countermeasures Ensuring Reliability Vandalism and Sabotage Denial of Service Privacy and Confidentiality Breaches Data Integrity Violations Man-in-the-Middle Attacks Spoofing Attacks Mobile-Code Threats Fraud Special Considerations for Web Services Environments Summary References
o begin to understand the need for information security, you first need to understand the ways in which your systems can be attacked. Threats and attacks are not new to Web Services. Many of them predate networks and computers, some going back to even before Caesar’s time. There are well-understood terms used to describe these attacks and the defenses that you can mount against them. We often confuse the newness of the technology, in this case Web Services, with the newness of the concepts, in this case security, and fail to leverage the history of the thinking and capabilities that can be brought to bear. In this chapter, we will begin to introduce the lexicon of information security terms to help form the basis for later material as we begin to look at how to provide secure Web Services.
T
19
20
Enterprise Web Services Security
THREATS, VULNERABILITIES, AND COUNTERMEASURES To define computer security, we first need to define what it is we mean by secure. One definition of a secure system is a system that always does just what you want and nothing more. To meet this security goal, the system must be reliable and remain reliable while resisting attempts by attackers to compromise its reliability. In one sense, we haven’t really defined secure well because the definition above simply replaced the term secure with the term reliable. We emphasize reliability because that term has a better-understood meaning: the system can’t be exploited by attackers to do things that we don’t want because it only does what we expect. A secure system has no unintended side effects that an attacker can attempt to exploit. That’s the reason for building a secure system: it is reliable and dependable, only doing what we want it to do. Unfortunately, building a system that reliably only does what we want it to do and nothing else has proven to be difficult. (Within security circles there is the concept of an unconditionally secure system—one that remains secure even when the attacker has unlimited time and computing resources for use in the attack. As we will discuss in Chapter 10, when we turn our attention to encryption algorithms, some perfectly secure mechanisms today will become vulnerable in the future because of Moore’s law—processing speed doubles roughly every 18 months [Moore65].) We need, therefore, to describe how we can secure a system by ensuring its reliability. To make a system reliable, we consider the system that we are trying to protect as a whole (the hardware, software, network, etc.) and try to determine ways that the system can be protected against attacks. In Chapter 3 we will describe the goals of that process. In this chapter we will be defining the ways in which systems can be attacked and how we can protect against those attacks. Compromise occurs when the efforts to ensure the reliability of a system fail. The consequence of the compromise is that our ability to trust the system is lost. The compromise may be the result of an attack or the exploitation of a vulnerability within the system or one of its underlying components. The result of the compromise is some degree of loss of reliability resulting from the loss of system integrity. The system no longer does exactly what it is expected to do. A threat is the possibility of a set of circumstances that may lead to compromise, that is, damage, loss, or harm to a system or its users. (We use the term loss in a generalized sense. A loss could be diminished value, restricted availability including theft, or reduced usability.) It’s easy to describe a threat that everyone understands: a schoolyard bully poses a threat to all the students in the playground (or at least the ones weaker than the bully). An attack occurs when the threat agent decides to attempt to damage a system or its users. To continue the analogy above, the attack happens when the bully
Threats and Attacks
21
chooses a victim and pursues him. Put another way, a threat expresses the potential for harm, and an attack actually causes the harm. You can’t have an attack without some threat existing that enables that attack. A vulnerability is a characteristic of or a weakness in a system that makes it subject to loss when an attack is mounted. The children on the schoolyard above are clearly vulnerable to injury from the bully’s attacks. The distinction between threats and vulnerabilities is that the vulnerability is an inherent characteristic of the system (the vulnerability is always there), while a threat is only realized if someone takes action. You can have undiscovered vulnerabilities; there is no threat until the vulnerability is discovered. One protects a system by use of countermeasures. A countermeasure puts controls in place to protect vulnerable components from attacks. Countermeasures are combinations of user actions, devices, procedures, or other methods that reduce or eliminate vulnerabilities. A schoolyard monitor could be hired as a countermeasure against our bully. Countermeasures can be technical (firewalls, intrusion detection systems, access control badges, etc.). Countermeasures can also be physical (or part of the system environment). For example, you can protect a site from intruders by the use of guards. We will continue to develop these definitions in Chapter 3, where we will explain how secure system designs help minimize the risk of successful attacks. For now, we concentrate on the source of threats and attacks. We continue by discussing the concept of ensuring reliability and some of the ways in which threats and attacks can be mounted against a system that you would like to secure.
ENSURING RELIABILITY Before we begin discussing the ways systems can be attacked, we need to define a model that describes how the systems are built and interconnected and how we can ensure reliability within those systems. Our model assumes that we have a client who wishes to perform some operation that requires them to communicate with a server somewhere in order to execute a business transaction. Figure 2.1 shows the basic layout of our model. In our model, software running on the client’s computer communicates with a partner system that implements the transaction. A client may need to communicate with multiple servers (server 1 through server n in Figure 2.1) in order to perform a transaction. The clients communicate with the servers over an unprotected Internet connection. In this model, we need to ensure the reliability of three components—the network, the client, and the server—for the overall system to be considered secure.
22
Enterprise Web Services Security
Server System 1
Client System
Internet or Private Network
Server System 2
Server System n
FIGURE 2.1 Networked client-server system model.
Ensuring the reliability of the client and servers means ensuring they are configured correctly, that they only contain the software they are supposed to contain and that that software is also configured correctly, and that they only expose the hardware connections and services they need. In effect, you must ensure that both the client and the server are appropriately “locked down.” We will get into the details of what it means to lock down a system in Chapter 8. As we will discuss throughout this book, locking down the components only at the network or system level is insufficient in a Web Services environment. Subcomponents such as the HyperText Transport Protocol (HTTP) server, applications server, and database server must also be appropriately locked down. In a Web Services environment where you are operating across the Internet, one caveat to this is that you will generally have far more control over the servers than you will over the clients in either business to business or business to comsumer types of implementations. Given that you have taken appropriate steps to ensure that the client and servers are reliable, or secure, the next question is the network. While the Internet provides the wide-area connectivity that allows for distributed transactions, it is important to remember that the network is not “run” by any one individual, company, or organization. It is a loosely connected collection of cooperating networks. The problem with this is that a client’s requests are carried over a network that the client and their servers do not control. Most companies assume that the companies supporting the Internet backbone are trustworthy (that is, that they’re not trying to watch what clients are doing in hopes of some financial gain).
Threats and Attacks
23
Another problem with our model is that the Internet provides a communications pipe that has no service-level guarantees. This means the client and server need to work together to add whatever reliability is necessary for them to use the Internet for their transaction. This means extra work for the application developers. For example, the client may send a message to a server and not expect a response. This is called fire-and-forget. In this scenario, the client has no guarantee the server actually received the message. In order to have such a guarantee, the client must expect and receive some sort of acknowledgement from the server that it at least received the message. This two-way model is the foundation of the basic request-response model that Web Services builds upon. Another aspect of Internet-based transaction systems is that the Internet provides only very basic services. The Internet provides TCP/IP, which is a simple packet transmission service Internet Protocol (IP) with a layered Transmission Control Protocol, (TCP), which provides reliable data transmission. The IP layer provides a simple unreliable packet transmission system for what are called datagrams. IP datagrams are collections of bits that are routed across the network by IP (and lower layers) until they eventually reach their destination. It’s important to understand that there is no guarantee that the packets will ever reach their destination. IP provides a best-effort service only and does not guarantee that datagrams will arrive at all or that they will arrive in the order in which they are transmitted. The TCP layer builds a reliable layer on top of IP. TCP data is guaranteed to arrive in the order in which the data was sent. TCP also provides error detection and correction for packets damaged or lost in transmission. While TCP provides a reliable transmission method, all that it does is move byte streams from end to end. TCP doesn’t care what the underlying data means to the client and server. Before the client and server can communicate in some useful, application-specific means, they must agree on a protocol for that communication. A protocol is an agreed-upon interpretation of the meaning of messages sent over the communication path created by TCP. A real-world example of this is a poker game. There is a set of well-defined steps that take place in the game, where the cards are dealt and then each player in turn decides what to bet and announces that decision. A game would not work if players bet out of order or declared their bets. The rules that dictate how the game will be played define the protocol. Before the client and servers in Figure 2.1 can communicate, some protocol must be designed to allow those systems to communicate. Protocols are generally application specific. One advantage of a Web Services environment is that it allows the protocol design details to be performed once and reused. This is the advantage of the Web Services protocols that we will explain later in this book: the Web Services layers allow systems to take advantage of the Internet without having to be designed specifically for networked communications.
24
Enterprise Web Services Security
The protocol for a particular service also defines the semantics (or meaning) of the messages transferred between the client and the server. Most Web Services applications follow a request-response protocol where a client sends a request and the server sends back a response. More complex protocols are also used; for example, where reliable transactions must occur over multiple systems, the protocol is required to implement some form of transaction reliability. This may entail very complex transactional semantics. One advantage of Web Services is that the environment can provide some of these reliability guarantees without adding complexity to the application software. The problem with widely available communications is that the network is very large. The fact that Web Services makes it easier to communicate between clients and servers over the Internet does not eliminate the threats that arise when a system uses the Internet for connectivity. Connecting to the Internet brings a greatly increased level of exposure to potential security breaches in the form of threats and attacks, as described below.
VANDALISM AND SABOTAGE Vandalism and sabotage are both instances where an individual or a group attempts to make unauthorized modifications to a system being attacked. Host penetration, network penetration, and viruses are all forms of vandalism and sabotage attacks under the WS-I scenarios introduced in Chapter 1. These attacks are designed to erode user confidence in the integrity of the systems being attacked. Often these involve modification of the content of a Web server in order to embarrass the owner of the Web site. Some very widely publicized attacks against Web sites include large commercial enterprises and government Web sites. At one point, over 100 Web site defacements were being tracked every day on sites such as the mirror at www.attrition.org. The distinction between vandalism and sabotage is imprecise, but one often speaks of attacks against competitors as being sabotage; most Web site defacements are simple acts of vandalism against weakly protected targets. The threat of vandalism is possibly higher (especially for Web sites) because there are so many more threat agents out on the Internet that deface Web sites just so they can brag about the systems they have successfully attacked. You can sometimes identify who the potential saboteurs are but you can’t identify potential vandals. Vandalism and sabotage usually involve exploitation of weaknesses of the sites being attacked. The weaknesses may appear at the network, system, or component level. These weaknesses may be due to flaws (bugs) in the Web server application or its underlying operating system or due to weak administrative controls. A control is something in a system (a countermeasure of some kind) that attempts to resist
Threats and Attacks
25
attacks. Administrative controls are configuration settings or environmental mechanisms (such as locks) that allow systems to resist attacks. An easily guessed administrative password is an example of a weak control. Unfortunately, systems are frequently penetrated because someone uses a trivial password or the default created by the vendor for the administrative account. Software bugs are frequently exploited during system intrusions. These bugs may be in your Web Services components or in the underlying systems components. Once programs are written to exploit software flaws, it is often trivially easy for an unsophisticated attacker to run the attack against a large number of systems until a system is found that does not have the patch installed that fixes the flaw. These unsophisticated attackers are called script-kiddies because they use a defined set of operations (a script) that allows them to break into a system without having any real understanding of what the script does. Because of this, the people who actually create the original exploits deride them as children. The kiddie is like any other vandal, as it takes no real skill to attack systems because it’s easier to destroy than it is to create, and it’s easier to attack than it is to defend. The ease of use of some attack programs means there are potentially a large number of attackers. Fortunately, some exploits are deliberately broken when released. In these cases, the author of the exploit program changes it so it no longer works properly, hoping to frustrate the kiddies. It takes some knowledge to turn these nonfunctional exploits into something that works. This tends to discourage the more unsophisticated attackers, but not for very long, as eventually someone will release a working exploit script. Again, bragging rights in the community of users that share exploit programs encourages people to share their tools with others, which encourages the faster spread of the exploit tool. There are some distinctions made regarding so-called hackers within the community of researchers that look for vulnerabilities. For example, legitimate companies look for security vulnerabilities and report them to the vendors to be corrected, waiting for a patch to be released before they publicize the flaw. These are often called “white-hat” hackers. On the other hand, so-called “black-hat” hackers look for vulnerabilities and keep their existence secret for as long as they can so they can build an exploit and attack as many systems as possible. The reality, however, is that both white-hat and black-hat hackers still concentrate on breaking into systems and thereby contribute to the maintenance headache that system administrators must bear. Even if administrators try to keep their systems patched, the math works in the attacker’s favor. If, for example, 99.9% of a widely used system are patched and 500,000 of them are deployed, 500 systems are open to attack. The fast spread of network worms (which often are written to exploit unpatched systems) demonstrates that some percentage of systems receive almost no maintenance; otherwise, these worms could not spread because patched systems are not vulnerable.
26
Enterprise Web Services Security
Vandalism is more common than sabotage, as there are more potential attackers, particularly given the widespread availability of automated attack tools. Sabotage is much less frequent, as any organization has a limited number of people who are interested in attacking it. Unfortunately, attackers bent on sabotage may have more resources available to them when mounting their attacks. A system’s defenders must take into account both forms of attacks, including those attacking simply for ego gratification as well as attackers bent on disrupting a company’s ability to do business.
DENIAL OF SERVICE Denial of service (DoS) attacks target the availability of a service. These too can occur at many different levels. It really doesn’t matter to attackers whether they are tying up the network interface to a service, the underlying operating system supporting the service, or the service itself. The result is the same. The service cannot get the resources it needs to support requests from legitimate clients. Web sites are frequent targets of DoS attacks against the site’s Web server that aim to make the site unavailable. DoS attacks can be implemented by several different means. One type of DoS attack exploits a flaw that causes the service or server to crash, making it unable to service user requests. Another form of DoS involves generating service requests to a Web server at such a high rate that the server is unable to respond to legitimate user requests. The standard TCP stack used on several systems can be tied up by handling even a low volume of pending service requests. This allows even an attacker using a low-bandwidth Internet connection to disrupt a site. DoS attacks can also be physical attacks such as disabling power to a site or stealing the servers hosting the site (surprisingly, companies often do not consider this threat when making contingency plans). Most of these attacks use technical means rather than physical attacks. One form of DoS attack is a distributed denial of service (DDoS) attack. In a DDoS, an attacker controls an army of compromised systems spread across the Internet. The attacker uses software installed on user computers that does nothing until it is awakened. The attacker then sends commands to those systems to attack a target. These systems are called “zombies” because the attack software is dormant until “raised from the dead” by the attacker’s command. The zombie machines direct a stream of legitimate-looking requests to the system under attack, keeping it so busy responding to zombie requests that it cannot respond to legitimate user requests. While a single system attempting a DoS attack can be easily blocked at a network level, zombie armies are not so easily blocked, as thousands of hosts may be involved. Often systems are taken over and become zombies through the use of software that is distributed with email-borne network worms or viruses that install zombie controller software unknown to the system’s legitimate owner.
Threats and Attacks
27
Zombies are now being used to flood Internet-based discussion boards and Web logs (blogs) by flooding them with postings of advertisements. Just a few hundred ad-posting spam zombies are enough to completely overwhelm a discussion board with spam [MLabs04]. Tracking down the owners to stop their systems from participating in future attacks is a very time consuming task; consequently, most compromised systems remain undetected and available for future attacks. Zombie masters turn other people’s systems into money-making ventures by gathering armies of systems under their control and selling those resources for use in attacks against their customers’ competitors or as resources to be used in spam floods. As described in [MLabs04], these systems are being sold for the purposes of spamming. Apparently there is a market for zombies; one article describes people selling “armies” of zombied PCs for a reasonable price [Achohido04]. Physical DoS attacks against networks, servers, and mains poweries are far less frequent than network DoS attacks. In many cases these failures are unintended side effects when the thief is just stealing an asset he plans to sell, not trying to bring down the Web site. A large percentage of these attacks are not deliberately targeted against the organization per se: they are attacks against the organization’s assets by theft of those assets.
PRIVACY AND CONFIDENTIALITY BREACHES Another threat against servers involves attempts to bypass protections for information stored on those servers. Covert channels, message archive attacks, and Trojan horses are all attacks under the WS-I scenarios where the objective is to stealthily remove data through a surreptitious channel. These attacks attempt to expose information that the server is expected to protect from such accesses (for example, credit card information, customer-identifying information such as name and address databases, and so forth). These confidentiality breaches may provide information that an attacker can use to place unauthorized credit card orders, mount identity theft attacks, and so forth. Other less damaging (but still significant) attacks include exposure of user email addresses to spammers. Some privacy breaches have been caused by errors in the Web site software allowing users to see data intended for other users. [EPIC97, CNET97]. In one instance, the agency responsible for this security breach was forced to withdraw the site from the Internet after negative publicity made the site unusable. Confidentiality and privacy threats have become more effective as companies move more and more of their operations onto the Web. In some cases, the rush to automate business processes leads to incomplete consideration of the privacy aspects. Also, marketers see value in the information being collected online and want to take advantage of this to improve their targeting of potential customers. So much
28
Enterprise Web Services Security
information is gathered about us online that marketers find valuable (purchasing habits, address details, phone numbers, etc.) that it is becoming an increasingly attractive target. The reach of the Internet makes it easier for the databases containing this information to be combined to discover even more about us. Not only are companies collecting more information, but people are increasingly willing to supply that information. People willingly give up information on themselves for reasons that in hindsight makes little sense. A common example of this is the “warranty registration” cards shipped with many products. People fill these in with little consideration of the value of the information they are disclosing. Some cards ask for the number of people in a household, their ages, family income levels, education levels, and so forth—information that has no bearing on the warranty for the newly purchased toaster. Marketers love to get this information, as it lets them build detailed databases of information on individuals, which is then sold for reasons having nothing to do with the original product. Some companies sell products at a loss simply because it allows them to collect current, accurate address information. Simson Garfinkel’s Database Nation: The Death of Privacy in the 21st Century [Garfinkel00] gives one view of just how far the concern for user privacy extends. Some information must be kept secret from others. Your credit card numbers are an obvious example of this. Another easily understood example is medical information. Allowing this information to be divulged unnecessarily would be a clear case of a privacy breach. Information protection does not exist just to ensure user privacy, however. Confidentiality concerns extend to information that may not be personally identifying. For example, a company may wish to keep the names of its customers secret to avoid competition. Exposure of this information isn’t really a privacy violation, but it does expose information that you expect the system to keep confidential. Businesses have a great deal of information that they consider to be confidential: pricing and cost information, profit levels, and so forth. It is easy to convince a company to protect their confidential data because there are clear benefits. Confidentiality protections can take many different forms. Table 2.1 shows some of these forms. TABLE 2.1 Confidentiality Protection Mechanisms Mechanism
Purpose
System Isolation
Restrict physical and network access to the system hosting confidential data
Transport Data Protection
Protect data in transit over untrusted networks (e.g., the Internet)
Storage Data Protection
Protect saved database records
Threats and Attacks
29
System isolation is a very effective mechanism for protecting information. The sensitive system is isolated (for example, by using a firewall) so that that system cannot be accessed by attackers. The only access permitted to the isolated system is from the service that answers user queries. While this form of protection can be very effective, any temptation to allow even limited connectivity to the system thus protected must be carefully considered, as such connectivity may lead to someone being able to bypass the assumed protections. Information in transit across untrusted networks (such as the Internet) is often protected by the use of encrypted protocols, such as Secure Sockets Layer (SSL) or Transport Layer Security (TLS). SSL and TLS encryption, which will be discussed in Chapter 10, protect the information from disclosure while it is in transit over the Internet. Web Services protocols can take advantage of SSL and TLS by using them to provide easily implemented privacy and integrity protections. SSL and TLS also can provide user authentication using public key infrastructure (PKI) certificates, as will be discussed later. Bulk data encryption may be used for sensitive systems to avoid disclosure of corporate data. One example of this is the use of hard-drive encryption software for laptop computers. This software limits the exposure when a corporate officer’s laptop is lost or stolen.
DATA INTEGRITY VIOLATIONS The integrity of a set of data refers to how well it is protected against unauthorized modifications. In other words, we ensure that the information has not been tampered with by using integrity protections. High-integrity information or data comes from a trustworthy source and is known to be unmodified after it was delivered from the trustworthy source. Key attack is one form of data integrity attack under the WS-I scenarios because if the attacker can steal the encryption key protecting the data, they can mask their changes to the data. Integrity checks are used to validate transactions. A business ensures the integrity of its business records by double-checking calculations. If an accurate starting balance is known, the ending balance can be verified by adding income and subtracting payments. As long as the balance calculated this way agrees with the running balance, the balance is verified. In a Web Services environment, these types of checks often become the responsibility of the Web Service supporting the transaction. For electronic commerce systems, we usually try to protect the transaction information from unauthorized changes rather than simply detect the changes. This is done to minimize the chance that invalid data can spread, corrupting other parts of the business database. However, there are cases where all we can do is to detect and report a tampering incident.
30
Enterprise Web Services Security
Web Services systems are usually concerned with the integrity of user-supplied data; is it the same information that the user or the system generated, or has it been changed at some point? An example of such an attack involves the use of online shopping carts. Some systems use cookies (data items stored by the user’s browser) to maintain order information. This allows an attacker to modify the cookie values to alter prices of items before placing an order, potentially allowing them to buy a product at well below the normal price. Protection of user details should incorporate both confidentiality protections (as discussed earlier in this chapter) as well as integrity protections. The SSL and TLS protocols used for secure Web connections (https: uniform resource identifiers) provide both confidentiality and integrity protection for data transferred over the SSL connection. Integrity attacks can be detected in many ways. Cryptographic checksums, which will be described in Chapter 10, can be stored with data to detect tampering. Alternatively, information can be stored in multiple places and then compared to verify that it is correct. Independent verification checks or multiple verification checks as used in business general ledger systems also provide a degree of integrity protection.
MAN-IN-THE-MIDDLE ATTACKS A man-in-the-middle attack is mounted against a communications path between partners involved in some form of transaction. Figure 2.2 shows how these attacks are performed. Two cooperating parties, Alice and Bob, are attempting to share information of some sort. For the purposes of this discussion, let’s assume that Alice is buying something from Bob’s Web site. Charlie manages to interpose himself between Alice and Bob so that all the messages between them go through him. Charlie is thus able to modify Alice’s order so it is delivered to Charlie’s address, not Alice’s.
Expected Communications Path Alice
Alice
Bob
Charlie Actual Communications Path
FIGURE 2.2 Man-in-the-middle attacks.
Bob
Threats and Attacks
31
Neither Alice nor Bob are able to detect Charlie is intercepting their communications unless they discover that the package was misdirected and delivered to Charlie. Charlie can manipulate the transaction to his benefit in other ways that are less likely to be detected. He can double Bob’s price and tell Alice to pay him rather than Bob. Charlie skims half the money off the top and sends the remainder to Bob. Unless Alice and Bob communicate the price outside Charlie’s control, they’ll never know they’ve been defrauded. Charlie may also attempt to expose confidential information rather than execute a fraudulent transaction. Alice and Bob may never know how their confidential information is being made public unless someone detects and exposes Charlie’s actions. A more serious example of man-in-the-middle attacks is the case of communications between military commanders. If a general sends an order to a major to have troops move to some position, the man-in-the-middle can send that unit to some other location. The enemy then knows where there is a hole in the defenses, making it more likely that they can break through the defensive line. Simply knowing the details of troop deployments without tampering with them is still a serious breach. Using protocols that are designed to resist such attacks mitigates man-in-themiddle attacks. Often this resistance uses cryptographic protocols that involve a secret known only to the parties that wish to communicate. Another way is by use of trusted third parties that can vouch for the identity of someone you wish to communicate with. SSL uses trusted third parties who sign PKI certificates that provide some level of proof of the identity of the site you are connected to or communicating with. Physically secured networks can also be used to limit the chance of a successful man-in-the-middle attack.
SPOOFING ATTACKS Attacks where an entity (a person or a networked computer system) masquerades as someone or something else are called spoofing attacks in the WS-I scenarios. Spoofing attacks are successful when one entity in a transaction trusts another entity. If an attacker knows about the trust, they can exploit it by masquerading as the trusted party. Spoofing over network services is possible because systems rely upon information for authenticating their users. If that authentication information is weakly protected, an attacker can steal a copy and generate traffic that uses the stolen identity information from an authorized user. Some spoofing attacks use replays, where the attacker records a valid transaction and retransmits it (sends it again). Note that this kind of attack is successful even if the transaction details are encrypted since the attacker does not need to understand the message format or
32
Enterprise Web Services Security
contents to be able to retransmit the transaction. A common form of spoofing attacks is to spoof the Internet IP address of another host. It is very easy for a system to generate traffic that appears to come from another IP address. If part of the protections for a network or a service depends upon IP addresses for making security decisions, an attacker can generate traffic that appears to come from a trusted IP address, thus potentially bypassing firewall or application protections. Systems must be designed to recognize that IP address information is of limited reliability. This means some other form of authentication method must be used to identify network systems (hosts). Replay-based spoofing attacks can be mitigated by use of message sequence numbers. In this case, each message has a unique sequence number that is increased for each message sent. The receiver discards any message that is out of sequence, disallowing replays. It is possible for an attacker to simply change the sequence number in a message to make the replayed copy appear to be in correct sequence. Protocols can protect against this by use of signatures or encryption to detect the tampered message. Authentication spoofing attacks may be mitigated by the use of trustworthy identity credentials. IP addresses are not trustworthy and should be replaced with other identity assertions. Examples of these will be described in Chapter 10. The most common form of user authentication is the reusable password. If passwords must be used, it is important that users be educated to use passwords that are difficult to guess and to change their passwords frequently. The use of one-time passwords or tokens should be considered as a replacement for weak passwords, as users historically have been shown to not be willing to use strong password controls. Unfortunately, users resist the introduction of one-time password systems and token systems. Helping users accept their responsibility to help protect their information can assist in the introduction of strong authentication systems. The attacks against LexisNexis where hackers took information on over 310,000 U.S. citizens using stolen passwords is an example of a spoofing attack [Enouf05]. In this case, hackers were able to fraudulently bypass LexisNexis’ security mechanisms to steal addresses and Social Security numbers. These types of attacks can be very difficult to detect because the attacker may, for all intents and purposes, appear as an authorized user.
MOBILE-CODE THREATS Mobile code is software that is delivered from one system on the network and is installed on a target system. Many types of benign mobile code are in use today. Java™ applets and ActiveX® controls used on Web pages are forms of mobile code. Java
Threats and Attacks
33
code can also be downloaded to mobile phones, often in the form of game programs to run on the phone. Web Services add an interesting twist to this issue because mobile code can be downloaded in encoded form (as we will discuss in Chapter 7, Web Services uses something called Base-64 encoding to transform binary data into text). In a simple Web site, the user’s browser displays text and graphics downloaded from a Web server. That Web server is responsible for executing software to generate the content of those pages. In contrast, a mobile code agent is downloaded from the target Web server and installed onto the user’s system. Because this code runs on the target user’s machine, usually with the rights and permissions granted to that user, rather than running on some remote server, the user’s system is not protected from hostile intent on the part of the mobile code author. In other words, anything that user is permitted to do, the mobile code can do. While Java attempts to limit what the applet can do (by use of a restricted environment called a sandbox, which will be discussed in detail in Chapter 8), there have been flaws in those restrictions. If users aren’t careful about what they do, they can unintentionally allow hostile mobile code to install itself on their machines. Such dangerous actions include anything that allows a hostile application to execute. A common example of this is double-clicking on unknown attachments or following Web links to hostile sites. A spyware program that asks the user for permission to install itself is still a spyware application. Several commonly recognized forms of hostile mobile code are: Trojan Horse: A program that appears to perform some useful function that includes some hidden code that performs some unexpected function. Virus: A piece of program code that attaches itself to other programs and propagates with the file it is attached to. Worm: A program that propagates by copying itself across a network. Spyware: A form of Trojan horse that allows an attacker to control what Web sites users see. It may also gather information on user habits and report them to its controller Zombie: A system infected with a control program that an attacker can later use in DoS and other attacks. While viruses and worms are still frequently seen, spyware is quickly becoming the most frequent cause of user disruption that uses mobile code. Spyware tries to hide its presence so it will not be deleted from the user’s machine while attempting to control the user’s system. Badly written spyware is frequently a cause of system instability. One particularly hostile form of spyware is the zombies that are being used by spammers to bypass spam blocking by allowing the spammers use of tens of thousands of compromised systems spread all around the world.
34
Enterprise Web Services Security
Mitigation of mobile code attacks relies on several precautions. Some of those are precautions are: Educating users to not run software from untrusted sources Maintaining system patches to avoid worm propagation Running anitvirus products and keep them up to date Running spyware detection programs Unfortunately, the user is the weakest link in this chain. Almost all spyware is installed because a user goes to a Web site that installs the program on his machine, often after asking the user for permission. Of course, mobile code is not always hostile. However, a system that is designed to use mobile code must be prepared to accept user resistance because of the reputation that Java and ActiveX have gained.
FRAUD Fraud occurs when an individual makes a false or exaggerated statement or claim with the expectation of financial gain. The definition of fraud requires that it be perpetrated with the intent to deceive someone into giving up something, specifically something of value or some right that they hold. This means a simple deception that does not cause a loss does not rise to the level of fraud, as fraud requires that the deception cause harm to another. The LexisNexis example cited earlier is an example of fraud. While at the time of this writing, LexisNexis had not found cases where the stolen information was being used to commit fraud, the perpetrators had certainly cost LexisNexis the expense of contacting all of its potentially affected customers [Enouf05]. Many different types of fraud exist, including online and offline fraud. Confidence schemes are a common source of fraud, particularly online. In a confidence scheme, the perpetrator (called a confidence man (con man for short) tries to defraud a victim by using a scheme that convinces the victim that he will profit if he goes along with the con man. Many of us have seen a common example of these: the so-called 419 scam mails and emails offering the victim a percentage of a very large sum (commonly over 10 million dollars) in return for assistance with getting the money out of the country where it’s being held, usually Nigeria. (The “419” terminology derives from the section number of the Nigerian code violated by these con men). The user becomes a willing coconspirator in the attempt to smuggle the money into the U.S.; because he is a conspirator, he is less likely to involve the authorities when things start to go badly, as they always do. The victim in these cases
Threats and Attacks
35
is convinced to pay “fees” to help move the money out of the country. Of course, the money never existed, and the victim loses all his “investment.” In some cases, the thieves have managed to empty the bank accounts of their victims; companies and even prominent political figures have been suckered into participating into these advance-fee scams. Lottery scams are another form of confidence scheme where the victims receives emails announcing that they have large winnings in a lottery they’ve never entered; all they need do is pay some fees to get their winnings. Even if only a small percentage of the potential victims respond to these solicitations, the con men win, as their investment (the cost to send a large number of email messages) is close to zero. Unfortunately, online fraud appears easier than in-person fraud. Perhaps this is because it’s easier to mislead people when you aren’t seeing them face to face. Perhaps it’s because most people don’t understand computers very well and consequently trust things they see online more than they would under other circumstances. This willing suspension of disbelief leaves many people in a state where they can be taken advantage of by what are very simple and obvious attacks (or at least obvious to those who know about them). In any case, victims continue to be taken in by simple means. System owners, Internet service providers, and educators must work to sensitize users to be wary of these threats.
SPECIAL CONSIDERATIONS FOR WEB SERVICES ENVIRONMENTS As we have discussed, many of the threats described in this chapter have significance in the Web Services environment. Some of these are quite similar to threats outside the Web Services environment, but some of the threats take somewhat different forms. Vandalism and sabotage attacks against Web Services sites result in changes to the site content. This can lead to modifications or deletions of files that are critical to proper service operation. However, this form of attack is not all that common within a Web Services context because the goal of a Web site defacement attack is to publicly deface the site. Breaking a Web service by deleting or modifying files used by the service does not provide a public demonstration of the break-in. DoS attacks against a server hosting a Web service are also possible. Like vandalism, it is likely that the primary target is not the Web service itself. The service just happens to be hosted on a system that also hosts a Web site that is under attack. DoS attacks against Web Services can be mitigated by replicating the service across several geographically and logically distributed systems. Colocation arrangements with your service provider should contain contract language obligating your Internet service provider to react to and attempt to recover from DoS attacks. Often
36
Enterprise Web Services Security
service level agreements (SLAs) are used to express user expectations of how ISPs will react to DoS attacks, including physical attacks. Privacy and confidentiality breaches are mitigated by proper site design. Information processed by the Web service must be properly isolated so that attackers cannot breach user confidentiality. This requires that the developer of the Web service function understand the sensitivity of the information the service is processing so that appropriate controls can be put in place. Service information must be protected while stored on the server and while in transit in order to protect user privacy. Integrity attacks against a Web service system will attempt to corrupt data managed by the service. Just like other forms of network service, a Web service is subject to attacks from users who fabricate user input hoping to exploit weaknesses in the service. Attention must be paid to buffer overflow attacks, input data format attacks, and so forth when a Web service is designed. Buffer overflows occur when an input string is delivered to a program that is larger than the program is designed to accept. These attacks can be used to manipulate the program stack, allowing the attacker to manipulate the program flow to allow them to take over a system by introducing hostile code in the buffer. Format attacks manipulate the C language string formatting services to allow an attacker to overwrite application data, again for the purpose of executing operations dictated by the attacker. Service interfaces may work properly when presented with proper input data but fail if input is manipulated. Unfortunately, security is not often considered in the design of service endpoints, and testing is superficial at best. If the service works properly when used with correct input, it is not likely that anyone is responsible for testing the service in the face of a hostile user. Developers must be educated to treat all user input as tainted and to verify that the format is as expected. Web Services designers must also consider man-in-the-middle attacks. Protocols must be designed to be skeptical about the credentials presented to them because it is possible for an attacker to redirect client requests so they pass through a system that they control. For example, domain name service (DNS) poisoning attacks can be used to redirect connections to a server controlled by the attacker. One must also consider a hostile insider such as a system administrator who controls the internal DNS servers. Insiders can redirect user requests (even to outside servers) to systems they control. While these are currently rare, combating these attacks requires that the client and server implement measures to detect the man-inthe-middle and other attacks so that only trustworthy or verified clients are permitted to connect. Clients must also be skeptical about the server’s identity until it is proven by some reliable means. Cryptographic techniques such as the use of public key authentication can be used to ensure that the connection between the client and server is a direct connection with no interloper.
Threats and Attacks
37
Spoofing in a Web Services context can occur in at least two forms: forged IP addresses and forged user credentials. IP forgery attacks against a Web service are effective against a service that uses IP addresses as part of an access control decision. IP addresses are easily forged; it does not make sense to build an access control system that makes decisions based on unreliable information. Replacing IP address authentication with other forms of authorization such as PKI certificates (described in Chapter 9) is strongly recommended. Spoofing using forgery of user credentials is another potential problem. Credential spoofing may be the result of weak authentication (for example, easily guessed passwords) or simply replay attacks. Service designers must take into account the possibility of authentication brute-force attacks (try every password until one works), sniffing of user passwords (listening over the network for user logins and capturing the passwords), and replay of user login sessions (capturing the login traffic and playing it back to fake a legitimate login). Often we find complex systems with only user-selected passwords being used to protect high-value transactions. Unfortunately, a Web Services system may not be able to dictate how users are identified because the system has to work with the existing means of authenticating clients, and those are frequently very weak, password-based systems. Mobile code threats to Web Services systems usually occur when hostile code compromises a user system. Spyware, keystroke loggers, and other hostile code can be used to record user account access for later analysis and replay. A keystroke logger may be the worst case, as it can be used to capture user login sessions. Since users only change their passwords when they are forced to change them, this allows the attacker a potentially very long window of opportunity to attack the system using the captured passwords. Unfortunately, it is difficult for a Web Services client to detect that the client system it is running on is compromised. Antivirus systems provide some level of protection against hostile mobile code, but these are after-the-fact methods of detection. They only detect malicious mobile code (malware) that the antivirus developers know about, meaning there is always a window between first release of malware and detection of that malware. This is why several damaging Internet worms (such as Slammer) were so successful in spreading. Many instances of spyware are not detected by common virus scanning products. Users think they are protected but often find that they are not when they use a spyware scanner to evaluate their system. One serious problem is the end-user license agreements that ship with some software that is widely considered to be spyware. For example, Gator’s license agreement has been analyzed to look for reasons why users are frequently induced into installing the products that bundle Gator. (One example of software that may come bundled with Gator is the Kazaa peer-to-peer file-sharing system.) Users clearly do not read the license agreements, as evidenced by the details. The
38
Enterprise Web Services Security
Kazaa license agreement that bundles Gator spans 63 pages of legalese, including an agreement by the user that he will not use automated means (such as spyware removal tools) for removing Gator [Edelman04]. From Gator’s point of view, this is quite reasonable because the user is given access to the software they want (Kazaa) as long as they agree to allow Gator to function; disabling the adware is a violation of the terms they agree to when they install Kazaa. (Of course, how many people really read all 63 pages of terms?) Also, Gator is actually only adware; that is, it delivers advertisements to the user that they agree to receive in return for running the software that’s bundled with Kazaa. There are other far less honest adware installers that do not tell their users what they’re really agreeing to. Of particular concern for Web Services client software is the case of Trojan horse programs that carry a hostile payload that records user sessions and transmits the user session to a central host. User education may be the most effective solution for malware attacks, but the spread of worms, viruses, and zombies seen today demonstrates that users are still easily duped. A Web service must be aware of the potential for attempts at fraud. Many of the possible reasons have been given above, but there are other considerations as well. Any time something of value is transferred or otherwise exposed to the Internet, there’s a chance that someone will try to exploit the system for benefit. Defense against these attacks requires attention to policy, education, and technology.
SUMMARY In this chapter we have discussed information security threats and the associated attacks in the context of Web servers, but they can be generalized to any network server or network service. We started by defining what we mean when we say that a system is “secure.” We mean it is reliable and does just what we want it to do. We also defined threats and vulnerabilities, threats being a set of circumstances that may lead to damage, loss, or harm and vulnerabilities being a characteristic of or a weakness in a system that makes it subject to loss when an attack is mounted. We defined an attack as a circumstance where a threat agent decides to attempt to damage a system or its users and acts on that decision. A countermeasure is a control put into place to protect vulnerable components from attacks. We discussed in detail some of the more prevalent attacks on the Internet including vandalism and sabotage, denial-of-service, privacy and confidentiality breaches, integrity violations, man-in-the-middle attacks, spoofing, mobile code threats, and fraud. We also briefly discussed how these threats impact the Web Services environment.
Threats and Attacks
39
REFERENCES [Achohido04] Achohido, B. and J. Swartz, “Going Price for Network of Zombie PCs: $2000-$3000.” USA Today, December 5, 2004. [CNET97] C|Net Tech News, “Social Security Site Closed.” Available online at http://news.com.com/2100-1017-278711.html?legacy=cnet. [Edelman04] Edelman, B., “Gator’s EULA Gone Bad.” Available online at http:// www.benedelman.org/news/112904-1.html. [Enouf05] Enouf, Thad, “Lexis Nexis Adds to Number of People Affected by Hacking Breach.” Dirty Tricks, April 12, 2005. Available online at http:// dirtytrix.blogspot.com/2005/04/lexis-nexus-adds-to-number-of-people.html. [EPIC97] The Electronic Privacy Information Center, “The Social Security Agency and Online Privacy.” Available online at http://www.epic.org/privacy/ databases/ssa/. [Garfinkel00] Garfinkel, Simson, Database Nation: The Death of Privacy in the 21st Century. O’Reilly and Associates, 2000. [MLabs04] Message Labs, “Monthly Report: October 2004: The Rise of the Zombie Botnets.” Available online at http://www.messagelabs.com/emailthreats/ intelligence/reports/monthlies/October04/. [Moore65] Moore, Gordon, “Cramming More Components Onto Integrated Circuits.” Electronics, April 19, 1965. Available online at http://www.intel. com/research/silicon/mooreslaw.htm.
This page intentionally left blank
3
Security Goals
In This Chapter Protecting Your Assets Common Security Terms Classic Security Goals Transaction Security Goals The Role of Security Policy in Web Services Security Enforcement Summary References
n information security program is created to meet a set of goals. Many of these goals are to protect against some of the specific threats and types of attacks we discussed in the previous chapter. While some of these goals may be nearly universal, others may not be so obvious. Achieving these goals also comes at a cost. Some of the costs are real (the costs of implementing or supporting various security mechanisms, for example), and some come in the form of opportunity costs—users who cannot be supported or the customers who cannot be reached. An enterprise has to weigh these costs in terms of the risks it is willing to take, the risks themselves representing a potential cost of loss, to develop a coherent security policy. Without such a policy, an enterprise may find itself gold-plating in one area while leaving the door standing wide open in another. In this chapter we will provide a rationale for having a strong security program and well-documented security policy by pointing out the important business elements that help justify those
A
41
42
Enterprise Web Services Security
security goals. We will look at threats, vulnerabilities, countermeasures, and risks in a broad context that will set the stage for the detailed policy implementation discussion in Chapter 6.
PROTECTING YOUR ASSETS The primary goal of a security program is to protect your assets, which are the things that you value or consider to be important to your business. Assets include your computers, networks, buildings, and employees. Assets don’t need to be tangible objects; trade secrets that allow you to build a unique product are also important (for example, you can be sure that Coca-Cola considers the formula they use to make Coke® to be an asset). The Web Services an organization offers may be among its most important intangible assets. They may represent key components of its business process or act as a gateway to extremely important or valuable business information or capabilities. While it concentrates on the assets you own, your security policy should also consider protections for the assets owned by your customers or business partners that may come into your possession. If you share data with customers, you do not want that data sharing to be the cause of an attack against their systems. That primary goal of providing protection for identified assets is just a part of the justification for a good security policy. Other goals include business continuity, privacy protection, and accountability for the company’s operations. While these are of course admirable goals, there are good, practical reasons for having a strong security policy above and beyond those goals. For example, to write down your security policy, you must think about the assets that are under your control and how those assets may be taken from you. You must also consider the protections you can put in place to keep those assets from being lost. The analysis necessary to help you decide what assets are important enough to protect is the first step toward improving the security of your enterprise. Exercise of due diligence requires you to understand what threats and vulnerabilities affect you and what countermeasures you can use to avoid security breaches. Another practical reason for having a strong security policy is that it helps you to judge the costs associated with protecting your assets, making it easier to justify the security budget. The following sections of this chapter list the steps you should take to define your security policy.
COMMON SECURITY TERMS Several terms are commonly used within the security community to help clarify the goals of a security policy. While these have meanings that are consistent with the
Security Goals
43
common use of the terms, the information security usage of these terms is somewhat more precise. This precision helps us understand the rationale for steps that are taken in implementation of a security policy. We will also show the relationship between threats, vulnerabilities, countermeasures, and risks. Reducing Vulnerabilities Vulnerabilities are weaknesses in a system that can be exploited, leading to loss or damage. As we discussed in the previous chapter, while they cannot be totally eliminated, they can certainly be reduced. The designers of a system are responsible for avoiding known attack methods when building their system. They should consider common causes of vulnerabilities such as: Buffer Overflows: The application is sent more data than the program allocated for an input value, leading to call stack corruption and exploited code execution. Heap Corruption: Similar to buffer overflows, these are attacks against memory that are not stack based. Replay Attacks: The attacker stores a transaction or a response and reuses it later. Integrity Violations: A system is attacked by tampering with the data being processed, leading to invalid results. Privacy Violations: Attackers obtain access to information they should not be able to view—for example, access to a user’s salary. This is not an exhaustive list. New attack methodologies are occasionally found, meaning that an application that currently appears to be secure may be successfully attacked in the future when new attacks are found or even when libraries that the application uses are found to be subject to some exploitable bug. Unfortunately, software developers often fail to consider well-known flaws when building systems, resulting in the same errors appearing in new software systems. Since imperfect humans build the systems using components that they may not fully control, it is very difficult to build a system that has no vulnerabilities. That lack of control is an unfortunate side effect of the object- and component-oriented design methodologies used today. The developers of a product are encouraged to use components that they may not completely understand or that may not be well designed or tested. Even in the absence of untrusted components there is still a problem because most applications rely upon an operating system (Windows, UNIX, Linux, etc.) that may have flaws that expose even the most carefully designed application.
44
Enterprise Web Services Security
As explained in Chapter 2, a “secure” system is one that does what it is expected to and nothing more. Side effects, random behavior, and crashes are clearly all violations of the security expectation. When we try to secure a system, we attempt to control the number of vulnerabilities in the system. Proper design discipline, code reviews, and simplicity of design all contribute to improving the vulnerability posture of a system. Unfortunately, some software developers are openly hostile toward any attempts to better organize the development process. Code reviews are an effective means of finding bugs before software is complete, but developers treat them as being too critical of their development style or code quality. The hostility toward such techniques reflects upon how they are used by management; rather than use them to encourage improved software quality, they are used to try to measure programmer performance. It’s only natural for a developer to resist methodologies when they’re used to make disciplinary decisions. The techniques necessary for making high-quality software with a low number of bugs are well known (processes such as extreme programming, white box design, process improvement methodologies, formal methods, and continuous testing), but software continues to be developed as an art rather than as a science. We will always have bugs because nothing is perfect, but there are many real improvements available if companies had the will to force better development discipline (assuming that they’re even aware of the results of the research in process improvement). Fixing a bug during development costs less than fixing it in the field after the product ships; worse, maintenance of a program to fix one bug often introduces a new bug. This is apparent from simply performing a web search for “new bug introduced with bug fix.” At the time of writing this, there are over one million results for this simple search. Classic information assurance practice is meant to avoid vulnerabilities by minimizing the amount of software that enforces security policy. High-assurance systems are built with a small, self-contained kernel that enforces security policy. This kernel, called the trusted computing base (TCB), is small enough to be analyzed methodologically to search for flaws. For high-assurance systems, this TCB is formally verified to prove that it works correctly and cannot be bypassed. This verification process is time consuming, but it provides a great deal of confidence in the correctness of the software. Having to perform a high-assurance analysis of a large, complex program would be cost prohibitive because of the complexity of the resulting analysis. Keeping software small and self-contained makes it easier to analyze for flaws because more complexity means there are more paths to verify for correctness. Each additional pathway multiplies the complexity of the system being designed, increasing the chance that the system will have an undetected flaw. It is easier to prove that a simple system that does only the essential tasks and nothing more is trustworthy.
Security Goals
45
This desire to simplify the system to improve security leads to a conflict between security and functionality because adding capability makes the system more complex, making it more difficult to analyze and secure. Unfortunately, security usually loses the battle against marketing’s desire to add features to products. Some customers (primarily national defense organizations) require products to be evaluated to prove that their design is correct, that the development process helps avoid flaws, and that the vendor has a reasonable flaw mediation process. These products are evaluated using the Common Criteria Evaluation and Validation Scheme (the Common Criteria) [NIAP04], a joint activity between the National Institute of Standards and Technologies (NIST) and the National Security Agency (NSA) (niap.nist.gov/cc-scheme/). Products evaluated under the Common Criteria scheme are verified for functionality and development quality. Purchases by members of the U.S. Department of Defense (DoD) are required to consider Common Criteria validated products in preference to those that have not been validated. This is a laudable practice. We hope this means that the quality of security-enforcing products will improve for all users, not just the defense agencies. Unfortunately, there are many products not purchased by the DoD that do not meet the evaluation criteria. The older Orange Book (DOD’s 5200.28 Standard for Trusted Computer System Evaluation) defined seven levels of operating systems security, D1-A1, as shown in Table 3.1, based on specific characteristics built into the operating system. The Common Criteria also defines a seven-level rating system (also shown in Table 3.1) for operating systems and other computer and network components that is based on evaluations of component functionality and security features. Most commercial systems you will encounter are at the C2 or EAL 3 level at best. Up to this point, we have concentrated on vulnerabilities in the software components of the system. It should also be mentioned that vulnerabilities might exist outside of the software being used. All of the components of the system such as the hardware, the software, and the data itself are subject to some forms of attack. Even if the software is 100% reliable and effective, it cannot enforce the security policy if an attacker can simply bypass it by taking another path through or around the system. Vulnerabilities can exist in many ways in the hardware components of a system. For example, hardware (such as networking components) can be overloaded in denial of service attacks. Network worms have also demonstrated the ability to bring down networks based on overloads. One example of this was the SQL Slammer worm. This worm was small (376 bytes of payload) and it spread very quickly (55 million systems per second were being probed at its peak.) [CAIDA03]. Slammer spread so quickly and infected such a large percentage of the potentially infection-prone systems that it overloaded much of the Internet, leading to widespread failures such as the failure of a major bank’s ATM system.
46
Enterprise Web Services Security
TABLE 3.1 Security Assurance Levels Orange Book
Meaning
Common Criteria
Meaning
D1
Untrusted
EAL 1
Product is functional
C1
Directory and file controls, authentication through login, root considered unsecured
EAL 2
Security mechanisms moderately checked
C2
Auditing plus additional security
EAL 3
Checking is more strict, but no reengineering
B1
Support for multilevel security and mandatory access control
EAL 4
Vendor is willing to fix problems in the development process
B2
Supports object level labeling
EAL 5
Very strict process
B3
Extends protections into hardware
EAL 6
System development is based on security
A1
Uses a mathematically verified design
EAL 7
Limited to very specific systems with very specific security requirements
Hardware may have other vulnerabilities beyond overload attacks. The system may have design weaknesses that can be exploited. For example, the Intel x86 architecture allows code to execute on the procedure call stack, allowing easy buffer overflows. Recent versions of the x86 correct this flaw. Some hardware bugs have allowed attack software to cause the system to lock up, requiring the system to be reset before it can be used. One case of this was the Intel Pentium® “f00f” bug (named for the hex encoding of an illegal instruction sequence). Encoding a particular sequence of bits in the instruction stream allows an unprivileged user to lock the system up; luckily, workarounds are available for most operating systems [Collins97]. Another vulnerable system component is the data stored on or processed by the system. Data can be attacked by modifying it, by intercepting it during transmission, by replay attacks, or by attempting to generate fraudulent copies of legitimate transaction data. Modification attacks seek to change the agreement between the transaction parties. For example, an attacker can change the “ship-to” address in an
Security Goals
47
order to his address so he receives the product rather than the person paying for it. Interception attacks expose data to unauthorized parties and may lead to privacy loss. Another problem with interception attacks is that passwords may be intercepted and later used to spoof a legitimate user’s identity. Replay attacks are used to retransmit a request; these may be used to flood a system with duplicate copies of a single legitimate order or cause a payee to be credited multiple times for a single product delivery. Replays may also be used to take advantage of intercepted authentication information. Once private data is exposed in some way, it may be used to perpetrate a fraudulent transaction. Another class of vulnerabilities is those caused by attacks against the environment. Power interruptions are one source of such problems. Fire, water, and weather-related damage (floods, thunderstorms, hurricanes, and blizzards) are also possible. Physical protection of the system components must also be considered because access to the console on most computers allows an attacker nearly unlimited access. For example, the attacker can reboot the system using an operating system CD that he brings with him, using that operating system to make copies of the system data. The legitimate users will not be aware of the exposure, as all they see is some amount of system down time; choosing the time for the attack allows it to be undetected. More extreme (or at least more unusual) physical attacks against computer systems include those by angry employees bent on destroying systems. Theft of critical systems is another problem that must be considered. Your organization should have a complete continuity-of-operations plan that defines all the systems that play critical roles in the operations of your organization. One source of guidance for forming such a plan is the U.S. Department of Homeland Security site at http://www.ready.gov/business/st1-planning.html. Each of the critical systems should have backups in place such as systems at other physical locations that can be placed into service to continue normal business operations. The effort necessary to write a complete plan is helpful in building your security policy as well. Realistically Assessing Threats As defined in Chapter 2, a threat is the possibility of a set of circumstances that may lead to damage, loss, or harm to a system or its users. Threats define the potential for loss or damage. All threats are not equal, nor are they equally probable. A threat potential captures the possibility that the threat may never be realized. If nobody tries to implement the threat, no loss occurs. In this case, the threat potential is zero. If a vulnerability exists to a widely available exploit method that is known to an attacker, the threat potential is very high. The security policy must consider all of the attack agents and what means they may use to attack the system. Each of the threats that those attackers pose should be covered in some way by security policy.
48
Enterprise Web Services Security
Ideally, a complete security policy would identify all the existing threats to the system. Of course, identifying all threats is difficult since new threats arise all the time from new attackers, not to mention any threats you are unaware of. Another reason you cannot identify all threats is because new vulnerabilities are found each day. All you can hope to do is find as many of the threats as possible while remaining vigilant for new threats so you can adapt your policy to accommodate them when they become known. An example of a system that tries to express threat levels is the U.S. Department of Homeland Security’s color-coded threat level scale. In general, several things determine what the threat level is for a given system. The threat level depends on several factors: The value of the resource being protected The expertise of the attacker The length of time the attacker has to probe before they are detected How well equipped the attacker is Whether an exploit is widely available or not Higher value resources are more likely to be attacked than those with low value. This depends on the attacker’s perception of the value of the asset, of course. Attackers will pose a higher level of threat when they see more benefit to them from attacking a particular asset. If your threats are primarily from competitors, you have an easier job identifying and protecting high-value assets: anything that gives away competitive advantage needs to be protected. This could include pricing information, supplier contract details, internal cost information, labor agreements, and so forth. However, “value” may be more subjective depending on how high profile your site is. Some people will attack a Web site (or any other type of service node) purely to enhance their reputations as hackers, attacking well-known Web sites simply so they can brag about the attacks. This is why several denial of service attacks were mounted against sites like eBay: primarily so the attackers can brag about making the newspapers. Threats based on the visibility or reputation of a Web site cannot be easily controlled. The system owner’s idea of value must also be considered because it is easier to justify protection for a system that is a critical part of your business processes. Just as assets have a range of values, attackers have a range of expertise. Some crackers have a great deal of experience in finding system flaws and in finding ways to exploit those flaws. Knowledgeable attackers who understand the internal details of the systems they attack are the worst case because they know how the systems will react to input and may be able to devise ways to exploit any vulnerabilities that exist. The more internal information the attackers have, the higher the threat they
Security Goals
49
pose because they are more likely to be able to pinpoint flaws in the system when they are familiar with the internal details. Highly experienced attackers find most system vulnerabilities because random searches or probes may find known problems, but new vulnerabilities are usually found by people who understand how to methodologically probe systems for vulnerabilities. Of course, random probes can still be effective. The Sapphire worm mentioned earlier was very successful in locating vulnerable systems, spreading quickly to a large percentage of the population using a simple random probe. However, that probe used a known flaw to spread; once this flaw was patched, the spread rate decreased quickly. Experienced system crackers start without a known flaw and probe the system until a flaw is uncovered. Once they find a problem, it’s characterized in the attacker community as a “zero-day” attack since the exploit is known to an attacker but no defense is known. Zero-day attacks are valued by the attacker community because discovery of a new, previously unknown problem is the way crackers enhance their reputation. Once their attack is leaked to the public, it is usually shared by unsophisticated attackers (“script kiddies”). While there are many more unsophisticated attackers, their effectiveness is limited once the vulnerability is made public. Usually a patch is issued to close the original vulnerability, limiting the kiddies to attacking systems that remain unpatched. Unfortunately, very often, once systems are set up and running they have very little subsequent administrative attention, leaving victims for the kiddies. As this was written, systems were still on the Internet that were infected with the Sapphire worm, still trying to spread the worm to systems that had been patched for nearly five years. Even if a system administrator does maintain systems up-to-date with patches, there is some exposure if they allow a newly installed system to be exposed to the Internet before it is patched. Recent measurements of the time it takes for an unpatched Windows 2000 system to be infected if connected to the Internet average around 20 minutes (or less), which is not nearly enough time to get the critical patches installed [ZDNet04]. Attackers range in expertise from unsophisticated attackers with limited knowledge of the systems they are attacking, to hackers who have a great deal of experience in locating flaws, to high-profile computer criminals who have unlimited resources available to them. Clearly, the unsophisticated attackers cannot develop new exploits, but they can have high impact on a system because there are so many of them. Few highly trained attackers exist, but there are a limited number of systems with sufficient value to be able to attract their attention. Another variable in determining threat level is the length of time it takes for the attack to be noticed. Attacks may be more profitable if they are undetected because allowing attackers more time may improve their chances of successfully breaching the system. One of the simple examples of this is a brute-force password attack. If you allow an attacker to guess the password for an account an unlimited number of
50
Enterprise Web Services Security
times, eventually a weak password will be detected and exploited. Lack of vigilance provides attackers with an avenue they can use to exploit widely publicized flaws. Allowing attackers a long time to use an exploited system also means they can use that system to attack others, decreasing the chances that they will be caught. Any attention that they gather will be directed toward your machines. You will eventually know that something is going wrong when one of their other victims accuses your company of mounting an attack. One measure of the level of the threat is the impact the threat poses. Impact is a way to measure the potential loss from an attack. We consider attacks against higher value assets to have higher impact than attacks against lower valued ones. Another way to look at impact is that it is a judgment about how effective an attacker is. A high-impact attack will do a nearly complete job of disabling a company’s ability to do business. A low-impact attack will have very little effect. One of the purposes of asset analysis is to determine where your critical resources are located, as attacks against those are likely to have high-impact. Clearly, it is easier to justify spending resources to protect against high-impact attacks. However, you should not concentrate on only the high-impact threats, as even small threats can be significant if attackers are persistent. Eventually they will be able to inflict enough cumulative damage to have a significant combined impact. Another way to determine the impact of an attack is what kind of resources, such as system tools, the threat agent possesses. Attackers with specialized tools will pose a higher threat. A simple example of this is an attacker with safecracking tools; that attacker will pose a higher threat than someone who is reduced to trying every possible combination. Tools in this context include debugging software, testing tools, and so forth. The developers don’t expect these tools to be distributed outside their development shop and be used against the product they are building. One must plan for the possibility that such tools may fall into the hands of an attacker with enough motivation. Threats at this level are considered reasonable for systems protecting secret or top secret information. The Common Criteria threat evaluation allows for attackers who are able to build their own tools if necessary for very high-assurance products. The rationale for this is that the attacker may have access to nearly unlimited financial resources when attacking an enemy system. Exploit availability is another way in which threat level varies. An undiscovered vulnerability has a negligible threat until it is discovered. Once the latent flaw is found and an exploit program is written, the threat is then dependent on how well the discoverers protects their knowledge of the exploit. Experience has shown that most exploits eventually become public as their developers spread them around because eventually someone receives a copy and releases it to the public. If a widely available exploit exists for a particular vulnerability, the threat level is very high. An example of this is the Microsoft SQL Server bug exploited by the Slammer/Sapphire
Security Goals
51
worm. The vulnerability was known for some time before the worm was released; before the worm, the bug was largely academic, but after release, those operating vulnerable systems were threatened, compelling them to patch immediately to close the hole. Widely available exploit programs dramatically increase the threat level, as it is easy to mount the attack with just a copy of the exploit program. Choosing the Right Countermeasures The discussion above may lead readers to despair. There are a virtually unlimited number of vulnerabilities and widely available exploits; there are crackers armed with automated exploits, and there is no hope. It’s not as bad as it first appears, because while there may appear to be an unlimited number of vulnerabilities that attackers can exploit, you are not required to sit still and accept the attacks. The defense side of the vulnerability equation is the ability to implement countermeasures. A countermeasure is a defensive action that a system defender can take to reduce or eliminate the effectiveness of an attack. The concept is easily understood, as there are analogies outside the world of information security. If the threat is a car collision, you install seat belts as a countermeasure to help eliminate injury during the accident. From the information security perspective, you take similar action. If the threat is against your database server, where an attacker is trying to read unauthorized data, you install a firewall to limit access to the database server so only users authorized by the Web server can read that information. Countermeasures can take many forms. Some countermeasures are technical controls, such as features added to a system to help it resist attacks. Others may be environmental controls such as physical protection of a system to help protect it from theft. Technical countermeasures may be easier to associate with information security concerns, but physical countermeasures are still very important. Some examples of physical security countermeasures are guards and access control systems such as badges, guard dogs, and keyed locks. Countermeasures can reduce the impact of an attack. To some extent, this can be treated as a reduction in the level of impact. However, you should remember that a countermeasure must be reliable if it is going to be expected to eliminate a threat. If the attacker is able to bypass the countermeasure, the threat still exists and may be exploited. Indeed, a countermeasure may lead you to not consider other protections for a vulnerable system. If the countermeasure ever fails, all the original vulnerabilities are exposed and may be exploited. Unfortunately, common cases like this exist where organizations rely upon firewalls to protect their networks. Because the countermeasure is in place, the administrators do not work to keep internal systems patched. If an employee brings a worm- or virus-infected system into the company, the worm is then unleashed inside the firewall, bypassing it
52
Enterprise Web Services Security
entirely. All too often companies build such systems with single levels of countermeasures that leave them entirely exposed if the countermeasure fails. A countermeasure should be designed to fail “closed” (that is, deny all traffic when the system fails); unfortunately, some systems do not implement this and fail in a permissive manner, allowing all traffic to flow unprotected when something fails. Recognizing and Accepting Residual Risk Some threats have no effective countermeasures. For example, if your threat agent has access to nuclear weapons, you cannot protect your data center from attack for any reasonable price. While this is an extreme example, there are other much more common instances where the countermeasure cost is so high that it is not reasonable to use. Another problem with countermeasures is that they may make the service you are trying to protect too costly. For example, you could have a Web site that allows customers to look up their bank balance. Such a system suffers from the threat of an attacker guessing a user’s password and being able to access their account information. One countermeasure for this attack is to strengthen the user verification by distributing one-time password tokens to all users. However, the cost to do this, given the low frequency of successful attacks, means the countermeasure is not cost effective. In such cases, the owner of the system can choose to accept the risk involved and not spend the money necessary to defend against the specified threat. A residual risk is a threat that the system owners decide they are willing to accept. Some threat exists, but the cost to defend against that threat is more than they are willing to bear. Put another way, they accept the risk as one of the costs of doing business; insurance may be used to help control the cost of that accepted risk. The formal definition of risk incorporates all of the security factors given earlier in this chapter. One formulation for combining the threat, vulnerability, countermeasures, and impact was proposed by Ira Winkler [Winkler97]. A lot of information is expressed in Winkler’s threat-level equation. Increasing the threat or vulnerability quantity increases the threat level; better countermeasures decrease it. Impact multiplies threat because each increment in system value increases threat level significantly. It seems from this equation that the goal of the security policy is a complete set of countermeasures to eliminate the threat. However, as we shall see, that cannot be done because of cost. All the other terms in the equation are aspects of the system or the environment that the owner of the system cannot control. For each of the factors, several influences may change how high the factor is rated. Table 3.2 gives examples of ways in which the measurement of the threat may be influenced. Identifying the influence factors helps concentrate attention on the items or individuals that can most directly reduce the threat level.
Security Goals
53
TABLE 3.2 Threat Level Equation Factors Factor
Influenced by
Threat
The number and expertise of the attackers
Vulnerability
The designer of the software used to build the system
Impact
The value of the system
Countermeasures
The system owner’s commitment to protect the system
In other words, you cannot influence the magnitude of the threat because you have no control over the existence of hackers. Also, you cannot change the number of vulnerabilities without replacing the product. You cannot lower the impact without devaluing your system and processes. All you can control is the number and type of countermeasures you install. This is the basis of risk assessment: deciding what threat levels are acceptable and what risks the owner is willing to accept given the cost to counteract those threats. The goal of a risk assessment is not to minimize or to eliminate risk. If you are trying to eliminate all risk during an assessment, your countermeasures will become prohibitively expensive. You cannot protect a system from an attacker who has millions of dollars to spend on an attack (which may be a reasonable threat magnitude for a system like Fort Knox) unless you can afford to spend even more on a defending your system. Spending the money necessary to protect a system against all possible threats is not likely to be acceptable to business managers. Similarly, attempting to minimize risk (by making it as small as possible) will usually run into a cost barrier. An organization must accept certain levels of risk. For example, you might have a backup “hot site” to which you can transfer your business operations if your main site is attacked. What about an attack against both your main site and your backup site? Do you need a backup for the backup? How many levels of backup do you need to be sure nothing will ever happen? The additional cost for each layer of protection in this case is very high and eliminates a very unlikely risk. The goal of the risk assessment should be to choose countermeasures that are cost effective in eliminating significant risk while identifying residual risks that the system owner chooses to accept.
CLASSIC SECURITY GOALS Several models have been proposed for describing the goals of a security policy. The first such goals articulated what is referenced as the “CIA triad” or “CIA triangle”
54
Enterprise Web Services Security
[Vincent05]. The term CIA is an acronym built from the initials of the three goals: confidentiality, integrity, and availability. More recent guidance has come from the National Security Telecommunications and Information Systems Security Committee (NSTISSC) [NSTISSC02]. The NSTISSC guidance calls confidentiality, integrity, and availability the “Critical Information Characteristics” that define a secure information system. This more recent guidance demonstrates that the CIA triad is still effective in articulating a means to secure a system. These three aspects define the heart of any secure system. Not all systems enforce all three aspects, but most do cover all of them. Confidentiality Confidentiality controls are responsible for ensuring that information is kept from being accessed by anyone not authorized to access it. Confidentiality is the primary concern of many of the contributors to the NSTISSC guidance, as they are largely from the DoD or other organizations in the U.S. government that are responsible for protecting national security secrets. A business is concerned about confidentiality because of secrecy concerns (for pricing information they would like to keep from being seen by their competitors) or privacy concerns (information on their customers that the customer expects them to keep private, such as their medical records). While confidentiality, secrecy, and privacy are very much related, confidentiality has a broader goal. Privacy seeks to protect others from reading information, but confidentiality considers all forms of access such as reading, copying, printing, and so forth. A confidentiality policy applies to all objects controlled by the system and requires the system to mediate all attempts to manipulate the object, even to the extent that the system must keep unauthorized individuals from even knowing that the object exists. Integrity Confidentiality of information is easily understood because it relates to easily understood concepts like privacy. Integrity is a bit less obvious, as integrity controls are not based on who has access to information. Integrity controls determine who is allowed to modify the content of data so that it is no longer correct. That “correctness” protection is the critical feature of an integrity protection system where the information is protected against attempts to tamper with it in order to ensure that it is always correct. It’s easy to understand why integrity is important if you consider the records of your bank, for example. You want the bank to have operations in place to prevent attackers from modifying your bank balance, and of course the bank has integrity controls in place that allow them to detect and correct unauthorized or inadvertent changes to account information.
Security Goals
55
Notice the conflict between confidentiality and integrity: a confidentiality control seeks to keep any access from happening, but an integrity control doesn’t care if the information is seen, as long as it remains correct. Availability Information that is not available when a user needs it has limited value. Availability controls try to ensure that when a valid request is made to access some piece of information, that access will succeed. It is important to notice that availability controls are only concerned with authorized, valid requests for the data. One reason for this is that availability failures are often caused by unauthorized parties flooding a server with requests so that it cannot serve legitimate user requests. This is a denial of service attack that attempts to prevent users from performing their authorized transactions. Again, there is a conflict between availability, confidentiality, and integrity. Availability controls want to make sure information is always available, whereas confidentiality tries to make it unavailable, at least to those who are not authorized. This goal conflict is shown in Figure 3.1, which shows that there are places where the goals conflict (the parts of the graphs that do not overlap), but that some forms of protections coincide (where the graphs overlap). The area in the center is the “holy grail” of a system, where the confidentiality, integrity, and availability goals work together to protect the system.
Confidentiality
Security
Integrity
Availability
FIGURE 3.1 The conflict between security goals.
56
Enterprise Web Services Security
The NSTISSC guidance is based on the classical confidentiality, integrity, and availability controls but considers the CIA triad to be incomplete. NSTISSC identifies additional concerns for a security program: where information is held (in storage, during processing, and in transmission) along with security measures (policy, education, and technology) to make a three-dimensional matrix such as that shown in Figure 3.2 that denotes the controls that are necessary for a security model to be considered complete.
Storage Processing Transmission
Policy
Education
Technology
Confidentiality
Integrity
Availability
FIGURE 3.2 The NSTISSC security model.
Each of the components of the cube in Figure 3.2 need to be considered at some level when you develop your policy. For example, you should consider confidentiality of information in transit in your security policy and you should consider education to help users enforce integrity of information in storage. The additional details in the NSTISSC model help identify assets and goals that might not be included if all the details are not considered when making decisions about what assets need protection.
TRANSACTION SECURITY GOALS Even with the additional considerations provided by the NSTISSC model, some additional aspects of transaction-oriented systems (such as Web Services) deserve
Security Goals
57
attention in a security policy. These are the authentication, scalability, and nonrepudiation goals, which will be defined in the following sections. Authentication An authentication system provides proof of user identity. For the purposes of securing a system, authentication usually provides the user’s identity in the form appropriate for use in making policy decisions. Typical implementations provide a user identifier as some unique binary value that the system can efficiently use in access control decisions. Authentication is needed so that a system that enforces user controls on data can identify the users making requests for information. This allows the system to enforce adequate (only allowing access to objects the user needs access to) and appropriate (only controlling what is necessary while controlling all system objects) confidentiality and integrity controls. The authentication system must interact with the user in some way to decide that the user really is who he is claiming to be. A common means of user identification is a username and password, but this is difficult to use in a transaction-oriented client-server-based system such as Web Services. Sending the user’s username and password over the network from the client to the server means the password can be captured as it passes across the network, allowing replay and other attacks. Transaction authentication also introduces the possibility of a rogue client who allows an attacker to masquerade as an arbitrary user. The design of the client software must protect information that an attacker could use to masquerade as the client. Distributed authentication schemes must take into account the insecurity of the communications network, the insecurity of the client-side software, and the possibility of replay attacks, among other problems. Protocols must be chosen (or designed) to ensure confidentiality of user authentication data and to use sequence numbers or other means to avoid replay attacks. Untrusted clients can be resisted by use of cryptographic controls (such as public key authentication, to be discussed in Chapter 9) to avoid forged user credentials. Allowing delegation of user authentication (so an intermediate system can act on behalf of the client) is difficult for Web Services authentication to do correctly. We will discuss the ways in which distributed authentication can be safely done in Chapter 9. Basic Web site authentication [RFC2617] uses a simple reversible encoding of the user’s username and password and transmits that information with every request sent to the Web site. If an attacker is able to capture a request from the user to the Web server, it can be used to determine the user’s username and password. Web basic authentication should therefore be avoided where possible. Another way a Web site can authenticate a user is by use of client public key infrastructure certificates in conjunction with a Secure Sockets Layer (SSL). As long as the users can be trusted to protect their certificates, this is a reasonably secure
58
Enterprise Web Services Security
system. Since it works in conjunction with SSL, it also adds confidentiality protections while ensuring the identity of users. This identity assurance is only available if users protect their certificates since anyone who has a copy of that certificate can claim to be that user. The user’s certificate should be protected with a strong, unguessable password or stored in a database with very restrictive access. The Windows operating systems offer a protected storage subsystem that stores user private keys in ways that restrict access by unauthorized applications [MSGloss05]. Authentication can be difficult to implement in a Web Services environment when the user does not directly interact with the system offering the service. In this case, there must be an intermediate system that is trusted to accept an authentication token of some kind from the original user and send that to the service endpoint. Getting this sort of system right (where a third party is allowed to proxy authentication to the endpoint) is a difficult design problem. Aspects of this problem will be covered in Chapter 14. Scalability Another transaction goal is to allow the system to grow or adapt as demand increases. If you consider the possibility that everyone on the Internet is a potential customer, you can understand the desire for scalability. The potential growth of the system must be considered when it is initially designed. For example, the growth of a system that requires all transactions to take place on a single computer will be limited by how fast a computer you can buy at any given time. One of the most common criticisms of proposed Internet protocols is that “it won’t scale” because most people are not accustomed to having to consider the exponential growth in demand that happens when a product or service becomes popular. Popular electronic commerce sites such as eBay and Amazon are built on clusters of multiple servers. These clusters are designed to allow more computing resources to be added so the system can handle higher load; a side effect of this is that the system becomes more reliable since there is usually a working system available to handle a user’s request. Content distribution services such as Akamai™ also allow a system to scale by placing resources close to clients. Scalability plans should consider both sides of this argument such as multiple machines dispersed over a wide geographical area in order to minimize the chance of a single attack bringing the system down. When an operation processes all transactions through a single service (a socalled chokepoint), the performance of the system is determined by how fast that chokepoint allows transactions to complete. If the capacity is too low, the chokepoint may become a bottleneck. Those bottlenecks will keep the system from being scalable, as you can only be as fast as you can make that single system. It’s very easy to double the speed of a system by adding another CPU, but you can’t do that for
Security Goals
59
a chokepoint where you must wait for the CPU family to double in speed. Unfortunately, many organizations don’t realize that their systems do not scale until they become popular, leading to unhappy customers and attempts at quick fixes that fail, leading to more unhappy customers. Scalability should be considered as part of the system’s design, not bolted on as a quick fix after a problem is noted. The protocols that underlie the Internet provide a case study in how to build scalable systems. While some say these designs are part of the Internet’s design to survive military attacks, scalability and resilience are really part of the culture. The ARPAnet designers [Griffiths02] and the Internet Engineering Task Force (http://www.ietf.org) have a history of taking scalability and reliability very seriously. Internet services are designed to avoid single points of failure; doing this helps make them scalable. The best example of this is the Domain Name System (DNS), which relies upon a set of root name servers for converting host names to IP addresses; those root servers are replicated with copies spread across multiple continents. Those systems are spread such that one of them is topologically close to any Internet user anywhere in the world. The protocol detects which server provides the best service and preferentially sends requests to that machine, but it also occasionally probes other servers to ensure that changes in network connectivity are detected. All of this design effort leads to systems that can easily be expanded to respond to changes in demand. Nonrepudiation The third transaction-related security goal is that online transactions should mimic the forms of interaction that businesses are accustomed to. For example, when two parties negotiate and sign a contract, that contract is enforceable because it can be proven that both parties agreed to the contract as proven by the fact that each of them signed and dated it. Any attempt to deny the fact that the contract is valid would require denying, or repudiating, the signature affixed to the contract document. An online transaction has similar requirements. When two parties agree to an electronic contract, there must be some way to prove that both of the participants in the transaction truly did agree to the terms. That’s where nonrepudiation comes in. When a system requires a binding contract, some means must be provided for the client to sign the contract to demonstrate their agreement. Such a signature should be date-stamped to demonstrate when the contract was negotiated. It should also provide strong integrity controls so that one of the parties can’t change the contract terms after an agreement is completed. Digital signatures can provide the necessary technology to allow enforcement of the contract because the parties cannot deny that they signed the contract; such mechanisms are necessary to enforce nonrepudiation. Without some form of nonrepudiation, an electronic contract is unenforceable.
60
Enterprise Web Services Security
Some consider the major difference between the terms information security and information assurance to be the addition of nonrepudiation to the assurance goals. There is no clear consensus, and the terms are used more or less interchangeably. However, nonrepudiation is not really a security goal, as it is largely a business goal.
THE ROLE OF SECURITY POLICY IN WEB SERVICES SECURITY ENFORCEMENT Web Services has security goals that are not very different from the goals mentioned already in this chapter. A Web service provides a platform-independent, scalable, distributed method for processing user requests. The service has user authentication needs, processes data that must be protected against confidentiality, integrity, and availability attacks, and must scale to handle user demand. Policy must dictate how information is to be protected for a Web service. The policy must consider all aspects of service data and how that data must be protected. The policy helps articulate the requirements for data protection and for how users are to be identified. The policy must also consider how trusted systems are to be controlled so that a distributed system cannot be attacked by concentrating on one poorly managed component or service. A distributed system such as one built on Web Services must consider a more complex environment than one built on a single system; not only must the policy cover the security concerns raised by the communications network, but it must also consider how systems will be approved to run components of the Web Services system. Of particular concern is a system that outsources service components where the policy must define how the systems to run those components will be vetted. The policy must also consider the spectrum of potential attackers. Anyone from untrained amateurs using downloaded exploit tools to attacks raised by nation-states with potentially unlimited resources must be considered. A Web Service policy also must be designed to incorporate the security requirements based on the business goals of the service. The business needs may dictate what security enforcement is necessary and appropriate for the service environment. The WS-Security standard from OASIS [WSSecurity04] provides a framework for the SOAP protocol that supports many Web Services implementations. WSSecurity defines a set of standard eXtensible Markup Language (XML) formats that allow a Web Service to implement encryption for confidentiality of transaction data. WS-Security also allows the use of digital signatures for transaction data, allowing integrity protection, user authentication, and nonrepudiation protections.
Security Goals
61
WS-Security is an important part of the security policy for a Web Services system. The WS-Security mechanisms will be covered in detail in Chapter 11.
SUMMARY In this chapter we introduced the reasons for having a security policy, defined several goals of security policy, and defined terms to be used to describe those security goals. We related those goals to their use in a distributed environment and expanded the requirements to incorporate business security goals. We started with a discussion of the assets that many enterprises need to protect including both tangible assets such as computers, networks, buildings, and employees and intangible assets such as trade secrets and intellectual property. We then introduced a model for looking at vulnerabilities, threats, and countermeasures and their impacts on overall risks. We next introduced the classic CIA triad, or CIA triangle, and how the three security goals it represents (confidentiality, integrity, and availability) contribute to an overall security strategy. The unique requirements of transaction-based systems such as authentication, scalability, and nonrepudiation were discussed along with the relationship of those requirements to the classical security goals. These were explained in the context of normal business relationships and business operations. The security expectations of the Web Services environment were also described to help understand how a Web Services system can provide assistance with meeting stated security goals as an integrated part of an enterprise’s overall security strategy.
REFERENCES [CAIDA03] Moore, D., V. Paxson, S. Savage, C. Shannon, S. Staniford, and N. Weaver, “The Spread of the Sapphire/Slammer Worm.” Available online at http://www.caida.org/outreach/papers/2003/sapphire/sapphire.html. [Collins97] Collins, R., “The Intel Pentium F00F Bug Description and Workarounds.” Available online at http://www.x86.org/errata/dec97/f00fbug. htm. [Griffiths02] Griffiths, Richard T., “History of the Internet, Internet for Historians (and just about everyone else).” Available online at http://www.let.leidenuniv.nl/history/ivh/frame_theorie.html. [MSGloss05] Microsoft Corporation, “Glossary of Windows 2000 Services.” Available online at http://www.microsoft.com/windows2000/techinfo/howitworks/ management/w2kservices.asp#p.
62
Enterprise Web Services Security
[NIAP04] National Information Assurance Partnership, CCEVS Website, Available online at http://niap.nist.gov/cc-scheme/index.html. [NSTISSC02] National Security Telecommunications and Information Security Committee, “National Training Standard for Information Systems Security (Infosec) Professionals.” Available online at http://security.isu.edu/pdf/4011. pdf, June 20, 1994. [RFC2617] Franks, J., et al., “HTTP Authentication: Basic and Digest Access Authentication.” Available online from http://www.ietf.org/rfc/rfc2617.txt, June 1999. [Vincent05] Vincent, Thomas, “OSXFAQ – Mac OS X Security.” Available online at http://www.osxfaq.com/Editorial/security/index2.ws. [Winkler97] Winkler, Ira, Corporate Espionage. Prima Publishing, 1997, p. 13. [WSSecurity04] Nadalin, Anthony, et al., “Web Services Security: SOAP Message Security 1.0 (WS-Security 2004).” Available online at http://docs.oasis-open. org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0.pdf, March 15, 2004. [ZDNet04] ZD Net, “Study: Unpatched PCs compromised in 20 minutes.” Available online at http://news.zdnet.com/2100-1009_22-5313402.html.
4
The Internet and World Wide Web Infrastructure
In This Chapter Internet 101 TCP/IP HTTP Security Domains Client System Vulnerabilities Java Virtual Machine Vulnerabilities Networks Summary References
he Internet and the World Wide Web are creating the materials from which our global economy is being built. The Internet provides the basic plumbing or wiring that creates the underlying infrastructure. The Internet has evolved since its inception in 1969 [Griffiths02] and comes with a well-defined set of technologies and nomenclature. The World Wide Web, or Web, provides some of the protocols that ride on top of this infrastructure that enable communications among the various nodes and the basic building blocks for Web Services. The Web provides both the universal addressing scheme, comparable to the Dewey decimal system at the local library, in the form of uniform resource identifiers (URIs) and the basic protocol, or handshake, for services to interact, or “talk,” with each other across this infrastructure in the form of Transmission Control Protocol/Internet Protocol (TCP/IP). If you think of the Internet as the pipe or wire, the Web is the
T
63
64
Enterprise Web Services Security
water or electricity flowing through it. In this chapter we describe the security-significant characteristics of the Internet and the World Wide Web and explain how security can be enforced in this environment.
INTERNET 101 The Internet is built on TCP/IP [RFC791, RFC793]. TCP/IP is a layered protocol, developed by the Department of Defense (DOD) in the late 1960s to interconnect a large number of independent networks connected by gateways. The idea behind TCP/IP was to develop a robust, automatically recoverable, survivable network that could sustain the failure of any single node. Protocols such as the HyperText Transport Protocol (HTTP) and the File Transport Protocol (FTP) run on top of TCP/IP. The Internet is made up of a series of networks, interconnected by high-speed lines, many consisting of regional subnetworks, or subnets, which in turn are constructed from a combination of local area networks (LANs) and host systems as depicted in Figure 4.1. IP is designed for communicating across these networks and is responsible for routing packets between the nodes of the network. TCP is responsible for breaking larger communications into packets, feeding these to IP, and verifying their correct delivery. Given its error correction responsibilities, TCP is responsible for error detection and correction and the initiation of any retransmission requests. Any given request may pass through dozens of networks between the originating node and its final destination.
Network B
Networks
Network C
Network A
Subnetworks SubNet 1
Host
SubNet 2
SubNet 1
Local Area Network
FIGURE 4.1 Internet address hierarchy.
The Internet and World Wide Web Infrastructure
65
The IP address is the key to communications across this network. Each IP address is a 4-byte (32-bit) number. By convention, each byte, or octet, of the number is expressed by converting it to a number between 0 and 255 and separating the numbers by periods. A typical IP address looks similar to the following: 192.168.1.123
The IP address is quasi-hierarchical: there is a scheme for representing networks, subnetworks, and hosts, but it is not a straight translation. To make the translation, one must understand the class structure used in creating IP addresses. An IP address has two parts: a network part and a host part. A network mask is used as a bit mask to determine what bits of the IP address make up the network part; the remaining bits are the host number on that network. The mask can be specified in a classful manner or in a classless manner. When classful addressing is being used, the first few bits of the address specify what class the address falls into, which specifies the size of the network mask. Class A addresses contain values between 1 and 126 in the first position, or octet. The first octet represents the network address; the remaining three are available for representing subnetworks or hosts. Class B addresses use the first two octets to represent the network address, and these addresses can range between 128.1 and 191.254. Class B addresses have only two octets, which they can use to represent subnetworks and hosts. Class C addresses use three octets for the network address. These addresses range from 192.1.1 to 223.254.254, leaving a single octet for representing subnetworks and hosts. With classless addressing, some number of bits are used as a network mask. For example, the network 192.168.1.0/24 specifies network number 192.168.1 with a 24-bit network mask, which is equivalent to a Class C network. There are 253 possible host numbers in that network. Network 10.0.0.0/8 uses an eight-bit (one octet) network mask. All the systems on a local network must be configured to know the local network number and network mask. Packets are routed through the network by checking to see if they are destined for the local network and if not, routing them to a gateway for the destination network. IP uses routing tables to maintain instructions about how information is to be routed. To make addressing more understandable to humans, a Domain Name System, or Service, (DNS) is used to translate names into IP addresses. For example, DNS might translate www.example.com into 192.168.1.123.
TCP/IP IP is a connectionless protocol. Packets are simply routed from node to node without any sense of sequence or content. TCP is a connection-oriented protocol (there
66
Enterprise Web Services Security
is a connectionless transport level protocol, the User Datagram Protocol (UDP), used on the Internet, but it is beyond the scope of this book). TCP senders and receivers create endpoints, called sockets. Each socket is identified by an IP address and a port number. The process creating the socket binds this information to the socket using a BIND primitive. A socket may have multiple connections open at any given time. Once a socket is established, a process willing to receive connections uses the LISTEN and ACCEPT primitives to passively listen for and connect to connection partners. When two endpoints need to exchange information, the sending endpoint creates a full-duplex connection to the socket on the receiving machine. The sender uses the CONNECT primitive to identify the address it needs to connect to, and the connection process begins. A three-way handshake is used to create the connection: the sender sends a SYN request, and the receiver acknowledges with a SYN response, which the sender acknowledges. Once the connection is established, information is exchanged using SEND and RECEIVE primitives. Each endpoint terminates its side of the connection independently of the other. When an endpoint is finished sending information, it sets the FIN (finish) bit in a final packet using the CLOSE primitive. When the FIN is acknowledged, that direction of the connection is shut down. The connection is released when both directions have been shut down. The overall sequence of events, from start to finish, is shown in the diagram in Figure 4.2.
SOCKET BIND CONNECT
SOCKET BIND LISTEN ACCEPT
SEND
RECEIVE
RECEIVE
SEND
CLOSE ACK CLOSE ACK
FIGURE 4.2 Transmission state diagram.
Now that we understand addressing, routing, and connections, we can look at how information is packaged and sent across the network. Higher level protocols, such as HTTP, do not deal directly with IP. Instead, they communicate through TCP. A transaction begins by a higher level protocol passing a payload for trans-
The Internet and World Wide Web Infrastructure
67
mission, along with the destination address, to TCP. TCP breaks the payload into packets, the size of which is determined by a configurable parameter, but is normally around 1500 bytes. TCP appends a header to the beginning of each packet containing the port addresses for both the source and destination, information needed to reassemble the original payload on the other end of the transmission, and information needed to recover it if a transmission error occurs. TCP passes this information, along with the destination address, to IP. IP, in turn, appends an IP header to the packet. The IP address contains both the source and destination IP addresses. The final payload, illustrated in Figure 4.3, is sent across the physical network, winding its way from node to node from the source to the destination. Once the payload arrives at its destination, the process is reversed, headers are stripped as the payload is passed from IP to TCP to the target protocol, and packets are reassembled into the original payload, be it a message, a file, or some other form of content.
IP Header
TCP Header
Data
FIGURE 4.3 Layout of a TCP/IP packet.
HTTP HTTP [RFC2616] is to the World Wide Web what TCP/IP is to the Internet. HTTP is the protocol on which the Web is built. HTTP is an application-level, TCP/IPbased protocol built around a very simple request-response model. Its primary purpose is for serving Web pages, written in HyperText Markup Language
68
Enterprise Web Services Security
(HTML), between HTTP clients and servers as shown in Figure 4.4. Since most Web Services applications today ride on this protocol, much of the discussion applies equally to both HTTP clients and servers and Web Services clients and servers. The HTTP client initiates a sequence by issuing a request to the server. The HTTP server completes the sequence by processing the request and returning an appropriate response to the client. The standard HTTP client is a Web browser, such as Netscape’s Navigator or Microsoft’s Internet Explorer; the standard server is a Web, or HTTP, server such as iPlanet’s Enterprise Server (now Sun One’s Web Server), Microsoft’s Internet Information Server (IIS), or Apache’s HTTP Server. HTTP is a sessionless protocol, meaning a session is maintained only for the duration of a single request and the corresponding response.
Request
Server
Client
Response
FIGURE 4.4 HTTP client-server model.
HTTP clients and servers communicate via messages in standard formats as shown in Figure 4.5. HTTP requests are ASCII formatted text; HTTP responses are in multimedia Internet mail extension (MIME) format.
method url version
version code phrase
Request_Header 1 . . Request_Header n
Response_Header 1 . . Response_Header n
Response_Body Request_Body Response Format Request Format
FIGURE 4.5 HTTP message formats.
The Internet and World Wide Web Infrastructure
69
HTTP request messages take the form [method] [request_URL] [HTTP_version] [header1_fieldname]:[field1_value] ... [headerN_fieldname]:[fieldN_value] [blank line to indicate end of request headers] [data]
The first word of the request is the method, or function, to be executed. The most common methods are: GET: The GET method is used to retrieve files and data from the server. The request_URL identifies the file to be retrieved or the program to be executed by its URL. POST: The POST method is used to send data to the server for further action. The request_URL identifies the URL of the program or process that is used to assist in performing this action. PUT: The PUT method sends information to the server for storage. The request_URL specifies the filename to which the data is to be written. HEAD: The HEAD method is a way to request the headers for an entity without the data itself. The server returns the response header information associated with the request, but not the data. If the method is viewed as the action, or verb, in the request, the request_URL is the corresponding object of that action. The request_URL designates the file or program requested. The request message can contain one or more headers. Each request header entry contains a name followed by header-specific information, the two presented as a field:value pair. The number of fields and whether they are mandatory or optional depends on the type of request header. Some frequently used request headers include: From: contains the name of the requesting user Accept: lists types of input the client will accept Accept-Encoding: lists content-encoding types supported Accept-Language: lists the languages preferrable User-Agent: the HTTP client Referer: the URL of the Web page referring to this site
70
Enterprise Web Services Security
Authorization: information such as user name and password Charge-To: the account to which costs are to be charged If-Modified-Since: contains a date, requesting the server to only return the document if it has been modified since that date Pragma: used to specify extensions to the header list The HTTP server processes each request and returns a response. HTTP response messages take the form [HTTP_version] [status_code] [reason_phrase] [header1_fieldname]:[field1_value] ... [headerN_fieldname]:[fieldN_value] [blank line indicating end of response headers] [data]
The first line contains a status_code providing information about the response. The reason_phrase that follows is a human-readable explanation of the code. Status_codes are grouped as follows: 1xx: 2xx: 3xx: 4xx: 5xx:
Informational Success Redirection Client error Server error
Two common status_codes illustrating this concept are: HHTP/1.1 200 OK HHTP/1.1 404 NOT FOUND The HTTP protocol defines a number of response headers. These include: Allow: provides a list of supported methods Content-Encoding: contains information on the encoding used for an entity Content-Language: indicates the language used Content-Length: the length of the data
The Internet and World Wide Web Infrastructure
71
Content-Type: specifies the MIME encoding Content-Version: contains version information for the data Derived-From: for conveying information about previous data versions Expires: expiration date MIME-Version: multipurpose Internet mail extension version Location: to support redirection Proxy-Authenticate: to support challenge and response Public: specifies the nonstandard methods the server supports Retry-After: to specify when a service might again be available Server: contains identifying information about the server Set-Cookie: sends data to the browser for retention Title: any title associated with the information Transfer-Encoding Header: encoding used in creating a response URL: identifies other possible locations for the data WWW-Authenticate: part of challenge and response As you can see from this list, HTTP natively contains several of the header formats necessary for first-level application authentication.
SECURITY DOMAINS Our purpose for this book is to help explain how you can protect the systems and infrastructure that support Web Services applications from attack. Defending a system of any type requires that you predict the ways it can be attacked and install countermeasures for all of those attacks. If you’re responsible for protecting a large network, this is a nearly impossible job. You must keep every machine on the network up-to-date with patches, educate all the users to ensure they don’t install untrustworthy software, and react rapidly to new attacks when they are released. The problem is that this is a never-ending job since new vulnerabilities are being discovered almost on a daily basis. There’s also a window of opportunity between discovery of a new vulnerability, release of a patch to fix the vulnerability, and the subsequent installation of the patches. Until the patch is installed, your systems are exposed. Worse yet, you must protect all your systems against all potential attacks if you are going to defend them. An attacker need only find one vulnerability that has not been corrected to be able to breach your systems. Once a system is
72
Enterprise Web Services Security
breached, attackers can use trust relationships between that system and others to extend their reach. Unfortunately, most consumer- and business-grade operating systems are “target-rich” environments with many opportunities for an attacker to exploit given even restricted access. Being connected to the Internet increases the seriousness of this problem. Worms such as the Blaster worm [CERT03] were able to spread quickly by exploiting a vulnerable network service on the target system. Once the worm is able to infect a new system, it uses that system to scan random network addresses for additional victims. Some organizations have reported that an unpatched system connected to the Internet will be infected with worms within 20 minutes of being connected to the network [ZDNet04]. The problem is that patches are not effective until they are installed and that they do not solve the problem on systems where they are not installed. Also, a patch provides a hint to exploit creators about the cause of the problem being patched. Frequently, patches result in quick reverse engineering of the original bug (where the attacker determines what has changed and uses that information to design an exploit). One example of this was the Sasser worm, which was created by reverse-engineering a patch to the Microsoft Windows Operating System [Achohido04a]. All too often the work by vendors to help their users fix problems just leads to providing assistance to the people trying to compromise those systems. Something must be done to permit systems to be used without their being quickly compromised by the latest attacks. The way around this problem is to separate your systems into compartments that contain either trustworthy or untrusted systems. These compartments are called domains. It is important to note that a security domain is different from an Internet or network domain. A given domain contains a set of systems that are all subject to the same security policy. All of your internal systems (employee desktops, systems that should not be accessed by outsiders, internal servers, and so forth) would be in one internal domain. Any public access Web servers would be in a separate domain and so forth. The division into trusted, untrusted, or other domains allows the administrator to build a boundary around the trusted domain and restrict access to those systems from anything in the untrusted domains. A common way to enforce domain separation is by use of a network firewall. A simple firewall policy might deny any access inward toward the trusted domain but allow outbound access from the trusted domain to the untrusted systems. Some organizations build domains for each division, each office location, or for other logical divisions of the company. This is reasonable as long as your domains are reasonably large. The advantage of this approach is that it allows the administrator to aggregate many systems into a single policy enforcement point with a consistent set of rules. If you divide the domains so there are too many of them with few members, the advantage of the aggregation is lost.
The Internet and World Wide Web Infrastructure
73
Domain separation is used in the construction of highly trustworthy computing systems. The software is divided into a small part that enforces the security (called the trusted computing base [TCB]), and a larger part that is outside the TCB. The software within the TCB is verified to be correct, while the non-TCB software does not need detailed analysis. This domain separation allows limiting the search for flaws when the system is designed and built. Domain separation in a Web Services environment requires that you decide what systems to place in your trusted network and what systems are untrusted. The fact that all the systems that you depend upon may not be on a single physical network may complicate this task. It’s no longer a simple network firewall that separates two networks and a simple policy. With a Web Services network, you must extend your trust domain to incorporate systems that may be outside your physical control. This can be done in several ways. One way this is frequently done is to build a separate services domain and assign remote service systems to that domain. You can then apply a different security policy to the service domain, perhaps allowing limited inbound communication from those systems. This is similar to the intranet-extranet-Internet concepts that have been widely used to permit limited interactions between business partners. Another way in which security domains are used is by the Internet Explorer Web browser. A user is allowed to create a set of zones and assign systems to those zones. For example, all internal systems may be assigned to a trusted zone, and all other systems to the untrusted zone. These zones serve the same purpose as a network domain: separating systems into groups so different policies can be enforced. Again, the purpose of the domain scheme is to allow enforcement to be implemented for a large number of systems with a single security description, allowing the policy to be simplified. This example only shows two domains, which is a common configuration with trusted and untrusted systems. The possible applications of the domain model can be much more expressive and flexible; having three, four, or more defined domains allows much more precise access controls.
CLIENT SYSTEM VULNERABILITIES Many of the potential security problems in a Web Services environment result from the client systems, partly because the configuration of the client systems may be something the Web Services system cannot control. The clients may be infected with worms, spyware, or any of the other threat agents discussed already. In this section we will concentrate on the sources of client-side vulnerabilities and how they may be addressed.
74
Enterprise Web Services Security
One unfortunate problem with most service-oriented systems is that client systems are less dependable and less reliable than server systems. Servers are maintained by a dedicated system administration staff; client systems are often not maintained at all. These are critical systems when they participate in a transaction, but because they are not kept up-to-date with software updates, they are inherently untrustworthy. Browser Vulnerabilities Web Services systems are accessed by clients using their chosen Web browser. The Web browsers have grown from a simple product that renders Web pages and images to full-featured multimedia centers. The browsers have become integral parts of the host operating systems (at least on Windows systems). They have added ways for attackers to run code on the client by means of scripting languages, ActiveX controls, and Java Applets. All of this capability comes with a price as the browser becomes more complicated and therefore harder to secure. Several different Web browsers are available for client systems. The Microsoft Internet Explorer browser runs on Windows and Macintosh® systems. Netscape®derived browsers (including the Open-Source Mozilla™ browser project) operate on a wide range of systems, including Windows and UNIX® variants. Other alternatives, such as the Opera™ Web browser, are also widely used. Unfortunately, some browsers have quirks in their behavior. Web site designers that only test their sites using one browser risk having the site appear badly if an alternative browser is used. In some cases, failure to test with multiple browsers may lead to problems that keep the Web site from working at all. (One example of this was a quirk in Internet Explorer with HTML tables. Badly formed tables would display correctly in Internet Explorer but display completely blank pages in Netscape.) That’s why many sites test using different browsers to ensure that their site works correctly regardless of the browser being used. While many of the reported problems with Web browsers have concentrated on Microsoft’s Internet Explorer, a search for vulnerabilities for any of the widely used Web browsers will find several reported problems. Cross-site permission problems (which allow malicious sites to cross domains) have been reported in Mozilla-derived browsers as well as Internet Explorer. Several alternative browsers (Netscape and Opera, for example) have had similar problems. Using a different browser isn’t a panacea. Browser builders live with conflicting goals, as they would like to improve the capabilities of the browsers, thus allowing richer Web site content, but those additional capabilities can sometimes be misused. For example, the JavaScript™ language supported by most browsers can be used to pop up advertising windows on user workstations. Several suppliers of pop-up blockers released utilities to help
The Internet and World Wide Web Infrastructure
75
correct for this by disabling the scripts that popped up the windows. Now the browsers are coming with pop-up blockers built in, thereby becoming both the source of the problem and the source of the solution. Browsers have a history of vulnerabilities that an attacker can use to execute code on the client’s system. This history means there is a good chance that we will continue to find problems that can lead to client system threats. Some of these attacks do not require the user to click “OK” to permit the malicious software (malware) to run, but even so, there are clearly a large number of users who simply click “OK” without reading warnings, allowing attackers wide use of their systems. The wide spread of email-borne worms demonstrates that the operator of a browser cannot be trusted to avoid installing malicious code. Browsers also add complexity to Web sites since not all browsers interpret page content the same way. The requirement to support different browser implementations (Netscape or Mozilla, Internet Explorer, Opera, and text-only browsers) adds complexity to the Web site content. Careful adherence to World Wide Web Consortium (W3C) standards in your Web site design may limit such incompatibilities, but important parts of a Web Service’s site content could be automatically generated code that may not strictly conform to W3C standards. Any extra coding necessary for compatibility makes the site more complex and therefore more difficult to maintain. As we have pointed out, complexity often leads to insecurity. More complex Web site content means there is more chance that something is going to work incorrectly with some obscure browser configuration. Microsoft’s Internet Explorer browser supports ActiveX controls. (There are also plug-in programs for Mozilla to support ActiveX.) ActiveX is a component support system that allows the browser to be extended in many different ways. Effectively, any application that can be run locally on a client’s machine can be converted into an ActiveX control and downloaded to the user’s PC. ActiveX depends upon the user to control access to their PC by approving ActiveX controls before they are allowed to execute. The control comes with a digital signature that is expected to demonstrate who created the control. The user is presented a signature from some company and decides whether or not they trust that company to install software on their PC. The user is expected to verify that the certificate attached to the ActiveX control is connected to an author that they expect; if they are at the amazon.com Web site, any controls should be signed by Amazon. One hopes the user will detect a mismatch and reject a control that appears to come from an unexpected source. While this seems like a reasonable set of controls, they have been found to be inadequate. Users click “OK” without reading the warning messages, allowing malware onto their PCs. Worse, the widely used public key infrastructure vendor Verisign has been duped into issuing a Microsoft Corporation signing key [Securiteam01], allowing attackers to create malicious ActiveX controls that look like they come from Microsoft. Users are conditioned to
76
Enterprise Web Services Security
approve any installs from Microsoft, as they trust Microsoft to not deliver malicious software. With a fraudulent site certificate, users can be convinced to install software that they would not have permitted otherwise. The biggest problem with the browser client is that given the number of users, it is very likely that a user can be found who will be taken in by any fraudulent attempt to convince him to install a piece of malware. Web Services designers should consider the user’s browser to be an untrustworthy component because it is highly likely to be compromised by the user.
JAVA VIRTUAL MACHINE VULNERABILITIES A Java virtual machine (JVM) provides an execution environment for Java applets. A Java program is compiled into an intermediate form that is not native to any particular processor architecture. Because of this, any system can execute a Java program if it has a virtual machine available to execute the Java compiled code (also called bytecode). The compiled bytecode module depends upon the virtual machine to interpret the compiled program and to control what the applet is allowed to do. An applet may contain a user interface to communicate with the user, can create network connections to approved hosts, and can perform other operations if the user permits. A Java applet can execute on any system that provides an appropriate execution environment in the form of a JVM; the bytecode output of the Java compiler does not target any specific hardware architecture. This allows Java programs to be easily moved between different types of systems without having to be recompiled. This portability is one of the frequently expressed goals of Web Services systems: portable, meaning it can be run on multiple host environments, ubiquitous, as it is available independent of the user’s location, and extensible by allowing it to scale across multiple systems. Java also allows coding for small, embedded environments as well as complex client-server systems. The Java language is similar to ActiveX in some respects. Java applets are program modules that extend the capability of the user’s browser. Like ActiveX, they can extend the user interface to provide additional display and user interaction features. Java uses a very different security model than ActiveX. Rather than depend upon users to limit what applets are allowed to execute, Java limits what an applet is allowed to do by running the applet in a limited capability environment called a sandbox. Theoretically, an applet cannot reach outside of the constrained sandbox. The problem with this model is that it is complex. The Java environment must provide an interface to the user’s system that limits what the Java control can do. The sandbox cannot completely isolate the applet from the user’s system; if it did, the applet could not interact with the user at all. The sandbox must analyze all applet activity, looking for patterns that indicate hostile activity. The problem with this
The Internet and World Wide Web Infrastructure
77
approach is that some threats may not appear to be hostile to the sandbox. In fact, fundamental security theory has demonstrated that a sandbox cannot be implemented to always detect attempts to bypass enforcement, as the expected security enforcement is undecidable [Venners05]. Undecidable means that regardless of the effort made to enforce the separation of the Java program from the user’s environment, it cannot be proved that the system always restricts the applet to the sandbox environment. Given the desire to build provable security systems, this is an unfortunate limitation. Some Java applets are digitally signed. This mechanism attempts to add some level of assurance to a Java applet by demonstrating the origin of the applet. The same issues surrounding ActiveX also apply to signed Java. If the authors of a hostile applet manages to compromise the signature system, they can convince a user to permit a hostile applet to execute. Once a hostile applet is allowed to execute, there is no limit to the damage that applet can cause. Another issue with Java is the disagreement between Sun and Microsoft over the JVM included with Windows. Other companies supply their own JVM implementations as well. There are subtle differences in the way these virtual machines operate, meaning applets must be coded to work properly in both. This adds complexity that leads to more potential for vulnerabilities.
NETWORKS Web Services depends entirely on a network infrastructure to provide a means for clients and services to communicate. The network provides the necessary communication mechanisms but also provides attackers with an avenue to attack your services. TCP/IP Vulnerabilities The Internet is built upon the TCP/IP protocol suite. The Internet was built using funding from the DoD that built the ARPANET. Even though the funding for the development of the Internet came from the DoD, a number of security flaws are inherent in the design of the TCP/IP protocol. One flaw in the TCP/IP design is that it does not provide assurance for addresses in IP packets. It is easy for an attacker to spoof a source address of a trusted system in hopes of exploiting permissions provided to trusted domains. Once attackers have privileged access to a system (administrator on Windows systems, root on UNIX systems), they can spoof traffic from their host using the source address of any other system on the Internet.
78
Enterprise Web Services Security
Another flaw with TCP/IP is that it has weak replay protections. A TCP connection between two hosts detects replayed packets using a simple sequence number. Some operating systems use highly predictable initial sequence numbers for new connections, which allows an attacker to easily hijack new user connections and take advantage of user authentication. TCP/IP allows manipulation of the route that packets take between hosts. The use of “source routing” allows an attacker to inject traffic into the network and make it route through a trusted host. This allows the attacker to exploit the trust applied to the source-routed host. The other routing protocols used on the Internet (Routing Information Protocol (RIP), open shortest path first (OSPF), and Border Gateway Protocol (BGP)) all allow spoofed routing updates. This vulnerability in the underlying routing protocols makes it easy for attackers to reroute traffic to a host that they control. Cryptographic controls on BGP are now being implemented to help reduce the severity of these attacks. These controls (the routing protocol used between Internet service providers) demonstrate an interesting side effect of security controls. While signed BGP updates help validate the source of routing data, signed BGP allows an attacker to launch a denial of service attack against a router by sending continuous forged routing updates with bad signatures. The router ends up consumed by the CPU load caused by the bogus packets. This is a case where a security mechanism leads to an additional security flaw. The Internet Control Message Protocol (ICMP) is used to return IP traffic errors to the originating system. For example, ICMP messages are used to report unreachable systems and unreachable ports. ICMP messages are not authenticated and can be easily spoofed; this allows an attacker to close connections by transmitting falsified ICMP messages. Many protocols rely upon domain names to protect connections. The underlying DNS system that translates domain names (www.foo.com) into IP addresses and IP addresses back into domain names is also subject to spoofing attacks. If a server depends upon domain names to control access attempts, that server can be spoofed if the DNS can be spoofed. Many TCP/IP systems rely upon the Dynamic Host Control Protocol (DHCP) to configure host IP addresses and routes and name server addresses. If attackers are able to compromise a DHCP server, they are able to manipulate the configuration of most of the systems on a LAN, allowing the use of DNS spoofing and other attacks. Most of the many other flaws in TCP/IP result from the TCP/IP suite and the supporting protocols having been designed in a largely academic, benign environment. The wide adoption of these systems that were designed without hostile users being considered has resulted in many of the vulnerabilities experienced in today’s Internet. While the replacement Internet protocol (IP version 6 [IPV6]) has added some cryptographic protections against spoofing attacks, those protections are not widely used. In addition, IPV6 itself has experienced little acceptance at this time.
The Internet and World Wide Web Infrastructure
79
HTTP Vulnerabilities Probably the most widely used protocol on the Internet is HTTP. HTTP is defined by the Internet Engineering Task Force (IETF) request for comments (RFC) document RFC 2616 [RFC2616]. HTTP is a simple request-response protocol in which a client system requests a Web page using a GET, POST, HEAD, or other request that specifies the directory and file on the Web server that contains the content to be displayed. HTTP delivers content in several different formats, encoded according to MIME format. MIME was originally designed to allow delivery of rich format (multimedia) content for email; HTTP uses the same encodings and content types to leverage the email efforts. HTTP requests can also allow a user (usually through a browser) to upload transaction data in response to a server query. This is the basis for many of the consumer interaction Web sites; users select products to purchase and upload their requests to the Web server for processing. Another feature of HTTP is the use of cookies. An HTTP cookie is a piece of data that a Web server page transmits to the user’s browser. The cookie is tagged with a domain name; any time the user’s browser requests information from a Web page in that DNS domain, the cookie value is transmitted with that page request. This allows a site to maintain context with a user, which is a critical function for order processing. (The cookie provides a temporary context value that points to the user’s shopping cart, for example.) A cookie can also be used by a Web site to track user activity on that site. This may lead to invasion of the users’ privacy. Once users do anything on the site that gives the site their identity, the site may always be able to track who they are on subsequent visits. Cookie blockers (which act like pop-up blockers) can help eliminate these privacy violations but may cause some sites to malfunction. HTTP uses TCP connections. This means it is fairly reliable in delivering content to the requesting user. TCP provides error recovery, sequencing to ensure that data is delivered in order, and detection of connection losses. HTTP is used for a number of transaction-oriented protocols that depend upon those characteristics to provide reliable transactions. HTTP can use an encrypted Secure Sockets Layer (SSL) connection (referred to as an https:// URL) to provide privacy for user communications. The use of SSL is a browser artifact and is not part of the HTTP specification. SMTP Vulnerabilities Email is transferred using the Simple Mail Transfer Protocol (SMTP). SMTP is a simpler protocol than HTTP because email is effectively unidirectional. SMTP relies upon the same MIME specifications to allow email to contain nontextual content that a Web page uses. Most mail user agents now support HTML content,
80
Enterprise Web Services Security
allowing email messages to be richly formatted like a Web page with embedded graphics, text effects, and so forth. One side effect of this is that a spammer can detect when victims read their spam message (thereby confirming their address) by using an image tag with a query string that identifies the user. In other words, something like
This tracking scheme, called a Web bug, displays an image, but the query string (the email= part) can be tracked by the source so that the spammer knows when a message has been read. Web bugs are used by the service at DidTheyReadIt (http://www.didtheyreadit.com) to allow someone to track when an email that they send is read. Message Tag (http://www.msgtag.com) and Re@dNotify (http://www. readnotify.com) sell similar systems that allow email read receipts without the recipient’s knowledge. Companies have responded to user’s privacy concerns by creating products that block these notification systems. An example is the EmailTracking Blocker at http://www.wizard-industries.com/trackingblocker.html. The SMTP protocol is a simple one and very easily forged. An attacker is able to send a falsified email message by connecting to an SMTP server using a Telnet program. They then send commands to create the email message. The simple protocol allows someone with no special tools to spoof the email system. The commands used by a spoofer to send a message are simple, as shown below: HELO sender.example.com (or EHLO for ESMTP) MAIL FROM: RCPT TO:
[email protected] DATA
The HELO command introduces the sender to the SMTP server. EHLO is used with an extended SMTP (ESMTP) session. ESMTP adds features to SMTP such as pipelining and extended error status codes; if a client sends EHLO and the server responds with an error, they fall back to standard SMTP and send HELO. The MAIL FROM command specifies the sender’s from address. The RCPT TO command specifies who the mail is being sent to. The DATA command introduces the body, which follows the DATA command. The headers for the message body (the From, To, Subject, CC, and so forth) are sent first, followed by a blank line. Then the body of the message is transmitted. The end of the message is signified by a single period on a line by itself.
The Internet and World Wide Web Infrastructure
81
The simplicity of the SMTP protocol allows easy spoofing. The MAIL FROM from address is usually not verified in any way, so it is easy to spoof mail that appears to come from the boss. One possible means of tracking the sender of the spoofed mail uses the sender’s IP address, which is logged by the SMTP server. However, the protocol itself provides no assurance that mail really did come from who it says it came from. Another problem is that SMTP is a store-and-forward protocol. When an email is stored on an intermediate system, it can be read by the administrator of that system. The protocol provides no privacy protection for the mail being transferred or stored. Proof of origin for email can be obtained by using software that adds digital signatures to the email body. The two most common email security packages are Pretty Good Privacy (PGP®) and Secure MIME (S/MIME). A free version of PGP exists, called GNU Privacy Guard (GPG). PGP, GPG, and S/MIME can also provide privacy protection for email by encrypting it using the recipient’s public key. PGP and GPG are designed to be infrastructure free; anyone can use them without having to register their identity. S/MIME uses a public key infrastructure system to register users and issue them keys. PGP and S/MIME are very different in detail, but they share the common goal of adding security to the SMTP protocol without requiring changes to the protocol. This allows the existing email infrastructure to be used for important business communications while avoiding spoofing and tampering. Server Vulnerabilities The Internet is built using a client-server architecture. Many of the basic protocols that make the Internet work were designed before the idea of client-server systems took hold. Servers have access to information that clients need and present an interface to allow the clients to download the information. Prior to the creation of the Web each protocol had its own client-side program: an FTP client to access FTP servers, a Telnet client for terminal services, a mail client for email, and so forth. The primary uses of the early Internet were for email, file transfer, and net news (Usenet). The Gopher system (developed at the University of Minnesota) and the World Wide Web sprung from the early file-oriented systems. Gopher was an early textonly menu-driven system for organizing a library of documents with links; the Web is much more familiar to Internet users today. (However, there still are a few Gopher servers running.) Both the Gopher and the Web were designed to solve the same problem: it’s easy to download something you’re interested in if you know where it is, but finding it is the hard part. Allowing an organization to display its library of information on a page that users can easily traverse makes it easier for
82
Enterprise Web Services Security
users to find what they’re looking for. Because of online business and search engines, the Web has become an important part of our lives. Web Server Vulnerabilities The move from individual protocol-specific services to the Web did not eliminate the need for Web servers. The early attempts at a Web infrastructure were similar to the Gopher system: a document with links to other documents. While this was useful, it was quickly recognized that something needed to be added to allow Web content to be specific to a particular user or customer. The need to make page content more dynamic was first met with the use of common gateway interface (CGI) programs. A CGI program executes in response to a user’s query and returns a resulting HTML page. This allows almost unlimited flexibility in how a Web site responds to a user’s request. Anything that the system can do locally can be reformatted into HTML output. Another feature added to Web servers was the ability to serve dynamic HTML (or active server pages). A dynamic page has an embedded script program that executes on the server to prepare the HTML output transmitted to the user. Database queries can be executed and inserted into the body of the HTML page, for example. Security concerns for Web servers depend on how complex the site is and how sensitive the data is that the site manipulates. The popular Web server programs (Apache, Microsoft IIS) have had multiple vulnerabilities discovered that have exploits available. The first concern is to ensure that the software on your Web server is up-to-date with patches. The next concern is for the content of your Web site. Files should be protected so that they cannot be modified by a remote user. On Apache, the Web server usually runs as user nobody. You can protect your Web site by ensuring that the user nobody does not have write access to any site content. Similar configuration is available for Microsoft IIS, where a user IUSR_servername is created to run the Web server processes; access control lists can be applied to Web content to deny that user write access. Failure to do this opens your site to being defaced by someone who can exploit a Web server flaw. Sensitive content on your Web server should be placed outside the directory tree used by the Web server. If possible, it should be stored on a separate machine with restricted access. For example, if you are collecting credit card records for processing orders, you should ensure that those records are protected. Many times sites have been subject to extortion when an attacker manages to expose customer credit card information [News00]. Other Vulnerabilities There are other commonly used servers on Internet-facing systems. For example, many Web sites use database systems to provide information for dynamic HTML
The Internet and World Wide Web Infrastructure
83
pages. Often the database servers are colocated with the Web server. Many of the concerns expressed above apply in this case as well. You should ensure that the software is kept up-to-date and limit access when possible. It isn’t necessary, for example, to allow any arbitrary host on the Internet to send queries to your database server. You can usually limit access so that only the local host is permitted database access. Any other service running on your Internet-facing hosts should be given the same treatment. You should consider whether it makes sense to expose your services to the Internet at all. Providing a Web interface may allow you to move the servers inside where they can be protected by your firewall.
SUMMARY In this chapter we introduced the Internet and covered the basic building blocks of a Web-centric Internet application, including protocols used for common transaction types such as Web and email. We discussed the aspects of these building blocks that cause security problems in order to introduce the ways in which these problems can be solved. We started with a discussion of the overall Internet architecture and its domain-based concepts. We then explored some of the specific security challenges posed to Internet clients, networks, and servers. We went into detail regarding client-based vulnerabilities introduced by Web browsers and the Java virtual machine. We similarly explored some of the issues concerning TCP/IP, HTTP, and SMTP, three key protocols within the Internet environment. We concluded with a discussion of server vulnerabilities, concentrating on those for Web servers and other types of servers, such as applications and database servers that are frequently found in Web Services applications.
REFERENCES [Achohido04a] Achohido, B., “Sasser Inspires Raiders to Jump In.” USA Today, June 10, 2004, p. B.03. [CERT03] CERT Coordination Center, “CERT Advisory CA-2003-20 W32/Blaster Worm.” Available online at http://www.cert.org/advisories/CA-2003-20.html. [Griffiths02] Griffiths, Richard T., “History of the Internet, Internet for Historians (and just about everyone else).” Available online at http://www.let.leidenuniv. nl/history/ivh/frame_theorie.html. [News00] C|Net News.com, “Company Says Extortion Try Exposes Thousands of Card Numbers.” Available online at http://news.com.com/2100-1017-249772. html.
84
Enterprise Web Services Security
[RFC791] Internet Protocol, DARPA Internet Program, Protocol Specification. Available online at http://www.faqs.org/rfcs/rfc791.html, September 1981. [RFC793] RFC 793, Transmission Control Protocol, DARPA Internet Program, Protocol Specification. Available online at http://www.faqs.org/rfcs/rfc793.html, September 1981. [RFC2616] Fielding, R. et al., “Hypertext Transfer Protocol—HTTP/1.1.” Available online at http://www.w3.org/Protocols/rfc2616/rfc2616.html. [Securiteam01] Beyond Security, “Attackers Managed to Obtain Microsoft Digital Signing Keys.” Available online at http://www.securiteam.com/windowsntfocus/ 5VP0P0K3PY.html. [Venners05] Venners, Bill, “Why Security.” Available online at http://www. artima.com/insidejvm/ed2/securityP.html, April 6, 2005. [ZDNet04] ZD Net, “Study: Unpatched PCs Compromised in 20 Minutes.” Available online at http://news.zdnet.com/2100-1009_22-5313402.html.
5
Web Services
In This Chapter Web Services Standards XML SOAP WSDL UDDI Web Services Toolkits Summary References
hile the Internet and the Web provide the basic plumbing and protocols for enabling global communications, Web Services provide the lingua franca that transforms the Web from islands of disparate, disconnected components into a common marketplace. Web Services is in some ways returning us to a pre–Tower of Babel age where language barriers disappear. When coupled with the Internet’s global reach, geographic and political boundaries begin to disappear as well. Web Services refers to a set of system interfaces that are being built on two predominant underlying standards: eXtensible Markup Language (XML) and Simple Object Access Protocol (SOAP). You can think of XML as the basic grammatical elements for constructing a letter (words, sentences, paragraphs, etc.) and SOAP as the standard way of, or form for, constructing the letter itself and its envelope (heading, body, salutation, etc.) in a way that allows the post office to
W
85
86
Enterprise Web Services Security
route and deliver the letter. The standards give Web Services its language and platform independence and fuel part of the excitement about the technology. The standards are also extensible, allowing organizations to independently build on the core standards to extend Web Services for various capabilities, such as security.
WEB SERVICES STANDARDS Four key standards bodies coordinate and promote the technologies underpinning Web Services. The Internet Engineering Task Force (IETF, www.ietf.org) is an open international community concerned with the evolution of key Internet technologies such as the Internet Protocol (IP), the Transmission Control Protocol (TCP), and the HyperText Transport Protocol (HTTP). The World Wide Web Consortium (W3C, www.w3c.org) is the home of many key XML standards and of two key Web Services standards: Simple Object Access Protocol (SOAP) and the Web Services Description Language (WSDL). The Organization for the Advancement of Structured Information Systems (OASIS, www.oasis-open.org) is the home of the Universal Description, Discovery, and Integration (UDDI) specifications. OASIS is focused on the continued evolution of UDDI and is also the home of many of the Web Services security standards such as WS-Security. The Web Services Interoperability Organization (WS-I, www.ws-i.org) is working with industry to promote interoperability among vendors across languages, platforms, and applications. Web Services builds on five key protocols: HTTP, XML, UDDI, WSDL, and SOAP. Web Services use HTTP and HTTPS (secure HTTP) as the standard transport protocols and XML as the standard data format for implementing both underlying service interfaces and data exchange formats. Web Services expose services using standard protocols for discovering, describing, and invoking those services (UDDI, WSDL, and SOAP, respectively). Figure 5.1 illustrates the three standard protocol stacks relating to these functions: HTTP forms the foundation for each, and XML forms the next layer, with the discovery, description, and invocation protocols forming the uppermost level in each stack.
Function
UDDI
WSDL
SOAP
Data Format
XML
XML
XML
Transport
HTTP
HTTP
HTTP
Discovery
Description
Invocation
FIGURE 5.1 Web Services standard protocol stacks.
Web Services
87
Web Services implements a services-oriented architecture (SOA), as illustrated in Figure 5.2, consisting of providers, brokers, and requestors. Service providers register the locations and descriptions of their services using UDDI and WSDL. Service requestors use these same protocols to discover the services and obtain the location and description information they need for binding to and using the services using SOAP.
r ip De sc i ce sh Se rv 1. P ub li
ce n o r vi S e ip ti v er escr sco d D n Di 2. on a i cat
Lo
tio n
Broker
3. Bind to Service Provider
4. Invoke and Utilize Service
Requestor
FIGURE 5.2 Web Services’ SOA.
SOAP uses a simple request-response model, as shown in Figure 5.3, where the requestor, acting as the SOAP client, requests services from a provider, acting as a SOAP server, and the provider provides the requested services across a SOAP interface.
Request
SOAP Client (requestor)
XML Messages
Response FIGURE 5.3 SOAP’s basic request-response model.
SOAP Server (provider)
88
Enterprise Web Services Security
In the last chapter, we discussed HTTP and the key role it plays in the Internet and in Internet-based technologies. In this chapter, we will delve deeper into the other four foundational standards underpinning Web Services (XML, SOAP, WSDL, and UDDI) and introduce much of the terminology and concepts we will use in later chapters when we turn our attention to the specific Web Services standards addressing security.
XML XML [XML00] is the standard language for Web Services. It lays the foundation that other standards build upon. At its heart, XML is a markup language for describing document content. It is based on the Standard Generalized Markup Language (SGML), which is a standard for describing electronic documents. The extensible part of XML’s name comes from the language not being based on a set of predefined tags, but being based on the concept that you can customize the tags to meet the needs of any particular Web Service or application. Elements and Attributes Listing 5.1 presents a simple XML document. The XML content is made up of one or more elements, where each element is encapsulated between start and end tags. The start tag is a word, the name of the tag, enclosed by angle brackets, that is, . The end tag is the same tag name enclosed by an open angle bracket followed by a slash and closed by a close angle bracket, that is, . The content, or data value, is whatever information appears between the start and end tags including other XML structures. In the example, the father’s name “Richard” and mother’s name “Kim” are represented as data. Elements that do not contain any content can use a simplified form where a slash and close angle bracket terminate the element as part of the open tag, that is, . You would use this tag format to indicate null values or in instances where only attributes are associated with an element. LISTING 5.1
A Simple XML Document
Richard Kim
Web Services
89
george mary
Attributes add noncontent information to a tag and appear between the tag name and the closing angle bracket on an element’s start tag. Attributes are name/value pairs where the left side is the attribute name and the right side its value, the two being separated by an equal sign. Attribute values must be quoted using either double (“”) or single (‘’) quotation marks. Attributes are limited in several ways: they cannot contain multiple values (making them difficult to expand) and they cannot be used to describe structures. The tag in the example contains an age attribute. Whether you should represent something as content or as an attribute value depends on whether it needs to be visible, as part of the document’s content, or simply available for some other reason, processing within your Web Service, for example. As a general rule, you should store data as content and use attributes for information that is not relevant to the data itself, but is necessary for the data’s interpretation or processing. XML documents normally begin with a prolog section. The prolog includes everything up to the root element. The first statement in the prolog is the XML declaration that begins with the literal string of characters “ Richard Kim george mary
You will sometimes hear someone describe an XML document as being well formed and valid. Valid documents are well formed, but well-formed documents are not necessarily valid. Being well formed is the minimum requirement for any XML document. Being well formed simply means the document conforms to the basic syntactical rules laid down in the defining W3C reference for the XML version being used [XML00]. At a minimum, the document Begins with an XML declaration statement Contains one or more elements
92
Enterprise Web Services Security
Has a single root element encompassing the entire document Has each element properly opened and closed (have both a start and end tag) Is properly nested (elements cannot overlap) Has attribute values in quotes and has the standalone attribute in the profile statement set to “yes” (it is not necessary to have any of the elements or attributes declared in an XML schema or to have the elements or attributes be in any order). In addition to the minimum rules for being well formed, valid XML documents must also follow the structural rules defined by an XML schema; this includes adhering to element and attribute names, relationships, and values where appropriate. To be valid, the document must follow all of the rules in the structural description plus have the standalone attribute in the profile statement set to “no,” —indicating that a description is required. Schemas XML schemas are XML documents that describe an XML namespace [Schema001, Schema101, Schema201]. XML schemas are generally created as separate files and saved with dot XSD (.xsd) file extensions. Being XML documents, XML schemas must follow the same rules as any other XML document in order to be considered well formed and valid. Like all XML documents, an XML schema begins with a profile statement identifying the document as an XML document and the XML version in which it is written. The root element for an XML schema document is a element. The element can contain an optional namespace reference, which causes the schema itself to be validated against that reference (you will normally use the W3C XML schema definition for this purpose). The typical namespace reference in an XML schema includes the following:
This namespace reference tells whatever XML validation software you may be using three things: schema elements will be prefixed with the characters “xs,” they are to be validated against the W3C schema definition standard, and all elements appearing in the schema are to be qualified with a namespace prefix. Including W3C’s XML schema definition in this way causes the schema validation software to validate the basic schema format against the schema standard, thus avoiding issues with document conformance caused by invalid schema structures. Requiring elements to be namespace qualified reduces the potential for errors caused by misspellings or ambiguities in element or attribute names.
Web Services
93
The schema element’s contents are a series of rules describing the structure and content of valid, conforming documents. The rules are written in terms of and elements defined in XML schema. The elements and attributes making up the document are defined as and rules, which must accurately reflect the number, order, and relationships among elements and attributes appearing in conforming documents. The content of those elements and attributes are described through and rules that define constraints in terms of the data types and values to which associated elements and attributes must adhere. Listing 5.3 illustrates the overall structure of an XML schema document. Each rule corresponds to an element in a conforming document. Elements are either simple or complex depending on their content: simple elements are ones whose content can be described in terms of simple data types; complex elements are ones that can contain other elements or attributes. Each rule corresponds to an attribute in a conforming document. Attributes can only contain simple data types; attribute definitions, therefore, must follow many of the same rules as those for simple elements. LISTING 5.3
Sample XML Schema Format
simple_element_rules = ... + ... + attribute_rules = ... + ... + complex_element_rules = ... + ... + ...
Listing 5.4 repeats our earlier example, this time with a schema reference appearing on the root element. The schema reference includes two basic pieces of information: the default namespace to use, if any, and the schema file’s location. The schema validation program uses the default namespace for validating element, attribute, and data type names that do not include a prefix or namespace qualifier. A default namespace is not needed if all the items in a document are namespace qualified.
94
Enterprise Web Services Security
LISTING 5.4
Sample XML Document with Schema Reference
Richard Kim george mary
The first statement in the schema reference in Listing 5.4 sets the default namespace to the schema’s target namespace: xmlns="http://www.xyz.com"
This is accomplished using an xmlns attribute without a prefix, which tells the validation software that any references that are not prefixed belong to this namespace. While the namespace name looks like a URI, it really isn’t; it is basically a name, or label, that identifies the namespace. The second statement identifies the XMLSchema-instance namespace, which is necessary for the schema reference to use the schemaLocation attribute: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
The final statement in the schema reference maps the namespace to a schema document: xsi:schemaLocation="http://www.xyz.com
family.xsd"
The first half of the schemaLocation attribute’s value contains the namespace name; the second half contains the schema file name. Listing 5.5 displays the schema document contained in family.xsd. The schema definition identifies , , , and as complex elements, meaning that they can contain attributes, other elements, or both. The element in the element’s definition indicates the element can contain unspecified attributes (this entry is necessary if the example
Web Services
95
document in Listing 5.4 is to validate successfully, because the schema does not include a definition for the age attribute, which is included on the element in the example). The element included as part of the element’s definition permits that element to include unspecified elements that can occur zero or more times (this flexibility is needed if our example document is to validate, to handle the elements that are included as part of the node in the example document, but are not defined in the schema). Both the and elements are defined to simply contain xs:string type data. LISTING 5.5
Schema for Sample Document
A number of validating XML processors are available for testing whether documents are well formed and valid. Several attainable by downloading them from the Web include Apache’s Xerces2, Altova’s XMLSpy™, and Microsoft’s MSXML [XERCES2, XMLSPY, MSXML].
96
Enterprise Web Services Security
Transformations One of XML’s major benefits is that it separates content from format. Thus, different Web Services applications can use the same XML document even though one wants to display it in a Web browser, one wants to print it, and another wants to render it on a handheld device. Each can customize the presentation or format to fit their needs using style sheets. The eXtensible Stylesheet Language (XSL) is the presentation side of XML [XSL01]. XSL is a language for developing style sheets that describe the presentation characteristics for a family of XML documents. The term style sheet comes from XSL style sheets containing stylistic formatting information, such as fonts, colors, character sizes, character emphasis (bold, italic, etc.), and effects (underline, strikethrough, etc.) and from this stylistic information being collected into aggregates, or sheets, that are normally stored as separate files. XSL style sheets are XML documents. Three technologies make up XSL: XSL Transformation (XSLT), XML Path Language (XPath), and XSL Formatting Objects (XSL-FO). XPath provides capabilities for referring to parts of an XML document. XSLT and XSL-FO use XPath and deal more directly with the presentation of the document. XSL breaks presentation into two parts, as illustrated in Figure 5.4: transformation and formatting. The XSLT transformation process takes an XML document and a set of transformation rules in an XSLT document and processes the XML document against those transformation rules, producing a result tree [XSLT99]. The result tree may be significantly different than the tree that would be created directly from the original document: elements may be deleted, added, renamed, or rearranged, or additional text may be added.
XML Document
Result Tree XSL Transform
XSLT
FIGURE 5.4 XSL processing.
XSL Formatter
Rendered Document
Web Services
97
XSLT provides the language for writing transformation rules for translating a source document into a result tree. Each rule is made up of two parts: a pattern that is matched against the source document and a template that maps the matching source to the result tree. XSL processing involves a five-step process: 1. Convert the source document into a source tree. 2. Convert the XSLT style sheet into an XSL tree. 3. Step through the source tree processing each node by: Searching the XSL tree performing a pattern match against the template rules. Reflecting the results from the action specified by the matching templates in the result tree. 4. Process node lists in the source tree by processing each node individually. 5. Process unmatched nodes by copying them to the result tree. The XSLT processor performs steps 3 and 4 recursively. When finished, the XSLT processor may write the result tree to a file, display it, or pass it to another process depending on the processor and the options selected. The XSLT processor’s default behavior is to “walk” the source tree, outputting text nodes to the result tree. XSL-FO adds the formatting elements necessary to transform result trees into a form suitable for rendering on a specific device. The XSL-FO formatting process combines cascading style sheets (CSSs) and formatting object classes to create areas that possess specific formatting and rendering traits mapped to the geometry of the output device [CSS298]. CSS is a rule-based language for writing style sheets that describe presentation information. It is called cascading because it uses a parentchild hierarchy for passing information from higher to lower levels within the document and in resolving collisions where more than one statement specifies style information for a given element. XSL-FO allows you to tie these rules to specific areas within the target document or to particular types of output devices. XSL-FO defines each node in the result tree as a formatting object. SL-FO provides a set of typographic classes (page, table, and paragraph) for mapping these objects to a presentation. Each class represents a particular formatting behavior. XSL-FO classes include block (which is used for paragraphs, titles, and captions), externalgraphic, footnote, list-block, simple-page-master, static-content, table, title, and region. XPath provides the syntactical elements for addressing (referencing) and selecting parts of an XML document [XPATH99]. The syntax is similar to that used for URIs and for DOS and UNIX filesystem references including slashes to separate parent and child nodes, single and double dot operators for relative references, and
98
Enterprise Web Services Security
a double slash operator for selecting all the elements of a particular type. The language also includes wildcard characters to assist navigation and operators to aid element selection. The XML Pointer Language (XPointer) complements XPath by providing a grammar for pointing to a specific, marked anchor point within a document [XPointer02]. Using XPointer, your Web Service can identify fragments within an XML document and then point to those fragments. Fragments may be either points, where a point is a position within a document, or ranges, where a range is a document segment defined by two end points. XPointer includes the functions necessary for navigating and manipulating points within a document. Listing 5.6 illustrates a very simple XSLT style sheet for the sample document we presented earlier. The XSLT begins with an XML prolog statement that identifies it as an XML document. The element is the root element. The element includes the XSLT transform namespace to reference the XSLT language constructs throughout the remainder of the style sheet. The first element within the element is the element. Each template element defines a section of output in the response tree. A style sheet can contain however many elements are needed. The element contains a match attribute, indicating it is to be matched against the root node of the document; the "/" is an XPath expression signifying the root node. The element contains XSL statements indicating the actions to be performed when a matching node is encountered. In the example, a looping construct is used to walk through however many “family/parents” nodes might appear in the document. This again is written as an XPath expression. The value-of statements output the contents of the and elements to the result tree. XML tags encapsulate the value-of elements: and . These are output directly to the result tree. So, if this XSLT were processed against the sample XML document presented earlier, it would output Richard and Kim to the result tree. LISTING 5.6
Sample XSLT Style Sheet
Web Services
99
SOAP XML provides the syntactical foundations for Web Services. SOAP fleshes out this foundation, expanding the vocabulary and adding the semantics for basic message exchange between Web Services clients and servers. SOAP is a simple, text-based protocol for exchanging information between two endpoints [SOAP002, SOAP102, SOAP202]. SOAP is based on a stateless, oneway message exchange protocol where one endpoint sends a message and the other receives it. You can easily build more complex, two-way message exchange protocols from this foundation. Two-way exchanges can be either synchronous, where one party waits on the other, or asynchronous, where the party sending the message continues on with other processing while waiting for a response. SOAP uses XML for its messaging format and supports two messaging styles: self-describing, document-style messages, and encoded, SOAP remote procedure calls (RPCs). The client-server, request-response model shown earlier in Figure 5.3 is the standard framework for the two-way Web Services client and Web Services server interactions we are most interested in when it comes to Web Services security. In this framework, the SOAP client initiates a request by packaging information describing the request into an XML document, following whatever encoding rules have been agreed upon by the two parties, and sends this request to the SOAP server. The SOAP server decodes the message, interprets the request, and formulates a response. The SOAP server packages the response as an XML document, again following whatever encoding rules have been agreed upon, and returns the response to the SOAP client. The Web Services client and server can interchangeably interact in the SOAP client and server roles, where one is the client and the other the server and vice versa, in different message exchanges. SOAP messages adhere to a standard format and carry text/xml as their multimedia Internet mail extensions (MIME) type. Figure 5.5 illustrates the four components of a standard SOAP message. The outermost component is the SOAP envelope, which is mandatory. The can contain a header, which is optional, and a body. A SOAP entry can contain one or more header entries. Each SOAP entry can include a "mustUnderstand" attribute to indicate whether the final recipient, or any of the actors between the originator and the final recipient, must be able to process that information in order to process the message. The element is also a mandatory element. The SOAP of a message
100
Enterprise Web Services Security
carries the primary information, or payload, being communicated between the SOAP client and SOAP server. Information is encoded in the depending on the message exchange protocol being used: document-style or RPC. With document-style messages, the conforms to an application-defined schema, which may be identified as a namespace in the message itself. With SOAP-RPC style, the is encoded following an agreed upon encoding scheme. Errors that occur during the transmission or processing of a message are called faults. The SOAP carries details about how to handle various types of faults, in addition to the basic payload, in a special element.
Envelope
Header
Body
Payload
Fault
FIGURE 5.5 SOAP message structure.
Document Style Messages Document-style SOAP messages leverage the full power of XML for describing, encoding, and validating messages. Document-style message formatting is ideal for implementing messaging interfaces between Web Services components where message content and format can vary and for asynchronous exchanges. Web Services applications normally choose to serialize document-style messages using XML Schema and literal encoding. XML schema is more powerful than RPC for representing complex messages, and XML document format is more natural for business documents such as invoices, receipts, orders, shipping manifests, etc. One draw-
Web Services
101
back of document-style messaging is the difficulty in identifying the specific process or service being requested. SOAP header entries are one option for clarifying and exchanging process information as part of the message; a top-level element, named for the process being requested, wrapping the XML payload is another. Listing 5.7 illustrates the SOAP document-style message exchange format. The message follows standard SOAP formatting rules: it is an XML document, it has an element as its root, and it contains the mandatory element. The message content is included as a child element directly under the element and carries with it namespaces for validating the message structure and content. LISTING 5.7
SOAP Document-style Format
Richard Kim
Web Services using SOAP document-style messages, at some point, must deal with parsing the XML documents into data structures the Web Service can understand. Two application programming interfaces (APIs) are available to support this translation process: the Simple API for XML (SAX) [SAX01] and the Document Object Model (DOM) [DOM198, DOM200, DOM302]. SAX is an event-based parser where the Web Service passes the XML document it wants to process to the SAX parser, and the SAX parser reports parsing events back to the service by calling service-specified callback routines. You can think of the callback routines in the same vein as event handlers. DOM is a tree-based parser where the Web Service passes the XML document it wants to process to the DOM parser, and the DOM parser reads the document, in its entirety, and creates an in-storage tree representing the document. The service can then navigate, read, modify, and update the tree nodes through DOM functions. Which parser is better? It depends. SAX is generally faster and better for situations where you simply need to extract a few elements from a document. DOM is more appropriate when more complex processing and navigation is needed.
102
Enterprise Web Services Security
XML Events provides language extensions for integrating event listeners and handlers with DOM event interfaces [XMLEvents02, DOMEvents200, DOMEvents302]. DOM Level 1 defined high-level interfaces including Document, Node, Attr, and Element. DOM Level 2 added the concepts of event capture and flow, methods for attaching event handlers, and mouse events. DOM Level 3 adds keyboard events. Event handlers are critical in asynchronous message exchanges where the sender continues on with some other processing while the receiver formulates a response, as is the concept of message correlation. Message correlation involves tying one message to another, tying a request to a response, for example. The Web Services Routing Protocol (WS-Routing) defines the SOAP header syntactical elements for correlating and routing messages in both one-way and twoway exchanges [WSRouting01]. Figure 5.6 illustrates a SOAP document-style message exchange between a SOAP client and server. The SOAP client uses its internal variables, an XSLT, and a DOM parser to create an XML document that it sends to the SOAP server. The SOAP server reverses the process to extract and validate the data items from the XML document and populate its internal variables. The SOAP server and client reverse roles to exchange return values.
Variables
XSLT
XML Document
... ... ...
... ... ...
XML Document
XSLT
... ... ...
... ... ...
Variables
Request
XML Messages
SOAP Client (requestor)
SOAP Server (provider)
Response Variables
XSLT
XML Document
... ... ...
... ... ...
XML Document
XSLT
... ... ...
... ... ...
FIGURE 5.6 SOAP document-style message exchange.
Variables
Web Services
103
RPC-Style Messages SOAP-RPC provides a standard way to serialize objects, data structures, and content to XML. SOAP-RPC provides a platform, language-independent protocol for RPC-style messaging in multiplatform environments (think Java and .Net). SOAP-RPC is a lightweight protocol for implementing RPC capabilities and can be considered an alternative to other RPC capabilities such as distributed component object model (DCOM) and common object request broker architecture (CORBA). SOAP-RPC is generally, though not necessarily, synchronous—the client makes the call to the server and normally waits until the server returns a response. Figure 5.7 illustrates the major components and steps involved in a SOAPRPC call. The process begins with the client calling a remote procedure belonging to the server. A proxy stub running in the client’s process space marshals the parameters, gathering them into a standard form, and serializes them for transport across the transport layer to the server. The server receives the call and reverses the process. A proxy stub running in the server’s process space deserializes the transport stream, unmarshals the parameters, and invokes the called process or service on the server. The reverse process returns the server’s response to the client.
8. Generate Response
7. Program Executes
1. Call Procedure SOAP Client
2. Marshall Parameters
SOAP
SOAP-RPC
Stub
Server
Stub
6. Unmarshall
SOAP 3. Serialize
5. Deserialize 4. Transport
FIGURE 5.7 The SOAP-RPC model.
SOAP supports several ways of encoding the RPC parameters. You use the attribute on an element to control the encoding scheme for data within that element’s scope. One option is to use XML schema and a schema of the application’s choice for encoding the data; another option is to use SOAP’s builtin types (called Section 5 encoding because valid values were originally defined in
encodingStyle
104
Enterprise Web Services Security
Section 5 of the SOAP specification) in combination with XML schema. This has become a popular technique and is the approach illustrated in Listings 5.8 and 5.9. Listing 5.8 illustrates a SOAP-RPC-style request message. The first thing to note is the namespace declarations for using both XML schema and XML built-in types. The second is the element in the . The element identifies a namespace for validating header entries. The encodes the call to the remote procedure. The first child element in the element contains the remote procedure’s name (the remote procedure could be a program, a method within a dynamic link library, or some other programming unit the remote server can understand). In the example, the remote procedure has a single input parameter, a 1 × 2-integer array. The array type comes from the SOAP built-in types, the item types from XML schema. LISTING 5.8
SOAP-RPC-style Request Message
... 100 20 ...
Listing 5.9 illustrates the corresponding SOAP-RPC-style response message. In this case, the method response is returning two elements, both containing integer values.
Web Services
LISTING 5.9
105
SOAP-RPC-style Response Message
... 100 20 ...
Binding SOAP supports HTTP and email binding. Binding involves mapping the SOAP document onto the underlying transport protocol. SOAP supports both HTTP GET and POST. With HTTP GET, the SOAP message is returned in the body of the HTTP response message. With HTTP POST, SOAP messages may be conveyed in the bodies of both the HTTP POST and the associated response. SOAP email binding is not part of the basic SOAP specification. SOAP messages may be exchanged via Internet email using the Internet message format (RFC 2822) [SOAPEmail02, RFC2822]. The SOAP message may be part of the email message text or included as an attachment.
WSDL In order for Web Services components to communicate, they must first agree on the interface they will use for the communication. The interface specification includes the protocols they will use, the messages they will exchange, the order in
106
Enterprise Web Services Security
which the messages will be exchanged, and the general semantics of those messages. WSDL is a standard language for describing interfaces between Web Services components [WSDL01]. WSDL describes Web Services applications as a set of endpoints that exchange information in order to use each other’s capabilities. The endpoints may operate on either document or RPC-style messages. WSDL defines Web Service applications as collections of endpoints that are called ports. WSDL abstracts the endpoint definitions from their implementation by separating the messages that can be exchanged and the operations that can be performed from the specific protocols and specifications being used. Figure 5.8 illustrates the WSDL abstraction model. Examining this model from the inside out, WSDL messages are abstract definitions of the data being exchanged; WSDL operations group messages together to represent an interaction; WSDL port types are abstract operations performed using these messages; WSDL bindings are the protocol and format specification for a given implementation; and WSDL ports map the service to the implementation. The combination of these elements describes a Web Service interface. Service
Port
Port
Binding
Binding
portType operation
message part1...partn
message part1...partn
message part1...partn
Abstract Interface
FIGURE 5.8 WSDL abstract description of services.
The WSDL description for a service is made up of eight elements, as illustrated in Listing 5.10, which map back to the abstraction model. The element encapsulates the definition for a Web Service. The element encloses
Web Services
107
associated data type definitions. Data type definitions are encoded using XML schema and can include both simple and complex types. The element defines both the input and output messages for the service. The messages are defined in terms of message parts that can be separately represented and bound. The element defines the operations that can be performed and the directions of those operations through an element. The element defines message exchange through three primitives: input, output, and fault. The element defines the data formats and protocols for a port and maps the operations to a set of bindings; SOAP is used in the example. WSDL supports SOAP, HTTP GET and POST, and MIME binding operations. The defines each operation in terms of a sequence of input, output, and fault messages. Finally, the element binds the port and operations together into an endpoint using a element. LISTING 5.10
Sample WSDL Service Description
108
Enterprise Web Services Security
Simple service
Communication between the Web Services client and server may be either unidirectional or bidirectional. The element in the Web Services’ WSDL document describes the direction of the communications and the messages to be exchanged. Each message is described in terms of an abstract message that must be defined in a element in the WSDL document. W3C defines four primitive types of operations from the WSDL owner’s point of view. Assuming the Web Services server is the WSDL owner, the four types are: One-Way: Another endpoint sends an unsolicited message to the server. Request-Response: An endpoint sends a request to the server, and the server returns a response. Solicit-Response: The server solicits a response from another endpoint, and that endpoint responds. Notification: The server sends an unsolicited message to another endpoint. In each instance, the other endpoint may be another Web Services server or a client, depending on the application.
Web Services
109
UDDI If two Web Services components want to engage in an exchange, the question becomes, how does the requestor discover the interface for using the provider’s services? Universal Description, Discovery, and Integration (UDDI) provides a standard way of registering and discovering Web Services [UDDI02]. UDDI is built on the concept of a distributed, XML registry, or directory, where service providers can register their services along with descriptions of and pointers to those services. Requestors can then use the UDDI directory to discover information about a Web Service and how to invoke it. The UDDI Business Registry (UBR) is a global UDDI repository hosted by IBM, Microsoft, SAP, and NTT Communications to create a central repository for registering, publishing, and finding business services. You can find more information about gaining access to and using the UBR at UDDI.org (http://www.uddi.org/find.html). You can compare the contents of a UDDI repository to a telephone book where: White pages contain simple contact and descriptive information about a business. Yellow pages describe the business in terms of standard taxonomies such as business area, product group, geographic region served, and industry. Green pages describe the services a business offers and provides URIs for obtaining service description information and invoking those services. Information in a UDDI repository is arranged hierarchically as shown in Figure 5.9. A business entity element occurs once for each business in the repository. These elements hold descriptive information about each business and form the white and yellow page sections of the repository. One or more business service elements exist for each business entity. At least one business service element exists for each service the business offers. The business service element contains the name and description of the service and contains at least one binding template that points to the service and the corresponding technical detail. The binding template for a service includes a description of the service and a pointer to the service in the form of an access point. The access point is normally a URI pointing to the service’s interface description, for example, a WSDL file. The binding template also points to technical models (tModels) that contain technical specifications for the service that requestors use to determine how to invoke the service. UDDI provides a publisher assertion element to tie together business entity structures belonging to an organization, thereby making it possible to describe complex relationships such as a corporation and its subsidiaries.
110
Enterprise Web Services Security
FIGURE 5.9 UDDI directory hierarchy.
UDDI provides two APIs for accessing and manipulating information in a UDDI repository. The Publish API provides the interfaces you need for registering services, and the Inquiry API provides the interfaces you need for searching (discovering) and retrieving information from the repository. The Publish API includes interfaces for creating, editing, and deleting each of the five major structures. The Inquiry API exposes a Browse method for browsing each of the five major structures and a Direct Access method for retrieving each type of structure given a corresponding key. Listing 5.11 illustrates the structure. The element begins with basic identifying, locating, and description information about the organization providing the service; in this case, XYZ Corporation. The businessKey attribute contains the unique identifier, or key, for locating the business entity using the UDDI Inquiry API and for creating references to the organization from other UDDI structures. The organization description includes telephone and email contact information, in human-readable form, that potential clients can use to contact XYZ Corporation to learn more about their services. The and elements contain information both services and humans can use in making decisions about whether or not they want to use the services being offered. In the example, the element identifies the
Web Services
111
company by its Dun and Bradstreet number; the element contains entries tying the company to medical supplies and the U.S. by way of a Universal Standard Products and Services Classification (UNSPSC) code and an ISO 3166 country code, respectively. LISTING 5.11
Sample Element
operator="www.xyz.corp/uddi" businessKey="A3B41200-1891-43A4-4798-0000EC51231E"> "http://www.xyz.com/uddi/base_service.html" XYZ Corporation Import and Export All Calls Here J. Smith 123-456-7890
[email protected] Order Vitamin Supplements Order Vitamins Based on Type Input Order Quantity http://www.xyz.com/input_quantity ... ...
The structure provides information about one of the services XYZ Corporation offers, in this case, a service for ordering vitamins. The structure captures basic, descriptive information about the service and encapsulates a binding template collection that describes the technical details for using that service. The element provides a unique identifier for the business service, and the element ties the service back to the business entity providing the service. As shown in the example, you can set the element to an identifier different than that of the owning business (a concept called service projection). Service projection allows a business entity to offer another’s service. You use elements to capture the technical characteristics for a service including the service’s access point and pointers to technical model entries describing the standards needed to invoke the service. The contains the unique identifier for the binding template, and the ties it back to the business service structure associated with the . The element provides a URI to the service. The URI may be either a direct or indirect link to the service; the useType attribute specifies how to interpret the value:
Web Services
113
endpoint: URI points to a Web Services endpoint. bindingTemplate: bindingKey points to another binding template that can be accessed for technical details. hostingRedirector: UDDI repository address; the referenced repository must be queried to determine the access point. wsdlDeployment: URI points to a remotely hosted WSDL document for the service. The element links the service to the tModels describing the standards used when invoking the service. The entries describing services in a UDDI repository create taxonomies requestors can use for finding business entities and services by tying services to standards, specifications, constructs, and technical concepts. The UDDI technical model fills two important needs for the discovery process. The entries provide a way of mapping services to technologies (similar services tend to use similar technologies) and determining compatibility between services. Unlike the other UDDI structures we have discussed, entries exist outside the normal parent-child containment hierarchy used to capture information about business entities, business services, and binding templates. The associated with a Web Service points to the appropriate technical model entries through tModelKeys. Listing 5.12 illustrates the tModel structure corresponding to the service shown. The element contains pointers to relevant standards (WSDL, SOAP, and XML) requestors use to access the service. The tModelKey provides the unique identifier for the technical model and corresponds to the link in the . LISTING 5.12
Sample Element
XYZ Corporation Standard Service Standard Interface for XYZ's Web Services http://www.xyz.com/wsdl/web_service_standard_ binding.wsdl
UDDI provides publisher assertion structures as a way to create relationships between business entities in a UDDI repository. You use publisher assertion entries in situations where a single element cannot adequately describe a business entity. For example, it may be important to know whether two business entities are in partnership, one is the parent of the other, or one is synonymous with the other. The business entities in question could be multinational corporations, conglomerates, or departments within a single organization. The publisher assertion framework is flexible enough to support any of these types of relationships. The only requirement is that both entities assert the relationship with the other for it to be valid and visible to other organizations accessing the UDDI repository. Listing 5.13 shows an example where the business entity identified by the is identified as a holding company that owns the entity identified by the in a parent-child relationship. The UDDI specification defines three types of relationships: peer-peer, parent-child, and identity. The peer-peer relationship is used to create relationships between two equals, for example, two departments within a larger company. The parent-child relationship is used to create relationships in hierarchical organizations where one entity is owned by or reports to the other, for example, a parent organization and one of its subsidiaries, as in our holding company example. The identity relationship is used to show that two organizations are in fact one, for example, sales and marketing both operating out of the same department within a company, but represented as separate entities within the UDDI repository. LISTING 5.13
Sample Example
A3B41200-1891-43A4-4798-0000EC51231E 4B236890-2134-1219-3672-12468A342191
Web Services
115
Dynamic, runtime discovery is both one of Web Services’ fundamental goals and promises. UDDI and UBR are enablers for realizing those promises. As more businesses register and list their services in UDDI directories such as UBR, these goals become more of a reality. In addition to its use for the Internet, UDDI repositories are also an option for registering, querying, and finding services within both intranet and extranet environments. Novell and Apache offer open source UDDI 2.0 implementations that can be used for these purposes [jUDDI04, NsureUDDI].
WEB SERVICES TOOLKITS If you had to write all of the XML and Web Services elements we have discussed in this chapter from scratch using a simple text editor, the task would be overwhelming. Fortunately, toolkits are available that greatly reduce the complexity of this task. Unfortunately, the toolkits are technology, and sometimes platform, specific and the standards evolve so quickly that there is often a lag between the time a given version of a standard is released and the time the new features represented in that standard universally appear within the toolkits. The vendors participating in the development of a given standard frequently anticipate a new version of the standard’s content and include many of its elements into their own toolkits while the standard is undergoing final public review and comment prior to adoption. Knowing this can help if you are using a toolkit from such a vendor, but even this doesn’t always hold true. This means you have to check the toolkit and its version against the standards and features you need and be prepared to either defer some features or write code to insert some statements. Given this situation, a good starting point for .NET developers is Microsoft’s Web Services Developer Center (http://msdn.microsoft.com/webservices/). This Web site provides links to development and architectural overviews, downloads for Microsoft’s SOAP Toolkit, as well as for tools and code examples, tutorials on various components, and white papers for developing Web Services security applications in a .NET environment. Toolkits for J2EE (Java 2 Enterprise Edition) developers are also widely available. J2EE developers, however, frequently want to marry-up the toolkit they use with the applications sever they use. Most applications server providers also provide
116
Enterprise Web Services Security
a toolkit that includes the Web Services security features. For example, Apache’s WSS4J toolkit is available at http://ws.apache.org/ws-fx/wss4j/package.html; IBM’s Web Services Toolkit is available at http://www.alphaworks.ibm.com/tech/ webservicestoolkit; and http://dev.bea.com/codelibrary/code/examples_webservices.jsp points to the WebLogic platform from BEA Systems.
SUMMARY In this chapter we looked at the bedrock standards upon which Web Services builds; XML, HTTP, SOAP, WSDL, and UDDI provide the foundation on which other more advanced standards such as WS-Policy and WS-Security are built. XML provides the common language for creating and communicating information, and SOAP provides the standard message format. HTTP supplies the standard transport enabling any Web server to become a potential Web Services platform. WSDL adds the description syntax for describing and discovering the service interfaces necessary for Web Services clients and servers to communicate. UDDI brings discoverability through the concept of a standards-based, globally accessible XML repository. We looked at each of these key standards in terms of their basic concepts and capabilities including enough of the syntax and grammar to set the stage for the more advanced XML documents presented in subsequent chapters. For XML, we looked at document structure and introduced the concepts of tags, elements, attributes, and namespaces. We also briefly introduced XML schemas, which play a key role in validating XML documents, and stylesheets, which are instrumental for transforming, or “styling,” XML documents. For SOAP, we discussed its key header, its body format, and its two major messaging formats: RPC based and document style. We went into some detail regarding WSDL’s key role as the binding mechanism for Web Services and its elements for defining service and messaging interfaces. We concluded with a discussion of UDDI’s major components, white, yellow, and green pages, and the role they play in making services truly discoverable. IETF, W3C, OASIS, and WS-I are four key standards organizations involved in overseeing the development, continued evolution, and integration of these standards.
REFERENCES [CSS298] Bos, Bert, et al., “Cascading Style Sheet, Level 2: CSS2 Specification.” Available online at http://www.w3.org/tr/rec-css2, May 12, 1998. [DOM198] Apparo, Vidur, et al., “Document Object Model (DOM) Level 1 Specification Version 1.0.” Available online at http://www.w3.org/tr/REC-DOMLevel-1, October 1, 1998.
Web Services
117
[DOM200] Le Hors, Arnaud, et al., “Document Object Model (DOM) Level 2 Core Specification Version 1.0.” Available online at http://www.w3.org/tr/DOMLevel-2-Core, November 13, 2000. [DOM302] Le Hors, Arnaud, et al., “Document Object Model (DOM) Level 3 Core Specification Version 1.0.” Available online at http://www.w3.org/tr/DOMLevel-3-Core, April 9, 2002. [DOMEvents200] Pixley, Tom, editor, “Document Object Model (DOM) Level 2 Events Specification, Version 1.0.” Available online at http://www.w3.org/ tr/dom-level-2-events/, November 13, 2000. [DOMEvents302] Le Hegaret, Philippe and Pixley, Tom, editors, “Document Object Model (DOM) Level 3 Events Specification, Version 1.0.” Available online at http://www.w3.org/tr/dom-level-3-events, July 12, 2002. [jUDDI04] Apache Open Source Java UDDI Directory. Available online at http://ws.apache.org/juddi/. [MSXML] Microsoft Corporation, “XML Downloads.” Available online at http://msdn.microsoft.com/xml/xmldownloads/default.aspx. [NsureUDDI] Novell’s Open Source UDDI 2.0 Solution. Available online at http://www.novell.com/coolsolutions/feature/5699.html. [RFC2396] Berners-Lee, T., et al., “Uniform Resource Identifier (URI): Generic Syntax.” Available online at http://www.ietf.org/rfc/rfc2396.txt, August 1998. [RFC2822] Resnick, T., “Internet Message Format.” Available online at http:// www.ietf.org/rfc/rfc2822.txt, April 2001. [SAX01] About SAX. Available online at http://www.saxproject.org/, 2001. [Schema001] XML Schema Part 0: Primer. Available online at http://www.w3.org/ TR/xmlschema-0, May 2, 2001. [Schema101] XML Schema Part 1: Structures. Available online at http://www. w3.org/tr/xmlschema-1, May 2, 2001. [Schema201] XML Schema Part 2: Datatypes. Available online at http://www. w3.org/tr/xmlschema-2, May 2, 2001. [SOAP002] Mitra, Nilo, “SOAP Version 1.2 Part 0: Primer.” Available online at http://www.w3.org/tr/SOAP12-part0, June 26, 2002. [SOAP102] Gudgin, Martin, et al., “SOAP Version 1.2 Part 1: Messaging Framework.” Available online at http://www.w3.org/tr/SOAP12-part1, June 26, 2002. [SOAP202] Gudgin, Martin, et al., “SOAP Version 1.2 Part 2: Adjuncts.” Available online at http://www.w3.org/tr/SOAP12-part2, June 26, 2002. [SOAPEmail02] Highland, Mary M., et al., “SOAP Version 1.2 Email Binding.”Available online at http://www.w3.org/tr/SOAP12-email.html, July 3, 2002. [UDDI02] Bellwood, Tom, et al., “UDDI Version 3.0.” Available online at http://www.uddi.org/pubs/uddi_v3.htm, July 19, 2002. [WSDL01] Christensen, Eric, et al., “Web Services Description Language (WSDL) 1.1.”Available online at http://www.w3.org/tr/wsdl, March 15, 2001.
118
Enterprise Web Services Security
[WSRouting01] Nielsen, Henrik F. and Thatte, Satish, “Web Services Routing Protocol (WS-Routing).” Available online at http://msdn.microsoft.com/ ws/2001/10/Routing/, October 23, 2001. [XERCES2] Available online at http://xml.apache.org/xerces2-j/. [XML00] Internet Engineering Task Force, “Extensible Markup Language (XML) 1.0 (Second Edition).” Available online at http://www.w3.org/tr/rec-xml, October 6, 2000. [XMLEvents02] McCarron, Shane, et al., “XML Events: An Events Syntax for XML.” Available online at http://www.w3.org/tr/xml-events/, August 12, 2002. [XMLNS99] Namespaces in XML. Available online at http://www.w3.org/tr/RECxml-names, January 14, 1999. [XMLSpy] Available online at http://www.altova.com/xmlspy. [XPATH99] Clark, James and Steve DeRose, “XML Path Language (XPATH) Version 1.0.”. Available online at http://www.w3.org/tr/xpath, 16 November 1999. [XPointer02] DeRose, Steve, et al., “XML Pointer Language (XPointer).” Available online at http://www.w3.org/tr/xptr, August 16, 2002. [XSL01] Adler, Sharon, et al., “Extensible Stylesheet Language (XSL) Version 1.0.” Available online at http://www.w3.org/tr/xsl, October 15, 2001. [XSLT99] Clark, James, “XSL Transformations (XSLT) Version 1.0.” Available online at http://www.w3.org/tr/xslt, November 16, 1999.
6
Security Policy Basics
In This Chapter The Importance of Security Policy Steps in Developing a Security Policy The Security Policy Document Summary References
p to this point, we have been laying the foundations for much of the discussion to follow. We will now shift our focus from the why and wherefore of good security practice and the basic building blocks of Web Services to the details of translating risk mitigation strategies into security policies and those policies into implementations. We begin our “deep dive” in this chapter with a discussion of security policy and how it relates to an enterprise’s overall Web Services security strategy. Security mechanisms are only valuable if they are part of an overall security fabric that provides the level of protection both desired and thought to be in place. It is important that an enterprise’s security policy be comprehensive and thorough. Gold plating in one area while not protecting another more vulnerable area can be worse than no security at all since it can engender a false sense of security. What you should take away from this chapter is that security policy is important, that there really are methods available for developing good policies, and that policy must provide the underpinnings for an enterprise’s security strategy.
U
119
120
Enterprise Web Services Security
THE IMPORTANCE OF SECURITY POLICY Whenever you deploy a new Web Service, you are potentially creating a gateway into your organization’s information technology (IT) infrastructure. For customers, business partners, suppliers, and employees, the Web Service represents a new way to obtain information or services. For an intruder or hacker, the Web Service represents a potential path to the heart of your IT systems and networks and the sensitive information they may contain, such as client lists, customer credit card information, employee data, or health records. Each Web Service, therefore, represents exposure to a set of threats and a corresponding set of risks of loss or damage as a result of those threats. In this chapter we explain how a well-documented security policy can help deal with the real-world risks that almost all systems face. How do you eliminate the risks? You can’t. The complexity of the software and networking systems involved in today’s internetworked environments, especially for services you deploy across the Internet, make that an impossible objective to achieve. However, that doesn’t mean you can’t significantly reduce or even minimize your risks. You do that through risk management and the application of clear, consistent, well-defined security policies and procedures that identify your organization’s sensitive information and prescribe appropriate countermeasures for its protection. Minimizing your risks begins with security, and security begins with security policy. In Chapter 3, we discussed how security goals must map into security policies. These security policies in turn must map into implementations. An enterprise security policy establishes the rules for implementing applications, including Web Services, within an organization and is therefore the embodiment of that organization’s overall security goals. Your enterprise security policy needs to encompass your entire computing environment including people, technology, and operations. Defense-in-depth provides a comprehensive strategy where intruders must defeat multiple interlocking countermeasures before gaining access to critical assets. Defense-in-depth recognizes the need to trade off the risks that vulnerabilities represent against the costs of protecting against those risks. The National Security Agency (NSA) has created the Information Assurance Technical Framework Forum (IATFF) to promote the use of the defensein-depth approach throughout government and industry [IATF02]. Defense-in-depth advocates a three-step (protect, detect, and react) approach to creating a secure environment. The first step is to incorporate security services, such as authentication, authorization, access control, and auditing, into the security infrastructure in order to protect from attack. Recognizing that attacks are an unavoidable consequence of doing business in certain environments, the next step is to incorporate attack detection capabilities that allow you to detect attacks when they occur. The final step is to build in appropriate reaction and response capabilities to counter those attacks.
Security Policy Basics
121
Defense-in-depth also recognizes the need for different security strategies within different parts of the security infrastructure as a function of the degree of trust placed in the underlying components. For example, you may use different strategies and protection mechanisms in different parts of the security infrastructure depending on whether you are dealing with clients accessing services across the Internet, business partners accessing resources through a shared extranet, or employees accessing resources through an internal intranet. One of Web Services’ challenges within an enterprise is devising protection mechanisms that can simultaneously work across diverse environments. The number of defensive layers and the strength of the protection mechanisms you need within each layer depend on the sensitivity or value of the assets you are trying to protect and the trust you place in the internetworking infrastructure between those assets and the users trying to obtain access. The more you trust the infrastructure, the more willing you are to expose resources or data with fewer protection mechanisms as part of the outer layers. Figure 6.1 shows the different perspectives you must take in developing a security policy that includes Web Services. Web Services have an outside-in view of security. Web Services execute at the highest level of the applications stack. They assume adequate protections are already in place at lower levels. For example, Web Services clients accessing a service may be in the same or different network domains. The Web Service assumes adequate perimeter defenses are in place, as part of network security policies, to protect the underlying systems and infrastructure, regardless of whether clients are in the same or a different domain. In order to ensure consistency and completeness of coverage, an enterprise security policy must take the opposite approach and view the security problem from the inside out. It must address security from the perspective of the assets or information that need to be protected and then work its way outward to the perimeters that include Web Services. Web Service's Point of View Applications Network Systems Physical
Information Resources
Access Protection Protection Protection
FIGURE 6.1 Security from different perspectives.
Security Policy's Point of View
122
Enterprise Web Services Security
STEPS IN DEVELOPING A SECURITY POLICY An enterprise security policy specifies the rules for protecting the assets belonging to the enterprise. The enterprise security policy includes the individual policies and procedures for protecting various components of the IT infrastructure, ranging from the physical security of systems and networks to personnel security for users, operators, and administrators. Implementing adequate security policies requires commitment from upper management and communicating to everyone throughout the organization their roles and responsibilities with regards to the policy. You should not add security as an afterthought. To be successful, security policy must be a well thought out, planned part of your IT and Web Services infrastructure. How does an organization approach developing a security policy? Table 6.1 summarizes two approaches. The Internet Engineering Task Force (IETF) recommends the five-step approach depicted in the first column in its Site Security Handbook for developing site security plans [RFC2196]. The IATF recommends the six-step information systems security-engineering process shown in the second column [IATF02]. The processes are similar, but the IATF process is geared toward systems engineers and marries the process to the systems engineering discipline. We will use the IETF structure to outline the security policy development process because we believe it is clearer for those who are writing an organization’s security policy who may not be systems engineers nor be familiar with that discipline. Given that the aims of the two approaches are the same, you could choose to follow whichever you are most comfortable with. We will use the IATF framework as well to help clarify components of the IETF approach and to lay out the policy outline.
TABLE 6.1 Steps in Developing a Security Plan IETF Approach
IATF Approach
Identify assets you’re trying to protect
Discover needs
Determine threats you’re protecting them from
Define system requirements
Determine likelihood and loss potential
Design systems architecture
Implement cost-effective measures
Develop detailed design
Continuously review and improve
Implement system Assess effectiveness
Security Policy Basics
123
Identify the Assets You Are Trying to Protect The first question you must answer is, what information or assets are you trying to protect and why? The answer begins with your systems, networks, and workstations. At a minimum, you must provide availability and integrity throughout the IT infrastructure. Systems and networks must be available and accessible to whoever you define your user community to be. The systems must also ensure that only authorized users can create, modify, and delete the information the systems contain. Depending on the sensitivity of the information within your systems, you may also need to ensure confidentiality of either the information, its communication, or both. A secondary question is, what makes the sensitive information in your systems sensitive? It may be classified, it may be a matter of privacy, it may be a matter of organization or corporate confidentiality, or it may be due to legal obligation. Classified Information
The U.S. government uses a classification system and the need-to-know principle for managing its sensitive information [Orange85, CCIS04]. The basic classifications (unclassified, confidential, secret, and top secret) correspond to the damage the loss of the information would cause to the security of the U.S. In order to access information, individuals must possess security clearances authorizing them access to information at the level being requested and have an official need-to-know the specific information in question. While the complexity of such an information classification system is overkill for a nongovernmental organization, there is value in understanding the methodologies used by organizations that take information protection very seriously. Privacy
While we do not have a comparable system measuring the levels of sensitivity we have regarding personal information, most of us assume a basic right to privacy and the ability to control the information that is collected about us and how that information is used. Different kinds of organizations have varying degrees of legal and ethical responsibilities for protecting those rights. As described in Chapter 1, there are also expectations that businesses have in how their confidential information will be handled, as well as employee privacy expectations. A well-designed security plan recognizes the need to meet those expectations. Identify the Threats You Are Protecting Against Once you have an understanding of the information you are trying to protect, the next question is, what threats you are trying to protect it against? As we discussed
124
Enterprise Web Services Security
in Chapter 2, threats come in many different forms. The IATF framework identifies five types of threats of attack: Passive Active Close-in Insider Distribution Passive attacks include eavesdropping, where an opponent listens in on communications, and traffic analysis, where an opponent tries to determine the location and the identities of the parties to a communication. Passive attacks do not try to disrupt or modify communications or content. Active attacks take the opposite tack. Active attacks include: Masquerade: An opponent pretends to be someone else. Replay: An opponent retransmits previously captured transactions. Message Modification: An opponent alters parts of otherwise legitimate messages. Denial of Service: An opponent tries to disrupt a system’s operation. In today’s internetworked environment, attacks can come from any number of locations and can be aimed either directly at an organization or at a business partner or service provider connecting to its network or utilizing its services. Close-in threats can be characterized as being either internal or external and as intentional or unintentional. Internal threats come from employees and others with unfettered access to your IT system and its infrastructure. Intentional internal threats frequently come from disgruntled employees seeking revenge. Unintentional threats are simply people making mistakes, as explained by Hanlon’s Razor: Never attribute to malice that which can be adequately explained by stupidity. External threats come from outside your infrastructure and can be either intentional, such as a hacker trying to get into your systems, or unintentional, such as a failing network component on a business partner’s segment of a shared extranet flooding your firewall with extraneous packets. Trusted insiders pose one of the greatest threats because they already have access to at least the basic infrastructure you are trying to protect and they may have privileged accesses that increases the potential loss of any attack they launch. An intruder may also mount an effective close-in attack, but generally with less success than the trusted insider; it is easier for intruders to go after unprotected assets they can more readily steal. You should remember Houdini gained widespread fame and
Security Policy Basics
125
made a very comfortable living breaking out of safes because they were generally designed to keep people out rather than in. Remote access attacks generally look to either steal unprotected assets or to mount denial-of-service types of attacks. Distribution attacks occur during the manufacture or transport of hardware, software, or encryption key materials. In addition to the threats outlined in the IATF framework, there are also threats from man-made and natural disasters such as acts of war, terrorist attacks, floods, hurricanes, and tornadoes. These types of threats can be devastating to an organization, as demonstrated by the events of September 11, 2001. Map Threats to Probability of Loss and Cost All threats are not equal. Each threat carries with it a probability, or likelihood, that it will occur and an associated cost. The probability of occurrence is a function of the specific business and IT environment and the sensitivity of the information involved or attractiveness of mounting an attack. If your organization has a large Internet presence, a large number of traveling users connecting to its systems via laptops and modems, and is in a business where a successful attack could produce large gains, the potential threats and vulnerabilities could be high. If you are in a closed environment with little or no sensitive or valuable information to be had, the probability of an attack is likely to be low. Associated with each threat is a loss potential. The loss may be in terms of money, credibility, business goodwill, prestige, or competitive advantage. Whatever the form, you should be able to assign a monetary value to the loss. The result of this exercise is a set of rough guesses for the likelihood of and cost of a given threat. A set of ballpark estimates are more than adequate, as it’s not possible to accurately estimate either cost or threat level. Given the set of estimates for the likelihood of occurrence and the cost associated with each threat, you can create a threat-to-loss chart similar to the one shown in Figure 6.2. The threat-to-loss chart maps each threat to a likelihood of occurrence and a cost of loss. In the hypothetical mapping shown, denial-of-service and replay attacks are likely to occur and have a relatively high associated cost of loss. A message modification attack also has a relatively high cost of loss, but a relatively low probability of occurrence. The threat-to-loss chart can help you decide which threats to protect against and which to accept as a cost of doing business because associated with each cost of loss is a cost to protect. The Computer Security Institute (CSI) and the Federal Bureau of Investigation (FBI) annually publish a “Computer Crime and Security Survey” that lists the number of security incidents and the costs in terms of the associated losses based on information they collect through an industry survey [CCSS04]. In the absence of any other information, this survey is a good source for developing the relative likelihood and cost factors.
126
Enterprise Web Services Security
Cost to Protect
Denial of Service
Message Modification Replay Masquerade
Eavesdropping Traffic Analysis
Likelihood of Loss
FIGURE 6.2 Mapping threats to loss.
Implement Cost-Effective Measures There is a tradeoff between the potential losses associated with a given threat and the costs of protecting against it. You can’t protect against everything, and it may turn out costing more to protect against a particular threat than it is worth. An organization has to balance the costs against the associated risks. Continuously Review and Improve Security Policies Once you have determined the threats your organization faces, the costs of those threats, and the threats you are willing to protect against, you are in a position to develop effective security policies. RFC 2196 defines a security policy as a formal statement of the rules governing those managing and using an organization’s IT infrastructure. The policies can either be permissive or restrictive. Permissive policies say that anything not explicitly prohibited is permitted. Restrictive policies take the opposite tack, saying that anything not explicitly permitted is prohibited [SUN04]. Defense-in-depth advocates a layered security strategy that brings people, technology, and operations together in an overlapping approach as shown in Figure 6.3. The IATF defense-in-depth framework provides a comprehensive method for developing security policies and procedures that highlights the importance of comprehensive security policies. Incomplete, unimplemented, misunderstood, or mismanaged security policies are worse than no security policy at all because they can engender a false sense of security.
Security Policy Basics
127
People • • • • •
Training Awareness Physical Security Personnel Security System Security Administration
Technology • • • • •
Technology Layers Security Criteria IT/IA Acquisition Risk Assessment Certification and Accreditation
Operations • • • • • •
Assessments Monitoring Intrusion Detection Warning Response Reconstitution
FIGURE 6.3 IATFF defense-in-depth strategy.
THE SECURITY POLICY DOCUMENT Most organizations document their security policies in a security policy manual, document, or Web site. If you are new to an organization or to implementing Web Services within an enterprise, you should find this document and determine the security infrastructure in place and the policies affecting the services you develop and the security mechanisms your services are responsible for using or implementing. Appendix A offers guidelines that you can use if you are responsible for developing, reviewing, or updating an enterprise’s security policy.
SUMMARY Security begins with a good security policy. The security policy clearly communicates the roles and responsibility managers, users, and administrators have in protecting information and technology assets. To ensure consistency and completeness, the security policy must take an inside-out approach to building interlocking layers of security mechanisms matching the sensitivity and value of the
128
Enterprise Web Services Security
information and assets it must protect while weighing the costs of the countermeasures against the risks. Both the IETF and IATF recommend a defense-in-depth strategy that advocates a three-step (protect, detect, and react) approach. An enterprise security policy identifies responsible organizations for physical, personnel, and IT security and the standards and countermeasures the organization will use for defending the computing environment, enclave boundaries, and the network and computing infrastructure. The security policy also lays out incident reporting and response procedures. Web Services must also be a key part of the security policy. Web Services countermeasures must be consistent with and leverage the protection mechanisms at lower levels in the protocol stack in order to create a well-formulated overall protection strategy.
REFERENCES [CCIS04] “Common Criteria for Information Security Evaluation January 2004, Version 2.2, Revision 256, 2004.” Available online at http://niap.nist.gov/ cc-scheme/cc_docs/cc_v22_part1.pdf. [CCSS04] Computer Security Institute, “Computer Crime and Security Survey.” Available online at http://www.gocsi.com/, 2004. [IATF02] Information Assurance Solutions Technical Directors, “Information Assurance Technical Framework Release 3.1.” Available online at http://www. iatf.net/framework_docs/version-3_1/index.cfm, September 2002. [Orange85] Brand, S., et al., “Department of Defense Trusted Computer System Evaluation Criteria.” Available online at http://www.fas.org/irp/nsa/rainbow/ std001.htm, December 1985. [RFC2196] Fraser, B., editor, RFC-2196 Site Security Handbook. Available online at http://www.ietf.org/rfc/rfc2196.txt. [SUN04] Sun Microsystems, “How to Develop a Network Security Policy: An Overview of Internetworking Site Security.” Available online at http:// itpapers.zdnet.com/whitepaper.aspx?scid=285&kw=&dtid=0&sortby=dated& docid=984.
7
Communicating Policy
In This Chapter Expressing Security Policy in Web Services WS-Policy WS-SecurityPolicy WS-PolicyAttachment Summary References
n enterprise security policy that isn’t written down or communicated is in some ways like not having a policy at all. Under such circumstances, the policy being evenly and consistently implemented is highly unlikely. Historically, communicating policy has involved writing it down and making sure the right people read it, understood it, and reflected it in their designs and implementations. Given Web Services’ goals of loose coupling and discoverability, the Web Services community and standards organizations have included policy and policy discoverability as key components of the overall Web Services architecture. This is a revolutionary step, as components can now not only discover interface requirements at runtime, but also the “expectations” behind those requirements and make runtime decisions about whether or not they can meet those expectations. You could equate this to identifying two merchants, each offering the same item at the
A
129
130
Enterprise Web Services Security
same price, yet one accepts only MasterCard® and the other only Visa®, and you happen to only have one of the cards in your pocket. Your decision would be obvious. So, too could be a Web Services client’s decision when choosing between two equivalent services when the client can only meet one of the service’s claims requirements. For example, both services may require some form of identification. If one requires an X.509 certificate and the other requires a Kerberos ticket and the client only understands X.509 certificates, its choice is obvious. In this chapter we discuss the eXtensible Markup Language (XML)–based standards that help communicate security policy in a Web Services environment and can help Web Services clients make these types of decisions. The organization owning a Web Service can use these standards to publish the policies surrounding the use of its service. These mechanisms allow clients to discover the policies as part of the service discovery process and to decide whether or not they can trust the services that they are relying upon and to gauge their ability to partner in establishing the necessary trust relationship.
EXPRESSING SECURITY POLICY IN WEB SERVICES To be effective, policies must be communicated and enforced. In a Web Services environment, this means Web Services servers must have mechanisms for telling potential clients about the policy elements they require and enforce, and those clients must have mechanisms for discovering that information and responding. Three evolving Web Services standards create the foundation for this communication. IBM and Microsoft laid out the original Web Services security framework in their Web Services roadmap [Roadmap02]. WS-Policy provides the basic grammar and framework for describing policies as a set of expressions made up of individual policy assertions, where an assertion is a specific constraint or requirement. WSSecurityPolicy adds security-specific assertion elements to WS-Policy for communicating security token, integrity, and confidentiality constraints. WS-PolicyAttachment completes the picture by defining mechanisms for inherently associating policies with a subject, as part of its intrinsic definition or through either its associated Web Services Description Language (WSDL) or Universal Description, Discovery, and Integration (UDDI) description. In this chapter, we focus on these three policy-related standards that come into play for communicating policy information between two parties. In Chapter 11, we will look at the standards clients and servers can use for communicating the corresponding security elements in complying with the policies.
Communicating Policy
131
WS-POLICY Figure 7.1 illustrates the basic Web Services policy model. A Web Services server acting in the role of a service provider conveys a set of conditions to potential clients acting as service requestors who make use decisions based on their ability to satisfy conditions and send satisfying claims to the provider as part of their requests. The Web Services Policy Framework (WS-Policy) provides the model and XML syntax for the first half of this exchange [WSPolicy04].
Policy Conditions (WS-Policy)
Web Services Client (requestor)
Web Services Server (provider)
Satisfying Claims FIGURE 7.1 The WS-Policy Model.
WS-Policy defines a policy, at the abstract level, as a set of policy alternatives that are in turn made up of a set of policy assertions. Listing 7.1 illustrates this relationship in Backus-Naur-Form (BNF). BNF is a simple language for expressing syntax and is used throughout the XML and Web Services standards. A BNF rule, or production, is made up of nonterminal and terminal (constant) symbols and four metasymbols: , ::=, and |. The angle bracket metasymbols enclose nonterminal symbol names. Each nonterminal symbol equates to a production rule. The ::= metasymbol is read as “is definedas.” The | metasymbol is read as “or.” The lefthand side of the rule is the symbol being defined and the right-hand its definition. In our example, the assertion is the lowest level construct in the grammar. An assertion equates to an individual requirement or condition that must be satisfied. An alternative is a collection of one or more assertions. WS-Policy leaves the definition of the assertion grammar to other standards such as WS-SecurityPolicy.
132
Enterprise Web Services Security
LISTING 7.1
BNF of WS-Policy Grammar (Abstract)
::= empty | | ::= | ::= requirement (or condition)
Normal Form At a concrete level, WS-Policy defines a policy expression as an XML Infoset representation of a policy. The policy expression can be in either normal or compact form. Listing 7.2 illustrates the outline for a policy expression in normal form. WSPolicy defines three syntactical elements, , , and , that create the basic grammar for writing policy expressions in this form. The element encapsulates the overall policy expression. The and elements are optional operators that can encapsulate a set of zero or more assertions. The element is conceptually an exclusive OR operator. It encapsulates a set of alternative assertions where exactly one of the child elements must be true. If this element is included but left empty, it indicates that there are no policy alternatives. The element is conceptually an AND operator. It encapsulates a set of assertions that must all be met. If this element is included but left empty, then there are no requirements or conditions in the area specified. LISTING 7.2
WS-Policy in Normal Form
... ... ... ...
Communicating Policy
133
Compact Form Normal-form policy expressions can become very verbose because of the limited operator and structure capabilities within the grammar. WS-Policy extends the grammar in three ways to support a more compact form for writing policy expressions: It adds the wsp:Optional attribute for use on assertion elements. It defines the semantics for recursively nesting policy operators. It adds an element for including other policy expressions to enable a more compact form for writing policy expressions. WS-Policy adds the wsp:Optional attribute in order to reduce the number of statements needed to express rules containing optional assertions; in normal form, you would have to write the rule twice, once with the optional assertion and once without. The wsp:Optional attribute can be used on any assertion element. It uses a Boolean value to indicate whether an assertion is either optional (True) or required (False). An assertion element that does not contain a wsp:Optional attribute is equivalent to one including the attribute with its value set to False. Compact-form policy expressions can recursively nest , , and operators. WS-Policy defines the transformation rules summarized in Table 7.1 for converting compact-form policy expressions into their normal form equivalents. The transformation rules provide the semantic guidelines for understanding how to expand and collapse statements into equivalent form without changing meaning. Compact-form policy expressions can also include a element anywhere an assertion can appear. The element provides a mechanism for one policy to include another through a uniform resource identifier (URI) reference. As a general rule, you can think of the policy expression pointed to by the as simply replacing the element. The exception is when the points to a element. In that case, the inclusion rule is to replace the element with an operator encapsulating the statement’s child elements. Listing 7.3 illustrates the syntax of this element. The URI attribute points to the policy expression for inclusion. The optional digest attribute contains the digest in Base-64 format (Base-64 is an encoding format for transforming binary data into printable text for transmission over character-based mechanisms such as those used for XML). The digest attribute provides a way of ensuring the right policy expression is included. The optional DigestAlgorithm attribute identifies the digest algorithm used to calculate the digest. The default is the secure hash algorithm (SHA1) using exclusive XML canonicalization to standardize the XML structure
134
Enterprise Web Services Security
TABLE 7.1 Compact Form to Normal Form Transformation Rules Rule
Meaning
Equivalence
is semantically equivalent to
Empty
is another way to express zero policy assertions is another way to express zero options
Commutative
Is equivalent to
Associative
Is equivalent to
Idempotent
Is equivalent to
Distributive
distributes across for example,
Is equivalent to
prior to creating the digest (we will discuss canonicalization in greater detail in Chapter 11) [EXCC14N]. The element is a placeholder for a valid operator and can be replaced by either or in the statements above.
Communicating Policy
LISTING 7.3
135
The PolicyReference Element Syntax
Merging Policies and Resolving Conflicts Figure 7.1 presents the simplest usage scenario—one where the Web Services provider sets the policy and requestors simply comply. How does this work in more complex situations where multiple policy setting providers are involved or the provider and requestor each have a set of policies and the requestor wants to limit the alternatives to mutually compatible ones? WS-Policy defines policy intersection as a first approximation for addressing these more complex scenarios. Policy intersection says that given two policies, P1 and P2, the intersection is the set of policy assertions, Ai, where for each assertion Ax in P1 and Ay in P2 where the vocabulary of Ax in P1 is equal to the vocabulary of Ay in P2, the set of policy assertion instances in Ai is all the assertion instances in Ax plus all the assertion instances in Ay. The vocabulary is the set of all assertion types used in the policy.
WS-SECURITYPOLICY WS-Policy provides the basic syntax and semantics for writing policy expressions. WS-Policy does not define the syntax or grammar for any particular type of assertions; it treats assertions in a generic way, leaving it to other standards to define appropriate assertions. The Web Services Security Policy Language (WS-SecurityPolicy) extends WS-Policy for the security-specific elements necessary for writing security policy assertions [WSSP02]. As we discussed in the last chapter, the Web Services section of an organization’s Security Policy should address questions of authentication, authorization, access control, confidentiality, and integrity. It should also cover the rules for traversing routers and firewalls and any other intermediaries involved in a message exchange. WS-SecurityPolicy defines assertion syntax for addressing these specific questions as well as for communicating where within the message (within the security header or message body) security-related information can be included and the requirements for and treatment of message time stamps.
136
Enterprise Web Services Security
SecurityToken Assertion
The element provides a means for a Web Services provider to tell a requestor the security tokens the provider requires or supports within its authentication, authorization, and access control services (we discuss the various types of tokens in detail in Chapter 9 under Identity Management). Listing 7.4 illustrates the syntax for this element. The subelement identifies the type of security token (see Table 7.2 for valid types) supported or required, and the optional subelement identifies the token issuer by name. The optional subelement contains type-specific information pertaining to the security claim. LISTING 7.4
The SecurityToken Element Syntax
... ... ...Token type specific claims... ... Token type specific details ... ... ... ... ...
Communicating Policy
137
TABLE 7.2 Valid TokenType Values Qname
Description
X509v3
X.509 Version 3 Certificate
Kerberosv5TGT
Kerberos V5 Ticket Granting Ticket
Kerberosv5ST
Kerberos V5 Service Ticket
UsernameToken
User name token
SAMLAssertion
SAML Assertion
XrMLLicense
XrML License
X.509 Claims
When the subelement is X.509v3, the optional subelement contains the name of either the issuing certificate authority (CA) or the corresponding root CA. The subelement can contain optional and subelements. If present, the subelement contains any restrictions on the certificate subject name. The optional MatchType attribute indicates whether an Exact or Prefix (the default) match is required. The optional subelement contains any restrictions on the extension identified by the OID attribute. The optional Critical attribute indicates whether the specified extension is critical (True) or not (False), and the optional MatchType attribute indicates whether an Exact or Prefix (the default) match is required. Kerberos Claims
When the
subelement contains a Kerberos QName, the optional subelement identifies the Kerberos realm. The subelement can contain an optional subelement and a mandatory subelement. If present, the subelement contains any restrictions on the client’s PrincipleName field in the Kerberos ticket, and the optional MatchType attribute indicates whether an Exact or Prefix (the default) match is required. The subelement contains the service’s PrincipleName.
Username Claims
The subelement is not used with username claims. The subelement can contain an optional subelement and a mandatory
138
Enterprise Web Services Security
subelement. If present, the subelement contains any restrictions on the contents of the subelement. The optional MatchType attribute indicates whether an Exact, Prefix (the default), or Regexp (regular expression) match is required. The subelement contains any restrictions on the contents of the subelement. The optional Type attribute indicates whether the password value should be sent in PasswordText plaintext (default) or PasswordDigest format.
Confidentiality Assertion
The element provides a way for a Web Services provider to tell a requestor its encryption requirements or convey information about the encryption capabilities that it supports. The provider may want the requestor to encrypt all or specific parts of the message and may require the use of a particular encryption algorithm. Listing 7.5 illustrates the syntax for this element. The optional subelement identifies the encryption algorithm to be used in encrypting related message parts. The optional Type attribute confirms that an encryption algorithm is being specified (its value is set to the AlgEncryption QName), and the optional URI attribute points to the XML encryption algorithm to use. Table 7.3 lists the algorithms by category along with the identifying URI (we will discuss the algorithms, their uses, and their strengths and weaknesses in Chapter 10). The optional subelement identifies any required key formats. The optional subelement identifies the token format or authority to use, and the optional subelement identifies the token to be used for the encryption itself. LISTING 7.5
The Confidentiality Element Syntax
... ...
Communicating Policy
139
The subelement identifies the parts of the message that requestors must encrypt. The optional Dialect attribute is a URI reference identifying how to interpret contents—as XPATH 1.0 statements (the default) or as WS-PolicyAssertions-defined functions (see Table 7.4) [XPATHF02, WSPAssert02]. (Chapter 5 contains a discussion of XPATH.)
TABLE 7.3 XML Encryption Algorithms Category
Name
URI
Block
Triple DES
http://www.w3.org/2001/04/xmlenc#tripledes-cbc
AES-128
http://www.w3.org/2001/04/xmlenc#aes128-cbc
AES-256
http://www.w3.org/2001/04/xmlenc#aes256-cbc
AES-192
http://www.w3.org/2001/04/xmlenc#aes192-cbc
Stream
None
Key Transport
RSA v1.5
http://www.w3.org/2001/04/xmlenc#rsa-1_5
RSA OAEP
http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgflp
Key Agreement
Diffie-Hellman
http://www.w3.org/2001/04/xmlenc#dh
Key Wrap
Triple DES
http://www.w3.org/2001/04/xmlenc#kw-tripledes
AES-128
http://www.w3.org/2001/04/xmlenc#kw-aes128
AES-256
http://www.w3.org/2001/04/xmlenc#kw-aes256
AES-192
http://www.w3.org/2001/04/xmlenc#kw-aes192
TABLE 7.4 MessageParts Dialect Values URI
Meaning
http://www.w3.org/TR/1999/REC-xpath-19991116
XPATH 1.0
http://schemas.xmlsoap.org/2002/12/wsse#part
WS-PolicyAssertion Functions
Integrity Assertion
The element provides a way for a Web Services provider to tell a requestor the parts of a message that the provider wants to validate to ensure they
140
Enterprise Web Services Security
have not been changed and to convey information about the digital signature algorithms and capabilities that it supports. The provider may want the requestor to digitally sign the entire message or just specific parts and may require the use of particular signature, method digest, canonicalization, or transformation algorithms [EXCC14N, XMLC14N, Hughes02, SOAPSE01]. WS-Security builds on XML Signature for signature capabilities [WSSecurity02, XMLSig02]. The significance of the subelements in the element comes from the two-step process used in creating digital signatures. The first step processes the document to be signed through a standard serialization algorithm and secure hash function, such as SHA1, to create a message digest that creates a digital fingerprint for the message. The second step encrypts the message digest, using the required encryption algorithm, to create a digital signature. Listing 7.6 illustrates the syntax for the element. The optional subelement identifies the algorithms to be used in transforming and signing related message parts. The optional Type attribute identifies the type of algorithm being addressed (see Table 7.5), and the optional URI attribute points to the corresponding algorithm to use as shown in Table 7.6 by category along with the identifying URI. The optional subelement identifies any required token formats and includes one or more optional subelements identifying the token format or authority to use. The optional subelement describes any claims that must be expressed in the token. The subelement identifies the parts of the message that requestors must sign, with the optional Dialect attribute being a URI reference identifying how to interpret contents—as XPATH 1.0 statements (the default) or as WS-PolicyAssertions-defined functions (see Table 7.4). The optional Signer attribute lists a set of URIs indicating who must sign each of the nodes. The predefined URI for the original sender of the message is http://schemas. xmlsoap.org/2002/12/secext/originalSender. LISTING 7.6
The Integrity Element Syntax
... ...
Communicating Policy
141
TABLE 7.5 Algorithm Type QNames QName
Description
AlgDigest
Digest method
AlgCanonicalization
Canonicalization
AlgSignature
Signature method
AlgTransform
Transformation
TABLE 7.6 XML Signature Algorithms Category
Name
URI
Message Digest
SHA 1
http://www.w3.org/2001/04/xmlenc#sha1
SHA 256
http://www.w3.org/2001/04/xmlenc#sha256
SHA 512
http://www.w3.org/2001/04/xmlenc#sha512
RIPEMD
http://www.w3.org/2001/04/xmlenc#ripemd160
Canonical XML
http://www.w3.org/2001/ REC-xml-cl4n-20010315
With Comments
http://www.w3.org/2001/ REC-xml-cl4n20010315#WithComments
Exclusive XML
http://www.w3.org/2001/10/xml-exc-c14n
With Comments
http://www.w3.org/2001/10/xml-excc14n#WithComments
MAC
HMAC/SHA1
http://www.w3.org/TR/2001/09/ xmldsig#hmac-sha1
Reference type
Object
http://www.w3.org/TR/2001/09/xmldsig#Object
Manifest
http://www.w3.org/TR/2001/09/xmldsig#Manifest
Properties
http://www.w3.org/TR/2001/09/ xmldsig#SignatureProperties
DSA
http://www.w3.org/TR/2001/09/ xmldsig#DSAKeyValue
RSA
http://www.w3.org/TR/2001/09/ xmldsig#RSAKeyValue
X509
http://www.w3.org/TR/2001/09/ xmldsig#X509Data
Canonicalization
Retrieval method
142
Enterprise Web Services Security
Category
Signature
Transformation
Encoding
Name
URI
PGP
http://www.w3.org/TR/2001/09/ xmldsig#PGPData
PKI
http://www.w3.org/TR/2001/09/x mldsig#SPKIData
Mgmt
http://www.w3.org/TR/2001/09/ xmldsig#MgmtData
DSA/SHA1
http://www.w3.org/TR/2001/09/ xmldsig#dsa-sha1
RSA/SHA1
http://www.w3.org/TR/2001/09/ xmldsig#rsa-sha1
XPath Filter
http://www.w3.org/2002/06/ xmldsig-filter2
XSL Transform
http://www.w3.org/1999/XSL/Transform
Decrypt XML
http://www.w3.org/2002/07/ decrypt#XML
Decrypt Binary
http://www.w3.org/2002/07/ decrypt#binary
Env Signature
http://www.w3.org/2000/09/ xmldsig#enveloped-signature
Normalization
http://www.w3.org/TR/2003/NOTE-soap12-n11n-20030328/
Dereference
http://www.docs.oasis-open.org/wss/ 2004/01/oasis-200401-wss-soapmessage-security-1.0#STR-Transform
Base64
http://www.w3.org/2000/09/ xmldsig#base64
Visibility Assertion
Intermediate services such as Web Services referral or router services may need to access parts of a message—particularly the header. In choreographed services, different services may need to process different parts of the message. In some cases the service provider will want requestors to transmit the information in plaintext; in others, the service provider will want to set up separate encryption schemes for each
Communicating Policy
143
actor. The element provides a way for a Web Services provider to tell a requestor the parts of a message that must be visible to intermediaries or subsidiary processes. Listing 7.7 illustrates the syntax for this element. The subelement identifies the parts of the message that must be visible, with the optional Dialect attribute being a URI reference identifying how to interpret contents—as XPATH 1.0 statements (the default) or as WSPolicyAssertions-defined functions (see Table 7.4). LISTING 7.7
The Visibility Element Syntax
SecurityHeader Assertions
WS-Security defines the header and sets out the rules for creating header blocks within the SOAP message header. One of these rules is that intermediaries can extend a header block by prepending new elements to the existing header block. Prepending means to attach the new elements to the beginning of the header before any elements that might already exist. The prepending rule is designed to eliminate any forward dependencies for receiving services because they can process elements in the order in which they appear. The element allows a service provider to modify this rule. Listing 7.8 illustrates the syntax for this element. The optional MustPrepend attribute tells requestors whether they need to follow the WS-Security rule. When the attribute’s value is set to True, the requestor must prepend any additional entries; when it is set to False (the default), the requestor need not follow the rule. LISTING 7.8
The SecurityHeader element syntax
WS-Security builds on XML Encryption for its encryption capabilities [XMLEncrypt02]. Since WS-Security defines the header, this means encryption information can be defined in either the header or within the document itself. The optional MustManifestEncryption attribute on the element gives providers a way to tell requestors whether the provider supports inline encryption information or whether it requires that information to be
144
Enterprise Web Services Security
solely contained within the header. When the MustManifestEncryption attribute is set to True, the provider will only process encryption information contained within the header; when it is set to False (the default), the provider will search the message for applicable encryption information. MessageAge Assertions
Some authentication and authorization schemes use timestamps to help reduce the risk of replay attacks. The element gives Web Services providers a way to tell requestors the time period during which they will accept a message. The time period is based on the message creation time reflected in the message’s header element. If the time period has elapsed or the message does not include a header element, the provider can optionally discard the message. Listing 7.9 illustrates the element’s syntax. The Age attribute reflects the maximum time period in seconds. LISTING 7.9
The MessageAge Element Syntax
Putting It Together: An Example Now that we have described both the policy framework and assertion grammars, let’s look at an example. Let’s suppose a Web Services provider wants requestors to optionally provide either an X.509 certificate or Kerberos service ticket, to optionally encrypt the message body using AES, and to sign the message using SHA1 to create the message digest and RSA to encrypt the result. The example policy specification in Listing 7.10 shows one way of stating this policy. LISTING 7.10
Security Policy Example
X509v3 Kerberosv5ST
Communicating Policy
145
wsp:Body wsp:GetInfosetForNode(wsp:GetBody(.))
The policy begins by stating that the provider will accept an X.509 certificate, a Kerberos service ticket, or no security token at all. The combination of the and subelements give us this last result. The assertion says requestors can optionally encrypt the message body using the AES algorithm and a 128-bit key. The Optional attribute on the opening tag being set to True specifies that encryption is optional. The subelement uses the Body function from Appendix II of WS-PolicyAssertions to identify the message elements to encrypt. The subelement has its Optional attribute set to false, indicating that requestors must sign the message body. The Algorithm subelement specifies that requestors are to use XML Canonicalization to serialize the
146
Enterprise Web Services Security
message body before using SHA1 to create the digest and RSA to encrypt the digest value. The subelement uses an XPATH 1.0 expression and a GetBody function from Appendix I of WS-PolicyAssertions to identify the Body element. The Signer attribute designates the original message sender as the party that must sign the message.
WS-POLICYATTACHMENT Web Services PolicyAttachment (WS-PolicyAttachment) defines the grammatical elements necessary for tying policies to policy subjects [WSPAttach04]. WSPolicyAttachment also describes how to use these mechanisms with WSDL and UDDI, making policy discovery part of service discovery. Finally, given the variety of ways policies can be tied to subjects, WS-PolicyAttachment discusses how multiple policies translate into effective policies. Tying Policies to Subjects A policy subject is a provider, a service, an endpoint, a message, or an interaction that a Web Services provider wants to constrain, influence, or control through policy. WS-PolicyAttachment extends WS-Policy to the attributes and elements for tying policy expressions to policy subjects. XML resources and resource descriptions can make the tie either intrinsically as part of the XML itself or externally through a separate document. XML resources can intrinsically tie policy expressions to policy subjects in any of three ways. WS-PolicyAttachment defines the PolicyURIs attribute for tying a policy expression directly to an XML element through an attribute reference as shown in the first example in Listing 7.11. A second option is to include the policy expression as a child element of the affected element as shown in the second example in Listing 7.11. A third option is to include references to the policy expression as shown in the third example in Listing 7.11. LISTING 7.11
Tying Policy Expressions to Policy Subjects
...
Communicating Policy
147
... ... ... ... ...
WS-PolicyAttachment also provides for externally tying policy expressions to policy subjects. WS-PolicyAttachment defines the element shown in Listing 7.12 for this purpose. The subelement identifies the policy subjects to whom the policy applies and establishes the policy’s scope. The policies described in subsequent elements apply to all the policy subjects within the policy’s scope. The example uses WS-Addressing to define an end point reference for this purpose. The optional subelement attaches the policy expression. Alternatively, you could have used a element to link to an external policy expression. The optional subelement allows you to attach any additional security information to the policy. WS-Security, which we will discuss in detail in Chapter 11, defines the syntax for this element.
148
Enterprise Web Services Security
LISTING 7.12
The PolicyAttachment Element Syntax
http://www.xyz.com/addr http://www.xyz.com/PT http://www.xyz.com/SN ... ...
Making Policies Discoverable WS-PolicyAttachment defines two ways to make policies discoverable. One way is to attach policy references to the WSDL elements corresponding to the policy subjects, and the other is to attach the policies through entries in a UDDI registry. Attaching Policies Using WSDL
Web Services providers communicate service interface descriptions to service requestors through WSDL documents. The WSDL service description is made up of a combination of abstract and concrete elements describing the service and how it ties to the underlying physical network. From a security policy perspective, a WSDL document provides attachment points for associating security policies with four types of policy subjects: service, endpoint, operation, and message, through the related set of WSDL elements corresponding to these subjects. You attach policies to these elements using either the policyURIs attribute or the subelement described earlier. You must also include a subelement, which includes the wsdl:required=”true” attribute, as part of the WSDL document’s element to alert requestors that they must be able to process the security attachments. If you want to include the element within the WSDL document, you should include it in the element and reference it from other WSDL elements.
Communicating Policy
149
Service Policy Subject
Attaching security policies to the element allows you to specify policies that affect the service as a whole. Endpoint Policy Subject
Attaching security polices to the , , or elements defining an endpoint allows you to specify policies that affect a particular implementation of a service. You should only attach binding independent assertions to shared elements to avoid unintended side affects. Operation Policy Subject
Attaching security policies to the subelement belonging to either a or element allows you to specify policies that affect a particular message sequence. Again, you should only attach binding independent assertions to shared subelements to avoid unintended side affects. Message Policy Subject
Attaching security policies to the , , , or subelements pertaining to a message or a message exchange allows you to specify policies affecting that message or exchange. Again, you should only attach binding independent assertions to shared subelements to avoid unintended side affects and you should also exercise care in attaching policies to outbound messages or message sequences unless you are sure or have provided a way for requestors to handle or negotiate the sequence. Attaching Policies Using UDDI
Web Services providers have two options for attaching security policies to service provider, service, and endpoint policy subjects through UDDI. One option is to directly reference remote policy expressions in the UDDI entities corresponding to the different types of policy subjects; the other option is to register the policy expression as a technical model in the UDDI registry and to then reference that tModel entry from other UDDI entities. Table 7.7 maps policy subjects to their corresponding UDDI structures. TABLE 7.7 Mapping Policy Subjects to UDDI Structures Policy Subject
UDDI Structure
Service provider
businessEntity
Service
businessService
Endpoint
tModel and bindingTemplate
150
Enterprise Web Services Security
Direct Reference Model
If a security policy only applies to a single service or endpoint, or if you have a universal policy that applies across your organization, then directly referencing the policy expression within the UDDI entities describing your organization, service, or endpoint is an option. WS-PolicyAttachment defines a new UDDI tModel entry, called the Remote Policy Reference category system, to support this type of reference. UDDI entities that have elements (, , and ) take advantage of this capability through subelements to the element. The tModelKey attribute on the element is set to the Remote Policy Reference tModel key (see Table 7.8 for a list of tModel types and their UDDI V2 and V3 keys), and the keyValue attribute is set to the URI of the remote policy expression. UDDI entities, such as the structure, that do not have subelements take advantage of this capability through their child element. To use this approach, you set the tModelKey attribute on the element to the Remote Policy Reference tModel key and put the URI reference to the remote policy expression into the subelement of a child element.
TABLE 7.8
tModel Types and Keys
tModel Type
UDDI V2
UDDI V3
Remote reference
uuid:a27078e4-fd38-320a-806f6749e84f8005
uddi:schemas.xmlsoap.org: remotepolicyreference:2003-03
WS-Policy type
uuid:fa1d77dc-edf0-3a84-a99a5972e434e993
uddi:schemas.xmlsoap.org: policytypes:2003-03
Local reference
uuid:a27f7d45-ec90-31f7-a655efe91433527c
uddi:schemas.xmlsoap.org: localpolicyreference:2003-03
Registration Model
What if you want to share the policy expression across service providers, services, or endpoints? In that case, you need to be able to register the policy expression within the UDDI registry and then create references to the registration rather than to the policy expression itself. WS-PolicyAttachment defines two new UDDI tModel entries to support registering and referencing policy expressions in this way. One entry is for creating tModel entries registering the policy expression itself; the other
Communicating Policy
151
supports other UDDI entities, such as , , , and elements, referencing the registered policy using tModelKeys by providing an appropriate interpretation of the reference meaning. The tModel entry that defines the category for registering remote policy expressions is called the WS-Policy Types category system. Listing 7.13 illustrates a tModel that uses this category system to create a registered policy expression. The subelement contains two child elements. The first uses the WS-Policy Types category tModelKey to identify the tModel as belonging to the “policy” category. The second child element’s keyValue attribute contains the URI of the policy expression; its tModelKey attribute uses the Remote Policy Reference tModelKey to indicate that it is a remote policy reference. Once created, the tModelKey for the tModel structure becomes the key for referencing the registered policy. WS-PolicyAttachment defines the Local Policy Reference category system to allow UDDI entities such as , , , and elements to reference and properly interpret registered policies. Entities with entries set the tModelKey attribute on the element to the Local Policy Reference tModelKey (see Table 7.8) and the keyValue attribute to the tModelKey of the registered policy expression. Entities that use entries set the tModelKey attribute on the element to the Local Policy Reference tModel key and the subelement of a child element to the tModelKey of the registered policy expression. LISTING 7.13
Policy Expression Reference
... Sample Policy tModel A WS-Policy Policy Description http://www.xyz.com/wspolicy
Effective Policy Web Services providers have a number of different options for attaching policy expressions to policy subjects. As we discussed above, policy subjects include the provider, the service, the endpoint, the operations making up a transaction, and the messages constituting a transaction. The provider can attach policy expressions affecting some policy subjects via both WDSL and UDDI attachment points. A question you would naturally have is, “how do service requestors properly interpret multiple policy expressions when they overlap?” WS-PolicyAttachment defines a merge process for creating an effective policy for a policy subject. A policy subject’s effective policy is the combination of relevant policies from all the policy scopes that contain the policy subject. You create the effective policy for a policy subject by first determining the policy scopes that include the policy subject and then serializing the policy expressions within those scopes. The serialization process involves changing each policy expression’s element into a element, combining it with other expressions affecting the policy subject, and wrapping the final result with a tag. How do you determine the policy scopes that contain a policy subject? The policy scope is the set of policy subjects to which policy expressions within that scope apply. As we have discussed, the policy scope for any given policy expression is determined by its attachment point. Policy expressions attached to UDDI structures have provider scope; those attached to UDDI structures or WSDL elements have service scope, and those attached to UDDI or structures or to WSDL , , or elements have endpoint scope, etc. As a general rule, a policy expression attached to an element has an element scope that is an intrinsic part of the element’s definition and applies to all uses of that element. In situations where multiple elements create a policy subject, the effective policy must merge the element policies of the constituent elements. For example, the effective policy for an endpoint merges any policy expressions attached to WSDL , , and descriptions forming the endpoint. In cases where both
Communicating Policy
153
UDDI and WSDL descriptions of a policy subject contain policy expression attachments, the effective policy must merge both sets of descriptions. When attaching policy expressions to Web Services elements, it is important to keep scope in mind to avoid unintended consequences.
SUMMARY WS-Policy creates a basic framework for describing and communicating policies made up of sets of rules or assertions. We discussed WS-Policy’s normal and compact forms for writing policy documents and presented a simple and a more complex scenario illustrating these forms. WS-SecurityPolicy adds the security-specific assertion elements Web Services providers need to communicate security token, integrity, and confidentiality requirements and constraints to requestors. We went into detail regarding the elements available for representing SecurityToken, Confidentiality, Integrity, Visibility, SecurityHeader, and MessageAge assertions. WS-PolicyAttachment completes the picture, enabling providers to make their policy requirements discoverable either intrinsically through their service’s interface or through the service’s associated WSDL or UDDI description.
REFERENCES [EXCC14N] Boyer, John, et al., “Exclusive XML Canonicalization Version 1.0.” Available online at http://www.w3.org/tr/xml-exc-c14n/, July 18, 2002. [Hughes02] Hughes, Merlin, et al., “Decryption Transform for XML Signature.” Available online at http://www.w3.org/tr/xmlenc-decrypt, August 2, 2002. [Roadmap02] Microsoft Corporation and IBM Corporation. “Security in a Web Services World: A Proposed Architecture and Roadmap, A Joint White Paper from IBM Corporation and Microsoft Corporation.” Version 1.0. Available online at http://www-106.ibm.com/developerworks/webservices/library/wssecmap, April 7, 2002. [SOAPSE01] Brown, Allen, et al., “SOAP Security Extensions: Digital Signature” Available online at http://www.w3.org/tr/soap-dsig, February 6, 2001. [WSPAssert02] Box, Don, et al., “Web Services Policy Assertions Language (WSPolicyAssertions) Version 1.1.” Available online at http://www.verisign.com/ wss/WS-PolicyAssertions.pdf, May 28, 2002. [WSPAttach04] Siddharth, Bajaj, et al., “Web Services Policy Attachment (WSPolicyAttachment).” Available online at http://ifr.sap.com/ws-policy/ws-policyattachment.pdf, September 2004.
154
Enterprise Web Services Security
[WSPolicy04] Siddharth, Bajaj, et al., “Web Services Policy Framework (WSPolicy).” Available online at http://ifr.sap.com/ws-policy/ws-policy.pdf, September 2004. [WSSecurity02] Atkinson, Bob, et al., “Web Services Security (WS-Security) Version 1.0.” Available online at http://www-106.ibm.com/developerworks/ webservices/library/ws-secure/, April 5, 2002. [WSSP02] Della-Libera, Giovanni, et al., “Web Services Security Policy Language (WS-SecurityPolicy) Version 1.0.” Available online at http://www.verisign. com/wss/WS-SecurityPolicy.pdf, December 18, 2002. [XMLC14N] Boyer, John, et al., “Canonical XML Version 1.0, W3C Recommendation.” Available online at http://www.w3.org/TR/xml-c14n, March 15, 2001. [XMLEncrypt02] Eastlake, Donald, et al., “XML Encryption Syntax and Processing.” Available online at http://www.w3.org/tr/xmlenc-core, August 2, 2002. [XMLSig02] Eastlake, Donald, et al., “XML Signature Syntax and Processing.” Available online at http://www.w3.org/tr/xmldsig-core, February 12, 2002. [XPATHF02] Boyer, John, et al., “XML-Signature XPATH Filter 2.0.” Available online at http://www.w3.org/tr/xmldsig-filter2, July 18, 2002.
8
Protecting the System Components
In This Chapter Security Controls for the System Components The Client Workstation Vulnerabilities Operating System Security Browser Security Downloading Components ActiveX Security Java Security Scripting Plug-ins The Network Network Vulnerabilities Wireless Communications Firewalls Gateways, Guards, and Routers Virtual Private Networks Servers Web Server Vulnerabilities Operating System Security Summary References
n Chapter 6 we talked about two ways of looking at enterprise security: from the inside out (which is the way the security policy must view it) and from the outside in (which is the way any given Web Service views it). We also discussed the importance of a layered approach to implementing policy where services can build on lower layers to maintain consistency while minimizing redundancies and the
I
155
156
Enterprise Web Services Security
potential for conflicts across layers. We begin our discussion of what it really means to implement a security policy with a discussion of what it means to implement security protection mechanisms at the network and systems levels. While deciding on what measures to take to protect your system, you must consider the protections for the components that make up that system, including the hardware, the software, and the network. Concentrating on security measures for the software alone may not be enough. In this chapter we discuss the security concerns for the system itself. This chapter concentrates on the physical components of the Web Services system and identifies the weaknesses in those components that should be considered when implementing security controls.
SECURITY CONTROLS FOR THE SYSTEM COMPONENTS Deciding what security measures to implement to help protect a system can be daunting. A complex distributed system may pose a difficult problem for the people responsible for securing that system simply because the system as a whole is too large to understand. Distributed control of the system components also makes securing that system difficult, as you may need to interact with several people to enforce good security controls. A common way of dealing with such complex problems is to divide them into smaller pieces and decide on appropriate controls for each of those subcomponents. While the components aren’t used in isolation because they are part of the overall system, protections for each of those components can be combined to help protect the system as a whole. The component-level view is particularly appropriate for a Web Services system, as will be seen. For a Web Services system, the obvious components are the user’s Web browser, the servers that support the Web Services application, and the network that allows those components to communicate. For each of these components, we will describe threats and countermeasures that can be used to protect them.
THE CLIENT The client is possibly the most important component to consider because there are so many more clients than there are servers. Also, the client is something that the Web Service designer cannot choose or control. While a system could be designed to work with a limited number of client configurations (only one client operating system or one type of Web browser), that’s not practical or reasonable. A key advantage of Web Services is their dependence upon open systems standards, which makes them platform and vendor independent. Restricting the system to a small
Protecting the System Components
157
number of client types gives up much of the advantage of a Web-based system. A Web Service application must work properly with different host systems (Windows 9x, Windows 2000, Linux, and UNIX) and with different revisions of the software running on the client. A Web Service system should not fail just because a client installs a browser patch or an operating system patch. Unfortunately, the client is the one component that the Web Services designer cannot control. The client can choose different operating systems (Windows, UNIX, or Mac), different Web browsers, and so forth. The possible combinations of client configurations may make the Web Services system more complex as it attempts to adapt to the client base. This additional complexity increases the chances of there being an undiscovered flaw in the system.
WORKSTATION VULNERABILITIES The Web Service user interacts with the system using a Web browser running on his computer system. We refer to this as a workstation, where this includes whatever type of computer system the user is using, be it a desktop, a laptop, or possibly even a mobile phone running a wireless application protocol (WAP)–enabled browser. The Internet Engineering Task Force’s RFC 2504, User’s Security Handbook [RFC2504], provides a basis for understanding the risks that users are exposed to simply being connected to the Internet. This RFC provides helpful guidance for network end users and system administrators in a very approachable form. This document can form the basis of a useful security awareness program with little additional effort. Physical protections for the user’s workstation are the responsibility of the system owner and operator. This means the responsibility for properly operating a PC falls upon the user of that PC. Unfortunately, history has shown that users are not particularly careful about what software they allow on their systems. For example, this lack of caution causes the wide spread of the Bagel (or Bagle) worm [Keizer04]. Bagel spreads from host to host through the use of email messages and leaves a remote-control zombie on the infected system. The zombie is a piece of software that waits for commands from a control host over the Internet. Anyone who has the remote control program for that particular zombie program can use it to manipulate the infected system. Once a system is compromised with a zombie, it’s available for outsiders to use to spread spam, attack other systems, or act as part of a distributed denial-of-service attack. These infected machines are referred to as bots (short for robots). Networks of bots are called botnets. The wide spread of zombies is demonstrated by the fact that botnets are available for sale to be used in network attacks and spam floods [Kapersky04].
158
Enterprise Web Services Security
The possibility that the user’s workstation is infected by a worm or bot becomes a problem for Web Service designers because their service interacts with the user via a Web browser running on the user’s workstation. Text is in plaintext format; authentication, confidentiality, and integrity services may run locally; local cache and keystores are accessible from the workstation, which all makes workstation vulnerabilities difficult to defend. If a zombie is installed, it may record the user’s input (such as passwords) or spoof user input to trick the service into performing some illicit operation. The service designer must be careful to not depend too heavily on the security of the user’s workstation. Some simple steps can be taken to ensure that there really is a human at the workstation and not a bot. For example, CAPTCHA (completely automated public Turing tests to tell computers and humans apart) tests are used to verify that a human is driving the application, not a bot [vonAhn04]. Similar schemes should be used to verify that the workstation really is operating on the user’s behalf. Another problem with trusting the user’s workstation concerns the integrity of data stored on that system. It may be exposed if left in the clear (stored in unprotected disk files). Cookies, files, and other content stored on the user’s workstation should be protected using cryptographic methods. Sensitive information should be processed in a way that minimizes exposure to other software operating on that workstation, as that software may or may not be benign.
OPERATING SYSTEM SECURITY Responsibility for much of the security enforcement for a Web Services system falls upon the operating system that controls the client and the server systems. The operating system is expected to enforce process isolation to keep programs from interfering with each other and to provide memory access controls to keep one program from tampering with the contents of memory owned by another process. Enforcement of confidentiality and integrity protections for service data relies upon the operating system. If the operating system doesn’t work correctly or doesn’t include the necessary fundamental constructs, applications no longer have the protections they expect. For example, the absence of task and address space constructs and the shared memory concepts in early operating systems such as DOS and Windows 3.x made them notoriously difficult to secure. These flaws have been corrected in modern operating systems. Fortunately, the operating system features that support these isolation requirements are generally well-tested, low-level features of the operating systems. In most cases, the protections are dependable and work as expected. However, any operating system must be maintained to ensure that any detected flaws are corrected in a
Protecting the System Components
159
reasonable length of time. The critical systems that comprise the Web Service system must have patch processes in place so that any detected flaws are corrected before they can be exploited. Commercial operating systems, such as UNIX and Windows, are certified at the C2 level under the Orange Book scheme and at the EAL 4 level under the Common Criteria scheme and therefore represent some degree of risk in highly restricted environments. (See Chapter 3 for details on these evaluation schemes.) Policies should, at a minimum, require disabling features such as guest and administrator accounts and locking down key systems directories and files such as root, the systems registry, and configuration and password files. Operating system security checklists are available to help secure the systems being used to host your Web site. The National Security Agency (NSA) security guides at http://www.nsa.gov/snac/ [NSA05] cover Windows, Sun Solaris, and Mac OS and are very well respected. A Web server configuration guide provides detailed guidance on how one should protect a Microsoft Web server from attack. The Microsoft checklist at http://msdn.microsoft.com/library/en-us/dnnetsec/html/CL_ SecWebs.asp provides a simple checklist that helps ensure that your servers are not misconfigured. Another good source for lockdown information is the Center for Internet Security (http://www.cisecurity.org).
BROWSER SECURITY A Web Service designer needs to interact with the service user to receive requests and respond with results. Usually this interaction with the user occurs using the user’s Web browser. One problem with this is that browsers are fairly limited in how they can accept input and provide responses. The form-based methodology that is part of the native HTML standard is a simple fill-in-the-blank form scheme that does not allow the browser to verify the user’s input. The user fills in the form and submits it to the server, and the server verifies the input. If anything is wrong, the server must ask the user to try again. Effectively, the user’s browser is used like a dumb terminal even though there’s usually a PC with a full-featured graphical user interface (GUI) that could easily be used to offload the verification process. Complex GUI operations such as click-based selections are difficult to do with a standard Web browser. Two technologies were created to solve this problem by allowing the browser to execute software on the user’s system that can be used to extend the browser’s capability while working with the user. Microsoft’s offering is ActiveX. Sun’s Java language is the second major option. In order to better understand some of the security challenges these technologies pose, let’s look at the overall browser architecture and how it operates.
160
Enterprise Web Services Security
Figure 8.1 illustrates a notional Web browser architecture. While both Microsoft Internet Explorer and Netscape Navigator support most of the same capabilities, Internet Explorer has componentized more of its architecture (that is, breaking the monolithic browser code into smaller components that can be reused for other purposes) making the corresponding components’ dynamic link libraries (DLLs) available to other applications. Much of the controversy that has surrounded Microsoft has concerned their making these components integral components of the operating system. Some of the components shown in our notional architecture provide similar functions but are necessary to support the two major technologies driving Web Services applications development today: Microsoft’s .NET and Sun’s J2EE (Java 2 Enterprise Edition). We will briefly discuss each component in our notional architecture below and in greater detail in subsequent sections as we turn to specific security concerns.
Cache
Javascript/ VBScript Interpreter
Display Engine
JAVA Virtual Machine
HTML Interpreter
Common Language Runtime
Browser Operating System
FIGURE 8.1 Web browser architecture.
First and foremost, the Web browser is a requester. Given a URL, the Web browser requests the Web page and whatever other application elements are necessary to satisfy the request from a Web server. The Web browser determines the pro-
Protecting the System Components
161
tocol to use in making its request from the URL. In most cases, the requests are made using HTTP. The Web browser communicates with the Web server over a direct, TCP/IP connection or via a dial-up SLIP or PPP connection. In both cases, a sessionless protocol is used (this is a protocol that does not use a persistent connection; the Web browser connects to the server and makes a request, the server honors the request, and the Web browser disconnects). If a request is made up of multiple components, each represents a separate request to the server, as there is no connection or session that allows the server to connect them together. To improve performance over slow or congested networks, the Web browser provides a cache for previously downloaded pages and objects. Before requesting that a page or object be downloaded, the browser checks to see if the needed item is already available in its cache. If it is, the browser uses it, thus saving the overhead of downloading another copy. As the Web browser downloads inputs, it makes a determination of how that input is to be handled: by one of the Web browser’s built-in components, by helper or plug-in applications, by one of the browser’s runtime execution engines, or by launching another application. These decisions are made on an element-by-element basis based on content type. The Web browser makes its determination of content type based on either the response header returned from the server or the file extension associated with the content. For example, a file extension of either .htm or .html denotes content in HTML format. The Web browser uses its HTML interpreter to interpret and process HTML input. Since most Web pages are written in HTML, the HTML interpreter is generally the first component invoked on a new input stream. The HTML interpreter governs the invocation of other elements, calling them into service as dictated by the input stream. As the Web browser receives HTML documents from the server, The HTML interpreter parses the HTML content, formats it for display, passes displayable content to the display engine for presentation, and resolves linkages to other documents, objects, or content. During this interpretation process, the HTML interpreter may encounter inputs that it cannot handle directly. When that happens, the HTML interpreter invokes the necessary component based on the type of input in question. The determination of which component to invoke is made based on information provided as an attribute on the HTML statement referencing the input or on the file type of the content. The three most common types of contained content are applets, multimedia internet mail extension (MIME) types, and objects. Once launched, the component is either given or pointed to a file containing the content in question and interacts with the Web browser throughout the display and navigation of that content. The Web browser’s display engine may begin displaying content before all the elements of a page are downloaded. This feature provides the illusion of quicker response in a low bandwidth environment. The display engine will normally
162
Enterprise Web Services Security
maintain a wait cursor until all the elements of a page are fully downloaded and resolved. The display engine displays the interpreted document in its main window. While the document is being displayed, the Web browser is responsible for processing keyboard and mouse events and implementing basic display features such as scrolling. The display engine also creates the runtime environment and is responsible for communicating events across components, interacting with components to refresh and signal focus changes, launching components in response to user events, and detecting and initiating requests for new Web pages through inputs to the Web browser’s location window, selections from the history list, or actions on the Web page, such as the user clicking on a submit button, that request a new page be loaded. In addition to controlling the display and navigation of the document, the Web browser’s display engine also acts as a hypertext linker. The display engine detects when the user clicks on a link, takes the URL corresponding to that link, and communicates with the Web server to transfer and display the information represented by that URL. The link may be displayed in the Web browser’s main window, in a frame within that window, or in another instance of the Web browser. A major architectural component that can come into play during both the interpretation and display process is the Web browser’s scripting language interpreter. The Web browser first detects scripting language programs in its inputs during the HTML interpretation process. Some scripting language directives may be aimed at controlling initial appearance or default values of some content, in which case the script is interpreted prior to display; others are conditionally invoked in response to the user clicking a button, selecting a value, or entering an input, in which case the scripting language is executed in response to those events. Modern Web browsers at a minimum support JavaScript and VBScript, either directly or through third-party extensions, and implement basic scripting events for communicating with and controlling other browser elements. The scripting languages can generally be used interchangeably, letting you mix and match as you choose. The Web browser loads, initializes, and passes content it cannot process itself to other components. The content may either be encapsulated within tags or passed through a file, with a .JAR, .EXE, or .DLL extension, on an , , or tag. Many of your Web Services will be invoked through this mechanism. When the Web browser detects JAVA applets or applications, it launches the Java Virtual Machine (JVM) and passes the applet or application to the JVM for execution. The Web browser in conjunction with the JVM creates and maintains a Java environment. Once initialized, the environment is maintained for the remain-
Protecting the System Components
163
der of the session. JavaScript can be used to control browser events and to communicate among Java applets and Java-based objects, for example, JavaBeans. When the Internet Explorer Web browser detects managed code, it launches the Common Language Runtime (CLR) and passes the code to the CLR for execution. Managed code is in the form of either an .EXE or .DLL file containing executable content in the form of Microsoft’s Intermediate Language (MSIL). As with JVM, the Web browser and CLR operate together to create and maintain an environment to support these components, and that environment is maintained for the duration of the user’s session. JavaScript or VBScript can be used to control browser events and to communicate among managed components. Instead of trying to anticipate every possible type of content and providing a “universal display engine” capable of recognizing and displaying that content, the Web browser framework implements an extensible way for Web browsers to be aware of, yet not directly responsible for, displaying that content: helper applications and plug-ins. Helper applications and plug-ins are generally responsible for understanding and displaying one or more MIME types. MIME types include formats for sound, graphics, and video. When this type of information is encountered, the Web browser launches either a helper application or plug-in to aid in its presentation. Figure 8.2 illustrates the relationship between the browser and these elements. Plug-ins can be implemented in either of two ways: internal or external. Internal plug-ins execute in the context of the browser, usually as a separate thread. External plug-ins and helper applications execute as separate applications in their own address space. The Web browser determines the MIME type associated with an element of content from its file extension. JPEG, GIF, and AVI are common MIME types detected in this manner. The Web browser uses associations to map either a helper application or plug-in to a given MIME type. Once an association is created, the Web browser launches the appropriate application when that MIME type is detected. Originally, helper applications and plug-ins were the only way to extend the browser to handle special inputs. Microsoft found this too limiting and decided to make the Web browser an object linking and embedding (OLE) container and introduced the idea of being able to extend the browser through ActiveX objects. This was more in keeping with Microsoft’s Active Desktop® concept at the time. The Web browser detects the presence of ActiveX objects as part of an tag reference. The object may already be present and registered on the client, in which case it is used. If it is not, the Web browser downloads the object and provides it with the associated content for processing or display. ActiveX objects can be implemented as either in-process or out-of-process servers as illustrated in Figure 8.2. In-process servers are similar to plug-ins executing within the context of the browser. Out-of-process servers execute as separate applications.
164
Enterprise Web Services Security
ActiveX In-Proc Server
ActiveX Out-of-Proc Server
Internal Plug-Ins
External Plug-Ins
Helper Applications
Browser Operating System
FIGURE 8.2 Plug-in and ActiveX environments.
DOWNLOADING COMPONENTS Helper applications, plug-ins, and ActiveX controls generally aren’t installed with the browser. Instead, they are downloaded either at the direction of the user or on demand. They are needed when the browser encounters a MIME type that it cannot render without the assistance of one of these components. The URL associated with the content specifies the server from which the component should be downloaded. The tag provides PLUGINURL and PLUGINPAGE attributes for this purpose; the tag provides a CODEBASE attribute. Helper applications and plug-ins are normally downloaded using the Java Archive (JAR) facility. This facility is invoked whenever an unregistered MIME type is encountered. The Web browser checks the PLUGINS directory on startup and registers all the helper applications and plug-ins found. The Web browser uses
Protecting the System Components
165
these applications to render the associated MIME type when that MIME type is encountered in a Web page. If the plug-in, or helper application, is not registered, the browser will download it from the specified server location via the JAR Manager. The steps involved in downloading a plug-in, or helper application, include: Determining the IP address of the server specified in the , or , tag’s PLUGINURL, PLUGINPAGE, or CODEBASE attribute from the domain name service (DNS) server Sending a POST or GET request specifying the name of the file to be retrieved Receiving the file from the server Saving the file in the PLUGINS directory Exploding (decompressing) the files Registering the file for the associated MIME type JAR files are compressed archives that use the same structure as ZIP files [Sun99]. This means the file may contain several files and directories. The JAR file should contain a special directory, META-INF, which contains instructions for registering and authenticating the contents. The META-INF directory will normally contain a manifest file, signature instruction files, and signature files. The manifest file contains a list of all the signed files. ActiveX controls follow a similar process. The steps involved in downloading ActiveX controls include: Determining if the correct version of the component is already resident Determining the IP address of each server specified in the Internet search path from the DNS server Sending a POST request specifying the name of the file to be retrieved Receiving the file from the server, if it is available Saving the file in the \windows\system\occcache directory Checking to ensure the file is safe to install Installing the file on the machine Registering the file Some of the differences in Microsoft’s approach to downloading ActiveX controls include the approach to locating the file to download, the approach to verifying the file, and the approach to registering the control. The Internet search path is specified in the registry and consists of three elements: URLs to be searched prior to CODEBASE, CODEBASE, and those to be searched following CODEBASE. The URLs before CODEBASE in the search sequence provide the means to specify cache, or more trusted, servers. Those following can be used to specify standard distribution points to be used if CODEBASE is not available. The
166
Enterprise Web Services Security
Internet search path is specified in the registry under the CodeBaseSearchPath key. The key is located under the InternetExplorer section of HKEY_CURRENT_USER\ Software\Microsoft. The CodeBaseSeachPath is specified in the form CodeBaseSearchPath=;;...;CODEBASE; ;...
To verify that the file is safe to install, call Windows Trust Provider Service function. WinVerifyTrust ensures that the component has been properly signed. Windows Trust Provider Service uses a hierarchical certificate structure to verify the signature. As previously mentioned, files are installed in the \windows\system\occcache directory. The files installed here may have been packaged in any of three ways: as a portable executable (PE) image file, a digitally signed cabinet (CAB) file, or as an information (INF) or setup script file. PE files are single files that are downloaded in uncompressed format from the server to the browser. CAB files are downloaded as a single file, but they can contain any number of files. CAB files are compressed using the Lempel-Ziv-Welch compression algorithm and normally contain an INF file to control their installation. INF files contain directions for downloading and installing a set of files. The INF file can point to files on multiple servers. When INF files are used to package an application, the INF file is not compressed. After the control is downloaded, the final step before activation is registration. The control is used to register the component. For DLLs, the browser calls the DLL’s DllRegisterServer method to complete the registration process. For EXEs, the browser launches the EXE with a /RegServer command line parameter. Microsoft introduced managed code components as part of its .NET architecture. In many respects, managed code objects are similar to ActiveX objects. The biggest advantage of managed code objects is that they do not have to be registered before they can be used. Managed code components are ones that have been compiled into MSIL and packaged as part of an assembly. An assembly may span files, so one or more files may have to be downloaded as part of the process. The assembly forms a complete package containing the code in the form of executables or DLLs, resources, such as bitmaps, and metadata. Each assembly contains a manifest describing its contents. The manifest includes versioning information composed of a four-part compatibility version (major version number, minor version number, build number, and revision number) and a human-readable informational version. The manifest also includes a hash of its contents, which is encrypted. The Web browser decrypts this number, recomputes the hash, and compares the results to ensure the code has not been changed. Finally, the assembly also contains the publisher’s public key and Rivest, Shamir, and Adleman (RSA) digital signature, which can be used to identify WinVerifyTrust
Protecting the System Components
167
the assembly with its publisher. Microsoft’s Authenticode® can be used to associate the publisher with the assembly as will be explained later.
ACTIVEX SECURITY ActiveX is built on Microsoft’s OLE technology. Microsoft developed OLE as a model for integrating applications based on its Component Object Model (COM). COM is an object model that enables two applications to communicate without either having to know how the other is implemented. OLE uses lightweight remote procedure calls (LRPC) to marshal requests between objects executing on the same machine and the Distributed Component Object Model (DCOM) to implement distributed objects. DCOM is implemented on top of the distributed computing environment (DCE) RPC specification. Microsoft introduced managed code with its .Net framework to overcome many of the disadvantages associated with ActiveX. When ActiveX was first introduced, executing components on the client meant downloading compiled, executable code onto the workstation and giving control to that code. With .Net, Microsoft has introduced the idea of an “intermediate language” and managed code, which is very similar in concept to Sun’s Java, and a just-in-time compiler as part of its CLR to solve some of the problems with downloading and executing raw executables. Managed code is written using any .Net-enabled language—C++, Visual Basic®, or C#—and executes within a CLR environment. CLR creates a standard set of base capabilities every component can draw upon. Additional services are layered on this base to create a rich runtime environment that is available to a component regardless of whether it is simply derived from a base class or built as a complex custom control. Much of the power of managed code components, like that of their ActiveX counterparts, comes from their ability to draw upon all the resources available from the underlying operating system and network. Given the large number of ActiveX components available and in use, you will likely find yourself in a situation where you are using managed code components to call ActiveX controls or vice versa. The call cannot be made directly because ActiveX controls are unmanaged code components and are based on Microsoft’s COM. Microsoft .NET Interop services provide the proxy capabilities needed to support the call across the managed code–unmanaged code boundary. Controls
An ActiveX object is an example of a COM control. A control is an object that encapsulates a user interface and associated control software in a form that allows the
168
Enterprise Web Services Security
control to be dynamically invoked as part of a user interface. This means the control has a user interface (for example, an image that the user can click on to cause the image to rotate) and software for managing that user interface. The control is packaged in a form that allows it to be installed in memory and activated by the user’s Web browser, using the same window as the user’s browser to display its interface. This allows seamless extension of the capabilities of the user’s browser. ActiveX controls allow extension of the browser’s user interface to include almost anything a local user interface program can do. Complex GUIs are possible that allow a Web Service to extend the user’s browser in nearly arbitrary ways [Act05]. Downloadable ActiveX controls exist for database processing, graphics processing, and multimedia display. ActiveX controls can be built and tested using standard Microsoft application development environments and can be written in several different programming languages. The Microsoft Visual Studio® programming environment makes implementation of a new ActiveX control a relatively easy job. While ActiveX allows very complex extension of the user’s browser, it has some disadvantages. ActiveX is a Microsoft proprietary technology that uses Windows operating system calls to set up and operate the control’s user interface. Native support for ActiveX is available in the Microsoft Internet Explorer browser; use of ActiveX with other Web browsers requires additional software to allow the control to execute. Some browsers do not have the ability to use ActiveX at all. Use of ActiveX thus limits the use of a Web Service to those users running an acceptable browser and to those running a Windows operating system on an Intel x86 family CPU. A more serious concern when ActiveX is in use is that the code incorporated in the ActiveX control executes in the user’s browser, using the user’s permissions and rights. Anything that user is permitted to do can be done by the control. Worse, the control contains native Windows application code, meaning the control is not restricted to only safe operations within a well-defined context. (In the next section we will discuss how Java attempts to correct this problem using its virtual machine and sandbox concepts.) This was demonstrated by an example ActiveX control that shut down the user’s PC when it was invoked [McLean97]]. Authenticode
It would be very unsafe to allow people to put controls on their Web sites that get downloaded and executed in a user’s Web browser with no limitations on what gets executed. Allowing this would make ActiveX a perfect mechanism for executing malicious code, also known as malware. Malicious code is software written to inflict some harm on the targeted system. This harm may take several forms. For example, malware could erase system files, expose user data to unauthorized individuals,
Protecting the System Components
169
and use the victim’s machine to assist in spreading copies of itself (a network worm). To help solve this problem, Microsoft uses a system called Authenticode [TechNet05] to protect against malicious code. Authenticode uses a code signing technique to validate the source of an ActiveX control. A digital signature for the control is created using the author’s private key (which only the author is able to use). ActiveX packages the control with the author’s signature and a copy of their public key certificate. That certificate must be signed by a trusted certificate authority. When a control is referenced in a Web page, it is downloaded and the signature is verified. If the public key certificate does not verify or if the signature is invalid, the control does not execute. The certificate is displayed to the user to allow him to permit or deny execution of the ActiveX control. The user is allowed to accept all content from a particular author if he wishes. (This is generally a bad idea, but unfortunately the ActiveX permission prompt leads many people to trust all content from Microsoft Corporation, potentially allowing things they weren’t aware of to execute on their systems with no further requests for permission.) The Authenticode system allows the user’s operating system to verify the source of a control. While this does not fix any problems a malicious control may cause, it is easy to track down the authors of the malware and take action against them. This is usually adequate to limit the risk, as people aren’t going to distribute malicious software that can be proven to be theirs, thus exposing them to liability. Another way in which Internet Explorer attempts to restrict ActiveX is by the use of defined security zones [TechNet05]. Only controls signed by trusted sites are allowed to execute in the trusted sites zone. Controls downloaded from the Internet are not allowed to execute without user verification. The user can also define untrusted sites and deny all active content that comes from those sites. In addition, Internet Explorer allows a user to deny all active content, including denial of all ActiveX controls. Unfortunately, the default “Medium Security” configuration allows ActiveX controls to execute if the user gives permission.
JAVA SECURITY The second form of active content for extending Web browsers uses Java. The Java programming language was originally written by a group at Sun Microsystems that was tasked with designing a language for controlling small, dedicated appliances [Byous98]. They designed a system for set-top cable television control boxes that was processor independent, allowing the resulting system to run on different CPU types without being rebuilt. While the cable TV project did not succeed, the authors saw an opportunity to marry their language with the newly emerging world of the Web. They created a demonstration Web browser called HotJava, which eventually
170
Enterprise Web Services Security
led to an agreement with Netscape to incorporate the Java technology as part of the Netscape Web browser [Byous98]. Java provides capabilities that are competitive with ActiveX. A Java program, called an applet, is downloaded to the user’s computer and executed in the context of the user’s Web browser. Like ActiveX, the applet can interact with the user using a GUI to accept user input, process that input, and send it to a server after verification. Both Java and ActiveX provide a highly interactive user interface that displays within the browser window, making the applet or control appear to be an integrated part of the browser itself. While Java is similar in capability to ActiveX, there are several ways in which the two platforms differ. One important way is that Java is processor and platform independent. While an ActiveX control is targeted for a Windows platform on an Intel x86 CPU, Java can execute on multiple platforms (for example, Windows, Mac, UNIX, and OpenVMS) and on several different processor types. The Java Virtual Machine
Java operates on multiple platforms and operating systems because the Java compiler does not generate native code that executes on a single platform. The compiler generates code for an abstract machine that does not exist in a compact encoded form called bytecode. The platform that executes the resulting bytecode program has an emulator that simulates that abstract machine. This simulator is called a virtual machine emulator. The emulator that enables Java programs to run is called a Java virtual machine (JVM). A Java program can operate on any system that has an associated JVM available. Normally the vendor that writes the operating system builds a JVM for its system to allow Java programs to execute. The JVM translates Java GUI requests to platform-specific GUI operations, allowing the program to operate across multiple platforms. This portability across platforms does not come without a cost. Since the Java program is not native code, it is significantly slower than an equivalent ActiveX control. While this is a disadvantage of Java, the performance gap is made smaller by optimizations to the JVM, including software that recompiles the Java code into native code just prior to executing it. A Java applet can approach native speed using such technology. Java does have some functional limitations that ActiveX does not share. While ActiveX controls can perform any operation permitted by the Windows operating system, Java programs are restricted to a common set of operations shared by multiple platforms. Some more complex operations (or operating system–specific operations) may be unavailable to the Java programmer. There are also multiple suppliers of JVMs, and quirks may be exposed by complex code that leads to compatibility problems when different JVMs are in use. (Simple code is, however, generally quite portable between VMs.)
Protecting the System Components
171
The Sandbox
The Java environment for the Web was designed to limit the security concerns posed by code that may potentially be malicious. Like most programming languages, Java has the potential to perform dangerous operations that the Web browser’s user may not want to allow. To combat this, the browser’s JVM executes the applet in a constrained environment called the sandbox [McGraw97]. The sandbox restricts what the applet’s JVM is permitted to do, restricting it so that it can only play in the sandbox. Several operations are denied when an applet attempts them. First, local file access is denied. This restriction ensures that the applet is not permitted to reveal the contents of the user’s files. Second, network connections from the applet are only permitted to the system that the applet came from. This allows the applet to download configuration data from its source but does not allow it to make arbitrary network connections. This restriction ensures that the applet cannot be used as a traffic flood generator, as the only system it could attack is the one the applet came from. Other operations, such as displaying arbitrary message windows and reading system configuration details are also denied by the sandbox mechanism. These keep the applet from spoofing a valid dialog (to, for example, capture a user’s password) or from sending user information to the applet’s source. The JVM also provides additional security checks to confirm that the compiled Java code is properly formed. The sandbox concept attempts to restrict an applet by defining actions that could be damaging and ensuring that the applet is not able to perform those operations. Other than those constraints, Java applets are usually permitted to execute without requesting permission from the user. This is very different from the ActiveX methodology, which asks for permission first. Signing Code
Java applets can also contain a digital signature to verify the source. As with ActiveX, the applet developer is issued a digital certificate that verifies their identity. A digital signature is attached to the applet along with a copy of the developer’s certificate. When the applet is loaded, the signature is verified to ensure that the code has not been tampered with prior to execution. Signed applets can request additional privileges that are normally denied by the sandbox [Mage99, McGraw97].
SCRIPTING Scripting languages are embedded in the downloaded Web page and are executed by the user’s Web browser. The scripting language elements can perform rudimentary tasks and help tie ActiveX and Java components together.
172
Enterprise Web Services Security
Scripting was originally introduced for coordinating interactions between Web browsers and components executing in peer relationships, that is, plug-ins, Java applets, and ActiveX controls. Prior to scripting, the only choices you had were static Web pages and external components. Highly dynamic content and high degrees of interaction required the use of external controls and external applications to support them. If you wanted to change the HTML on the current page, a round trip between the client and the server was required to communicate an event to the server and download an updated page. This implied a tradeoff between the degree of interactivity and performance and made the Internet far more useful as a reference tool than as a medium for business transactions. Scripting changed this by providing a way of communicating user and browser events between the browser and its peer components without involving the server; all the interactions could occur solely on the client. Once dynamic HTML (DHTML) was introduced, scripting in conjunction with DHTML carried this interaction a step further to include HTML itself. The script language understood by most Web browsers is called JavaScript or ECMAScript. JavaScript bears a passing resemblance to Java, but they are very different things. The only real commonality is the “Java” portion of the name, which was apparently chosen by Netscape for marketing reasons [Harold97]. A Java program is compiled into a component, but a JavaScript program is not compiled. It is interpreted “on the fly” by the browser in response to user activity. JavaScript programs can be incorporated into Web pages to allow verification of user input (allowing only numbers to be placed into a telephone number field, for example) to help vet the user’s submission before it is sent off to the Web server. Unfortunately, JavaScript can also be used to pop up advertising windows and other annoyances, so it is frequently disabled. A Web site should carefully consider why it chooses to use JavaScript, given that a number of users refuse (quite correctly) to allow JavaScript to run. Alternative means of performing the same operations when scripts are disabled should be considered.
PLUG-INS Web browsers can also be extended by the use of plug-ins. A plug-in is a program that extends the capability of a Web browser by allowing it to handle a new document type. Plug-ins are similar to ActiveX controls, as they are native platform code that executes in the browser context with the rights and permissions of the user [NSTISSC00]. Unfortunately, plug-in technology has been embraced by spyware vendors. These are companies that install software into users’ Web browser in order to direct
Protecting the System Components
173
them to advertising sites or to track their actions. Spyware often reports user activity to some home base, invading user privacy [Cexx05]. Plug-ins cause the same security concerns that bots cause: a compromised system is often unstable, and the spyware may reveal sensitive user information. Several packages exist that assist users with removing spyware plug-ins. Examples of these are Spybot Search and Destroy (http://www.safer-networking.org/en/index. html) and Ad-Aware (http://www.lavasoftusa.com).
THE NETWORK The second system component that Web Service designers must consider is the network. The network ties the components of the system together; without a functioning network there is no Web and no Web Service. Dependence on the network leads to vulnerabilities that the service designer must keep in mind when designing the system.
NETWORK VULNERABILITIES The network is a source of threats to all of the basic aspects of system security. Confidentiality, integrity, and availability of service information are all subject to attack when traveling over the network because the systems that make the network operate may not be under the Web Service designer’s control. The path between the user’s browser and the Web server that provides access to the Web Service application may pass through dozens of systems controlled by parties that are outside the Web Service provider’s control. At any point along the path someone may attempt to compromise the security of the system’s information with any of the following attacks: Confidentiality: Exposure of service data by snooping the traffic and making local copies Integrity: Tampering with service data by modifying the content Availability: Blocking Web Service data flow or flooding a server to deny legitimate users There is very little the Web Service can do to control threats mounted from the network. If you can’t control the network routers and network links, you are at the mercy of the owners of those components. Fortunately, there are things you can do to mitigate some of the risks. Confidentiality and integrity of network traffic can be
174
Enterprise Web Services Security
protected using cryptographic means such as Secure Sockets Layer (SSL) as will be discussed in Chapter 10. Availability risks are more difficult to mitigate. One possible solution for availability concerns is to configure redundant network links to help recover from connection failures. Redundant network hardware can be configured at server sites to help resist availability attacks. Other network protections may come from firewalls, redundant gateways, and guards, which will be discussed later. Cryptographic protections are not a panacea for all network security problems. Waving “crypto fairy dust” [Smith03] over a problem doesn’t make it go away; it simply moves the problem somewhere else (key management, for example). The problems with cryptographic quick fixes will be discussed further in Chapter 10.
WIRELESS COMMUNICATIONS As discussed in Chapter 1, two forms of wireless networking are used to support Web Services. These are used to support wireless mobile telephones and mobile workstations. The mobile telephone user makes Web Service requests via a Wireless Application Protocol (WAP) gateway. The communications between the telephone and the gateway and between the gateway and the Web server that supports the wireless application are protected using protocols similar to those used by normal Web browsers for secured communications. The primary concern for these types of wireless applications is the gateway system itself. User credentials are sent via the gateway; if that system is compromised, the attacker can steal user authentication information and spoof legitimate transactions that appear to come from a valid user. Another way in which wireless communication is used is in a wireless network system such as Wi-Fi. This raises a significant concern for confidentiality of the Web Service communications that are transported over the wireless LAN. The problem with wireless links is that they use public airwaves to carry network traffic. This means it is very easy for someone to “tap” the network since it only requires that the attacker be physically close to the wireless infrastructure. This is much more difficult than tapping wired networks. You wouldn’t allow someone into your building with a network sniffer and allow them to connect to your LAN and start capturing traffic, but a wireless network can be attacked from your company’s parking lot. Like wired networks, wireless networks can be protected using cryptographic techniques (details on how these techniques work will be covered in Chapter 10).
Protecting the System Components
175
One must be careful how these are implemented, however. The first set of cryptographic protections for 802.11 wireless networks was called Wired Equivalent Privacy (WEP). WEP had several implementation flaws that allowed an attacker to bypass it and read network traffic simply by capturing enough encrypted traffic [SIR01]. The replacement protocol, Wireless Protected Access (WPA) is being rolled out in current products [WiFi03] and is highly recommended as a replacement for WEP. If WPA is unavailable and WEP must be used, then a policy must be implemented to force frequent WEP key changes. This will not stop wireless attackers from sniffing your traffic, but it will limit how much information they can obtain. Unfortunately, for a heavily utilized network, key changes may need to be done on a daily basis.
FIREWALLS Another way of protecting Web Service components is to isolate them from the Internet. Frequently, companies have a policy stating that access to their internal systems should not be accessed by anyone other than authorized employees. Connecting a company to the Internet places the internal servers and workstations at risk from attack from the Internet. A firewall is a gateway between two networks that implements a particular security policy. A common policy is that trusted insiders are allowed to access the Internet but untrusted outsiders are banned from connecting to internal systems. Placing a firewall between a company’s LAN and the Internet is a common means of protecting those assets that are protected by the firewall. (The firewall term is used because the firewall is similar to the metal shield that isolates the engine compartments from the passenger compartments of automobiles and airplanes. This firewall protects the passengers from engine fires. The network firewall provides similar protection for the internal network systems; this means those internal systems do not need to be hardened to resist Internet-borne attacks. These attacks may attempt to compromise any of the security goals [confidentiality, integrity, and availability]). A well-designed firewall will resist attacks of all kinds while allowing the traffic necessary for normal system operations to pass. From a Web Services standpoint, firewalls can be a barrier that will need to be overcome. This may require that the policy be changed to permit the Web Service to pass traffic that it needs in order to get the job done or that the Web Service encapsulate it’s traffic in forms that are permitted by the firewall. The SOAP scheme (which will be discussed in Chapter 5) is one way of allowing Web Service traffic to pass through a firewall.
176
Enterprise Web Services Security
GATEWAYS, GUARDS, AND ROUTERS A gateway is a system that connects two networks, allowing specified types of traffic to pass. For example, an email gateway would only allow email traffic to pass between the networks. These are more specialized than a firewall system, as they permit only a restricted type of traffic to flow. A gateway is usually a simple system with limited capabilities and is usually used in a situation where its proper operation must be certified and accredited. A single-function gateway simplifies documenting that gateway’s operation for certification. Gateways are also used to bridge between mobile telephone networks and the Internet, as previously discussed. A guard is a form of gateway that implements an information-flow control policy. They are used on networks that handle classified information and are responsible for ensuring that information that passes through the guard does not violate the confidentiality of the information flow. A guard connected between the Internet and a network processing classified information would not allow classified documents to leak onto the Internet. It enforces this policy by inspecting the contents of the information being passed through the guard to determine how the information should be classified. A guard may pose a problem for a Web Service system if it is blocking traffic that the service needs. A router connects networks and allows network traffic to flow between those networks. A router can have simple filtering operations enabled that allow it to act as a rudimentary firewall system. Often routers are used in combination with a firewall in a “belt and braces” (or “belt and suspenders”) system. If one protection fails, the other protection is still in place and able to resist some forms of attack. The only concern from a Web Services point of view is similar to those with a guard. A router may need to be configured to permit the Web Service traffic to pass. Routers and firewalls act at the network layer (layer 3) of the Open Systems Interconnection (OSI) stack [OSI94] (discussed in Chapter 6). For completeness, we should also mention hubs and switches. These are network components that operate at layer 2 (data link), providing LAN connectivity to multiple hosts. A hub is a simple system that connects several systems, allowing all of the connected hosts to “hear” all of the traffic flowing through the hub. A switch improves upon this by adding traffic management, which isolates traffic between machines A and B that are connected to a particular switch so that other hosts do not see that traffic. While this provides some security advantage (attackers can’t sniff the traffic between A and B if they don’t see it), that advantage is not guaranteed.
Protecting the System Components
177
VIRTUAL PRIVATE NETWORKS A virtual private network (VPN) provides a way for traffic to flow between systems over a public network (such as the Internet) while remaining private. An IP Security (IPSec) VPN provides both integrity and confidentiality protection for network data, allowing the Internet to be a low-cost alternative to a private network circuit. If properly used, an IPSec VPN is secure as a dedicated, protected private network link. The primary issue with secure VPN usage is key management. Public key–based encryption and integrity keys are preferred over statically defined session keys. If static keys are used, the key values should be changed frequently. From a Web Services standpoint, VPNs are most likely used to allow private connections between service nodes that support a Web Service. For example, a pair of database servers that are protected by a set of firewalls may replicate their database contents over a VPN connection instead of going over the public Internet. These behind-the-firewall, back-end connections should use a VPN or some other means of connectivity that does not expose the data to sniffers or data recording and replay attacks.
SERVERS The final Web Service environment components are the servers that provide responses to user requests. There are usually a small number of servers compared to the number of client systems, making the job of securing them more reasonable. It is expected that more effort will be expended in securing the service systems, as they house more of the sensitive information. A single client system compromise may expose that user’s information, while a server compromise might expose the data for all users, making the extra effort spent securing the server systems more than worthwhile. When considering how to secure the servers that support your applications, the first perspective should be physical access. As a general rule, policies should stipulate that servers be located in secure areas with as few individuals as possible permitted access to servers containing sensitive information. This is an obvious point that’s easily understood, but for some reason systems continue to be exposed to attack because they are not properly protected (or the protections are allowed to lapse). For this reason, it’s important to state the need for physical security even if it’s obvious. The next level is logical access. Policies should clearly identify processes and services that have logical access to servers. The most common ones are centralized
178
Enterprise Web Services Security
backup and monitoring systems. Centralized services generally have two requirements. One requirement is for some service-specific software to be present and enabled on each server. The second requirement is for some degree of access and privilege to each server from the central service. The security policy should clearly define procedures for installing, configuring, and maintaining any local software and should specify the level of access to the server from the central service. The central service should not be given more than the minimum privileges necessary to perform its function. Systems administration is the third perspective. Systems administrators normally have root or super user privileges on the servers they support. Policies should clearly delineate roles and responsibilities and the separation of duties required. A key question an organization should ask concerning systems administration is whether Web server administrators should also be database administrators and should also be certificate authority administrators and should also be network administrators. The greater the responsibility, the greater the risk from errors or inaction. A fourth perspective is from the server itself and its lockdown. Attacks can be launched through unneeded open services or protocols running on the servers. An organization should configure servers with the minimum privileges and services they need to perform their function. Since larger organizations rarely have just one instance of any particular server type (HTTP, applications, database, and print), policies should include standard lockdown procedures for each type of server owned by the organization. While the operating system lockdown may be the same, the ports and services will be unique depending on the type of server. Server policy should also include guidelines concerning: Auditing: Specifying auditable events, audit retention periods, etc. Passwords: Specifying length, composition, frequency of change, etc. Key Files: Specific guidelines for locking down critical files such as registry and configuration files Patch Level: Specifying that servers should be upgraded within some time period following vendor release of security-relevant patches and releases The Center for Internet Security and NSA sites mentioned earlier are good sources of the latest lockdown information for many different types of operating systems and servers.
Protecting the System Components
179
WEB SERVER VULNERABILITIES The Web server is the most exposed component of the Web Service system. It must allow at least Web (HTTP) traffic inbound from the Internet. This exposes Web servers to attack from anywhere in the world. The history of Web server vulnerabilities means the Web Service designers and administrators must understand the potential problems and their solutions. CGI Flaws
A Web browser accepts user input into a form and returns the resulting data to the target Web server by sending the result to a processing program on the server. The Common Gateway Interface (CGI) defines how the browser transmits the user input to the server, how the Web server processes that input, and how the Web server returns an appropriate response. Figure 8.3 shows how a Web server invokes a CGI program for processing form input.
Web Browser
Encoded Data Web Server
Encoded Data
User Output
CGI Application Process Form Data Output Response
FIGURE 8.3 CGI processing information flow.
The flow depicted in Figure 8.3 shows how form data is processed. It is collected from the user, sent to the Web server over the Internet, and then transmitted to the CGI program that is responsible for verifying the user input and performing the appropriate operation for the user. This might entail storing a record in a database or updating a database record.
180
Enterprise Web Services Security
CGI programs are unfortunately subject to the same programmatic flaws as other types of programs. They fail to check user input and are therefore subject to buffer overflows and other problems. One common cause of problems with CGI programs is a failure to check user input before using it. For example, let’s say a form accepts a username for input and uses it as part of a Structured Query Language (SQL) query. The query might be constructed like the following: SELECT * FROM users WHERE username=’$USER’
where the $USER string is a variable reference that is set to some value based on what the user provides. If that input is not checked for validity, a hostile user can enter the following as his username: admin’;UPDATE users SET password=’admin’ WHERE username=’admin
When the user’s input is stored in the original command, the resulting command sent to the database is a series of SQL commands separated by semicolons: SELECT * FROM users where username=’admin’; UPDATE users SET password=’admin’ WHERE username=’admin’;
This is an example of a well-known type of exploit that allows the attacker to modify the password of the administrative user. It can be thwarted by strict checking of user input, as single quotes are not normally valid in usernames. The CGI program is responsible for checking that no quotes appear in the user input before using the values. Just as important are checks for length violations. Attempts to put very long values into a fixed-length buffer can lead to buffer overflows that can allow an attacker to compromise the Web server. Denial of Service
Another form of threat for a Web server is a denial-of-service (DoS) attack. These attacks are mounted by people trying to disrupt operations of the Web site. They can do this by flooding the server with requests so it is unable to handle legitimate user requests. The zombie networks described earlier are often used in distributed DoS (DDoS) attacks. These attacks coordinate a group of zombie systems to generate an overwhelming traffic level. DDoS attacks are much more difficult to bypass because they do not originate from a single source and thus cannot be blocked at the network level. There isn’t much that a Web Service system can do to avoid DoS attacks. You can escalate these to the Internet service provider (ISP) providing connectivity to
Protecting the System Components
181
the Web server, but this may not help in all cases. Having multiple sites that are physically separated can assist in resisting such attacks. Weak Authentication
Web Services typically process data on behalf of a particular user. Most sites identify their users by use of simple reusable passwords. Human nature leads people to choose passwords badly. They use bad passwords (their pet’s name, their own name, dictionary words, etc.) and reuse those bad passwords across multiple sites. Given this, there is little assurance that users really are who they say they are. Weak authentication is subject to simple brute-force attacks, where passwords are guessed until the correct one is found. Very often, Web-based systems do not keep track of login failures, allowing an attacker an unlimited number of guesses. Eventually, a valid username/password combination will be found. Another problem with Web authentication is that the standard authentication method, Basic Authentication, sends the user’s username/password pair to the Web server as part of the headers sent with every request to that Web server. The username and password are encoded in Base-64, but this is done to ensure that special characters are allowed in passwords, not to obscure the password content. Anyone sniffing traffic from the client end or the server end is able to easily recover the user’s password. Several alternatives exist that allow stronger user authentication. These include user public key certificates and the use of one-time password devices such as the SecurID® token. Unfortunately, these are infrequently used. All that a Web Service can do is test for weak passwords and reject them. Auditing failed logins and keeping a count of failed logins are also recommended.
OPERATING SYSTEM SECURITY A Web server requires an operating system to run. The operating system provides the Web server with necessary services such as a network stack and a filesystem for storing Web pages. Particular security concerns for Web servers should be considered when operating the service. Some of those are discussed below. User Accounts
A Web server should be a dedicated system in almost all cases. This implies that there are few user accounts on the system and in particular that there are no user accounts other than those used by the server administrators. This policy is enforced to ensure that users are not able to compromise the security of the Web server
182
Enterprise Web Services Security
configuration. The basis of this policy is that many of the compromises against operating systems require local login access to the server system. Since users have historically not been able to maintain adequate passwords, their user accounts may be subject to brute-force attacks, allowing an attacker an opportunity to use a local exploit to increase their privileges and thereby compromise the underlying operating system. A single administrative account is adequate. More than one may be used to help provide an audit trail of which administrator was responsible for a particular action on or change to a system’s configuration. A periodic audit of the system should be performed to ensure that unexpected user accounts have not been added to the system. Server Hardening
Many default installations of Web server systems leave many unnecessary files and applications installed. Any unnecessary files or applications complicate the server configuration and may eventually lead to compromise. The rationale for this is simple: if an application is not installed on your server, it does not matter if that application has an exploitable flaw. The server should be configured with conservative settings that minimize the chance of compromise. The process of eliminating unnecessary software and locking down the settings is called hardening the server, as it makes the server harder to attack. Frequently Web server installations come with sample or demonstration pages designed to help Web developers build their sites. Unfortunately, several of these have been found to be improperly coded, allowing compromise of server contents. This is true of several types of Web server software. Just like unnecessary software applications, unnecessary sample files should be removed from the Web server before it goes into production. Full details of the hardening process are outside the scope of this book, but there are several very good guides to help lock down Web server configurations. The NSA has guidance for several systems [NSA05]. Another source of guidance is the server configuration benchmarks available from the Center for Internet Security [CIS04]. Both of these guides can help improve the attack resistance of your Web server system. File Access/Permissions
Even if one of the previously mentioned hardening documents is used, other things should be done to help keep the Web server secure. Normally, Web server software runs as a nonprivileged user (nobody on UNIX and IUSR_hostname on Windows). The directories that contain Web site content should be protected so that the Web server user is not allowed to write to them. Some administrators protect their entire
Protecting the System Components
183
system so the Web server user has no write access anywhere. This can be a simple way of protecting Web site content from tampering as long as the site’s service programs do not need to write to disk (this might be necessary for a service program that temporarily stores a large amount of information). Any operating system files, including programs that comprise the Web server, should be protected so that the Web user cannot access them unless necessary for normal server operation. Disallowing access to these programs may contain a compromise if one happens, allowing a form of “defense in depth,” where multiple layers of protection need to be breached for an attacker to be successful. Some operating systems have more flexible access controls than others, but you should take advantage of whatever abilities your system provides to help contain the Web user in order to limit the chance of compromise. File Content
A final consideration for the Web server is the content of the files and databases stored on the server. Any file that has sensitive content should have particular attention paid to ensure that the contents are not compromised. A frequently seen and easily understood example of this is a file containing user order information, including credit card numbers. Every possible effort should be put forth to protect such data files against disclosure. One scheme for doing this involves removing such content from the Web server as quickly as possible. For example, an order’s content can be gathered, written to a temporary file, and then deleted after the transaction is saved onto a separate database server system. Encrypting the data while it is in transit could also be considered.
SUMMARY In this chapter we have pointed out some of the possible security problems that arise from the environment that supports your Web Service system. These security problems should be considered and addressed while designing your system. While some do not have simple “silver bullet” fixes, service designers can take steps to limit the chances of successful compromise of their systems. System components in a Web Services environment include client workstations, servers, the underlying network, and the operating systems supporting these systems. We looked at some of the major vulnerabilities of each of these components and techniques for “locking them down.” We explored in detail the issues mobile code and downloaded components present to clients and how Authenticode and signed Java components can help mitigate these risks. At the network
184
Enterprise Web Services Security
level, we looked at the role firewalls, gateways, guards, routers, and VPNs can play in increasing network-level security. For servers, we looked at the vulnerabilities CGI scripts and weak authentication represent and how user and file administration in conjunction with proper server lock down can help mitigate these and other risks.
REFERENCES [Act05] Active-X.com, “What is Active X?” Available online at http://www.activex.com/articles/whatis.htm. [Byous98] Byous, Jon, “Java Technology: The Early Years.” Available online at http://java.sun.com/features/1998/05/birthday.html. [Cexx05] cexx.org, “The Trouble with Spyware and Advertising-Supported Software.” Available online at http://www.cexx.org/problem.htm. [CIS04] The Center for Internet Security, “CIS Level-1 Benchmark and Scoring Tool for Solaris.” Available online at http://www.cisecurity.org/bench_ solaris.html. [Harold97] Harold, Elliotte, “The comp.lang.java FAQ List.” Available online at http://www.ibiblio.org/javafaq/javafaq.html#xtocid90007. [Kapersky04] Kapersky Labs, “Malware Trends in 2004.” Available online at http://www.kaspersky.com/news?id=156802893. [Keizer04] Keizer, Gregg, “New Bagel Worm Slows After Fast Start.” Information Week (July 16, 2004). [Mage99] MageLang Institute, “Security.” Available online at http://java.sun. com/developer/onlineTraining/Security/Fundamentals/Security.html#secAppletSecurityManager. [McGraw97] McGraw, Gary and Edward Felten, “Understanding the Keys to Java Security—the Sandbox and Authentication.” Available online at http://www. javaworld.com/javaworld/jw-05-1997/jw-05-security.html. [McLean97] McLean, Fred, “The Exploder Control Frequently Asked Questions (FAQ).” Available online at http://dslweb.nwnexus.com/mclain/ActiveX/ Exploder/FAQ.htm. [NSA05] National Security Agency, “Security Configuration Guides.” Available online at http://www.nsa.gov/snac/. [NSTISSC00] NSTISSC, “Advisory Memorandum on Web Browser Security Vulnerabilities.” Available online at http://csrc.nist.gov/publications/secpubs/ web-secvul.pdf.
Protecting the System Components
185
[OSI94] International Standards Organization, “ISO 7498-1 Information Processing Systems—Open Systems Interconnection—Basic Reference Model: The Basic Model, Technical Report.” International Standards Organization, 1994. [RFC2504] Guthman, E., et al., “RFC-2504 User’s Security Handbook.” Available online at http://www.ietf.org/rfc/rfc2504.txt, February 1999. [SIR01] Stubblefield, Adam, John Ioannidis, and Avriel D. Rubin, “Using the Fluhrer, Mantin, and Shamir Attack to Break WEP.” Available online at http://www.workingwireless.net/wireless/Documents/wireless_extreme/wep_ attack.html. [Smith03] Smith, Sean, “Fairy Dust, Secrets, and the Real World.”January 2003. [Sun99] Sun Microsystems, “JAR File Specification.” Available online at http:// java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html. [TechNet05] Microsoft Corporation, “Microsoft Authenticode Reference Guide.” Available online at http://www.microsoft.com/technet/archive/security/topics/ secaps/authcode.mspx. [vonAhn04] von Ahn, Luis et al., “CAPTCHA: Using Hard AI Problems for Security.” Eurocrypt 2000 conference. Available online at http://www-2.cs.cmu.edu/ ~biglou/captcha_crypt.pdf. [WiFi03] WiFi Alliance, “Overview: WiFi Protected Access.” Available online at http://www.wi-fi.org/OpenSection/pdf/Wi-Fi_Protected_Access_Overview.pdf.
This page intentionally left blank
9
Protecting Messages, Transactions, and Data
In This Chapter Protecting a Web Services Exchange Securing the Communications Channel Identity Management and Trust Authentication Authorization Access Control Summary References
n the last chapter, we looked at implementing security mechanisms at the system and network level. Web Services is about communicating messages between Web Services clients and Web Services servers that ride on top of this infrastructure. The client may be a person, a process, or another Web Service. The service is by definition a Web Service and as such is implemented either in software or by a hardware component capable of exposing a Web Services’ interface. It is loosely coupled, discoverable, and Simple Object Access Protocol (SOAP) based. The message may be a document, one side of a remote procedure call (RPC) exchange, or a transaction, and in the latter instance, either a business or atomic type transaction. Depending on the purpose of the communication and the sensitivity of the information being exchanged, the parties may require various degrees of trust and
I
187
188
Enterprise Web Services Security
privacy. In some instances, the system and network mechanisms may be enough to protect the traffic. In others, additional protection mechanisms must be applied either in the software components underpinning the Web Service or in the Web Service itself. There are tradeoffs involved in choosing the security mechanisms themselves and in placing those mechanisms within the hardware, software, and network stack. In this chapter we explain the ways that Web Services help in securing the information used by the clients and servers in a transaction. Our focus is on the availability part of the confidentiality, integrity, and availability information security triad [FIPS199 03, NIST800-33]. (We will discuss the other two parts in detail in the next chapter.) Availability controls are meant to ensure that when a valid request is made to access some piece of information, that access will succeed. Availability is concerned with making sure users are who they say they are, only have access to the information they are authorized to access, and can only perform the functions they are authorized to perform. Identity management and the ability to create trust relationships between parties are key when it comes to assuring availability.
PROTECTING A WEB SERVICES EXCHANGE Figure 9.1 shows the primary actors in a Web Services exchange, as defined in the WS-Trust model, and their relationships [WSTrust04]. In this model, the Web Services client wants to communicate one or more messages with a Web Services server through a secure channel that traverses a communications environment of varying degrees of trust. The parties to the communication may independently trust one another in a direct trust relationship or may need to depend on a mutually trusted third party in a brokered relationship. In establishing their trust relationship, the parties may exchange credentials in-band, as part of the communication itself, or out-of-band either directly or through a third party. Similarly, each party to the exchange may have originally received its credential through an in-band or out-ofband exchange. The degree to which the parties trust the underlying communications environment normally depends on the nature of the environment and the degree of control the parties have over its components. Parties communicating across an intranet where they control the network can place greater trust in the communications environment than those communicating across an extranet or the Internet. Three factors can complicate the simple exchange scenario shown in Figure 9.1. One complicating factor can be the number of different actors involved and the parts they play in the exchange. The Web Services client and server are the minimum set of actors. A third-party trust broker comes into play in brokered trust re-
Protecting Messages, Transactions, and Data
als nti de e r C
Trusted Third Party
189
Cre de nti als
Trust Domain Clients
Servers
Me
ssa
ge
Me
ssa
ge
Communications Environment
FIGURE 9.1 Basic security model.
lationships. At a minimum, a Web Services Description Language (WSDL) server comes into the picture with runtime discovery, and a Universal Description, Discovery, and Integration (UDDI) server may enter the picture at this juncture as well. When is the list of actors complete? When it includes all of the services relevant to the transaction. Since Web Services are choreographable, the list can become quite large—especially in coarse-grained message sequences where one Web Service calls upon another to perform some part of the processing. Each interface potentially represents a pair of actors, where that pair may need to secure their part of the message exchange, using the techniques we discuss later in this chapter, and to involve a third party in establishing their trust relationship. A second complicating factor can be the communications environment between the Web Services client and server. In complex environments, intermediaries may need to route or refer messages among various communications nodes in order to guarantee message delivery between the two principal endpoints [WSRouting01, WSReferal01]. These intermediaries may need to access different parts of the message, especially the SOAP header, and may require the ability to modify the message content in order to fulfill their role. The ability to apply end-to-end, as opposed to point-to-point, mechanisms becomes important in these types of scenarios. The third complicating factor, particularly in the Internet environment, is the number and variety of potential security domains, policies, and mechanisms that can come into play. The ability to create virtual trust domains and trust relationships, to bridge domains, and to proxy credentials between domains is important in nonhomogeneous environments.
190
Enterprise Web Services Security
In this chapter and the next, we will look at the basic security services and mechanisms available for establishing trust relationships and securing Web Services communications. The basic services are authentication, authorization, confidentiality, and integrity [WSSecurity04, IATF02]. We will primarily look at these services from the Web Services server’s perspective, but both parties to a communication may have similar concerns and may use similar underlying mechanisms. For example, parties to a communication will generally want to mutually authenticate before beginning any secure type of message exchange. Mutual authentication assumes that both parties are able to challenge for, produce, and verify credentials as part of establishing their trust relationship. The security services we discuss assume the endpoints to the communication are secure. Unauthorized parties with unrestricted access to the hardware or software at an endpoint can subvert any security mechanisms you might put into place. In such an environment, your safest option is to assume any services provided by or communications with the endpoint are compromised.
SECURING THE COMMUNICATIONS CHANNEL The first step in securing a Web Services message exchange is to create a secure channel between the Web Services client and server. The secure channel provides a secure communications path between the two parties that enables them to share sensitive information without fear of compromise. Open Systems Interconnection (OSI) defines a seven-layer model for describing communications-based applications [OSI94]. These seven layers form the communications channel. Assuming you have already decided that you need a secure channel, the question becomes, at what level within this model do you secure it? The amount of trust you have in the underlying network and how much control you have over its components are two key factors in making this decision. Performance is a third. Given that you will use encryption services to secure the channel, where you secure the channel within the protocol stack can play a major role in how well your application performs; performance normally degrades, the higher you go in the stack as you move from hardware to software encryption. A countering paradox is that overall security increases as you move up the stack. While you potentially encrypt less information at each layer, the information you do encrypt is more secure because you can selectively control what information is encrypted and how much of it is accessible to any given recipient or intermediary. In addition to the question of where in the stack to perform the encryption, with today’s technologies and the performance available, especially at the lowest levels of the protocol stack, there is also a question of how many times you want to
Protecting Messages, Transactions, and Data
191
encrypt the traffic. For example, in some situations, you could choose to use secure HTTP (HTTPS) over IP Security (IPSEC) to effectively create a secure channel, or encrypted tunnel, within a secure channel. This is obvious overkill in most scenarios but could be quite appropriate in others. So, how much encryption is enough? We’ll refer back to the discussion in Chapter 6 on security tradeoffs and implementing cost-effective measures. Link, Network, and Applications Layer Encryption Link encryption places data link-level encryption devices on both the client and the server sides of the channel [CNSS03]. The client and server can communicate securely because the encryption device encrypts all traffic across the link. Linklevel encryption devices turn the entire link into an encrypted tunnel. Network encryption places network layer encryption devices on both the client and the server sides of the channel. The difference between data link layer and network layer encryption lies in what is encrypted. With link encryption, everything but the data link header is encrypted, whereas with network encryption, the data link and network headers are transmitted in the clear. IPSec is an example of a network-layer encryption protocol. Applications-layer encryption occurs at the applications level within the OSI model. Application-layer encryption is software based and by necessity leaves headers and routing information in the clear so that lower-level network infrastructure devices such as routers and switches are unaware of the encryption. Secure Socket Layer (SSL) and XML encryption are both examples of applications-layer encryption. Web Services ride on (or are carried by) TCP/IP. Applications-layer encryption is generally sufficient for securing Web Services transactions unless you are trying to hide either the fact of the communication or the route being used (for example, to prevent traffic analysis). Where applications-layer encryption is insufficient, you can use either network- or data-layer encryption techniques to counter specific types of attacks. An advantage of network-layer encryption over link encryption when it comes to Web Services is that with network-layer encryption, the encryption devices do not need to be placed at each switching device and intermediate node. The tradeoff is in the amount of header information that is transmitted in the clear. Stallings describes techniques for using a combination of link-level and network encryption devices to secure both the headers and the payload [Stallings95]. Point-to-Point Encryption Point-to-point encryption techniques secure the communications channel between any two nodes by creating an encrypted tunnel within the communications link running between the nodes. The information is generally in the clear at both endpoints. SSL is a common point-to-point encryption technique on the Web.
192
Enterprise Web Services Security
End-to-End Encryption End-to-end encryption techniques selectively encrypt either parts of or the entire payload in such a way that the parts are only decipherable by their intended recipients [CNSS03]. In a Web Services exchange the intended recipient may be the Web Services server, a subservient process to the Web Services server, or an intermediate process. The Web Services client can choose to encrypt part of the payload for the message’s final recipient and leave other parts unencrypted or encrypt them using different keys or algorithms to support processing by intermediaries or subservient processes. Using SSL to Establish Secure Sessions Netscape originally developed SSL, releasing version 3 in 1996. SSL was the basis for the Internet Engineering Task Force’s (IETF) Transport Level Security Protocol (TLS) standard [RFC2246]. SSL runs between the HTTP service and the TCP/IP stack. Given that you will probably use SSL in at least some of your Web Services applications, let’s look at how it works to create a secure channel [RFC2246, RFC2818]. As a first step, the Web Services client needs to send a message across a secure connection to a Web Services server. The client begins this process by sending a “Hello” message to port 443 of the server hosting the Web Service. The client then chooses the algorithms it wants to use for authentication, message encryption, and message integrity (SSL supports RSA®, Diffie-Hellman, and Fortezza for authentication; Digital Encryption Standard (DES), International Data Encryption Algorithm (IDEA), RC2 (40-bit encryption; RC is an acronym for Rivest Cipher), and RC4 (128-bit encryption) for message encryption; and Secure Hash Algorithm (SHA) and Message Digest, Version 5 (MD5) for message integrity) and negotiates the ones it wants to use with the server. Once this negotiation is complete, the server sends its certificate to the client, who verifies the certificate authority’s (CA’s) signature on the certificate, using the CA’s public key. The client then generates a session key, which it sends (encrypted using the server’s public key) to the server. The server decrypts the session key using its private key and generates a random message that it encrypts using the session key and sends that to the client. The client and server can now securely exchange messages using the mutually agreed upon session key.
IDENTITY MANAGEMENT AND TRUST In the SSL example above, the client created a trust relationship with the server in a three-step process. First, the client used the CA’s signature on the server’s certifi-
Protecting Messages, Transactions, and Data
193
cate to verify that the certificate was issued by someone the client trusted (the CA) and that it had not been changed. The second step was for the client to send a session key to the server encrypted using the server’s public key. The client was able to do this because it knew that only the server (the certificate owner) should have the private key needed to decrypt the message. The process was complete when the client was able to understand the message the server returned, which was encrypted using the session key. That returned message told the client that the server had been able to decrypt and use the session key, thus establishing the server’s identity. Trust Relationships Webster’s defines trust as the assured reliance on the truth of someone or something or their ability to perform a specific function [Websters04]. A trust relationship between two parties therefore simply means both parties know and trust in the other’s identity. Such a relationship must exist before the parties can securely communicate. WS-Trust and WS-Federation define several types of trust relationships: direct, direct brokered, indirect brokered, and delegated as illustrated in Figure 9.2 [WSTrust04, WSFederation03]. In direct trust relationships, the two parties exchange credentials and create the trust relationship on the basis of the claims represented by those credentials. In brokered relationships, the parties exchange credentials and form their trust relationship on the basis of a trusted third party. In a direct brokered trust relationship the first party trusts the second party because the third party trusts the second party as evidenced by the second party’s possession of a token or credential issued by the third party. In an indirect brokered trust relationship the first party trusts the second party because it trusts the third party and the third party has negotiated with the second party in order to verify its credentials. In delegated trust relationships, one party impersonates another’s identity in order to access a service. In Figure 9.2, the client and Server A mutually authenticate. Server A then impersonates the client when it accesses Server B. Web Services servers use the delegation model when they want to use another service using their client’s access privileges rather than their own. Identity management deals with managing the identity information necessary for creating these trust relationships. We will cover each of these types of trust relationships and how they are established in greater detail in Chapter 13. Identity Management The basic identity question is, how do you uniquely identify a person or process [NIST800-63]? A person’s identity is what makes him unique. In Web Services environments there are real identities, representing real people, and pseudoidentities associated with processes, systems, and services operating within the environment. Each must have a unique digital identity that distinguishes him from everyone and
194
Enterprise Web Services Security
Broker Client
Server
a) Direct
Server
Client
b) Brokered
Client
Server A
Server B
c) Delegated
FIGURE 9.2 Types of trust relationships.
everything else. Identity management includes the processes involved in administering, storing, and communicating identities [NECCC02]. Identity management is an important part of the security infrastructure because identities form the basis for key security services such as authentication, authorization, access control, and auditing. Identity management in a Web Services environment is an increasingly important component because many businesses must now concern themselves with identity management not only within the organization but also across organizational boundaries in support of customers and business partners. Figure 9.3 illustrates three leading identity management approaches. In the direct model, each business maintains control over its own user community and potentially creates a unique identify management interface for clients, partners, and suppliers. In such an arrangement, it is possible that any two nodes will use different types of credentials in any particular connection graph. This makes administration and provisioning difficult, as each pair-wise node may require a unique set of security mechanisms. In the common broker model, a central authority defines and brokers identities among the members of some group. The common infrastructure simplifies administration, provisioning, and control, as all nodes intersect
Protecting Messages, Transactions, and Data
195
at a common point. In the federated model, each member maintains control over its own user community but has agreed to trust those identities its partners trust. WSFederation defines models for creating trust relationships in a federated environment and introduces the concept of identity providers being a special function of token services that can make security claims in issued tokens [WSFederation03].
a) Direct Model
b) Common Broker Model
c) Federated Model
FIGURE 9.3 Identity management approaches.
In the digital world, an identity equates to some type of digital credential where the credential uniquely maps to the person or entity it represents. Passwords and Pass-Phrases Password and pass-phrase services rely on something the client knows (either a password or pass-phrase) to establish identity [NIST800-12]. The password or passphrase must be something the user can easily remember yet be something difficult
196
Enterprise Web Services Security
for others to guess. Strong passwords mix upper and lowercase letters, numbers, and special characters to create passwords that are difficult to guess or to discover through exhaustive trial and error. Guidelines for creating strong passwords include: Being at least eight characters in length Not containing your name or email address or your spouse’s or child’s name Being regularly changed Not being repeated over some time period (at least a year) Being memorable Pass-phrases are sentences that are used to remember complex passwords. For example, a pass-phrase of “I wish I could catch 1 fish” would yield a password of “IwIcc1f” if one uses the first letter of each word of the pass-phrase. Smart Cards Smart cards rely on something the client possesses to establish identity where the possession is the smart card itself [NIST800-12]. Smart cards are credit card-size devices with embedded memory and microprocessor chips. Smart cards can carry personal account, credit, or preference information. They can also store certificates, encryption keys, or other information, such as roles or attributes, that you may want to use as part of the authentication, authorization, or access control process. The use of smart cards requires a reader at the client end. Readers normally plug into the RS232 serial port, a USB port, PCMCIA, or infrared IRDA port on a clients PC. The International Standards Organization (ISO) 7816 family of standards governs the size and location of card contacts and the interface commands and protocols for the cards. A smart card is usually unlocked by the user entering a PIN code, which allows the system connected to the reader to send requests to the card on the user’s behalf. Once the smart card is unlocked, it can be used to sign or encrypt information using the card owner’s private key. (More detail on private key operations will be given in Chapter 10.) Third-Party Brokers Third-party brokers come into play in both the common broker and federated models. Third-party brokers allow the parties to an exchange to depend on a mutually agreed upon third party to endorse each other’s identity. Different types of thirdparty brokers come into play depending on the technologies and services being used.
Protecting Messages, Transactions, and Data
197
Certificate Authorities X.509 is built around the concept of digital certificates [RFC2459]. Digital certificates are stored in either a directory service directory or a local certificate cache or wallet. The parties using a certificate assume a trusted CA created the certificate. The certificate includes the CA’s identity and signature for verifying the certificate’s bona fides using the CA’s public key. The certificate also includes the identity of its owner and the owner’s public encryption key along with a designator identifying the algorithm to which the key belongs. Parties in an X.509 scheme assume that only the certificate’s owner possesses the private encryption key corresponding to the public key in the certificate. Kerberos Authentication Servers In Greek mythology, Kerberos was a three-headed dog guarding the gates of Hades. MIT developed the Kerberos service as part of Project Athena [RFC1510]. Kerberos was originally intended to include authentication, authorization, and auditing as part of a three-headed security approach; thus the name. Kerberos replaces user identities with tickets: ticket-granting tickets and service tickets [RFC1510]. The Kerberos Key Distribution Center (KDC) in a domain (or realm) authenticates users to servers and servers to users. The KDC maintains a list of users and servers and their respective passwords. The KDC also maintains a unique secret encryption key for each server. The KDC becomes the trusted third party for both parties, which grants clients ticket-granting tickets that include authentication information servers can use, encrypted using the server-specific secret key, to verify the client’s identity and authentication by the KDC. More detail on how Kerberos works will be provided later in this chapter. Policy Decision Points Newer standards, such as Security Assertion Markup Language (SAML) and eXtensible Access Control Markup Language (XACML), replace identities with assertions [SAML04, XACML03]. Policy decision points (PDPs) act as the third-party brokers for these services. The standards provide for separate PDPs for authentication, authorization, and attributes. In these schemes, parties negotiate their identity with an authentication PDP and then pass claims, in the form of assertions, to others. Services receiving the claims can verify them with the PDP. Microsoft .NET Passport Microsoft’s Passport service uses a central login server that assigns each user a unique Passport identifier [Passport04]. When a Web Service needs to authenticate
198
Enterprise Web Services Security
a client using their passport, it redirects the client’s request to a well-known Passport server. The Passport server establishes an SSL connection with the client and presents a login page. Following login and successful authentication, the Passport server encrypts the authentication information, using triple-DES (and an out-ofband established key), and redirects the client back to the original Web Service, including the authentication information as part of the redirection message. Browser-based services normally set the authentication information as a cookie to avoid having to reauthenticate the client for subsequent requests. The Passport server also sets an encrypted cookie to avoid having to reauthenticate clients visiting multiple Passport-supported sites. Liberty Alliance The Liberty Alliance Project™ is a consortium of over 150 companies working on an open, federated network identity management architecture [Liberty04]. Liberty Alliance defines an identity as a set of traits, attributes, and preferences belonging to an individual. Traits are government- or company-issued identities and biometrics; attributes and preferences are a combination of sharable user characteristics and individual preferences. Liberty Alliance is building its authentication scheme around the SAML standard.
AUTHENTICATION An authentication service’s primary role is to establish a client’s, or a server’s, identity [NIST800-12, NIST800-63]. The service may be internal or external to using Web Services, and its complexity depends on the number and types of authentication schemes it must support. If the service must support a number of different authentication schemes or services, we recommend that you develop a choreographable authentication service that you can build your other Web Services around. Authentication Services follow two basic patterns, as shown in Table 9.1, depending on the type of security credentials involved: secure channel and secure format. The difference lies in whether or not the client must create a secure channel before sending its security credentials to the server. Some credentials are already in a secure format because of their use of encryption, allowing clients to send them through an unsecured channel under most circumstances. Depending on the sensitivity of the information, the encryption algorithms being used, the algorithm’s strength, and the key lengths involved, you may want to create a secure channel in some environments even if you are using secure format credentials.
Protecting Messages, Transactions, and Data
199
TABLE 9.1 Basic Authentication Patterns Pattern One
Pattern Two
1. Create a secure channel
1. Send security credential in secure format
2. Send security credential to server
2. Server verifies security credential
3. Server verifies security credential
3. Server accepts or denies request
4. Server accepts or denies request
A second difference lies in the verification step, depending on the type of trust relationship that exists between the two parties. In direct trust relationships, the server compares the client’s credential against some information the server maintains, such as a list of user names and their passwords or a shared secret. In brokered trust relationships, the server may verify, via a separate message sequence, the credential with the third-party broker. In delegated trust relationships, the server trusts an earlier service to have verified the credential. User IDs and Passwords User ID and password schemes depend on a shared secret, the password, to verify the identity the user ID represents [NIST800-12, NIST800-63]. The Web Services server will normally access a user table or access control list to match the clientprovided password against a previously stored value. If they match, the server assumes the client is the person, service, or process the user ID represents. User-ID and password schemes assume that only the person, or process, owning the user ID knows the password. User-ID and password schemes frequently require a secure channel between the client and server to compensate for the client sending the user-ID and password information to the server in plaintext. For this arrangement to work, the client and server must have previously agreed upon a mechanism for creating the secure channel or be able to negotiate one at the point of the exchange. SSL is often the choice for creating the secure channel. As another option, some browsers now support use of a message digest algorithm to convert the plaintext password into a secure format. If the client is a browser, you will also want to use password-type tags on the Web page to prevent prying eyes from seeing the password as the user types it in. While this protects the password at the presentation layer, it is still in plaintext in the client-workstation’s memory, in cache, and in the channel.
200
Enterprise Web Services Security
X.509 Public Key Authentication X.509 replaces user IDs and passwords with digital certificates, third-party CAs, and an authentication scheme built around public key encryption [RFC2459]. CAs have already been introduced in this chapter. The ISO X.509 standard and Public Key Cryptography Standards (PKCS) define X.509 certificates and their use. With X.509, a trusted, third-party CA assigns each user a signed digital certificate and a pair of encryption keys: one public and one private. The CA may be part of a chain of CAs, with the highest-level link being the Internet PCA Registration Authority (IPRA). The IPRA certifies and issues certificates to policy certification authorities (PCAs), who in turn certify and issue certificates to CAs. X.509 authentication makes the following assumptions: Both parties to the message exchange trust a common CA. Only the CA, or trusted delegates, can issue valid certificates. Only the owner of the digital certificate possesses the corresponding private encryption key. In most environments, it is safe to use X.509 certificates following the secure format pattern. Figure 9.4 illustrates using the X.509 authentication scheme for a message exchange. The process begins with both parties exchanging certificates. The client sends its certificate to the server and the server sends its certificate to the client. Both parties verify the identity and CA information contained in the certificate. The parties can use the CA’s public key to verify the CA’s signature on the certificate. The parties then exchange a series of messages to verify each other’s identity; this process is known as mutual authentication. The process begins with the client generating a unique transaction ID (Tran ID1), which it sends as part of a message to the server. The client encrypts the message using the server’s public key (which is obtainable from the certificate). The server decrypts the message, generates a unique transaction ID of its own (Tran ID2) that it returns in a message, which also includes Tran ID1, to the client. The server encrypts this message with the client’s public key. The client decrypts this message and verifies that it contains Tran ID1. The client can now trust the server since only the server should have the private key necessary to decrypt the first message. The client now sends a message to the server that contains Tran ID2, which it encrypts using the Server’s public key. The server decrypts this message and can now trust the client. The server now generates a session key, using some previously agreed upon or negotiated algorithm, which it returns to the client in a message that it encrypts with the client’s public key. The client and server can now exchange messages securely using the session key. The
Protecting Messages, Transactions, and Data
201
client and server use different algorithms for authentication and message exchange because of performance. Secret key encryption algorithms are normally more efficient than public key algorithms.
Messages
Client
Server
Client Certificate Verify CA Server Certificate
Verify CA
Message A with Trans ID 1 Generate Trans ID 1
Generate Trans ID 2
Message B with Trans ID 1 and ID 2 Server Now Trusted Message C with Trans ID 2 Client Now Trusted Random Key
Messages
Generate Random Key Session Messages
FIGURE 9.4 The X.509 authentication process.
LDAP (The Role of Directory Services) In the scenario above, the client and server began their dialogue by exchanging digital certificates. An alternative would be for each party to request the other’s certificate from the CA. Yet another alternative would be to obtain the certificate from a public directory containing the name and public key of each user in the domain. With a directory service in the picture, the client and server need only exchange or know the identity of the other party. They can then use the directory to obtain the corresponding credentials. A directory service approach is more secure because the CA can now revoke credentials and either maintain a revocation list or periodically republish the directory to remove users that are no longer valid. The directory service you will most frequently encounter is LDAP [RFC2251]. The University of Michigan designed the Lightweight Directory Access Protocol (LDAP) for accessing an X.500-type directory service over TCP/IP. (X.500 is an ISO
202
Enterprise Web Services Security
specification for directory systems.) Netscape, IBM, Oracle, Microsoft, and others have agreed to follow the LDAP standard for implementing Internet directories. The LDAP directory service consists of a directory implementing a hierarchical namespace and an open protocol for accessing information in the directory. The LDAP directory implements a schema defining object classes that can include users, services, network and computing devices, etc. Each object class consists of one or more entries. Each entry consists of one or more attributes, which in turn consist of a type (or syntax) and one or more values. The attribute’s type defines how to interpret its values. Types include distinguished names, common names, telephone numbers, etc. The LDAP protocol provides operations for binding to the directory service and for searching for and comparing entries. The basic sequence of operations is for the requesting party to BIND to the directory service, execute a query to find and retrieve the directory entry for the party it is interested in, followed by an UNBIND. There are two common implementations for the directory. Given the directory’s tree-like structure, most implementers use a hierarchical database model. This provides high-speed access for individual queries but is relatively inefficient for high rates of insertions and joins. The Netscape Web server (which became iPlanet™, which is now Sun ONE™) is a prototypical example of this implementation. However, the hierarchical structure is not very efficient for relational database systems that want to access the directory as part of their search process. This has led to implementations where the LDAP wraps a traditional relational database management system (RDBMS). Oracle Corporation’s Oracle Internet Directory (OID) is an example of this type of implementation. Depending on whether you are writing Web Services for the Internet, an extranet, or an intranet, you may find up to three levels of directories involved. At the Internet level, you may use large public directory services such as Big Foot or Infospace. Within an extranet, you may use organizational directories belonging to one or more organizations, such as a company, university, or government agency, or a common directory specifically defined for the space. Within an intranet, you may use either a global directory or individual department or group-level directories. Kerberos Two versions of Kerberos are currently in widespread use: Versions 4 and 5. We will describe Version 4 because it is simpler to describe, yet most of the discussion is directly relevant to Version 5 as well. The foundations for Kerberos authentication are the concept of shared secrets and the idea that if only two parties know a secret, then either can verify the other’s identity by their knowledge of the secret. The Kerberos service assumes a Kerberos
Protecting Messages, Transactions, and Data
203
KDC server exists that contains the user IDs and passwords of all the users within its domain (or realm). The Kerberos server also maintains a unique secret key for each server in the realm. The secret key is a shared secret between the Kerberos server and the server it supports. The Kerberos servers supporting two realms can share a secret key and form a trust relationship between the two realms. Kerberos uses a three-step authentication process as shown in Figure 9.5. The three steps correspond to three subprotocols. The Authentication Service subprotocol provides clients with a session key and a ticket-granting ticket. The ticketgranting service (TGS) subprotocol issues service session keys and service-granting tickets (SGTs). The client-server (CS) subprotocol enables clients to request services from providers. The Kerberos KDC implements the first two services.
Client 1. Login requesting UID and Password . 2. Client sends ticket Request to Kerberos
Messages Ticket-Granting Request
Ticket-Granting Ticket
AS. 3. Client uses password to decrypt TGT.
Kerberos AS 1. Server generates TGT which it encrypts with its own secret key. 2. Server includes TGT in larger message and encrypts it with a key derived from the user’s password.
Kerberos TGS 4. Client sends service ticket request to Kerberos TGS. Request includes TGT as an authenticator.
Service-Ticket Request
Service-Granting Ticket
Service Request 5. Client sends service request to Web Service. Request includes SGT and an authenticator.
Authentication Message
1. Server verifies Client bona fides. 2. Server generates a session key for the two parties, an SGT, and encrypts the SGT using service’s secret key. 3. Server includes SGT in larger message that it encrypts using the session key.
Web Service 1. Service verifies Client bona fides. 2. Mutually authenticates if necessary.
FIGURE 9.5 The Kerberos authentication pattern.
Once per session, a client must log on and request a ticket granting ticket from the Kerberos authentication service. To avoid having to send the client’s password through an unsecured channel, the client sends a request containing its ID, the authentication service’s ID, and a timestamp to the AS. The authentication service
204
Enterprise Web Services Security
generates a TGS ticket made up of the client’s ID, the client’s network address, the authentication service’s ID, a second timestamp, a lifetime value, and a session encryption key. The authentication service encrypts this service ticket with its own secret encryption key. The authentication service includes the encrypted TGS ticket in a larger message containing the authentication service’s ID, the timestamp, the lifetime value, and the session key, which it encrypts with a key derived from the client’s password (the authentication service obtains the client’s password from a local database) and sends it to the client. The client generates a decryption key using the password it obtained and decrypts the message. The KDC is able to conclude in subsequent service requests that the client is who he claims by virtue of his having been able to decrypt this message, under the assumption that only the client knows its password. In order to use a service, the client must first obtain an SGT from the Kerberos TGS. The client initiates this process by sending a request for an SGT to the TGS. The request includes the TGS ticket it received from the authentication service, the ID of the service it wants to use, and an authenticator. The authenticator is made up of the client’s ID, its network address, and a timestamp. The client encrypts it using the session key it received from the authentication service. The TGS decrypts the request using the shared session key, as a first step in authenticating the request, and then verifies the client’s ID and network address from the authenticator with those in the TGS ticket to ensure the request is coming from the client. After verifying that the client is authorized to access the service, the TGS generates a servicesession key for the client and service to share, includes this in an SGT that it encrypts using the secret key the TGS shares with the server supporting the requested service. The SGT includes the service-session key the service will share with the client, the client’s ID and network address, a timestamp, a lifetime value, and the service’s ID. The TGS includes the SGT in a larger message that includes the service’s ID, a timestamp, and the shared service-session key the client is to use in communicating with the service. The TGS encrypts this larger message with the session key it shares with the client and sends it to the client. The client must request an SGT for each service it uses. The client decrypts the message from the TGS and sends the SGT and an authenticator to the Web Service to obtain service. The authenticator includes the client’s ID, network address, and a timestamp. The client encrypts the authenticator using the service-session key it shares with the service. The assumption is that only the client is able to decrypt the message from the TGS service that generated that key. The Web Service receiving the message decrypts the SGT, using its secret key, extracts the shared service-session key, and uses it to decrypt the authenticator. The Web Service then validates the client’s ID and network address, and assuming that they all match, concludes that the client is whom they claim. To mutually authenticate, the Web Service sends the client a message containing the timestamp from the
Protecting Messages, Transactions, and Data
205
authenticator portion of the client’s message incremented by one, encrypted using the shared service-session key. At the end of this process, the client and Web Service can securely exchange messages using the TGS-created secret service-session key they share. Kerberos Version 4 used DES as the heart of its encryption scheme. Version 5 relaxed this constraint by incorporating encryption type and key length information into the ticket structure. This structure allows the use of any algorithm for Kerberos encryption. Microsoft uses Version 5 with public key encryption in its implementation. Version 5 also improves the generality of the service and its use of encryption; the basic concepts and ticket exchange sequence, however, remain the same.
AUTHORIZATION While the authentication service determines a user’s identity, the authorization service determines what the user or process associated with an identity can do. Authorization therefore assumes successful authentication [CNSS03]. The authorization service determines what a user can do by matching the user’s identity with a set of privileges or permissions. The privileges correspond to specific functions or actions the user or service can take. At an operating systems level, privileges include login; creating, reading, updating, and deleting files; and executing processes. As you move up through higher-level services, such as Web servers, applications servers, and database servers, privileges take on service-specific meanings such as accessing or updating a Web page, accessing one or more Entity JavaBeans™ (EJBs) or component object model (COM) objects, and producing (running) a specific query or report. As a Web services developer, you will need to be familiar with authorization mechanisms at all different levels and of different types because you may need to develop Web Services implementing everything from wrapping hardware-level services, such as a print service, to advanced applications services, such as credit card authorization. You should always follow the principle of least privilege in implementing your authorization services. The principle of least privilege says, “Every user of the service should operate using the least privileges necessary to complete the task at hand” [CNSS03]. AuthorizationDecision = AuthorizationFunction ( identity, resource, privilege ) This formula illustrates the basic authorization function: given an identity, a resource, and the privilege the identity needs to perform a specific action, can the identity perform the action the privilege represents? Complexity comes in two forms: in how identities map to resources and privileges and in where within the overall applications model the actual authorization decision is made.
206
Enterprise Web Services Security
How you map identities to resources and privileges is an important decision; it establishes the level of administrative burden on your system administrators and the complexity of the authorization function. Normally, the simpler the systems administration, the more complex the authorization function, and vice versa. We discuss privileges and resources separately because you may treat them either separately or collectively depending on your particular requirement. For example, you may say user X has privilege Y for resource Z (this user can print on this printer using this print server) or you may aggregate either the privileges, the resources, or both (this user can print on any printer belonging to this print server, this user has all privileges for this printer on this print server, or this user has all privileges for all printers belonging to this print server). Figure 9.6 depicts the three options for mapping identities to resources and privileges: direct, indirect, and computational. In a direct mapping, identities map directly to resources and privileges. Giving user X privilege Y for resource Z is an example of direct mapping. In an indirect mapping, identities map to an intermediate entity, normally a role (or group), and resources and privileges to the same intermediate entity. Giving users with the “customer” role authorization to submit customer feedback via a customer feedback form on your Web site is an example of indirect mapping. Privilege
Privilege Identity
Identity
Role Resource
Resource
a) Direct
b) Indirect
Privilege Identity
F(Ai, Ax) Resource
c) Computationally FIGURE 9.6 Mapping identities to resources and privileges.
Role mapping simplifies the administration function because you can now aggregate identities, resources, and privileges to roles. However, it complicates the authorization service because the authorization service must now identify the resource or privilege needed and the role associated with that resource or privilege
Protecting Messages, Transactions, and Data
207
and then verify that the identity possesses that role. Computational mapping goes a step further and maps some set of attributes the user possesses against a role or set of attributes associated with the resource, the privilege, or both. An authorization decision mapping users who are administrative assistants working in XYZ Division with system administrator privileges for printers located in XYZ Division is an example of a computational mapping. To make this decision, the authorization service must map job functions to privileges and user organizational locations to resource to facilities to organizational locations. The second complicating factor in implementing an authorization service is where to make the authorization decision. There are choices in terms of both where the decision is made in the OSI protocol stack and the component involved. You may be asking, “Why wouldn’t I always make the decision in the Web Service (or the applications layer)?” Consistency of implementation and level of risk are two major reasons you wouldn’t. If you are writing a Web Service that exclusively controls and uses a resource, implementing the authorization service within the applications layer as part of the Web Service itself is an option. However, generally, any number of different Web Services will need to share a resource, and you will want to consistently implement the authorization service across those services. So, as a general rule, you will want to implement your authorization service as a choreographable service and, particularly if you are dealing in a mixed environment, as a Web Service. This allows many Web Services to share the same authorization service. The second issue, level of risk, is even more important. The higher in the protocol stack you go in implementing the authorization service that controls a resource, the higher the risk of successful attack from a lower level. This leads to the principle that you always want to implement the authorization service for a resource as low in the stack and as close to the resource as possible. How far down in the stack you should go depends on the resource involved and the availability of appropriate protection mechanisms for protecting that type of resource at each level. To better understand this point, let’s look at an example. Assume you want to protect a particular Web Service. The Web Service is unknown at the hardware level. At best, it is merely a series of bits on a hard drive somewhere. The operating system hosting the HTTP server may know it is an executable of some sort, assuming it is a simple executable file; otherwise, it too is oblivious. If it were a simple executable file, then one option would be to protect it using the operating system’s filesystem access control mechanism. What if the service is implemented as an Active Server Page (ASP) or EJB? In that case, the HTTP server is the lowest level in the stack that knows it is an executable being called. If you want to control access to the service at the lowest possible level, you would have to control it through the HTTP server and through access to the specific ASP or EJB function supporting the service. You could control it at higher levels, for example, within the service itself, but that would open the process
208
Enterprise Web Services Security
and the data to additional vulnerabilities and attacks because unauthorized users would be allowed to execute the service. Based on this discussion, we can modify our earlier principle to be that you should protect resources at the lowest level in the stack where identifiable and appropriate protection mechanisms exist. Since most of the Web Services you will write will use some form of Web server, we will take a closer look at the authorization points you can expect to find and the decisions you will need to make in several typical environments. Basic Web Servers The basic Web server is an HTTP service running on top of a native operating system such as UNIX or Windows server. The HTTP service on such a server may be little more than a listener with an HTTP interpreter. In its most primitive form, it will at most contain a primitive scripting interpreter capable of launching Common Gateway Interface (CGI) programs and possibly server side includes, but little more. A basic Web server will probably only include basic authentication services, which utilize user IDs and passwords [RFC2617]. Newer versions of basic Web servers also include some form of digest authentication, which uses an MD5 digest algorithm to protect the user’s password as the client transmits it to the server Basic servers will also sometimes include some form of SSL authentication, but will probably not include more sophisticated approaches unless you want to implement them as application code within your Web Service. You will probably write any Web Services you want to run on a basic Web server as a CGI application. A CGI application runs as an external application to the HTTP service itself as a separate address space or daemon process that has direct access to the operating system and operating system functions. This is an important point because you may lock down the HTTP service itself yet leave the system vulnerable to CGI applications. As Figure 9.7 illustrates, there are three basic authorization points on such a basic Web server. One is the operating system itself. At the operating system level, you can protect the filesystem, both files and directories, and programs. These can be protected by limiting access to the file containing the executable or by restricting execution privileges. Restricting access to files or directories may require your CGI application to be able to proxy the user’s identity since the HTTP service itself may not be able to do so in a way the operating system understands. The second authorization point is at the HTTP service level. You can generally choose to give users either anonymous or authenticated access to this service. Anonymous access is a concern if you allow users to access and execute programs and the Web server contains sensitive information. If you are going to provide
209
Protecting Messages, Transactions, and Data
Request
HTTP Basic Service
Common Gateway Interface Program
Client Response HTTP Service
Web Pages & Scripts
Database
Operating System
Database Access Files and Programs
FIGURE 9.7 Web server authorization points.
anonymous access to some capabilities, you need to carefully lock down the root directory, the filesystem, and executables (the cgi-bin area). Otherwise, you will open yourself up to attack. If you use authenticated access, the HTTP service may provide capabilities for restricting access to Web pages and executables. The server will generally implement access controls through either a configuration file or a database. As general rule, it is better to restrict access to identifiable Web objects at this level because the HTTP service can enforce access controls before it fetches Web pages, runs scripts, or launches a CGI program. The third authorization point is within the CGI program. It is critical for you to understand what permissions the HTTP service will give the CGI program on launch and what options you have for limiting or controlling those privileges. Ideally, the CGI program will receive minimum privileges under the assumption it will switch to a valid user’s identity, thereby inheriting that user’s privileges, as part of its authorization processing. A common problem is allowing CGI programs to operate with the HTTP services privileges or squirreling away a user ID and password the CGI program can use. In both cases, the CGI program essentially runs with system privileges, which allows the use access to files users normally would not be permitted to read, as well as allowing the possibility of corrupting the system configuration. To illustrate some of the choices you will face when dealing with a basic Web server, let’s assume a situation where we have a CGI program accessing a database. The database could be a real database, such as an SQL Server or Oracle RDBMS, or files within the filesystem. There are two basic concerns here: how to control access to the CGI program and how to control access to the database it is accessing. If at all possible, either the operating system or the HTTP service should control access
210
Enterprise Web Services Security
to the CGI program. Why? Because in situations where the CGI program is protecting itself, it is vulnerable to attack, assuming someone can modify or alter its behavior before it can reach an authorization decision (buffer overflow types of attacks attempt to exploit this vulnerability). Given that the CGI program is executing on behalf of an authorized user, the next concern becomes where to protect the data. It depends on the type of database the program is accessing. It is generally best to use the operating system’s access control mechanisms for restricting access to files within the filesystem. As we will discuss in a later section, it is generally better to use the database product’s access control mechanisms to restrict access to a RDBMS and its capabilities. Why wouldn’t you implement the database access control in the CGI program? Because the filesystem or database is then exposed to attack by anyone who can find a way to get direct access to them, possibly through another CGI program. J2EE Applications Servers J2EE (Java 2 Enterprise Edition) applications servers (apps servers) are an increasingly popular platform for developing Web Services applications. The combination of a standards-based hosting environment and standards-based messaging formats and protocols leverage the promise of write-once, run-anywhere code. An apps server includes an HTTP server running on top of a native operating system and at a minimum a Web container [J2EE04]. The Web container provides the hosting environment for servlet and Java Server Page (JSP) applications. More advanced apps servers also contain an EJB container. The EJB container provides the hosting environment for any Java beans you may write. Depending on your particular circumstance, you may deploy the Web and EJB containers on the same or different physical servers or as different logical instances. A J2EE apps server normally provides several authentication options. Formbased authentication lets you use any HTML form to perform the basic authentication check. You simply need to include an action of j_security_check and the parameters j_username and j_password. Since apps servers are also HTTP servers, most apps servers also support HTTP basic authentication. With basic authentication, the Web server sends a “401 Authentication Request” header to the client to indicate a user ID and password are required. Many also support digest authentication that uses MD5 digest codes to avoid sending passwords across the network. Being a Java platform, most apps servers also support the Java Authentication and Authorization Service (JAAS) [JAAS04]. JAAS is based on the concept of a stackable pluggable authentication module (PAM) framework [PAM96]. The PAM framework lets you add multiple authentication mechanisms without changing login services. With JAAS, applications deal with a LoginContext that is independent of the authentication mechanism. Many apps servers also support custom
Protecting Messages, Transactions, and Data
211
authentication that allows you to retrieve credentials and then compare them to a database or an LDAP directory. You will generally write the Web Services applications that you want to run on a J2EE apps server as either a servlet or an EJB. With either, you may choose to chain components together depending on the functionality that you need to implement. Figure 9.6 shows the same authorization point options on an apps server as would be on a basic Web server, with all the same advantages and disadvantages. The J2EE apps server adds an additional option: container authorization. Container authorization essentially provides an intermediate level, between the HTTP server and the application, for J2EE applications [J2EE04]. Container authorization is role based and normally offers two options: Java Runtime Environment (JRE)/container and application authorization. JRE/container authorization works for both the Web and EJB container; its advantage is that the authorization check occurs before any code executes. It is useful if you need to control access to a servlet, JSP, or bean. JRE/container authorization is often referred to as declarative security because it is declared in configuration files on the server. Application authorization occurs as the application executes. Application authorization breaks down into role based (the application makes the authorization decision based on the client’s role) and segment based (the application makes the authorization decision based on user attributes). In both cases, the container has initiated and given control to the application’s code before the application makes the authorization decision. ASP.NET Servers Microsoft was an early adopter of Web Services and has been a platform of choice for many Web Services applications. Building Web Services in a Microsoft environment, of course, means building them to run on an Internet information server (IIS) system using technologies such as ActiveX, Active Server Pages (ASP), and ASP.NET. IIS is an HTTP server. IIS supports two types of requests: anonymous and authenticated [IISAuth04]. With anonymous requests, the IIS server only knows the IP address of the client. Anonymous requests run under the machine name of the IIS server. With anonymous authentication, IIS only denies requests the operating system denies. Since you will generally give the IIS server broader privileges than you would to any individual user, you generally should not use anonymous authentication unless you are protecting the resources at a higher level. IIS supports four types of authenticated requests: basic, digest, integrated windows challenge/response, and client certificate matching. Basic and digest authentication are similar to those found in traditional HTTP servers, as both depend on a user ID and password. Basic authentication implements HTTP 1.0 authentication
212
Enterprise Web Services Security
using Windows accounts. With basic authentication, the client sends passwords to the IIS server in Base64-encoded format. Digest authentication sends a digest instead of the password across the network. The client receives the password it uses to compute the digest from the user; the IIS server retrieves the password it uses to verify the digest from the active cirectory. The two digests must match for authorization to be successful. Integrated Windows authentication (often referred to as integrated login or NTLM) uses Windows logon credentials. Integrated Windows authentication uses either native Kerberos V5 or a user-ID and password scheme based on Windows accounts. Client certification matching authentication maps one (one-to-one) or more (many-to-one) X.509 certificates to a user ID. IIS can also use SSL to authenticate the client using X.509 certificates. IIS also supports Fortezza as an add-on cryptographic service provider (CSP). Fortezza is a National Security Agency (NSA)–developed authentication mechanism based on a certification authority and smart cards. Microsoft adds a second level of authentication services with ASP.NET [ASPAuth04]. This second level of authentication is similar in concept to Java’s container authorization. ASP.NET supports three types of authentication: forms, passport, and windows. With forms authentication, ASP.NET uses HTML forms to collect authentication information from the user. Passport authentication uses Microsoft’s Passport services to authenticate the user. The user must have signed up for Passport services and that Passport service must be available to the ASP.NET process. Windows authentication uses Window’s accounts to authenticate the user. ASP.NET also supports custom authentication providers where you set the authentication mode to none and then authenticate within the application itself. ASP.NET uses impersonation to execute processes under the identity of the requesting user. If impersonation is not enabled, ASP.NET executes processes with the privileges of the ASP.NET user account. At the IIS level, you can control traditional resources such as files and processes. ASP.NET adds an extra authorization dimension by supporting both file and URL authorization [ASPAuthorize04]. File authorization checks an (ACL) to determine a user’s ability to execute a particular aspx or asmx file. URL authorization checks the user’s accesses against parts of the URL namespace. Recent enhancements to IIS have made the HTTP Listener a kernel process and introduced the concept of worker processes where each request effectively launches, or assigns, its own processing thread containing a request-specific set of configurable IIS services. This increases the overall security of the authorization mechanism. Windows Authentication with impersonation allows you to map users and resources consistently across systems and the Web based on user credentials. You may be asking, “Why not always use Windows Authentication?” The problem is that the Windows challenge/response protocols do not pass through some firewalls, causing authentication attempts to fail. For Windows Authentication to
Protecting Messages, Transactions, and Data
213
work, both parties must be able to communicate with either the same domain controller or at least domain controllers that are in communication with one another.
ACCESS CONTROL The distinction between authorization and access control is one of granularity. In this book, we use the term authorization to refer to coarse-grained access control for objects such as Web pages, CGI applications, servlets, or COM objects. We use the term access control to refer to fine-grained access control for lower-level objects such as rows, tables, and documents within a data source. Some group the two together under the term authorization. We distinguish between the terms for two reasons. First, database products, such as Oracle Database Server and Microsoft SQL Server, provide authorization mechanisms that understand and are capable of controlling access to database objects such as tables, records, reports, and stored procedures [OracleASO01, SQLServer03]. Second, you may use different authorization strategies for coarsegrained and fine-grained access. Depending on the environment you are working in, you will likely choose role-based access control for coarse-grained access and may choose some other form (we will discuss the options later) for data access control. Filesystems and many filesystem-based DBMS products only provide coarsegrained access control. If a given user has access to the file or knows the password to the database, he has access to everything in that file or database. In these situations, authorization and access control are in effect the same. As Figure 9.8 illustrates, if the data you want to access is defined at the filesystem level and a file object is the right level of granularity, the operating system is the best option for making authorization decisions. Most operating systems allow you to set create, read, update, delete, and execute privileges at the file and directory level. What if you need to control access to objects within the file such as rows in a table, documents within a file, or paragraphs within a document and the product you are using doesn’t provide access control at that level? Your only option then is to implement access control as part of your Web Service or as a service your Web Service can draw upon. Filesystem-based DBMS products that include an access control mechanism provide a third option: to use the DBMS product’s capabilities to implement access control. DBMS products normally provide control over things the DBMS understands as objects. The list normally includes tables, views, and stored procedures. They also generally offer one or more ways of mapping user identities to those objects. User-level access control is generally the minimum capability. Role-based
214
Enterprise Web Services Security
Request Web Service
Content Within File Object
Client Response
DBMS W/O AC
Operating System
File Objects
Database
FIGURE 9.8 Local filesystem or filesystem-based databases.
access control is gaining popularity and is found in an increasing number of products. Some are also beginning to support more sophisticated constructs, such as rule- or attribute-based access control, at increasing levels of granularity, that is, row-level access control. Under what conditions would you implement access control within your Web Service instead of within the DBMS product itself? When the product you are using doesn’t control access To objects you want to control (you want to control access to a stored procedure and that isn’t supported natively) At the level you need (you want to implement row-level access control and the product only supports table access control) In the way you need to support it (you need to control access by attribute and the product only supports control by database object) Once you move access control decisions out of the DBMS into your Web Service, you also have to decide whether you want to use the DBMS’s account management structure. In order to reduce the administrative overhead or to supplement the underlying DBMS’s capabilities, it is sometimes tempting to substitute a table look-up or algorithmic access control scheme for the native DBMS’s account structure. We recommend against this type of approach, unless absolutely necessary, for two reasons. First, it precludes, or complicates, the use of commercial offthe-shelf (COTS) products, such as report writers or query-by-example tools, that
Protecting Messages, Transactions, and Data
215
depend on the DBMS’s account structure. Second, as a general rule, it is best to implement access control as close to the data source as possible, and with DBMS products, that means within the DBMS product itself. The first concern arises because commercial report writers (such as Seagate Crystal Reports™) that convert user requests into SQL out-of-the-box expect to use the DBMS’s security features. At best, they provide an interface for customizing access by inserting code into the middle of this conversion process. The vulnerability arises when these types of tools are introduced in environments where the DBMS depends on some other interface to protect the data it contains. Since the commercial tools aren’t coming through this interface, they effectively have system-high access to the data. Server-based DBMS products operate as a service instead of as an extension of the operating system’s filesystem. Being a service means the DBMS service implements some protocol for communicating between it and your Web Service. In today’s environment, that protocol normally rides on top of TCP/IP, and your Web Service will access the DBMS service through an abstraction layer such as Microsoft’s Open Database Connectivity (ODBC) or J2EE’s Java Database Connectivity (JDBC™). Most vendors still offer proprietary connectors for their products. The choice between using an open connector or a proprietary connector is generally between portability and performance. You can setup server-based DBMS products in one of two ways. In a singleserver configuration the DBMS service runs on the same operating system and server as the Web Service (see Figure 9.9). While this configuration may be OK in a small office environment, it is generally discouraged for enterprise-level services because of performance. In a multiple server configuration the Web Service runs on one hardware server under one instance of the operating system, and the DBMS service runs on another hardware server under a different instance of the operating system or possibly even a different operating system. For example, in a multipleserver configuration, you may run your Web Service as a servlet on a J2EE apps server using SUN Solaris™ while your DBMS service is Microsoft’s SQL Server running on a Windows XP server. The single-server configuration introduces the question of controlling service access. One option is to control access through your Web Service; the other is to control access through the DBMS service. If you decide to control access through your Web Service, you need to configure the DBMS service to give the Web Service the maximum privileges (system high) needed by any of the Web Service’s clients and then depend on the Web Service to broker the access decision. You have two choices in controlling access using the DBMS service. One option, authenticated user, is to have the Web Service authenticate as the user (proxy the user’s identity) with the DBMS service. This approach generally only works with user-ID and password schemes because the Web Service is able to proxy the identity of the user to the DBMS service and provides a password the Web Service obtains either from the
216
Enterprise Web Services Security
Request Web Service
Client
Database Service
Response
Operating System
Service Access Database
FIGURE 9.9 Single server architecture.
client or from a database belonging to the Web Service. The authenticated user approach doesn’t work for authentication schemes that require the Web Service to possess something only the client can possibly possess, such as the client’s private key with X.509 or the client’s IP address with Kerberos. The second option, trusted user, has the Web Service authenticate as itself with the DBMS service, ideally with minimum privileges, and then switch to the client’s identity as part of the transaction. The switch to the client’s identity may involve switching the user context, by setting a variable, by logging on as the client within the session context, by using a function such as Oracle’s Proxy User, or through delegation as in Microsoft’s impersonation feature. The options available to you are a function of the products you are using and what they support. Table 9.2 summarizes the options. Depending on the DBMS service’s capabilities, you may need to create an account for the Web Service on the DBMS service. If you do need to create such an account, you should assign it the minimum privileges and resources necessary to support its function. Multiple-server configurations add the complexity of establishing a trust relationship and a trusted path between the server hosting your Web Service and the server hosting the DBMS service. In this configuration, you have three identities involved in the transaction (the two servers and the Web Services client), three physical boxes (the client and the two servers), and the potential for man-in-the-middle attacks between any two of the parties. There are two options for creating a secure channel between the parties. One is to create point-to-point trust relationships
Protecting Messages, Transactions, and Data
217
TABLE 9.2 WS-DBMS Relationships Relationship Type
Web Service Authenticates With:
System high
The DBMS service using its own credentials and receives the maximum privileges needed by the Web Service’s most privileged client
Authenticated user
The DBMS service using the client’s credentials and receives the client’s privileges
Trusted user
The DBMS service using its own credentials and receives the minimum privileges necessary, then switches to the client’s identity as part of the request
using SSL sessions between the client and the Web Service and between the Web Service and the DBMS service. The other is to create an end-to-end trust relationship where the Web Service simply passes the request it receives from the client to the DBMS service and then simply echoes whatever result the DBMS service returns. Choosing the Identity Mapping Scheme Once you understand the products and configuration you are dealing with, the first decision you need to make in designing your Web Service’s access control strategy is how you are going to map identities to privileges and privileges to resources. Figure 9.7 illustrates the basic options. The answer frequently turns on performance and administrative overhead. Performance is a function of the number of rules involved in making the access decision. Each rule maps an identity (some representation of the client making the request) to a set of privileges to an object, such as a row in a table. The more granular the access and the more entities involved, the more computationally intensive this calculation becomes. The administrative burden comes in the form of how many entities (humans, privileges, and resources) systems administrators must manage. As we go through the various access control options, you will notice different levels of abstraction coming into play to simplify this burden. User-Based Access Control (UBAC)
UBAC maps individual users, or proxies, to privileges and resources [NIST800-12]. The access control question is, does this user have the privileges to perform the requested function against the resources in question? Systems administrators grant
218
Enterprise Web Services Security
privileges to individual users against individual or groups of resources. The number of rules increases rapidly as a function of the number of users and the number of resources. You can reduce the administrative burden by aggregating users and privileges into groups and resources into collections. Most DBMS services support UBAC. Systems administrators set up accounts for each user, using the DBMS’s administrative tool, and map users to privileges and resources. Granularity can be a problem. Most DBMS services support mapping privileges to database objects such as tables, views, and stored procedures, but few go below this level. Some, such as Oracle’s Advanced Security Option (ASO), offer row-level security [OracleLabel04]. If you need this capability and it is not part of the DBMS service you are using, you must implement it yourself either within a stored procedure or as part of your Web Service. Role-Based Access Control (RBAC)
RBAC introduces a level of abstraction by mapping users, privileges, and resources to a common intermediate value, a role [NIST800-12, RBAC04]. The access control question is, does the user making the request share a role with the privileges and resources for which the request is being made? Each role represents a collection of users, a collection of privileges, and a collection of resources. The role presumably has significance and meaning beyond the users and privileges brought together. Roles frequently reflect organizational positions or job functions, based on the premise that users occupying a particular position can perform certain functions. The RBAC strategy requires fewer rules than UBAC because the rules calculation becomes additive rather than multiplicative, as the number of users and resources increases. RBAC degenerates whenever the number of roles is greater than either the number of users or the number of resources. RBAC can degenerate beyond UBAC in situations where both conditions are true. Many DBMS services now natively support RBAC. Under this scheme, systems administrators still create accounts for each user, using the DBMS’s administrative tools, but now they assign that user to one or more roles. Systems administrators or processes-creating resources also map privileges and resources to roles. The access control decision becomes one of marrying the two sets of roles order to make the access decision. One advantage of RBAC is that it allows you to separately manage users and resources; this is important in situations where you are trying to separate administrative functions. If the DBMS service you are using does not support RBAC, an option is to use groups. By mapping users to groups and privileges and resources to the same groups, you can effectively turn group names into roles in a UBAC scheme.
Protecting Messages, Transactions, and Data
219
Rule- or Attribute-Based Access Control (RuBAC)
RuBAC increases the level of abstraction beyond simple RBAC schemes to include arbitrary sets of attributes describing users, privileges, and resources [Rule97]. The access control question is, does this user possess some set of attributes that map to a corresponding set of attributes belonging to the privileges and resources involved? The access control decision function can become extremely complex depending on the numbers and types of attributes involved in making the decision. In the simplest case, you can think of the problem as being one of appending some additional set of constraints to the WHERE clause of every request your Web Service makes against the data source. The other extreme is a complex function that must collect some set of information concerning the user through a series of queries and a corresponding set of information for the privileges and resources, also involving a series of queries, culminating in a matching operation for the decision itself. Oracle’s fine-grained access control options are examples of the capabilities necessary to support RuBAC natively within a DBMS service [OracleLabel04]. Oracle’s Virtual Private Database (VPD) option allows you to implement security policies as functions that can execute at the row level. Oracle’s Label Security builds on VPD to restrict access based on a user’s predefined sensitivity tags or labels. The RuBAC rules function is case specific. Its performance characteristics are a function of the number of attributes and the complexity of the matching function. If you need to use RuBAC, you should estimate the performance overhead early in the design to ensure that you can actually implement the function within acceptable performance ranges. Mandatory Access Controls If you are working on U.S. government projects, especially with the military or the intelligence community, you may run into the concept of mandatory access controls (MACs) [Orange85]. MACs are similar to roles but are based on classification labels. MAC is built on the concept of hierarchical (unclassified, confidential, secret, top secret) and nonhierarchical labels and the concept of dominance. Multilevel environments maintain integrity by enforcing two rules: No read-up: A user in a lower-level domain can only read information at the same or a lower level. No write-down: A user in a higher-level domain can only write down information at the same or a lower level than the lower-level domain. Taken together, these two principles ensure that information only flows vertically or upward, from a security level or sensitivity perspective, in the hierarchy, never downward.
220
Enterprise Web Services Security
Choosing the Access Control Decision Point Once you answer the identity-mapping question, the next question becomes where to actually make the access control decision. Figure 9.10 illustrates the options for implementing the access control decision point. Path A shows the access control decision being made within the context of the Web Service as either part of the service itself or as a call to an external procedure. You would normally choose to implement this decision point as a Java Data Access Object (DAO), EJB, ADO.NET component, or subroutine in order to encapsulate the business logic underlying the decision and to be able to share the function with any Web Service wanting to access the resources in question. Path B moves the access control decision to a stored procedure running within the context of the DBMS service. Path C makes the DBMS service’s access control service the access control decision point. The DBMS service’s access control service should always be the first choice, but that assumes the DBMS service supports the level of granularity and identity mapping scheme you need for your application. The stored procedure implementation would be the second choice, because it aligns with the principle of protecting the resource as close to the resource as possible, but writing stored procedures in SQL-based languages can be difficult. Some products offer Java or some other procedural language for writing stored procedures, which makes this option more attractive. Moving the decision point into your Web Service is the least attractive option, but if the DBMS service doesn’t offer the features you need and a stored procedure isn’t an option, it may be the only choice you have.
Request
Data Access Object
Path A Stored Procedure
Path B Path C
Database DBMS AC Service
Response Web Service
DBMS Service
FIGURE 9.10 Possible access control paths.
Protecting Data as Close to the Source as Possible
We have mentioned several times that you should always protect data as close to the source as possible. Why? In order to reduce risk. The further you move the access control decision point away from the data, the greater the risk that someone will be
Protecting Messages, Transactions, and Data
221
able to successfully attack the data source. Ideally, every piece of data would be selfprotecting, but until that becomes a technical reality, the best you can do is protect data as close to the data source as you can.
SUMMARY In this chapter, we looked at the primary actors involved in creating trust relationships between Web Services clients and servers and the importance of secure channels in ensuring the confidentiality and integrity of the communications between them. We explored the third element of the information security triad, availability, and looked at the key role identity management plays in creating trust relationships and the issues and concerns that authentication, authorization, and access control services must address and some of the tradeoffs they make. In our discussion of identity management, we briefly introduced some of today’s major approaches including passwords and pass-phrases, smart cards, biometrics, certificates, ticketing systems, Microsoft’s Passport, and Liberty Alliance. They all share the goal of allowing one user or process to rely on the asserted identity of another. Authentication is the basic process for validating this asserted identity. We introduced two basic authentication patterns and discussed how they relate to different identity techniques. We delved deeply into the issues of authentication and authorization and the options for performing authentication and authorization decisions on Web, J2EE, and database servers. We also looked in detail at access control, discussing different ways of securing data including user-based, role-based, and rulebased access control. Authorization and access control services are both concerned with mapping identities to privileges, where privileges determine what a user is allowed to see or do, and are therefore closely allied with the concept of authentication.
REFERENCES [ASPAuth04] Microsoft Corporation, “Designing Distributed Applications with Visual Studio .NET, ASP.Net Authentication.” Available online at http://msdn. microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxcon ASPNetAuthentication.asp, 2004. [ASPAuthorize04] Microsoft Corporation, “Designing Distributed Applications with Visual Studio .NET, Authorization.” Available online at http://msdn. microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxcon Authorization.asp, 2004.
222
Enterprise Web Services Security
[CNSS03] CNSS, “National Information Assurance (IA) Glossary, CNSS Instruction No. 4009.” Available online at http://www.cnss.gov/Assets/pdf/cnssi_4012. pdf, May 2003. [FIPS199 03] National Institute of Standards and Technology, “Standards for Security Categorization of Federal Information and Information Systems, Federal Information Processing Standards Publication (FIPS) 199.” Available online at http://csrc.nist.gov/publications/fips/fips199/FIPS-PUB-199-final.pdf, December 2003. [IATF02] Information Assurance Solutions Technical Directors, “Information Assurance Technical Framework Release 3.1.” Available online at http://www. iatf.net/framework_docs/version-3_1/index.cfm, September 2002. [IISAuth04] Microsoft Corporation, “Designing Distributed Applications with Visual Studio .NET, IIS Authentication.” Available online at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconIISAuthentication.asp, 2004. [J2EE04] Armstrong, Eric, et al., “The J2EE 1.4 Tutorial.” Available online at http://java.sun.com/j2ee/1.4/docs/tutorial/doc/J2EETutorial.pdf, August 31, 2004. [JAAS04] Mahmoud, Qusay, “Java Authentication and Authorization Service (JAAS) in Java 2, Standard Edition (J2SE) 1.4.” Available online at http://java. sun.com/j2se/1.4.2/docs/guide/security/jaas/JAASRefGuide.html, August 9, 2004. [Liberty04] Liberty Alliance, “Liberty Alliance Project.” Available online at http:// www.projectliberty.org. [NECCC02] The National Electronic Commerce Coordinating Council, “Identity Management: A White Paper.” Available online at http://www.ec3.org/ Downloads/2002/id_management.pdf, December 4–6, 2002. [NIST800-12] National Institutes of Standards and Technologies, “An Introduction to Computer Security: The NIST Handbook.” NIST Special Publication 800-12. Available online at http://csrc.nist.gov/publications/nistpubs/80012/handbook.pdf, October 1995. [NIST800-33] National Institute of Standards and Technology, “Underlying Technical Models for Information Technology Security,” NIST Special Publication 800-33. Available online at http://csrc.nist.gov/publications/nistpubs/80033/sp800-33.pdf, December 2001. [NIST800-63] National Institutes of Standards and Technologies, “Electronic Authentication Guidelines,” NIST Special Publication 800-63 Version 1.0.1. Available online at http://csrc.nist.gov/publications/nistpubs/800-63/SP80063v6_3_3.pdf, September 2004. [OracleASO01] Oracle Corporation, “Oracle Advanced Security 9i: Enterprise User Security: An Oracle Whitepaper.” Available online at http://www.oracle. com/technology/deploy/Security/aso/pdf/EUS901.doc, August 2001.
Protecting Messages, Transactions, and Data
223
[OracleLabel04] Oracle Corporation, “Oracle Label Security: An Oracle Data Sheet.” Available online at http://www.oracle.com/technology/deploy/Security/ pdf/ds_security_db_labelsecurity_10r1_0104.pdf, January 2004. [Orange85] Brand, S., et al., “Department of Defense Trusted Computer System Evaluation Criteria.” Available online at http://www.fas.org/irp/nsa/rainbow/ std001.htm, December 1985. [OSI94] International Standards Organization, “ISO 7498-1 Information Processing Systems—Open Systems Interconnection—Basic Reference Model: The Basic Model, Technical Report.” International Standards Organization, 1994. [PAM96] Samar, Vipin, “Unified Login with Pluggable Authentication Modules (PAM).” CCS ’96, New Delhi, India. Available online at http://portal.acm. org/citation.cfm?id=238177. [Passport04] Microsoft Corporation, “Microsoft .NET Passport.” Available online at http://www.passport.net/. [RBAC04] American National Standards Institute, “Role-based Access Control.” Document Number ANSI/INCITS 359-2004. Available online at http://csrc. nist.gov/rbac/, February 3, 2004. [RFC1510] Kohl, J., et al., “The Kerberos Network Authentication Service (V5).” Available online at http://www.ietf.org/rfc/rfc1510.txt, September 1993. [RFC2246] Dierks, T. and C. Allen, “The TLS Protocol Version 1.0.” Available online at http://www.ietf.org/rfc/rfc2246.txt, January 1999. [RFC2251] Wahl, M. et al., “Lightweight Directory Access Protocol (v3).” Available online at http://www.ietf.org/rfc/rfc2251.txt, December 1997. [RFC2459] Houslet, R., et al., “Internet X.509 Public Key Infrastructure Certificate and CRL Profile.” Available online at http://www.ietf.org/rfc/rfc2459.txt, January 1999. [RFC2617] Franks, J., et al., “HTTP Authentication: Basic and Digest Access Authentication.” Available online from http://www.ietf.org/rfc/rfc2617.txt, June 1999. [RFC2818] Rescorla, E., “HTTP Over TLS.” Available online at http://www. ietf.org/rfc/rfc2818.txt, May 2000. [Rule97] Didriksen, Tor, Rule-based Database Access Control—A Practical Approach, ACM Workshop on Role Based Access Control, ACM Press, 1997. Available online at http://portal.acm.org/citation.cfm?id=266772. [SAML04] Hughes, John, et al., “Technical Overview of the OASIS Security Assertion Markup Language (SAML) V1.1.” Available online at http://www.oasisopen.org/committees/documents.php?wg_abbrev=security, May 11, 2004. [SQLServer03] Chander, Girish, et al., “SQL Server 2000 SP3 Security Features and Best Practices.” Available online at http://www.microsoft.com/technet/ prodtechnol/sql/2000/maintain/sp3sec00.mspx, May 16, 2003.
224
Enterprise Web Services Security
[Stallings95] Stallings, William, Network and Internetwork Security: Principles and Practice. Prentice Hall, 1995. [Websters04] Merriam Webster, “Merriam Webster Online.” Available online at http://www.m-w.com. [WSFederation03] Bajaj, Siddharth, et al., “Web Services Federation Language (WS-Federation).” Available online at http://www-106.ibm.com/developerworks/webservices/library/ws-fed/, July 8, 2003. [WSReferal01] Nielsen, Henrik F., et al., “Web Services Referral Protocol (WSReferral).” Available online at http://msdn.microsoft.com/ws/2001/10/Referral/, October 23, 2001. [WSRouting01] Nielsen, Henrik F. and Satish Thatte, “Web Services Routing Protocol (WS-Routing).” Available online at http://msdn.microsoft.com/ws/ 2001/10/Routing/, October 23, 2001. [WSSecurity04] Nadalin, Anthony, et al., “Web Services Security: SOAP Message Security 1.0 (WS-Security 2004).”. Available online at http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0.pdf, March 15, 2004. [WSTrust04] Anderson, Steve, et al., “Web Services Trust Language (WS-Trust) Version 1.1.” Available online at http://www-106.ibm.com/developerworks/ library/ws-trust/, May 2004. [XACML03] Godik, Simon, et al., “eXtensible Access Control Markup Language (XACML) Version 1.0.” Available online at http://www.oasis-open.org/ committees/documents.php/2406/OASIS-XACML-1.0.pdf, February 18, 2003.
10
Implementing the Information Security Triad
In This Chapter Confidentiality Integrity Summary References
n the last chapter, we began our discussion of the three important concepts of information security: confidentiality, integrity, and availability with a focus on availability. In this chapter, we turn our attention to the other two elements: confidentiality and integrity. Confidentiality controls are responsible for ensuring that information is protected from unauthorized access. In our discussion of availability, we discussed the importance of and options for mapping identities to privileges and the use of privileges to control access. In our discussion of confidentiality, we will look at mechanisms for protecting information even from parties we cannot identify and in situations where we cannot even control their access to the information. Integrity controls complement confidentiality controls in providing mechanisms for guaranteeing message validity and detecting tampering even if control is lost over a message or its content. In this chapter we will discuss how each
I
225
226
Enterprise Web Services Security
of the three aspects of the confidentiality-integrity-availability (CIA) triad can be enforced using the controls that are available to a Web Services system and its supporting infrastructure. The important technical mechanisms for enforcing security are presented in detail to help you choose the appropriate technology for your environment and specific concerns.
CONFIDENTIALITY One of the three elements of the information security triad is enforcement of confidentiality. Like most terms of art, this one has a meaning that is precise but that is easily misunderstood by those who have not been initiated. Most people think of confidentiality as being equivalent to secrecy, but there is a difference. Given a piece of information that you know, you keep it secret by not telling anyone. As long as you never reveal it, the information is secret (unless, of course, someone can find it out by some other means). Confidentiality is different because it usually involves the controlled disclosure of the information being protected. In most situations involving confidentiality protection, you want to reveal the information to another person while protecting that information from third parties who want to snoop on your information exchange. In concrete terms, you want to reveal your secret to someone and expect the system to make sure that nobody else is able to eavesdrop on that disclosure. Whatever technology provides you with confidentiality protection must allow for a controlled release of information. We talk about “controlled release” because you must reveal the information to someone for it to be used. If it’s never released for use, it’s confidential but not very useful. We control the release of the information for use so that only the people who need access to the information are allowed to use it. The system must enforce the rule that only people who have authorization to access the information are allowed to see it. The question is, “how do we provide this sort of protection?” In most instances where we talk about confidentiality protection, the answer is to use some form of encryption. Encryption is one of the ways that WS-Security provides protection for Web Service messages. Encryption Encryption systems have been in use for centuries. They are used to thwart interception attacks, which are situations where a third party gains access to the information and can act upon it. The components of a basic encryption system are shown in Figure 10.1, which introduces several of the terms used with encryption. The message the users wish to share is called the plaintext (plain as in normal format, understandable by the owner or the owner’s application) or cleartext. An encryption
Implementing the Information Security Triad
227
algorithm (such as the Advanced Encryption Standard [AES], the Data Encryption Standard [DES], or Rivest, Shamir, and Adelman [RSA]) processes the plaintext. The encryption algorithm uses an encryption key to transform the plaintext into ciphertext, which is constructed from the plaintext by some method that obscures the original plaintext. The transformation between the plaintext and the ciphertext depends upon the value of the encryption key. The ciphertext is transmitted between the two parties over some means (a network, a floppy disk, USB key, etc.; the transport isn’t important). A decryption algorithm uses the decryption key to transform the ciphertext back into the original plaintext. For many practical encryption systems, things are simpler than Figure 10.1 shows. One common simplification used by many systems is that the same key is used for both encryption and decryption. The users of the system must simply agree upon a single shared key to use for encrypting communications between them. Also, the encryption and decryption algorithms are usually the same. To decrypt, you run the algorithm in reverse, which performs a sort of “un-do” operation, reversing the changes that lead to the ciphertext.
Plaintext Input
Encryption Algorithm
Transmitted Ciphertext
Encryption Key
Encryption Algorithm
Plaintext Output
Decryption Key
FIGURE 10.1 A basic encryption scheme.
The purpose of the cryptosystem shown in Figure 10.1 is to protect the plaintext message while allowing the parties to share that message. For a network transmission, we normally assume that the network between the sender and the receiver is insecure, allowing an eavesdropper to read the ciphertext. We also assume that the attacker knows the encryption algorithm being used. Therefore, the protection of the plaintext lies entirely in the strength of the encryption algorithm and the secrecy of
228
Enterprise Web Services Security
the encryption key. You will notice that we have a “chicken and egg” situation where the parties must exchange the encryption key in secret prior to the use of that key in encrypted sessions. There must be some way outside of the normal data transfer for that key exchange to take place. If an eavesdropper were to observe the key exchange, the encryption would serve no purpose, as the eavesdropper could simply apply the (known) decryption algorithm and key to read the messages. If one looks at Figure 10.1 from the point of view of people who want to eavesdrop on the message, there are several other places where they may mount an attack. First, if they can read the message before the sender encrypts it, the encryption process does the users no good. They can also mount this attack on the receiving system after the message has been decrypted. Another method is for them to sniff the encrypted data in transit. If they are able to store enough encrypted data, they may be able to mount a statistical attack against the plaintext. Simply knowing that a message has been sent may provide information on its own. If the two parties are a company and a customer, the message exchange probably represents the purchase of a product, for example. An encryption algorithm takes an input stream (a stream is a series of bits) and processes it to create a ciphertext stream. The two classes of cryptographic algorithms are called block ciphers and stream ciphers. A block cipher works on one block of input data at a time (common block sizes are 64, 128, and 512 bits). Plaintext input is read until a buffer is full, and then that buffer is passed to the encryption algorithm for encryption. The output of the encryption algorithm is a block of data, usually the same size as the input buffer. A stream of input data must be collected until a block is filled before a ciphertext block is issued. If there is not enough data to fill a block, a block cipher must pad the input data by adding extra bits to fill in for the missing bits. Some mechanism must be employed to remove the pad when the block is decrypted. On the other hand, stream ciphers work on the input one byte at a time, emitting a ciphertext byte immediately upon receipt of each plaintext byte. Encryption systems are expected to resist attempts to decode the information in the ciphertext in order to determine the plaintext. Cryptanalysts are concerned with attempting to find ways to decrypt private communications; cryptographers try to create cryptosystems that resist cryptanalysis. Cryptosystems can be attacked in several ways, in increasing usefulness to the attacker: Ciphertext Only: The analyst has access to the ciphertext and knows the encryption algorithm being used. Known Plaintext Attacks: The analyst knows the plaintext and corresponding ciphertext.
Implementing the Information Security Triad
229
Chosen Plaintext Attacks: The analyst can choose a plaintext message and learn the corresponding ciphertext. Chosen Ciphertext Attacks: The analyst has access to plaintext-ciphertext pairs and is allowed to choose the ciphertext result. Ciphertext-only attacks are the most difficult to mount, as the cryptanalyst has the most limited knowledge. As one proceeds down the list above, the effectiveness of the attack improves because the attacker has more information to work with. Clearly, it is unlikely that anyone will permit an attacker the sort of access implied by chosen text attacks, but the other attacks are practical. For example, it is very likely that an attacker can choose the plaintext if he is able to enter a transaction into a system and observe the resulting ciphertext. Another way in which known plaintext attacks become practical are when they are mounted against virtual private network (network encryption) schemes. Every IP packet sent over a network has an IP header that has the same first few bytes (these give the IP version number, which is 4 for most current Internet traffic, and the header length, which is usually five octets in length). These and other header contents are sufficiently regular to provide an avenue for known plaintext attacks. The attacker can use this technique to probe the statistical properties of the ciphertext. This attack involves making small changes to the plaintext while looking for the corresponding changes in the ciphertext, hoping that such changes will provide insight that allows derivation of the key. To avoid these sorts of attacks, a strong cryptographic system attempts to avoid statistical correlation between the plaintext and the ciphertext. If an attacker is able to relate bits of the input to corresponding bits of the output, that relationship may provide help derive the associated key. Consequently, expectations are placed on cryptosystems that help analysts decide whether a system is worthy of use. These help measure how well the system avoids correlations between input and output. First, a system is expected to avoid correlation between changes in input bits and changes to output bits. This allows the system to avoid tracking plaintext bits when ciphertext bits are known. Usually this is performed by operations that switch bit positions multiple times; this technique is called confusion. A highly confused output cannot be used to determine information about the input. Another technique is to ensure that a change to a single input bit causes multiple changes in the output. Ideally, a single bit change to the plaintext would change all the ciphertext output bits. This technique, called diffusion, also avoids attacks based on small input changes. A strong cryptosystem uses both diffusion and confusion in multiple steps, called rounds, which mash the data in unpredictable ways that resist cryptanalysis. In the absence of a statistical attack, cryptanalysis is limited to brute-force key attempts. A good cryptographic system ensures that these attacks are impractical, as described below.
230
Enterprise Web Services Security
Symmetric and Asymmetric Key
There are two different classes of cryptographic systems in common use today. Almost all bulk encryption systems in common use today (those used to encrypt large amounts of data, or those where performance matters, such as virtual private network [VPNs]) use symmetric key encryption. The distinction between these systems is that a symmetric key system uses the same key value for encryption as the key used for decryption. Only one key need be shared between users for such a system to work. Asymmetric key systems use different encryption and decryption keys or different encryption and decryption schemes. Commonly used symmetric key algorithms are the AES, the older DES and the RC4® cipher. The most common asymmetric key ciphers are the Diffie-Hellman and RSA systems, which will be described later. Symmetric key systems are easy to use and manage and easy for most people to understand. The cryptograms printed in your daily paper use a symmetric key that is the correspondence between the plaintext letter and the ciphertext letter. (Incidentally, the fact that these cryptograms use a fixed transposition between plaintext and ciphertext is what makes them easy to solve: they have the same letter frequency as plain English text, where “e” is the most common letter.) Bulk encryption algorithms such as AES and DES use this method. The key used for encryption is simply fed into the same algorithm used in reverse in order to decrypt the ciphertext. These are (relatively) simple systems for people to understand because they usually do something to scramble the plaintext and do the same thing again to recover the plaintext. Just about all of the early cryptographic systems used symmetric, shared keys. The simplicity of these systems is their downfall, however. When you attempt to implement a symmetric cryptographic system for a large community of users, you immediately run into the problem of key distribution. The key distribution problem is easily illustrated. While a simple exchange between parties A and B (usually referred to as Alice and Bob) only requires one key shared by Alice and Bob, a system with six users (Alice, Bob, Charley, Dave, Ed, Frank, and George) requires 15 keys. The formula for the number of keys needed is
(n)(n - 1) , 2
where n is the number of users. Why are different keys used for each
pair of users? Because it allows Alice to send something to Bob that Charley, Dave, and so forth can’t also read. Using one key would mean that everyone could read everything, leading to the large number of keys illustrated. For a company with 500 users who wish to communicate confidentially, this means someone must manage 124,750 keys. Worse, when employees join or leave the company, all their keys with other users must be either issued (for the new employee) or invalidated (for the person leaving the organization). You would need a full-time employee to issue, distribute, and invalidate keys. This key management issue is why almost all widely used systems use asymmetric cryptography. (We say
Implementing the Information Security Triad
231
“almost all” because there is a well-known counterexample: the systems banks use to support funds transfer uses symmetric, individually configured encryption keys. This is an example of how impracticality need not be a barrier if there’s enough money involved. The ability to withdraw money from your checking account in almost any industrialized country demonstrates that the system works well despite how practical it may or may not be.) An asymmetric cryptographic system attempts to work around the key management problem by reducing the number of keys that need to be transferred for the system to work. In such a system, every user is assigned at least one pair of related keys. One key is used to encrypt data being sent to that user; the other key is used to decrypt the user’s data. The information cannot be decrypted without the user’s key, which corresponds to the key that was used to encrypt it. Knowing the encryption key does not help in decrypting the message. These systems are built upon a system that relates multiple (usually three) pieces of information. One is a common modulus used for mathematical operations, and the others are a related pair of encryption and decryption keys that are associated with that modulus value. A user’s encryption key and the modulus are published as the public key for that user. The term publish is important, as anyone is allowed to know that public key information. That information could be printed in a newspaper without compromising any information that is encrypted using that key information, so it can be sent to the public key owner. The owner of that key is the only person who knows the private key that corresponds to the public key. The private key uses the same modulus but uses a decryption value known only by the owner of the public key that can be used to decrypt information that was encrypted using the public value and modulus. The advantage of a public key system is that only one piece of information need be published for each user. A directory system can be set up to store the public key data for each user of the system; given access to the directory, any user on the system can communicate confidentially with every other user. Invalidation is also easy because removing the user’s entry from the directory system immediately stops all users from sending that user encrypted data (equivalently, new employees are introduced to everyone by publishing them in the directory). Asymmetric key systems usually publish user identity by use of certificates. A certificate contains the owner’s identity information (name, company ID number, department, etc.) along with his public key encryption data and modulus. The content of the certificate is attested to and protected from tampering by using a digital signature (which will be described later). The purpose of digital certificates is often confusing to people just being introduced to cryptographic systems. It is important to remember that a certificate only contains public information. Anything in a certificate is information that anyone could be allowed to know without compromising the owner’s private information. The associated private key value is the only
232
Enterprise Web Services Security
information that the certificate owner must protect. Note that the side effects of private key compromise are much less serious than those with a symmetric key system. If a symmetric key user loses his or her key, everyone else in the system must be notified to not use that key any longer. For a public key system, all the user must do is to publish a new public key pair (associated with his new private key.) Key Strength Comparisons
The primary measure of the strength of a cryptographic system is the key size (or key length). (However, see the discussion of “snake oil” below.) If the system is properly defined, adding an additional key bit doubles the strength of the system; that is, twice as much work must be done to break the key. It’s difficult for most people to understand the value of such doubling and how quickly it increases the strength of the underlying crypto. Our gut reaction is that a simple change that adds a few bits doesn’t improve things much. To demonstrate this problem, consider the following scenario: you are offered a job for a single month with 31 days. You are offered the following options for your pay: 1. One thousand dollars for each work day 2. One penny for day one, doubled to two cents for day two, and doubled again (to four cents) for day three, etc. Most people would intuitively choose the first option, which earns them $31,000 by the time the month is out. However, it’s easy to point out the failure of the intuition. If you choose the penny doubling pay, you’re pretty miserable by the end of the first week. You’ve only received 64 cents for your day’s work at the end of the first week. After two weeks, it’s still not very positive, as on day fourteen, you’re still only getting $81.92 for the day. It’s not until day 18 that you finally start to catch up, with $1317.02 for the day, which is still far behind the $18,000 the other people have received. However, week three starts to look better because you collect $10,485.76, allowing you to start to catch up to the opponent. If you calculate your pay for the last day of the month ($10,7